Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 3
0
Archivo: compound.py Proyecto: FHe/tdl
 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
Ejemplo n.º 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
Ejemplo n.º 5
0
Archivo: compound.py Proyecto: FHe/tdl
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
Ejemplo n.º 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