kim-api  2.2.1+v2.2.1.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 ! CDDL HEADER START
3 !
4 ! The contents of this file are subject to the terms of the Common Development
5 ! and Distribution License Version 1.0 (the "License").
6 !
7 ! You can obtain a copy of the license at
8 ! http://www.opensource.org/licenses/CDDL-1.0. See the License for the
9 ! specific language governing permissions and limitations under the License.
10 !
11 ! When distributing Covered Code, include this CDDL HEADER in each file and
12 ! include the License file in a prominent location with the name LICENSE.CDDL.
13 ! If applicable, add the following below this CDDL HEADER, with the fields
14 ! enclosed by brackets "[]" replaced with your own identifying information:
15 !
16 ! Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
17 !
18 ! CDDL HEADER END
19 !
20 
21 !
22 ! Copyright (c) 2016--2020, Regents of the University of Minnesota.
23 ! All rights reserved.
24 !
25 ! Contributors:
26 ! Ryan S. Elliott
27 !
28 
29 !
30 ! Release: This file is part of the kim-api-2.2.1 package.
31 !
32 
39  use, intrinsic :: iso_c_binding
40  implicit none
41  private
42 
43  public &
44  ! Derived types
45  kim_model_routine_name_type, &
46  ! Constants
55  ! Routines
56  kim_known, &
57  operator(.eq.), &
58  operator(.ne.), &
59  kim_from_string, &
60  kim_to_string, &
63 
69  type, bind(c) :: kim_model_routine_name_type
76  integer(c_int) model_routine_name_id
77  end type kim_model_routine_name_type
78 
84  type(kim_model_routine_name_type), protected, save, &
85  bind(c, name="KIM_MODEL_ROUTINE_NAME_Create") &
87 
94  type(kim_model_routine_name_type), protected, save, &
95  bind(c, name="KIM_MODEL_ROUTINE_NAME_ComputeArgumentsCreate") &
97 
103  type(kim_model_routine_name_type), protected, save, &
104  bind(c, name="KIM_MODEL_ROUTINE_NAME_Compute") &
106 
112  type(kim_model_routine_name_type), protected, save, &
113  bind(c, name="KIM_MODEL_ROUTINE_NAME_Extension") &
115 
121  type(kim_model_routine_name_type), protected, save, &
122  bind(c, name="KIM_MODEL_ROUTINE_NAME_Refresh") &
124 
131  type(kim_model_routine_name_type), protected, save, &
132  bind(c, name="KIM_MODEL_ROUTINE_NAME_WriteParameterizedModel") &
134 
141  type(kim_model_routine_name_type), protected, save, &
142  bind(c, name="KIM_MODEL_ROUTINE_NAME_ComputeArgumentsDestroy") &
144 
150  type(kim_model_routine_name_type), protected, save, &
151  bind(c, name="KIM_MODEL_ROUTINE_NAME_Destroy") &
153 
159  interface kim_known
160  module procedure kim_model_routine_name_known
161  end interface kim_known
162 
168  interface operator(.eq.)
169  module procedure kim_model_routine_name_equal
170  end interface operator(.eq.)
171 
177  interface operator(.ne.)
178  module procedure kim_model_routine_name_not_equal
179  end interface operator(.ne.)
180 
188  interface kim_from_string
189  module procedure kim_model_routine_name_from_string
190  end interface kim_from_string
191 
197  interface kim_to_string
198  module procedure kim_model_routine_name_to_string
199  end interface kim_to_string
200 
201 contains
207  logical recursive function kim_model_routine_name_known(model_routine_name)
208  implicit none
209  interface
210  integer(c_int) recursive function known(model_routine_name) &
211  bind(c, name="KIM_ModelRoutineName_Known")
212  use, intrinsic :: iso_c_binding
213  import kim_model_routine_name_type
214  implicit none
215  type(kim_model_routine_name_type), intent(in), value :: &
216  model_routine_name
217  end function known
218  end interface
219  type(kim_model_routine_name_type), intent(in) :: model_routine_name
220 
221  kim_model_routine_name_known = (known(model_routine_name) /= 0)
222  end function kim_model_routine_name_known
223 
229  logical recursive function kim_model_routine_name_equal(lhs, rhs)
230  implicit none
231  type(kim_model_routine_name_type), intent(in) :: lhs
232  type(kim_model_routine_name_type), intent(in) :: rhs
233 
234  kim_model_routine_name_equal &
235  = (lhs%model_routine_name_id == rhs%model_routine_name_id)
236  end function kim_model_routine_name_equal
237 
243  logical recursive function kim_model_routine_name_not_equal(lhs, rhs)
244  implicit none
245  type(kim_model_routine_name_type), intent(in) :: lhs
246  type(kim_model_routine_name_type), intent(in) :: rhs
247 
248  kim_model_routine_name_not_equal = .not. (lhs == rhs)
249  end function kim_model_routine_name_not_equal
250 
258  recursive subroutine kim_model_routine_name_from_string(string, &
259  model_routine_name)
260  implicit none
261  interface
262  type(kim_model_routine_name_type) recursive function from_string(string) &
263  bind(c, name="KIM_ModelRoutineName_FromString")
264  use, intrinsic :: iso_c_binding
265  import kim_model_routine_name_type
266  implicit none
267  character(c_char), intent(in) :: string(*)
268  end function from_string
269  end interface
270  character(len=*, kind=c_char), intent(in) :: string
271  type(kim_model_routine_name_type), intent(out) :: model_routine_name
272 
273  model_routine_name = from_string(trim(string)//c_null_char)
274  end subroutine kim_model_routine_name_from_string
275 
281  recursive subroutine kim_model_routine_name_to_string(model_routine_name, &
282  string)
283  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
284  implicit none
285  interface
286  type(c_ptr) recursive function get_string(model_routine_name) &
287  bind(c, name="KIM_ModelRoutineName_ToString")
288  use, intrinsic :: iso_c_binding
289  import kim_model_routine_name_type
290  implicit none
291  type(kim_model_routine_name_type), intent(in), value :: &
292  model_routine_name
293  end function get_string
294  end interface
295  type(kim_model_routine_name_type), intent(in) :: &
296  model_routine_name
297  character(len=*, kind=c_char), intent(out) :: string
298 
299  type(c_ptr) :: p
300 
301  p = get_string(model_routine_name)
302  call kim_convert_c_char_ptr_to_string(p, string)
303  end subroutine kim_model_routine_name_to_string
304 
311  recursive subroutine kim_get_number_of_model_routine_names( &
312  number_of_model_routine_names)
313  implicit none
314  interface
315  recursive subroutine get_number_of_model_routine_names( &
316  number_of_model_routine_names) &
317  bind(c, name="KIM_MODEL_ROUTINE_NAME_GetNumberOfModelRoutineNames")
318  use, intrinsic :: iso_c_binding
319  integer(c_int), intent(out) :: number_of_model_routine_names
320  end subroutine get_number_of_model_routine_names
321  end interface
322  integer(c_int), intent(out) :: number_of_model_routine_names
323 
324  call get_number_of_model_routine_names(number_of_model_routine_names)
326 
333  recursive subroutine kim_get_model_routine_name(index, &
334  model_routine_name, ierr)
335  implicit none
336  interface
337  integer(c_int) recursive function get_model_routine_name( &
338  index, model_routine_name) &
339  bind(c, name="KIM_MODEL_ROUTINE_NAME_GetModelRoutineName")
340  use, intrinsic :: iso_c_binding
341  import kim_model_routine_name_type
342  implicit none
343  integer(c_int), intent(in), value :: index
344  type(kim_model_routine_name_type), intent(out) :: &
345  model_routine_name
346  end function get_model_routine_name
347  end interface
348  integer(c_int), intent(in) :: index
349  type(kim_model_routine_name_type), intent(out) :: model_routine_name
350  integer(c_int), intent(out) :: ierr
351 
352  ierr = get_model_routine_name(index - 1, model_routine_name)
353  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