I have a simulation trajectory from DFTB+ for 1 NaNO3 in 32 H2O molecules. The trajectory is in xyz format and I converted a frame of xyz to pdb using openbabel to serve as topology input.

I am following the instructions from the solvation analysis package documentation. However, I keep getting an assertion error

All residues must have the same length

I don't know how to get past this. My codes are pasted below from my Jupyter notebook.

import MDAnalysis as mda
u=mda.Universe("./single-frame-1NaNO3-32-H2O.pdb", "./nano3-1-water-32-some-frames.xyz")
import solvation_analysis
nano3Atoms=u.atoms.select_atoms("id 1 or id 2 or id 3 or id 4 or id 5")
oAtomsWater=u.atoms.select_atoms("type O and resname HOH")
hAtomsWater=u.atoms.select_atoms("type H and resname HOH")
solventAtoms=u.atoms - nano3Atoms

from solvation_analysis.solute import Solute

All the intermediate steps seem to present reasonable outputs with nano3Atoms showing all atoms that correspond to NaNO3. The last step when soluteObject is defined is when the assertion error is thrown. Any help would be greatly appreciated.

A pdb file and some frames from the simulation output are presented here. Thank you,

  • 1
    $\begingroup$ You may have more success asking directly on the github discussion board for MDAnalysis: github.com/MDAnalysis/mdanalysis/discussions/categories/q-a. $\endgroup$ Commented Feb 26 at 23:21
  • $\begingroup$ Thanks for this suggestion. I posted my question at the discussion board. $\endgroup$
    – bhopshang
    Commented Feb 28 at 17:20
  • $\begingroup$ Try using the MDAnalysis write function to visualize the solvent atoms to see if they're what they should be, I ran into the same problem, if you had figured it out please teach me how. Thank you $\endgroup$
    – Anh Nguyen
    Commented Feb 28 at 20:19


You must log in to answer this question.