40 use,
intrinsic :: iso_c_binding
46 kim_length_unit_type, &
71 type, bind(c) :: kim_length_unit_type
77 integer(c_int) length_unit_id
78 end type kim_length_unit_type
85 type(kim_length_unit_type),
protected,
save, &
86 bind(c, name=
"KIM_LENGTH_UNIT_unused") &
94 type(kim_length_unit_type),
protected,
save, &
95 bind(c, name=
"KIM_LENGTH_UNIT_A") &
103 type(kim_length_unit_type),
protected,
save, &
104 bind(c, name=
"KIM_LENGTH_UNIT_Bhor") &
112 type(kim_length_unit_type),
protected,
save, &
113 bind(c, name=
"KIM_LENGTH_UNIT_cm") &
121 type(kim_length_unit_type),
protected,
save, &
122 bind(c, name=
"KIM_LENGTH_UNIT_m") &
130 type(kim_length_unit_type),
protected,
save, &
131 bind(c, name=
"KIM_LENGTH_UNIT_nm") &
140 module procedure kim_length_unit_known
141 end interface kim_known
148 interface operator (.eq.)
149 module procedure kim_length_unit_equal
150 end interface operator (.eq.)
157 interface operator (.ne.)
158 module procedure kim_length_unit_not_equal
159 end interface operator (.ne.)
167 interface kim_from_string
168 module procedure kim_length_unit_from_string
169 end interface kim_from_string
176 interface kim_to_string
177 module procedure kim_length_unit_to_string
178 end interface kim_to_string
186 logical recursive function kim_length_unit_known(length_unit)
189 integer(c_int) recursive function known(length_unit) &
190 bind(c, name=
"KIM_LengthUnit_Known")
191 use,
intrinsic :: iso_c_binding
192 import kim_length_unit_type
194 type(kim_length_unit_type),
intent(in),
value :: length_unit
197 type(kim_length_unit_type),
intent(in) :: length_unit
199 kim_length_unit_known = (known(length_unit) /= 0)
200 end function kim_length_unit_known
207 logical recursive function kim_length_unit_equal(lhs, rhs)
209 type(kim_length_unit_type),
intent(in) :: lhs
210 type(kim_length_unit_type),
intent(in) :: rhs
212 kim_length_unit_equal &
213 = (lhs%length_unit_id .eq. rhs%length_unit_id)
214 end function kim_length_unit_equal
221 logical recursive function kim_length_unit_not_equal(lhs, rhs)
223 type(kim_length_unit_type),
intent(in) :: lhs
224 type(kim_length_unit_type),
intent(in) :: rhs
226 kim_length_unit_not_equal = .not. (lhs .eq. rhs)
227 end function kim_length_unit_not_equal
235 recursive subroutine kim_length_unit_from_string(string, length_unit)
238 type(kim_length_unit_type)
recursive function from_string(string) &
239 bind(c, name=
"KIM_LengthUnit_FromString")
240 use,
intrinsic :: iso_c_binding
241 import kim_length_unit_type
243 character(c_char),
intent(in) :: string(*)
244 end function from_string
246 character(len=*, kind=c_char),
intent(in) :: string
247 type(kim_length_unit_type),
intent(out) :: length_unit
249 length_unit = from_string(trim(string)//c_null_char)
250 end subroutine kim_length_unit_from_string
257 recursive subroutine kim_length_unit_to_string(length_unit, string)
258 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
261 type(c_ptr)
recursive function get_string(length_unit) &
262 bind(c, name=
"KIM_LengthUnit_ToString")
263 use,
intrinsic :: iso_c_binding
264 import kim_length_unit_type
266 type(kim_length_unit_type),
intent(in),
value :: length_unit
267 end function get_string
269 type(kim_length_unit_type),
intent(in) :: length_unit
270 character(len=*, kind=c_char),
intent(out) :: string
274 p = get_string(length_unit)
275 call kim_convert_c_char_ptr_to_string(p, string)
276 end subroutine kim_length_unit_to_string
287 recursive subroutine get_number_of_length_units(number_of_length_units) &
288 bind(c, name=
"KIM_LENGTH_UNIT_GetNumberOfLengthUnits")
289 use,
intrinsic :: iso_c_binding
290 integer(c_int),
intent(out) :: number_of_length_units
291 end subroutine get_number_of_length_units
293 integer(c_int),
intent(out) :: number_of_length_units
295 call get_number_of_length_units(number_of_length_units)
306 integer(c_int) recursive function get_length_unit(index, length_unit) &
307 bind(c, name=
"KIM_LENGTH_UNIT_GetLengthUnit")
308 use,
intrinsic :: iso_c_binding
309 import kim_length_unit_type
311 integer(c_int),
intent(in),
value :: index
312 type(kim_length_unit_type),
intent(out) :: length_unit
313 end function get_length_unit
315 integer(c_int),
intent(in) :: index
316 type(kim_length_unit_type),
intent(out) :: length_unit
317 integer(c_int),
intent(out) :: ierr
319 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