kim-api  2.2.1+v2.2.1.GNU.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--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_model_handle_type, &
46  ! Constants
48  ! Routines
49  operator(.eq.), &
50  operator(.ne.), &
53  kim_is_routine_present, &
54  kim_get_influence_distance, &
55  kim_get_number_of_neighbor_lists, &
56  kim_get_neighbor_list_values, &
57  kim_get_units, &
58  kim_compute_arguments_create, &
59  kim_compute_arguments_destroy, &
60  kim_compute, &
61  kim_extension, &
62  kim_clear_then_refresh, &
63  kim_write_parameterized_model, &
64  kim_get_species_support_and_code, &
65  kim_get_number_of_parameters, &
66  kim_get_parameter_metadata, &
67  kim_get_parameter, &
68  kim_set_parameter, &
69  kim_set_simulator_buffer_pointer, &
70  kim_get_simulator_buffer_pointer, &
71  kim_to_string, &
72  kim_set_log_id, &
73  kim_push_log_verbosity, &
74  kim_pop_log_verbosity
75 
81  type, bind(c) :: kim_model_handle_type
82  type(c_ptr) :: p = c_null_ptr
83  end type kim_model_handle_type
84 
88  type(kim_model_handle_type), protected, save &
90 
94  interface operator(.eq.)
95  module procedure kim_model_handle_equal
96  end interface operator(.eq.)
97 
101  interface operator(.ne.)
102  module procedure kim_model_handle_not_equal
103  end interface operator(.ne.)
104 
110  interface kim_is_routine_present
111  module procedure kim_model_is_routine_present
112  end interface kim_is_routine_present
113 
119  interface kim_get_influence_distance
120  module procedure kim_model_get_influence_distance
121  end interface kim_get_influence_distance
122 
128  interface kim_get_number_of_neighbor_lists
130  end interface kim_get_number_of_neighbor_lists
131 
137  interface kim_get_neighbor_list_values
138  module procedure kim_model_get_neighbor_list_values
139  end interface kim_get_neighbor_list_values
140 
146  interface kim_get_units
147  module procedure kim_model_get_units
148  end interface kim_get_units
149 
155  interface kim_compute_arguments_create
156  module procedure kim_model_compute_arguments_create
157  end interface kim_compute_arguments_create
158 
164  interface kim_compute_arguments_destroy
165  module procedure kim_model_compute_arguments_destroy
166  end interface kim_compute_arguments_destroy
167 
173  interface kim_compute
174  module procedure kim_model_compute
175  end interface kim_compute
176 
182  interface kim_extension
183  module procedure kim_model_extension
184  end interface kim_extension
185 
191  interface kim_clear_then_refresh
192  module procedure kim_model_clear_then_refresh
193  end interface kim_clear_then_refresh
194 
200  interface kim_write_parameterized_model
201  module procedure kim_model_write_parameterized_model
202  end interface kim_write_parameterized_model
203 
210  interface kim_get_species_support_and_code
212  end interface kim_get_species_support_and_code
213 
219  interface kim_get_number_of_parameters
220  module procedure kim_model_get_number_of_parameters
221  end interface kim_get_number_of_parameters
222 
228  interface kim_get_parameter_metadata
229  module procedure kim_model_get_parameter_metadata
230  end interface kim_get_parameter_metadata
231 
238  interface kim_get_parameter
239  module procedure kim_model_get_parameter_integer
240  module procedure kim_model_get_parameter_double
241  end interface kim_get_parameter
242 
249  interface kim_set_parameter
250  module procedure kim_model_set_parameter_integer
251  module procedure kim_model_set_parameter_double
252  end interface kim_set_parameter
253 
260  interface kim_set_simulator_buffer_pointer
262  end interface kim_set_simulator_buffer_pointer
263 
270  interface kim_get_simulator_buffer_pointer
272  end interface kim_get_simulator_buffer_pointer
273 
279  interface kim_to_string
280  module procedure kim_model_to_string
281  end interface kim_to_string
282 
288  interface kim_set_log_id
289  module procedure kim_model_set_log_id
290  end interface kim_set_log_id
291 
297  interface kim_push_log_verbosity
298  module procedure kim_model_push_log_verbosity
299  end interface kim_push_log_verbosity
300 
306  interface kim_pop_log_verbosity
307  module procedure kim_model_pop_log_verbosity
308  end interface kim_pop_log_verbosity
309 
310 contains
314  logical recursive function kim_model_handle_equal(lhs, rhs)
315  implicit none
316  type(kim_model_handle_type), intent(in) :: lhs
317  type(kim_model_handle_type), intent(in) :: rhs
318 
319  if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
320  kim_model_handle_equal = .true.
321  else
322  kim_model_handle_equal = c_associated(lhs%p, rhs%p)
323  end if
324  end function kim_model_handle_equal
325 
329  logical recursive function kim_model_handle_not_equal(lhs, rhs)
330  implicit none
331  type(kim_model_handle_type), intent(in) :: lhs
332  type(kim_model_handle_type), intent(in) :: rhs
333 
334  kim_model_handle_not_equal = .not. (lhs == rhs)
335  end function kim_model_handle_not_equal
336 
394  recursive subroutine kim_model_create( &
395  numbering, requested_length_unit, requested_energy_unit, &
396  requested_charge_unit, requested_temperature_unit, requested_time_unit, &
397  model_name, requested_units_accepted, model_handle, ierr)
398  use kim_numbering_module, only: kim_numbering_type
399  use kim_unit_system_module, only: kim_length_unit_type, &
400  kim_energy_unit_type, &
401  kim_charge_unit_type, &
402  kim_temperature_unit_type, &
403  kim_time_unit_type
404  implicit none
405  interface
406  integer(c_int) recursive function create( &
407  numbering, requested_length_unit, requested_energy_unit, &
408  requested_charge_unit, requested_temperature_unit, &
409  requested_time_unit, model_name, requested_units_accepted, model) &
410  bind(c, name="KIM_Model_Create")
411  use, intrinsic :: iso_c_binding
412  use kim_numbering_module, only: kim_numbering_type
413  use kim_unit_system_module, only: kim_length_unit_type, &
414  kim_energy_unit_type, &
415  kim_charge_unit_type, &
416  kim_temperature_unit_type, &
417  kim_time_unit_type
418  implicit none
419  type(kim_numbering_type), intent(in), value :: numbering
420  type(kim_length_unit_type), intent(in), value :: requested_length_unit
421  type(kim_energy_unit_type), intent(in), value :: requested_energy_unit
422  type(kim_charge_unit_type), intent(in), value :: requested_charge_unit
423  type(kim_temperature_unit_type), intent(in), value :: &
424  requested_temperature_unit
425  type(kim_time_unit_type), intent(in), value :: requested_time_unit
426  character(c_char), intent(in) :: model_name(*)
427  integer(c_int), intent(out) :: requested_units_accepted
428  type(c_ptr), intent(out) :: model
429  end function create
430  end interface
431  type(kim_numbering_type), intent(in) :: numbering
432  type(kim_length_unit_type), intent(in) :: requested_length_unit
433  type(kim_energy_unit_type), intent(in) :: requested_energy_unit
434  type(kim_charge_unit_type), intent(in) :: requested_charge_unit
435  type(kim_temperature_unit_type), intent(in) :: &
436  requested_temperature_unit
437  type(kim_time_unit_type), intent(in) :: requested_time_unit
438  character(len=*, kind=c_char), intent(in) :: model_name
439  integer(c_int), intent(out) :: requested_units_accepted
440  type(kim_model_handle_type), intent(out) :: model_handle
441  integer(c_int), intent(out) :: ierr
442 
443  type(c_ptr) :: pmodel
444 
445  ierr = create(numbering, requested_length_unit, requested_energy_unit, &
446  requested_charge_unit, requested_temperature_unit, &
447  requested_time_unit, trim(model_name)//c_null_char, &
448  requested_units_accepted, pmodel)
449  model_handle%p = pmodel
450  end subroutine kim_model_create
451 
473  recursive subroutine kim_model_destroy(model_handle)
474  implicit none
475  interface
476  recursive subroutine destroy(model) bind(c, name="KIM_Model_Destroy")
477  use, intrinsic :: iso_c_binding
478  implicit none
479  type(c_ptr), intent(inout) :: model
480  end subroutine destroy
481  end interface
482  type(kim_model_handle_type), intent(inout) :: model_handle
483 
484  type(c_ptr) :: pmodel
485  pmodel = model_handle%p
486  call destroy(pmodel)
487  model_handle%p = c_null_ptr
488  end subroutine kim_model_destroy
489 
495  recursive subroutine kim_model_is_routine_present( &
496  model_handle, model_routine_name, present, required, ierr)
497  use kim_interoperable_types_module, only: kim_model_type
498  use kim_model_routine_name_module, only: kim_model_routine_name_type
499  implicit none
500  interface
501  integer(c_int) recursive function is_routine_present( &
502  model, model_routine_name, present, required) &
503  bind(c, name="KIM_Model_IsRoutinePresent")
504  use, intrinsic :: iso_c_binding
505  use kim_interoperable_types_module, only: kim_model_type
506  use kim_model_routine_name_module, only: kim_model_routine_name_type
507  implicit none
508  type(kim_model_type), intent(in) :: model
509  type(kim_model_routine_name_type), intent(in), value &
510  :: model_routine_name
511  integer(c_int), intent(out) :: present
512  integer(c_int), intent(out) :: required
513  end function is_routine_present
514  end interface
515  type(kim_model_handle_type), intent(in) :: model_handle
516  type(kim_model_routine_name_type), intent(in) :: model_routine_name
517  integer(c_int), intent(out) :: present
518  integer(c_int), intent(out) :: required
519  integer(c_int), intent(out) :: ierr
520  type(kim_model_type), pointer :: model
521 
522  call c_f_pointer(model_handle%p, model)
523  ierr = is_routine_present(model, model_routine_name, present, required)
524  end subroutine kim_model_is_routine_present
525 
531  recursive subroutine kim_model_get_influence_distance( &
532  model_handle, influence_distance)
533  use kim_interoperable_types_module, only: kim_model_type
534  implicit none
535  interface
536  recursive subroutine get_influence_distance(model, influence_distance) &
537  bind(c, name="KIM_Model_GetInfluenceDistance")
538  use, intrinsic :: iso_c_binding
539  use kim_interoperable_types_module, only: kim_model_type
540  implicit none
541  type(kim_model_type), intent(in) :: model
542  real(c_double), intent(out) :: influence_distance
543  end subroutine get_influence_distance
544  end interface
545  type(kim_model_handle_type), intent(in) :: model_handle
546  real(c_double), intent(out) :: influence_distance
547  type(kim_model_type), pointer :: model
548 
549  call c_f_pointer(model_handle%p, model)
550  call get_influence_distance(model, influence_distance)
551  end subroutine kim_model_get_influence_distance
552 
558  recursive subroutine kim_model_get_number_of_neighbor_lists( &
559  model_handle, number_of_neighbor_lists)
560  use kim_interoperable_types_module, only: kim_model_type
561  implicit none
562  interface
563  recursive subroutine get_neighbor_list_pointers( &
564  model, number_of_neighbor_lists, cutoffs_ptr, &
565  model_will_not_request_neighbors_of_noncontributing__ptr) &
566  bind(c, name="KIM_Model_GetNeighborListPointers")
567  use, intrinsic :: iso_c_binding
568  use kim_interoperable_types_module, only: kim_model_type
569  implicit none
570  type(kim_model_type), intent(in) :: model
571  integer(c_int), intent(out) :: number_of_neighbor_lists
572  type(c_ptr), intent(out) :: cutoffs_ptr
573  type(c_ptr), intent(out) :: &
574  model_will_not_request_neighbors_of_noncontributing__ptr
575  end subroutine get_neighbor_list_pointers
576  end interface
577  type(kim_model_handle_type), intent(in) :: model_handle
578  integer(c_int), intent(out) :: number_of_neighbor_lists
579  type(kim_model_type), pointer :: model
580 
581  type(c_ptr) cutoffs_ptr, hint_ptr
582 
583  call c_f_pointer(model_handle%p, model)
584  call get_neighbor_list_pointers(model, number_of_neighbor_lists, &
585  cutoffs_ptr, hint_ptr)
587 
593  recursive subroutine kim_model_get_neighbor_list_values( &
594  model_handle, cutoffs, &
595  model_will_not_request_neighbors_of_noncontributing_particles, ierr)
596  use kim_interoperable_types_module, only: kim_model_type
597  implicit none
598  interface
599  recursive subroutine get_neighbor_list_pointers( &
600  model, number_of_neighbor_lists, cutoffs_ptr, &
601  model_will_not_request_neighbors_of_noncontributing__ptr) &
602  bind(c, name="KIM_Model_GetNeighborListPointers")
603  use, intrinsic :: iso_c_binding
604  use kim_interoperable_types_module, only: kim_model_type
605  implicit none
606  type(kim_model_type), intent(in) :: model
607  integer(c_int), intent(out) :: number_of_neighbor_lists
608  type(c_ptr), intent(out) :: cutoffs_ptr
609  type(c_ptr), intent(out) :: &
610  model_will_not_request_neighbors_of_noncontributing__ptr
611  end subroutine get_neighbor_list_pointers
612  end interface
613  type(kim_model_handle_type), intent(in) :: model_handle
614  real(c_double), intent(out) :: cutoffs(:)
615  integer(c_int), intent(out) :: &
616  model_will_not_request_neighbors_of_noncontributing_particles(:)
617  integer(c_int), intent(out) :: ierr
618  type(kim_model_type), pointer :: model
619 
620  integer(c_int) number_of_neighbor_lists
621  real(c_double), pointer :: cutoffs_fpointer(:)
622  integer(c_int), pointer :: &
623  model_will_not_request_neighbors_of_noncontributing__fpointer(:)
624  type(c_ptr) cutoffs_ptr
625  type(c_ptr) model_will_not_request_neighbors_of_noncontributing__ptr
626 
627  call c_f_pointer(model_handle%p, model)
628  call get_neighbor_list_pointers( &
629  model, number_of_neighbor_lists, cutoffs_ptr, &
630  model_will_not_request_neighbors_of_noncontributing__ptr)
631  if (c_associated(cutoffs_ptr)) then
632  call c_f_pointer(cutoffs_ptr, cutoffs_fpointer, &
633  [number_of_neighbor_lists])
634  else
635  nullify (cutoffs_fpointer)
636  end if
637  if (size(cutoffs) < number_of_neighbor_lists) then
638  ierr = 1
639  else
640  ierr = 0
641  cutoffs = cutoffs_fpointer(1:number_of_neighbor_lists)
642  end if
643 
644  if (c_associated( &
645  model_will_not_request_neighbors_of_noncontributing__ptr)) then
646  call c_f_pointer( &
647  model_will_not_request_neighbors_of_noncontributing__ptr, &
648  model_will_not_request_neighbors_of_noncontributing__fpointer, &
649  [number_of_neighbor_lists])
650  else
651  nullify ( &
652  model_will_not_request_neighbors_of_noncontributing__fpointer)
653  end if
654  if (size( &
655  model_will_not_request_neighbors_of_noncontributing_particles) &
656  < number_of_neighbor_lists) then
657  ierr = 1
658  else
659  ierr = 0
660  model_will_not_request_neighbors_of_noncontributing_particles = &
661  model_will_not_request_neighbors_of_noncontributing__fpointer( &
662  1:number_of_neighbor_lists)
663  end if
665 
671  recursive subroutine kim_model_get_units( &
672  model_handle, length_unit, energy_unit, charge_unit, temperature_unit, &
673  time_unit)
674  use kim_unit_system_module, only: kim_length_unit_type, &
675  kim_energy_unit_type, &
676  kim_charge_unit_type, &
677  kim_temperature_unit_type, &
678  kim_time_unit_type
679  use kim_interoperable_types_module, only: kim_model_type
680  implicit none
681  interface
682  recursive subroutine get_units( &
683  model, length_unit, energy_unit, charge_unit, temperature_unit, &
684  time_unit) &
685  bind(c, name="KIM_Model_GetUnits")
686  use, intrinsic :: iso_c_binding
687  use kim_unit_system_module, only: kim_length_unit_type, &
688  kim_energy_unit_type, &
689  kim_charge_unit_type, &
690  kim_temperature_unit_type, &
691  kim_time_unit_type
692  use kim_interoperable_types_module, only: kim_model_type
693  type(kim_model_type), intent(in) :: model
694  type(kim_length_unit_type), intent(out) :: length_unit
695  type(kim_energy_unit_type), intent(out) :: energy_unit
696  type(kim_charge_unit_type), intent(out) :: charge_unit
697  type(kim_temperature_unit_type), intent(out) :: temperature_unit
698  type(kim_time_unit_type), intent(out) :: time_unit
699  end subroutine get_units
700  end interface
701  type(kim_model_handle_type), intent(in) :: model_handle
702  type(kim_length_unit_type), intent(out) :: length_unit
703  type(kim_energy_unit_type), intent(out) :: energy_unit
704  type(kim_charge_unit_type), intent(out) :: charge_unit
705  type(kim_temperature_unit_type), intent(out) :: temperature_unit
706  type(kim_time_unit_type), intent(out) :: time_unit
707  type(kim_model_type), pointer :: model
708 
709  call c_f_pointer(model_handle%p, model)
710  call get_units(model, length_unit, energy_unit, charge_unit, &
711  temperature_unit, time_unit)
712  end subroutine kim_model_get_units
713 
740  recursive subroutine kim_model_compute_arguments_create( &
741  model_handle, compute_arguments_handle, ierr)
743  kim_compute_arguments_handle_type
744  use kim_interoperable_types_module, only: kim_model_type
745  implicit none
746  interface
747  integer(c_int) recursive function compute_arguments_create( &
748  model, compute_arguments) &
749  bind(c, name="KIM_Model_ComputeArgumentsCreate")
750  use, intrinsic :: iso_c_binding
751  use kim_interoperable_types_module, only: kim_model_type
752  implicit none
753  type(kim_model_type), intent(in) :: model
754  type(c_ptr), intent(out) :: compute_arguments
755  end function compute_arguments_create
756  end interface
757  type(kim_model_handle_type), intent(in) :: model_handle
758  type(kim_compute_arguments_handle_type), intent(out) :: &
759  compute_arguments_handle
760  integer(c_int), intent(out) :: ierr
761  type(kim_model_type), pointer :: model
762  type(c_ptr) :: pcompute_arguments
763 
764  call c_f_pointer(model_handle%p, model)
765 
766  ierr = compute_arguments_create(model, pcompute_arguments)
767  if (ierr == 0) then
768  compute_arguments_handle%p = pcompute_arguments
769  end if
771 
799  recursive subroutine kim_model_compute_arguments_destroy( &
800  model_handle, compute_arguments_handle, ierr)
801  use kim_compute_arguments_module, only: kim_compute_arguments_handle_type
802  use kim_interoperable_types_module, only: kim_model_type
803  implicit none
804  interface
805  integer(c_int) recursive function compute_arguments_destroy( &
806  model, compute_arguments) &
807  bind(c, name="KIM_Model_ComputeArgumentsDestroy")
808  use, intrinsic :: iso_c_binding
809  use kim_interoperable_types_module, only: kim_model_type
810  implicit none
811  type(kim_model_type), intent(in) :: model
812  type(c_ptr), intent(inout) :: compute_arguments
813  end function compute_arguments_destroy
814  end interface
815  type(kim_model_handle_type), intent(in) :: model_handle
816  type(kim_compute_arguments_handle_type), intent(inout) :: &
817  compute_arguments_handle
818  integer(c_int), intent(out) :: ierr
819  type(kim_model_type), pointer :: model
820  type(c_ptr) pcompute_arguments
821 
822  call c_f_pointer(model_handle%p, model)
823  pcompute_arguments = compute_arguments_handle%p
824  ierr = compute_arguments_destroy(model, pcompute_arguments)
825  if (ierr /= 0) then
826  compute_arguments_handle%p = c_null_ptr
827  end if
829 
855  recursive subroutine kim_model_compute( &
856  model_handle, compute_arguments_handle, ierr)
857  use kim_compute_arguments_module, only: kim_compute_arguments_handle_type
858  use kim_interoperable_types_module, only: kim_compute_arguments_type, &
859  kim_model_type
860  implicit none
861  interface
862  integer(c_int) recursive function compute(model, compute_arguments) &
863  bind(c, name="KIM_Model_Compute")
864  use, intrinsic :: iso_c_binding
865  use kim_interoperable_types_module, only: kim_compute_arguments_type
866  use kim_interoperable_types_module, only: kim_model_type
867  implicit none
868  type(kim_model_type), intent(in) :: model
869  type(kim_compute_arguments_type), intent(in) :: compute_arguments
870  end function compute
871  end interface
872  type(kim_model_handle_type), intent(in) :: model_handle
873  type(kim_compute_arguments_handle_type), intent(in) :: &
874  compute_arguments_handle
875  integer(c_int), intent(out) :: ierr
876  type(kim_model_type), pointer :: model
877  type(kim_compute_arguments_type), pointer :: compute_arguments
878 
879  call c_f_pointer(model_handle%p, model)
880  call c_f_pointer(compute_arguments_handle%p, compute_arguments)
881  ierr = compute(model, compute_arguments)
882  end subroutine kim_model_compute
883 
909  recursive subroutine kim_model_extension( &
910  model_handle, extension_id, extension_structure, ierr)
911  use kim_interoperable_types_module, only: kim_model_type
912  implicit none
913  interface
914  integer(c_int) recursive function extension( &
915  model, extension_id, extension_structure) &
916  bind(c, name="KIM_Model_Extension")
917  use, intrinsic :: iso_c_binding
918  use kim_interoperable_types_module, only: kim_model_type
919  implicit none
920  type(kim_model_type), intent(in) :: model
921  character(c_char), intent(in) :: extension_id(*)
922  type(c_ptr), intent(in), value :: extension_structure
923  end function extension
924  end interface
925  type(kim_model_handle_type), intent(in) :: model_handle
926  character(len=*, kind=c_char), intent(in) :: extension_id
927  type(c_ptr), intent(in) :: extension_structure
928  integer(c_int), intent(out) :: ierr
929  type(kim_model_type), pointer :: model
930 
931  call c_f_pointer(model_handle%p, model)
932  ierr = extension(model, trim(extension_id)//c_null_char, &
933  extension_structure)
934  end subroutine kim_model_extension
935 
957  recursive subroutine kim_model_clear_then_refresh(model_handle, ierr)
958  use kim_interoperable_types_module, only: kim_model_type
959  implicit none
960  interface
961  integer(c_int) recursive function clear_then_refresh(model) &
962  bind(c, name="KIM_Model_ClearThenRefresh")
963  use, intrinsic :: iso_c_binding
964  use kim_interoperable_types_module, only: kim_model_type
965  implicit none
966  type(kim_model_type), intent(in) :: model
967  end function clear_then_refresh
968  end interface
969  type(kim_model_handle_type), intent(in) :: model_handle
970  integer(c_int), intent(out) :: ierr
971  type(kim_model_type), pointer :: model
972 
973  call c_f_pointer(model_handle%p, model)
974  ierr = clear_then_refresh(model)
975  end subroutine kim_model_clear_then_refresh
976 
1002  recursive subroutine kim_model_write_parameterized_model( &
1003  model_handle, path, model_name, ierr)
1004  use kim_interoperable_types_module, only: kim_model_type
1005  implicit none
1006  interface
1007  integer(c_int) recursive function write_parameterized_model( &
1008  model, path, model_name) &
1009  bind(c, name="KIM_Model_WriteParameterizedModel")
1010  use, intrinsic :: iso_c_binding
1011  use kim_interoperable_types_module, only: kim_model_type
1012  implicit none
1013  type(kim_model_type), intent(in) :: model
1014  character(c_char), intent(in) :: path(*)
1015  character(c_char), intent(in) :: model_name(*)
1016  end function write_parameterized_model
1017  end interface
1018  type(kim_model_handle_type), intent(in) :: model_handle
1019  character(len=*, kind=c_char), intent(in) :: path
1020  character(len=*, kind=c_char), intent(in) :: model_name
1021  integer(c_int), intent(out) :: ierr
1022  type(kim_model_type), pointer :: model
1023 
1024  call c_f_pointer(model_handle%p, model)
1025  ierr = write_parameterized_model(model, trim(path)//c_null_char, &
1026  trim(model_name)//c_null_char)
1028 
1035  recursive subroutine kim_model_get_species_support_and_code( &
1036  model_handle, species_name, species_is_supported, code, ierr)
1037  use kim_species_name_module, only: kim_species_name_type
1038  use kim_interoperable_types_module, only: kim_model_type
1039  implicit none
1040  interface
1041  integer(c_int) recursive function get_species_support_and_code( &
1042  model, species_name, species_is_supported, code) &
1043  bind(c, name="KIM_Model_GetSpeciesSupportAndCode")
1044  use, intrinsic :: iso_c_binding
1045  use kim_species_name_module, only: kim_species_name_type
1046  use kim_interoperable_types_module, only: kim_model_type
1047  implicit none
1048  type(kim_model_type), intent(in) :: model
1049  type(kim_species_name_type), intent(in), value :: species_name
1050  integer(c_int), intent(out) :: species_is_supported
1051  integer(c_int), intent(out) :: code
1052  end function get_species_support_and_code
1053  end interface
1054  type(kim_model_handle_type), intent(in) :: model_handle
1055  type(kim_species_name_type), intent(in) :: species_name
1056  integer(c_int), intent(out) :: species_is_supported
1057  integer(c_int), intent(out) :: code
1058  integer(c_int), intent(out) :: ierr
1059  type(kim_model_type), pointer :: model
1060 
1061  call c_f_pointer(model_handle%p, model)
1062  ierr = get_species_support_and_code(model, species_name, &
1063  species_is_supported, code)
1065 
1071  recursive subroutine kim_model_get_number_of_parameters( &
1072  model_handle, number_of_parameters)
1073  use kim_interoperable_types_module, only: kim_model_type
1074  implicit none
1075  interface
1076  recursive subroutine get_number_of_parameters( &
1077  model, number_of_parameters) &
1078  bind(c, name="KIM_Model_GetNumberOfParameters")
1079  use, intrinsic :: iso_c_binding
1080  use kim_interoperable_types_module, only: kim_model_type
1081  implicit none
1082  type(kim_model_type), intent(in) :: model
1083  integer(c_int), intent(out) :: number_of_parameters
1084  end subroutine get_number_of_parameters
1085  end interface
1086  type(kim_model_handle_type), intent(in) :: model_handle
1087  integer(c_int), intent(out) :: number_of_parameters
1088  type(kim_model_type), pointer :: model
1089 
1090  call c_f_pointer(model_handle%p, model)
1091  call get_number_of_parameters(model, number_of_parameters)
1092  end subroutine kim_model_get_number_of_parameters
1093 
1099  recursive subroutine kim_model_get_parameter_metadata( &
1100  model_handle, parameter_index, data_type, extent, name, description, ierr)
1101  use kim_data_type_module, only: kim_data_type_type
1102  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
1103  use kim_interoperable_types_module, only: kim_model_type
1104  implicit none
1105  interface
1106  integer(c_int) recursive function get_parameter_metadata( &
1107  model, parameter_index, data_type, extent, name, description) &
1108  bind(c, name="KIM_Model_GetParameterMetadata")
1109  use, intrinsic :: iso_c_binding
1110  use kim_data_type_module, only: kim_data_type_type
1111  use kim_interoperable_types_module, only: kim_model_type
1112  implicit none
1113  type(kim_model_type), intent(in) :: model
1114  integer(c_int), intent(in), value :: parameter_index
1115  type(kim_data_type_type), intent(out) :: data_type
1116  integer(c_int), intent(out) :: extent
1117  type(c_ptr), intent(out) :: name
1118  type(c_ptr), intent(out) :: description
1119  end function get_parameter_metadata
1120  end interface
1121  type(kim_model_handle_type), intent(in) :: model_handle
1122  integer(c_int), intent(in) :: parameter_index
1123  type(kim_data_type_type), intent(out) :: data_type
1124  integer(c_int), intent(out) :: extent
1125  character(len=*, kind=c_char), intent(out) :: name
1126  character(len=*, kind=c_char), intent(out) :: description
1127  integer(c_int), intent(out) :: ierr
1128  type(kim_model_type), pointer :: model
1129 
1130  type(c_ptr) :: pname, pdesc
1131 
1132  call c_f_pointer(model_handle%p, model)
1133  ierr = get_parameter_metadata(model, parameter_index - 1, data_type, &
1134  extent, pname, pdesc)
1135  call kim_convert_c_char_ptr_to_string(pname, name)
1136  call kim_convert_c_char_ptr_to_string(pdesc, description)
1137  end subroutine kim_model_get_parameter_metadata
1138 
1144  recursive subroutine kim_model_get_parameter_integer( &
1145  model_handle, parameter_index, array_index, parameter_value, ierr)
1146  use kim_interoperable_types_module, only: kim_model_type
1147  implicit none
1148  interface
1149  integer(c_int) recursive function get_parameter_integer( &
1150  model, parameter_index, array_index, parameter_value) &
1151  bind(c, name="KIM_Model_GetParameterInteger")
1152  use, intrinsic :: iso_c_binding
1153  use kim_interoperable_types_module, only: kim_model_type
1154  implicit none
1155  type(kim_model_type), intent(in) :: model
1156  integer(c_int), intent(in), value :: parameter_index
1157  integer(c_int), intent(in), value :: array_index
1158  integer(c_int), intent(out) :: parameter_value
1159  end function get_parameter_integer
1160  end interface
1161  type(kim_model_handle_type), intent(in) :: model_handle
1162  integer(c_int), intent(in) :: parameter_index
1163  integer(c_int), intent(in) :: array_index
1164  integer(c_int), intent(out) :: parameter_value
1165  integer(c_int), intent(out) :: ierr
1166  type(kim_model_type), pointer :: model
1167 
1168  call c_f_pointer(model_handle%p, model)
1169  ierr = get_parameter_integer(model, parameter_index - 1, array_index - 1, &
1170  parameter_value)
1171  end subroutine kim_model_get_parameter_integer
1172 
1178  recursive subroutine kim_model_get_parameter_double( &
1179  model_handle, parameter_index, array_index, parameter_value, ierr)
1180  use kim_interoperable_types_module, only: kim_model_type
1181  implicit none
1182  interface
1183  integer(c_int) recursive function get_parameter_double( &
1184  model, parameter_index, array_index, parameter_value) &
1185  bind(c, name="KIM_Model_GetParameterDouble")
1186  use, intrinsic :: iso_c_binding
1187  use kim_interoperable_types_module, only: kim_model_type
1188  implicit none
1189  type(kim_model_type), intent(in) :: model
1190  integer(c_int), intent(in), value :: parameter_index
1191  integer(c_int), intent(in), value :: array_index
1192  real(c_double), intent(out) :: parameter_value
1193  end function get_parameter_double
1194  end interface
1195  type(kim_model_handle_type), intent(in) :: model_handle
1196  integer(c_int), intent(in) :: parameter_index
1197  integer(c_int), intent(in) :: array_index
1198  real(c_double), intent(out) :: parameter_value
1199  integer(c_int), intent(out) :: ierr
1200  type(kim_model_type), pointer :: model
1201 
1202  call c_f_pointer(model_handle%p, model)
1203  ierr = get_parameter_double(model, parameter_index - 1, array_index - 1, &
1204  parameter_value)
1205  end subroutine kim_model_get_parameter_double
1206 
1212  recursive subroutine kim_model_set_parameter_integer( &
1213  model_handle, parameter_index, array_index, parameter_value, ierr)
1214  use kim_interoperable_types_module, only: kim_model_type
1215  implicit none
1216  interface
1217  integer(c_int) recursive function set_parameter_integer( &
1218  model, parameter_index, array_index, parameter_value) &
1219  bind(c, name="KIM_Model_SetParameterInteger")
1220  use, intrinsic :: iso_c_binding
1221  use kim_interoperable_types_module, only: kim_model_type
1222  implicit none
1223  type(kim_model_type), intent(in) :: model
1224  integer(c_int), intent(in), value :: parameter_index
1225  integer(c_int), intent(in), value :: array_index
1226  integer(c_int), intent(in), value :: parameter_value
1227  end function set_parameter_integer
1228  end interface
1229  type(kim_model_handle_type), intent(in) :: model_handle
1230  integer(c_int), intent(in) :: parameter_index
1231  integer(c_int), intent(in) :: array_index
1232  integer(c_int), intent(in) :: parameter_value
1233  integer(c_int), intent(out) :: ierr
1234  type(kim_model_type), pointer :: model
1235 
1236  call c_f_pointer(model_handle%p, model)
1237  ierr = set_parameter_integer(model, parameter_index - 1, array_index - 1, &
1238  parameter_value)
1239  end subroutine kim_model_set_parameter_integer
1240 
1246  recursive subroutine kim_model_set_parameter_double( &
1247  model_handle, parameter_index, array_index, parameter_value, ierr)
1248  use kim_interoperable_types_module, only: kim_model_type
1249  implicit none
1250  interface
1251  integer(c_int) recursive function set_parameter_double( &
1252  model, parameter_index, array_index, parameter_value) &
1253  bind(c, name="KIM_Model_SetParameterDouble")
1254  use, intrinsic :: iso_c_binding
1255  use kim_interoperable_types_module, only: kim_model_type
1256  implicit none
1257  type(kim_model_type), intent(in) :: model
1258  integer(c_int), intent(in), value :: parameter_index
1259  integer(c_int), intent(in), value :: array_index
1260  real(c_double), intent(in), value :: parameter_value
1261  end function set_parameter_double
1262  end interface
1263  type(kim_model_handle_type), intent(in) :: model_handle
1264  integer(c_int), intent(in) :: parameter_index
1265  integer(c_int), intent(in) :: array_index
1266  real(c_double), intent(in) :: parameter_value
1267  integer(c_int), intent(out) :: ierr
1268  type(kim_model_type), pointer :: model
1269 
1270  call c_f_pointer(model_handle%p, model)
1271  ierr = set_parameter_double(model, parameter_index - 1, array_index - 1, &
1272  parameter_value)
1273  end subroutine kim_model_set_parameter_double
1274 
1281  recursive subroutine kim_model_set_simulator_buffer_pointer(model_handle, ptr)
1282  use kim_interoperable_types_module, only: kim_model_type
1283  implicit none
1284  interface
1285  recursive subroutine set_simulator_buffer_pointer(model, ptr) &
1286  bind(c, name="KIM_Model_SetSimulatorBufferPointer")
1287  use, intrinsic :: iso_c_binding
1288  use kim_interoperable_types_module, only: kim_model_type
1289  implicit none
1290  type(kim_model_type), intent(in) :: model
1291  type(c_ptr), intent(in), value :: ptr
1292  end subroutine set_simulator_buffer_pointer
1293  end interface
1294  type(kim_model_handle_type), intent(in) :: model_handle
1295  type(c_ptr), intent(in) :: ptr
1296  type(kim_model_type), pointer :: model
1297 
1298  call c_f_pointer(model_handle%p, model)
1299  call set_simulator_buffer_pointer(model, ptr)
1301 
1308  recursive subroutine kim_model_get_simulator_buffer_pointer(model_handle, ptr)
1309  use kim_interoperable_types_module, only: kim_model_type
1310  implicit none
1311  interface
1312  recursive subroutine get_simulator_buffer_pointer(model, ptr) &
1313  bind(c, name="KIM_Model_GetSimulatorBufferPointer")
1314  use, intrinsic :: iso_c_binding
1315  use kim_interoperable_types_module, only: kim_model_type
1316  implicit none
1317  type(kim_model_type), intent(in) :: model
1318  type(c_ptr), intent(out) :: ptr
1319  end subroutine get_simulator_buffer_pointer
1320  end interface
1321  type(kim_model_handle_type), intent(in) :: model_handle
1322  type(c_ptr), intent(out) :: ptr
1323  type(kim_model_type), pointer :: model
1324 
1325  call c_f_pointer(model_handle%p, model)
1326  call get_simulator_buffer_pointer(model, ptr)
1328 
1334  recursive subroutine kim_model_to_string(model_handle, string)
1335  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
1336  use kim_interoperable_types_module, only: kim_model_type
1337  implicit none
1338  interface
1339  type(c_ptr) recursive function model_string(model) &
1340  bind(c, name="KIM_Model_ToString")
1341  use, intrinsic :: iso_c_binding
1342  use kim_interoperable_types_module, only: kim_model_type
1343  implicit none
1344  type(kim_model_type), intent(in) :: model
1345  end function model_string
1346  end interface
1347  type(kim_model_handle_type), intent(in) :: model_handle
1348  character(len=*, kind=c_char), intent(out) :: string
1349  type(kim_model_type), pointer :: model
1350 
1351  type(c_ptr) :: p
1352 
1353  call c_f_pointer(model_handle%p, model)
1354  p = model_string(model)
1355  call kim_convert_c_char_ptr_to_string(p, string)
1356  end subroutine kim_model_to_string
1357 
1363  recursive subroutine kim_model_set_log_id(model_handle, log_id)
1364  use kim_interoperable_types_module, only: kim_model_type
1365  implicit none
1366  interface
1367  recursive subroutine set_log_id(model, log_id) &
1368  bind(c, name="KIM_Model_SetLogID")
1369  use, intrinsic :: iso_c_binding
1370  use kim_interoperable_types_module, only: kim_model_type
1371  implicit none
1372  type(kim_model_type), intent(in) :: model
1373  character(c_char), intent(in) :: log_id(*)
1374  end subroutine set_log_id
1375  end interface
1376  type(kim_model_handle_type), intent(in) :: model_handle
1377  character(len=*, kind=c_char), intent(in) :: log_id
1378  type(kim_model_type), pointer :: model
1379 
1380  call c_f_pointer(model_handle%p, model)
1381  call set_log_id(model, trim(log_id)//c_null_char)
1382  end subroutine kim_model_set_log_id
1383 
1389  recursive subroutine kim_model_push_log_verbosity(model_handle, log_verbosity)
1390  use kim_log_verbosity_module, only: kim_log_verbosity_type
1391  use kim_interoperable_types_module, only: kim_model_type
1392  implicit none
1393  interface
1394  recursive subroutine push_log_verbosity(model, log_verbosity) &
1395  bind(c, name="KIM_Model_PushLogVerbosity")
1396  use, intrinsic :: iso_c_binding
1397  use kim_log_verbosity_module, only: kim_log_verbosity_type
1398  use kim_interoperable_types_module, only: kim_model_type
1399  implicit none
1400  type(kim_model_type), intent(in) :: model
1401  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
1402  end subroutine push_log_verbosity
1403  end interface
1404  type(kim_model_handle_type), intent(in) :: model_handle
1405  type(kim_log_verbosity_type), intent(in) :: log_verbosity
1406  type(kim_model_type), pointer :: model
1407 
1408  call c_f_pointer(model_handle%p, model)
1409  call push_log_verbosity(model, log_verbosity)
1410  end subroutine kim_model_push_log_verbosity
1411 
1417  recursive subroutine kim_model_pop_log_verbosity(model_handle)
1418  use kim_log_verbosity_module, only: kim_log_verbosity_type
1419  use kim_interoperable_types_module, only: kim_model_type
1420  implicit none
1421  interface
1422  recursive subroutine pop_log_verbosity(model) &
1423  bind(c, name="KIM_Model_PopLogVerbosity")
1424  use, intrinsic :: iso_c_binding
1425  use kim_log_verbosity_module, only: kim_log_verbosity_type
1426  use kim_interoperable_types_module, only: kim_model_type
1427  implicit none
1428  type(kim_model_type), intent(in) :: model
1429  end subroutine pop_log_verbosity
1430  end interface
1431  type(kim_model_handle_type), intent(in) :: model_handle
1432  type(kim_model_type), pointer :: model
1433 
1434  call c_f_pointer(model_handle%p, model)
1435  call pop_log_verbosity(model)
1436  end subroutine kim_model_pop_log_verbosity
1437 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.