kim-api  2.2.1+v2.2.1.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 ! 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_compute_callback_name_type, &
46  ! Constants
50  ! Routines
51  kim_known, &
52  operator(.eq.), &
53  operator(.ne.), &
54  kim_from_string, &
55  kim_to_string, &
58 
64  type, bind(c) :: kim_compute_callback_name_type
71  integer(c_int) compute_callback_name_id
72  end type kim_compute_callback_name_type
73 
80  type(kim_compute_callback_name_type), protected, save, &
81  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_GetNeighborList") &
83 
90  type(kim_compute_callback_name_type), protected, save, &
91  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_ProcessDEDrTerm") &
93 
100  type(kim_compute_callback_name_type), protected, save, &
101  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_ProcessD2EDr2Term") &
103 
109  interface kim_known
110  module procedure kim_compute_callback_name_known
111  end interface kim_known
112 
118  interface operator(.eq.)
119  module procedure kim_compute_callback_name_equal
120  end interface operator(.eq.)
121 
128  interface operator(.ne.)
129  module procedure kim_compute_callback_name_not_equal
130  end interface operator(.ne.)
131 
139  interface kim_from_string
140  module procedure kim_compute_callback_name_from_string
141  end interface kim_from_string
142 
148  interface kim_to_string
149  module procedure kim_compute_callback_name_to_string
150  end interface kim_to_string
151 
152 contains
158  logical recursive function kim_compute_callback_name_known( &
159  compute_callback_name)
160  implicit none
161  interface
162  integer(c_int) recursive function known(compute_callback_name) &
163  bind(c, name="KIM_ComputeCallbackName_Known")
164  use, intrinsic :: iso_c_binding
165  import kim_compute_callback_name_type
166  implicit none
167  type(kim_compute_callback_name_type), intent(in), value :: &
168  compute_callback_name
169  end function known
170  end interface
171  type(kim_compute_callback_name_type), intent(in) :: compute_callback_name
172 
173  kim_compute_callback_name_known = (known(compute_callback_name) /= 0)
174  end function kim_compute_callback_name_known
175 
181  logical recursive function kim_compute_callback_name_equal(lhs, rhs)
182  implicit none
183  type(kim_compute_callback_name_type), intent(in) :: lhs
184  type(kim_compute_callback_name_type), intent(in) :: rhs
185 
186  kim_compute_callback_name_equal &
187  = (lhs%compute_callback_name_id == rhs%compute_callback_name_id)
188  end function kim_compute_callback_name_equal
189 
196  logical recursive function kim_compute_callback_name_not_equal(lhs, rhs)
197  implicit none
198  type(kim_compute_callback_name_type), intent(in) :: lhs
199  type(kim_compute_callback_name_type), intent(in) :: rhs
200 
201  kim_compute_callback_name_not_equal = .not. (lhs == rhs)
202  end function kim_compute_callback_name_not_equal
203 
211  recursive subroutine kim_compute_callback_name_from_string( &
212  string, compute_callback_name)
213  implicit none
214  interface
215  type(kim_compute_callback_name_type) recursive function from_string( &
216  string) bind(c, name="KIM_ComputeCallbackName_FromString")
217  use, intrinsic :: iso_c_binding
218  import kim_compute_callback_name_type
219  implicit none
220  character(c_char), intent(in) :: string(*)
221  end function from_string
222  end interface
223  character(len=*, kind=c_char), intent(in) :: string
224  type(kim_compute_callback_name_type), intent(out) :: compute_callback_name
225 
226  compute_callback_name = from_string(trim(string)//c_null_char)
227  end subroutine kim_compute_callback_name_from_string
228 
234  recursive subroutine kim_compute_callback_name_to_string( &
235  compute_callback_name, string)
236  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
237  implicit none
238  interface
239  type(c_ptr) recursive function get_string(compute_callback_name) &
240  bind(c, name="KIM_ComputeCallbackName_ToString")
241  use, intrinsic :: iso_c_binding
242  import kim_compute_callback_name_type
243  implicit none
244  type(kim_compute_callback_name_type), intent(in), value :: &
245  compute_callback_name
246  end function get_string
247  end interface
248  type(kim_compute_callback_name_type), intent(in) :: &
249  compute_callback_name
250  character(len=*, kind=c_char), intent(out) :: string
251 
252  type(c_ptr) :: p
253 
254  p = get_string(compute_callback_name)
255  call kim_convert_c_char_ptr_to_string(p, string)
256  end subroutine kim_compute_callback_name_to_string
257 
265  recursive subroutine kim_get_number_of_compute_callback_names( &
266  number_of_compute_callback_names)
267  implicit none
268  interface
269  recursive subroutine get_number_of_compute_callback_names( &
270  number_of_compute_callback_names) &
271  bind(c, &
272  name="KIM_COMPUTE_CALLBACK_NAME_GetNumberOfComputeCallbackNames")
273  use, intrinsic :: iso_c_binding
274  integer(c_int), intent(out) :: number_of_compute_callback_names
275  end subroutine get_number_of_compute_callback_names
276  end interface
277  integer(c_int), intent(out) :: number_of_compute_callback_names
278 
279  call get_number_of_compute_callback_names(number_of_compute_callback_names)
281 
288  recursive subroutine kim_get_compute_callback_name(index, &
289  compute_callback_name, &
290  ierr)
291  implicit none
292  interface
293  integer(c_int) recursive function get_compute_callback_name( &
294  index, compute_callback_name) &
295  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_GetComputeCallbackName")
296  use, intrinsic :: iso_c_binding
297  import kim_compute_callback_name_type
298  implicit none
299  integer(c_int), intent(in), value :: index
300  type(kim_compute_callback_name_type), intent(out) :: &
301  compute_callback_name
302  end function get_compute_callback_name
303  end interface
304  integer(c_int), intent(in) :: index
305  type(kim_compute_callback_name_type), intent(out) :: compute_callback_name
306  integer(c_int), intent(out) :: ierr
307 
308  ierr = get_compute_callback_name(index - 1, compute_callback_name)
309  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. ...