mammos_units#

Quantities (values with units).

mammos_units is an extension of astropy.units. Please refer to https://docs.astropy.org/en/stable/units/ref_api.html.

The following additional units are defined in this package:

  • formula_unit`

  • mu_B

  • atom

Functions

moment_induction(volume)

Equivalency for magnetic moment per formula unit and magnetic induction.

mammos_units.moment_induction(volume)#

Equivalency for magnetic moment per formula unit and magnetic induction.

Equivalency for converting between magnetic moment per counting unit (either formula unit or per atom) and magnetic induction (Tesla).

This equivalency handles the conversion between magnetic moment units (μ_B/f.u. or μ_B/atom) and magnetic induction (Tesla) based on a given volume.

The conversion is based on the relation:

\[B = \frac{\mu_0 \cdot m}{V}\]

Where: - B is the magnetic induction in Tesla - μ_0 is the vacuum permeability - m is the magnetic moment in Bohr magnetons per counting unit - V is the volume per counting unit

Parameters:

volume (astropy.units.Quantity) – The volume over which the magnetic moment is distributed. This can be in any unit of volume that can be converted to m³.

Returns:

The equivalency object that can be passed to the equivalencies argument of astropy.units.Quantity.to().

Raises:
  • ValueError – If the volume is negative.

  • TypeError – If the input is not an astropy Quantity object.

Return type:

astropy.units.Equivalency

Examples

>>> import mammos_units as u
>>> vol = 4 * u.angstrom**3
>>> eq = u.moment_induction(vol)
>>> moment = 2.5 * u.mu_B / u.f_u
>>> b_field = moment.to(u.T, equivalencies=eq)
>>> b_field
<Quantity 7.28379049 T>
>>> b_field.to(u.mu_B / u.f_u, equivalencies=eq)
<Quantity 2.5 mu_B / f_u>