Physical unit definitions

Defines

Unit

This file contains definitions of various physical units. We have decided to make the units more explicit in the program; since they are inline constexpr, there should be no runtime overhead on its use, and it makes for a less bug-prone and more clear code. It also makes switching scales far easier and less bug-prone.

namespace mdk

Variables

Unit f77unit = 1.0
Unit angstrom = f77unit / 5.0
Unit nanometer = 10.0 * angstrom
Unit meter = nanometer * 1.0e9
Unit nanosecond = 1.0
Unit tau = 1.0 * nanosecond
Unit microsecond = nanosecond * 1.0e3
Unit millisecond = nanosecond * 1.0e6
Unit second = nanosecond * 1.0e9
Unit atom = 1.0
Unit mol = 6.02214076e23 / atom
Unit eps = 1.0
Unit kcal = eps * mol / 1.57824959
Unit Joule = kcal / 4184.0
Unit eps_kB = 1.0
Unit kB = eps / eps_kB
Unit Kelvin = 1.380649e-23 * Joule / kB
Unit kg = Joule * second * second / (meter * meter)
Unit au = kg * 0.99999999965e-3 / mol
Unit f77mass = eps * tau * tau / (f77unit * f77unit)

In the Fortran version of the model, distance of f77unit, time of tau, energy of eps and the average mass of an aminoacid were units; these are however incongruent, it’s a confirmed bug.

Unit echarge = 1.0
Unit Coulomb = echarge / 1.602176634e-19
Unit Ampere = Coulomb / second
Unit cspeed = 299792458.0 * meter / second
Unit Henry = kg * meter * meter / (second * second * Ampere * Ampere)
Unit mu_0 = 1.25663706212e-6 * Henry / meter
Unit epsilon_0 = 1.0 / (mu_0 * cspeed * cspeed)
Unit rad = 1.0
Unit degree = (2.0 * M_PI / 360.0) * rad