![]() |
(git:d18deda)
|
unit conversion facility More...
Data Types | |
type | cp_unit_set_type |
stores the default units to be used More... | |
type | cp_unit_type |
stores a unit More... | |
Functions/Subroutines | |
subroutine, public | cp_unit_create (unit, string) |
creates a unit parsing a string | |
elemental subroutine, public | cp_unit_release (unit) |
releases the given unit | |
character(len=cp_unit_desc_length) function, public | cp_unit_desc (unit, defaults, accept_undefined) |
returns the "name" of the given unit | |
real(kind=dp) function, public | cp_unit_to_cp2k1 (value, unit, defaults, power) |
transform a value to the internal cp2k units | |
real(kind=dp) function, public | cp_unit_from_cp2k1 (value, unit, defaults, power) |
converts from the internal cp2k units to the given unit | |
real(kind=dp) function, public | cp_unit_to_cp2k (value, unit_str, defaults, power) |
converts to the internal cp2k units to the given unit | |
real(kind=dp) function, public | cp_unit_from_cp2k (value, unit_str, defaults, power) |
converts from the internal cp2k units to the given unit | |
logical function, public | cp_unit_compatible (ref_unit, unit) |
returs true if the two units are compatible | |
subroutine, public | cp_unit_set_create (unit_set, name) |
initializes the given unit set | |
subroutine, public | cp_unit_set_release (unit_set) |
releases the given unit set | |
subroutine, public | export_units_as_xml (iw) |
Exports all available units as XML. | |
Variables | |
integer, parameter, public | cp_ukind_none = 0 |
integer, parameter, public | cp_ukind_energy = 1 |
integer, parameter, public | cp_ukind_length = 2 |
integer, parameter, public | cp_ukind_temperature = 3 |
integer, parameter, public | cp_ukind_angle = 4 |
integer, parameter, public | cp_ukind_pressure = 5 |
integer, parameter, public | cp_ukind_time = 6 |
integer, parameter, public | cp_ukind_mass = 7 |
integer, parameter, public | cp_ukind_undef = 8 |
integer, parameter, public | cp_ukind_potential = 9 |
integer, parameter, public | cp_ukind_force = 10 |
integer, parameter, public | cp_ukind_max = 10 |
integer, parameter, public | cp_units_none = 100 |
integer, parameter, public | cp_units_au = 101 |
integer, parameter, public | cp_units_m_e = 110 |
integer, parameter, public | cp_units_amu = 111 |
integer, parameter, public | cp_units_kg = 112 |
integer, parameter, public | cp_units_hartree = 130 |
integer, parameter, public | cp_units_wavenum = 131 |
integer, parameter, public | cp_units_joule = 132 |
integer, parameter, public | cp_units_kcalmol = 133 |
integer, parameter, public | cp_units_ry = 134 |
integer, parameter, public | cp_units_ev = 135 |
integer, parameter, public | cp_units_kjmol = 136 |
integer, parameter, public | cp_units_jmol = 137 |
integer, parameter, public | cp_units_kev = 138 |
integer, parameter, public | cp_units_bohr = 140 |
integer, parameter, public | cp_units_angstrom = 141 |
integer, parameter, public | cp_units_m = 142 |
integer, parameter, public | cp_units_pm = 143 |
integer, parameter, public | cp_units_nm = 144 |
integer, parameter, public | cp_units_k = 150 |
integer, parameter, public | cp_units_bar = 161 |
integer, parameter, public | cp_units_atm = 162 |
integer, parameter, public | cp_units_kbar = 163 |
integer, parameter, public | cp_units_pa = 164 |
integer, parameter, public | cp_units_mpa = 165 |
integer, parameter, public | cp_units_gpa = 166 |
integer, parameter, public | cp_units_rad = 170 |
integer, parameter, public | cp_units_deg = 171 |
integer, parameter, public | cp_units_fs = 180 |
integer, parameter, public | cp_units_s = 181 |
integer, parameter, public | cp_units_wn = 182 |
integer, parameter, public | cp_units_ps = 183 |
integer, parameter, public | cp_units_volt = 190 |
integer, parameter, public | cp_units_newton = 200 |
integer, parameter, public | cp_units_mnewton = 201 |
integer, parameter, public | cp_unit_max_kinds = 8 |
integer, parameter, public | cp_unit_basic_desc_length = 15 |
integer, parameter, public | cp_unit_desc_length = cp_unit_max_kinds*cp_unit_basic_desc_length |
unit conversion facility
Units are complex, this module does not try to be very smart, for example SI prefixes are not supported automatically, and which kinds are really basic can change depending on the system of units chosen, and equivalences are not always catched. This is thought as a simple conversion facility for the input and output. If you need something more you are probably better off using the physcon module directly.
subroutine, public cp_units::cp_unit_create | ( | type(cp_unit_type), intent(out) | unit, |
character(len=*), intent(in) | string | ||
) |
creates a unit parsing a string
unit | the unit to initialize |
string | the string containing the description of the unit |
Definition at line 162 of file cp_units.F.
elemental subroutine, public cp_units::cp_unit_release | ( | type(cp_unit_type), intent(in) | unit | ) |
releases the given unit
unit | the unit to release |
Definition at line 544 of file cp_units.F.
character(len=cp_unit_desc_length) function, public cp_units::cp_unit_desc | ( | type(cp_unit_type), intent(in) | unit, |
type(cp_unit_set_type), intent(in), optional | defaults, | ||
logical, intent(in), optional | accept_undefined | ||
) |
returns the "name" of the given unit
unit | the unit to describe |
defaults | defaults for the undefined units, optional |
accept_undefined | if defaults is not present or is not associated whether undefined units should be accepted (defaults to false) |
Definition at line 1034 of file cp_units.F.
real(kind=dp) function, public cp_units::cp_unit_to_cp2k1 | ( | real(kind=dp), intent(in) | value, |
type(cp_unit_type), intent(in) | unit, | ||
type(cp_unit_set_type), intent(in), optional | defaults, | ||
integer, intent(in), optional | power | ||
) |
transform a value to the internal cp2k units
value | the value to convert |
unit | the unit of the result |
defaults | the defaults unit for those that are left free (cp_units_none) |
power | the power of the unit (defaults to 1) |
Definition at line 1084 of file cp_units.F.
real(kind=dp) function, public cp_units::cp_unit_from_cp2k1 | ( | real(kind=dp), intent(in) | value, |
type(cp_unit_type), intent(in) | unit, | ||
type(cp_unit_set_type), intent(in), optional | defaults, | ||
integer, intent(in), optional | power | ||
) |
converts from the internal cp2k units to the given unit
value | the value to convert |
unit | the unit of the result |
defaults | the defaults unit for those that are left free (cp_units_none) |
power | the power of the unit (defaults to 1) |
Definition at line 1120 of file cp_units.F.
real(kind=dp) function, public cp_units::cp_unit_to_cp2k | ( | real(kind=dp), intent(in) | value, |
character(len=*), intent(in) | unit_str, | ||
type(cp_unit_set_type), intent(in), optional | defaults, | ||
integer, intent(in), optional | power | ||
) |
converts to the internal cp2k units to the given unit
value | the value to convert |
unit_str | the unit of the result as string |
defaults | the defaults unit for those that are left free (cp_units_none) |
power | the power of the unit (defaults to 1) |
Definition at line 1149 of file cp_units.F.
real(kind=dp) function, public cp_units::cp_unit_from_cp2k | ( | real(kind=dp), intent(in) | value, |
character(len=*), intent(in) | unit_str, | ||
type(cp_unit_set_type), intent(in), optional | defaults, | ||
integer, intent(in), optional | power | ||
) |
converts from the internal cp2k units to the given unit
value | the value to convert |
unit_str | the unit of the result as string |
defaults | the defaults unit for those that are left free (cp_units_none) |
power | the power of the unit (defaults to 1) |
Definition at line 1178 of file cp_units.F.
logical function, public cp_units::cp_unit_compatible | ( | type(cp_unit_type), intent(in) | ref_unit, |
type(cp_unit_type), intent(in) | unit | ||
) |
returs true if the two units are compatible
ref_unit | ... |
unit | ... |
Definition at line 1204 of file cp_units.F.
subroutine, public cp_units::cp_unit_set_create | ( | type(cp_unit_set_type), intent(out) | unit_set, |
character(len=*), intent(in) | name | ||
) |
initializes the given unit set
unit_set | the set to initialize |
name | the name of the set, used for the dafault initialization of the various units |
Definition at line 1227 of file cp_units.F.
subroutine, public cp_units::cp_unit_set_release | ( | type(cp_unit_set_type), intent(inout) | unit_set | ) |
releases the given unit set
unit_set | the unit set to release |
Definition at line 1298 of file cp_units.F.
subroutine, public cp_units::export_units_as_xml | ( | integer, intent(in) | iw | ) |
Exports all available units as XML.
iw | ... |
Definition at line 1315 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_none = 0 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_energy = 1 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_length = 2 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_temperature = 3 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_angle = 4 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_pressure = 5 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_time = 6 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_mass = 7 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_undef = 8 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_potential = 9 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_force = 10 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_ukind_max = 10 |
Definition at line 51 of file cp_units.F.
integer, parameter, public cp_units::cp_units_none = 100 |
Definition at line 65 of file cp_units.F.
integer, parameter, public cp_units::cp_units_au = 101 |
Definition at line 65 of file cp_units.F.
integer, parameter, public cp_units::cp_units_m_e = 110 |
Definition at line 68 of file cp_units.F.
integer, parameter, public cp_units::cp_units_amu = 111 |
Definition at line 68 of file cp_units.F.
integer, parameter, public cp_units::cp_units_kg = 112 |
Definition at line 68 of file cp_units.F.
integer, parameter, public cp_units::cp_units_hartree = 130 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_wavenum = 131 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_joule = 132 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_kcalmol = 133 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_ry = 134 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_ev = 135 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_kjmol = 136 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_jmol = 137 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_kev = 138 |
Definition at line 72 of file cp_units.F.
integer, parameter, public cp_units::cp_units_bohr = 140 |
Definition at line 83 of file cp_units.F.
integer, parameter, public cp_units::cp_units_angstrom = 141 |
Definition at line 83 of file cp_units.F.
integer, parameter, public cp_units::cp_units_m = 142 |
Definition at line 83 of file cp_units.F.
integer, parameter, public cp_units::cp_units_pm = 143 |
Definition at line 83 of file cp_units.F.
integer, parameter, public cp_units::cp_units_nm = 144 |
Definition at line 83 of file cp_units.F.
integer, parameter, public cp_units::cp_units_k = 150 |
Definition at line 90 of file cp_units.F.
integer, parameter, public cp_units::cp_units_bar = 161 |
Definition at line 93 of file cp_units.F.
integer, parameter, public cp_units::cp_units_atm = 162 |
Definition at line 94 of file cp_units.F.
integer, parameter, public cp_units::cp_units_kbar = 163 |
Definition at line 95 of file cp_units.F.
integer, parameter, public cp_units::cp_units_pa = 164 |
Definition at line 96 of file cp_units.F.
integer, parameter, public cp_units::cp_units_mpa = 165 |
Definition at line 97 of file cp_units.F.
integer, parameter, public cp_units::cp_units_gpa = 166 |
Definition at line 98 of file cp_units.F.
integer, parameter, public cp_units::cp_units_rad = 170 |
Definition at line 101 of file cp_units.F.
integer, parameter, public cp_units::cp_units_deg = 171 |
Definition at line 101 of file cp_units.F.
integer, parameter, public cp_units::cp_units_fs = 180 |
Definition at line 105 of file cp_units.F.
integer, parameter, public cp_units::cp_units_s = 181 |
Definition at line 105 of file cp_units.F.
integer, parameter, public cp_units::cp_units_wn = 182 |
Definition at line 105 of file cp_units.F.
integer, parameter, public cp_units::cp_units_ps = 183 |
Definition at line 105 of file cp_units.F.
integer, parameter, public cp_units::cp_units_volt = 190 |
Definition at line 111 of file cp_units.F.
integer, parameter, public cp_units::cp_units_newton = 200 |
Definition at line 114 of file cp_units.F.
integer, parameter, public cp_units::cp_units_mnewton = 201 |
Definition at line 114 of file cp_units.F.
integer, parameter, public cp_units::cp_unit_max_kinds = 8 |
Definition at line 117 of file cp_units.F.
integer, parameter, public cp_units::cp_unit_basic_desc_length = 15 |
Definition at line 117 of file cp_units.F.
integer, parameter, public cp_units::cp_unit_desc_length = cp_unit_max_kinds*cp_unit_basic_desc_length |
Definition at line 117 of file cp_units.F.