Example #1
0
 def test_replace_types_fail():
     lines = """
     [ defaults ]
     1.0   1.0   yes  1.0     1.0
     [ dihedraltypes ]
     C   Q    Q     Q    5   123.50	401.664	0.0	0.0
     [ moleculetype ]
     test 3
     [ atoms ]
     1 CT2   1 test C1 1   0.0 14.0
     2 CE2   1 test C2 2   0.0 12.0
     3 CE1   1 test C3 3   0.0 12.0
     4 CT2   1 test C4 4   0.0 12.0
     [ dihedrals ]
     1  2  3  4 2
     [ system ]
     some title
     [ molecules ]
     test 1
     """
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     with pytest.raises(OSError):
         top.gen_bonded_interactions()
Example #2
0
def example_system():
    """
    Create a dummy test system with three types of molecules AA, BB and
    NA. NA is the molecule to be used a ligand. AA and BB are composed
    of different residues.
    """
    # dummy vermouth force-field
    force_field = vermouth.forcefield.ForceField(name='test_ff')
    # monomers used in the meta-molecule
    ALA = Monomer(resname="ALA", n_blocks=2)
    GLU = Monomer(resname="GLU", n_blocks=1)
    THR = Monomer(resname="THR", n_blocks=1)
    # two meta-molecules
    meta_mol_A = MetaMolecule.from_monomer_seq_linear(force_field,
                                                      [ALA, GLU, THR],
                                                      "AA")
    meta_mol_B = MetaMolecule.from_monomer_seq_linear(force_field,
                                                      [GLU, ALA, THR],
                                                      "BB")
    NA = MetaMolecule()
    NA.add_monomer(current=0, resname="NA", connections=[])
    molecules = [meta_mol_A, meta_mol_A.copy(),
                 meta_mol_B.copy(), NA, NA.copy(),
                 NA.copy(), NA.copy()]
    top = Topology(force_field=force_field)
    top.molecules = molecules
    top.mol_idx_by_name = {"AA":[0, 1], "BB": [2], "NA":[3, 4, 5, 6]}
    return top
Example #3
0
 def test_replace_defines(lines, outcome):
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     top.replace_defines()
     assert top.molecules[0].molecule.interactions["angles"][
         0].parameters == outcome
Example #4
0
 def test_replace_types(lines, outcome):
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     top.gen_bonded_interactions()
     for inter_type in outcome:
         assert top.molecules[0].molecule.interactions[
             inter_type] == outcome[inter_type]
Example #5
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 #6
0
 def test_gen_pairs(lines, outcome):
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     top.gen_pairs()
     for atom_pair in outcome:
         assert atom_pair in top.nonbond_params
         nb1 = top.nonbond_params[atom_pair]["nb1"]
         nb2 = top.nonbond_params[atom_pair]["nb2"]
         nb1_ref = outcome[atom_pair]["nb1"]
         nb2_ref = outcome[atom_pair]["nb2"]
         assert math.isclose(nb1, nb1_ref)
         assert math.isclose(nb2, nb2_ref)
Example #7
0
 def test_directives(lines, attr, value):
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     assert getattr(top, attr) == value
def nonbond_matrix():
    toppath = TEST_DATA + "/struc_build/system.top"
    topology = Topology.from_gmx_topfile(name="test", path=toppath)
    topology.preprocess()
    topology.volumes = {"PEO": 0.43}
    return NonBondEngine.from_topology(topology.molecules,
                                       topology,
                                       box=np.array([10., 10., 10.]))
Example #9
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 #10
0
 def test_define(def_statements, result):
     """
     test the handling of define statements in
     """
     new_lines = textwrap.dedent(def_statements)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     assert top.defines == result
Example #11
0
    def test_convert_nonbond_to_sig_eps():
        """
        Simply test if the conversion from C6 C12 to simga epsilon
        is done properly.
        """

        force_field = vermouth.forcefield.ForceField(name='test_ff')
        top = Topology(force_field, name="test")
        top.nonbond_params = {
            frozenset(["EO", "EO"]): {
                "nb1": 6.44779031E-02,
                "nb2": 4.07588234E-04
            }
        }
        top.convert_nonbond_to_sig_eps()
        assert math.isclose(top.nonbond_params[frozenset(["EO", "EO"])]["nb1"],
                            0.43)
        assert math.isclose(top.nonbond_params[frozenset(["EO", "EO"])]["nb2"],
                            3.4 * 0.75)
