40 use,
intrinsic :: iso_c_binding
46 kim_collection_type, &
69 type, bind(c) :: kim_collection_type
75 integer(c_int) collection_id
76 end type kim_collection_type
83 type(kim_collection_type),
protected,
save, &
84 bind(c, name=
"KIM_COLLECTION_system") &
92 type(kim_collection_type),
protected,
save, &
93 bind(c, name=
"KIM_COLLECTION_user") &
102 type(kim_collection_type),
protected,
save, &
103 bind(c, name=
"KIM_COLLECTION_environmentVariable") &
112 type(kim_collection_type),
protected,
save, &
113 bind(c, name=
"KIM_COLLECTION_currentWorkingDirectory") &
122 module procedure kim_collection_known
123 end interface kim_known
130 interface operator (.eq.)
131 module procedure kim_collection_equal
132 end interface operator (.eq.)
139 interface operator (.ne.)
140 module procedure kim_collection_not_equal
141 end interface operator (.ne.)
149 interface kim_from_string
150 module procedure kim_collection_from_string
151 end interface kim_from_string
158 interface kim_to_string
159 module procedure kim_collection_to_string
160 end interface kim_to_string
168 logical recursive function kim_collection_known(collection)
171 integer(c_int) recursive function known(collection) &
172 bind(c, name=
"KIM_Collection_Known")
173 use,
intrinsic :: iso_c_binding
174 import kim_collection_type
176 type(kim_collection_type),
intent(in),
value :: collection
179 type(kim_collection_type),
intent(in) :: collection
181 kim_collection_known = (known(collection) /= 0)
182 end function kim_collection_known
189 logical recursive function kim_collection_equal(lhs, rhs)
191 type(kim_collection_type),
intent(in) :: lhs
192 type(kim_collection_type),
intent(in) :: rhs
194 kim_collection_equal &
195 = (lhs%collection_id .eq. rhs%collection_id)
196 end function kim_collection_equal
203 logical recursive function kim_collection_not_equal(lhs, rhs)
205 type(kim_collection_type),
intent(in) :: lhs
206 type(kim_collection_type),
intent(in) :: rhs
208 kim_collection_not_equal = .not. (lhs .eq. rhs)
209 end function kim_collection_not_equal
217 recursive subroutine kim_collection_from_string(string, collection)
220 type(kim_collection_type)
recursive function from_string(string) &
221 bind(c, name=
"KIM_Collection_FromString")
222 use,
intrinsic :: iso_c_binding
223 import kim_collection_type
225 character(c_char),
intent(in) :: string(*)
226 end function from_string
228 character(len=*, kind=c_char),
intent(in) :: string
229 type(kim_collection_type),
intent(out) :: collection
231 collection = from_string(trim(string)//c_null_char)
232 end subroutine kim_collection_from_string
239 recursive subroutine kim_collection_to_string(collection, string)
240 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
243 type(c_ptr)
recursive function get_string(collection) &
244 bind(c, name=
"KIM_Collection_ToString")
245 use,
intrinsic :: iso_c_binding
246 import kim_collection_type
248 type(kim_collection_type),
intent(in),
value :: collection
249 end function get_string
251 type(kim_collection_type),
intent(in) :: collection
252 character(len=*, kind=c_char),
intent(out) :: string
256 p = get_string(collection)
257 call kim_convert_c_char_ptr_to_string(p, string)
258 end subroutine kim_collection_to_string
269 recursive subroutine get_number_of_collections(number_of_collections) &
270 bind(c, name=
"KIM_COLLECTION_GetNumberOfCollections")
271 use,
intrinsic :: iso_c_binding
273 integer(c_int),
intent(out) :: number_of_collections
274 end subroutine get_number_of_collections
276 integer(c_int),
intent(out) :: number_of_collections
278 call get_number_of_collections(number_of_collections)
289 integer(c_int) recursive function get_collection(index, collection) &
290 bind(c, name=
"KIM_COLLECTION_GetCollection")
291 use,
intrinsic :: iso_c_binding
292 import kim_collection_type
294 integer(c_int),
intent(in),
value :: index
295 type(kim_collection_type),
intent(out) :: collection
296 end function get_collection
298 integer(c_int),
intent(in) :: index
299 type(kim_collection_type),
intent(out) :: collection
300 integer(c_int),
intent(out) :: ierr
302 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.