[cig-commits] [commit] master: convert tabs to spaces (5a2021f)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Thu Dec 11 12:20:09 PST 2014
Repository : https://github.com/geodynamics/burnman
On branch : master
Link : https://github.com/geodynamics/burnman/compare/c5ec36a308413012ee5b0763ccb541c2ad56f382...bc315ff9a2ed1d4871962882f0626468342f1ffc
>---------------------------------------------------------------
commit 5a2021ff3a4596f99ef9d52c88997f9717e1a6b8
Author: Timo Heister <timo.heister at gmail.com>
Date: Thu Dec 11 10:32:42 2014 -0800
convert tabs to spaces
>---------------------------------------------------------------
5a2021ff3a4596f99ef9d52c88997f9717e1a6b8
burnman/mineral.py | 20 ++++++++++----------
burnman/mineral_helpers.py | 46 ++++++++++++++++++++++------------------------
2 files changed, 32 insertions(+), 34 deletions(-)
diff --git a/burnman/mineral.py b/burnman/mineral.py
index 860fc96..d0fd7d6 100644
--- a/burnman/mineral.py
+++ b/burnman/mineral.py
@@ -39,12 +39,12 @@ class Mineral(Material):
"""
def __init__(self):
- if 'params' not in self.__dict__:
- self.params={}
- if 'equation_of_state' in self.params:
- self.set_method(self.params['equation_of_state'])
- else:
- self.method=None
+ if 'params' not in self.__dict__:
+ self.params={}
+ if 'equation_of_state' in self.params:
+ self.set_method(self.params['equation_of_state'])
+ else:
+ self.method=None
def set_method(self, method):
"""
@@ -54,9 +54,9 @@ class Mineral(Material):
or 'slb3'. Alternatively, you can pass a user defined
class which derives from the equation_of_state base class.
"""
- if 'equation_of_state' in self.params:
- if self.params['equation_of_state'] is not method:
- warnings.warn('Overriding database equation of state. From '+self.params['equation_of_state'] +' to ' + method)
+ if 'equation_of_state' in self.params:
+ if self.params['equation_of_state'] is not method:
+ warnings.warn('Overriding database equation of state. From '+self.params['equation_of_state'] +' to ' + method)
if( isinstance(method, basestring)):
if (method == "slb2"):
self.method = slb.SLB2()
@@ -107,7 +107,7 @@ class Mineral(Material):
self.temperature = temperature
self.old_params = self.params
- if self.method==None:
+ if self.method==None:
raise AttributeError, "no method set for mineral, or equation_of_state given in mineral.params"
self.V = self.method.volume(self.pressure, self.temperature, self.params)
diff --git a/burnman/mineral_helpers.py b/burnman/mineral_helpers.py
index 69f73fb..05f2a26 100644
--- a/burnman/mineral_helpers.py
+++ b/burnman/mineral_helpers.py
@@ -35,22 +35,20 @@ class HelperSolidSolution(Mineral):
comes up with a new mineral by doing a weighted arithmetic
average of the end member minerals
"""
- self.base_materials = base_materials
- self.molar_fraction = molar_fraction
- assert(len(base_materials) == len(molar_fraction))
- assert(sum(molar_fraction) > 0.9999)
- assert(sum(molar_fraction) < 1.0001)
- #does not make sense to do a solid solution with different number of
- #atoms per formula unit or different equations of state, at least not simply...
- for m in base_materials:
- if(base_materials[0].params.has_key('n')):
- assert(m.params['n'] == base_materials[0].params['n'])
-
- self.method=base_materials[0].method
-
- self.params = {}
-
+ self.base_materials = base_materials
+ self.molar_fraction = molar_fraction
+ assert(len(base_materials) == len(molar_fraction))
+ assert(sum(molar_fraction) > 0.9999)
+ assert(sum(molar_fraction) < 1.0001)
+ #does not make sense to do a solid solution with different number of
+ #atoms per formula unit or different equations of state, at least not simply...
+ for m in base_materials:
+ if(base_materials[0].params.has_key('n')):
+ assert(m.params['n'] == base_materials[0].params['n'])
+
+ self.method=base_materials[0].method
+ self.params = {}
def debug_print(self, indent=""):
print "%sHelperSolidSolution(%s):" % (indent, self.to_string())
@@ -64,16 +62,16 @@ class HelperSolidSolution(Mineral):
mat.method = self.method
mat.set_state(pressure, temperature)
- itrange = range(0, len(self.base_materials))
+ itrange = range(0, len(self.base_materials))
self.params = {}
- for prop in self.base_materials[0].params:
- try:
- self.params[prop] = sum([ self.base_materials[i].params[prop] * self.molar_fraction[i] for i in itrange ])
- except TypeError:
- #if there is a type error, it is probably a string. Just go with the value of the first base_material.
- self.params[prop] = self.base_materials[0].params[prop]
+ for prop in self.base_materials[0].params:
+ try:
+ self.params[prop] = sum([ self.base_materials[i].params[prop] * self.molar_fraction[i] for i in itrange ])
+ except TypeError:
+ #if there is a type error, it is probably a string. Just go with the value of the first base_material.
+ self.params[prop] = self.base_materials[0].params[prop]
- Mineral.set_state(self,pressure,temperature)
+ Mineral.set_state(self,pressure,temperature)
class HelperSpinTransition(Material):
"""
@@ -92,7 +90,7 @@ class HelperSpinTransition(Material):
self.ls_mat = ls_mat
self.hs_mat = hs_mat
self.active_mat = None
- self.method=ls_mat.method
+ self.method=ls_mat.method
def debug_print(self, indent=""):
print "%sHelperSpinTransition:" % indent
More information about the CIG-COMMITS
mailing list