Beispiel #1
0
 def molecular_weight(self):
     """The molecular weight of the species. (Note: value_si is in kg/molecule not kg/mol)"""
     if self._molecular_weight is None and self.molecule is not None and len(
             self.molecule) > 0:
         self._molecular_weight = quantity.Mass(
             self.molecule[0].get_molecular_weight(), 'kg/mol')
     return self._molecular_weight
Beispiel #2
0
 def test_amu(self):
     """
     Test the creation of a mass quantity with units of amu.
     """
     q = quantity.Mass(1.0, "amu")
     self.assertAlmostEqual(q.value, 1.0, 6)
     self.assertAlmostEqual(q.value_si, constants.amu, delta=1e-32)
     self.assertEqual(q.units, "amu")
Beispiel #3
0
 def test_kg(self):
     """
     Test the creation of a mass quantity with units of kg.
     """
     q = quantity.Mass(1.0, "kg")
     self.assertAlmostEqual(q.value, 1.0, 6)
     self.assertAlmostEqual(q.value_si, 1.0, delta=1e-6)
     self.assertEqual(q.units, "kg")
Beispiel #4
0
 def test_kgpermol(self):
     """
     Test the creation of a mass quantity with units of kg/mol.
     Note that kg/mol is automatically coerced to amu.
     """
     q = quantity.Mass(1.0, "kg/mol")
     self.assertAlmostEqual(q.value, 1000.0, 3)
     self.assertAlmostEqual(q.value_si, 1000. * constants.amu, delta=1e-29)
     self.assertEqual(q.units, "amu")
Beispiel #5
0
 def molecular_weight(self, value):
     self._molecular_weight = quantity.Mass(value)
Beispiel #6
0
 def setMolecularWeight(self, value):
     self._molecularWeight = quantity.Mass(value)