Example #12
0
 def test_def_fails(lines):
     """
     test if incorrectly formatted ifdefs raise
     appropiate error
     """
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     with pytest.raises(IOError):
         polyply.src.top_parser.read_topology(new_lines, top)
Example #13
0
 def test_atom_type_fail():
     lines = """
     [ atomtypes ]
     opls_001   C   6      12.01100     0.500       A    3.75000e-01  4.39320e-01 random; SIG
     """
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     with pytest.raises(IOError):
         polyply.src.top_parser.read_topology(new_lines, top)
Example #14
0
def test_persistence_parsers(test_system, lines, expected):
    lines = textwrap.dedent(lines).splitlines()
    ff = vermouth.forcefield.ForceField(name='test_ff')
    top = Topology(ff)
    polyply.src.build_file_parser.read_build_file(lines, test_system.molecules,
                                                  top)
    for ref, new in zip(expected, top.persistences):
        print(ref, new)
        for info_ref, info_new in zip(ref[:-1], new[:-1]):
            assert info_ref == info_new
        assert all(ref[-1] == new[-1])
Example #15
0
 def test_ifdefs_files(def_statements):
     """
     test files in ifdef/ifndef statements are only
     read if a define has been read before
     """
     new_lines = textwrap.dedent(def_statements)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     assert True
Example #16
0
 def test_buckingham_fail():
     lines = """
     [ defaults ]
     2   1   no   1.0     1.0
     """
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     with pytest.raises(IOError):
         polyply.src.top_parser.read_topology(new_lines, top)
Example #17
0
def test_parser(test_system, lines, tagged_mols, tagged_nodes):
    lines = textwrap.dedent(lines).splitlines()
    ff = vermouth.forcefield.ForceField(name='test_ff')
    top = Topology(ff)
    polyply.src.build_file_parser.read_build_file(lines, test_system.molecules,
                                                  top)
    for idx, mol in enumerate(test_system.molecules):
        for node in mol.nodes:
            if "restraints" in mol.nodes[node]:
                assert node in tagged_nodes
                assert idx in tagged_mols
def test_consistency():
    """
    This test checks that all interaction formats defined
    in TOPDirector.atom_idxs also have a corresponding
    method in ITPDirector.METH_DICT.
    """
    ff = vermouth.forcefield.ForceField(name='test_ff')
    top = Topology(ff, name="test")
    top_director = polyply.src.top_parser.TOPDirector(top)
    for inter_type in top_director.atom_idxs:
        assert (tuple(['moleculetype', inter_type]) in top_director.METH_DICT or \
                tuple([inter_type]) in top_director.METH_DICT)
Example #19
0
    def test_add_positions_from_pdb():
        top = Topology.from_gmx_topfile(TEST_DATA + "/topology_test/pdb.top",
                                        "test")
        top.add_positions_from_file(TEST_DATA + "/topology_test/test.pdb")
        for meta_mol in top.molecules:
            for node in meta_mol.molecule.nodes:
                assert "position" in meta_mol.molecule.nodes[node].keys()

        for meta_mol in top.molecules:
            for node in meta_mol.nodes:
                assert "position" in meta_mol.nodes[node].keys()
                assert meta_mol.nodes[node]["build"] == False
