kim-api  2.3.0+v2.3.0.GNU.GNU.
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
kim_model_routine_name_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
42  kim_model_routine_name_type, &
43  ! Constants
52  ! Routines
53  kim_known, &
54  operator(.eq.), &
55  operator(.ne.), &
56  kim_from_string, &
57  kim_to_string, &
60 
66  type, bind(c) :: kim_model_routine_name_type
73  integer(c_int) model_routine_name_id
74  end type kim_model_routine_name_type
75 
81  type(kim_model_routine_name_type), protected, save, &
82  bind(c, name="KIM_MODEL_ROUTINE_NAME_Create") &
84 
91  type(kim_model_routine_name_type), protected, save, &
92  bind(c, name="KIM_MODEL_ROUTINE_NAME_ComputeArgumentsCreate") &
94 
100  type(kim_model_routine_name_type), protected, save, &
101  bind(c, name="KIM_MODEL_ROUTINE_NAME_Compute") &
103 
109  type(kim_model_routine_name_type), protected, save, &
110  bind(c, name="KIM_MODEL_ROUTINE_NAME_Extension") &
112 
118  type(kim_model_routine_name_type), protected, save, &
119  bind(c, name="KIM_MODEL_ROUTINE_NAME_Refresh") &
121 
128  type(kim_model_routine_name_type), protected, save, &
129  bind(c, name="KIM_MODEL_ROUTINE_NAME_WriteParameterizedModel") &
131 
138  type(kim_model_routine_name_type), protected, save, &
139  bind(c, name="KIM_MODEL_ROUTINE_NAME_ComputeArgumentsDestroy") &
141 
147  type(kim_model_routine_name_type), protected, save, &
148  bind(c, name="KIM_MODEL_ROUTINE_NAME_Destroy") &
150 
156  interface kim_known
157  module procedure kim_model_routine_name_known
158  end interface kim_known
159 
165  interface operator(.eq.)
166  module procedure kim_model_routine_name_equal
167  end interface operator(.eq.)
168 
174  interface operator(.ne.)
175  module procedure kim_model_routine_name_not_equal
176  end interface operator(.ne.)
177 
185  interface kim_from_string
186  module procedure kim_model_routine_name_from_string
187  end interface kim_from_string
188 
194  interface kim_to_string
195  module procedure kim_model_routine_name_to_string
196  end interface kim_to_string
197 
198 contains
204  logical recursive function kim_model_routine_name_known(model_routine_name)
205  implicit none
206  interface
207  integer(c_int) recursive function known(model_routine_name) &
208  bind(c, name="KIM_ModelRoutineName_Known")
209  use, intrinsic :: iso_c_binding
210  import kim_model_routine_name_type
211  implicit none
212  type(kim_model_routine_name_type), intent(in), value :: &
213  model_routine_name
214  end function known
215  end interface
216  type(kim_model_routine_name_type), intent(in) :: model_routine_name
217 
218  kim_model_routine_name_known = (known(model_routine_name) /= 0)
219  end function kim_model_routine_name_known
220 
226  logical recursive function kim_model_routine_name_equal(lhs, rhs)
227  implicit none
228  type(kim_model_routine_name_type), intent(in) :: lhs
229  type(kim_model_routine_name_type), intent(in) :: rhs
230 
231  kim_model_routine_name_equal &
232  = (lhs%model_routine_name_id == rhs%model_routine_name_id)
233  end function kim_model_routine_name_equal
234 
240  logical recursive function kim_model_routine_name_not_equal(lhs, rhs)
241  implicit none
242  type(kim_model_routine_name_type), intent(in) :: lhs
243  type(kim_model_routine_name_type), intent(in) :: rhs
244 
245  kim_model_routine_name_not_equal = .not. (lhs == rhs)
246  end function kim_model_routine_name_not_equal
247 
255  recursive subroutine kim_model_routine_name_from_string(string, &
256  model_routine_name)
257  implicit none
258  interface
259  type(kim_model_routine_name_type) recursive function from_string(string) &
260  bind(c, name="KIM_ModelRoutineName_FromString")
261  use, intrinsic :: iso_c_binding
262  import kim_model_routine_name_type
263  implicit none
264  character(c_char), intent(in) :: string(*)
265  end function from_string
266  end interface
267  character(len=*, kind=c_char), intent(in) :: string
268  type(kim_model_routine_name_type), intent(out) :: model_routine_name
269 
270  model_routine_name = from_string(trim(string)//c_null_char)
271  end subroutine kim_model_routine_name_from_string
272 
278  recursive subroutine kim_model_routine_name_to_string(model_routine_name, &
279  string)
280  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
281  implicit none
282  interface
283  type(c_ptr) recursive function get_string(model_routine_name) &
284  bind(c, name="KIM_ModelRoutineName_ToString")
285  use, intrinsic :: iso_c_binding
286  import kim_model_routine_name_type
287  implicit none
288  type(kim_model_routine_name_type), intent(in), value :: &
289  model_routine_name
290  end function get_string
291  end interface
292  type(kim_model_routine_name_type), intent(in) :: &
293  model_routine_name
294  character(len=*, kind=c_char), intent(out) :: string
295 
296  type(c_ptr) :: p
297 
298  p = get_string(model_routine_name)
299  call kim_convert_c_char_ptr_to_string(p, string)
300  end subroutine kim_model_routine_name_to_string
301 
308  recursive subroutine kim_get_number_of_model_routine_names( &
309  number_of_model_routine_names)
310  implicit none
311  interface
312  recursive subroutine get_number_of_model_routine_names( &
313  number_of_model_routine_names) &
314  bind(c, name="KIM_MODEL_ROUTINE_NAME_GetNumberOfModelRoutineNames")
315  use, intrinsic :: iso_c_binding
316  integer(c_int), intent(out) :: number_of_model_routine_names
317  end subroutine get_number_of_model_routine_names
318  end interface
319  integer(c_int), intent(out) :: number_of_model_routine_names
320 
321  call get_number_of_model_routine_names(number_of_model_routine_names)
323 
330  recursive subroutine kim_get_model_routine_name(index, &
331  model_routine_name, ierr)
332  implicit none
333  interface
334  integer(c_int) recursive function get_model_routine_name( &
335  index, model_routine_name) &
336  bind(c, name="KIM_MODEL_ROUTINE_NAME_GetModelRoutineName")
337  use, intrinsic :: iso_c_binding
338  import kim_model_routine_name_type
339  implicit none
340  integer(c_int), intent(in), value :: index
341  type(kim_model_routine_name_type), intent(out) :: &
342  model_routine_name
343  end function get_model_routine_name
344  end interface
345  integer(c_int), intent(in) :: index
346  type(kim_model_routine_name_type), intent(out) :: model_routine_name
347  integer(c_int), intent(out) :: ierr
348 
349  ierr = get_model_routine_name(index - 1, model_routine_name)
350  end subroutine kim_get_model_routine_name
recursive subroutine, public kim_get_number_of_model_routine_names(number_of_model_routine_names)
Get the number of standard ModelRoutineName's defined by the KIM API.
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_compute_arguments_create
An Extensible Enumeration for the ModelRoutineName's supported by the KIM API.
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_compute
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_refresh
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_destroy
recursive subroutine, public kim_get_model_routine_name(index, model_routine_name, ierr)
Get the identity of each defined standard ModelRoutineName.
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_compute_arguments_destroy
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_extension
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_create
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_write_parameterized_model