예제 #1
0
 def test_bigger_timestep_sets_allbonds_and_hydrogen_masses(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type="explicit",
         cutoff=1.0,
         use_big_timestep=False,
         use_bigger_timestep=True,
         implicit_solvent="vacuum",
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=True,
         temperature=self.TEMP,
         extra_bonds=[],
         extra_restricted_angles=[],
         extra_torsions=[],
         implicitSolventSaltConc=None,
         soluteDielectric=None,
         solventDielectric=None,
     )
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=True,
         nonbondedMethod=ff.PME,
         nonbondedCutoff=1.0,
         constraints=ff.AllBonds,
         implicitSolvent=None,
         rigidWater=True,
         hydrogenMass=4.0 * gram / mole,
         ewaldErrorTolerance=self.pme_params.tolerance,
     )
예제 #2
0
 def test_cutoff_sets_correct_method(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type="implicit",
         cutoff=1.5,
         use_big_timestep=False,
         use_bigger_timestep=False,
         implicit_solvent="obc",
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=False,
         temperature=self.TEMP,
         extra_bonds=[],
         extra_restricted_angles=[],
         extra_torsions=[],
         implicitSolventSaltConc=None,
         soluteDielectric=None,
         solventDielectric=None,
     )
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=False,
         nonbondedMethod=ff.CutoffNonPeriodic,
         nonbondedCutoff=1.5,
         constraints=ff.HBonds,
         implicitSolvent=OBC2,
         hydrogenMass=None,
         implicitSolventSaltConc=0.0,
         soluteDielectric=1.0,
         solventDielectric=78.5,
     )
예제 #3
0
 def test_big_timestep_sets_allbonds_and_hydrogen_masses(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type="implicit",
         cutoff=None,
         use_big_timestep=True,
         use_bigger_timestep=False,
         implicit_solvent="obc",
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=False,
         temperature=self.TEMP,
         extra_bonds=[],
         extra_restricted_angles=[],
         extra_torsions=[],
         implicitSolventSaltConc=None,
         soluteDielectric=None,
         solventDielectric=None,
     )
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=False,
         nonbondedMethod=ff.NoCutoff,
         nonbondedCutoff=999.,
         constraints=ff.AllBonds,
         implicitSolvent=OBC2,
         hydrogenMass=3.0 * (gram / mole),
         implicitSolventSaltConc=0.0,
         soluteDielectric=1.0,
         solventDielectric=78.5,
     )
예제 #4
0
    def test_pressure_coupling_should_add_barostat(self):
        PRESS = 2.0 * atmosphere
        STEPS = 50
        pcouple_params = PressureCouplingParams(
            enable=True,
            temperature=self.TEMP,
            pressure=PRESS,
            steps=STEPS)
        pme_params = PMEParams(
            enable=True,
            tolerance=0.0005)

        with mock.patch('meld.system.openmm_runner.runner.MonteCarloBarostat',
                        spec=MonteCarloBarostat) as mock_baro:
            mock_baro.return_value = mock.sentinel.baro_force

            _create_openmm_system(
                self.mock_parm,
                solvation_type='explicit',
                cutoff=1.0,
                use_big_timestep=False, use_bigger_timestep=False,
                implicit_solvent='vacuum',
                pme_params=pme_params,
                pcouple_params=pcouple_params,
                remove_com=True,
                temperature=self.TEMP)

            mock_baro.assert_called_with(PRESS, self.TEMP, STEPS)
            mock_sys = self.mock_parm.createSystem.return_value
            mock_sys.addForce.assert_called_with(mock.sentinel.baro_force)
예제 #5
0
    def test_no_pme_uses_cutoffs(self):
        pme_params = PMEParams(enable=False, tolerance=0.0001)

        _create_openmm_system(
            self.mock_parm,
            solvation_type="explicit",
            cutoff=1.0,
            use_big_timestep=False,
            use_bigger_timestep=False,
            implicit_solvent="vacuum",
            pme_params=pme_params,
            pcouple_params=self.pcouple_params,
            remove_com=True,
            temperature=self.TEMP,
            extra_bonds=[],
            extra_restricted_angles=[],
            extra_torsions=[],
            implicitSolventSaltConc=None,
            soluteDielectric=None,
            solventDielectric=None,
        )
        self.mock_parm.createSystem.assert_called_with(
            removeCMMotion=True,
            nonbondedMethod=ff.CutoffPeriodic,
            nonbondedCutoff=1.0,
            constraints=ff.HBonds,
            implicitSolvent=None,
            rigidWater=True,
            hydrogenMass=None,
            ewaldErrorTolerance=pme_params.tolerance,
        )
