[cig-commits] [commit] add_gibbs_energy: Bug fix for formula parsing (a7672d4)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Dec 11 17:11:29 PST 2014


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

On branch  : add_gibbs_energy
Link       : https://github.com/geodynamics/burnman/compare/0000000000000000000000000000000000000000...2148b324d3e8aa7b527f831eb397590942563008

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

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

    Bug fix for formula parsing


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

a7672d461f6237b13dfb4badbc72ee4420f36d3e
 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