Skip to content

Commit

Permalink
Merge pull request #544 from marrink-lab/fix/box2
Browse files Browse the repository at this point in the history
fix pdb box
  • Loading branch information
pckroon authored Sep 19, 2023
2 parents c14cf44 + 3019793 commit 72766a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion vermouth/pdb/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def _finish_molecule(self, line="", lineno=0):
if {"a", "b", "c"}.issubset(set(self.cryst.keys())):
self.active_molecule.box = np.array([self.cryst['a']/10.,
self.cryst['b']/10.,
self.cryst['b']/10.])
self.cryst['c']/10.])
self.molecules.append(self.active_molecule)
self.active_molecule = Molecule()

Expand Down
10 changes: 5 additions & 5 deletions vermouth/tests/pdb/test_read_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,31 +236,31 @@ def test_atom_attributes():

@pytest.mark.parametrize('pdbstr, cryst_dict', (
# complete directive
('''CRYST1 77.987 77.987 77.987 90.00 90.00 90.00 P 1 1
('''CRYST1 77.987 87.987 97.987 90.00 90.00 90.00 P 1 1
MODEL 1
ATOM 1 EO PEO 0 74.550 37.470 22.790 1.00 0.00
ATOM 2 EO PEO 1 77.020 38.150 25.000 1.00 0.00
ATOM 3 EO PEO 2 76.390 37.180 28.130 1.00 0.00
ATOM 4 EO PEO 3 75.430 37.920 31.450 1.00 0.00
''',
{"a": 77.987, "b": 77.987, "c": 77.987,
{"a": 77.987, "b": 87.987, "c": 97.987,
"alpha": 90.0, "beta": 90.0, "gamma": 90,
"space_group": "P 1", "z_value": 1}
),
# incomplete directive
('''CRYST1 77.987 77.987 77.987
('''CRYST1 77.987 87.987 97.987
MODEL 1
ATOM 1 EO PEO 0 74.550 37.470 22.790 1.00 0.00
ATOM 2 EO PEO 1 77.020 38.150 25.000 1.00 0.00
ATOM 3 EO PEO 2 76.390 37.180 28.130 1.00 0.00
ATOM 4 EO PEO 3 75.430 37.920 31.450 1.00 0.00
''',
{"a": 77.987, "b": 77.987, "c": 77.987,}
{"a": 77.987, "b": 87.987, "c": 97.987,}
)))
def test_cryst1(caplog, pdbstr, cryst_dict):
parser = PDBParser()
mols = list(parser.parse(pdbstr.splitlines()))
assert np.all(np.isclose(mols[0].box, np.array([7.7987, 7.7987, 7.7987])))
assert np.all(np.isclose(mols[0].box, np.array([7.7987, 8.7987, 9.7987])))
assert parser.cryst == cryst_dict
if len(cryst_dict) < 8:
assert any(rec.levelname == 'WARNING' for rec in caplog.records)

0 comments on commit 72766a2

Please sign in to comment.