36 use,
intrinsic :: iso_c_binding
64 type,
bind(c) :: kim_length_unit_type
70 integer(c_int) length_unit_id
79 bind(c, name="KIM_LENGTH_UNIT_unused") &
88 bind(c, name="KIM_LENGTH_UNIT_A") &
97 bind(c, name="KIM_LENGTH_UNIT_Bohr") &
106 bind(c, name="KIM_LENGTH_UNIT_cm") &
115 bind(c, name="KIM_LENGTH_UNIT_m") &
124 bind(c, name="KIM_LENGTH_UNIT_nm") &
133 module procedure kim_length_unit_known
141 interface operator(.eq.)
142 module procedure kim_length_unit_equal
143 end interface operator(.eq.)
150 interface operator(.ne.)
151 module procedure kim_length_unit_not_equal
152 end interface operator(.ne.)
161 module procedure kim_length_unit_from_string
170 module procedure kim_length_unit_to_string
179 logical recursive function kim_length_unit_known(length_unit)
182 integer(c_int) recursive function known(length_unit) &
183 bind(c, name="KIM_LengthUnit_Known")
184 use,
intrinsic :: iso_c_binding
187 type(kim_length_unit_type),
intent(in),
value :: length_unit
190 type(kim_length_unit_type),
intent(in) :: length_unit
192 kim_length_unit_known = (known(length_unit) /= 0)
193 end function kim_length_unit_known
200 logical recursive function kim_length_unit_equal(lhs, rhs)
202 type(kim_length_unit_type),
intent(in) :: lhs
203 type(kim_length_unit_type),
intent(in) :: rhs
205 kim_length_unit_equal &
206 = (lhs%length_unit_id == rhs%length_unit_id)
207 end function kim_length_unit_equal
214 logical recursive function kim_length_unit_not_equal(lhs, rhs)
216 type(kim_length_unit_type),
intent(in) :: lhs
217 type(kim_length_unit_type),
intent(in) :: rhs
219 kim_length_unit_not_equal = .not. (lhs == rhs)
220 end function kim_length_unit_not_equal
228 recursive subroutine kim_length_unit_from_string(string, length_unit)
231 type(kim_length_unit_type)
recursive function from_string(string) &
232 bind(c, name="KIM_LengthUnit_FromString")
233 use,
intrinsic :: iso_c_binding
236 character(c_char),
intent(in) :: string(*)
237 end function from_string
239 character(len=*, kind=c_char),
intent(in) :: string
240 type(kim_length_unit_type),
intent(out) :: length_unit
242 length_unit = from_string(trim(string)//c_null_char)
243 end subroutine kim_length_unit_from_string
250 recursive subroutine kim_length_unit_to_string(length_unit, string)
251 use kim_convert_string_module,
only: kim_convert_c_char_ptr_to_string
254 type(c_ptr)
recursive function get_string(length_unit) &
255 bind(c, name="KIM_LengthUnit_ToString")
256 use,
intrinsic :: iso_c_binding
259 type(kim_length_unit_type),
intent(in),
value :: length_unit
262 type(kim_length_unit_type),
intent(in) :: length_unit
263 character(len=*, kind=c_char),
intent(out) :: string
268 call kim_convert_c_char_ptr_to_string(p, string)
269 end subroutine kim_length_unit_to_string
280 recursive subroutine get_number_of_length_units(number_of_length_units) &
281 bind(c, name="KIM_LENGTH_UNIT_GetNumberOfLengthUnits")
282 use,
intrinsic :: iso_c_binding
283 integer(c_int),
intent(out) :: number_of_length_units
284 end subroutine get_number_of_length_units
286 integer(c_int),
intent(out) :: number_of_length_units
288 call get_number_of_length_units(number_of_length_units)
299 integer(c_int) recursive function get_length_unit(index, length_unit) &
300 bind(c, name="KIM_LENGTH_UNIT_GetLengthUnit")
301 use,
intrinsic :: iso_c_binding
304 integer(c_int),
intent(in),
value :: index
306 end function get_length_unit
308 integer(c_int),
intent(in) :: index
310 integer(c_int),
intent(out) :: ierr
312 ierr = get_length_unit(index - 1, length_unit)
Create a LengthUnit 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 LengthUnit's supported by the KIM API.
type(kim_length_unit_type), save, bind(C, name="KIM_LENGTH_UNIT_nm"), public, protected kim_length_unit_nm
The standard nanometer unit of length.
type(kim_length_unit_type), save, bind(C, name="KIM_LENGTH_UNIT_A"), public, protected kim_length_unit_a
The standard angstrom unit of length.
type(kim_length_unit_type), save, bind(C, name="KIM_LENGTH_UNIT_unused"), public, protected kim_length_unit_unused
Indicates that a LengthUnit is not used.
recursive subroutine, public kim_get_length_unit(index, length_unit, ierr)
Get the identity of each defined standard LengthUnit.
type(kim_length_unit_type), save, bind(C, name="KIM_LENGTH_UNIT_Bohr"), public, protected kim_length_unit_bohr
The standard Bohr unit of length.
type(kim_length_unit_type), save, bind(C, name="KIM_LENGTH_UNIT_cm"), public, protected kim_length_unit_cm
The standard centimeter unit of length.
recursive subroutine, public kim_get_number_of_length_units(number_of_length_units)
Get the number of standard LengthUnit's defined by the KIM API.
type(kim_length_unit_type), save, bind(C, name="KIM_LENGTH_UNIT_m"), public, protected kim_length_unit_m
The standard meter unit of length.
An Extensible Enumeration for the LengthUnit's supported by the KIM API.