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, )
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
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.], )
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.], )
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
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.], )
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.], )
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, )