-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I am hoping to use the Sire trajectory interface to parallelise the setup of ABFE replica exchange simulations in BioSimSpace. This would give a highly parallelised way of reading and writing the input and output coordinates for each replica. This seems to work fine for AMBER format coordinate files, e.g.:
In [1]: import sire as sr
In [2]: mols = sr.load("input/system.prm7", "input/traj.dcd")
In [3]: mols.num_frames()
Out[3]: 100
In [4]: sr.save(mols.trajectory(), "frame.rst7")
Out[4]: ['/home/lester/Code/openbiosim/biosimspace/abfe_setup/frame.rst7']
In [5]: new_mols = sr.load("input/system.prm7", "frame.rst7/*")
In [6]: new_mols.num_frames()
Out[6]: 100
In [7]: for frame in new_mols.trajectory()[:10]:
...: print(frame)
...:
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )
System( name=ACE num_molecules=631 num_residues=633 num_atoms=1912 )but fails when using Gro87 format:
In [1]: import sire as sr
In [2]: mols = sr.load("input/system.top", "input/traj.xtc")
In [3]: mols.num_frames()
Out[3]: 100
In [4]: sr.save(mols.trajectory(), "frame.gro")
Out[4]: ['/home/lester/Code/openbiosim/biosimspace/abfe_setup/frame.gro']
In [5]: new_mols = sr.load("input/system.top", "frame.gro/*")
In [6]: new_mols.num_frames()
Out[6]: 100
In [7]: for frame in new_mols.trajectory()[:10]:
...: print(frame)
...:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1 │
│ │
│ /home/lester/.conda/envs/openbiosim/lib/python3.12/site-packages/sire/mol/_trajectory.py:159 in │
│ __next__ │
│ │
│ 156 │ │ │
│ 157 │ │ self._frame = self._iter.__next__() │
│ 158 │ │ │
│ ❱ 159 │ │ return self.current() │
│ 160 │ │
│ 161 │ def __len__(self): │
│ 162 │ │ return len(self._values) │
│ │
│ /home/lester/.conda/envs/openbiosim/lib/python3.12/site-packages/sire/mol/_trajectory.py:283 in │
│ current │
│ │
│ 280 │ │ │ map = self._map.clone() │
│ 281 │ │ │ map.set("transform", self._aligner[self._frame]) │
│ 282 │ │ │
│ ❱ 283 │ │ ret.load_frame(self._frame, map=map) │
│ 284 │ │ │
│ 285 │ │ try: │
│ 286 │ │ │ mol = ret.molecule() │
│ │
│ /home/lester/.conda/envs/openbiosim/lib/python3.12/site-packages/sire/system/_system.py:185 in │
│ load_frame │
│ │
│ 182 │ │ """Load the ith frame into this System""" │
│ 183 │ │ from ..base import create_map │
│ 184 │ │ │
│ ❱ 185 │ │ self._system.load_frame(i, map=create_map(map)) │
│ 186 │ │ self._molecules = None │
│ 187 │ │
│ 188 │ def save_frame(self, i=None, map=None): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: SireError::incompatible_error: Cannot subset a Frame of length 0 using start 259, count 3. (call
sire.error.get_last_error_details() for more info)The Gro87 files were definitely written correctly. I'm wondering whether this is because the files don't contain a time stamp, which is somehow being used to index the frames?
Inputs can be found here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working