kim-api  2.1.4-git+v2.1.3-git-1-g7847914a.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--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.git repository.
31 !
32 
33 
40  use, intrinsic :: iso_c_binding
41  implicit none
42  private
43 
44  public &
45  ! Derived types
46  kim_compute_argument_name_type, &
47 
48  ! Constants
58 
59  ! Routines
60  kim_known, &
61  operator (.eq.), &
62  operator (.ne.), &
63  kim_from_string, &
64  kim_to_string, &
68 
69 
75  type, bind(c) :: kim_compute_argument_name_type
82  integer(c_int) compute_argument_name_id
83  end type kim_compute_argument_name_type
84 
91  type(kim_compute_argument_name_type), protected, save, &
92  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_numberOfParticles") &
94 
101  type(kim_compute_argument_name_type), protected, save, &
102  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_particleSpeciesCodes") &
104 
111  type(kim_compute_argument_name_type), protected, save, &
112  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_particleContributing") &
114 
121  type(kim_compute_argument_name_type), protected, save, &
122  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_coordinates") &
124 
131  type(kim_compute_argument_name_type), protected, save, &
132  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialEnergy") &
134 
141  type(kim_compute_argument_name_type), protected, save, &
142  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialForces") &
144 
151  type(kim_compute_argument_name_type), protected, save, &
152  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialParticleEnergy") &
154 
161  type(kim_compute_argument_name_type), protected, save, &
162  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialVirial") &
164 
171  type(kim_compute_argument_name_type), protected, save, &
172  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_partialParticleVirial") &
174 
180  interface kim_known
181  module procedure kim_compute_argument_name_known
182  end interface kim_known
183 
189  interface operator (.eq.)
190  module procedure kim_compute_argument_name_equal
191  end interface operator (.eq.)
192 
199  interface operator (.ne.)
200  module procedure kim_compute_argument_name_not_equal
201  end interface operator (.ne.)
202 
210  interface kim_from_string
211  module procedure kim_compute_argument_name_from_string
212  end interface kim_from_string
213 
219  interface kim_to_string
220  module procedure kim_compute_argument_name_to_string
221  end interface kim_to_string
222 
223 contains
229  logical recursive function kim_compute_argument_name_known( &
230  compute_argument_name)
231  implicit none
232  interface
233  integer(c_int) recursive function known(compute_argument_name) &
234  bind(c, name="KIM_ComputeArgumentName_Known")
235  use, intrinsic :: iso_c_binding
236  import kim_compute_argument_name_type
237  implicit none
238  type(kim_compute_argument_name_type), intent(in), value :: &
239  compute_argument_name
240  end function known
241  end interface
242  type(kim_compute_argument_name_type), intent(in) :: compute_argument_name
243 
244  kim_compute_argument_name_known = (known(compute_argument_name) /= 0)
245  end function kim_compute_argument_name_known
246 
252  logical recursive function kim_compute_argument_name_equal(lhs, rhs)
253  implicit none
254  type(kim_compute_argument_name_type), intent(in) :: lhs
255  type(kim_compute_argument_name_type), intent(in) :: rhs
256 
257  kim_compute_argument_name_equal &
258  = (lhs%compute_argument_name_id .eq. rhs%compute_argument_name_id)
259  end function kim_compute_argument_name_equal
260 
267  logical recursive function kim_compute_argument_name_not_equal(lhs, rhs)
268  implicit none
269  type(kim_compute_argument_name_type), intent(in) :: lhs
270  type(kim_compute_argument_name_type), intent(in) :: rhs
271 
272  kim_compute_argument_name_not_equal = .not. (lhs .eq. rhs)
273  end function kim_compute_argument_name_not_equal
274 
282  recursive subroutine kim_compute_argument_name_from_string(string, &
283  compute_argument_name)
284  implicit none
285  interface
286  type(kim_compute_argument_name_type) recursive function from_string( &
287  string) bind(c, name="KIM_ComputeArgumentName_FromString")
288  use, intrinsic :: iso_c_binding
289  import kim_compute_argument_name_type
290  implicit none
291  character(c_char), intent(in) :: string(*)
292  end function from_string
293  end interface
294  character(len=*, kind=c_char), intent(in) :: string
295  type(kim_compute_argument_name_type), intent(out) :: compute_argument_name
296 
297  compute_argument_name = from_string(trim(string)//c_null_char)
298  end subroutine kim_compute_argument_name_from_string
299 
305  recursive subroutine kim_compute_argument_name_to_string( &
306  compute_argument_name, string)
307  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
308  implicit none
309  interface
310  type(c_ptr) recursive function get_string(compute_argument_name) &
311  bind(c, name="KIM_ComputeArgumentName_ToString")
312  use, intrinsic :: iso_c_binding
313  import kim_compute_argument_name_type
314  implicit none
315  type(kim_compute_argument_name_type), intent(in), value :: &
316  compute_argument_name
317  end function get_string
318  end interface
319  type(kim_compute_argument_name_type), intent(in) :: &
320  compute_argument_name
321  character(len=*, kind=c_char), intent(out) :: string
322 
323  type(c_ptr) :: p
324 
325  p = get_string(compute_argument_name)
326  call kim_convert_c_char_ptr_to_string(p, string)
327  end subroutine kim_compute_argument_name_to_string
328 
336  recursive subroutine kim_get_number_of_compute_argument_names( &
337  number_of_compute_argument_names)
338  implicit none
339  interface
340  recursive subroutine get_number_of_compute_argument_names( &
341  number_of_compute_argument_names) &
342  bind(c, &
343  name="KIM_COMPUTE_ARGUMENT_NAME_GetNumberOfComputeArgumentNames")
344  use, intrinsic :: iso_c_binding
345  integer(c_int), intent(out) :: number_of_compute_argument_names
346  end subroutine get_number_of_compute_argument_names
347  end interface
348  integer(c_int), intent(out) :: number_of_compute_argument_names
349 
350  call get_number_of_compute_argument_names(number_of_compute_argument_names)
352 
353 
361  recursive subroutine kim_get_compute_argument_name(index, &
362  compute_argument_name, ierr)
363  implicit none
364  interface
365  integer(c_int) recursive function get_compute_argument_name(index, &
366  compute_argument_name) &
367  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_GetComputeArgumentName")
368  use, intrinsic :: iso_c_binding
369  import kim_compute_argument_name_type
370  implicit none
371  integer(c_int), intent(in), value :: index
372  type(kim_compute_argument_name_type), intent(out) :: &
373  compute_argument_name
374  end function get_compute_argument_name
375  end interface
376  integer(c_int), intent(in) :: index
377  type(kim_compute_argument_name_type), intent(out) :: compute_argument_name
378  integer(c_int), intent(out) :: ierr
379 
380  ierr = get_compute_argument_name(index-1, compute_argument_name)
381  end subroutine kim_get_compute_argument_name
382 
390  recursive subroutine kim_get_compute_argument_data_type( &
391  compute_argument_name, &
392  data_type, ierr)
393  use kim_data_type_module, only : kim_data_type_type
394  implicit none
395  interface
396  integer(c_int) recursive function get_compute_argument_data_type( &
397  compute_argument_name, data_type) &
398  bind(c, name="KIM_COMPUTE_ARGUMENT_NAME_GetComputeArgumentDataType")
399  use, intrinsic :: iso_c_binding
400  use kim_data_type_module, only : kim_data_type_type
401  import kim_compute_argument_name_type
402  implicit none
403  type(kim_compute_argument_name_type), intent(in), value :: &
404  compute_argument_name
405  type(kim_data_type_type), intent(out) :: data_type
406  end function get_compute_argument_data_type
407  end interface
408  type(kim_compute_argument_name_type), intent(in) :: &
409  compute_argument_name
410  type(kim_data_type_type), intent(out) :: data_type
411  integer(c_int), intent(out) :: ierr
412 
413  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