1
"""
2
Tests the dummy atoms utilities.
3
"""
4

5 38
import os
6

7 38
import parmed as pmd
8

9 38
import paprika.dummy as dummy
10 38
from paprika.align import zalign
11

12

13 38
def test_extract_dummy():
14 38
    cb6 = pmd.load_file(
15
        os.path.join(os.path.dirname(__file__), "../data/cb6-but/vac.pdb")
16
    )
17 38
    aligned_cb6 = zalign(cb6, ":CB6", ":BUT")
18 38
    aligned_cb6 = dummy.add_dummy(aligned_cb6, residue_name="DM1", z=-6.0)
19 38
    aligned_cb6 = dummy.add_dummy(aligned_cb6, residue_name="DM2", z=-9.0)
20 38
    aligned_cb6 = dummy.add_dummy(aligned_cb6, residue_name="DM3", z=-11.2, y=2.2)
21

22 38
    dm_index = []
23 38
    for atom in aligned_cb6.topology.atoms():
24 38
        if atom.residue.name in ["DM1", "DM2", "DM3"]:
25 38
            dm_index.append(atom.index)
26

27 38
    assert len(dm_index) != 0
28

29 38
    dummy_dict = dummy.extract_dummy_atoms(aligned_cb6, serial=False)
30

31 38
    assert all(dummy_dict["DM1"]["pos"] == [0.0, 0.0, -6.0])
32 38
    assert all(dummy_dict["DM2"]["pos"] == [0.0, 0.0, -9.0])
33 38
    assert all(dummy_dict["DM3"]["pos"] == [0.0, 2.2, -11.2])
34

35 38
    assert dummy_dict["DM1"]["mass"] == 208.0
36 38
    assert dummy_dict["DM2"]["mass"] == 208.0
37 38
    assert dummy_dict["DM3"]["mass"] == 208.0
38

39 38
    assert dummy_dict["DM1"]["idx"] == dm_index[0]
40 38
    assert dummy_dict["DM2"]["idx"] == dm_index[1]
41 38
    assert dummy_dict["DM3"]["idx"] == dm_index[2]

Read our documentation on viewing source code .

Loading