# opencr.constants

*module*

Physical constants (CODATA 2018, through `scipy.constants`) and unit helpers.

OpenCR's units follow the max-models convention: SI everywhere, except
temperatures, given as ``kT`` in eV, and particle and level energies in eV.
Densities are in m^-3, rate coefficients of an order-``k`` reaction in
m^(3(k-1))/s (s^-1 for spontaneous emission, m^3/s for electron impact, m^6/s
for three-body recombination), wavelengths in nm (in vacuum unless a function
says otherwise).

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L1-L1)

## opencr.constants.ATOMIC_MASS

*attribute* · *module attribute*

```python
ATOMIC_MASS = _c.atomic_mass
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L37-L37)

## opencr.constants.BOHR_RADIUS

*attribute* · *module attribute*

```python
BOHR_RADIUS = _c.physical_constants['Bohr radius'][0]
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L41-L41)

## opencr.constants.ELECTRON_MASS

*attribute* · *module attribute*

```python
ELECTRON_MASS = _c.m_e
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L35-L35)

## opencr.constants.ELEMENTARY_CHARGE

*attribute* · *module attribute*

```python
ELEMENTARY_CHARGE = _c.e
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L34-L34)

## opencr.constants.HYDROGEN_IONIZATION_ENERGY

*attribute* · *module attribute*

```python
HYDROGEN_IONIZATION_ENERGY = 13.598434599702
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L43-L43)

## opencr.constants.PLANCK

*attribute* · *module attribute*

```python
PLANCK = _c.h
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L38-L38)

## opencr.constants.PROTON_MASS

*attribute* · *module attribute*

```python
PROTON_MASS = _c.m_p
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L36-L36)

## opencr.constants.SPEED_OF_LIGHT

*attribute* · *module attribute*

```python
SPEED_OF_LIGHT = _c.c
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L39-L39)

## opencr.constants.VACUUM_PERMITTIVITY

*attribute* · *module attribute*

```python
VACUUM_PERMITTIVITY = _c.epsilon_0
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L40-L40)

## opencr.constants.air_wavelength

*function*

```python
def air_wavelength(vacuum_wavelength: float | np.ndarray) -> np.ndarray
```

Return the wavelength in standard air of a vacuum wavelength (both in nm).

The refractive index of Edlén (1966) as revised by Birch and Downs (1994),
the IAU standard used by NIST, applied above 200 nm; shorter wavelengths
are returned unchanged (there is no air conversion in the vacuum UV).

**Numerics**

*edlen*

$$
\lambda_{\mathrm{air}} = \frac{\lambda}{n}, \qquad n - 1 = 8.34254\times10^{-5} + \frac{2.406147\times10^{-2}}{130 - \sigma^2} + \frac{1.5998\times10^{-4}}{38.9 - \sigma^2}, \qquad \sigma = \frac{10^3}{\lambda\,[\mathrm{nm}]}\ \mu\mathrm{m}^{-1}
$$

Assumptions:

- standard air, the IAU standard used by NIST; above 200 nm only (shorter wavelengths are returned unchanged)

References:

- [Edlén, Metrologia 2, 71 (1966)](https://doi.org/10.1088/0026-1394/2/2/002)
- [Birch and Downs, Metrologia 31, 315 (1994)](https://doi.org/10.1088/0026-1394/31/4/006)

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L99-L124)

## opencr.constants.photon_wavelength

*function*

```python
def photon_wavelength(energy: float | np.ndarray) -> np.ndarray
```

Return the vacuum wavelength in nm of a photon of ``energy`` eV.

**Numerics**

*wavelength*

$$
\lambda\,[\mathrm{nm}] = \frac{hc}{E} = \frac{1239.84\ldots}{E\,[\mathrm{eV}]}
$$

Assumptions:

- in vacuum

References:

- [Tiesinga et al., Rev. Mod. Phys. 93, 025010 (2021)](https://doi.org/10.1103/RevModPhys.93.025010) (CODATA 2018)

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L84-L96)

## opencr.constants.thermal_de_broglie_cubed

*function*

```python
def thermal_de_broglie_cubed(temperature: float | np.ndarray) -> np.ndarray
```

Return ``(h^2 / (2 pi m_e kT))^(3/2)`` in m^3, ``kT`` in eV.

The electron's thermal de Broglie volume, the factor of the Saha equation
``n_e n_+ / n_0 = (g_e g_+ / g_0) exp(-I / kT) / lambda^3``.

**Numerics**

*volume*

$$
\Lambda^3 = \left(\frac{h^2}{2\pi m_e kT}\right)^{3/2}
$$

*saha*

$$
\frac{n_e n_+}{n_0} = \frac{g_e g_+}{g_0}\,\frac{e^{-I/kT}}{\Lambda^3}
$$

Assumptions:

- $kT$ in eV, $\Lambda^3$ in m$^3$

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/constants.py#L127-L142)
