Beispiel #1
0
class TestTrypsinLigandParameterization:
    """Test the parameterization of the 1D ligand"""

    messy_input = get_test_data(
        "1D_allH.mae", "testsystems/trypsin1d"
    )  # typical hand generated input for an epik calculation
    messy_epik_output = get_test_data(
        "1D_epik.mae", "testsystems/trypsin1d"
    )  # some messy epik generated output with scrambled and duplicated hydrogen names
    preprocessed_mol2 = get_test_data(
        "1D_preprocessed.mol2", "testsystems/trypsin1d"
    )  # A cleaned up mol2 file. Parameterization should work for this one
    ffxml_file = get_test_data(
        "1D.ffxml", "testsystems/trypsin1d"
    )  # A cleaned up mol2 file. Parameterization should work for this one

    def test_mapping_states(self):
        """Test the generation of a clean mol2 file from an epik result."""
        unique_filename = "{}.mol2".format(str(uuid4()))
        protons_app.ligands.epik_results_to_mol2(
            TestTrypsinLigandParameterization.messy_epik_output, unique_filename
        )
        assert path.isfile(unique_filename), "No output mol2 file was produced"
        remove(unique_filename)  # clean up after ourselves

    @pytest.mark.skipif(
        not is_schrodinger_suite_installed() or not found_gaff or not hasOpenEye,
        reason="This test requires Schrodinger's suite, OpenEye, and gaff",
    )
    def test_running_epik(self):
        """Test if Epik is run successfully on the molecule."""
        unique_id = str(uuid4())
        unique_filename = "{}.mae".format(unique_id)
        log_name = "{}.log".format(unique_id)
        protons_app.ligands.generate_epik_states(
            TestTrypsinLigandParameterization.messy_input,
            unique_filename,
            pH=7.8,
            max_penalty=10.0,
            workdir=None,
            tautomerize=False,
        )

        assert path.isfile(unique_filename), "No Epik output file was produced"
        epik_data = retrieve_epik_info(unique_filename)
        assert len(epik_data) > 0, "No Epik data was extracted."
        remove(unique_filename)  # clean up after ourselves
        remove(log_name)
Beispiel #2
0
    def setup_viologen_implicit():
        """
        Set up viologen in implicit solvent
        """
        viologen = SystemSetup()
        viologen.temperature = 300.0 * unit.kelvin
        viologen.pressure = 1.0 * unit.atmospheres
        viologen.timestep = 1.0 * unit.femtoseconds
        viologen.collision_rate = 1.0 / unit.picoseconds
        viologen.pH = 7.0
        testsystems = get_test_data("viologen", "testsystems")
        viologen.ffxml_files = os.path.join(testsystems,
                                            "viologen-protons.ffxml")
        viologen.gaff = os.path.join(testsystems, "gaff.xml")
        viologen.forcefield = ForceField(viologen.gaff, "gaff-obc2.xml",
                                         viologen.ffxml_files)

        viologen.pdbfile = app.PDBFile(
            os.path.join(testsystems, "viologen-vacuum.pdb"))
        viologen.topology = viologen.pdbfile.topology
        viologen.positions = viologen.pdbfile.getPositions(asNumpy=True)
        viologen.constraint_tolerance = 1.0e-7

        viologen.integrator = openmm.LangevinIntegrator(
            viologen.temperature, viologen.collision_rate, viologen.timestep)

        viologen.integrator.setConstraintTolerance(
            viologen.constraint_tolerance)
        viologen.system = viologen.forcefield.createSystem(
            viologen.topology,
            nonbondedMethod=app.NoCutoff,
            constraints=app.HBonds)
        viologen.cooh1 = {  # indices in topology of the first cooh group
            "HO": 56,
            "OH": 0,
            "CO": 1,
            "OC": 2,
            "R": 3,
        }
        viologen.cooh2 = {  # indices in topology of the second cooh group
            "HO": 57,
            "OH": 27,
            "CO": 25,
            "OC": 26,
            "R": 24,
        }

        viologen.simulation = app.Simulation(
            viologen.topology,
            viologen.system,
            viologen.integrator,
            TestCarboxylicAcid.platform,
        )
        viologen.simulation.context.setPositions(viologen.positions)
        viologen.context = viologen.simulation.context
        viologen.perturbations_per_trial = 10
        viologen.propagations_per_step = 1

        return viologen
