TkN 2.7.1
Toolkit for Nuclei
Loading...
Searching...
No Matches
units

As seen in the tkn::tkmeasure class, tkn offers the possibility to convert some measure into different units
Currently, tkn handles three unit types: Energy, Time and Length. Few other units are included in tkn but that cannot be converted

The available energy units are the following: eV, keV, MeV, GeV, TeV
The available time units are the following: as, fs, ps, ns, us, ms, s, min, h, d, y
The available length units are the following: am, fm, pm, nm, um, mm, cm, m

In general, units can be converted only within the same unit type. One exception is the reciprocal conversion between a decay width Gamma and an ENSDF half-life T1/2: Gamma * T1/2 = hbar * ln(2). The mean lifetime is tau = T1/2 / ln(2), so Gamma * tau = hbar.

On both tknucleus and tklevel, use get_half_life() or get_mean_lifetime() (seconds by default, time units only), and get_decay_width() (keV by default, energy units only). Stable states give infinite time and zero width; absent data or an invalid unit gives NaN. For a limit, these scalar methods return the boundary, not a central value: inspect the stored measure's flags before using it.

Legacy get_lifetime() and get_lifetime_measure() retain their historical T1/2/Gamma convention, not mean lifetime. To inspect converted uncertainties and limits, copy the stored measure before set_unit(); reciprocal conversion reverses lower/upper bounds. To derive tau, convert a copy to a time unit, then multiply by 1 / std::log(2.). Do not convert that tau measure to energy using the generic legacy conversion, which assumes T1/2. Typed quantities are reserved for V3. One year in TkN is 31556926 seconds.

Units without a conversion rule (for example K, C, F, %, u, or a user-defined label) cannot be relabelled as another unit. set_unit() returns false in this case, as it does for incompatible dimensions. A converted read such as get_value(requested_unit) does not modify the stored measure and returns NaN when the requested conversion is invalid.