示例#1
0
文件: utils.py 项目: CHEMPHY/perses
def generate_gaff_xml():
    """
    Return a file-like object for `gaff.xml`
    """
    from openmoltools import amber
    gaff_dat_filename = amber.find_gaff_dat()

    # Generate ffxml file contents for parmchk-generated frcmod output.
    leaprc = StringIO("parm = loadamberparams %s" % gaff_dat_filename)
    import parmed
    params = parmed.amber.AmberParameterSet.from_leaprc(leaprc)
    params = parmed.openmm.OpenMMParameterSet.from_parameterset(params)
    citations = """\
    Wang, J., Wang, W., Kollman P. A.; Case, D. A. "Automatic atom type and bond type perception in molecular mechanical calculations". Journal of Molecular Graphics and Modelling , 25, 2006, 247260.
    Wang, J., Wolf, R. M.; Caldwell, J. W.;Kollman, P. A.; Case, D. A. "Development and testing of a general AMBER force field". Journal of Computational Chemistry, 25, 2004, 1157-1174.
    """
    ffxml = str()
    gaff_xml = StringIO(ffxml)
    provenance=dict(OriginalFile='gaff.dat', Reference=citations)
    params.write(gaff_xml, provenance=provenance)

    return gaff_xml
示例#2
0
def generate_gaff_xml():
    """
    Return a file-like object for `gaff.xml`
    """
    from openmoltools import amber
    gaff_dat_filename = amber.find_gaff_dat()

    # Generate ffxml file contents for parmchk-generated frcmod output.
    leaprc = StringIO("parm = loadamberparams %s" % gaff_dat_filename)
    import parmed
    params = parmed.amber.AmberParameterSet.from_leaprc(leaprc)
    params = parmed.openmm.OpenMMParameterSet.from_parameterset(params)
    citations = """\
Wang, J., Wang, W., Kollman P. A.; Case, D. A. "Automatic atom type and bond type perception in molecular mechanical calculations". Journal of Molecular Graphics and Modelling , 25, 2006, 247260.
Wang, J., Wolf, R. M.; Caldwell, J. W.;Kollman, P. A.; Case, D. A. "Development and testing of a general AMBER force field". Journal of Computational Chemistry, 25, 2004, 1157-1174.
"""
    ffxml = str()
    gaff_xml = StringIO(ffxml)
    provenance=dict(OriginalFile='gaff.dat', Reference=citations)
    params.write(gaff_xml, provenance=provenance)

    return gaff_xml
示例#3
0
from protons.ligutils import parametrize_ligand, MultiIsomerResidue
from . import get_data
from openmoltools.schrodinger import is_schrodinger_suite_installed
from openmoltools.amber import find_gaff_dat

try:
    find_gaff_dat()
    found_gaff = True
except ValueError:
    found_gaff = False

from unittest import skipIf, TestCase


class LigandXmlTestCase(TestCase):
    @skipIf(not is_schrodinger_suite_installed() or not found_gaff,
            "This test requires Schrodinger's suite and gaff")
    def test_ligand_cphxml(self):
        """
        Run epik on a ligand and parametrize its isomers
        """
        parametrize_ligand(get_data("ligand_allH.mol2", "testsystems"),
                           "/tmp/ligand-isomers.xml",
                           pH=4.5)

    def test_xml_compilation(self):
        """
        Compile an xml file for the isomers
        """
        xmlfile = get_data("isomers.xml", "testsystems/ligand_xml")
        m = MultiIsomerResidue(xmlfile)
from constph.ligutils import parametrize_ligand, MultiIsomerResidue
from . import get_data
from openmoltools.schrodinger import is_schrodinger_suite_installed
from openmoltools.amber import find_gaff_dat

try:
    find_gaff_dat()
    found_gaff = True
except ValueError:
    found_gaff = False

from unittest import skipIf, TestCase


class LigandXmlTestCase(TestCase):
    
    @skipIf(not is_schrodinger_suite_installed() or not found_gaff, "This test requires Schrodinger's suite and gaff")
    def test_ligand_cphxml(self):
        """
        Run epik on a ligand and parametrize its isomers
        """
        parametrize_ligand(get_data("ligand_allH.mol2", "testsystems"), "/tmp/ligand-isomers.xml", pH=4.5)

    def test_xml_compilation(self):
        """
        Compile an xml file for the isomers
        """
        xmlfile = get_data("isomers.xml", "testsystems/ligand_xml")
        m = MultiIsomerResidue(xmlfile)
        m.write('/tmp/isomers.cph.xml')