SF_CONSTANTS

Description

SciFortran module for physical and mathematical constants, the latter expressed in SI units and in agreement with NIST CODATA 2022 recommended values.

Quick access

Routines:

isinfty(), isnan(), stop_error(), timestamp(), wait()

Subroutines and functions

interface  sf_constants/isinfty(a)

Evaluates an integer, real or complex number and returns a logical expression. If .true. the input is infinite.

Parameters:

a [integer/real/complex, in] – Number to evaluate

Result:

bool [logical] – Result

interface  sf_constants/isnan(a)

Evaluates an integer, real or complex quantity and returns a logical expression. If .true. the input is NaN.

Parameters:

a [integer/real/complex, in] – Number to evaluate

Result:

bool [logical] – Result

interface  sf_constants/wait(time)

Waits for a given time interval (integer, real or double) expressed in milliseconds before continuing execution.

Parameters:

time [integer/real] – desired sleep interval [ms]

subroutine  sf_constants/timestamp([unit])

Prints the date and time to unit. The date is in the format Timestamp: [day][month name][year][h]:[m]:[s].[ms]

Options:

unit [integer] – Output unit. Default 6

subroutine  sf_constants/stop_error(msg)

Aborts the program with nonzero exit code. The statement STOP "msg" will return exit code 0 when compiled using gfortran. stop_error() uses the statement stop 1 which returns an exit code 1 and a print statement to print the message.

Parameters:

msg [character(len=*)] – Message to print on stderr

List of physical and numerical constants

This is a list of all the physical and numerical constants in sf_constants, which are listed as parameters:

Commonly used parameters

dbl, ddp, dp, epsilonq, epsilonr, euler, gamma_euler, max_int, max_real, one, pi, pi2, sp, sqrt2, sqrt3, sqrt6, xi, zero

sf_constants/dbl

“double” precision

Type:

integer

Attributes:

public, parameter

Default:

8

sf_constants/ddp

“quad” precision

Type:

integer

Attributes:

public, parameter

Default:

16

sf_constants/dp

“double” precision, alternative naming

Type:

integer

Attributes:

public, parameter

Default:

8

sf_constants/epsilonq

Small tolerance for quad precision comparisons (stored as real(8); the machine epsilon of kind ddp is about 1.9d-34)

Type:

real

Attributes:

public, parameter

Default:

1.d-30

sf_constants/epsilonr

Machine epsilon of double precision: smallest \(\epsilon\) with \(1+\epsilon \neq 1\)

Type:

real

Attributes:

public, parameter

Default:

epsilon(1.d0)

sf_constants/euler

Real Euler number \(e\)

Type:

real

Attributes:

public, parameter

Default:

2.7182818284590452353602874713526624977572470936999595749669676277240766303535d0

sf_constants/gamma_euler

Real number Euler-Mascheroni constant \(\gamma\)

Type:

real

Attributes:

public, parameter

Default:

0.57721566490153286060d0

sf_constants/max_int

Largest integer number

Type:

integer

Attributes:

public, parameter

Default:

huge(1)

sf_constants/max_real

Largest real number

Type:

real

Attributes:

public, parameter

Default:

huge(1.d0)

sf_constants/one

Complex number \(1+i0\)

Type:

complex

Attributes:

public, parameter

Default:

(1.d0,0.d0)

sf_constants/pi

Real number \(\pi\)

Type:

real

Attributes:

public, parameter

Default:

3.14159265358979323846264338327950288419716939937510d0

sf_constants/pi2

Real number \(2\pi\)

Type:

real

Attributes:

public, parameter

Default:

6.28318530717958647692528676655900576839433879875021d0

sf_constants/sp

“single” precision

Type:

integer

Attributes:

public, parameter

Default:

kind(1.0)

sf_constants/sqrt2

Real number \(\sqrt{2}\)

Type:

real

Attributes:

public, parameter

Default:

1.41421356237309504880169d0

sf_constants/sqrt3

Real number \(\sqrt{3}\)

Type:

real

Attributes:

public, parameter

Default:

1.73205080756887729352745d0

sf_constants/sqrt6

Real number \(\sqrt{6}\)

Type:

real

Attributes:

public, parameter

Default:

2.44948974278317809819728d0

sf_constants/xi

Complex number \(0+i1\)

Type:

complex

Attributes:

public, parameter

Default:

(0.d0,1.d0)

sf_constants/zero

Complex number \(0+i0\)

Type:

complex

Attributes:

public, parameter

Default:

(0.d0,0.d0)

Physical constants

Expressed in the SI units

