Skip to content
Projects

opencr.core.species

Species and their quantum states.

A Species is a particle kind named by its formula, as in plasmacoll and carafe ("e", "H", "H+", "H2", "H-"), with its charge, mass and elemental composition. A State is one state of a species that the model resolves: an atomic level H(n=2), a fine-structure level, a molecular electronic-vibrational state H2(X,v=3), or the species as a whole (an empty label) when it is not resolved. The solver sees only states, so the resolution of a model changes without changing the solver.

Energies of the states of one element share one scale: zero at the ground state of the neutral, the ion’s ground state at the ionization energy. Detailed balance and the photon energies of radiative transitions are computed from these energies.

The mass of a species and the energy of a state take an astropy Quantity or a string such as "1.008 u" or "10.2 eV" as well as a number in kg or eV (see plasmacoll.units).

Attributes

NameDescription
ELECTRONNo description.
ELECTRON_STATENo description.

Classes

NameDescription
SpeciesA particle kind.
StateOne resolved state of a species.

Functions

NameDescription
species_from_formulaReturn the species of a simple formula such as "H", "H2+", "Ar" or "H-".

ELECTRONattributemodule attribute#

ELECTRON = Species('e', -1, ELECTRON_MASS, {})

ELECTRON_STATEattributemodule attribute#

ELECTRON_STATE = State(ELECTRON, weight=2.0)

Speciesclassdataclass#

class Species(name: str, charge: int, mass: float = unit_field('kg'), composition: Mapping[str, int] = dict())

A particle kind.

Attributes

NameTypeDescription
namestrThe formula, e.g. "H2+".
chargeintThe charge in units of e.
massfloatThe mass in kg.
compositionMapping[str, int]The number of atoms of each element, e.g. {"H": 2}; empty for the electron.

chargeattributeinstance attribute#

charge: int

compositionattributeclass attributeinstance attribute#

composition: Mapping[str, int] = field(default_factory=dict)

massattributeclass attributeinstance attribute#

mass: float = unit_field('kg')

nameattributeinstance attribute#

name: str

to_dictmethod#

def to_dict() -> dict[str, Any]

Return the species as plain data.

Stateclassdataclass#

class State(species: Species, label: str = '', energy: float = unit_field('eV', 0.0), weight: float = 1.0, quantum_numbers: Mapping[str, Any] = dict())

One resolved state of a species.

Attributes

NameTypeDescription
speciesSpeciesThe species.
labelstrThe quantum label, e.g. "n=2" or "X,v=3"; empty when the species is not resolved further.
energyfloatThe energy in eV on the common scale of the element (see the module docstring).
weightfloatThe statistical weight g.
quantum_numbersMapping[str, Any]The quantum numbers by name, e.g. {"n": 2}, {"n": 2, "l": 1} or {"electronic": "X", "v": 3}.

energyattributeclass attributeinstance attribute#

energy: float = unit_field('eV', 0.0)

labelattributeclass attributeinstance attribute#

label: str = ''

quantum_numbersattributeclass attributeinstance attribute#

quantum_numbers: Mapping[str, Any] = field(default_factory=dict)

speciesattributeinstance attribute#

species: Species

weightattributeclass attributeinstance attribute#

weight: float = 1.0

chargeproperty#

charge: int

The charge in units of e.

nameproperty#

name: str

The state’s name, "H(n=2)", or the species’ name when unresolved.

to_dictmethod#

def to_dict() -> dict[str, Any]

Return the state as plain data (the species by name).

species_from_formulafunction#

def species_from_formula(formula: str) -> Species

Return the species of a simple formula such as "H", "H2+", "Ar" or "H-".

The formula is one element symbol, an optional atom count and the charge as repeated signs ("H2+", "H-", "Ar++"). The mass is the sum of the atomic masses minus the missing electrons (plus the extra ones of a negative ion).