Example #20
0
    def test_add_positions_from_gro():
        top = Topology.from_gmx_topfile(
            TEST_DATA + "/topology_test/system.top", "test")
        top.add_positions_from_file(TEST_DATA + "/topology_test/test.gro")
        for node in top.molecules[0].molecule.nodes:
            if node < 14:
                assert "position" in top.molecules[0].molecule.nodes[
                    node].keys()

        for node in top.molecules[0].nodes:
            if node != 2:
                assert "position" in top.molecules[0].nodes[node].keys()
                assert top.molecules[0].nodes[node]["build"] == False
            else:
                assert top.molecules[0].nodes[node]["build"] == True
 def test_skip_directives(lines):
     """
     Test that directives which currently cannot be read and
     or interpreted are simply skipped and don't cause an
     error when reading the topology file.
     """
     new_lines = textwrap.dedent(lines)
     new_lines = new_lines.splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     assert top.defaults == {"nbfunc":1.0,
                             "comb-rule":1.0,
                             "gen-pairs":'no',
                             "fudgeLJ":1.0,
                             "fudgeQQ":1.0}
 def test_itp_handling():
    """
    test if multiple itps are read correctly
    """
    lines = """
    [ defaults ]
    1   1   no   1.0     1.0
    [ moleculetype ]
    GLY 1
    [ atoms ]
    1 P4 1 ALA BB 1
    [ moleculetype ]
    LYS 1
    [ atoms ]
    1 P4 1 ALA BB 1
    [ molecules ]
    LYS  2
    """
    new_lines = textwrap.dedent(lines).splitlines()
    force_field = vermouth.forcefield.ForceField(name='test_ff')
    top = Topology(force_field, name="test")
    polyply.src.top_parser.read_topology(new_lines, top)
    assert top.defaults == {"nbfunc": 1,
                            "comb-rule": 1,
                            "gen-pairs": "no",
                            "fudgeLJ": 1.0,
                            "fudgeQQ": 1.0}
    # check that there are two LYS in topology
    assert len(top.molecules) == 2
    for mol in top.molecules:
        assert mol.mol_name == "LYS"
    # check that both are not the same instance of meta_molecule
    assert top.molecules[0] is not top.molecules[1]
    # also check that the high-res molecule is not the same
    assert top.molecules[0].molecule is not top.molecules[1].molecule
    # we also should have each molecule as block in the force
    # field. Again we only check that it is there because
    # the actual parsing is done elsewhere
    assert len(force_field.blocks) == 2
Example #23
0
    def test_ifdefs(def_statements, bonds):
        """
        test the handling if ifdefs and ifndefs at
        different positions in itp-file
        """
        lines = """
        [ moleculetype ]
        GLY 1

        [ atoms ]
        1 P4 1 ALA BB 1
        2 P4 1 ALA SC1 1
        3 P4 1 ALA SC2 1
        4 P4 1 ALA SC3 1
        """
        new_lines = lines + def_statements
        new_lines = textwrap.dedent(new_lines)
        new_lines = new_lines.splitlines()
        force_field = vermouth.forcefield.ForceField(name='test_ff')
        top = Topology(force_field, name="test")
        polyply.src.top_parser.read_topology(new_lines, top)
        print(top.force_field.blocks["GLY"].interactions['bonds'])
        assert top.force_field.blocks["GLY"].interactions['bonds'] == bonds
Example #24
0
 def test_itp_handling():
     """
     test if multiple itps are read correctly
     """
     lines = """
    [ defaults ]
    1   1   no   1.0     1.0
    [ moleculetype ]
    GLY 1
    [ atoms ]
    1 P4 1 ALA BB 1
    [ moleculetype ]
    LYS 1
    [ atoms ]
    1 P4 1 ALA BB 1
    [ molecules ]
    LYS  2
    """
     new_lines = textwrap.dedent(lines).splitlines()
     force_field = vermouth.forcefield.ForceField(name='test_ff')
     top = Topology(force_field, name="test")
     polyply.src.top_parser.read_topology(new_lines, top)
     assert top.defaults == {
         "nbfunc": 1,
         "comb-rule": 1,
         "gen-pairs": "no",
         "fudgeLJ": 1.0,
         "fudgeQQ": 1.0
     }
     # we just assert that one of the molecules is there
     # because parsing is done via itp reader and thus covered
     assert len(top.molecules[0]) == 1
     # we also should have each molecule as block in the force
     # field. Again we only check that it is there because
     # the actual parsing is done elsewhere
     assert len(force_field.blocks) == 2
Example #25
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
Example #27
0
 def test_convert_to_vermouth_system():
     top = Topology.from_gmx_topfile(
         TEST_DATA + "/topology_test/system.top", "test")
     system = top.convert_to_vermouth_system()
     assert isinstance(system, vermouth.system.System)
     assert len(system.molecules) == 1
Example #28
0
 def test_from_gmx_topfile():
     top = Topology.from_gmx_topfile(
         TEST_DATA + "/topology_test/system.top", "test")
     assert len(top.molecules) == 1
def molecule():
    toppath = TEST_DATA + "/struc_build/system.top"
    topology = Topology.from_gmx_topfile(name="test", path=toppath)
    return topology.molecules[0]