[cig-commits] [commit] add_thermodynamic_potentials: Bug fix for formula parsing (0219d63)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Tue Dec 9 09:56:14 PST 2014


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

On branch  : add_thermodynamic_potentials
Link       : https://github.com/geodynamics/burnman/compare/2e5646d93cedbbf8eae54cc37cffc14e0aa85180...d5ddad03ff9f30f5a4efaddb4e3ec585ea1a7c51

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

commit 0219d632965e1322962a87494b5cd20dcb1caa42
Author: Bob Myhill <myhill.bob at gmail.com>
Date:   Wed Sep 3 09:42:44 2014 +0200

    Bug fix for formula parsing


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

0219d632965e1322962a87494b5cd20dcb1caa42
 burnman/processchemistry.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/burnman/processchemistry.py b/burnman/processchemistry.py
index b52d7fe..033536a 100644
--- a/burnman/processchemistry.py
+++ b/burnman/processchemistry.py
@@ -195,11 +195,17 @@ def ProcessSolidSolutionChemistry(formulae):
                     element_index=sites[site].index(element_on_site)
                 list_occupancies[endmember][site][element_index]=proportion_element_on_site
 
+            # Loop over elements after site
             if len(site_split) != 1:
                 not_in_site=filter(None, site_split[1])
                 not_in_site=not_in_site.replace(mult, '', 1)
                 for enamenumber in re.findall('[A-Z][^A-Z]*', not_in_site):
                     element=filter(None, re.split(r'(\d+)', enamenumber))
+                    # Look up number of atoms of element
+                    if len(element) == 1:
+                        nel=1.
+                    else: 
+                        nel=float(float(element[1])
                     solution_formula[element[0]]=solution_formula.get(element[0], 0.0) + float(element[1])
 
         solution_formulae.append(solution_formula)



More information about the CIG-COMMITS mailing list