Exemple #1
0
    def init_energy(self,):
        """
        Change the incident energy of the calc

        get fp,fpp from ifeffit for index of refraction calcs
        """
        if len(self.fp) != self.nelem:
            self.fp    = num.zeros(self.nelem, dtype=num.double)
            self.fpp   = num.zeros(self.nelem, dtype=num.double)
            self.amu   = num.zeros(self.nelem, dtype=num.double)
            self._init_ptr  = True

        energy = self.calc_params[0]
        for j in range(self.nelem):
            en = [energy, energy + 1.]
            self.iff.put_array('calc.en',en)
            cmd = 'f1f2(energy=calc.en,z=%i)' % self.elem_z[j]
            self.iff.ifeffit(cmd)
            fp  = self.iff.get_array('calc.f1')
            fpp = self.iff.get_array('calc.f2')
            #
            self.fp[j]  = fp[0]
            self.fpp[j] = fpp[0]
            self.amu[j] = elements.amu(self.elem_z[j])

        self._init_en = False
Exemple #2
0
    def init_energy(self, ):
        """
        Change the incident energy of the calc

        get fp,fpp from ifeffit for index of refraction calcs
        """
        if len(self.fp) != self.nelem:
            self.fp = num.zeros(self.nelem, dtype=num.double)
            self.fpp = num.zeros(self.nelem, dtype=num.double)
            self.amu = num.zeros(self.nelem, dtype=num.double)
            self._init_ptr = True

        energy = self.calc_params[0]
        for j in range(self.nelem):
            en = [energy, energy + 1.]
            self.iff.put_array('calc.en', en)
            cmd = 'f1f2(energy=calc.en,z=%i)' % self.elem_z[j]
            self.iff.ifeffit(cmd)
            fp = self.iff.get_array('calc.f1')
            fpp = self.iff.get_array('calc.f2')
            #
            self.fp[j] = fp[0]
            self.fpp[j] = fpp[0]
            self.amu[j] = elements.amu(self.elem_z[j])

        self._init_en = False
Exemple #3
0
 def _calc_mw(self,):
     """
     compute molecular wieght (g/mole)
     """
     mw = 0.0
     for el in self.formula.keys():
         nu = self.formula[el]
         aw = elements.amu(el)
         mw = mw + nu*aw
     self.mw = mw
Exemple #4
0
 def _calc_mw(self, ):
     """
     compute molecular wieght (g/mole)
     """
     mw = 0.0
     for el in self.formula.keys():
         nu = self.formula[el]
         aw = elements.amu(el)
         mw = mw + nu * aw
     self.mw = mw
Exemple #5
0
def element_mass_fraction(f,el):
    """
    Compute the mass fraction of an element in a species
    (multiply by 100 for wt%, 1e6 for ppm and 1e9 for ppb)

    Parameters
    ----------
    * f is a species or component instance (or string - see parse_formula)
    * el is a a string, e.g. 'Al', 'As' etc..

    """
    if type(f) == types.StringType:
        f = parse_formula(f)
        f = Species(formula=f)
    nu = f.nuZ(el)
    if nu == 0: return 0.
    aw = elements.amu(el)
    frac = nu*aw/f.mw
    return frac
Exemple #6
0
def element_mass_fraction(f, el):
    """
    Compute the mass fraction of an element in a species
    (multiply by 100 for wt%, 1e6 for ppm and 1e9 for ppb)

    Parameters
    ----------
    * f is a species or component instance (or string - see parse_formula)
    * el is a a string, e.g. 'Al', 'As' etc..

    """
    if type(f) == types.StringType:
        f = parse_formula(f)
        f = Species(formula=f)
    nu = f.nuZ(el)
    if nu == 0: return 0.
    aw = elements.amu(el)
    frac = nu * aw / f.mw
    return frac