From 74b7c39473d4ad4dde8833174136d08c55b35c2d Mon Sep 17 00:00:00 2001 From: "f.grunewald" Date: Tue, 19 Sep 2023 14:55:56 +0200 Subject: [PATCH 1/2] fix pdb box --- vermouth/pdb/pdb.py | 2 +- vermouth/tests/pdb/test_read_pdb.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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..d8a78d411 100644 --- a/vermouth/tests/pdb/test_read_pdb.py +++ b/vermouth/tests/pdb/test_read_pdb.py @@ -236,7 +236,7 @@ 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 @@ -248,7 +248,7 @@ def test_atom_attributes(): "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 @@ -260,7 +260,7 @@ def test_atom_attributes(): 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) From 3019793d9a3ff230cc557911a69943f53a6e9379 Mon Sep 17 00:00:00 2001 From: "f.grunewald" Date: Tue, 19 Sep 2023 15:12:04 +0200 Subject: [PATCH 2/2] adjust pdb box test --- vermouth/tests/pdb/test_read_pdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vermouth/tests/pdb/test_read_pdb.py b/vermouth/tests/pdb/test_read_pdb.py index d8a78d411..a651f15af 100644 --- a/vermouth/tests/pdb/test_read_pdb.py +++ b/vermouth/tests/pdb/test_read_pdb.py @@ -243,7 +243,7 @@ def test_atom_attributes(): 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} ), @@ -255,7 +255,7 @@ def test_atom_attributes(): 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()