Exemple #1
0
def test_openff_skeleton(tmpdir):
    """
    Make sure the skeleton method in openff works when we have missing coverage in the openff forcefield.
    This will add generic parameters to the forcefield which should match any missing terms, no charges are generated this way.
    """
    with tmpdir.as_cwd():
        # load a molecule with b
        mol = Ligand.from_file(get_data("132-Benzodioxaborole.pdb"))
        OpenFF(mol)

        # no charges should be generated
        for i in range(mol.n_atoms):
            assert mol.NonbondedForce[i][0] == 0
Exemple #2
0
    def test_OpenFF(self):
        # try to parametrise using OpenFF
        OpenFF(self.molecule)

        # now make sure we have parameters assigned
        self.assertEqual(len(self.molecule.HarmonicBondForce), len(list(self.molecule.topology.edges)))

        self.assertEqual(len(self.molecule.HarmonicAngleForce), len(self.molecule.angles))

        self.assertEqual(len(self.molecule.PeriodicTorsionForce),
                         len(self.molecule.dih_phis) + len(self.molecule.improper_torsions))

        self.assertEqual(len(self.molecule.molecule['input']), len(self.molecule.NonbondedForce))
    def test_OpenFF(self):
        """Parametrise with OpenFF and ensure parameters have all been assigned."""

        OpenFF(self.molecule)

        self.assertEqual(len(self.molecule.HarmonicBondForce),
                         len(list(self.molecule.topology.edges)))

        self.assertEqual(len(self.molecule.HarmonicAngleForce),
                         len(self.molecule.angles))

        self.assertEqual(
            len(self.molecule.PeriodicTorsionForce),
            len(self.molecule.dih_phis) + len(self.molecule.improper_torsions))

        self.assertEqual(len(self.molecule.coords['input']),
                         len(self.molecule.NonbondedForce))
Exemple #4
0
Convert the pdb file to sdf and retype the molecule transfer the torsion parameters from the new molecule to the old and serialise again.
"""
from QUBEKit.ligand import Ligand
from QUBEKit.parametrisation import OpenFF, XML
from openff.toolkit.topology import Molecule as OFFMolecule
import parmed
from simtk.openmm import app, XmlSerializer

# convert to sdf first
off_mol = OFFMolecule.from_file("MOL.pdb")
off_mol.to_file("MOL.sdf", "sdf")

# make the qube mol
qb_mol1 = Ligand.from_file("MOL.sdf")
# apply params
OpenFF(qb_mol1)
# write out the params
qb_mol1.write_parameters("temp")

# now load a second molecule
qb_mol2 = Ligand.from_file("MOL.sdf")
# apply params from xml
XML(qb_mol2, input_file="MOL.xml")

# transfer the torsions
qb_mol2.PeriodicTorsionForce = qb_mol1.PeriodicTorsionForce
qb_mol2.combination = "opls"
qb_mol2.write_parameters(name="new")

# now build the parmed system
pdb = app.PDBFile("MOL.pdb")