# opencr.core.reactions

*module*

Reactions between states.

A `Reaction` lists its reactant and product states (a state that
appears twice counts twice), its kind, its rate model and the provenance of
its data. Creating one checks the charge and element balance; photons are
implicit products of the radiative kinds (`RADIATIVE_KINDS`).

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

## opencr.core.reactions.RADIATIVE_KINDS

*attribute* · *module attribute*

```python
RADIATIVE_KINDS = ('spontaneous_emission', 'radiative_recombination')
```

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

## opencr.core.reactions.REACTION_KINDS

*attribute* · *module attribute*

```python
REACTION_KINDS = ('excitation', 'deexcitation', 'ionization', 'three_body_recombination', 'radiative_recombination', 'dielectronic_recombination', 'spontaneous_emission', 'dissociation', 'dissociative_excitation', 'dissociative_ionization', 'dissociative_recombination', 'attachment', 'dissociative_attachment', 'detachment', 'charge_exchange', 'mutual_neutralization', 'associative_detachment', 'penning_ionization', 'quenching', 'vibrational_transfer', 'proton_transfer', 'wall_loss', 'pumping', 'other')
```

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L27-L52)

## opencr.core.reactions.Reaction

*class* · *dataclass*

```python
class Reaction
```

One reaction.

**Attributes**

- `name` (`str`) — A unique name in its network, e.g. ``"exc:H(n=1)->H(n=2)"``.
- `reactants` (`tuple[State, ...]`) — The reactant states; the electron is `ELECTRON_STATE`.
- `products` (`tuple[State, ...]`) — The product states.
- `kind` (`str`) — One of `REACTION_KINDS`.
- `rate` (`RateModel`) — The rate model.
- `provenance` (`Provenance | None`) — The origin of the rate data.
- `escape` (`float`) — For a spontaneous emission, the default escape factor of the line (1 for an optically thin plasma); conditions may override it.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L64-L179)

### opencr.core.reactions.Reaction.escape

*attribute* · *class attribute* · *instance attribute*

```python
escape: float = 1.0
```

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

### opencr.core.reactions.Reaction.kind

*attribute* · *instance attribute*

```python
kind: str
```

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

### opencr.core.reactions.Reaction.name

*attribute* · *instance attribute*

```python
name: str
```

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

### opencr.core.reactions.Reaction.products

*attribute* · *instance attribute*

```python
products: tuple[State, ...]
```

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

### opencr.core.reactions.Reaction.provenance

*attribute* · *class attribute* · *instance attribute*

```python
provenance: Provenance | None = None
```

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

### opencr.core.reactions.Reaction.rate

*attribute* · *instance attribute*

```python
rate: RateModel
```

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

### opencr.core.reactions.Reaction.reactants

*attribute* · *instance attribute*

```python
reactants: tuple[State, ...]
```

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

### opencr.core.reactions.Reaction.energy_change

*property*

```python
energy_change: float
```

The internal energy of the products minus the reactants' in eV.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L157-L161)

### opencr.core.reactions.Reaction.equation

*property*

```python
equation: str
```

The reaction as text, e.g. ``"e + H(n=1) -> e + H(n=2)"``.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L148-L154)

### opencr.core.reactions.Reaction.is_inverse

*property*

```python
is_inverse: bool
```

Whether the rate is the detailed balance of another reaction.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L171-L173)

### opencr.core.reactions.Reaction.net

*property*

```python
net: dict[str, int]
```

The net change of each state per reaction (products minus reactants).

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L141-L145)

### opencr.core.reactions.Reaction.order

*property*

```python
order: int
```

The number of reactant particles.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L126-L128)

### opencr.core.reactions.Reaction.photon_energy

*property*

```python
photon_energy: float | None
```

For a spontaneous emission, the photon energy in eV; otherwise ``None``.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L164-L168)

### opencr.core.reactions.Reaction.product_counts

*property*

```python
product_counts: dict[str, int]
```

How often each state is a product, by name.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L136-L138)

### opencr.core.reactions.Reaction.reactant_counts

*property*

```python
reactant_counts: dict[str, int]
```

How often each state is a reactant, by name.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L131-L133)

### opencr.core.reactions.Reaction.inverse_of

*method*

```python
def inverse_of(forward: Reaction) -> bool
```

Return whether this reaction is ``forward`` run backwards.

[View source](https://github.com/max-models/OpenCR/blob/devel/src/opencr/core/reactions.py#L175-L179)
