# Reaction Rate Types

pynucastro can understand reaction rates in a variety of formats.
The basic `Rate`

class serves
as the base class for all the different rate types and provides
the core functionality.

Here we describe the most commonly used rates.

## ReacLib

The JINA ReacLib database provides
the core thermonuclear rates. These are managed in pynucastro through
the `ReacLibRate`

class.

A ReacLib rate is composed of several sets (managed as
`SingleSet`

objects, each
taking the form:

where \(\lambda\) is of the form:

### Chapters

The rates are divided into chapters, based on how many nuclei are on each side of the reaction:

chapter |
reaction format |

1 |
\(e_1 \rightarrow e_2\) |

2 |
\(e_1 \rightarrow e_2 + e_3\) |

3 |
\(e_1 \rightarrow e_2 + e_3 + e_4\) |

4 |
\(e_1 + e_2 \rightarrow e_3\) |

5 |
\(e_1 + e_2 \rightarrow e_3 + e_4\) |

6 |
\(e_1 + e_2 \rightarrow e_3 + e_4 + e_5\) |

7 |
\(e_1 + e_2 \rightarrow e_3 + e_4 + e_5 + e_6\) |

8 |
\(e_1 + e_2 + e_3 \rightarrow e_4\) |

9 |
\(e_1 + e_2 + e_3 \rightarrow e_4 + e_5\) |

10 |
\(e_1 + e_2 + e_3 + e_4 \rightarrow e_5 + e_6\) |

11 |
\(e_1 \rightarrow e_2 + e_3 + e_4 + e_5\) |

### Labels

The ReacLib database lists the source / reference of each rate with a 6 character string.

The first 4 characters are the label that gives the source of the rate, according to: https://reaclib.jinaweb.org/labels.php

This is stored in both

`SingleSet`

and`ReacLibRate`

as the`.label`

attribute.The next character is

`n`

for a non-resonant set,`r`

for a resonance, or`w`

to indicate that it is a weak rate.Different sets can have either n or r (and there can be multiple resonances).

For a

`SingleSet`

,`SingleSet.resonant`

is`True`

if it is a resonanceFor the combined

`ReacLibRate`

object, we combine all of the resonances and the non-resonance set, and change the flag to`c`

for _combined_.

If the weak flag,

`w`

is set, then`ReacLibRate.weak`

will be`True`

.The 6th character indicates it the rate is a derived reverse rate, by the presence of a v. This is stored in both

`SingleSet`

and`ReacLibRate`

as the`.reverse`

attribute.

### Weak rates

Electron capture capture rates are those identified with a label of either `ec`

or `bec`

. These
have `ReacLibRate.weak_type`

set to `electron_capture`

. For these rates, and only these rates,
we include \(Y_e\) in the overall rate (multiplying density).

Note

There is some ambiguity as to whether \(Y_e\) should be included for `bec`

rates.

The only other place `weak_type`

is used for `ReacLibRate`

is to set the print representation.

Note

ReacLib only provides a fit to the temperature dependence of a rate, so for electron-captures, it may not be a very good approximation, and tabulated electron capture rates should be used instead.

### Reverse rates

As noted above, rates with the `v`

flag in the label are reverse
rates that were computed from the forward rate via detailed balance.
These rates do not include the corrections from partition functions,
and therefore, should not be used directly. Instead, the
`DerivedRate`

functionality in pynucastro can be used to redo the
detailed balance including the effects of partition functions.

Note

In ReacLib, _reverse_ does not always mean \(Q < 0\). Sometimes the rate with \(Q < 0\) is easier to measure experimentally, and so that is measured and then the \(Q > 0\) rate is computed via detailed balance.

### Rate evaluation functions

The `ReacLibRate`

class has functions `function_string_py`

and
`function_string_cxx`

to write out
the python and C++ code needed to evaluate the T-dependent portion of
the reaction rate (basically what is encoded in the ReacLib database).

For the C++ version, templating is used to allow for the derivative with respect to temperature to also be computed.

### ydot term

The `ReacLibRate`

class knows how to output the contribution to the
molar fraction evolution (\(\dot{Y}\)) as a python expression (for
C++, this is handled separately via SymPy in the `network`

module).
This is handled by `ReacLibRate.ydot_string_py()`

.

For a unary reaction involving nucleus \(A\), it takes the form:

for a binary reaction, \(A + B\), it takes the form:

where the \(1 + \delta_{AB}\) factor is stored in the rate as `Rate.prefactor`

.

and for a trinary reaction, it is:

where \(n_A\) is the number of nucleus \(A\) in the reaction.

Note

The rate class does not include the stoichiometric factors – that is the responsibility of the network.

Similarly, `ReacLib.jacobian_string_py()`

outputs the contribution to the Jacobian for this rate.

## Tabulated Rates

For electron captures and beta-decays (which are of the form \(\rm{A \rightarrow B}\)), we use tabulated rates. These are two-dimensional tables, in terms of \(T\) and \(\rho Y_e\).

Note

If positron captures and decays are available, then these are included with the appropriate electron counterpart into a single rate.

A tabular rate is described by 2 files. The first file mimics the
ReacLib header, with a chapter indicated as `t`

and gives the name
of the table and the number of columns, density, and temperature
points. For example,
pynucastro/library/tabular/suzuki/na23–ne23-toki demonstrates the following
format:

```
t
[parent nuclide] [daughter nuclide]
[rate table file name]
[number of header lines before the first line of data]
[number of density*ye values]
[number of temperature values]
```

The second file is the table itself. For now they must be in
the form of, e.g. 23na-23ne_electroncapture.dat in
`pynucastro/library/tabular/suzuki`

, indexed by the product of density and
electron fraction \(\rm{\rho Y_e}\) and temperature
\(\rm{T}\), with the same number and order of variables.
The columns of the tables (and
units) are:

\(\log_{10} (\rho Y_e)\): electron density in \(\mathrm{g~cm^{-3}}\)

\(\log_{10} T\): temperature in \(\mathrm{K}\)

\(\mu\): chemical potential in erg

\(\Delta Q\): threshold energy in erg

\(V_s\): Coulomb potential at the origin in erg

\(\log_{10} (\lambda)\): electron capture or \(\beta\)-decay rate in \(\mathrm{s^{-1}}\). For some rates, this is (\(e^-\)-capture and \(e^+\)-decay) or (\(\beta\)-decay + \(e^+\)-capture)

\(\log_{10} (\epsilon_\nu)\): neutrino energy loss in \(\mathrm{erg~s^{-1}}\)

\(\log_{10} (\epsilon_\gamma)\): gamma energy loss in \(\mathrm{erg~s^{-1}}\)

and the data is ordered with `rhoY`

varying the slowest (i.e., for a
given `rhoY`

we loop over all of the temperatures).

pynucastro uses linear interpolation to return the rate given the temperature and electron density.

The form of the reaction \(A \rightarrow B\)

where \(\lambda\) is the rate returned from the table.