예제 #6
0
 def test_cutoff_sets_correct_method(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type="implicit",
         cutoff=1.5,
         use_big_timestep=False,
         use_bigger_timestep=False,
         implicit_solvent="obc",
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=False,
         temperature=self.TEMP,
         extra_bonds=[],
         extra_restricted_angles=[],
         extra_torsions=[],
         implicitSolventSaltConc=None,
         soluteDielectric=None,
         solventDielectric=None,
     )
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=False,
         nonbondedMethod=ff.CutoffNonPeriodic,
         nonbondedCutoff=1.5,
         constraints=ff.HBonds,
         implicitSolvent=OBC2,
         hydrogenMass=None,
         implicitSolventSaltConc=0.0,
         soluteDielectric=1.0,
         solventDielectric=78.5,
     )
예제 #7
0
 def test_bigger_timestep_sets_allbonds_and_hydrogen_masses(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type="explicit",
         cutoff=1.0,
         use_big_timestep=False,
         use_bigger_timestep=True,
         implicit_solvent="vacuum",
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=True,
         temperature=self.TEMP,
         extra_bonds=[],
         extra_restricted_angles=[],
         extra_torsions=[],
         implicitSolventSaltConc=None,
         soluteDielectric=None,
         solventDielectric=None,
     )
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=True,
         nonbondedMethod=ff.PME,
         nonbondedCutoff=1.0,
         constraints=ff.AllBonds,
         implicitSolvent=None,
         rigidWater=True,
         hydrogenMass=4.0 * gram / mole,
         ewaldErrorTolerance=self.pme_params.tolerance,
     )
예제 #8
0
    def test_no_pme_uses_cutoffs(self):
        pme_params = PMEParams(enable=False, tolerance=0.0001)

        _create_openmm_system(
            self.mock_parm,
            solvation_type="explicit",
            cutoff=1.0,
            use_big_timestep=False,
            use_bigger_timestep=False,
            implicit_solvent="vacuum",
            pme_params=pme_params,
            pcouple_params=self.pcouple_params,
            remove_com=True,
            temperature=self.TEMP,
            extra_bonds=[],
            extra_restricted_angles=[],
            extra_torsions=[],
            implicitSolventSaltConc=None,
            soluteDielectric=None,
            solventDielectric=None,
        )
        self.mock_parm.createSystem.assert_called_with(
            removeCMMotion=True,
            nonbondedMethod=ff.CutoffPeriodic,
            nonbondedCutoff=1.0,
            constraints=ff.HBonds,
            implicitSolvent=None,
            rigidWater=True,
            hydrogenMass=None,
            ewaldErrorTolerance=pme_params.tolerance,
        )
예제 #9
0
 def test_big_timestep_sets_allbonds_and_hydrogen_masses(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type="implicit",
         cutoff=None,
         use_big_timestep=True,
         use_bigger_timestep=False,
         implicit_solvent="obc",
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=False,
         temperature=self.TEMP,
         extra_bonds=[],
         extra_restricted_angles=[],
         extra_torsions=[],
         implicitSolventSaltConc=None,
         soluteDielectric=None,
         solventDielectric=None,
     )
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=False,
         nonbondedMethod=ff.NoCutoff,
         nonbondedCutoff=999.,
         constraints=ff.AllBonds,
         implicitSolvent=OBC2,
         hydrogenMass=3.0 * (gram / mole),
         implicitSolventSaltConc=0.0,
         soluteDielectric=1.0,
         solventDielectric=78.5,
     )
