[cig-commits] [commit] solid_solution_molar_mass: added test for molar_mass() (d96ae53)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Jan 1 05:12:13 PST 2015


Repository : https://github.com/geodynamics/burnman

On branch  : solid_solution_molar_mass
Link       : https://github.com/geodynamics/burnman/compare/0000000000000000000000000000000000000000...fe211b4b277a753e04e153250e4ed8b270dee9b7

>---------------------------------------------------------------

commit d96ae534b3bb1e52c6be6df6bbe8a128092105ff
Author: sannecottaar <sanne.cottaar at gmail.com>
Date:   Thu Jan 1 13:58:53 2015 +0100

    added test for molar_mass()


>---------------------------------------------------------------

d96ae534b3bb1e52c6be6df6bbe8a128092105ff
 burnman/solidsolution.py    | 2 +-
 tests/test_solidsolution.py | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/burnman/solidsolution.py b/burnman/solidsolution.py
index 672ea34..07e44c5 100644
--- a/burnman/solidsolution.py
+++ b/burnman/solidsolution.py
@@ -68,7 +68,7 @@ class SolidSolution(Mineral):
         """
         Returns molar mass of the mineral [kg/mol]
         """
-	molar_mass = sum([ self.base_material[i][0].params['molar_mass'] * self.molar_fraction[i] for i in range(self.n_endmembers) ])
+	molar_mass = sum([ self.base_material[i][0].molar_mass() * self.molar_fraction[i] for i in range(self.n_endmembers) ])
         return molar_mass
 
     def set_method(self, method):
diff --git a/tests/test_solidsolution.py b/tests/test_solidsolution.py
index dfc4a79..c08a64a 100644
--- a/tests/test_solidsolution.py
+++ b/tests/test_solidsolution.py
@@ -202,8 +202,13 @@ class test_solidsolution(BurnManTest):
         self.assertArraysAlmostEqual(site_fill, ones)
 
     def test_set_method(self):
-       ss = olivine_ss()
-       ss.set_method('mtait')
+        ss = olivine_ss()
+        ss.set_method('mtait')
+
+    def test_molar_mass(self):
+        ss=olivine_ss()
+	ss.set_composition( np.array( [0.5, 0.5]))
+	self.assertArraysAlmostEqual([ss.molar_mass()], [0.1722331])
 
 if __name__ == '__main__':
     unittest.main()



More information about the CIG-COMMITS mailing list