kim-api 2.3.0+AppleClang.AppleClang.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
Loading...
Searching...
No Matches
kim_collection_item_type_module.f90
Go to the documentation of this file.
1!
2! KIM-API: An API for interatomic models
3! Copyright (c) 2013--2022, Regents of the University of Minnesota.
4! All rights reserved.
5!
6! Contributors:
7! Ryan S. Elliott
8!
9! SPDX-License-Identifier: LGPL-2.1-or-later
10!
11! This library is free software; you can redistribute it and/or
12! modify it under the terms of the GNU Lesser General Public
13! License as published by the Free Software Foundation; either
14! version 2.1 of the License, or (at your option) any later version.
15!
16! This library is distributed in the hope that it will be useful,
17! but WITHOUT ANY WARRANTY; without even the implied warranty of
18! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19! Lesser General Public License for more details.
20!
21! You should have received a copy of the GNU Lesser General Public License
22! along with this library; if not, write to the Free Software Foundation,
23! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24!
25
26!
27! Release: This file is part of the kim-api-2.3.0 package.
28!
29
36 use, intrinsic :: iso_c_binding
37 implicit none
38 private
39
40 public &
41 ! Derived types
43 ! Constants
47 ! Routines
48 kim_known, &
49 operator(.eq.), &
50 operator(.ne.), &
55
61 type, bind(c) :: kim_collection_item_type_type
68 integer(c_int) collection_item_type_id
70
77 type(kim_collection_item_type_type), protected, save, &
78 bind(c, name="KIM_COLLECTION_ITEM_TYPE_modelDriver") &
80
87 type(kim_collection_item_type_type), protected, save, &
88 bind(c, name="KIM_COLLECTION_ITEM_TYPE_portableModel") &
90
97 type(kim_collection_item_type_type), protected, save, &
98 bind(c, name="KIM_COLLECTION_ITEM_TYPE_simulatorModel") &
100
106 interface kim_known
107 module procedure kim_collection_item_type_known
108 end interface kim_known
109
115 interface operator(.eq.)
116 module procedure kim_collection_item_type_equal
117 end interface operator(.eq.)
118
124 interface operator(.ne.)
125 module procedure kim_collection_item_type_not_equal
126 end interface operator(.ne.)
127
136 module procedure kim_collection_item_type_from_string
137 end interface kim_from_string
138
145 module procedure kim_collection_item_type_to_string
146 end interface kim_to_string
147
148contains
154 logical recursive function kim_collection_item_type_known( &
155 collection_item_type)
156 implicit none
157 interface
158 integer(c_int) recursive function known(collection_item_type) &
159 bind(c, name="KIM_CollectionItemType_Known")
160 use, intrinsic :: iso_c_binding
162 implicit none
163 type(kim_collection_item_type_type), intent(in), value :: &
164 collection_item_type
165 end function known
166 end interface
167 type(kim_collection_item_type_type), intent(in) :: collection_item_type
168
169 kim_collection_item_type_known = (known(collection_item_type) /= 0)
170 end function kim_collection_item_type_known
171
177 logical recursive function kim_collection_item_type_equal(lhs, rhs)
178 implicit none
179 type(kim_collection_item_type_type), intent(in) :: lhs
180 type(kim_collection_item_type_type), intent(in) :: rhs
181
182 kim_collection_item_type_equal &
183 = (lhs%collection_item_type_id == rhs%collection_item_type_id)
184 end function kim_collection_item_type_equal
185
191 logical recursive function kim_collection_item_type_not_equal(lhs, rhs)
192 implicit none
193 type(kim_collection_item_type_type), intent(in) :: lhs
194 type(kim_collection_item_type_type), intent(in) :: rhs
195
196 kim_collection_item_type_not_equal = .not. (lhs == rhs)
197 end function kim_collection_item_type_not_equal
198
206 recursive subroutine kim_collection_item_type_from_string( &
207 string, collection_item_type)
208 implicit none
209 interface
210 type(kim_collection_item_type_type) recursive function &
211 from_string(string) bind(c, name="KIM_CollectionItemType_FromString")
212 use, intrinsic :: iso_c_binding
214 implicit none
215 character(c_char), intent(in) :: string(*)
216 end function from_string
217 end interface
218 character(len=*, kind=c_char), intent(in) :: string
219 type(kim_collection_item_type_type), intent(out) :: collection_item_type
220
221 collection_item_type = from_string(trim(string)//c_null_char)
222 end subroutine kim_collection_item_type_from_string
223
229 recursive subroutine kim_collection_item_type_to_string( &
230 collection_item_type, string)
231 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
232 implicit none
233 interface
234 type(c_ptr) recursive function get_string(collection_item_type) &
235 bind(c, name="KIM_CollectionItemType_ToString")
236 use, intrinsic :: iso_c_binding
238 implicit none
239 type(kim_collection_item_type_type), intent(in), value :: &
240 collection_item_type
241 end function get_string
242 end interface
243 type(kim_collection_item_type_type), intent(in) :: collection_item_type
244 character(len=*, kind=c_char), intent(out) :: string
245
246 type(c_ptr) :: p
247
248 p = get_string(collection_item_type)
249 call kim_convert_c_char_ptr_to_string(p, string)
250 end subroutine kim_collection_item_type_to_string
251
259 number_of_collection_item_types)
260 implicit none
261 interface
262 recursive subroutine get_number_of_collection_item_types( &
263 number_of_collection_item_types) &
264 bind(c, name="KIM_COLLECTION_ITEM_TYPE_GetNumberOfCollectionItemTypes")
265 use, intrinsic :: iso_c_binding
266 implicit none
267 integer(c_int), intent(out) :: number_of_collection_item_types
268 end subroutine get_number_of_collection_item_types
269 end interface
270 integer(c_int), intent(out) :: number_of_collection_item_types
271
272 call get_number_of_collection_item_types(number_of_collection_item_types)
274
281 recursive subroutine kim_get_collection_item_type(index, &
282 collection_item_type, ierr)
283 implicit none
284 interface
285 integer(c_int) recursive function get_collection_item_type( &
286 index, collection_item_type) &
287 bind(c, name="KIM_COLLECTION_ITEM_TYPE_GetCollectionItemType")
288 use, intrinsic :: iso_c_binding
290 implicit none
291 integer(c_int), intent(in), value :: index
292 type(kim_collection_item_type_type), intent(out) :: collection_item_type
293 end function get_collection_item_type
294 end interface
295 integer(c_int), intent(in) :: index
296 type(kim_collection_item_type_type), intent(out) :: collection_item_type
297 integer(c_int), intent(out) :: ierr
298
299 ierr = get_collection_item_type(index - 1, collection_item_type)
300 end subroutine kim_get_collection_item_type
KIM::CollectionItemType::CollectionItemType(std::string const &)
Determines if the object is a quantity known to the KIM API.
An Extensible Enumeration for the CollectionItemType's supported by the KIM API.
type(kim_collection_item_type_type), save, bind(C, name="KIM_COLLECTION_ITEM_TYPE_simulatorModel"), public, protected kim_collection_item_type_simulator_model
The standard simulatorModel CollectionItemType.
recursive subroutine, public kim_get_number_of_collection_item_types(number_of_collection_item_types)
Get the number of standard CollectionItemType's defined by the KIM API.
recursive subroutine, public kim_get_collection_item_type(index, collection_item_type, ierr)
Get the identity of each defined standard CollectionItemType.
type(kim_collection_item_type_type), save, bind(C, name="KIM_COLLECTION_ITEM_TYPE_modelDriver"), public, protected kim_collection_item_type_model_driver
The standard modelDriver CollectionItemType.
type(kim_collection_item_type_type), save, bind(C, name="KIM_COLLECTION_ITEM_TYPE_portableModel"), public, protected kim_collection_item_type_portable_model
The standard portableModel CollectionItemType.
An Extensible Enumeration for the CollectionItemType's supported by the KIM API.