diff --git a/vermouth/pdb/pdb.py b/vermouth/pdb/pdb.py index 715a3ac56..4963ce938 100644 --- a/vermouth/pdb/pdb.py +++ b/vermouth/pdb/pdb.py @@ -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() diff --git a/vermouth/tests/pdb/test_read_pdb.py b/vermouth/tests/pdb/test_read_pdb.py index 86e6c844f..a651f15af 100644 --- a/vermouth/tests/pdb/test_read_pdb.py +++ b/vermouth/tests/pdb/test_read_pdb.py @@ -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)