def perturb(self, entry, unperturb=False): """ Perturb E0 of `entry` which could be either a :class:TransitionState or a :class:Configuration In the latter case, only the first species in the Configuration.species list is perturbed. The perturbation is done by addition of the energy amount in self.perturbation. If unperturb is `False`, the perturbation is addition of the energy amount in self.perturbation. If unperturb is `False`, this is done by subtracting. """ perturbation = self.perturbation.value_si if unperturb: perturbation *= -1 if isinstance(entry, TransitionState): entry.conformer.E0 = quantity.Energy(entry.conformer.E0.value_si + perturbation, 'J/mol') elif isinstance(entry, Configuration): entry.species[0].conformer.E0 = quantity.Energy(entry.species[0].conformer.E0.value_si + perturbation, 'J/mol')
def test_Kelvin(self): """ Test the creation of an energy quantity with units of K (not really an energy!). """ q = quantity.Energy(10.0, "K") self.assertAlmostEqual(q.value, 10 * 8.314472, delta=1e-6) self.assertEqual(q.units, "J/mol")
def test_kcalpermol(self): """ Test the creation of an energy quantity with units of kcal/mol. """ q = quantity.Energy(1.0, "kcal/mol") self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 4184., delta=1e-6) self.assertEqual(q.units, "kcal/mol")
def test_joule_per_mol(self): """ Test the creation of an energy quantity with units of J/mol. """ q = quantity.Energy(1.0, "J/mol") self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 1.0, delta=1e-6) self.assertEqual(q.units, "J/mol")
def test_kcal(self): """ Test the creation of an energy quantity with units of kcal. """ try: q = quantity.Energy(1.0, "kcal") self.fail('Allowed invalid unit type "kcal".') except quantity.QuantityError: pass
def test_joule(self): """ Test the creation of an energy quantity with units of J. """ try: quantity.Energy(1.0, "J") self.fail('Allowed invalid unit type "J".') except quantity.QuantityError: pass
def maximum_grain_size(self, value): self._maximum_grain_size = quantity.Energy(value)
def maximumGrainSize(self, value): self._maximumGrainSize = quantity.Energy(value)