kim-api  2.1.4-git+v2.1.3-git-3-g4c859c7f.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
kim_model_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_model_handle_type, &
47 
48  ! Constants
50 
51  ! Routines
52  operator (.eq.), &
53  operator (.ne.), &
56  kim_is_routine_present, &
57  kim_get_influence_distance, &
58  kim_get_number_of_neighbor_lists, &
59  kim_get_neighbor_list_values, &
60  kim_get_units, &
61  kim_compute_arguments_create, &
62  kim_compute_arguments_destroy, &
63  kim_compute, &
64  kim_extension, &
65  kim_clear_then_refresh, &
66  kim_write_parameterized_model, &
67  kim_get_species_support_and_code, &
68  kim_get_number_of_parameters, &
69  kim_get_parameter_metadata, &
70  kim_get_parameter, &
71  kim_set_parameter, &
72  kim_set_simulator_buffer_pointer, &
73  kim_get_simulator_buffer_pointer, &
74  kim_to_string, &
75  kim_set_log_id, &
76  kim_push_log_verbosity, &
77  kim_pop_log_verbosity
78 
79 
85  type, bind(c) :: kim_model_handle_type
86  type(c_ptr) :: p = c_null_ptr
87  end type kim_model_handle_type
88 
92  type(kim_model_handle_type), protected, save &
94 
98  interface operator (.eq.)
99  module procedure kim_model_handle_equal
100  end interface operator (.eq.)
101 
105  interface operator (.ne.)
106  module procedure kim_model_handle_not_equal
107  end interface operator (.ne.)
108 
114  interface kim_is_routine_present
115  module procedure kim_model_is_routine_present
116  end interface kim_is_routine_present
117 
123  interface kim_get_influence_distance
124  module procedure kim_model_get_influence_distance
125  end interface kim_get_influence_distance
126 
132  interface kim_get_number_of_neighbor_lists
134  end interface kim_get_number_of_neighbor_lists
135 
141  interface kim_get_neighbor_list_values
142  module procedure kim_model_get_neighbor_list_values
143  end interface kim_get_neighbor_list_values
144 
150  interface kim_get_units
151  module procedure kim_model_get_units
152  end interface kim_get_units
153 
159  interface kim_compute_arguments_create
160  module procedure kim_model_compute_arguments_create
161  end interface kim_compute_arguments_create
162 
168  interface kim_compute_arguments_destroy
169  module procedure kim_model_compute_arguments_destroy
170  end interface kim_compute_arguments_destroy
171 
177  interface kim_compute
178  module procedure kim_model_compute
179  end interface kim_compute
180 
186  interface kim_extension
187  module procedure kim_model_extension
188  end interface kim_extension
189 
195  interface kim_clear_then_refresh
196  module procedure kim_model_clear_then_refresh
197  end interface kim_clear_then_refresh
198 
204  interface kim_write_parameterized_model
205  module procedure kim_model_write_parameterized_model
206  end interface kim_write_parameterized_model
207 
214  interface kim_get_species_support_and_code
216  end interface kim_get_species_support_and_code
217 
223  interface kim_get_number_of_parameters
224  module procedure kim_model_get_number_of_parameters
225  end interface kim_get_number_of_parameters
226 
232  interface kim_get_parameter_metadata
233  module procedure kim_model_get_parameter_metadata
234  end interface kim_get_parameter_metadata
235 
242  interface kim_get_parameter
243  module procedure kim_model_get_parameter_integer
244  module procedure kim_model_get_parameter_double
245  end interface kim_get_parameter
246 
253  interface kim_set_parameter
254  module procedure kim_model_set_parameter_integer
255  module procedure kim_model_set_parameter_double
256  end interface kim_set_parameter
257 
264  interface kim_set_simulator_buffer_pointer
266  end interface kim_set_simulator_buffer_pointer
267 
274  interface kim_get_simulator_buffer_pointer
276  end interface kim_get_simulator_buffer_pointer
277 
283  interface kim_to_string
284  module procedure kim_model_to_string
285  end interface kim_to_string
286 
292  interface kim_set_log_id
293  module procedure kim_model_set_log_id
294  end interface kim_set_log_id
295 
301  interface kim_push_log_verbosity
302  module procedure kim_model_push_log_verbosity
303  end interface kim_push_log_verbosity
304 
310  interface kim_pop_log_verbosity
311  module procedure kim_model_pop_log_verbosity
312  end interface kim_pop_log_verbosity
313 
314 contains
318  logical recursive function kim_model_handle_equal(lhs, rhs)
319  implicit none
320  type(kim_model_handle_type), intent(in) :: lhs
321  type(kim_model_handle_type), intent(in) :: rhs
322 
323  if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
324  kim_model_handle_equal = .true.
325  else
326  kim_model_handle_equal = c_associated(lhs%p, rhs%p)
327  end if
328  end function kim_model_handle_equal
329 
333  logical recursive function kim_model_handle_not_equal(lhs, rhs)
334  implicit none
335  type(kim_model_handle_type), intent(in) :: lhs
336  type(kim_model_handle_type), intent(in) :: rhs
337 
338  kim_model_handle_not_equal = .not. (lhs .eq. rhs)
339  end function kim_model_handle_not_equal
340 
396  recursive subroutine kim_model_create(numbering, requested_length_unit, &
397  requested_energy_unit, requested_charge_unit, &
398  requested_temperature_unit, requested_time_unit, model_name, &
399  requested_units_accepted, model_handle, ierr)
400  use kim_numbering_module, only : kim_numbering_type
401  use kim_unit_system_module, only : kim_length_unit_type, &
402  kim_energy_unit_type, kim_charge_unit_type, kim_temperature_unit_type, &
403  kim_time_unit_type
404  implicit none
405  interface
406  integer(c_int) recursive function create(numbering, &
407  requested_length_unit, requested_energy_unit, requested_charge_unit, &
408  requested_temperature_unit, requested_time_unit, model_name, &
409  requested_units_accepted, model) bind(c, name="KIM_Model_Create")
410  use, intrinsic :: iso_c_binding
411  use kim_numbering_module, only : kim_numbering_type
412  use kim_unit_system_module, only : kim_length_unit_type, &
413  kim_energy_unit_type, kim_charge_unit_type, &
414  kim_temperature_unit_type, kim_time_unit_type
415  implicit none
416  type(kim_numbering_type), intent(in), value :: numbering
417  type(kim_length_unit_type), intent(in), value :: requested_length_unit
418  type(kim_energy_unit_type), intent(in), value :: requested_energy_unit
419  type(kim_charge_unit_type), intent(in), value :: requested_charge_unit
420  type(kim_temperature_unit_type), intent(in), value :: &
421  requested_temperature_unit
422  type(kim_time_unit_type), intent(in), value :: requested_time_unit
423  character(c_char), intent(in) :: model_name(*)
424  integer(c_int), intent(out) :: requested_units_accepted
425  type(c_ptr), intent(out) :: model
426  end function create
427  end interface
428  type(kim_numbering_type), intent(in) :: numbering
429  type(kim_length_unit_type), intent(in) :: requested_length_unit
430  type(kim_energy_unit_type), intent(in) :: requested_energy_unit
431  type(kim_charge_unit_type), intent(in) :: requested_charge_unit
432  type(kim_temperature_unit_type), intent(in) :: &
433  requested_temperature_unit
434  type(kim_time_unit_type), intent(in) :: requested_time_unit
435  character(len=*, kind=c_char), intent(in) :: model_name
436  integer(c_int), intent(out) :: requested_units_accepted
437  type(kim_model_handle_type), intent(out) :: model_handle
438  integer(c_int), intent(out) :: ierr
439 
440  type(c_ptr) :: pmodel
441 
442  ierr = create(numbering, requested_length_unit, requested_energy_unit, &
443  requested_charge_unit, requested_temperature_unit, requested_time_unit, &
444  trim(model_name)//c_null_char, requested_units_accepted, pmodel)
445  model_handle%p = pmodel
446  end subroutine kim_model_create
447 
469  recursive subroutine kim_model_destroy(model_handle)
470  implicit none
471  interface
472  recursive subroutine destroy(model) bind(c, name="KIM_Model_Destroy")
473  use, intrinsic :: iso_c_binding
474  implicit none
475  type(c_ptr), intent(inout) :: model
476  end subroutine destroy
477  end interface
478  type(kim_model_handle_type), intent(inout) :: model_handle
479 
480  type(c_ptr) :: pmodel
481  pmodel = model_handle%p
482  call destroy(pmodel)
483  model_handle%p = c_null_ptr
484  end subroutine kim_model_destroy
485 
491  recursive subroutine kim_model_is_routine_present(model_handle, &
492  model_routine_name, present, required, ierr)
493  use kim_interoperable_types_module, only : kim_model_type
494  use kim_model_routine_name_module, only : kim_model_routine_name_type
495  implicit none
496  interface
497  integer(c_int) recursive function is_routine_present(model, &
498  model_routine_name, present, required) &
499  bind(c, name="KIM_Model_IsRoutinePresent")
500  use, intrinsic :: iso_c_binding
501  use kim_interoperable_types_module, only : kim_model_type
502  use kim_model_routine_name_module, only : kim_model_routine_name_type
503  implicit none
504  type(kim_model_type), intent(in) :: model
505  type(kim_model_routine_name_type), intent(in), value &
506  :: model_routine_name
507  integer(c_int), intent(out) :: present
508  integer(c_int), intent(out) :: required
509  end function is_routine_present
510  end interface
511  type(kim_model_handle_type), intent(in) :: model_handle
512  type(kim_model_routine_name_type), intent(in) :: model_routine_name
513  integer(c_int), intent(out) :: present
514  integer(c_int), intent(out) :: required
515  integer(c_int), intent(out) :: ierr
516  type(kim_model_type), pointer :: model
517 
518  call c_f_pointer(model_handle%p, model)
519  ierr = is_routine_present(model, model_routine_name, present, required)
520  end subroutine kim_model_is_routine_present
521 
527  recursive subroutine kim_model_get_influence_distance(model_handle, &
528  influence_distance)
529  use kim_interoperable_types_module, only : kim_model_type
530  implicit none
531  interface
532  recursive subroutine get_influence_distance(model, influence_distance) &
533  bind(c, name="KIM_Model_GetInfluenceDistance")
534  use, intrinsic :: iso_c_binding
535  use kim_interoperable_types_module, only : kim_model_type
536  implicit none
537  type(kim_model_type), intent(in) :: model
538  real(c_double), intent(out) :: influence_distance
539  end subroutine get_influence_distance
540  end interface
541  type(kim_model_handle_type), intent(in) :: model_handle
542  real(c_double), intent(out) :: influence_distance
543  type(kim_model_type), pointer :: model
544 
545  call c_f_pointer(model_handle%p, model)
546  call get_influence_distance(model, influence_distance)
547  end subroutine kim_model_get_influence_distance
548 
554  recursive subroutine kim_model_get_number_of_neighbor_lists(model_handle, &
555  number_of_neighbor_lists)
556  use kim_interoperable_types_module, only : kim_model_type
557  implicit none
558  interface
559  recursive subroutine get_neighbor_list_pointers(model, &
560  number_of_neighbor_lists, cutoffs_ptr, &
561  model_will_not_request_neighbors_of_noncontributing__ptr) &
562  bind(c, name="KIM_Model_GetNeighborListPointers")
563  use, intrinsic :: iso_c_binding
564  use kim_interoperable_types_module, only : kim_model_type
565  implicit none
566  type(kim_model_type), intent(in) :: model
567  integer(c_int), intent(out) :: number_of_neighbor_lists
568  type(c_ptr), intent(out) :: cutoffs_ptr
569  type(c_ptr), intent(out) :: &
570  model_will_not_request_neighbors_of_noncontributing__ptr
571  end subroutine get_neighbor_list_pointers
572  end interface
573  type(kim_model_handle_type), intent(in) :: model_handle
574  integer(c_int), intent(out) :: number_of_neighbor_lists
575  type(kim_model_type), pointer :: model
576 
577  type(c_ptr) cutoffs_ptr, hint_ptr
578 
579  call c_f_pointer(model_handle%p, model)
580  call get_neighbor_list_pointers(model, number_of_neighbor_lists, &
581  cutoffs_ptr, hint_ptr)
583 
589  recursive subroutine kim_model_get_neighbor_list_values(model_handle, &
590  cutoffs, model_will_not_request_neighbors_of_noncontributing_particles, &
591  ierr)
592  use kim_interoperable_types_module, only : kim_model_type
593  implicit none
594  interface
595  recursive subroutine get_neighbor_list_pointers(model, &
596  number_of_neighbor_lists, cutoffs_ptr, &
597  model_will_not_request_neighbors_of_noncontributing__ptr) &
598  bind(c, name="KIM_Model_GetNeighborListPointers")
599  use, intrinsic :: iso_c_binding
600  use kim_interoperable_types_module, only : kim_model_type
601  implicit none
602  type(kim_model_type), intent(in) :: model
603  integer(c_int), intent(out) :: number_of_neighbor_lists
604  type(c_ptr), intent(out) :: cutoffs_ptr
605  type(c_ptr), intent(out) :: &
606  model_will_not_request_neighbors_of_noncontributing__ptr
607  end subroutine get_neighbor_list_pointers
608  end interface
609  type(kim_model_handle_type), intent(in) :: model_handle
610  real(c_double), intent(out) :: cutoffs(:)
611  integer(c_int), intent(out) :: &
612  model_will_not_request_neighbors_of_noncontributing_particles(:)
613  integer(c_int), intent(out) :: ierr
614  type(kim_model_type), pointer :: model
615 
616  integer(c_int) number_of_neighbor_lists
617  real(c_double), pointer :: cutoffs_fpointer(:)
618  integer(c_int), pointer :: &
619  model_will_not_request_neighbors_of_noncontributing__fpointer(:)
620  type(c_ptr) cutoffs_ptr
621  type(c_ptr) model_will_not_request_neighbors_of_noncontributing__ptr
622 
623  call c_f_pointer(model_handle%p, model)
624  call get_neighbor_list_pointers(model, number_of_neighbor_lists, &
625  cutoffs_ptr, &
626  model_will_not_request_neighbors_of_noncontributing__ptr)
627  if (c_associated(cutoffs_ptr)) then
628  call c_f_pointer(cutoffs_ptr, cutoffs_fpointer, &
629  [number_of_neighbor_lists])
630  else
631  nullify(cutoffs_fpointer)
632  end if
633  if (size(cutoffs) < number_of_neighbor_lists) then
634  ierr = 1
635  else
636  ierr = 0
637  cutoffs = cutoffs_fpointer(1:number_of_neighbor_lists)
638  end if
639 
640  if (c_associated( &
641  model_will_not_request_neighbors_of_noncontributing__ptr)) then
642  call c_f_pointer( &
643  model_will_not_request_neighbors_of_noncontributing__ptr, &
644  model_will_not_request_neighbors_of_noncontributing__fpointer, &
645  [number_of_neighbor_lists])
646  else
647  nullify( &
648  model_will_not_request_neighbors_of_noncontributing__fpointer)
649  end if
650  if (size( &
651  model_will_not_request_neighbors_of_noncontributing_particles) &
652  < number_of_neighbor_lists) then
653  ierr = 1
654  else
655  ierr = 0
656  model_will_not_request_neighbors_of_noncontributing_particles = &
657  model_will_not_request_neighbors_of_noncontributing__fpointer( &
658  1:number_of_neighbor_lists)
659  end if
661 
667  recursive subroutine kim_model_get_units(model_handle, length_unit, &
668  energy_unit, charge_unit, temperature_unit, time_unit)
669  use kim_unit_system_module, only : kim_length_unit_type, &
670  kim_energy_unit_type, kim_charge_unit_type, kim_temperature_unit_type, &
671  kim_time_unit_type
672  use kim_interoperable_types_module, only : kim_model_type
673  implicit none
674  interface
675  recursive subroutine get_units(model, length_unit, energy_unit, &
676  charge_unit, temperature_unit, time_unit) &
677  bind(c, name="KIM_Model_GetUnits")
678  use, intrinsic :: iso_c_binding
679  use kim_unit_system_module, only : kim_length_unit_type, &
680  kim_energy_unit_type, kim_charge_unit_type, &
681  kim_temperature_unit_type, kim_time_unit_type
682  use kim_interoperable_types_module, only : kim_model_type
683  type(kim_model_type), intent(in) :: model
684  type(kim_length_unit_type), intent(out) :: length_unit
685  type(kim_energy_unit_type), intent(out) :: energy_unit
686  type(kim_charge_unit_type), intent(out) :: charge_unit
687  type(kim_temperature_unit_type), intent(out) :: temperature_unit
688  type(kim_time_unit_type), intent(out) :: time_unit
689  end subroutine get_units
690  end interface
691  type(kim_model_handle_type), intent(in) :: model_handle
692  type(kim_length_unit_type), intent(out) :: length_unit
693  type(kim_energy_unit_type), intent(out) :: energy_unit
694  type(kim_charge_unit_type), intent(out) :: charge_unit
695  type(kim_temperature_unit_type), intent(out) :: temperature_unit
696  type(kim_time_unit_type), intent(out) :: time_unit
697  type(kim_model_type), pointer :: model
698 
699  call c_f_pointer(model_handle%p, model)
700  call get_units(model, length_unit, energy_unit, charge_unit, &
701  temperature_unit, time_unit)
702  end subroutine kim_model_get_units
703 
729  recursive subroutine kim_model_compute_arguments_create(model_handle, &
730  compute_arguments_handle, ierr)
732  kim_compute_arguments_handle_type
733  use kim_interoperable_types_module, only : kim_model_type
734  implicit none
735  interface
736  integer(c_int) recursive function compute_arguments_create(model, &
737  compute_arguments) bind(c, name="KIM_Model_ComputeArgumentsCreate")
738  use, intrinsic :: iso_c_binding
739  use kim_interoperable_types_module, only : kim_model_type
740  implicit none
741  type(kim_model_type), intent(in) :: model
742  type(c_ptr), intent(out) :: compute_arguments
743  end function compute_arguments_create
744  end interface
745  type(kim_model_handle_type), intent(in) :: model_handle
746  type(kim_compute_arguments_handle_type), intent(out) :: &
747  compute_arguments_handle
748  integer(c_int), intent(out) :: ierr
749  type(kim_model_type), pointer :: model
750  type(c_ptr) :: pcompute_arguments
751 
752  call c_f_pointer(model_handle%p, model)
753 
754  ierr = compute_arguments_create(model, pcompute_arguments)
755  if (ierr == 0) then
756  compute_arguments_handle%p = pcompute_arguments
757  end if
759 
786  recursive subroutine kim_model_compute_arguments_destroy(model_handle, &
787  compute_arguments_handle, ierr)
789  kim_compute_arguments_handle_type
790  use kim_interoperable_types_module, only : kim_model_type
791  implicit none
792  interface
793  integer(c_int) recursive function compute_arguments_destroy(model, &
794  compute_arguments) bind(c, name="KIM_Model_ComputeArgumentsDestroy")
795  use, intrinsic :: iso_c_binding
796  use kim_interoperable_types_module, only : kim_model_type
797  implicit none
798  type(kim_model_type), intent(in) :: model
799  type(c_ptr), intent(inout) :: compute_arguments
800  end function compute_arguments_destroy
801  end interface
802  type(kim_model_handle_type), intent(in) :: model_handle
803  type(kim_compute_arguments_handle_type), intent(inout) :: &
804  compute_arguments_handle
805  integer(c_int), intent(out) :: ierr
806  type(kim_model_type), pointer :: model
807  type(c_ptr) pcompute_arguments
808 
809  call c_f_pointer(model_handle%p, model)
810  pcompute_arguments = compute_arguments_handle%p
811  ierr = compute_arguments_destroy(model, pcompute_arguments)
812  if (ierr /= 0) then
813  compute_arguments_handle%p = c_null_ptr
814  end if
816 
841  recursive subroutine kim_model_compute(model_handle, &
842  compute_arguments_handle, ierr)
843  use kim_compute_arguments_module, only : kim_compute_arguments_handle_type
844  use kim_interoperable_types_module, only : kim_compute_arguments_type, &
845  kim_model_type
846  implicit none
847  interface
848  integer(c_int) recursive function compute(model, compute_arguments) &
849  bind(c, name="KIM_Model_Compute")
850  use, intrinsic :: iso_c_binding
851  use kim_interoperable_types_module, only : kim_compute_arguments_type
852  use kim_interoperable_types_module, only : kim_model_type
853  implicit none
854  type(kim_model_type), intent(in) :: model
855  type(kim_compute_arguments_type), intent(in) :: compute_arguments
856  end function compute
857  end interface
858  type(kim_model_handle_type), intent(in) :: model_handle
859  type(kim_compute_arguments_handle_type), intent(in) :: &
860  compute_arguments_handle
861  integer(c_int), intent(out) :: ierr
862  type(kim_model_type), pointer :: model
863  type(kim_compute_arguments_type), pointer :: compute_arguments
864 
865  call c_f_pointer(model_handle%p, model)
866  call c_f_pointer(compute_arguments_handle%p, compute_arguments)
867  ierr = compute(model, compute_arguments)
868  end subroutine kim_model_compute
869 
894  recursive subroutine kim_model_extension(model_handle, extension_id, &
895  extension_structure, ierr)
896  use kim_interoperable_types_module, only : kim_model_type
897  implicit none
898  interface
899  integer(c_int) recursive function extension(model, extension_id, &
900  extension_structure) bind(c, name="KIM_Model_Extension")
901  use, intrinsic :: iso_c_binding
902  use kim_interoperable_types_module, only : kim_model_type
903  implicit none
904  type(kim_model_type), intent(in) :: model
905  character(c_char), intent(in) :: extension_id(*)
906  type(c_ptr), intent(in), value :: extension_structure
907  end function extension
908  end interface
909  type(kim_model_handle_type), intent(in) :: model_handle
910  character(len=*, kind=c_char), intent(in) :: extension_id
911  type(c_ptr), intent(in) :: extension_structure
912  integer(c_int), intent(out) :: ierr
913  type(kim_model_type), pointer :: model
914 
915  call c_f_pointer(model_handle%p, model)
916  ierr = extension(model, trim(extension_id)//c_null_char, &
917  extension_structure)
918  end subroutine kim_model_extension
919 
941  recursive subroutine kim_model_clear_then_refresh(model_handle, ierr)
942  use kim_interoperable_types_module, only : kim_model_type
943  implicit none
944  interface
945  integer(c_int) recursive function clear_then_refresh(model) &
946  bind(c, name="KIM_Model_ClearThenRefresh")
947  use, intrinsic :: iso_c_binding
948  use kim_interoperable_types_module, only : kim_model_type
949  implicit none
950  type(kim_model_type), intent(in) :: model
951  end function clear_then_refresh
952  end interface
953  type(kim_model_handle_type), intent(in) :: model_handle
954  integer(c_int), intent(out) :: ierr
955  type(kim_model_type), pointer :: model
956 
957  call c_f_pointer(model_handle%p, model)
958  ierr = clear_then_refresh(model)
959  end subroutine kim_model_clear_then_refresh
960 
986  recursive subroutine kim_model_write_parameterized_model(model_handle, &
987  path, model_name, ierr)
988  use kim_interoperable_types_module, only : kim_model_type
989  implicit none
990  interface
991  integer(c_int) recursive function write_parameterized_model(model, &
992  path, model_name) bind(c, name="KIM_Model_WriteParameterizedModel")
993  use, intrinsic :: iso_c_binding
994  use kim_interoperable_types_module, only : kim_model_type
995  implicit none
996  type(kim_model_type), intent(in) :: model
997  character(c_char), intent(in) :: path(*)
998  character(c_char), intent(in) :: model_name(*)
999  end function write_parameterized_model
1000  end interface
1001  type(kim_model_handle_type), intent(in) :: model_handle
1002  character(len=*, kind=c_char), intent(in) :: path
1003  character(len=*, kind=c_char), intent(in) :: model_name
1004  integer(c_int), intent(out) :: ierr
1005  type(kim_model_type), pointer :: model
1006 
1007  call c_f_pointer(model_handle%p, model)
1008  ierr = write_parameterized_model(model, trim(path)//c_null_char, &
1009  trim(model_name)//c_null_char)
1011 
1018  recursive subroutine kim_model_get_species_support_and_code(model_handle, &
1019  species_name, species_is_supported, code, ierr)
1020  use kim_species_name_module, only : kim_species_name_type
1021  use kim_interoperable_types_module, only : kim_model_type
1022  implicit none
1023  interface
1024  integer(c_int) recursive function get_species_support_and_code(model, &
1025  species_name, species_is_supported, code) &
1026  bind(c, name="KIM_Model_GetSpeciesSupportAndCode")
1027  use, intrinsic :: iso_c_binding
1028  use kim_species_name_module, only : kim_species_name_type
1029  use kim_interoperable_types_module, only : kim_model_type
1030  implicit none
1031  type(kim_model_type), intent(in) :: model
1032  type(kim_species_name_type), intent(in), value :: species_name
1033  integer(c_int), intent(out) :: species_is_supported
1034  integer(c_int), intent(out) :: code
1035  end function get_species_support_and_code
1036  end interface
1037  type(kim_model_handle_type), intent(in) :: model_handle
1038  type(kim_species_name_type), intent(in) :: species_name
1039  integer(c_int), intent(out) :: species_is_supported
1040  integer(c_int), intent(out) :: code
1041  integer(c_int), intent(out) :: ierr
1042  type(kim_model_type), pointer :: model
1043 
1044  call c_f_pointer(model_handle%p, model)
1045  ierr = get_species_support_and_code(model, species_name, &
1046  species_is_supported, code)
1048 
1054  recursive subroutine kim_model_get_number_of_parameters(model_handle, &
1055  number_of_parameters)
1056  use kim_interoperable_types_module, only : kim_model_type
1057  implicit none
1058  interface
1059  recursive subroutine get_number_of_parameters(model, &
1060  number_of_parameters) bind(c, name="KIM_Model_GetNumberOfParameters")
1061  use, intrinsic :: iso_c_binding
1062  use kim_interoperable_types_module, only : kim_model_type
1063  implicit none
1064  type(kim_model_type), intent(in) :: model
1065  integer(c_int), intent(out) :: number_of_parameters
1066  end subroutine get_number_of_parameters
1067  end interface
1068  type(kim_model_handle_type), intent(in) :: model_handle
1069  integer(c_int), intent(out) :: number_of_parameters
1070  type(kim_model_type), pointer :: model
1071 
1072  call c_f_pointer(model_handle%p, model)
1073  call get_number_of_parameters(model, number_of_parameters)
1074  end subroutine kim_model_get_number_of_parameters
1075 
1081  recursive subroutine kim_model_get_parameter_metadata(model_handle, &
1082  parameter_index, data_type, extent, name, description, ierr)
1083  use kim_data_type_module, only : kim_data_type_type
1084  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
1085  use kim_interoperable_types_module, only : kim_model_type
1086  implicit none
1087  interface
1088  integer(c_int) recursive function get_parameter_metadata(model, &
1089  parameter_index, data_type, extent, name, description) &
1090  bind(c, name="KIM_Model_GetParameterMetadata")
1091  use, intrinsic :: iso_c_binding
1092  use kim_data_type_module, only : kim_data_type_type
1093  use kim_interoperable_types_module, only : kim_model_type
1094  implicit none
1095  type(kim_model_type), intent(in) :: model
1096  integer(c_int), intent(in), value :: parameter_index
1097  type(kim_data_type_type), intent(out) :: data_type
1098  integer(c_int), intent(out) :: extent
1099  type(c_ptr), intent(out) :: name
1100  type(c_ptr), intent(out) :: description
1101  end function get_parameter_metadata
1102  end interface
1103  type(kim_model_handle_type), intent(in) :: model_handle
1104  integer(c_int), intent(in) :: parameter_index
1105  type(kim_data_type_type), intent(out) :: data_type
1106  integer(c_int), intent(out) :: extent
1107  character(len=*, kind=c_char), intent(out) :: name
1108  character(len=*, kind=c_char), intent(out) :: description
1109  integer(c_int), intent(out) :: ierr
1110  type(kim_model_type), pointer :: model
1111 
1112  type(c_ptr) :: pname, pdesc
1113 
1114  call c_f_pointer(model_handle%p, model)
1115  ierr = get_parameter_metadata(model, parameter_index-1, data_type, extent, &
1116  pname, pdesc)
1117  call kim_convert_c_char_ptr_to_string(pname, name)
1118  call kim_convert_c_char_ptr_to_string(pdesc, description)
1119  end subroutine kim_model_get_parameter_metadata
1120 
1126  recursive subroutine kim_model_get_parameter_integer(model_handle, &
1127  parameter_index, array_index, parameter_value, ierr)
1128  use kim_interoperable_types_module, only : kim_model_type
1129  implicit none
1130  interface
1131  integer(c_int) recursive function get_parameter_integer(model, &
1132  parameter_index, array_index, parameter_value) &
1133  bind(c, name="KIM_Model_GetParameterInteger")
1134  use, intrinsic :: iso_c_binding
1135  use kim_interoperable_types_module, only : kim_model_type
1136  implicit none
1137  type(kim_model_type), intent(in) :: model
1138  integer(c_int), intent(in), value :: parameter_index
1139  integer(c_int), intent(in), value :: array_index
1140  integer(c_int), intent(out) :: parameter_value
1141  end function get_parameter_integer
1142  end interface
1143  type(kim_model_handle_type), intent(in) :: model_handle
1144  integer(c_int), intent(in) :: parameter_index
1145  integer(c_int), intent(in) :: array_index
1146  integer(c_int), intent(out) :: parameter_value
1147  integer(c_int), intent(out) :: ierr
1148  type(kim_model_type), pointer :: model
1149 
1150  call c_f_pointer(model_handle%p, model)
1151  ierr = get_parameter_integer(model, parameter_index-1, array_index-1, &
1152  parameter_value)
1153  end subroutine kim_model_get_parameter_integer
1154 
1160  recursive subroutine kim_model_get_parameter_double(model_handle, &
1161  parameter_index, array_index, parameter_value, ierr)
1162  use kim_interoperable_types_module, only : kim_model_type
1163  implicit none
1164  interface
1165  integer(c_int) recursive function get_parameter_double(model, &
1166  parameter_index, array_index, parameter_value) &
1167  bind(c, name="KIM_Model_GetParameterDouble")
1168  use, intrinsic :: iso_c_binding
1169  use kim_interoperable_types_module, only : kim_model_type
1170  implicit none
1171  type(kim_model_type), intent(in) :: model
1172  integer(c_int), intent(in), value :: parameter_index
1173  integer(c_int), intent(in), value :: array_index
1174  real(c_double), intent(out) :: parameter_value
1175  end function get_parameter_double
1176  end interface
1177  type(kim_model_handle_type), intent(in) :: model_handle
1178  integer(c_int), intent(in) :: parameter_index
1179  integer(c_int), intent(in) :: array_index
1180  real(c_double), intent(out) :: parameter_value
1181  integer(c_int), intent(out) :: ierr
1182  type(kim_model_type), pointer :: model
1183 
1184  call c_f_pointer(model_handle%p, model)
1185  ierr = get_parameter_double(model, parameter_index-1, array_index-1, &
1186  parameter_value)
1187  end subroutine kim_model_get_parameter_double
1188 
1194  recursive subroutine kim_model_set_parameter_integer(model_handle, &
1195  parameter_index, array_index, parameter_value, ierr)
1196  use kim_interoperable_types_module, only : kim_model_type
1197  implicit none
1198  interface
1199  integer(c_int) recursive function set_parameter_integer(model, &
1200  parameter_index, array_index, parameter_value) &
1201  bind(c, name="KIM_Model_SetParameterInteger")
1202  use, intrinsic :: iso_c_binding
1203  use kim_interoperable_types_module, only : kim_model_type
1204  implicit none
1205  type(kim_model_type), intent(in) :: model
1206  integer(c_int), intent(in), value :: parameter_index
1207  integer(c_int), intent(in), value :: array_index
1208  integer(c_int), intent(in), value :: parameter_value
1209  end function set_parameter_integer
1210  end interface
1211  type(kim_model_handle_type), intent(in) :: model_handle
1212  integer(c_int), intent(in) :: parameter_index
1213  integer(c_int), intent(in) :: array_index
1214  integer(c_int), intent(in) :: parameter_value
1215  integer(c_int), intent(out) :: ierr
1216  type(kim_model_type), pointer :: model
1217 
1218  call c_f_pointer(model_handle%p, model)
1219  ierr = set_parameter_integer(model, parameter_index-1, array_index-1, &
1220  parameter_value)
1221  end subroutine kim_model_set_parameter_integer
1222 
1228  recursive subroutine kim_model_set_parameter_double(model_handle, &
1229  parameter_index, array_index, parameter_value, ierr)
1230  use kim_interoperable_types_module, only : kim_model_type
1231  implicit none
1232  interface
1233  integer(c_int) recursive function set_parameter_double(model, &
1234  parameter_index, array_index, parameter_value) &
1235  bind(c, name="KIM_Model_SetParameterDouble")
1236  use, intrinsic :: iso_c_binding
1237  use kim_interoperable_types_module, only : kim_model_type
1238  implicit none
1239  type(kim_model_type), intent(in) :: model
1240  integer(c_int), intent(in), value :: parameter_index
1241  integer(c_int), intent(in), value :: array_index
1242  real(c_double), intent(in), value :: parameter_value
1243  end function set_parameter_double
1244  end interface
1245  type(kim_model_handle_type), intent(in) :: model_handle
1246  integer(c_int), intent(in) :: parameter_index
1247  integer(c_int), intent(in) :: array_index
1248  real(c_double), intent(in) :: parameter_value
1249  integer(c_int), intent(out) :: ierr
1250  type(kim_model_type), pointer :: model
1251 
1252  call c_f_pointer(model_handle%p, model)
1253  ierr = set_parameter_double(model, parameter_index-1, array_index-1, &
1254  parameter_value)
1255  end subroutine kim_model_set_parameter_double
1256 
1263  recursive subroutine kim_model_set_simulator_buffer_pointer(model_handle, ptr)
1264  use kim_interoperable_types_module, only : kim_model_type
1265  implicit none
1266  interface
1267  recursive subroutine set_simulator_buffer_pointer(model, ptr) &
1268  bind(c, name="KIM_Model_SetSimulatorBufferPointer")
1269  use, intrinsic :: iso_c_binding
1270  use kim_interoperable_types_module, only : kim_model_type
1271  implicit none
1272  type(kim_model_type), intent(in) :: model
1273  type(c_ptr), intent(in), value :: ptr
1274  end subroutine set_simulator_buffer_pointer
1275  end interface
1276  type(kim_model_handle_type), intent(in) :: model_handle
1277  type(c_ptr), intent(in) :: ptr
1278  type(kim_model_type), pointer :: model
1279 
1280  call c_f_pointer(model_handle%p, model)
1281  call set_simulator_buffer_pointer(model, ptr)
1283 
1290  recursive subroutine kim_model_get_simulator_buffer_pointer(model_handle, ptr)
1291  use kim_interoperable_types_module, only : kim_model_type
1292  implicit none
1293  interface
1294  recursive subroutine get_simulator_buffer_pointer(model, ptr) &
1295  bind(c, name="KIM_Model_GetSimulatorBufferPointer")
1296  use, intrinsic :: iso_c_binding
1297  use kim_interoperable_types_module, only : kim_model_type
1298  implicit none
1299  type(kim_model_type), intent(in) :: model
1300  type(c_ptr), intent(out) :: ptr
1301  end subroutine get_simulator_buffer_pointer
1302  end interface
1303  type(kim_model_handle_type), intent(in) :: model_handle
1304  type(c_ptr), intent(out) :: ptr
1305  type(kim_model_type), pointer :: model
1306 
1307  call c_f_pointer(model_handle%p, model)
1308  call get_simulator_buffer_pointer(model, ptr)
1310 
1316  recursive subroutine kim_model_to_string(model_handle, string)
1317  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
1318  use kim_interoperable_types_module, only : kim_model_type
1319  implicit none
1320  interface
1321  type(c_ptr) recursive function model_string(model) &
1322  bind(c, name="KIM_Model_ToString")
1323  use, intrinsic :: iso_c_binding
1324  use kim_interoperable_types_module, only : kim_model_type
1325  implicit none
1326  type(kim_model_type), intent(in) :: model
1327  end function model_string
1328  end interface
1329  type(kim_model_handle_type), intent(in) :: model_handle
1330  character(len=*, kind=c_char), intent(out) :: string
1331  type(kim_model_type), pointer :: model
1332 
1333  type(c_ptr) :: p
1334 
1335  call c_f_pointer(model_handle%p, model)
1336  p = model_string(model)
1337  call kim_convert_c_char_ptr_to_string(p, string)
1338  end subroutine kim_model_to_string
1339 
1345  recursive subroutine kim_model_set_log_id(model_handle, log_id)
1346  use kim_interoperable_types_module, only : kim_model_type
1347  implicit none
1348  interface
1349  recursive subroutine set_log_id(model, log_id) &
1350  bind(c, name="KIM_Model_SetLogID")
1351  use, intrinsic :: iso_c_binding
1352  use kim_interoperable_types_module, only : kim_model_type
1353  implicit none
1354  type(kim_model_type), intent(in) :: model
1355  character(c_char), intent(in) :: log_id(*)
1356  end subroutine set_log_id
1357  end interface
1358  type(kim_model_handle_type), intent(in) :: model_handle
1359  character(len=*, kind=c_char), intent(in) :: log_id
1360  type(kim_model_type), pointer :: model
1361 
1362  call c_f_pointer(model_handle%p, model)
1363  call set_log_id(model, trim(log_id)//c_null_char)
1364  end subroutine kim_model_set_log_id
1365 
1371  recursive subroutine kim_model_push_log_verbosity(model_handle, log_verbosity)
1372  use kim_log_verbosity_module, only : kim_log_verbosity_type
1373  use kim_interoperable_types_module, only : kim_model_type
1374  implicit none
1375  interface
1376  recursive subroutine push_log_verbosity(model, log_verbosity) &
1377  bind(c, name="KIM_Model_PushLogVerbosity")
1378  use, intrinsic :: iso_c_binding
1379  use kim_log_verbosity_module, only : kim_log_verbosity_type
1380  use kim_interoperable_types_module, only : kim_model_type
1381  implicit none
1382  type(kim_model_type), intent(in) :: model
1383  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
1384  end subroutine push_log_verbosity
1385  end interface
1386  type(kim_model_handle_type), intent(in) :: model_handle
1387  type(kim_log_verbosity_type), intent(in) :: log_verbosity
1388  type(kim_model_type), pointer :: model
1389 
1390  call c_f_pointer(model_handle%p, model)
1391  call push_log_verbosity(model, log_verbosity)
1392  end subroutine kim_model_push_log_verbosity
1393 
1399  recursive subroutine kim_model_pop_log_verbosity(model_handle)
1400  use kim_log_verbosity_module, only : kim_log_verbosity_type
1401  use kim_interoperable_types_module, only : kim_model_type
1402  implicit none
1403  interface
1404  recursive subroutine pop_log_verbosity(model) &
1405  bind(c, name="KIM_Model_PopLogVerbosity")
1406  use, intrinsic :: iso_c_binding
1407  use kim_log_verbosity_module, only : kim_log_verbosity_type
1408  use kim_interoperable_types_module, only : kim_model_type
1409  implicit none
1410  type(kim_model_type), intent(in) :: model
1411  end subroutine pop_log_verbosity
1412  end interface
1413  type(kim_model_handle_type), intent(in) :: model_handle
1414  type(kim_model_type), pointer :: model
1415 
1416  call c_f_pointer(model_handle%p, model)
1417  call pop_log_verbosity(model)
1418  end subroutine kim_model_pop_log_verbosity
1419 end module kim_model_module
static int write_parameterized_model(KIM_ModelWriteParameterizedModel const *const modelWriteParameterizedModel)
recursive subroutine, public kim_model_destroy(model_handle)
Destroy a previously Model::Create&#39;d object.
recursive subroutine kim_model_get_influence_distance(model_handle, influence_distance)
Get the Model&#39;s influence distance.
recursive subroutine kim_model_to_string(model_handle, string)
Get a string representing the internal state of the Model object.
recursive subroutine kim_model_get_parameter_double(model_handle, parameter_index, array_index, parameter_value, ierr)
Get a parameter value from the Model.
static int compute_arguments_destroy(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsDestroy *const modelComputeArgumentsDestroy)
recursive subroutine kim_model_compute_arguments_create(model_handle, compute_arguments_handle, ierr)
Create a new ComputeArguments object for the Model object.
recursive subroutine kim_model_clear_then_refresh(model_handle, ierr)
Clear influence distance and neighbor list pointers and refresh Model object after parameter changes...
recursive subroutine kim_model_compute(model_handle, compute_arguments_handle, ierr)
Call the Model&#39;s MODEL_ROUTINE_NAME::Compute routine.
An Extensible Enumeration for the ModelRoutineName&#39;s supported by the KIM API.
recursive subroutine kim_model_get_neighbor_list_values(model_handle, cutoffs, model_will_not_request_neighbors_of_noncontributing_particles, ierr)
Get Model&#39;s neighbor list values.
recursive subroutine kim_model_set_log_id(model_handle, log_id)
Set the identity of the Log object associated with the Model object.
recursive subroutine kim_model_push_log_verbosity(model_handle, log_verbosity)
Push a new LogVerbosity onto the Model object&#39;s Log object verbosity stack.
recursive subroutine kim_model_write_parameterized_model(model_handle, path, model_name, ierr)
Call the Model&#39;s MODEL_ROUTINE_NAME::WriteParameterizedModel routine.
An Extensible Enumeration for the Numbering&#39;s supported by the KIM API.
recursive subroutine kim_model_set_parameter_double(model_handle, parameter_index, array_index, parameter_value, ierr)
Set a parameter value for the Model.
type(kim_model_handle_type), save, public, protected kim_model_null_handle
NULL handle for use in comparisons.
recursive subroutine kim_model_get_number_of_parameters(model_handle, number_of_parameters)
Get the number of parameter arrays provided by the Model.
recursive subroutine kim_model_get_parameter_metadata(model_handle, parameter_index, data_type, extent, name, description, ierr)
Get the metadata associated with one of the Model&#39;s parameter arrays.
recursive subroutine kim_model_get_number_of_neighbor_lists(model_handle, number_of_neighbor_lists)
Get Model&#39;s number of neighbor lists.
recursive subroutine kim_model_get_parameter_integer(model_handle, parameter_index, array_index, parameter_value, ierr)
Get a parameter value from the Model.
Provides the primary interface to a KIM API Model object and is meant to be used by simulators...
An Extensible Enumeration for the SpeciesName&#39;s supported by the KIM API.
recursive subroutine kim_model_get_simulator_buffer_pointer(model_handle, ptr)
Get the Simulator&#39;s buffer pointer from the Model object.
Provides the primary interface to a KIM API ComputeArguments object and is meant to be used by simula...
static int compute_arguments_create(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate)
recursive subroutine kim_model_set_parameter_integer(model_handle, parameter_index, array_index, parameter_value, ierr)
Set a parameter value for the Model.
recursive subroutine kim_model_set_simulator_buffer_pointer(model_handle, ptr)
Set the Simulator&#39;s buffer pointer within the Model object.
recursive subroutine kim_model_get_species_support_and_code(model_handle, species_name, species_is_supported, code, ierr)
Get the Model&#39;s support and code for the requested SpeciesName.
recursive subroutine, public kim_model_create(numbering, requested_length_unit, requested_energy_unit, requested_charge_unit, requested_temperature_unit, requested_time_unit, model_name, requested_units_accepted, model_handle, ierr)
Create a new KIM API Model object.
recursive subroutine kim_model_extension(model_handle, extension_id, extension_structure, ierr)
Call the Model&#39;s MODEL_ROUTINE_NAME::Extension routine.
An Extensible Enumeration for the DataType&#39;s supported by the KIM API.
recursive subroutine kim_model_pop_log_verbosity(model_handle)
Pop a LogVerbosity from the Model object&#39;s Log object verbosity stack.
An Extensible Enumeration for the LogVerbosity&#39;s supported by the KIM API.
recursive subroutine kim_model_get_units(model_handle, length_unit, energy_unit, charge_unit, temperature_unit, time_unit)
Get the Model&#39;s base unit values.
recursive subroutine kim_model_compute_arguments_destroy(model_handle, compute_arguments_handle, ierr)
Destroy a previously Model::ComputeArgumentsCreate&#39;d object.