def modifications():
    """
    Provides modifications
    """
    mods = {}
    mod_a = Link(force_field=FF_UNIVERSAL, name='mA')
    mod_a.add_node('mA', atomname='mA', PTM_atom=True)
    mods['mA'] = mod_a

    mod_c = Link(force_field=FF_UNIVERSAL, name='mC')
    mod_c.add_node('mC', atomname='mC', PTM_atom=True)
    mods['mC'] = mod_c

    mod_d = Link(force_field=FF_UNIVERSAL, name='mD')
    mod_d.add_node('mD', atomname='mD', PTM_atom=True)
    mods['mD'] = mod_d

    mod_fg = Link(force_field=FF_UNIVERSAL, name='mFG')
    mod_fg.add_node('mF', atomname='mF', PTM_atom=True)
    mod_fg.add_node('mG', atomname='mG', PTM_atom=True)
    mod_fg.add_edge('mF', 'mG')
    mod_fg.add_interaction('bond', ['mF', 'mG'], (3, 4))
    mods['mFG'] = mod_fg

    mod_i = Link(force_field=FF_UNIVERSAL, name='mI')
    mod_i.add_node('mI', atomname='mI', PTM_atom=True)
    mods['mI'] = mod_i
    mod_i2 = Link(force_field=FF_UNIVERSAL, name='mI2')
    mod_i2.add_node('mI2', atomname='mI2', PTM_atom=True)
    mods['mI2'] = mod_i2

    mod_j = Link(force_field=FF_UNIVERSAL, name='mJ')
    mod_j.add_node('mJ', atomname='mJ', PTM_atom=True)
    mods['mJ'] = mod_j
    mod_j2 = Link(force_field=FF_UNIVERSAL, name='mJ2')
    mod_j2.add_node('mJ2', atomname='mJ2', PTM_atom=True)
    mods['mJ2'] = mod_j2
    mod = Link(name=('mJ', 'mJ2'), force_field=FF_UNIVERSAL)
    mod.add_nodes_from((['mJ', {'atomname': 'mJ', 'PTM_atom': True}],
                        ['mJ2', {'atomname': 'mJ2', 'PTM_atom': True}],
                        ['J', {'atomname': 'J', 'PTM_atom': False}]))
    mod.add_edges_from([('J', 'mJ'), ('J', 'mJ2')])
    mods[('mJ', 'mJ2')] = mod
    return mods
Exemple #2
0
def build_forcefield_with_mods():
    """
    Build a force field that describe some modifications.

    Returns
    -------
    vermouth.ForceField
    """
    nter = Link(name='N-ter')
    nter.add_nodes_from((
        (0, {'atomname': 'CA', 'PTM_atom': False, 'element': 'C'}),
        (1, {'atomname': 'N', 'PTM_atom': False, 'element': 'N'}),
        (2, {'atomname': 'HN', 'PTM_atom': False, 'element': 'H'}),
        (3, {'atomname': 'H', 'PTM_atom': True, 'element': 'H'}),
    ))
    nter.add_edges_from([[0, 1], [1, 2], [1, 3]])

    cter = Link(name='C-ter')
    cter.add_nodes_from((
        (0, {'atomname': 'C', 'PTM_atom': False, 'element': 'C'}),
        (1, {'atomname': 'O', 'PTM_atom': False, 'element': 'O'}),
        (2, {'atomname': 'OXT', 'PTM_atom': True, 'element': 'O'}),
    ))
    cter.add_edges_from([[0, 1], [0, 2]])

    gluh = Link(name='GLU-H')
    gluh.add_nodes_from((
        (0, {'atomname': 'CD', 'PTM_atom': False, 'element': 'C'}),
        (1, {'atomname': 'OE1', 'PTM_atom': False, 'element': 'O'}),
        (2, {'atomname': 'OE2', 'PTM_atom': False, 'element': 'O'}),
        (3, {'atomname': 'HE1', 'PTM_atom': True, 'element': 'H'}),
    ))
    gluh.add_edges_from([[0, 1], [0, 2], [1, 3]])

    forcefield = copy.copy(vermouth.forcefield.get_native_force_field('universal'))
    forcefield.modifications = {}
    for mod in [nter, gluh, cter]:
        forcefield.modifications[mod.name] = mod
    forcefield.renamed_residues[('GLU', ('GLU-H', 'N-ter'))] = 'GLU0'
    return forcefield
def make_link(mol_nodes, mol_edges=[]):
    mol = Link()
    mol.add_nodes_from(mol_nodes)
    mol.add_edges_from(mol_edges)
    return mol