36 use,
intrinsic :: iso_c_binding
42 kim_length_unit_type, &
64 type, bind(c) :: kim_length_unit_type
70 integer(c_int) length_unit_id
71 end type kim_length_unit_type
78 type(kim_length_unit_type),
protected,
save, &
79 bind(c, name=
"KIM_LENGTH_UNIT_unused") &
87 type(kim_length_unit_type),
protected,
save, &
88 bind(c, name=
"KIM_LENGTH_UNIT_A") &
96 type(kim_length_unit_type),
protected,
save, &
97 bind(c, name=
"KIM_LENGTH_UNIT_Bohr") &
105 type(kim_length_unit_type),
protected,
save, &
106 bind(c, name=
"KIM_LENGTH_UNIT_cm") &
114 type(kim_length_unit_type),
protected,
save, &
115 bind(c, name=
"KIM_LENGTH_UNIT_m") &
123 type(kim_length_unit_type),
protected,
save, &
124 bind(c, name=
"KIM_LENGTH_UNIT_nm") &
133 module procedure kim_length_unit_known
134 end interface kim_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.)
160 interface kim_from_string
161 module procedure kim_length_unit_from_string
162 end interface kim_from_string
169 interface kim_to_string
170 module procedure kim_length_unit_to_string
171 end interface kim_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
185 import kim_length_unit_type
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
234 import kim_length_unit_type
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
257 import kim_length_unit_type
259 type(kim_length_unit_type),
intent(in),
value :: length_unit
260 end function get_string
262 type(kim_length_unit_type),
intent(in) :: length_unit
263 character(len=*, kind=c_char),
intent(out) :: string
267 p = get_string(length_unit)
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
302 import kim_length_unit_type
304 integer(c_int),
intent(in),
value :: index
305 type(kim_length_unit_type),
intent(out) :: length_unit
306 end function get_length_unit
308 integer(c_int),
intent(in) :: index
309 type(kim_length_unit_type),
intent(out) :: length_unit
310 integer(c_int),
intent(out) :: ierr
312 ierr = get_length_unit(index - 1, length_unit)
type(kim_length_unit_type), save, public, protected kim_length_unit_a
type(kim_length_unit_type), save, public, protected kim_length_unit_bohr
type(kim_length_unit_type), save, public, protected kim_length_unit_m
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, public, protected kim_length_unit_unused
An Extensible Enumeration for the LengthUnit's supported by the KIM API.
type(kim_length_unit_type), save, public, protected kim_length_unit_nm
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, public, protected kim_length_unit_cm