예제 #1
0
 def test_should_raise_when_dims_has_non_xyz(self):
     with self.assertRaises(ValueError):
         restraints.AbsoluteCOMRestraint(
             system=self.system,
             scaler=self.scaler,
             ramp=self.ramp,
             group=[(1, "CA")],
             weights=None,
             dims="a",  # not xyz
             force_const=1 * u.kilojoule_per_mole / u.nanometer**2,
             position=np.array([0.0, 0.0, 0.0]) * u.nanometer,
         )
예제 #2
0
 def test_should_raise_on_position_wrong_shape(self):
     with self.assertRaises(ValueError):
         restraints.AbsoluteCOMRestraint(
             system=self.system,
             scaler=self.scaler,
             ramp=self.ramp,
             group=[(1, "CA")],
             weights=None,
             dims="xyz",
             force_const=1 * u.kilojoule_per_mole / u.nanometer**2,
             position=np.array([0.0, 0.0, 0.0, 0.0]) * u.nanometer,
         )  # too many positions
예제 #3
0
 def test_should_raise_on_negative_weight(self):
     with self.assertRaises(ValueError):
         restraints.AbsoluteCOMRestraint(
             system=self.system,
             scaler=self.scaler,
             ramp=self.ramp,
             group=[(1, "CA"), (2, "CA")],
             weights=[1., -1.],
             dims="xyz",
             force_const=1,
             position=[0., 0., 0.],
         )
예제 #4
0
 def test_should_raise_on_size_mismatch(self):
     with self.assertRaises(ValueError):
         restraints.AbsoluteCOMRestraint(
             system=self.system,
             scaler=self.scaler,
             ramp=self.ramp,
             group=[(1, "CA")],
             weights=[1., 1.],  # too many weights
             dims="xyz",
             force_const=1,
             position=[0., 0., 0.],
         )
예제 #5
0
 def test_should_raise_on_position_wrong_shape(self):
     with self.assertRaises(ValueError):
         restraints.AbsoluteCOMRestraint(
             system=self.system,
             scaler=self.scaler,
             ramp=self.ramp,
             group=[(1, "CA")],
             weights=None,
             dims="xyz",
             force_const=1,
             position=[0., 0., 0., 0.],
         )  # too many positions
예제 #6
0
 def test_should_raise_on_repeated_dim(self):
     with self.assertRaises(ValueError):
         restraints.AbsoluteCOMRestraint(
             system=self.system,
             scaler=self.scaler,
             ramp=self.ramp,
             group=[(1, "CA")],
             weights=None,
             dims="xx",  # repeated
             force_const=1,
             position=[0., 0., 0.],
         )
예제 #7
0
 def test_should_raise_when_dims_has_non_xyz(self):
     with self.assertRaises(ValueError):
         restraints.AbsoluteCOMRestraint(
             system=self.system,
             scaler=self.scaler,
             ramp=self.ramp,
             group=[(1, "CA")],
             weights=None,
             dims="a",  # not xyz
             force_const=1,
             position=[0., 0., 0.],
         )
예제 #8
0
 def test_should_raise_on_size_mismatch(self):
     group = [self.system.index.atom(0, "CA")]
     with self.assertRaises(ValueError):
         restraints.AbsoluteCOMRestraint(
             system=self.system,
             scaler=self.scaler,
             ramp=self.ramp,
             group=group,
             weights=[1.0, 1.0],  # too many weights
             dims="xyz",
             force_const=1 * u.kilojoule_per_mole / u.nanometer**2,
             position=np.array([0.0, 0.0, 0.0]) * u.nanometer,
         )