36 use,
intrinsic :: iso_c_binding
42 kim_collection_type, &
62 type, bind(c) :: kim_collection_type
68 integer(c_int) collection_id
69 end type kim_collection_type
76 type(kim_collection_type),
protected,
save, &
77 bind(c, name=
"KIM_COLLECTION_system") &
85 type(kim_collection_type),
protected,
save, &
86 bind(c, name=
"KIM_COLLECTION_user") &
95 type(kim_collection_type),
protected,
save, &
96 bind(c, name=
"KIM_COLLECTION_environmentVariable") &
105 type(kim_collection_type),
protected,
save, &
106 bind(c, name=
"KIM_COLLECTION_currentWorkingDirectory") &
115 module procedure kim_collection_known
116 end interface kim_known
123 interface operator(.eq.)
124 module procedure kim_collection_equal
125 end interface operator(.eq.)
132 interface operator(.ne.)
133 module procedure kim_collection_not_equal
134 end interface operator(.ne.)
142 interface kim_from_string
143 module procedure kim_collection_from_string
144 end interface kim_from_string
151 interface kim_to_string
152 module procedure kim_collection_to_string
153 end interface kim_to_string
161 logical recursive function kim_collection_known(collection)
164 integer(c_int) recursive function known(collection) &
165 bind(c, name=
"KIM_Collection_Known")
166 use,
intrinsic :: iso_c_binding
167 import kim_collection_type
169 type(kim_collection_type),
intent(in),
value :: collection
172 type(kim_collection_type),
intent(in) :: collection
174 kim_collection_known = (known(collection) /= 0)
175 end function kim_collection_known
182 logical recursive function kim_collection_equal(lhs, rhs)
184 type(kim_collection_type),
intent(in) :: lhs
185 type(kim_collection_type),
intent(in) :: rhs
187 kim_collection_equal &
188 = (lhs%collection_id == rhs%collection_id)
189 end function kim_collection_equal
196 logical recursive function kim_collection_not_equal(lhs, rhs)
198 type(kim_collection_type),
intent(in) :: lhs
199 type(kim_collection_type),
intent(in) :: rhs
201 kim_collection_not_equal = .not. (lhs == rhs)
202 end function kim_collection_not_equal
210 recursive subroutine kim_collection_from_string(string, collection)
213 type(kim_collection_type)
recursive function from_string(string) &
214 bind(c, name=
"KIM_Collection_FromString")
215 use,
intrinsic :: iso_c_binding
216 import kim_collection_type
218 character(c_char),
intent(in) :: string(*)
219 end function from_string
221 character(len=*, kind=c_char),
intent(in) :: string
222 type(kim_collection_type),
intent(out) :: collection
224 collection = from_string(trim(string)//c_null_char)
225 end subroutine kim_collection_from_string
232 recursive subroutine kim_collection_to_string(collection, string)
233 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
236 type(c_ptr)
recursive function get_string(collection) &
237 bind(c, name=
"KIM_Collection_ToString")
238 use,
intrinsic :: iso_c_binding
239 import kim_collection_type
241 type(kim_collection_type),
intent(in),
value :: collection
242 end function get_string
244 type(kim_collection_type),
intent(in) :: collection
245 character(len=*, kind=c_char),
intent(out) :: string
249 p = get_string(collection)
250 call kim_convert_c_char_ptr_to_string(p, string)
251 end subroutine kim_collection_to_string
262 recursive subroutine get_number_of_collections(number_of_collections) &
263 bind(c, name=
"KIM_COLLECTION_GetNumberOfCollections")
264 use,
intrinsic :: iso_c_binding
266 integer(c_int),
intent(out) :: number_of_collections
267 end subroutine get_number_of_collections
269 integer(c_int),
intent(out) :: number_of_collections
271 call get_number_of_collections(number_of_collections)
282 integer(c_int) recursive function get_collection(index, collection) &
283 bind(c, name=
"KIM_COLLECTION_GetCollection")
284 use,
intrinsic :: iso_c_binding
285 import kim_collection_type
287 integer(c_int),
intent(in),
value :: index
288 type(kim_collection_type),
intent(out) :: collection
289 end function get_collection
291 integer(c_int),
intent(in) :: index
292 type(kim_collection_type),
intent(out) :: collection
293 integer(c_int),
intent(out) :: ierr
295 ierr = get_collection(index - 1, collection)
type(kim_collection_type), save, public, protected kim_collection_user
type(kim_collection_type), save, public, protected kim_collection_environment_variable
recursive subroutine, public kim_get_number_of_collections(number_of_collections)
Get the number of standard Collection's defined by the KIM API.
type(kim_collection_type), save, public, protected kim_collection_system
recursive subroutine, public kim_get_collection(index, collection, ierr)
Get the identity of each defined standard Collection.
type(kim_collection_type), save, public, protected kim_collection_current_working_directory
An Extensible Enumeration for the Collection's supported by the KIM API.