def test_creating_restraint_should_raise_if_ramp_is_wrong_type(self): scaler = restraints.ConstantScaler() ramp = restraints.ConstantScaler() with self.assertRaises(ValueError): _rest = self.manager.create_restraint( "distance", scaler, ramp=ramp, atom1=self.system.index.atom(0, "CA"), atom2=self.system.index.atom(1, "CA"), r1=0.0, r2=1.0, r3=3.0, r4=4.0, k=1.0, )
def test_creating_restraint_should_raise_if_ramp_is_wrong_type(self): scaler = restraints.ConstantScaler() ramp = restraints.ConstantScaler() self.mock_system.index_of_atom.side_effect = [0, 1] with self.assertRaises(ValueError): _rest = self.manager.create_restraint( "distance", scaler, ramp=ramp, atom_1_res_index=1, atom_1_name="CA", atom_2_res_index=2, atom_2_name="CA", r1=0., r2=1., r3=3., r4=4., k=1.0, )
def test_create_restraint_without_specifying_ramp_should_use_constant_ramp( self): scaler = restraints.ConstantScaler() rest = self.manager.create_restraint( "distance", scaler, atom1=self.system.index.atom(0, "CA"), atom2=self.system.index.atom(1, "CA"), r1=0.0 * u.nanometer, r2=1.0 * u.nanometer, r3=3.0 * u.nanometer, r4=4.0 * u.nanometer, k=1.0 * u.kilojoule_per_mole / u.nanometer**2, ) self.assertTrue(isinstance(rest.ramp, restraints.ConstantRamp))
def test_create_restraint_without_specifying_ramp_should_use_constant_ramp( self): scaler = restraints.ConstantScaler() self.mock_system.index_of_atom.side_effect = [0, 1] rest = self.manager.create_restraint( "distance", scaler, atom_1_res_index=1, atom_1_name="CA", atom_2_res_index=2, atom_2_name="CA", r1=0., r2=1., r3=3., r4=4., k=1.0, ) self.assertTrue(isinstance(rest.ramp, restraints.ConstantRamp))
def test_should_raise_if_alpha_is_greater_than_one(self): scaler = restraints.ConstantScaler() with self.assertRaises(RuntimeError): scaler(2.0)
def test_should_raise_if_alpha_is_less_than_zero(self): scaler = restraints.ConstantScaler() with self.assertRaises(RuntimeError): scaler(-1.0)
def test_should_return_1_when_alpha_is_1(self): scaler = restraints.ConstantScaler() self.assertAlmostEqual(scaler(1.0), 1.0)
def setUp(self): p = SubSystemFromSequence("GLY GLY GLY GLY") b = SystemBuilder() self.system = b.build_system([p]) self.scaler = restraints.ConstantScaler() self.ramp = restraints.ConstantRamp()
def setUp(self): self.mock_system = mock.Mock() self.scaler = restraints.ConstantScaler() self.ramp = restraints.ConstantRamp()
def setUp(self): p = system.ProteinMoleculeFromSequence("GLY GLY GLY GLY") b = system.SystemBuilder() self.system = b.build_system_from_molecules([p]) self.scaler = restraints.ConstantScaler() self.ramp = restraints.ConstantRamp()