Acellera / moleculekit

MoleculeKit: Your favorite molecule manipulation kit
Other
198 stars 37 forks source link

Wrapping bug puts water atoms way outside the box in a small set of frames #102

Closed AdriaPerezCulubret closed 2 years ago

AdriaPerezCulubret commented 2 years ago

Found an issue when wrapping a trajectory, where in 9 frames out of 75800000, a water atom was incorrectly located outside the simulation box.

In [5]: for sim in tqdm.tqdm(sims):
   ...:     prodrun = sim.split("/")[-2]
   ...:     mol = Molecule(f"{simpath}/{prodrun}/structure.prmtop")
   ...:     mol.read(sim, skip=1)
   ...:     mol.wrap("protein or resname ACE NME")
   ...:     mol.align("protein or resname ACE NME", refmol=mol_ref)
   ...:     mol.filter("resname WAT and name O")
   ...:     wat_xyz.append(mol.coords.copy())
   ...: 
   ...: wat_xyz = np.concatenate(wat_xyz)
   ...: wat_xyz = np.concatenate(wat_xyz, axis=1).T

In [10]: for i in range(3):
    ...:     print(np.min(wat_xyz[:, i]), np.max(wat_xyz[:, i]))
    ...: 
-720.43494 137.29675
-339.72385 773.0217
-800.0154 230.26523

In [14]: mol.box[:, 0]
Out[14]: array([99.575035, 99.57701 , 99.57799 ], dtype=float32)
stefdoerr commented 2 years ago

Fixed by https://github.com/Acellera/moleculekit/commit/c162c649917fe2440b75033dab58b97609d1b9ff