def convert_atomic_to_mass_fractions(atomic_fractions):
    """
    Converts an atomic fraction :class:`dict` to a mass fraction :class:`dict`.

    Args:
        atomic_fractions (dict): atomic fraction :class:`dict`.
            The composition is specified by a dictionary.
            The keys are atomic numbers and the values atomic fractions.
            No wildcard are accepted.
    """
    # Calculate total atomic mass
    atomic_masses = {}
    total_atomic_mass = 0.0
    for z, atomic_fraction in atomic_fractions.items():
        atomic_mass = pyxray.element_atomic_weight(z)
        atomic_masses[z] = atomic_mass
        total_atomic_mass += atomic_fraction * atomic_mass

    # Create mass fraction
    mass_fractions = {}
    for z, atomic_fraction in atomic_fractions.items():
        mass_fractions[z] = atomic_fraction * atomic_masses[z] / total_atomic_mass

    return mass_fractions
def convert_atomic_to_mass_fractions ( atomic_fractions ) : atomic_masses = { } total_atomic_mass = 0.0 for z , atomic_fraction in atomic_fractions . items ( ) : atomic_mass = pyxray . element_atomic_weight ( z ) atomic_masses [ z ] = atomic_mass total_atomic_mass += atomic_fraction * atomic_mass mass_fractions = { } for z , atomic_fraction in atomic_fractions . items ( ) : mass_fractions [ z ] = atomic_fraction * atomic_masses [ z ] / total_atomic_mass return mass_fractions
Converts an atomic fraction :class:`dict` to a mass fraction :class:`dict`.

    Args:
        atomic_fractions (dict): atomic fraction :class:`dict`.
            The composition is specified by a dictionary.
            The keys are atomic numbers and the values atomic fractions.
            No wildcard are accepted.