[cig-commits] [commit] inversion, master, validate_MT_params: Bug fix for formula parsing (a7672d4)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Dec 12 18:25:28 PST 2014


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

On branches: inversion,master,validate_MT_params
Link       : https://github.com/geodynamics/burnman/compare/80c2a295c42dfdb38f83f6c1334bf7d8f97a8463...409647ff05dfad6a686198cac1481bd46b5e2e62

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

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