Example #1
0
def test_raise_residue_error(top_lines):
    lines = textwrap.dedent(top_lines)
    lines = lines.splitlines()
    force_field = ForceField("test")
    topology = Topology(force_field)
    read_topology(lines=lines, topology=topology, cwdir="./")
    topology.preprocess()
    topology.volumes = {"GLY": 0.53, "GLU": 0.67, "ASP": 0.43}
    with pytest.raises(IOError):
        polyply.src.check_residue_equivalence.check_residue_equivalence(
            topology)
Example #2
0
def example_topology():
    top_lines = """
    [ defaults ]
    1   1   no   1.0     1.0
    [ atomtypes ]
    N0 45.0 0.000 A 0.0 0.0
    [ nonbond_params ]
    N0   N0   1 4.700000e-01    3.700000e+00
    [ moleculetype ]
    testA 1
    [ atoms ]
    1    N0  1   GLY    BB   1 0.00     45
    2    N0  1   GLY    SC1  1 0.00     45
    3    N0  1   GLY    SC2  1 0.00     45
    4    N0  2   GLU    BB   2 0.00     45
    5    N0  2   GLU    SC1  2 0.00     45
    6    N0  2   GLU    SC2  2 0.00     45
    [ bonds ]
    1    2    1  0.47 2000
    2    3    1  0.47 2000
    1    4    1  0.47 2000
    4    5    1  0.47 2000
    4    6    1  0.47 2000
    [ moleculetype ]
    testB 1
    [ atoms ]
    1    N0  1   ASP    BB   1 0.00
    2    N0  1   ASP    SC1  1 0.00
    3    N0  1   ASP    SC2  1 0.00
    [ bonds ]
    1    2    1  0.47 2000
    2    3    1  0.47 2000
    [ system ]
    test system
    [ molecules ]
    testA 2
    testB 1
    """
    lines = textwrap.dedent(top_lines)
    lines = lines.splitlines()
    force_field = ForceField("test")
    topology = Topology(force_field)
    read_topology(lines=lines, topology=topology, cwdir="./")
    topology.preprocess()
    topology.volumes = {"GLY": 0.53, "GLU": 0.67, "ASP": 0.43}
    return topology
Example #3
0
def test_raise_residue_no_error():
    """
    This test makes sure that we actually skip molecules that are defined
    in the top file but not used in the actual system.
    """
    top_lines = """
    [ defaults ]
    1   1   no   1.0     1.0
    [ atomtypes ]
    N0 72.0 0.000 A 0.0 0.0
    N1 72.0 0.000 A 0.0 0.0
    [ nonbond_params ]
    N0   N0   1 4.700000e-01    3.700000e+00
    N1   N1   1 4.700000e-01    3.700000e+00
    [ moleculetype ]
    testA 1
    [ atoms ]
    1    N0   1   GLY    BB   1 0.00     45
    2    N0   1   GLY    SC1  1 0.00     45
    3    N0   1   GLY    SC2  1 0.00     45
    4    N1   2   GLU    BB   2 0.00     45
    5    N1   2   GLU    SC1  2 0.00     45
    6    N1   2   GLU    SC2  2 0.00     45
    7    N1   2   GLU    SC3  2 0.00     45
    [ bonds ]
    1     2    1  0.47 2000
    2     3    1  0.47 2000
    3     4    1  0.47 2000
    4     5    1  0.47 2000
    5     6    1  0.47 2000
    6     7    1  0.47 2000
    [ moleculetype ]
    testB 1
    [ atoms ]
    1    N0   1   ASP    BB   1 0.00     45
    2    N0   1   ASP    SC3  1 0.00     45
    3    N0   1   ASP    SC4  1 0.00     45
    4    N1   2   GLU    BB   2 0.00     45
    5    N1   2   GLU    SC1  2 0.00     45
    6    N1   2   GLU    SC2  2 0.00     45
    7    N1   2   GLU    SC3  2 0.00     45
    [ bonds ]
    1     2    1  0.47 2000
    2     3    1  0.47 2000
    3     4    1  0.47 2000
    4     5    1  0.47 2000
    5     6    1  0.47 2000
    5     7    1  0.47 2000
    [ system ]
    test system
    [ molecules ]
    testA 1
    """
    lines = textwrap.dedent(top_lines)
    lines = lines.splitlines()
    force_field = ForceField("test")
    topology = Topology(force_field)
    read_topology(lines=lines, topology=topology, cwdir="./")
    topology.preprocess()
    topology.volumes = {"GLY": 0.53, "GLU": 0.67, "ASP": 0.43}
    polyply.src.check_residue_equivalence.check_residue_equivalence(topology)
