Loading...
Searching...
No Matches
tip4p_unit_system.hpp File Reference

Physical constants, unit conversion. More...

Go to the source code of this file.

Namespaces

namespace  forcefields
namespace  forcefields::unit_system
 Physical constants and unit conversion.

Macros

#define FORCEFIELDS_UNIT_SYSTEM_SI_MKSA   0
 Systeme international.
#define FORCEFIELDS_UNIT_SYSTEM_METRE_KILOGRAMME_PER_MOL_SECOND_AMPERE_PER_MOL   1
 System based on Metre, kg/mol, second, Ampere/mol.
#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_KILOGRAMME_PER_MOL_FEMTOSECOND_AMPERE_PER_MOL   2
 System based on angstrom, kg/mol, femtosecond, Ampere/mol.
#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_GRAMME_PER_MOL_FEMTOSECOND_ECHARGE   3
 Angstrom, gramme/mol, femtosecond, e (proton charge).
#define FORCEFIELDS_UNIT_SYSTEM_ELECTRONVOLT_ANGSTROM_FEMTOSECOND_ECHARGE   4
 Electron volt, angstrom, femtosecond, e (proton charge).
#define FORCEFIELDS_UNIT_SYSTEM_KILOCALORY_PER_MOL_ANGSTROM_FEMTOSECOND_ECHARGE   5
 Kilo calory per mole, angstrom, femtosecond, e (proton charge).
#define FORCEFIELDS_UNIT_SYSTEM_HPP   FORCEFIELDS_UNIT_SYSTEM_ELECTRONVOLT_ANGSTROM_FEMTOSECOND_ECHARGE
 Default system of units.

Variables

const double forcefields::unit_system::R_gas = 8.314472
const double forcefields::unit_system::k_boltzmann = 1.3806505e-23
const double forcefields::unit_system::Na_avogadro = 6.0221415e23
const double forcefields::unit_system::calory = 4.1868
const double forcefields::unit_system::e_charge = 1.60217653e-19
const double forcefields::unit_system::debye
const double forcefields::unit_system::one_over_4_pi_epsilon0
 This is the quantity 1/(4*pi*epsilon0) in SI units.
const double forcefields::unit_system::sqrt_one_over_4_pi_epsilon0 = 9.48026992492973368e+04
 This is the quantity 1/sqrt(4*pi*epsilon0) in SI units.