예제 #10
0
 def test_no_cutoff_should_set_correct_method(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type='implicit',
         cutoff=None, use_big_timestep=False,
         use_bigger_timestep=False,
         implicit_solvent='obc',
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=False,
         temperature=self.TEMP)
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=False, nonbondedMethod=ff.NoCutoff, nonbondedCutoff=999.,
         constraints=ff.HBonds, implicitSolvent=OBC2, hydrogenMass=None)
예제 #11
0
 def test_big_timestep_sets_allbonds_and_hydrogen_masses(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type='implicit',
         cutoff=None,
         use_big_timestep=True, use_bigger_timestep=False,
         implicit_solvent='obc',
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=False,
         temperature=self.TEMP)
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=False, nonbondedMethod=ff.NoCutoff,
         nonbondedCutoff=999., constraints=ff.AllBonds,
         implicitSolvent=OBC2, hydrogenMass=3.0 * (gram / mole))
예제 #12
0
 def test_bigger_timestep_sets_allbonds_and_hydrogen_masses(self):
     _create_openmm_system(
         self.mock_parm,
         solvation_type='explicit',
         cutoff=1.0,
         use_big_timestep=False, use_bigger_timestep=True,
         implicit_solvent='vacuum',
         pme_params=self.pme_params,
         pcouple_params=self.pcouple_params,
         remove_com=True,
         temperature=self.TEMP)
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=True,
         nonbondedMethod=ff.PME,
         nonbondedCutoff=1.0,
         constraints=ff.AllBonds,
         implicitSolvent=None,
         rigidWater=True,
         hydrogenMass=4.0 * gram / mole,
         ewaldErrorTolerance=self.pme_params.tolerance)
 def test_gbneck2_sets_correct_solvent_model(self):
     _create_openmm_system(self.mock_parm,
                           solvation_type='implicit',
                           cutoff=None,
                           use_big_timestep=False,
                           use_bigger_timestep=False,
                           implicit_solvent='gbNeck2',
                           pme_params=self.pme_params,
                           pcouple_params=self.pcouple_params,
                           remove_com=False,
                           temperature=self.TEMP,
                           extra_bonds=[],
                           extra_restricted_angles=[],
                           extra_torsions=[])
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=False,
         nonbondedMethod=ff.NoCutoff,
         nonbondedCutoff=999.,
         constraints=ff.HBonds,
         implicitSolvent=GBn2,
         hydrogenMass=None)
 def test_enables_pme_and_cutoffs(self):
     _create_openmm_system(self.mock_parm,
                           solvation_type='explicit',
                           cutoff=1.0,
                           use_big_timestep=False,
                           use_bigger_timestep=False,
                           implicit_solvent='vacuum',
                           pme_params=self.pme_params,
                           pcouple_params=self.pcouple_params,
                           remove_com=True,
                           temperature=self.TEMP,
                           extra_bonds=[],
                           extra_restricted_angles=[],
                           extra_torsions=[])
     self.mock_parm.createSystem.assert_called_with(
         removeCMMotion=True,
         nonbondedMethod=ff.PME,
         nonbondedCutoff=1.0,
         constraints=ff.HBonds,
         implicitSolvent=None,
         rigidWater=True,
         hydrogenMass=None,
         ewaldErrorTolerance=self.pme_params.tolerance)
예제 #15
0
    def test_pressure_coupling_should_add_barostat(self):
        PRESS = 2.0 * atmosphere
        STEPS = 50
        pcouple_params = PressureCouplingParams(enable=True,
                                                temperature=self.TEMP,
                                                pressure=PRESS,
                                                steps=STEPS)
        pme_params = PMEParams(enable=True, tolerance=0.0005)

        with mock.patch(
                "meld.system.openmm_runner.runner.MonteCarloBarostat",
                spec=MonteCarloBarostat,
        ) as mock_baro:
            mock_baro.return_value = mock.sentinel.baro_force

            _create_openmm_system(
                self.mock_parm,
                solvation_type="explicit",
                cutoff=1.0,
                use_big_timestep=False,
                use_bigger_timestep=False,
                implicit_solvent="vacuum",
                pme_params=pme_params,
                pcouple_params=pcouple_params,
                remove_com=True,
                temperature=self.TEMP,
                extra_bonds=[],
                extra_restricted_angles=[],
                extra_torsions=[],
                implicitSolventSaltConc=None,
                soluteDielectric=None,
                solventDielectric=None,
            )

            mock_baro.assert_called_with(PRESS, self.TEMP, STEPS)
            mock_sys = self.mock_parm.createSystem.return_value
            mock_sys.addForce.assert_called_with(mock.sentinel.baro_force)