avogadro_constant, bohr_magneton, bohr_magneton_in_evot, bohr_magneton_in_hzot, bohr_magneton_in_inverse_meters_per_tesla, bohr_magneton_in_kot, bohr_radius, boltzmann_constant, boltzmann_constant_in_evok, boltzmann_constant_in_hzok, boltzmann_constant_in_inverse_meters_per_kelvin, compton_wavelength, compton_wavelength_over_2_pi, electric_constant, electron_charge_to_mass_quotient, electron_g_factor, electron_gyromag__ratio, electron_gyromag__ratio_over_2_pi, electron_mag__mom_, electron_mag__mom__to_bohr_magneton_ratio, electron_mass, electron_mass_energy_equivalent, electron_mass_energy_equivalent_in_mev, electron_volt, electron_volt_atomic_mass_unit_relationship, electron_volt_hartree_relationship, electron_volt_hertz_relationship, electron_volt_inverse_meter_relationship, electron_volt_joule_relationship, electron_volt_kelvin_relationship, electron_volt_kilogram_relationship, elementary_charge, elementary_charge_over_h, faraday_constant, faraday_constant_for_conventional_electric_current, fine_structure_constant, josephson_constant, joule_electron_volt_relationship, joule_hertz_relationship, joule_inverse_meter_relationship, joule_kelvin_relationship, joule_kilogram_relationship, kelvin_atomic_mass_unit_relationship, kelvin_electron_volt_relationship, kelvin_hartree_relationship, kelvin_hertz_relationship, kelvin_inverse_meter_relationship, kelvin_joule_relationship, kelvin_kilogram_relationship, kilogram_atomic_mass_unit_relationship, kilogram_electron_volt_relationship, kilogram_hartree_relationship, kilogram_hertz_relationship, kilogram_inverse_meter_relationship, kilogram_joule_relationship, kilogram_kelvin_relationship, lattice_parameter_of_silicon, natural_unit_of_action, natural_unit_of_action_in_ev_s, natural_unit_of_energy, natural_unit_of_energy_in_mev, natural_unit_of_length, natural_unit_of_mass, natural_unit_of_mom_um, natural_unit_of_mom_um_in_mevoc, natural_unit_of_time, natural_unit_of_velocity, newtonian_constant_of_gravitation, planck_constant, planck_constant_in_ev_s, planck_constant_over_2_pi, rydberg_constant, rydberg_constant_times_c_in_hz, rydberg_constant_times_hc_in_ev, rydberg_constant_times_hc_in_j, speed_of_light_in_vacuum, standard_acceleration_of_gravity, stefan_boltzmann_constant

sf_constants/avogadro_constant

