Unit Conversion

Functions to convert between various physical units

Enums

enum vrna_unit_energy_e

Energy / Work Units.

Values:

enumerator VRNA_UNIT_J

Joule ( \( 1~J = 1~kg \cdot m^2 s^{-2} \) )

enumerator VRNA_UNIT_KJ

Kilojoule ( \( 1~kJ = 1,000~J \) )

enumerator VRNA_UNIT_CAL_IT

Calorie (International (Steam) Table, \( 1~cal_{IT} = 4.1868~J \) )

enumerator VRNA_UNIT_DACAL_IT

Decacolorie (International (Steam) Table, \( 1~dacal_{IT} = 10~cal_{IT} = 41.868~J \) )

enumerator VRNA_UNIT_KCAL_IT

Kilocalorie (International (Steam) Table, \( 1~kcal_{IT} = 4.1868~kJ \) )

enumerator VRNA_UNIT_CAL

Calorie (Thermochemical, \( 1~cal_{th} = 4.184~J \) )

enumerator VRNA_UNIT_DACAL

Decacalorie (Thermochemical, \( 1~dacal_{th} = 10~cal_{th} = 41.84~J \) )

enumerator VRNA_UNIT_KCAL

Kilocalorie (Thermochemical, \( 1~kcal_{th} = 4.184~kJ \) )

enumerator VRNA_UNIT_G_TNT

g TNT ( \( 1~g~\mathrm{TNT} = 1,000~cal_{th} = 4,184~J \) )

enumerator VRNA_UNIT_KG_TNT

kg TNT ( \( 1~kg~\mathrm{TNT} = 1,000~kcal_{th} = 4,184~kJ \) )

enumerator VRNA_UNIT_T_TNT

ton TNT ( \( 1~t~\mathrm{TNT} = 1,000,000~kcal_{th} = 4,184~MJ \) )

enumerator VRNA_UNIT_EV

Electronvolt ( \( 1~eV = 1.602176565 \times 10^{-19}~J \) )

enumerator VRNA_UNIT_WH

Watt hour ( \( 1~W \cdot h = 1~W \cdot 3,600 s = 3,600~J = 3.6~kJ \) )

enumerator VRNA_UNIT_KWH

Kilowatt hour ( \( 1~kW \cdot h = 1~kW \cdot 3,600~s = 3,600~kJ = 3.6~MJ \) )

enum vrna_unit_temperature_e

Temperature Units.

Values:

enumerator VRNA_UNIT_K

Kelvin (K)

enumerator VRNA_UNIT_DEG_C

Degree Celcius (C) ( \( [^{\circ}C] = [K] - 273.15 \) )

enumerator VRNA_UNIT_DEG_F

Degree Fahrenheit (F) ( \( [^{\circ}F] = [K] \times \frac{9}{5} - 459.67 \) )

enumerator VRNA_UNIT_DEG_R

Degree Rankine (R) ( \( [^{\circ}R] = [K] \times \frac{9}{5} \) )

enumerator VRNA_UNIT_DEG_N

Degree Newton (N) ( \( [^{\circ}N] = ([K] - 273.15) \times \frac{33}{100} \) )

enumerator VRNA_UNIT_DEG_DE

Degree Delisle (De) ( \( [^{\circ}De] = (373.15 - [K]) \times \frac{3}{2} \) )

enumerator VRNA_UNIT_DEG_RE

Degree Raumur (R) ( \( [^{\circ}R{\acute e}] = ([K] - 273.15) \times \frac{4}{5} \) )

enumerator VRNA_UNIT_DEG_RO

Degree Rmer (R) ( \( [^{\circ}\text{R{\o}}] = ([K] - 273.15) \times \frac{21}{40} + 7.5 \) )

Functions

double vrna_convert_energy(double energy, vrna_unit_energy_e from, vrna_unit_energy_e to)
#include <ViennaRNA/utils/units.h>

Convert between energy / work units.

Parameters:
  • energy – Input energy value

  • from – Input unit

  • to – Output unit

Returns:

Energy value in Output unit

double vrna_convert_temperature(double temp, vrna_unit_temperature_e from, vrna_unit_temperature_e to)
#include <ViennaRNA/utils/units.h>

Convert between temperature units.

Parameters:
  • temp – Input temperature value

  • from – Input unit

  • to – Output unit

Returns:

Temperature value in Output unit

int vrna_convert_kcal_to_dcal(double energy)
#include <ViennaRNA/utils/units.h>

Convert floating point energy value into integer representation.

This function converts a floating point value in kcal/mol into its corresponding deka-cal/mol integer representation as used throughout RNAlib.

Parameters:
  • energy – The energy value in kcal/mol

Returns:

The energy value in deka-cal/mol

double vrna_convert_dcal_to_kcal(int energy)
#include <ViennaRNA/utils/units.h>

Convert an integer representation of free energy in deka-cal/mol to kcal/mol.

This function converts a free energy value given as integer in deka-cal/mol into the corresponding floating point number in kcal/mol

Parameters:
  • energy – The energy in deka-cal/mol

Returns:

The energy in kcal/mol