Beispiel #3
0
 def test_create_calibration_system(self):
     """Create a solvated imidazole system."""
     # An protonated imidazole molecule in vacuum
     vacuum_file = get_test_data("imidazole.pdb", "testsystems/imidazole_explicit")
     input_xml = get_test_data(
         "protons-imidazole-ph-feature.xml", "testsystems/imidazole_explicit"
     )
     output_basename = str(uuid4())
     hxml = "{}-h.xml".format(str(uuid4()))
     protons_app.ligands.create_hydrogen_definitions(input_xml, hxml)
     protons_app.ligands.prepare_calibration_systems(
         vacuum_file,
         output_basename,
         ffxml=input_xml,
         hxml=hxml,
         delete_old_H=True,
         minimize=False,
     )
Beispiel #4
0
    def setup_viologen_implicit():
        """
        Set up viologen in implicit solvent
        """
        viologen = SystemSetup()
        viologen.temperature = 300.0 * unit.kelvin
        viologen.pressure = 1.0 * unit.atmospheres
        viologen.timestep = 1.0 * unit.femtoseconds
        viologen.collision_rate = 1.0 / unit.picoseconds
        viologen.pH = 7.0
        testsystems = get_test_data("viologen", "testsystems")
        viologen.ffxml_files = os.path.join(testsystems, "viologen-protons.ffxml")
        viologen.gaff = os.path.join(testsystems, "gaff.xml")
        viologen.forcefield = ForceField(
            viologen.gaff, "gaff-obc2.xml", viologen.ffxml_files
        )

        viologen.pdbfile = app.PDBFile(os.path.join(testsystems, "viologen-vacuum.pdb"))
        viologen.topology = viologen.pdbfile.topology
        viologen.positions = viologen.pdbfile.getPositions(asNumpy=True)
        viologen.constraint_tolerance = 1.0e-7

        viologen.integrator = openmm.LangevinIntegrator(
            viologen.temperature, viologen.collision_rate, viologen.timestep
        )

        viologen.integrator.setConstraintTolerance(viologen.constraint_tolerance)
        viologen.system = viologen.forcefield.createSystem(
            viologen.topology, nonbondedMethod=app.NoCutoff, constraints=app.HBonds
        )
        viologen.cooh1 = {  # indices in topology of the first cooh group
            "HO": 56,
            "OH": 0,
            "CO": 1,
            "OC": 2,
            "R": 3,
        }
        viologen.cooh2 = {  # indices in topology of the second cooh group
            "HO": 57,
            "OH": 27,
            "CO": 25,
            "OC": 26,
            "R": 24,
        }

        viologen.simulation = app.Simulation(
            viologen.topology,
            viologen.system,
            viologen.integrator,
            TestCarboxylicAcid.platform,
        )
        viologen.simulation.context.setPositions(viologen.positions)
        viologen.context = viologen.simulation.context
        viologen.perturbations_per_trial = 10
        viologen.propagations_per_step = 1

        return viologen
