36 use,
intrinsic :: iso_c_binding
65 type,
bind(c) :: kim_energy_unit_type
71 integer(c_int) energy_unit_id
80 bind(c, name="KIM_ENERGY_UNIT_unused") &
89 bind(c, name="KIM_ENERGY_UNIT_amu_A2_per_ps2") &
98 bind(c, name="KIM_ENERGY_UNIT_erg") &
107 bind(c, name="KIM_ENERGY_UNIT_eV") &
116 bind(c, name="KIM_ENERGY_UNIT_Hartree") &
125 bind(c, name="KIM_ENERGY_UNIT_J") &
134 bind(c, name="KIM_ENERGY_UNIT_kcal_mol") &
143 module procedure kim_energy_unit_known
151 interface operator(.eq.)
152 module procedure kim_energy_unit_equal
153 end interface operator(.eq.)
160 interface operator(.ne.)
161 module procedure kim_energy_unit_not_equal
162 end interface operator(.ne.)
171 module procedure kim_energy_unit_from_string
180 module procedure kim_energy_unit_to_string
189 logical recursive function kim_energy_unit_known(energy_unit)
192 integer(c_int) recursive function known(energy_unit) &
193 bind(c, name="KIM_EnergyUnit_Known")
194 use,
intrinsic :: iso_c_binding
197 type(kim_energy_unit_type),
intent(in),
value :: energy_unit
200 type(kim_energy_unit_type),
intent(in) :: energy_unit
202 kim_energy_unit_known = (known(energy_unit) /= 0)
203 end function kim_energy_unit_known
210 logical recursive function kim_energy_unit_equal(lhs, rhs)
212 type(kim_energy_unit_type),
intent(in) :: lhs
213 type(kim_energy_unit_type),
intent(in) :: rhs
215 kim_energy_unit_equal &
216 = (lhs%energy_unit_id == rhs%energy_unit_id)
217 end function kim_energy_unit_equal
224 logical recursive function kim_energy_unit_not_equal(lhs, rhs)
226 type(kim_energy_unit_type),
intent(in) :: lhs
227 type(kim_energy_unit_type),
intent(in) :: rhs
229 kim_energy_unit_not_equal = .not. (lhs == rhs)
230 end function kim_energy_unit_not_equal
238 recursive subroutine kim_energy_unit_from_string(string, energy_unit)
241 type(kim_energy_unit_type)
recursive function from_string(string) &
242 bind(c, name="KIM_EnergyUnit_FromString")
243 use,
intrinsic :: iso_c_binding
246 character(c_char),
intent(in) :: string(*)
247 end function from_string
249 character(len=*, kind=c_char),
intent(in) :: string
250 type(kim_energy_unit_type),
intent(out) :: energy_unit
252 energy_unit = from_string(trim(string)//c_null_char)
253 end subroutine kim_energy_unit_from_string
260 recursive subroutine kim_energy_unit_to_string(energy_unit, string)
261 use kim_convert_string_module,
only: kim_convert_c_char_ptr_to_string
264 type(c_ptr)
recursive function get_string(energy_unit) &
265 bind(c, name="KIM_EnergyUnit_ToString")
266 use,
intrinsic :: iso_c_binding
269 type(kim_energy_unit_type),
intent(in),
value :: energy_unit
272 type(kim_energy_unit_type),
intent(in) :: energy_unit
273 character(len=*, kind=c_char),
intent(out) :: string
278 call kim_convert_c_char_ptr_to_string(p, string)
279 end subroutine kim_energy_unit_to_string
290 recursive subroutine get_number_of_energy_units(number_of_energy_units) &
291 bind(c, name="KIM_ENERGY_UNIT_GetNumberOfEnergyUnits")
292 use,
intrinsic :: iso_c_binding
293 integer(c_int),
intent(out) :: number_of_energy_units
294 end subroutine get_number_of_energy_units
296 integer(c_int),
intent(out) :: number_of_energy_units
298 call get_number_of_energy_units(number_of_energy_units)
309 integer(c_int) recursive function get_energy_unit(index, energy_unit) &
310 bind(c, name="KIM_ENERGY_UNIT_GetEnergyUnit")
311 use,
intrinsic :: iso_c_binding
314 integer(c_int),
intent(in),
value :: index
316 end function get_energy_unit
318 integer(c_int),
intent(in) :: index
320 integer(c_int),
intent(out) :: ierr
322 ierr = get_energy_unit(index - 1, energy_unit)
Create an EnergyUnit object corresponding to the provided string. If the string does not match one of...
Determines if the object is a quantity known to the KIM API.
Converts the object to a string.
An Extensible Enumeration for the EnergyUnit's supported by the KIM API.
type(kim_energy_unit_type), save, bind(C, name="KIM_ENERGY_UNIT_erg"), public, protected kim_energy_unit_erg
The standard erg unit of energy.
type(kim_energy_unit_type), save, bind(C, name="KIM_ENERGY_UNIT_unused"), public, protected kim_energy_unit_unused
Indicates that a EnergyUnit is not used.
type(kim_energy_unit_type), save, bind(C, name="KIM_ENERGY_UNIT_Hartree"), public, protected kim_energy_unit_hartree
The standard Hartree unit of energy.
recursive subroutine, public kim_get_number_of_energy_units(number_of_energy_units)
Get the number of standard EnergyUnit's defined by the KIM API.
recursive subroutine, public kim_get_energy_unit(index, energy_unit, ierr)
Get the identity of each defined standard EnergyUnit.
type(kim_energy_unit_type), save, bind(C, name="KIM_ENERGY_UNIT_J"), public, protected kim_energy_unit_j
The standard Joule unit of energy.
type(kim_energy_unit_type), save, bind(C, name="KIM_ENERGY_UNIT_amu_A2_per_ps2"), public, protected kim_energy_unit_amu_a2_per_ps2
The standard amu*A /ps unit of energy.
type(kim_energy_unit_type), save, bind(C, name="KIM_ENERGY_UNIT_eV"), public, protected kim_energy_unit_ev
The standard electronvolt unit of energy.
type(kim_energy_unit_type), save, bind(C, name="KIM_ENERGY_UNIT_kcal_mol"), public, protected kim_energy_unit_kcal_mol
The standard kilocalorie per mole unit of energy.
An Extensible Enumeration for the EnergyUnit's supported by the KIM API.