kim-api  2.2.1+v2.2.1.GNU.GNU.
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
kim_compute_argument_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_argument_name_type, &
46  ! Constants
56  ! Routines
57  kim_known, &
58  operator(.eq.), &
59  operator(.ne.), &
60  kim_from_string, &
61  kim_to_string, &
65 
71  type, bind(c) :: kim_compute_argument_name_type
78  integer(c_int) compute_argument_name_id
79  end type kim_compute_argument_name_type
80 
87  type(kim_compute_argument_name_type), protected, save, &
88  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_numberOfParticles") &
90 
97  type(kim_compute_argument_name_type), protected, save, &
98  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_particleSpeciesCodes") &
100 
107  type(kim_compute_argument_name_type), protected, save, &
108  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_particleContributing") &
110 
117  type(kim_compute_argument_name_type), protected, save, &
118  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_coordinates") &
120 
127  type(kim_compute_argument_name_type), protected, save, &
128  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialEnergy") &
130 
137  type(kim_compute_argument_name_type), protected, save, &
138  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialForces") &
140 
147  type(kim_compute_argument_name_type), protected, save, &
148  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialParticleEnergy") &
150 
157  type(kim_compute_argument_name_type), protected, save, &
158  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialVirial") &
160 
167  type(kim_compute_argument_name_type), protected, save, &
168  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialParticleVirial") &
170 
176  interface kim_known
177  module procedure kim_compute_argument_name_known
178  end interface kim_known
179 
185  interface operator(.eq.)
186  module procedure kim_compute_argument_name_equal
187  end interface operator(.eq.)
188 
195  interface operator(.ne.)
196  module procedure kim_compute_argument_name_not_equal
197  end interface operator(.ne.)
198 
206  interface kim_from_string
207  module procedure kim_compute_argument_name_from_string
208  end interface kim_from_string
209 
215  interface kim_to_string
216  module procedure kim_compute_argument_name_to_string
217  end interface kim_to_string
218 
219 contains
225  logical recursive function kim_compute_argument_name_known( &
226  compute_argument_name)
227  implicit none
228  interface
229  integer(c_int) recursive function known(compute_argument_name) &
230  bind(c, name="KIM_ComputeArgumentName_Known")
231  use, intrinsic :: iso_c_binding
232  import kim_compute_argument_name_type
233  implicit none
234  type(kim_compute_argument_name_type), intent(in), value :: &
235  compute_argument_name
236  end function known
237  end interface
238  type(kim_compute_argument_name_type), intent(in) :: compute_argument_name
239 
240  kim_compute_argument_name_known = (known(compute_argument_name) /= 0)
241  end function kim_compute_argument_name_known
242 
248  logical recursive function kim_compute_argument_name_equal(lhs, rhs)
249  implicit none
250  type(kim_compute_argument_name_type), intent(in) :: lhs
251  type(kim_compute_argument_name_type), intent(in) :: rhs
252 
253  kim_compute_argument_name_equal &
254  = (lhs%compute_argument_name_id == rhs%compute_argument_name_id)
255  end function kim_compute_argument_name_equal
256 
263  logical recursive function kim_compute_argument_name_not_equal(lhs, rhs)
264  implicit none
265  type(kim_compute_argument_name_type), intent(in) :: lhs
266  type(kim_compute_argument_name_type), intent(in) :: rhs
267 
268  kim_compute_argument_name_not_equal = .not. (lhs == rhs)
269  end function kim_compute_argument_name_not_equal
270 
278  recursive subroutine kim_compute_argument_name_from_string( &
279  string, compute_argument_name)
280  implicit none
281  interface
282  type(kim_compute_argument_name_type) recursive function from_string( &
283  string) bind(c, name="KIM_ComputeArgumentName_FromString")
284  use, intrinsic :: iso_c_binding
285  import kim_compute_argument_name_type
286  implicit none
287  character(c_char), intent(in) :: string(*)
288  end function from_string
289  end interface
290  character(len=*, kind=c_char), intent(in) :: string
291  type(kim_compute_argument_name_type), intent(out) :: compute_argument_name
292 
293  compute_argument_name = from_string(trim(string)//c_null_char)
294  end subroutine kim_compute_argument_name_from_string
295 
301  recursive subroutine kim_compute_argument_name_to_string( &
302  compute_argument_name, string)
303  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
304  implicit none
305  interface
306  type(c_ptr) recursive function get_string(compute_argument_name) &
307  bind(c, name="KIM_ComputeArgumentName_ToString")
308  use, intrinsic :: iso_c_binding
309  import kim_compute_argument_name_type
310  implicit none
311  type(kim_compute_argument_name_type), intent(in), value :: &
312  compute_argument_name
313  end function get_string
314  end interface
315  type(kim_compute_argument_name_type), intent(in) :: &
316  compute_argument_name
317  character(len=*, kind=c_char), intent(out) :: string
318 
319  type(c_ptr) :: p
320 
321  p = get_string(compute_argument_name)
322  call kim_convert_c_char_ptr_to_string(p, string)
323  end subroutine kim_compute_argument_name_to_string
324 
332  recursive subroutine kim_get_number_of_compute_argument_names( &
333  number_of_compute_argument_names)
334  implicit none
335  interface
336  recursive subroutine get_number_of_compute_argument_names( &
337  number_of_compute_argument_names) &
338  bind(c, &
339  name="KIM_COMPUTE_ARGUMENT_NAME_GetNumberOfComputeArgumentNames")
340  use, intrinsic :: iso_c_binding
341  integer(c_int), intent(out) :: number_of_compute_argument_names
342  end subroutine get_number_of_compute_argument_names
343  end interface
344  integer(c_int), intent(out) :: number_of_compute_argument_names
345 
346  call get_number_of_compute_argument_names(number_of_compute_argument_names)
348 
356  recursive subroutine kim_get_compute_argument_name( &
357  index, compute_argument_name, ierr)
358  implicit none
359  interface
360  integer(c_int) recursive function get_compute_argument_name( &
361  index, compute_argument_name) &
362  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_GetComputeArgumentName")
363  use, intrinsic :: iso_c_binding
364  import kim_compute_argument_name_type
365  implicit none
366  integer(c_int), intent(in), value :: index
367  type(kim_compute_argument_name_type), intent(out) :: &
368  compute_argument_name
369  end function get_compute_argument_name
370  end interface
371  integer(c_int), intent(in) :: index
372  type(kim_compute_argument_name_type), intent(out) :: compute_argument_name
373  integer(c_int), intent(out) :: ierr
374 
375  ierr = get_compute_argument_name(index - 1, compute_argument_name)
376  end subroutine kim_get_compute_argument_name
377 
385  recursive subroutine kim_get_compute_argument_data_type( &
386  compute_argument_name, &
387  data_type, ierr)
388  use kim_data_type_module, only: kim_data_type_type
389  implicit none
390  interface
391  integer(c_int) recursive function get_compute_argument_data_type( &
392  compute_argument_name, data_type) &
393  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_GetComputeArgumentDataType")
394  use, intrinsic :: iso_c_binding
395  use kim_data_type_module, only: kim_data_type_type
396  import kim_compute_argument_name_type
397  implicit none
398  type(kim_compute_argument_name_type), intent(in), value :: &
399  compute_argument_name
400  type(kim_data_type_type), intent(out) :: data_type
401  end function get_compute_argument_data_type
402  end interface
403  type(kim_compute_argument_name_type), intent(in) :: &
404  compute_argument_name
405  type(kim_data_type_type), intent(out) :: data_type
406  integer(c_int), intent(out) :: ierr
407 
408  ierr = get_compute_argument_data_type(compute_argument_name, data_type)
recursive subroutine, public kim_get_compute_argument_data_type(compute_argument_name, data_type, ierr)
Get the DataType of each defined standard ComputeArgumentName.
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_particle_contributing
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_partial_virial
recursive subroutine, public kim_get_compute_argument_name(index, compute_argument_name, ierr)
Get the identity of each defined standard ComputeArgumentName.
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_partial_energy
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_partial_particle_energy
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_coordinates
recursive subroutine, public kim_get_number_of_compute_argument_names(number_of_compute_argument_names)
Get the number of standard ComputeArgumentName's defined by the KIM API.
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_partial_particle_virial
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_particle_species_codes
An Extensible Enumeration for the DataType's supported by the KIM API.
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_partial_forces
An Extensible Enumeration for the ComputeArgumentName's supported by the KIM API. ...
type(kim_compute_argument_name_type), save, public, protected kim_compute_argument_name_number_of_particles