kim-api  2.3.0+v2.3.0.GNU.GNU.
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
kim_compute_callback_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_compute_callback_name_type, &
43  ! Constants
47  ! Routines
48  kim_known, &
49  operator(.eq.), &
50  operator(.ne.), &
51  kim_from_string, &
52  kim_to_string, &
55 
61  type, bind(c) :: kim_compute_callback_name_type
68  integer(c_int) compute_callback_name_id
69  end type kim_compute_callback_name_type
70 
77  type(kim_compute_callback_name_type), protected, save, &
78  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_GetNeighborList") &
80 
87  type(kim_compute_callback_name_type), protected, save, &
88  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_ProcessDEDrTerm") &
90 
97  type(kim_compute_callback_name_type), protected, save, &
98  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_ProcessD2EDr2Term") &
100 
106  interface kim_known
107  module procedure kim_compute_callback_name_known
108  end interface kim_known
109 
115  interface operator(.eq.)
116  module procedure kim_compute_callback_name_equal
117  end interface operator(.eq.)
118 
125  interface operator(.ne.)
126  module procedure kim_compute_callback_name_not_equal
127  end interface operator(.ne.)
128 
136  interface kim_from_string
137  module procedure kim_compute_callback_name_from_string
138  end interface kim_from_string
139 
145  interface kim_to_string
146  module procedure kim_compute_callback_name_to_string
147  end interface kim_to_string
148 
149 contains
155  logical recursive function kim_compute_callback_name_known( &
156  compute_callback_name)
157  implicit none
158  interface
159  integer(c_int) recursive function known(compute_callback_name) &
160  bind(c, name="KIM_ComputeCallbackName_Known")
161  use, intrinsic :: iso_c_binding
162  import kim_compute_callback_name_type
163  implicit none
164  type(kim_compute_callback_name_type), intent(in), value :: &
165  compute_callback_name
166  end function known
167  end interface
168  type(kim_compute_callback_name_type), intent(in) :: compute_callback_name
169 
170  kim_compute_callback_name_known = (known(compute_callback_name) /= 0)
171  end function kim_compute_callback_name_known
172 
178  logical recursive function kim_compute_callback_name_equal(lhs, rhs)
179  implicit none
180  type(kim_compute_callback_name_type), intent(in) :: lhs
181  type(kim_compute_callback_name_type), intent(in) :: rhs
182 
183  kim_compute_callback_name_equal &
184  = (lhs%compute_callback_name_id == rhs%compute_callback_name_id)
185  end function kim_compute_callback_name_equal
186 
193  logical recursive function kim_compute_callback_name_not_equal(lhs, rhs)
194  implicit none
195  type(kim_compute_callback_name_type), intent(in) :: lhs
196  type(kim_compute_callback_name_type), intent(in) :: rhs
197 
198  kim_compute_callback_name_not_equal = .not. (lhs == rhs)
199  end function kim_compute_callback_name_not_equal
200 
208  recursive subroutine kim_compute_callback_name_from_string( &
209  string, compute_callback_name)
210  implicit none
211  interface
212  type(kim_compute_callback_name_type) recursive function from_string( &
213  string) bind(c, name="KIM_ComputeCallbackName_FromString")
214  use, intrinsic :: iso_c_binding
215  import kim_compute_callback_name_type
216  implicit none
217  character(c_char), intent(in) :: string(*)
218  end function from_string
219  end interface
220  character(len=*, kind=c_char), intent(in) :: string
221  type(kim_compute_callback_name_type), intent(out) :: compute_callback_name
222 
223  compute_callback_name = from_string(trim(string)//c_null_char)
224  end subroutine kim_compute_callback_name_from_string
225 
231  recursive subroutine kim_compute_callback_name_to_string( &
232  compute_callback_name, string)
233  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
234  implicit none
235  interface
236  type(c_ptr) recursive function get_string(compute_callback_name) &
237  bind(c, name="KIM_ComputeCallbackName_ToString")
238  use, intrinsic :: iso_c_binding
239  import kim_compute_callback_name_type
240  implicit none
241  type(kim_compute_callback_name_type), intent(in), value :: &
242  compute_callback_name
243  end function get_string
244  end interface
245  type(kim_compute_callback_name_type), intent(in) :: &
246  compute_callback_name
247  character(len=*, kind=c_char), intent(out) :: string
248 
249  type(c_ptr) :: p
250 
251  p = get_string(compute_callback_name)
252  call kim_convert_c_char_ptr_to_string(p, string)
253  end subroutine kim_compute_callback_name_to_string
254 
262  recursive subroutine kim_get_number_of_compute_callback_names( &
263  number_of_compute_callback_names)
264  implicit none
265  interface
266  recursive subroutine get_number_of_compute_callback_names( &
267  number_of_compute_callback_names) &
268  bind(c, &
269  name="KIM_COMPUTE_CALLBACK_NAME_GetNumberOfComputeCallbackNames")
270  use, intrinsic :: iso_c_binding
271  integer(c_int), intent(out) :: number_of_compute_callback_names
272  end subroutine get_number_of_compute_callback_names
273  end interface
274  integer(c_int), intent(out) :: number_of_compute_callback_names
275 
276  call get_number_of_compute_callback_names(number_of_compute_callback_names)
278 
285  recursive subroutine kim_get_compute_callback_name(index, &
286  compute_callback_name, &
287  ierr)
288  implicit none
289  interface
290  integer(c_int) recursive function get_compute_callback_name( &
291  index, compute_callback_name) &
292  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_GetComputeCallbackName")
293  use, intrinsic :: iso_c_binding
294  import kim_compute_callback_name_type
295  implicit none
296  integer(c_int), intent(in), value :: index
297  type(kim_compute_callback_name_type), intent(out) :: &
298  compute_callback_name
299  end function get_compute_callback_name
300  end interface
301  integer(c_int), intent(in) :: index
302  type(kim_compute_callback_name_type), intent(out) :: compute_callback_name
303  integer(c_int), intent(out) :: ierr
304 
305  ierr = get_compute_callback_name(index - 1, compute_callback_name)
306  end subroutine kim_get_compute_callback_name
type(kim_compute_callback_name_type), save, public, protected kim_compute_callback_name_process_d2edr2_term
recursive subroutine, public kim_get_compute_callback_name(index, compute_callback_name, ierr)
Get the identity of each defined standard ComputeCallbackName.
type(kim_compute_callback_name_type), save, public, protected kim_compute_callback_name_get_neighbor_list
type(kim_compute_callback_name_type), save, public, protected kim_compute_callback_name_process_dedr_term
recursive subroutine, public kim_get_number_of_compute_callback_names(number_of_compute_callback_names)
Get the number of standard ComputeCallbackName's defined by the KIM API.
An Extensible Enumeration for the ComputeCallbackName's supported by the KIM API. ...