const double forcefields::unit_system::pi = 3.14159265358979312
const double forcefields::unit_system::MOL = Na_avogadro
const double forcefields::unit_system::DEGREE = pi / 180
const char forcefields::unit_system::LENGTH [] = "A"
const char forcefields::unit_system::TIME [] = "fs"
const char forcefields::unit_system::MASS [] = "eV A^-2 fs^2"
const char forcefields::unit_system::CURRENT [] = "e/fs"
const char forcefields::unit_system::VELOCITY [] = "A fs^-1"
const char forcefields::unit_system::ACCELERATION [] = "A fs^-2"
const char forcefields::unit_system::FORCE [] = "eV/A"
const char forcefields::unit_system::ENERGY [] = "eV"
const char forcefields::unit_system::PRESSURE [] = "eV A^-3"
const char forcefields::unit_system::CHARGE [] = "(eV A)^(-1/2)"
const double forcefields::unit_system::METRE = 1e10
const double forcefields::unit_system::KG = 1e10 / e_charge
const double forcefields::unit_system::SECOND = 1e15
const double forcefields::unit_system::AMPERE = 1e-15 / e_charge
const char *const forcefields::unit_system::TEMPERATURE = ENERGY
const double forcefields::unit_system::METRE_PER_SECOND = METRE / SECOND
const double forcefields::unit_system::METRE_PER_SECOND2 = METRE_PER_SECOND / SECOND
const double forcefields::unit_system::NEWTON = KG * METRE_PER_SECOND2
const double forcefields::unit_system::JOULE = NEWTON * METRE
const double forcefields::unit_system::COULOMB = AMPERE * SECOND
const double forcefields::unit_system::WATT = JOULE / SECOND
const double forcefields::unit_system::VOLT = WATT / AMPERE
const double forcefields::unit_system::KELVIN = k_boltzmann * JOULE
const double forcefields::unit_system::KILO = 1e3
const double forcefields::unit_system::NANO = 1e-9
const double forcefields::unit_system::FEMTO = 1e-15
const double forcefields::unit_system::NM = NANO * METRE
const double forcefields::unit_system::GRAM = KG / KILO
const double forcefields::unit_system::GRAM_PER_MOL = GRAM / MOL
const double forcefields::unit_system::G_PER_MOL = GRAM_PER_MOL
const double forcefields::unit_system::KJ_PER_MOL = KILO * JOULE / MOL
const double forcefields::unit_system::KJ = KILO * JOULE
const double forcefields::unit_system::FS = FEMTO * SECOND
const double forcefields::unit_system::ANGSTROM = 1e-10 * METRE
const double forcefields::unit_system::ANGSTROM2 = ANGSTROM * ANGSTROM
const double forcefields::unit_system::ANGSTROM3 = ANGSTROM * ANGSTROM * ANGSTROM
const double forcefields::unit_system::ECHARGE = e_charge * COULOMB
const double forcefields::unit_system::EV = ECHARGE * VOLT
const double forcefields::unit_system::CALORY = calory * JOULE
const double forcefields::unit_system::KCAL_PER_MOL = KILO * CALORY / MOL
const double forcefields::unit_system::BOHR = 5.291772108e-11 * METRE
const double forcefields::unit_system::HARTREE = 4.35974417e-18 * JOULE
const double forcefields::unit_system::ERGS = 1e-7 * JOULE
const double forcefields::unit_system::ONE_OVER_4_PI_EPSILON0

Detailed Description

Physical constants, unit conversion.

Author
Jean-Claude C. Berthet
Date
2006-2007 University of Iceland

Introduction

This file contains constants to convert between different units and also to choose a default system of units. There are two types of constants, those in lowercase letters and those in capital letters. Constants in lowercase letters are universal constants usually expressed in the international sytem of unit (SI). The contents of these constants do not depend on the default system of unit chosen. The content of constants is capital letters depends on the default system. Those latter are further devided into two subgroups: unit name constants and converters.

system of units:

The default system of units is selected at compilation by setting the macro FORCEFIELDS_UNIT_SYSTEM_HPP .

The content of the constants called unit name constants and converters depends on the system chosen.
The default system like the SI is based on the four dimensions distance, mass, time, electric current. All other units are extracted from the four units chosen for these four dimensions. For example if the default system is SI, the unit of energy will be Joule because \( 1\ J = 1\ m^2\ kg\ s^{-2} \) . As well the unit of pressure will be Pascal ( \( 1\ Pa=1\ m^{-1}\ kg\ s^{-2} \) ). Quantities of same dimensions are always expressed with the same units. For instance the temperature has the dimension of the energy, therefore is default unit is the unit of the energy (Joule if SI is the default system).

Default unit names:

A unit constant is a constant string of characters named after a quantity (e.g. ENERGY, PRESSURE, etc). It contains the name of the default unit used for that quantity (e.g. kJ , eV , etc for an energy). These constants can be used to display a quantity in the default system of unit. For example, let us assume that kJ/mol is the default unit for the energy. We wish to display the content of a variable energy which contains an energy expressed in the default system of unit. We shall write the following code:

cout << energy << ' ' << ENERGY << endl;

Converters: converting quantities.

A converter is a double constant which has the name of a unit (e.g. PASCAL, KELVIN, ANGSTROM...). The constant contains the value of one quantity of the unit espressed in the default system of unit. Here is an example on how to use the converters. Let us assume that the default system of unit uses the meter as length unit. We wish to display the content of a variable x which contains a distance in meter, but we want to display it in Angstrom. To make the conversion we need to divide the quantity by one Angstrom:

\[ \frac{x\ meter}{1\ Angstrom}=\frac{x\ meter}{10^{-10}\ meter}=x \time 10^{-10} \]

We shall add to the code the following line which will display the quantity in Angstrom.

cout << "x = " << x / ANGSTROM << " Angstrom." << endl;

Reversively, we may also wish to input a value into x. We shall write for example:

double x_angstrom;
cout << "Enter distance in Angstrom: ";
cin >> x_angstrom;
x= x_angstrom*ANGSTROM;
cout << "The distance is " << x/ANGSTROM << " Angstrom." << endl;

Definition in file tip4p_unit_system.hpp.

Macro Definition Documentation

◆ FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_GRAMME_PER_MOL_FEMTOSECOND_ECHARGE

#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_GRAMME_PER_MOL_FEMTOSECOND_ECHARGE   3

Angstrom, gramme/mol, femtosecond, e (proton charge).

Definition at line 92 of file tip4p_unit_system.hpp.

◆ FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_KILOGRAMME_PER_MOL_FEMTOSECOND_AMPERE_PER_MOL

#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_KILOGRAMME_PER_MOL_FEMTOSECOND_AMPERE_PER_MOL   2

System based on angstrom, kg/mol, femtosecond, Ampere/mol.

Definition at line 89 of file tip4p_unit_system.hpp.

89#define FORCEFIELDS_UNIT_SYSTEM_ANGSTROM_KILOGRAMME_PER_MOL_FEMTOSECOND_AMPERE_PER_MOL \
90 2

◆ FORCEFIELDS_UNIT_SYSTEM_ELECTRONVOLT_ANGSTROM_FEMTOSECOND_ECHARGE

#define FORCEFIELDS_UNIT_SYSTEM_ELECTRONVOLT_ANGSTROM_FEMTOSECOND_ECHARGE   4

Electron volt, angstrom, femtosecond, e (proton charge).

Definition at line 94 of file tip4p_unit_system.hpp.

◆ FORCEFIELDS_UNIT_SYSTEM_HPP

Default system of units.

Definition at line 101 of file tip4p_unit_system.hpp.

101#define FORCEFIELDS_UNIT_SYSTEM_HPP \
102 FORCEFIELDS_UNIT_SYSTEM_ELECTRONVOLT_ANGSTROM_FEMTOSECOND_ECHARGE

◆ FORCEFIELDS_UNIT_SYSTEM_KILOCALORY_PER_MOL_ANGSTROM_FEMTOSECOND_ECHARGE

#define FORCEFIELDS_UNIT_SYSTEM_KILOCALORY_PER_MOL_ANGSTROM_FEMTOSECOND_ECHARGE   5

Kilo calory per mole, angstrom, femtosecond, e (proton charge).

Definition at line 96 of file tip4p_unit_system.hpp.

96#define FORCEFIELDS_UNIT_SYSTEM_KILOCALORY_PER_MOL_ANGSTROM_FEMTOSECOND_ECHARGE \
97 5

◆ FORCEFIELDS_UNIT_SYSTEM_METRE_KILOGRAMME_PER_MOL_SECOND_AMPERE_PER_MOL

#define FORCEFIELDS_UNIT_SYSTEM_METRE_KILOGRAMME_PER_MOL_SECOND_AMPERE_PER_MOL   1

System based on Metre, kg/mol, second, Ampere/mol.

Definition at line 87 of file tip4p_unit_system.hpp.

◆ FORCEFIELDS_UNIT_SYSTEM_SI_MKSA

#define FORCEFIELDS_UNIT_SYSTEM_SI_MKSA   0

Systeme international.

Definition at line 85 of file tip4p_unit_system.hpp.