kim-api 2.4.1+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.4.1 package.
28!
29
30!> \brief \copybrief KIM::CollectionItemType
31!!
32!! \sa KIM::CollectionItemType, KIM_CollectionItemType
33!!
34!! \since 2.1
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
56 !> \brief \copybrief KIM::CollectionItemType
57 !!
58 !! \sa KIM::CollectionItemType, KIM_CollectionItemType
59 !!
60 !! \since 2.1
61 type, bind(c) :: kim_collection_item_type_type
62 !> \brief \copybrief KIM::CollectionItemType::collectionItemTypeID
63 !!
64 !! \sa KIM::CollectionItemType::collectionItemTypeID,
65 !! KIM_CollectionItemType::collectionItemTypeID
66 !!
67 !! \since 2.1
68 integer(c_int) collection_item_type_id
70
71 !> \brief \copybrief KIM::COLLECTION_ITEM_TYPE::modelDriver
72 !!
73 !! \sa KIM::COLLECTION_ITEM_TYPE::modelDriver,
74 !! KIM_COLLECTION_ITEM_TYPE_modelDriver
75 !!
76 !! \since 2.1
77 type(kim_collection_item_type_type), protected, save, &
78 bind(c, name="KIM_COLLECTION_ITEM_TYPE_modelDriver") &
80
81 !> \brief \copybrief KIM::COLLECTION_ITEM_TYPE::portableModel
82 !!
83 !! \sa KIM::COLLECTION_ITEM_TYPE::portableModel,
84 !! KIM_COLLECTION_ITEM_TYPE_portableModel
85 !!
86 !! \since 2.1
87 type(kim_collection_item_type_type), protected, save, &
88 bind(c, name="KIM_COLLECTION_ITEM_TYPE_portableModel") &
90
91 !> \brief \copybrief KIM::COLLECTION_ITEM_TYPE::simulatorModel
92 !!
93 !! \sa KIM::COLLECTION_ITEM_TYPE::simulatorModel,
94 !! KIM_COLLECTION_ITEM_TYPE_simulatorModel
95 !!
96 !! \since 2.1
97 type(kim_collection_item_type_type), protected, save, &
98 bind(c, name="KIM_COLLECTION_ITEM_TYPE_simulatorModel") &
100
101 !> \brief \copybrief KIM::CollectionItemType::Known
102 !!
103 !! \sa KIM::CollectionItemType::Known, KIM_CollectionItemType_Known
104 !!
105 !! \since 2.1
106 interface kim_known
107 module procedure kim_collection_item_type_known
108 end interface kim_known
109
110 !> \brief \copybrief KIM::CollectionItemType::operator==()
111 !!
112 !! \sa KIM::CollectionItemType::operator==(), KIM_CollectionItemType_Equal
113 !!
114 !! \since 2.1
115 interface operator(.eq.)
116 module procedure kim_collection_item_type_equal
117 end interface operator(.eq.)
118
119 !> \brief \copybrief KIM::CollectionItemType::operator!=()
120 !!
121 !! \sa KIM::CollectionItemType::operator!=(), KIM_CollectionItemType_NotEqual
122 !!
123 !! \since 2.1
124 interface operator(.ne.)
125 module procedure kim_collection_item_type_not_equal
126 end interface operator(.ne.)
127
128 !> \brief \copybrief <!--
129 !! -->KIM::CollectionItemType::CollectionItemType(std::string const &)
130 !!
131 !! \sa KIM::CollectionItemType::CollectionItemType(std::string const &),
132 !! KIM_CollectionItemType_FromString
133 !!
134 !! \since 2.1
136 module procedure kim_collection_item_type_from_string
137 end interface kim_from_string
138
139 !> \brief \copybrief KIM::CollectionItemType::ToString
140 !!
141 !! \sa KIM::CollectionItemType::ToString, KIM_CollectionItemType_ToString
142 !!
143 !! \since 2.1
145 module procedure kim_collection_item_type_to_string
146 end interface kim_to_string
147
148contains
149 !> \brief \copybrief KIM::CollectionItemType::Known
150 !!
151 !! \sa KIM::CollectionItemType::Known, KIM_CollectionItemType_Known
152 !!
153 !! \since 2.1
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
172 !> \brief \copybrief KIM::CollectionItemType::operator==()
173 !!
174 !! \sa KIM::CollectionItemType::operator==(), KIM_CollectionItemType_Equal
175 !!
176 !! \since 2.1
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
186 !> \brief \copybrief KIM::CollectionItemType::operator!=()
187 !!
188 !! \sa KIM::CollectionItemType::operator!=(), KIM_CollectionItemType_NotEqual
189 !!
190 !! \since 2.1
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
199 !> \brief \copybrief <!--
200 !! -->KIM::CollectionItemType::CollectionItemType(std::string const &)
201 !!
202 !! \sa KIM::CollectionItemType::CollectionItemType(std::string const &),
203 !! KIM_CollectionItemType_FromString
204 !!
205 !! \since 2.1
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
224 !> \brief \copybrief KIM::CollectionItemType::ToString
225 !!
226 !! \sa KIM::CollectionItemType::ToString, KIM_CollectionItemType_ToString
227 !!
228 !! \since 2.1
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
252 !> \brief \copybrief KIM::COLLECTION_ITEM_TYPE::GetNumberOfCollectionItemTypes
253 !!
254 !! \sa KIM::COLLECTION_ITEM_TYPE::GetNumberOfCollectionItemTypes,
255 !! KIM_COLLECTION_ITEM_TYPE_GetNumberOfCollectionItemTypes
256 !!
257 !! \since 2.1
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
275 !> \brief \copybrief KIM::COLLECTION_ITEM_TYPE::GetCollectionItemType
276 !!
277 !! \sa KIM::COLLECTION_ITEM_TYPE::GetCollectionItemType,
278 !! KIM_COLLECTION_ITEM_TYPE_GetCollectionItemType
279 !!
280 !! \since 2.1
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.