Exemple #1
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
    def test_from_monomer_seq_linear(monomers, edges, nodes, attrs):
        ff = vermouth.forcefield.ForceField(name='test_ff')
        name = "test"
        meta_mol = MetaMolecule.from_monomer_seq_linear(ff, monomers, name)

        assert nx.get_node_attributes(meta_mol, "resname") == attrs
        assert list(meta_mol.nodes) == nodes
        assert list(meta_mol.edges) == edges
Exemple #3
0
def test_molecule():
    # dummy vermouth force-field
    force_field = vermouth.forcefield.ForceField(name='test_ff')
    # monomers used in the meta-molecule
    ALA = Monomer(resname="ALA", n_blocks=4)
    GLU = Monomer(resname="GLU", n_blocks=2)
    THR = Monomer(resname="THR", n_blocks=3)
    # two meta-molecules
    mol = MetaMolecule.from_monomer_seq_linear(force_field, [ALA, GLU, THR],
                                               "AA")
    return mol
    def test_get_links(lines, ref_ids):
        lines = textwrap.dedent(lines).splitlines()
        force_field = vermouth.forcefield.ForceField(name='test_ff')
        vermouth.ffinput.read_ff(lines, force_field)
        meta_mol = MetaMolecule.from_monomer_seq_linear(
            force_field, [Monomer(resname="PEO", n_blocks=5)], "test")
        polyply.src.map_to_molecule.MapToMolecule().run_molecule(meta_mol)

        resids = []
        for edge in meta_mol.edges:
            _, ids = polyply.src.apply_links._get_links(meta_mol, edge)
            resids += ids
        assert len(resids) == len(ref_ids)
        for resid in ids:
            assert resid in ref_ids