promoted_name='distance_between_atoms', default=2.5) solvate.promote_parameter( "padding_distance", promoted_name="padding_distance", default=11.0, description= "The largest dimension (in A) of the solute (along the x, y, or z axis) " "is determined, and a cubic box of size " "(largest dimension)+2*padding is used") ff = ForceFieldPrep("ForceField") # ff.promote_parameter('ligand_forcefield', promoted_name='ligand_forcefield', default='SMIRNOFF') # Minimization minimize = OpenMMminimizeCube("Minimize") minimize.promote_parameter('restraints', promoted_name='m_restraints', default="noh ligand", description='Select mask to apply restarints') minimize.promote_parameter('restraintWt', promoted_name='m_restraintWt', default=5.0, description='Restraint weight in kcal/(mol A^2') # NVT Warm-up warmup = OpenMMnvtCube('warmup', title='warmup') warmup.promote_parameter('time', promoted_name='warm_psec', default=20.0, description='Length of MD run in picoseconds')
Outputs: -------- ofs: Outputs the minimized system """ job.classification = [['Simulation']] job.tags = [tag for lists in job.classification for tag in lists] ifs = OEMolIStreamCube("complex", title="Complex Reader") ifs.promote_parameter("data_in", promoted_name="complex", title='Complex Input File', description="protein:ligand complex input file") minComplex = OpenMMminimizeCube('minComplex') minComplex.promote_parameter('steps', promoted_name='steps') ofs = OEMolOStreamCube('ofs', title='OFS-Success') ofs.set_parameters(backend='s3') fail = OEMolOStreamCube('fail', title='OFS-Failure') fail.set_parameters(backend='s3') fail.set_parameters(data_out='fail.oeb.gz') job.add_cubes(ifs, minComplex, ofs, fail) ifs.success.connect(minComplex.intake) minComplex.success.connect(ofs.intake) minComplex.failure.connect(fail.intake) if __name__ == "__main__": job.run()
promoted_name='ligand_ff', default='GAFF2') ff.promote_parameter('other_forcefield', promoted_name='other_ff', default='GAFF2') # Output the prepared systems complex_prep_ofs = OEMolOStreamCube('complex_prep_ofs', title='ComplexSetUpOut') complex_prep_ofs.set_parameters(backend='s3') complex_prep_ofs.set_parameters( data_out=iprot.promoted_parameters['protein_prefix']['default'] + '_SetUp.oeb.gz') # Minimization minComplex = OpenMMminimizeCube('minComplex', title='Minimize') minComplex.promote_parameter('restraints', promoted_name='m_restraints', default="noh (ligand or protein)", description='Select mask to apply restarints') minComplex.promote_parameter('restraintWt', promoted_name='m_restraintWt', default=5.0, description='Restraint weight') minComplex.promote_parameter('steps', promoted_name='steps', default=20000) minComplex.promote_parameter('center', promoted_name='center', default=True) # Output the minimized systems minimization_ofs = OEMolOStreamCube('minimization_ofs', title='MinimizationOut') minimization_ofs.set_parameters(backend='s3')
Outputs: -------- ofs: Outputs the minimized system """ job.classification = [['Simulation']] job.tags = [tag for lists in job.classification for tag in lists] ifs = OEMolIStreamCube("SystemReader", title="System Reader") ifs.promote_parameter("data_in", promoted_name="system", title='System Input File', description="System input file") min = OpenMMminimizeCube('Minimize') min.promote_parameter('steps', promoted_name='steps') ofs = OEMolOStreamCube('ofs', title='OFS-Success') ofs.set_parameters(backend='s3') fail = OEMolOStreamCube('fail', title='OFS-Failure') fail.set_parameters(backend='s3') fail.set_parameters(data_out='fail.oeb.gz') job.add_cubes(ifs, min, ofs, fail) ifs.success.connect(min.intake) min.success.connect(ofs.intake) min.failure.connect(fail.intake) if __name__ == "__main__": job.run()
ffComplex = ForceFieldPrep("ForceFieldComplex", title="ForceFieldComplex") ffComplex.promote_parameter('protein_forcefield', promoted_name='protein_ff', default='amber99sbildn.xml') ffComplex.promote_parameter('solvent_forcefield', promoted_name='solvent_ff', default='tip3p.xml') ffComplex.promote_parameter('ligand_forcefield', promoted_name='ligand_ff', default='GAFF2') ffComplex.promote_parameter('other_forcefield', promoted_name='other_ff', default='GAFF2') # Minimization minComplex = OpenMMminimizeCube('minComplex', title='MinimizeComplex') minComplex.promote_parameter('restraints', promoted_name='m_restraints', default="noh (ligand or protein)", description='Select mask to apply restarints') minComplex.promote_parameter('restraintWt', promoted_name='m_restraintWt', default=5.0, description='Restraint weight') # NVT simulation. Here the assembled system is warmed up to the final selected temperature warmupComplex = OpenMMnvtCube('warmupComplex', title='warmupComplex') warmupComplex.promote_parameter('time', promoted_name='warm_psec', default=20.0, description='Length of MD run in picoseconds')
def setUp(self): self.cube = OpenMMminimizeCube('minComplex') self.runner = CubeTestRunner(self.cube) self.runner.start()
class MinimizationCubeTester(unittest.TestCase): """ Test the OpenMM Minimization cube Example inputs from `openmm_orion/examples/data` """ def calculate_eng(self, oe_mol): # Extract starting MD data from OEMol mdData = utils.MDData(oe_mol) topology = mdData.topology positions = mdData.positions structure = mdData.structure box = mdData.box # OpenMM system system = structure.createSystem(nonbondedMethod=eval("app.%s" % self.cube.args.nonbondedMethod), nonbondedCutoff=self.cube.args.nonbondedCutoff * unit.angstroms, constraints=eval("app.%s" % self.cube.args.constraints)) # OpenMM Integrator integrator = openmm.LangevinIntegrator(self.cube.args.temperature * unit.kelvin, 1.0 / unit.picoseconds, 0.002 * unit.picoseconds) # Set Simulation simulation = app.Simulation(topology, system, integrator) # Set Positions simulation.context.setPositions(positions) # Set Box dimensions simulation.context.setPeriodicBoxVectors(box[0], box[1], box[2]) # Collect the OpenMM state energy info state = simulation.context.getState(getEnergy=True) # Potential Energy peng = state.getPotentialEnergy() return peng def setUp(self): self.cube = OpenMMminimizeCube('minComplex') self.runner = CubeTestRunner(self.cube) self.runner.start() def _test_success(self): print('Testing cube:', self.cube.name) # Complex file name complex_fname = utils.get_data_filename('examples', 'data/pbace_lcat13a_complex.oeb.gz') # Read OEMol molecule mol = oechem.OEMol() with oechem.oemolistream(complex_fname) as ifs: oechem.OEReadMolecule(ifs, mol) # Calculate starting potential energy eng_i = self.calculate_eng(mol) # Process the molecules self.cube.process(mol, self.cube.intake.name) # Assert that one molecule was emitted on the success port self.assertEqual(self.runner.outputs['success'].qsize(), 1) # Assert that zero molecules were emitted on the failure port self.assertEqual(self.runner.outputs['failure'].qsize(), 0) outmol = self.runner.outputs["success"].get() # Calculate final potential energy eng_f = self.calculate_eng(outmol) self.assertLess(eng_f, eng_i) @pytest.mark.slow def test_success(self): self.cube.args.steps = 100000 self._test_success() def test_failure(self): pass def tearDown(self): self.runner.finalize()