当前位置: 首页>>代码示例>>Python>>正文


Python Material.molecular_mass方法代码示例

本文整理汇总了Python中pyne.material.Material.molecular_mass方法的典型用法代码示例。如果您正苦于以下问题:Python Material.molecular_mass方法的具体用法?Python Material.molecular_mass怎么用?Python Material.molecular_mass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyne.material.Material的用法示例。


在下文中一共展示了Material.molecular_mass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_from_atom_frac_meth

# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import molecular_mass [as 别名]
def test_from_atom_frac_meth():
    h2o = {10010000: 2.0, 80160000: 1.0}
    mat = Material()
    mat.from_atom_frac(h2o)
    assert_equal(mat.atoms_per_molecule, 3.0)
    assert_equal(mat.comp[10010000], 0.11191487328808077)
    assert_equal(mat.comp[80160000], 0.8880851267119192)
    assert_equal(mat.mass, 18.01056468403)    
    assert_equal(mat.molecular_mass(), 18.01056468403)    

    h2 = Material({10010000: 1.0}, atoms_per_molecule=2.0)
    h2o = {'O16': 1.0, h2: 1.0}
    mat = Material()
    mat.from_atom_frac(h2o)
    assert_equal(mat.atoms_per_molecule, 3.0)
    assert_equal(mat.comp[10010000], 0.11191487328808077)
    assert_equal(mat.comp[80160000], 0.8880851267119192)
    assert_equal(mat.molecular_mass(), 18.01056468403)    

    ihm = Material()
    ihm.from_atom_frac({922350000: 0.5, 922380000: 0.5})
    uox = {ihm: 1.0, 'O16': 2.0}
    mat = Material()
    mat.from_atom_frac(uox)
    assert_equal(mat.atoms_per_molecule, 3.0)
    assert_almost_equal(mat.comp[80160000], 0.11912625367051276, 16)
    assert_almost_equal(mat.comp[922350000], 0.43763757904405304, 15)
    assert_almost_equal(mat.comp[922380000], 0.44323616728543414, 15)
    assert_almost_equal(mat.molecular_mass()/268.53718851614, 1.0, 15)
开发者ID:NukespudWork,项目名称:pyne,代码行数:31,代码来源:test_material.py

示例2: test_to_atom_frac

# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import molecular_mass [as 别名]
def test_to_atom_frac():
    h2o = {10010000: 0.11191487328808077, 80160000: 0.8880851267119192}
    mat = Material(h2o, atoms_per_molecule=3.0)
    af = mat.to_atom_frac()
    assert_equal(mat.atoms_per_molecule, 3.0)
    assert_equal(af[10010000], 2.0)
    assert_equal(af[80160000], 1.0)
    assert_equal(mat.molecular_mass(), 18.01056468403)    
开发者ID:NukespudWork,项目名称:pyne,代码行数:10,代码来源:test_material.py

示例3: test_molecular_mass

# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import molecular_mass [as 别名]
    def test_molecular_mass(self):
        mat_empty = Material({})
        assert_equal(mat_empty.molecular_mass(), 0.0)

        mat_u238 = Material({922380000: 1.0})
        mw_u238 = mat_u238.molecular_mass()
        try:
            assert_almost_equal(mw_u238, 238.050788423)
        except AssertionError:
            assert_almost_equal(mw_u238, 238.0)            

        mat_mixed = Material({922350000: 0.5, 922380000: 0.5})
        mw_mixed = mat_mixed.molecular_mass()
        try:
            assert_almost_equal(mw_mixed/236.547360417, 1.0, 4)            
        except AssertionError:
            assert_almost_equal(mw_mixed/236.5, 1.0, 4)
开发者ID:NukespudWork,项目名称:pyne,代码行数:19,代码来源:test_material.py

示例4: AtomicDensityToMassDensity

# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import molecular_mass [as 别名]
def AtomicDensityToMassDensity(heu_atom):
    print "\n\n",heu_atom
    print "========heu_atom molecular mass ",heu_atom.molecular_mass()
    heu=Material()
    heu.from_atom_frac(heu_atom)
    print "\n\n",heu
    print "ERROR:  heu molecular mass is not correct heu.molecular_mass() = ", heu.molecular_mass()
    heu.metadata=heu_atom.metadata
    heu.metadata['density_g_per_cc']=heu.mass
    heu.normalize()
    return heu
开发者ID:nukespud,项目名称:pythonTools,代码行数:13,代码来源:PyneModules.py

示例5: transmute

# 需要导入模块: from pyne.material import Material [as 别名]
# 或者: from pyne.material.Material import molecular_mass [as 别名]
    def transmute(self, x, t=None, phi=None, tol=None, log=None, *args, **kwargs):
        """Transmutes a material into its daughters.

        Parameters
        ----------
        x : Material or similar
            Input material for transmutation.
        t : float
            Transmutations time [sec].
        phi : float or array of floats
            Neutron flux vector [n/cm^2/sec].  Currently this must either be 
            a scalar or match the group structure of EAF.
        tol : float
            Tolerance level for chain truncation.
        log : file-like or None
            The log file object should be written. A None imples the log is 
            not desired.

        Returns
        -------
        y : Material
            The output material post-transmutation.

        """
        if not isinstance(x, Material):
            x = Material(x)
        if t is not None:
            self.t = t
        if phi is not None:
            self.phi = phi
        if log is not None:
            self.log = log
        if tol is not None:
            self.tol = tol

        x_atoms = x.to_atom_frac()
        y_atoms = {}
        for nuc, adens in x_atoms.items():
            # Find output for root of unit density and scale all output by 
            # actual nuclide density and add to final output.
            partial = self._transmute_partial(nuc)
            for part_nuc, part_adens in partial.items():
                y_atoms[part_nuc] = part_adens * adens + y_atoms.get(part_nuc, 0.0)
        mw_x = x.molecular_mass()
        y = from_atom_frac(y_atoms, atoms_per_molecule=x.atoms_per_molecule)
        # even though it doesn't look likt it, the following line is actually
        #   mass_y = MW_y * mass_x / MW_x
        y.mass *= x.mass / mw_x 
        return y
开发者ID:FlanFlanagan,项目名称:pyne,代码行数:51,代码来源:chainsolve.py


注:本文中的pyne.material.Material.molecular_mass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。