예제 #16
0
    def test_no_pme_uses_cutoffs(self):
        pme_params = PMEParams(
            enable=False,
            tolerance=0.0001)

        _create_openmm_system(
            self.mock_parm,
            solvation_type='explicit',
            cutoff=1.0,
            use_big_timestep=False, use_bigger_timestep=False,
            implicit_solvent='vacuum',
            pme_params=pme_params,
            pcouple_params=self.pcouple_params,
            remove_com=True,
            temperature=self.TEMP)
        self.mock_parm.createSystem.assert_called_with(
            removeCMMotion=True,
            nonbondedMethod=ff.CutoffPeriodic,
            nonbondedCutoff=1.0,
            constraints=ff.HBonds,
            implicitSolvent=None,
            rigidWater=True,
            hydrogenMass=None,
            ewaldErrorTolerance=pme_params.tolerance)
예제 #17
0
    def test_pressure_coupling_should_add_barostat(self):
        PRESS = 2.0 * atmosphere
        STEPS = 50
        pcouple_params = PressureCouplingParams(
            enable=True, temperature=self.TEMP, pressure=PRESS, steps=STEPS
        )
        pme_params = PMEParams(enable=True, tolerance=0.0005)

        with mock.patch(
            "meld.system.openmm_runner.runner.MonteCarloBarostat",
            spec=MonteCarloBarostat,
        ) as mock_baro:
            mock_baro.return_value = mock.sentinel.baro_force

            _create_openmm_system(
                self.mock_parm,
                solvation_type="explicit",
                cutoff=1.0,
                use_big_timestep=False,
                use_bigger_timestep=False,
                implicit_solvent="vacuum",
                pme_params=pme_params,
                pcouple_params=pcouple_params,
                remove_com=True,
                temperature=self.TEMP,
                extra_bonds=[],
                extra_restricted_angles=[],
                extra_torsions=[],
                implicitSolventSaltConc=None,
                soluteDielectric=None,
                solventDielectric=None,
            )

            mock_baro.assert_called_with(PRESS, self.TEMP, STEPS)
            mock_sys = self.mock_parm.createSystem.return_value
            mock_sys.addForce.assert_called_with(mock.sentinel.baro_force)
예제 #18
0
 def test_big_timestep_sets_allbonds_and_hydrogen_masses(self):
     _create_openmm_system(self.mock_parm, cutoff=None, use_big_timestep=True, implicit_solvent='obc', remove_com=False)
     self.mock_parm.createSystem.assert_called_with(removeCMMotion=False, nonbondedMethod=ff.NoCutoff, nonbondedCutoff=999.,
                                                    constraints=ff.AllBonds, implicitSolvent=OBC2, hydrogenMass=3.0 * (gram / mole))
예제 #19
0
 def test_cutoff_sets_correct_method(self):
     _create_openmm_system(self.mock_parm, cutoff=1.5, use_big_timestep=False, implicit_solvent='obc', remove_com=False)
     self.mock_parm.createSystem.assert_called_with(removeCMMotion=False, nonbondedMethod=ff.CutoffNonPeriodic, nonbondedCutoff=1.5,
                                                    constraints=ff.HBonds, implicitSolvent=OBC2, hydrogenMass=None)
예제 #20
0
 def test_gbneck2_sets_correct_solvent_model(self):
     _create_openmm_system(self.mock_parm, cutoff=None, use_big_timestep=False, implicit_solvent='gbNeck2', remove_com=False)
     self.mock_parm.createSystem.assert_called_with(removeCMMotion=False, nonbondedMethod=ff.NoCutoff, nonbondedCutoff=999.,
                                                    constraints=ff.HBonds, implicitSolvent=GBn2, hydrogenMass=None)