![]() |
(git:f7b9015)
|
unit conversion facility More...
Data Types | |
| type | cp_unit_type |
| stores a unit More... | |
| type | cp_unit_set_type |
| stores the default units to be used 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_efield = 11 |
| integer, parameter, public | cp_ukind_dipole = 12 |
| integer, parameter, public | cp_ukind_max = 12 |
| 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_units_volt_per_m = 202 |
| integer, parameter, public | cp_units_volt_per_nm = 203 |
| integer, parameter, public | cp_units_volt_per_angstrom = 204 |
| integer, parameter, public | cp_units_debye = 210 |
| integer, parameter, public | cp_units_e_angstrom = 211 |
| integer, parameter, public | cp_units_c_m = 212 |
| 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 173 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 586 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 1166 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 1216 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 1252 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 1281 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 1310 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 1336 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 1359 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 1436 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 1453 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_none = 0 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_energy = 1 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_length = 2 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_temperature = 3 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_angle = 4 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_pressure = 5 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_time = 6 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_mass = 7 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_undef = 8 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_potential = 9 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_force = 10 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_efield = 11 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_dipole = 12 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_ukind_max = 12 |
Definition at line 50 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_none = 100 |
Definition at line 66 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_au = 101 |
Definition at line 66 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_m_e = 110 |
Definition at line 69 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_amu = 111 |
Definition at line 69 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_kg = 112 |
Definition at line 69 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_hartree = 130 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_wavenum = 131 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_joule = 132 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_kcalmol = 133 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_ry = 134 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_ev = 135 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_kjmol = 136 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_jmol = 137 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_kev = 138 |
Definition at line 73 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_bohr = 140 |
Definition at line 84 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_angstrom = 141 |
Definition at line 84 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_m = 142 |
Definition at line 84 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_pm = 143 |
Definition at line 84 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_nm = 144 |
Definition at line 84 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_k = 150 |
Definition at line 91 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_bar = 161 |
Definition at line 94 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_atm = 162 |
Definition at line 95 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_kbar = 163 |
Definition at line 96 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_pa = 164 |
Definition at line 97 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_mpa = 165 |
Definition at line 98 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_gpa = 166 |
Definition at line 99 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_rad = 170 |
Definition at line 102 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_deg = 171 |
Definition at line 102 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_fs = 180 |
Definition at line 106 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_s = 181 |
Definition at line 106 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_wn = 182 |
Definition at line 106 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_ps = 183 |
Definition at line 106 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_volt = 190 |
Definition at line 112 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_newton = 200 |
Definition at line 115 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_mnewton = 201 |
Definition at line 115 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_volt_per_m = 202 |
Definition at line 119 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_volt_per_nm = 203 |
Definition at line 119 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_volt_per_angstrom = 204 |
Definition at line 119 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_debye = 210 |
Definition at line 124 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_e_angstrom = 211 |
Definition at line 124 of file cp_units.F.
| integer, parameter, public cp_units::cp_units_c_m = 212 |
Definition at line 124 of file cp_units.F.
| integer, parameter, public cp_units::cp_unit_max_kinds = 8 |
Definition at line 128 of file cp_units.F.
| integer, parameter, public cp_units::cp_unit_basic_desc_length = 15 |
Definition at line 128 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 128 of file cp_units.F.