def _parameterize(self):
     if not self.mol.ff:
         params = mdt.create_ff_parameters(
             self.mol,
             charges=self.params.partial_charges,
             baseff=self.params.gaff_version)
         params.assign(self.mol)
def test_ff_assignment_doesnt_change_topology(pdb3aid):
    m = pdb3aid
    protein = mdt.Molecule(m.get_atoms('protein'))
    ligand = mdt.Molecule(m.get_atoms('unknown'))
    ligff = mdt.create_ff_parameters(ligand, charges='gasteiger')

    mdt.guess_histidine_states(protein)
    mol = protein.combine(ligand)

    ff = mdt.forcefields.DefaultAmber()
    ff.add_ff(ligff)

    mdready = ff.create_prepped_molecule(mol)

    assert mdready.num_residues == mol.num_residues
    assert mdready.num_chains == mol.num_chains
    for c1, c2 in zip(mdready.chains, mol.chains):
        assert c1.name == c2.name
        assert c1.num_residues == c2.num_residues
        assert c1.index == c2.index

    for newr, oldr in zip(mdready.residues, mol.residues):
        assert newr.index == oldr.index
        if newr.resname == 'HIS':
            assert oldr.resname in 'HIS HID HIE HIP'.split()
        else:
            assert newr.resname == oldr.resname
        assert newr.pdbindex == oldr.pdbindex
        assert newr.chain.index == oldr.chain.index
        for atom in oldr:
            assert atom.name in newr
Exemplo n.º 3
0
def test_ff_assignment_doesnt_change_topology(pdb3aid):
    m = pdb3aid
    protein = mdt.Molecule(m.get_atoms('protein'))
    ligand = mdt.Molecule(m.get_atoms('unknown'))
    ligff = mdt.create_ff_parameters(ligand, charges='gasteiger')

    mdt.guess_histidine_states(protein)
    mol = protein.combine(ligand)

    ff = mdt.forcefields.DefaultAmber()
    ff.add_ff(ligff)

    mdready = ff.create_prepped_molecule(mol)

    assert mdready.num_residues == mol.num_residues
    assert mdready.num_chains == mol.num_chains
    for c1, c2 in zip(mdready.chains, mol.chains):
        assert c1.name == c2.name
        assert c1.num_residues == c2.num_residues
        assert c1.index == c2.index

    for newr, oldr in zip(mdready.residues, mol.residues):
        assert newr.index == oldr.index
        if newr.resname == 'HIS':
            assert oldr.resname in 'HIS HID HIE HIP'.split()
        else:
            assert newr.resname == oldr.resname
        assert newr.pdbindex == oldr.pdbindex
        assert newr.chain.index == oldr.chain.index
        for atom in oldr:
            assert atom.name in newr
def h2params():
    mol = mdt.from_smiles('[H][H]')
    mol.atoms[0].name = 'HA'
    mol.atoms[1].name = 'HB'
    mol.residues[0].name = 'H2'

    params = mdt.create_ff_parameters(mol, charges='gasteiger')
    return mol, params
def h2params():
    mol = mdt.from_smiles('[H][H]')
    mol.atoms[0].name = 'HA'
    mol.atoms[1].name = 'HB'
    mol.residues[0].name = 'H2'

    params = mdt.create_ff_parameters(mol, charges='gasteiger')
    return mol, params
def test_charge_models(ethylene, chargemodel):
    mol = ethylene
    if chargemodel == 'esp':
        pytest.xfail("ESP not yet implemented")
    assert not mol.ff
    params = mdt.create_ff_parameters(mol, charges=chargemodel)
    assert params is not None
    _test_succesful_parameterization(mol)
Exemplo n.º 7
0
def test_charge_models(ethylene, chargemodel):
    mol = ethylene
    if chargemodel == 'esp':
        pytest.xfail("ESP not yet implemented")
    assert not mol.ff
    params = mdt.create_ff_parameters(mol, charges=chargemodel)
    assert params is not None
    _test_succesful_parameterization(mol)
def test_parameterize_multiple_identical_small_molecules():
    m1 = mdt.from_smiles('O')
    params = mdt.create_ff_parameters(m1, charges='am1-bcc')
    assert params is not None
    m2 = m1.copy()
    m2.translate([4.0, 0.0, 0.0] * mdt.units.angstrom)
    mol = m1.combine(m2)
    ff = mdt.forcefields.DefaultAmber()
    ff.add_ff(params)

    ff.assign(mol)
    _test_succesful_parameterization(mol)
Exemplo n.º 9
0
def test_parameterize_multiple_identical_small_molecules():
    m1 = mdt.from_smiles('O')
    params = mdt.create_ff_parameters(m1, charges='am1-bcc')
    assert params is not None
    m2 = m1.copy()
    m2.translate([4.0, 0.0, 0.0] * mdt.units.angstrom)
    mol = m1.combine(m2)
    ff = mdt.forcefields.DefaultAmber()
    ff.add_ff(params)

    ff.assign(mol)
    _test_succesful_parameterization(mol)
Exemplo n.º 10
0
def test_numeric_residue_name_1PYN(request, mol):
    """ The ligand in this residue is named "941", which causes a little trickiness
    """
    import parmed

    mol = request.getfixturevalue(mol)
    ligand = mdt.Molecule(mol.residues[283])

    params = mdt.create_ff_parameters(ligand, charges='gasteiger')
    params._file_list['mol.lib'].put('/tmp/tmp.lib')

    contents = parmed.load_file('/tmp/tmp.lib')
    assert len(contents) == 1
    assert list(contents.keys())[0] == '941'
def _param_small_mol(cached_small_molecule, chargemodel):
    mol = cached_small_molecule.copy()
    params = mdt.create_ff_parameters(mol, charges=chargemodel, baseff='gaff2')
    params.assign(mol)
    mol.set_energy_model(mdt.models.ForceField)
    return mol
Exemplo n.º 12
0
def _param_small_mol(cached_small_molecule, chargemodel):
    mol = cached_small_molecule.copy()
    params = mdt.create_ff_parameters(mol, charges=chargemodel, baseff='gaff2')
    params.assign(mol)
    mol.set_energy_model(mdt.models.ForceField)
    return mol
def test_parameterization_from_formats(objkey, request):
    mol = request.getfixturevalue(objkey)
    assert not mol.ff
    params = mdt.create_ff_parameters(mol, charges='gasteiger')
    assert params is not None
    _test_succesful_parameterization(mol)
Exemplo n.º 14
0
def test_parameterization_from_formats(objkey, request):
    mol = request.getfixturevalue(objkey)
    assert not mol.ff
    params = mdt.create_ff_parameters(mol, charges='gasteiger')
    assert params is not None
    _test_succesful_parameterization(mol)