Beispiel #5
0
    def setup_amino_acid_water(three_letter_code):
        """
        Set up glutamic acid in water
        """
        if three_letter_code not in ["glh", "ash"]:
            raise ValueError("Amino acid not available.")

        aa = SystemSetup()
        aa.temperature = 300.0 * unit.kelvin
        aa.pressure = 1.0 * unit.atmospheres
        aa.timestep = 1.0 * unit.femtoseconds
        aa.collision_rate = 1.0 / unit.picoseconds
        aa.pH = 7.0
        testsystems = get_test_data("amino_acid", "testsystems")
        aa.ffxml_files = "amber10-constph.xml"
        aa.forcefield = ForceField(aa.ffxml_files, "tip3p.xml")

        aa.pdbfile = app.PDBFile(
            os.path.join(testsystems, "{}.pdb".format(three_letter_code))
        )
        aa.topology = aa.pdbfile.topology
        aa.positions = aa.pdbfile.getPositions(asNumpy=True)
        aa.constraint_tolerance = 1.0e-7

        aa.integrator = create_compound_gbaoab_integrator(aa)

        aa.integrator.setConstraintTolerance(aa.constraint_tolerance)
        aa.system = aa.forcefield.createSystem(
            aa.topology,
            nonbondedMethod=app.PME,
            nonbondedCutoff=1.0 * unit.nanometers,
            constraints=app.HBonds,
            rigidWater=True,
            ewaldErrorTolerance=0.0005,
        )
        aa.system.addForce(openmm.MonteCarloBarostat(aa.pressure, aa.temperature, 25))

        aa.simulation = app.Simulation(
            aa.topology, aa.system, aa.integrator, TestCarboxylicAcid.platform
        )
        aa.simulation.context.setPositions(aa.positions)
        aa.context = aa.simulation.context
        aa.perturbations_per_trial = 1000
        aa.propagations_per_step = 1

        return aa
Beispiel #6
0
    def setup_amino_acid_water(three_letter_code):
        """
        Set up glutamic acid in water
        """
        if three_letter_code not in ["glh", "ash"]:
            raise ValueError("Amino acid not available.")

        aa = SystemSetup()
        aa.temperature = 300.0 * unit.kelvin
        aa.pressure = 1.0 * unit.atmospheres
        aa.timestep = 1.0 * unit.femtoseconds
        aa.collision_rate = 1.0 / unit.picoseconds
        aa.pH = 7.0
        testsystems = get_test_data("amino_acid", "testsystems")
        aa.ffxml_files = "amber10-constph.xml"
        aa.forcefield = ForceField(aa.ffxml_files, "tip3p.xml")

        aa.pdbfile = app.PDBFile(
            os.path.join(testsystems, "{}.pdb".format(three_letter_code)))
        aa.topology = aa.pdbfile.topology
        aa.positions = aa.pdbfile.getPositions(asNumpy=True)
        aa.constraint_tolerance = 1.0e-7

        aa.integrator = create_compound_gbaoab_integrator(aa)

        aa.integrator.setConstraintTolerance(aa.constraint_tolerance)
        aa.system = aa.forcefield.createSystem(
            aa.topology,
            nonbondedMethod=app.PME,
            nonbondedCutoff=1.0 * unit.nanometers,
            constraints=app.HBonds,
            rigidWater=True,
            ewaldErrorTolerance=0.0005,
        )
        aa.system.addForce(
            openmm.MonteCarloBarostat(aa.pressure, aa.temperature, 25))

        aa.simulation = app.Simulation(aa.topology, aa.system, aa.integrator,
                                       TestCarboxylicAcid.platform)
        aa.simulation.context.setPositions(aa.positions)
        aa.context = aa.simulation.context
        aa.perturbations_per_trial = 1000
        aa.propagations_per_step = 1

        return aa
