Skip to content

Commit 6d06082

Browse files
committed
added tests for triclinic box wrapping modes
1 parent b3dbb88 commit 6d06082

File tree

6 files changed

+27
-1
lines changed

6 files changed

+27
-1
lines changed

moleculekit/molecule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3623,7 +3623,7 @@ def test_append_inverse_collisions(self):
36233623
assert new_n_waters == (n_waters - 6) # No waters were killed
36243624
assert (n_lipids - new_n_lipids) == 1 * popc_n_atoms # 1 lipid removed
36253625

3626-
def test_wrapping(self):
3626+
def test_orthogonal_wrapping(self):
36273627
from moleculekit.home import home
36283628

36293629
homedir = home(dataDir="test-wrapping")

tests/dodecahedral_box

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../moleculekit/test-data/molecule-readers/dodecahedral_box

tests/test_wrapping.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from moleculekit.molecule import Molecule
2+
import numpy as np
3+
import os
4+
5+
curr_dir = os.path.dirname(os.path.abspath(__file__))
6+
7+
8+
def _test_triclinic_wrapping():
9+
refdir = os.path.join(curr_dir, "dodecahedral_box")
10+
mol = Molecule(os.path.join(refdir, "3ptb_dodecahedron.psf"))
11+
12+
mol.read(os.path.join(refdir, "output.xtc"))
13+
mol.wrap(wrapsel="protein", unitcell="triclinic")
14+
refcoords = Molecule(os.path.join(refdir, "output_triclinic_wrapped.xtc"))
15+
assert np.max(np.abs(mol.coords - refcoords.coords)) < 1e-2
16+
17+
mol.read(os.path.join(refdir, "output.xtc"))
18+
mol.wrap(wrapsel="protein", unitcell="compact")
19+
refcoords = Molecule(os.path.join(refdir, "output_compact_wrapped.xtc"))
20+
assert np.max(np.abs(mol.coords - refcoords.coords)) < 1e-2
21+
22+
mol.read(os.path.join(refdir, "output.xtc"))
23+
mol.wrap(wrapsel="protein", unitcell="rectangular")
24+
refcoords = Molecule(os.path.join(refdir, "output_rectangular_wrapped.xtc"))
25+
assert np.max(np.abs(mol.coords - refcoords.coords)) < 1e-2

0 commit comments

Comments
 (0)