Ejemplo n.º 1
0
 def test_flexibleConstraints(self):
     """ Test the flexibleConstraints keyword """
     topology = self.pdb1.topology
     system1 = self.forcefield1.createSystem(topology, constraints=HAngles,
                                             rigidWater=True)
     system2 = self.forcefield1.createSystem(topology, constraints=HAngles,
                                             rigidWater=True, flexibleConstraints=True)
     system3 = self.forcefield1.createSystem(topology, constraints=None, rigidWater=False)
     validateConstraints(self, topology, system1, HAngles, True)
     # validateConstraints fails for system2 since by definition atom pairs can be in both bond
     # and constraint lists. So just check that the number of constraints is the same for both
     # system1 and system2
     self.assertEqual(system1.getNumConstraints(), system2.getNumConstraints())
     for force in system1.getForces():
         if isinstance(force, HarmonicBondForce):
             bf1 = force
         elif isinstance(force, HarmonicAngleForce):
             af1 = force
     for force in system2.getForces():
         if isinstance(force, HarmonicBondForce):
             bf2 = force
         elif isinstance(force, HarmonicAngleForce):
             af2 = force
     for force in system3.getForces():
         if isinstance(force, HarmonicAngleForce):
             af3 = force
     # Make sure we picked up extra bond terms with flexibleConstraints
     self.assertGreater(bf2.getNumBonds(), bf1.getNumBonds())
     # Make sure flexibleConstraints yields just as many angles as no constraints
     self.assertEqual(af2.getNumAngles(), af3.getNumAngles())
Ejemplo n.º 2
0
 def test_flexibleConstraints(self):
     """ Test the flexibleConstraints keyword """
     topology = self.pdb1.topology
     system1 = self.forcefield1.createSystem(topology, constraints=HAngles,
                                             rigidWater=True)
     system2 = self.forcefield1.createSystem(topology, constraints=HAngles,
                                             rigidWater=True, flexibleConstraints=True)
     system3 = self.forcefield1.createSystem(topology, constraints=None, rigidWater=False)
     validateConstraints(self, topology, system1, HAngles, True)
     # validateConstraints fails for system2 since by definition atom pairs can be in both bond
     # and constraint lists. So just check that the number of constraints is the same for both
     # system1 and system2
     self.assertEqual(system1.getNumConstraints(), system2.getNumConstraints())
     for force in system1.getForces():
         if isinstance(force, HarmonicBondForce):
             bf1 = force
         elif isinstance(force, HarmonicAngleForce):
             af1 = force
     for force in system2.getForces():
         if isinstance(force, HarmonicBondForce):
             bf2 = force
         elif isinstance(force, HarmonicAngleForce):
             af2 = force
     for force in system3.getForces():
         if isinstance(force, HarmonicAngleForce):
             af3 = force
     # Make sure we picked up extra bond terms with flexibleConstraints
     self.assertGreater(bf2.getNumBonds(), bf1.getNumBonds())
     # Make sure flexibleConstraints yields just as many angles as no constraints
     self.assertEqual(af2.getNumAngles(), af3.getNumAngles())
Ejemplo n.º 3
0
    def test_RigidWaterAndConstraints(self):
        """Test all eight options for the constraints and rigidWater parameters."""

        topology = self.prmtop1.topology
        for constraints_value in [None, HBonds, AllBonds, HAngles]:
            for rigidWater_value in [True, False]:
                system = self.prmtop1.createSystem(constraints=constraints_value, rigidWater=rigidWater_value)
                validateConstraints(self, topology, system, constraints_value, rigidWater_value)
Ejemplo n.º 4
0
    def test_RigidWaterAndConstraints(self):
        """Test all eight options for the constraints and rigidWater parameters."""

        topology = prmtop1.topology
        for constraints_value in [None, HBonds, AllBonds, HAngles]:
            for rigidWater_value in [True, False]:
                system = prmtop1.createSystem(constraints=constraints_value,
                                              rigidWater=rigidWater_value)
                validateConstraints(self, topology, system, constraints_value,
                                    rigidWater_value)