kim-api  2.1.2+v2.1.2.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--2019, 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.1.2 package.
31 !
32 
33 
40  use, intrinsic :: iso_c_binding
41  implicit none
42  private
43 
44  public &
45  ! Derived types
46  kim_compute_callback_name_type, &
47 
48  ! Constants
52 
53  ! Routines
54  kim_known, &
55  operator (.eq.), &
56  operator (.ne.), &
57  kim_from_string, &
58  kim_to_string, &
61 
62 
68  type, bind(c) :: kim_compute_callback_name_type
75  integer(c_int) compute_callback_name_id
76  end type kim_compute_callback_name_type
77 
84  type(kim_compute_callback_name_type), protected, save, &
85  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_GetNeighborList") &
87 
94  type(kim_compute_callback_name_type), protected, save, &
95  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_ProcessDEDrTerm") &
97 
104  type(kim_compute_callback_name_type), protected, save, &
105  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_ProcessD2EDr2Term") &
107 
113  interface kim_known
114  module procedure kim_compute_callback_name_known
115  end interface kim_known
116 
122  interface operator (.eq.)
123  module procedure kim_compute_callback_name_equal
124  end interface operator (.eq.)
125 
132  interface operator (.ne.)
133  module procedure kim_compute_callback_name_not_equal
134  end interface operator (.ne.)
135 
143  interface kim_from_string
144  module procedure kim_compute_callback_name_from_string
145  end interface kim_from_string
146 
152  interface kim_to_string
153  module procedure kim_compute_callback_name_to_string
154  end interface kim_to_string
155 
156 contains
162  logical recursive function kim_compute_callback_name_known( &
163  compute_callback_name)
164  implicit none
165  interface
166  integer(c_int) recursive function known(compute_callback_name) &
167  bind(c, name="KIM_ComputeCallbackName_Known")
168  use, intrinsic :: iso_c_binding
169  import kim_compute_callback_name_type
170  implicit none
171  type(kim_compute_callback_name_type), intent(in), value :: &
172  compute_callback_name
173  end function known
174  end interface
175  type(kim_compute_callback_name_type), intent(in) :: compute_callback_name
176 
177  kim_compute_callback_name_known = (known(compute_callback_name) /= 0)
178  end function kim_compute_callback_name_known
179 
185  logical recursive function kim_compute_callback_name_equal(lhs, rhs)
186  implicit none
187  type(kim_compute_callback_name_type), intent(in) :: lhs
188  type(kim_compute_callback_name_type), intent(in) :: rhs
189 
190  kim_compute_callback_name_equal &
191  = (lhs%compute_callback_name_id .eq. rhs%compute_callback_name_id)
192  end function kim_compute_callback_name_equal
193 
200  logical recursive function kim_compute_callback_name_not_equal(lhs, rhs)
201  implicit none
202  type(kim_compute_callback_name_type), intent(in) :: lhs
203  type(kim_compute_callback_name_type), intent(in) :: rhs
204 
205  kim_compute_callback_name_not_equal = .not. (lhs .eq. rhs)
206  end function kim_compute_callback_name_not_equal
207 
215  recursive subroutine kim_compute_callback_name_from_string(string, &
216  compute_callback_name)
217  implicit none
218  interface
219  type(kim_compute_callback_name_type) recursive function from_string( &
220  string) bind(c, name="KIM_ComputeCallbackName_FromString")
221  use, intrinsic :: iso_c_binding
222  import kim_compute_callback_name_type
223  implicit none
224  character(c_char), intent(in) :: string(*)
225  end function from_string
226  end interface
227  character(len=*, kind=c_char), intent(in) :: string
228  type(kim_compute_callback_name_type), intent(out) :: compute_callback_name
229 
230  compute_callback_name = from_string(trim(string)//c_null_char)
231  end subroutine kim_compute_callback_name_from_string
232 
238  recursive subroutine kim_compute_callback_name_to_string( &
239  compute_callback_name, string)
240  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
241  implicit none
242  interface
243  type(c_ptr) recursive function get_string(compute_callback_name) &
244  bind(c, name="KIM_ComputeCallbackName_ToString")
245  use, intrinsic :: iso_c_binding
246  import kim_compute_callback_name_type
247  implicit none
248  type(kim_compute_callback_name_type), intent(in), value :: &
249  compute_callback_name
250  end function get_string
251  end interface
252  type(kim_compute_callback_name_type), intent(in) :: &
253  compute_callback_name
254  character(len=*, kind=c_char), intent(out) :: string
255 
256  type(c_ptr) :: p
257 
258  p = get_string(compute_callback_name)
259  call kim_convert_c_char_ptr_to_string(p, string)
260  end subroutine kim_compute_callback_name_to_string
261 
269  recursive subroutine kim_get_number_of_compute_callback_names( &
270  number_of_compute_callback_names)
271  implicit none
272  interface
273  recursive subroutine get_number_of_compute_callback_names( &
274  number_of_compute_callback_names) &
275  bind(c, &
276  name="KIM_COMPUTE_CALLBACK_NAME_GetNumberOfComputeCallbackNames")
277  use, intrinsic :: iso_c_binding
278  integer(c_int), intent(out) :: number_of_compute_callback_names
279  end subroutine get_number_of_compute_callback_names
280  end interface
281  integer(c_int), intent(out) :: number_of_compute_callback_names
282 
283  call get_number_of_compute_callback_names(number_of_compute_callback_names)
285 
292  recursive subroutine kim_get_compute_callback_name(index, &
293  compute_callback_name, ierr)
294  implicit none
295  interface
296  integer(c_int) recursive function get_compute_callback_name(index, &
297  compute_callback_name) &
298  bind(c, name="KIM_COMPUTE_CALLBACK_NAME_GetComputeCallbackName")
299  use, intrinsic :: iso_c_binding
300  import kim_compute_callback_name_type
301  implicit none
302  integer(c_int), intent(in), value :: index
303  type(kim_compute_callback_name_type), intent(out) :: &
304  compute_callback_name
305  end function get_compute_callback_name
306  end interface
307  integer(c_int), intent(in) :: index
308  type(kim_compute_callback_name_type), intent(out) :: compute_callback_name
309  integer(c_int), intent(out) :: ierr
310 
311  ierr = get_compute_callback_name(index-1, compute_callback_name)
312  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. ...