Beispiel #7
0
    def setup_viologen_water():
        """
        Set up viologen in water
        """
        viologen = SystemSetup()
        viologen.temperature = 300.0 * unit.kelvin
        viologen.pressure = 1.0 * unit.atmospheres
        viologen.timestep = 1.0 * unit.femtoseconds
        viologen.collision_rate = 1.0 / unit.picoseconds
        viologen.pH = 7.0
        testsystems = get_test_data("viologen", "testsystems")
        viologen.ffxml_files = os.path.join(testsystems,
                                            "viologen-protons-cooh.ffxml")
        viologen.gaff = os.path.join(testsystems, "gaff.xml")
        viologen.forcefield = ForceField(viologen.gaff, viologen.ffxml_files,
                                         "tip3p.xml")

        viologen.pdbfile = app.PDBFile(
            os.path.join(testsystems, "viologen-solvated.pdb"))
        viologen.topology = viologen.pdbfile.topology
        viologen.positions = viologen.pdbfile.getPositions(asNumpy=True)
        viologen.constraint_tolerance = 1.0e-7

        viologen.integrator = create_compound_gbaoab_integrator(viologen)

        viologen.integrator.setConstraintTolerance(
            viologen.constraint_tolerance)
        viologen.system = viologen.forcefield.createSystem(
            viologen.topology,
            nonbondedMethod=app.PME,
            nonbondedCutoff=1.0 * unit.nanometers,
            constraints=app.HBonds,
            rigidWater=True,
            ewaldErrorTolerance=0.0005,
        )
        viologen.system.addForce(
            openmm.MonteCarloBarostat(viologen.pressure, viologen.temperature,
                                      25))
        viologen.cooh1 = {  # indices in topology of the first cooh group
            "HO": 56,
            "OH": 1,
            "CO": 0,
            "OC": 2,
            "R": 3,
        }
        viologen.cooh2 = {  # indices in topology of the second cooh group
            "HO": 57,
            "OH": 27,
            "CO": 25,
            "OC": 26,
            "R": 24,
        }

        viologen.simulation = app.Simulation(
            viologen.topology,
            viologen.system,
            viologen.integrator,
            TestCarboxylicAcid.platform,
        )
        viologen.simulation.context.setPositions(viologen.positions)
        viologen.context = viologen.simulation.context
        viologen.perturbations_per_trial = 1000
        viologen.propagations_per_step = 1

        return viologen
Beispiel #8
0
    def setup_viologen_water():
        """
        Set up viologen in water
        """
        viologen = SystemSetup()
        viologen.temperature = 300.0 * unit.kelvin
        viologen.pressure = 1.0 * unit.atmospheres
        viologen.timestep = 1.0 * unit.femtoseconds
        viologen.collision_rate = 1.0 / unit.picoseconds
        viologen.pH = 7.0
        testsystems = get_test_data("viologen", "testsystems")
        viologen.ffxml_files = os.path.join(testsystems, "viologen-protons-cooh.ffxml")
        viologen.gaff = os.path.join(testsystems, "gaff.xml")
        viologen.forcefield = ForceField(
            viologen.gaff, viologen.ffxml_files, "tip3p.xml"
        )

        viologen.pdbfile = app.PDBFile(
            os.path.join(testsystems, "viologen-solvated.pdb")
        )
        viologen.topology = viologen.pdbfile.topology
        viologen.positions = viologen.pdbfile.getPositions(asNumpy=True)
        viologen.constraint_tolerance = 1.0e-7

        viologen.integrator = create_compound_gbaoab_integrator(viologen)

        viologen.integrator.setConstraintTolerance(viologen.constraint_tolerance)
        viologen.system = viologen.forcefield.createSystem(
            viologen.topology,
            nonbondedMethod=app.PME,
            nonbondedCutoff=1.0 * unit.nanometers,
            constraints=app.HBonds,
            rigidWater=True,
            ewaldErrorTolerance=0.0005,
        )
        viologen.system.addForce(
            openmm.MonteCarloBarostat(viologen.pressure, viologen.temperature, 25)
        )
        viologen.cooh1 = {  # indices in topology of the first cooh group
            "HO": 56,
            "OH": 1,
            "CO": 0,
            "OC": 2,
            "R": 3,
        }
        viologen.cooh2 = {  # indices in topology of the second cooh group
            "HO": 57,
            "OH": 27,
            "CO": 25,
            "OC": 26,
            "R": 24,
        }

        viologen.simulation = app.Simulation(
            viologen.topology,
            viologen.system,
            viologen.integrator,
            TestCarboxylicAcid.platform,
        )
        viologen.simulation.context.setPositions(viologen.positions)
        viologen.context = viologen.simulation.context
        viologen.perturbations_per_trial = 1000
        viologen.propagations_per_step = 1

        return viologen