Number of particles per mole \(N_{A} [mol^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.602214076000d+24

sf_constants/bohr_magneton

Natural unit of the electron magnetic moment \(\mu_{B} = \frac{e\hbar}{2m_{e}} [J\cdot T^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.927401006570d-23

sf_constants/bohr_magneton_in_evot

Natural unit of the electron magnetic moment \(\mu_{B} = \frac{e\hbar}{2m_{e}} [eV\cdot T^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.578838179820d-04

sf_constants/bohr_magneton_in_hzot

Natural unit of the electron magnetic moment \(\mu_{B} = \frac{e\hbar}{2m_{e}} [Hz\cdot T^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.139962449171d+11

sf_constants/bohr_magneton_in_inverse_meters_per_tesla

Natural unit of the electron magnetic moment \(\mu_{B} = \frac{e\hbar}{2m_{e}} [m^{-1}\cdot T^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.466864477190d+02

sf_constants/bohr_magneton_in_kot

Natural unit of the electron magnetic moment \(\mu_{B} = \frac{e\hbar}{2m_{e}} [K \cdot T^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.671713814720d+00

sf_constants/bohr_radius

Approximate nucleus-electron distance in an Hydrogen atom \(a_{0} = \frac{4\pi\epsilon_{0}\hbar^{2}}{e^{2}m_{e}} [m]\)

Type:

real

Attributes:

public, parameter

Default:

0.529177210544d-10

sf_constants/boltzmann_constant

Proportionality constant between energy and temperature of an ideal gas \(k_{B} [J \cdot K^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.138064900000d-22

sf_constants/boltzmann_constant_in_evok

Proportionality constant between energy and temperature of an ideal gas \(k_{B} [eV \cdot K^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.8617333262145177d-04

sf_constants/boltzmann_constant_in_hzok

Proportionality constant between energy and temperature of an ideal gas \(k_{B} [Hz \cdot K^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.2083661912332757d+11

sf_constants/boltzmann_constant_in_inverse_meters_per_kelvin

Proportionality constant between energy and temperature of an ideal gas \(k_{B} [m^{-1} \cdot K^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.6950348004861274d+02

sf_constants/compton_wavelength

Wavelength of a photon having the same rest energy as the electron \(\lambda_{c} = \frac{h}{m_{e}c} [m]\)

Type:

real

Attributes:

public, parameter

Default:

0.242631023538d-11

sf_constants/compton_wavelength_over_2_pi

Normalized Compton wavelength \(\lambda_{c} = \frac{\hbar}{m_{e}c} [m]\)

Type:

real

Attributes:

public, parameter

Default:

0.386159267440d-12

sf_constants/electric_constant

Vacuum permittivity \(\epsilon_{0} [F\cdot m^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.885418781880d-11

sf_constants/electron_charge_to_mass_quotient

Ratio between electronic charge and mass \(\frac{q_{e}}{m_{e}} [C \cdot kg^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

-0.175882000838d+12

sf_constants/electron_g_factor

Electron g-factor \(g\) (Dimensionless)

Type:

real

Attributes:

public, parameter

Default:

-0.200231930436092d+01

sf_constants/electron_gyromag__ratio

Electron gyromagnetic ratio \(\gamma_{e} = \frac{|g_{e}|\mu_{B}}{\hbar}[rad\cdot s^{-1}\cdot T^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.176085962784d+12

sf_constants/electron_gyromag__ratio_over_2_pi

Normalized electron gyromagnetic ratio \(\gamma_{e} = \frac{|g_{e}|\mu_{B}}{2\pi\hbar}\;[MHz\cdot T^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.280249513861d+05

sf_constants/electron_mag__mom_

Electron magnetic moment \(\mu_{e} [J\cdot T^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

-0.928476469170d-23

sf_constants/electron_mag__mom__to_bohr_magneton_ratio

Ratio between electron magnetic moment and Bohr magneton \(\frac{\mu_{e}}{\mu_{B}}=\frac{g}{2}\)

Type:

real

Attributes:

public, parameter

Default:

-0.100115965218046d+01

sf_constants/electron_mass

Mass of the electron \(m_{e}\;[kg]\)

Type:

real

Attributes:

public, parameter

Default:

0.910938371390d-30

sf_constants/electron_mass_energy_equivalent

Electron rest energy \([J]\)

Type:

real

Attributes:

public, parameter

Default:

0.818710578800d-13

sf_constants/electron_mass_energy_equivalent_in_mev

Electron rest energy \([MeV]\)

Type:

real

Attributes:

public, parameter

Default:

0.510998950690d+00

sf_constants/electron_volt

Equivalent of \(1\;eV\;[J]\)

Type:

real

Attributes:

public, parameter

Default:

0.160217663400d-18

sf_constants/electron_volt_atomic_mass_unit_relationship

Atomic mass unit equivalence of \(1\;eV\)

Type:

real

Attributes:

public, parameter

Default:

0.107354410083d-08

sf_constants/electron_volt_hartree_relationship

Equivalent of \(1\;eV\;[Ha]\)

Type:

real

Attributes:

public, parameter

Default:

0.36749322175665d-01

sf_constants/electron_volt_hertz_relationship

Equivalent of \(1\;eV\;[Hz]\)

Type:

real

Attributes:

public, parameter

Default:

0.2417989242084918d+15

sf_constants/electron_volt_inverse_meter_relationship

Equivalent of \(1\;eV\;[m^-1]\)

Type:

real

Attributes:

public, parameter

Default:

0.8065543937349212d+06

sf_constants/electron_volt_joule_relationship

Equivalent of \(1\;eV\;[J]\)

Type:

real

Attributes:

public, parameter

Default:

0.160217663400d-18

sf_constants/electron_volt_kelvin_relationship

Equivalent of \(1\;eV\;[K]\)

Type:

real

Attributes:

public, parameter

Default:

0.1160451812155008d+05

sf_constants/electron_volt_kilogram_relationship

Equivalent of \(1\;eV\;[kg]\)

Type:

real

Attributes:

public, parameter

Default:

0.1782661921627898d-35

sf_constants/elementary_charge

Charge unit (charge of the proton) \([C]\)

Type:

real

Attributes:

public, parameter

Default:

0.160217663400d-18

sf_constants/elementary_charge_over_h

Charge unit (charge of the proton) divided by \(h\;[m^{-2} kg^{-1} s^{2} A]\)

Type:

real

Attributes:

public, parameter

Default:

0.2417989242084918d+15

sf_constants/faraday_constant

Quotient between total charge and number of charge carriers (2019 SI units) \(\frac{q}{n}=eN_{A}\;[C\;mol^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.9648533212331002d+05

sf_constants/faraday_constant_for_conventional_electric_current

Quotient between total charge and number of charge carriers (1990 “conventional” values, derived as \(F/(1\;C_{90}\;[C])\)):math:frac{q}{n}=eN_{A};[C;mol^{-1}]

Type:

real

Attributes:

public, parameter

Default:

0.964853235487d+05

sf_constants/fine_structure_constant

Fundamental constant characterizing the strength of the electromagnetic interaction between elementarycharged particles \(\alpha=\frac{e^2}{2\epsilon_{0}hc}\)

Type:

real

Attributes:

public, parameter

Default:

0.729735256430d-02

sf_constants/josephson_constant

Inverse of the magnetic flux quantum \(K_{J}=\frac{2e}{h}\;[Hz\;V^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.4835978484169836d+15

sf_constants/joule_electron_volt_relationship

Equivalent of \(1J\) in \([eV]\)

Type:

real

Attributes:

public, parameter

Default:

0.6241509074460763d+19

sf_constants/joule_hertz_relationship

Equivalent of \(1J\) in \([Hz]\), from \(f=\frac{E}{h}\)

Type:

real

Attributes:

public, parameter

Default:

0.1509190179642152d+34

sf_constants/joule_inverse_meter_relationship

Equivalent of \(1J\) in \([m^{-1}]\), from \(\frac{1}{\lambda}=\frac{E}{hc}\)

Type:

real

Attributes:

public, parameter

Default:

0.5034116567542709d+25

sf_constants/joule_kelvin_relationship

Equivalent of \(1J\) in \([K]\), from \(T=\frac{E}{k_{B}}\)

Type:

real

Attributes:

public, parameter

Default:

0.7242970516039920d+23

sf_constants/joule_kilogram_relationship

Equivalent of \(1J\) in \([kg]\), from \(m=\frac{E}{c^{2}}\)

Type:

real

Attributes:

public, parameter

Default:

0.1112650056053618d-16

sf_constants/kelvin_atomic_mass_unit_relationship

Equivalent of \(1K\) in \([amu]\)

Type:

real

Attributes:

public, parameter

Default:

0.925108728840d-13

sf_constants/kelvin_electron_volt_relationship

Equivalent of \(1K\) in \([eV]\)

Type:

real

Attributes:

public, parameter

Default:

0.8617333262145177d-04

sf_constants/kelvin_hartree_relationship

Equivalent of \(1K\) in \([Ha]\)

Type:

real

Attributes:

public, parameter

Default:

0.31668115634564d-05

sf_constants/kelvin_hertz_relationship

Equivalent of \(1K\) in \([Hz]\)

Type:

real

Attributes:

public, parameter

Default:

0.2083661912332757d+11

sf_constants/kelvin_inverse_meter_relationship

Equivalent of \(1K\) in \([m^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.6950348004861274d+02

sf_constants/kelvin_joule_relationship

Equivalent of \(1K\) in \([J]\) (Boltzmann constant)

Type:

real

Attributes:

public, parameter

Default:

0.138064900000d-22

sf_constants/kelvin_kilogram_relationship

Equivalent of \(1K\) in \([kg]\)

Type:

real

Attributes:

public, parameter

Default:

0.1536179187240372d-39

sf_constants/kilogram_atomic_mass_unit_relationship

Equivalent of \(1kg\) in \([amu]\)

Type:

real

Attributes:

public, parameter

Default:

0.602214075370d+27

sf_constants/kilogram_electron_volt_relationship

Equivalent of \(1kg\) in \([eV]\)

Type:

real

Attributes:

public, parameter

Default:

0.5609588603804452d+36

sf_constants/kilogram_hartree_relationship

Equivalent of \(1kg\) in \([Ha]\)

Type:

real

Attributes:

public, parameter

Default:

0.20614857887415d+35

sf_constants/kilogram_hertz_relationship

Equivalent of \(1kg\) in \([Hz]\)

Type:

real

Attributes:

public, parameter

Default:

0.1356392489652132d+51

sf_constants/kilogram_inverse_meter_relationship

Equivalent of \(1kg\) in \([m^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.4524438335443823d+42

sf_constants/kilogram_joule_relationship

Equivalent of \(1kg\) in \([J]\)

Type:

real

Attributes:

public, parameter

Default:

0.8987551787368176d+17

sf_constants/kilogram_kelvin_relationship

Equivalent of \(1kg\) in \([K]\)

Type:

real

Attributes:

public, parameter

Default:

0.6509657260728959d+40

sf_constants/lattice_parameter_of_silicon

Lattice parameter of diamond cubic silicon lattice \([m]\)

Type:

real

Attributes:

public, parameter

Default:

0.543102051100d-09

sf_constants/natural_unit_of_action

Value of \(\hbar = \frac{h}{2\pi}\) \([J \cdot s]\)

Type:

real

Attributes:

public, parameter

Default:

0.1054571817646156d-33

sf_constants/natural_unit_of_action_in_ev_s

Value of \(\hbar = \frac{h}{2\pi}\) \([eV \cdot s]\)

Type:

real

Attributes:

public, parameter

Default:

0.6582119569509066d-15

sf_constants/natural_unit_of_energy

Rest energy of the electron \([J]\)

Type:

real

Attributes:

public, parameter

Default:

0.818710578800d-13

sf_constants/natural_unit_of_energy_in_mev

Rest energy of the electron \([MeV]\)

Type:

real

Attributes:

public, parameter

Default:

0.510998950690d+00

sf_constants/natural_unit_of_length

Reduced Compton wavelength of the electron \(\lambda_{C}=\frac{\hbar}{m_{e}c}\;[m]\)

Type:

real

Attributes:

public, parameter

Default:

0.386159267440d-12

sf_constants/natural_unit_of_mass

Mass of the electron \(m_{e}\;[kg]\)

Type:

real

Attributes:

public, parameter

Default:

0.910938371390d-30

sf_constants/natural_unit_of_mom_um

Natural momentum unit \(m_{e}c\;[kg \cdot m \cdot s^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.273092453446d-21

sf_constants/natural_unit_of_mom_um_in_mevoc

Natural momentum unit in MeV over c \(m_{e}c\;[MeV\cdot c^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.510998950690d+00

sf_constants/natural_unit_of_time

Reduced Compton time of the electron \(t_{C}=\frac{\hbar}{m_{e}c^{2}}\;[s]\)

Type:

real

Attributes:

public, parameter

Default:

0.128808866644d-20

sf_constants/natural_unit_of_velocity

Speed of light \(c\;[m\cdot s^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.299792458000d+09

sf_constants/newtonian_constant_of_gravitation

Gravitational constant \(G\;[m^{3}\cdot kg^{-1} \cdot s^{-2}]\)

Type:

real

Attributes:

public, parameter

Default:

0.667430000000d-10

sf_constants/planck_constant

Planck constant \(h\;[J \cdot s]\)

Type:

real

Attributes:

public, parameter

Default:

0.662607015000d-33

sf_constants/planck_constant_in_ev_s

Planck constant \(h\;[eV \cdot s]\)

Type:

real

Attributes:

public, parameter

Default:

0.4135667696923859d-14

sf_constants/planck_constant_over_2_pi

Reduced Planck constant \(\hbar\;[J \cdot s]\)

Type:

real

Attributes:

public, parameter

Default:

0.1054571817646156d-33

sf_constants/rydberg_constant

Highest wavenumber of a photon emitted by a Hydrogen atom \(R_{\infty}=\frac{m_{e}e^{4}}{8\epsilon_{0}^{2}h^{3}c}\;[m^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.10973731568157d+08

sf_constants/rydberg_constant_times_c_in_hz

Rydberg constant times \(c\) : \(R_{\infty}c=\frac{m_{e}e^{4}}{8\epsilon_{0}^{2}h^{3}}\;[Hz]\)

Type:

real

Attributes:

public, parameter

Default:

0.328984196025d+16

sf_constants/rydberg_constant_times_hc_in_ev

Rydberg constant times \(hc\) : \(R_{\infty}hc=\frac{m_{e}e^{4}}{8\epsilon_{0}^{2}h^{2}}\;[eV]\)

Type:

real

Attributes:

public, parameter

Default:

0.1360569312299d+02

sf_constants/rydberg_constant_times_hc_in_j

Rydberg constant times \(hc\) : \(R_{\infty}hc=\frac{m_{e}e^{4}}{8\epsilon_{0}^{2}h^{2}}\;[J]\)

Type:

real

Attributes:

public, parameter

Default:

0.2179872361103d-17

sf_constants/speed_of_light_in_vacuum

Speed of light \(c\;[m\cdot s^{-1}]\)

Type:

real

Attributes:

public, parameter

Default:

0.299792458000d+09

sf_constants/standard_acceleration_of_gravity

Acceleration of gravity on Earth \(g\;[m\cdot s^{-2}]\)

Type:

real

Attributes:

public, parameter

Default:

9.80665d000000

sf_constants/stefan_boltzmann_constant

Total energy radiated per unit surface of a black body \(\sigma\;[W \cdot m^{-2} \cdot K^{-4}]\)

Type:

real

Attributes:

public, parameter

Default:

0.5670374419184429d-07