def topology():
    top_lines = """
    [ defaults ]
    1   1   no   1.0     1.0
    [ atomtypes ]
    N0 72.0 0.000 A 0.0 0.0
    [ nonbond_params ]
    N0   N0   1 4.700000e-01    3.700000e+00
    [ moleculetype ]
    testA 1
    [ atoms ]
    1    N0   1   GLY    BB   1 0.00     45
    2    N0   2   GLY    SC1  1 0.00     45
    3    N0   3   GLY    SC2  1 0.00     45
    4    N0   4   GLU    BB   2 0.00     45
    5    N0   5   GLU    SC1  2 0.00     45
    6    N0   6   GLU    SC2  2 0.00     45
    7    N0   7   GLU    SC2  2 0.00     45
    8    N0   8   GLU    SC2  2 0.00     45
    9    N0   9   GLU    SC2  2 0.00     45
   10    N0  10   GLU    SC2  2 0.00     45
   11    N0  11   GLU    SC2  2 0.00     45
   12    N0  12   GLU    SC2  2 0.00     45
   13    N0  13   GLU    SC2  2 0.00     45
   14    N0  14   GLU    SC2  2 0.00     45
   15    N0  15   GLU    SC2  2 0.00     45
   16    N0  16   GLU    SC2  2 0.00     45
   17    N0  17   GLU    SC2  2 0.00     45
   18    N0  18   GLU    SC2  2 0.00     45
   19    N0  19   GLU    SC2  2 0.00     45
   20    N0  20   GLU    SC2  2 0.00     45
   21    N0  21   GLU    SC2  2 0.00     45
   22    N0  22   GLU    SC2  2 0.00     45
    [ bonds ]
    1     2    1  0.47 2000
    2     3    1  0.47 2000
    3     4    1  0.47 2000
    4     5    1  0.47 2000
    5     6    1  0.47 2000
    6     7    1  0.47 2000
    7     8    1  0.47 2000
    8     9    1  0.47 2000
    9    10    1  0.47 2000
   10    11    1  0.47 2000
   11    12    1  0.47 2000
   12    13    1  0.47 2000
   13    14    1  0.47 2000
   14    15    1  0.47 2000
   15    16    1  0.47 2000
   16    17    1  0.47 2000
   17    18    1  0.47 2000
   18    19    1  0.47 2000
   19    20    1  0.47 2000
   20    21    1  0.47 2000
   21    22    1  0.47 2000
    [ moleculetype ]
    testB 1
    [ atoms ]
    1    N0   1   ASP    BB   1 0.00     45
    2    N0   2   GLY    SC1  1 0.00     45
    3    N0   3   ASP    SC2  1 0.00     45
    4    N0   4   ASP    BB   2 0.00     45
    5    N0   5   GLY    SC1  2 0.00     45
    6    N0   6   ASP    SC2  2 0.00     45
    7    N0   7   ASP    SC2  2 0.00     45
    8    N0   8   GLU    SC2  2 0.00     45
    9    N0   9   GLU    SC2  2 0.00     45
   10    N0  10   GLY    SC2  2 0.00     45
   11    N0  11   ASP    SC2  2 0.00     45
   12    N0  12   GLU    SC2  2 0.00     45
   13    N0  13   ASP    SC2  2 0.00     45
   14    N0  14   ASP    SC2  2 0.00     45
   15    N0  15   GLU    SC2  2 0.00     45
   16    N0  16   ASP    SC2  2 0.00     45
   17    N0  17   ASP    SC2  2 0.00     45
   18    N0  18   GLY    SC2  2 0.00     45
   19    N0  19   ASP    SC2  2 0.00     45
   20    N0  20   ASP    SC2  2 0.00     45
   21    N0  21   GLY    SC2  2 0.00     45
   22    N0  22   ASP    SC2  2 0.00     45
    [ bonds ]
    1     2    1  0.47 2000
    2     3    1  0.47 2000
    3     4    1  0.47 2000
    4     5    1  0.47 2000
    5     6    1  0.47 2000
    6     7    1  0.47 2000
    7     8    1  0.47 2000
    8     9    1  0.47 2000
    9    10    1  0.47 2000
   10    11    1  0.47 2000
   11    12    1  0.47 2000
   12    13    1  0.47 2000
   13    14    1  0.47 2000
   14    15    1  0.47 2000
   15    16    1  0.47 2000
   16    17    1  0.47 2000
   17    18    1  0.47 2000
   18    19    1  0.47 2000
   19    20    1  0.47 2000
   20    21    1  0.47 2000
   21    22    1  0.47 2000
    [ moleculetype ]
    testC 1
    [ atoms ]
    1    N0   1   GLY    BB   1 0.00     45
    2    N0   2   GLY    SC1  1 0.00     45
    3    N0   3   GLY    SC2  1 0.00     45
    4    N0   4   GLU    BB   2 0.00     45
    5    N0   5   GLU    SC1  2 0.00     45
    6    N0   6   GLU    SC2  2 0.00     45
    7    N0   7   GLU    SC2  2 0.00     45
    8    N0   8   GLU    SC2  2 0.00     45
    9    N0   9   GLU    SC2  2 0.00     45
   10    N0  10   GLU    SC2  2 0.00     45
   11    N0  11   GLU    SC2  2 0.00     45
   12    N0  12   GLU    SC2  2 0.00     45
   13    N0  13   GLU    SC2  2 0.00     45
   14    N0  14   GLU    SC2  2 0.00     45
   15    N0  15   GLU    SC2  2 0.00     45
   16    N0  16   GLU    SC2  2 0.00     45
   17    N0  17   GLU    SC2  2 0.00     45
   18    N0  18   GLU    SC2  2 0.00     45
   19    N0  19   GLU    SC2  2 0.00     45
   20    N0  20   GLU    SC2  2 0.00     45
   21    N0  21   GLU    SC2  2 0.00     45
   22    N0  22   GLU    SC2  2 0.00     45
   23    N0  23   GLU    SC2  2 0.00     45
   24    N0  24   GLU    SC2  2 0.00     45
   25    N0  25   GLU    SC2  2 0.00     45
    [ bonds ]
    1     2    1  0.47 2000
    2     3    1  0.47 2000
    3     4    1  0.47 2000
    4     5    1  0.47 2000
    5     6    1  0.47 2000
    6     7    1  0.47 2000
    7     8    1  0.47 2000
    8     9    1  0.47 2000
    9    10    1  0.47 2000
   10    11    1  0.47 2000
   11    12    1  0.47 2000
   12    13    1  0.47 2000
   13    14    1  0.47 2000
   14    15    1  0.47 2000
   15    16    1  0.47 2000
   16    17    1  0.47 2000
   17    18    1  0.47 2000
   18    19    1  0.47 2000
   19    20    1  0.47 2000
   20    21    1  0.47 2000
   21    22    1  0.47 2000
    3    23    1  0.47 2000
    23   24    1  0.47 2000
    3    25    1  0.47 2000
   [ system ]
    test system
    [ molecules ]
    testA 10
    testB 10
    testC 5
    """
    lines = textwrap.dedent(top_lines)
    lines = lines.splitlines()
    force_field = ForceField("test")
    topology = Topology(force_field)
    read_topology(lines=lines, topology=topology, cwdir="./")
    topology.preprocess()
    topology.volumes = {"GLY": 0.53, "GLU": 0.67, "ASP": 0.43}
    return topology