kim-api  2.1.2+v2.1.2.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
kim_simulator_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-2.1.2 package.
31 !
32 
33 
40  use, intrinsic :: iso_c_binding
41  implicit none
42  private
43 
44  public &
45  ! Derived types
46  kim_simulator_model_handle_type, &
47 
48  ! Constants
50 
51  ! Routines
52  operator (.eq.), &
53  operator (.ne.), &
56  kim_get_simulator_name_and_version, &
57  kim_get_number_of_supported_species, &
58  kim_get_supported_species, &
59  kim_open_and_initialize_template_map, &
60  kim_template_map_is_open, &
61  kim_add_template_map, &
62  kim_close_template_map, &
63  kim_get_number_of_simulator_fields, &
64  kim_get_simulator_field_metadata, &
65  kim_get_simulator_field_line, &
66  kim_get_parameter_file_directory_name, &
67  kim_get_specification_file_name, &
68  kim_get_number_of_parameter_files, &
69  kim_get_parameter_file_name, &
70  kim_set_simulator_buffer_pointer, &
71  kim_get_simulator_buffer_pointer, &
72  kim_to_string, &
73  kim_set_log_id, &
74  kim_push_log_verbosity, &
75  kim_pop_log_verbosity
76 
77 
83  type, bind(c) :: kim_simulator_model_handle_type
84  type(c_ptr) :: p = c_null_ptr
85  end type kim_simulator_model_handle_type
86 
90  type(kim_simulator_model_handle_type), protected, save &
92 
96  interface operator (.eq.)
97  module procedure kim_simulator_model_handle_equal
98  end interface operator (.eq.)
99 
103  interface operator (.ne.)
104  module procedure kim_simulator_model_handle_not_equal
105  end interface operator (.ne.)
106 
113  interface kim_get_simulator_name_and_version
114  module procedure kim_simulator_model_get_simulator_name_and_version
115  end interface kim_get_simulator_name_and_version
116 
123  interface kim_get_number_of_supported_species
125  end interface kim_get_number_of_supported_species
126 
133  interface kim_get_supported_species
135  end interface kim_get_supported_species
136 
143  interface kim_open_and_initialize_template_map
145  end interface kim_open_and_initialize_template_map
146 
153  interface kim_template_map_is_open
155  end interface kim_template_map_is_open
156 
162  interface kim_add_template_map
163  module procedure kim_simulator_model_add_template_map
164  end interface kim_add_template_map
165 
172  interface kim_close_template_map
174  end interface kim_close_template_map
175 
182  interface kim_get_number_of_simulator_fields
184  end interface kim_get_number_of_simulator_fields
185 
192  interface kim_get_simulator_field_metadata
194  end interface kim_get_simulator_field_metadata
195 
202  interface kim_get_simulator_field_line
204  end interface kim_get_simulator_field_line
205 
212  interface kim_get_parameter_file_directory_name
214  end interface kim_get_parameter_file_directory_name
215 
222  interface kim_get_specification_file_name
224  end interface kim_get_specification_file_name
225 
232  interface kim_get_number_of_parameter_files
234  end interface kim_get_number_of_parameter_files
235 
242  interface kim_get_parameter_file_name
244  end interface kim_get_parameter_file_name
245 
252  interface kim_set_simulator_buffer_pointer
254  end interface kim_set_simulator_buffer_pointer
255 
262  interface kim_get_simulator_buffer_pointer
264  end interface kim_get_simulator_buffer_pointer
265 
271  interface kim_to_string
272  module procedure kim_simulator_model_to_string
273  end interface kim_to_string
274 
280  interface kim_set_log_id
281  module procedure kim_simulator_model_set_log_id
282  end interface kim_set_log_id
283 
290  interface kim_push_log_verbosity
292  end interface kim_push_log_verbosity
293 
299  interface kim_pop_log_verbosity
301  end interface kim_pop_log_verbosity
302 
303 contains
307  logical recursive function kim_simulator_model_handle_equal(lhs, rhs)
308  implicit none
309  type(kim_simulator_model_handle_type), intent(in) :: lhs
310  type(kim_simulator_model_handle_type), intent(in) :: rhs
311 
312  if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
313  kim_simulator_model_handle_equal = .true.
314  else
315  kim_simulator_model_handle_equal = c_associated(lhs%p, rhs%p)
316  end if
317  end function kim_simulator_model_handle_equal
318 
322  logical recursive function kim_simulator_model_handle_not_equal(lhs, rhs)
323  implicit none
324  type(kim_simulator_model_handle_type), intent(in) :: lhs
325  type(kim_simulator_model_handle_type), intent(in) :: rhs
326 
327  kim_simulator_model_handle_not_equal = .not. (lhs .eq. rhs)
328  end function kim_simulator_model_handle_not_equal
329 
335  recursive subroutine kim_simulator_model_create(simulator_model_name, &
336  simulator_model_handle, ierr)
337  implicit none
338  interface
339  integer(c_int) recursive function create(simulator_model_name, &
340  simulator_model) bind(c, name="KIM_SimulatorModel_Create")
341  use, intrinsic :: iso_c_binding
342  implicit none
343  character(c_char), intent(in) :: simulator_model_name(*)
344  type(c_ptr), intent(out) :: simulator_model
345  end function create
346  end interface
347  character(len=*, kind=c_char), intent(in) :: simulator_model_name
348  type(kim_simulator_model_handle_type), intent(out) :: simulator_model_handle
349  integer(c_int), intent(out) :: ierr
350 
351  type(c_ptr) :: psimulator_model
352 
353  ierr = create(trim(simulator_model_name)//c_null_char, psimulator_model)
354  simulator_model_handle%p = psimulator_model
355  end subroutine kim_simulator_model_create
356 
362  recursive subroutine kim_simulator_model_destroy(simulator_model_handle)
363  implicit none
364  interface
365  recursive subroutine destroy(simulator_model) &
366  bind(c, name="KIM_SimulatorModel_Destroy")
367  use, intrinsic :: iso_c_binding
368  implicit none
369  type(c_ptr), intent(inout) :: simulator_model
370  end subroutine destroy
371  end interface
372  type(kim_simulator_model_handle_type), intent(inout) :: &
373  simulator_model_handle
374 
375  type(c_ptr) :: psimulator_model
376  psimulator_model = simulator_model_handle%p
377  call destroy(psimulator_model)
378  simulator_model_handle%p = c_null_ptr
379  end subroutine kim_simulator_model_destroy
380 
387  recursive subroutine kim_simulator_model_get_simulator_name_and_version( &
388  simulator_model_handle, simulator_name, simulator_version)
389  use kim_interoperable_types_module, only : kim_simulator_model_type
390  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
391  implicit none
392  interface
393  recursive subroutine get_simulator_name_and_version(simulator_model, &
394  simulator_name, simulator_version) &
395  bind(c, name="KIM_SimulatorModel_GetSimulatorNameAndVersion")
396  use, intrinsic :: iso_c_binding
397  use kim_interoperable_types_module, only : kim_simulator_model_type
398  implicit none
399  type(kim_simulator_model_type), intent(in) :: simulator_model
400  type(c_ptr), intent(out) :: simulator_name
401  type(c_ptr), intent(out) :: simulator_version
402  end subroutine get_simulator_name_and_version
403  end interface
404  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
405  character(len=*, kind=c_char), intent(out) :: simulator_name
406  character(len=*, kind=c_char), intent(out) :: simulator_version
407  type(kim_simulator_model_type), pointer :: simulator_model
408 
409  type(c_ptr) psimulator_name, psimulator_version
410 
411  call c_f_pointer(simulator_model_handle%p, simulator_model)
412  call get_simulator_name_and_version(simulator_model, psimulator_name, &
413  psimulator_version)
414  call kim_convert_c_char_ptr_to_string(psimulator_name, simulator_name)
415  call kim_convert_c_char_ptr_to_string(psimulator_version, simulator_version)
416  end subroutine kim_simulator_model_get_simulator_name_and_version
417 
425  simulator_model_handle, number_of_supported_species)
426  use kim_interoperable_types_module, only : kim_simulator_model_type
427  implicit none
428  interface
429  recursive subroutine get_number_of_supported_species(simulator_model, &
430  number_of_supported_species) &
431  bind(c, name="KIM_SimulatorModel_GetNumberOfSupportedSpecies")
432  use, intrinsic :: iso_c_binding
433  use kim_interoperable_types_module, only : kim_simulator_model_type
434  implicit none
435  type(kim_simulator_model_type), intent(in) :: simulator_model
436  integer(c_int), intent(out) :: number_of_supported_species
437  end subroutine get_number_of_supported_species
438  end interface
439  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
440  integer(c_int), intent(out) :: number_of_supported_species
441  type(kim_simulator_model_type), pointer :: simulator_model
442 
443  call c_f_pointer(simulator_model_handle%p, simulator_model)
444  call get_number_of_supported_species(simulator_model, &
445  number_of_supported_species)
447 
454  recursive subroutine kim_simulator_model_get_supported_species( &
455  simulator_model_handle, index, species_name, ierr)
456  use kim_interoperable_types_module, only : kim_simulator_model_type
457  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
458  implicit none
459  interface
460  integer(c_int) recursive function get_supported_species(simulator_model, &
461  index, species_name) &
462  bind(c, name="KIM_SimulatorModel_GetSupportedSpecies")
463  use, intrinsic :: iso_c_binding
464  use kim_interoperable_types_module, only : kim_simulator_model_type
465  implicit none
466  type(kim_simulator_model_type), intent(in) :: simulator_model
467  integer(c_int), intent(in), value :: index
468  type(c_ptr), intent(out) :: species_name
469  end function get_supported_species
470  end interface
471  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
472  integer(c_int), intent(in) :: index
473  character(len=*, kind=c_char), intent(out) :: species_name
474  integer(c_int), intent(out) :: ierr
475  type(kim_simulator_model_type), pointer :: simulator_model
476 
477  type(c_ptr) pspecies_name
478 
479  call c_f_pointer(simulator_model_handle%p, simulator_model)
480  ierr = get_supported_species(simulator_model, index-1, pspecies_name)
481  call kim_convert_c_char_ptr_to_string(pspecies_name, species_name)
483 
491  simulator_model_handle)
492  use kim_interoperable_types_module, only : kim_simulator_model_type
493  implicit none
494  interface
495  recursive subroutine open_and_initialize_template_map(simulator_model) &
496  bind(c, name="KIM_SimulatorModel_OpenAndInitializeTemplateMap")
497  use, intrinsic :: iso_c_binding
498  use kim_interoperable_types_module, only : kim_simulator_model_type
499  implicit none
500  type(kim_simulator_model_type), intent(in) :: simulator_model
501  end subroutine open_and_initialize_template_map
502  end interface
503  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
504  type(kim_simulator_model_type), pointer :: simulator_model
505 
506  call c_f_pointer(simulator_model_handle%p, simulator_model)
507  call open_and_initialize_template_map(simulator_model)
509 
516  integer(c_int) recursive function kim_simulator_model_template_map_is_open( &
517  simulator_model_handle)
518  use kim_interoperable_types_module, only : kim_simulator_model_type
519  implicit none
520  interface
521  integer(c_int) recursive function template_map_is_open(simulator_model) &
522  bind(c, name="KIM_SimulatorModel_TemplateMapIsOpen")
523  use, intrinsic :: iso_c_binding
524  use kim_interoperable_types_module, only : kim_simulator_model_type
525  implicit none
526  type(kim_simulator_model_type), intent(in) :: simulator_model
527  end function template_map_is_open
528  end interface
529  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
530  type(kim_simulator_model_type), pointer :: simulator_model
531 
532  call c_f_pointer(simulator_model_handle%p, simulator_model)
533  kim_simulator_model_template_map_is_open = template_map_is_open( &
534  simulator_model)
536 
542  recursive subroutine kim_simulator_model_add_template_map( &
543  simulator_model_handle, key, value, ierr)
544  use kim_interoperable_types_module, only : kim_simulator_model_type
545  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
546  implicit none
547  interface
548  integer(c_int) recursive function add_template_map(simulator_model, key, &
549  value) bind(c, name="KIM_SimulatorModel_AddTemplateMap")
550  use, intrinsic :: iso_c_binding
551  use kim_interoperable_types_module, only : kim_simulator_model_type
552  implicit none
553  type(kim_simulator_model_type), intent(in) :: simulator_model
554  character(c_char), intent(in) :: key(*)
555  character(c_char), intent(in) :: value(*)
556  end function add_template_map
557  end interface
558  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
559  character(len=*, kind=c_char), intent(in) :: key
560  character(len=*, kind=c_char), intent(in) :: value
561  integer(c_int), intent(out) :: ierr
562  type(kim_simulator_model_type), pointer :: simulator_model
563 
564  call c_f_pointer(simulator_model_handle%p, simulator_model)
565  ierr = add_template_map(simulator_model, trim(key)//c_null_char, &
566  trim(value)//c_null_char)
568 
575  recursive subroutine kim_simulator_model_close_template_map( &
576  simulator_model_handle)
577  use kim_interoperable_types_module, only : kim_simulator_model_type
578  implicit none
579  interface
580  recursive subroutine close_template_map(simulator_model) &
581  bind(c, name="KIM_SimulatorModel_CloseTemplateMap")
582  use, intrinsic :: iso_c_binding
583  use kim_interoperable_types_module, only : kim_simulator_model_type
584  implicit none
585  type(kim_simulator_model_type), intent(in) :: simulator_model
586  end subroutine close_template_map
587  end interface
588  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
589  type(kim_simulator_model_type), pointer :: simulator_model
590 
591  call c_f_pointer(simulator_model_handle%p, simulator_model)
592  call close_template_map(simulator_model)
594 
602  simulator_model_handle, number_of_simulator_fields)
603  use kim_interoperable_types_module, only : kim_simulator_model_type
604  implicit none
605  interface
606  recursive subroutine get_number_of_simulator_fields(simulator_model, &
607  number_of_simulator_fields) &
608  bind(c, name="KIM_SimulatorModel_GetNumberOfSimulatorFields")
609  use, intrinsic :: iso_c_binding
610  use kim_interoperable_types_module, only : kim_simulator_model_type
611  implicit none
612  type(kim_simulator_model_type), intent(in) :: simulator_model
613  integer(c_int), intent(out) :: number_of_simulator_fields
614  end subroutine get_number_of_simulator_fields
615  end interface
616  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
617  integer(c_int), intent(out) :: number_of_simulator_fields
618  type(kim_simulator_model_type), pointer :: simulator_model
619 
620  call c_f_pointer(simulator_model_handle%p, simulator_model)
621  call get_number_of_simulator_fields(simulator_model, &
622  number_of_simulator_fields)
624 
632  simulator_model_handle, field_index, extent, field_name, ierr)
633  use kim_interoperable_types_module, only : kim_simulator_model_type
634  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
635  implicit none
636  interface
637  integer(c_int) recursive function get_simulator_field_metadata( &
638  simulator_model, field_index, extent, field_name) &
639  bind(c, name="KIM_SimulatorModel_GetSimulatorFieldMetadata")
640  use, intrinsic :: iso_c_binding
641  use kim_interoperable_types_module, only : kim_simulator_model_type
642  implicit none
643  type(kim_simulator_model_type), intent(in) :: simulator_model
644  integer(c_int), intent(in), value :: field_index
645  integer(c_int), intent(out) :: extent
646  type(c_ptr), intent(out) :: field_name
647  end function get_simulator_field_metadata
648  end interface
649  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
650  integer(c_int), intent(in) :: field_index
651  integer(c_int), intent(out) :: extent
652  character(len=*, kind=c_char), intent(out) :: field_name
653  integer(c_int), intent(out) :: ierr
654  type(kim_simulator_model_type), pointer :: simulator_model
655 
656  type(c_ptr) pfield_name
657 
658  call c_f_pointer(simulator_model_handle%p, simulator_model)
659  ierr = get_simulator_field_metadata(simulator_model, field_index-1, &
660  extent, pfield_name)
661  call kim_convert_c_char_ptr_to_string(pfield_name, field_name)
663 
670  recursive subroutine kim_simulator_model_get_simulator_field_line( &
671  simulator_model_handle, field_index, line_index, line_value, ierr)
672  use kim_interoperable_types_module, only : kim_simulator_model_type
673  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
674  implicit none
675  interface
676  integer(c_int) recursive function get_simulator_field_line( &
677  simulator_model, field_index, line_index, line_value) &
678  bind(c, name="KIM_SimulatorModel_GetSimulatorFieldLine")
679  use, intrinsic :: iso_c_binding
680  use kim_interoperable_types_module, only : kim_simulator_model_type
681  implicit none
682  type(kim_simulator_model_type), intent(in) :: simulator_model
683  integer(c_int), intent(in), value :: field_index
684  integer(c_int), intent(in), value :: line_index
685  type(c_ptr), intent(out) :: line_value
686  end function get_simulator_field_line
687  end interface
688  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
689  integer(c_int), intent(in), value :: field_index
690  integer(c_int), intent(in), value :: line_index
691  character(len=*, kind=c_char), intent(out) :: line_value
692  integer(c_int), intent(out) :: ierr
693  type(kim_simulator_model_type), pointer :: simulator_model
694 
695  type(c_ptr) pline_value
696 
697  call c_f_pointer(simulator_model_handle%p, simulator_model)
698  ierr = get_simulator_field_line(simulator_model, field_index-1, &
699  line_index-1, pline_value)
700  call kim_convert_c_char_ptr_to_string(pline_value, line_value)
702 
710  simulator_model_handle, directory_name)
711  use kim_interoperable_types_module, only : kim_simulator_model_type
712  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
713  implicit none
714  interface
715  recursive subroutine get_parameter_file_directory_name(simulator_model, &
716  directory_name) &
717  bind(c, name="KIM_SimulatorModel_GetParameterFileDirectoryName")
718  use, intrinsic :: iso_c_binding
719  use kim_interoperable_types_module, only : kim_simulator_model_type
720  implicit none
721  type(kim_simulator_model_type), intent(in) :: simulator_model
722  type(c_ptr), intent(out) :: directory_name
723  end subroutine get_parameter_file_directory_name
724  end interface
725  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
726  character(len=*, kind=c_char), intent(out) :: directory_name
727  type(kim_simulator_model_type), pointer :: simulator_model
728 
729  type(c_ptr) pdirectory_name
730 
731  call c_f_pointer(simulator_model_handle%p, simulator_model)
732  call get_parameter_file_directory_name(simulator_model, pdirectory_name)
733  call kim_convert_c_char_ptr_to_string(pdirectory_name, directory_name)
735 
743  simulator_model_handle, specification_file_name)
744  use kim_interoperable_types_module, only : kim_simulator_model_type
745  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
746  implicit none
747  interface
748  recursive subroutine get_specification_file_name(simulator_model, &
749  specification_file_name) &
750  bind(c, name="KIM_SimulatorModel_GetSpecificationFileName")
751  use, intrinsic :: iso_c_binding
752  use kim_interoperable_types_module, only : kim_simulator_model_type
753  implicit none
754  type(kim_simulator_model_type), intent(in) :: simulator_model
755  type(c_ptr), intent(out) :: specification_file_name
756  end subroutine get_specification_file_name
757  end interface
758  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
759  character(len=*, kind=c_char), intent(out) :: specification_file_name
760  type(kim_simulator_model_type), pointer :: simulator_model
761 
762  type(c_ptr) pspecification_file_name
763 
764  call c_f_pointer(simulator_model_handle%p, simulator_model)
765  call get_specification_file_name(simulator_model, pspecification_file_name)
766  call kim_convert_c_char_ptr_to_string(pspecification_file_name, &
767  specification_file_name)
769 
777  simulator_model_handle, number_of_parameter_files)
778  use kim_interoperable_types_module, only : kim_simulator_model_type
779  implicit none
780  interface
781  recursive subroutine get_number_of_parameter_files(simulator_model, &
782  number_of_parameter_files) &
783  bind(c, name="KIM_SimulatorModel_GetNumberOfParameterFiles")
784  use, intrinsic :: iso_c_binding
785  use kim_interoperable_types_module, only : kim_simulator_model_type
786  implicit none
787  type(kim_simulator_model_type), intent(in) :: simulator_model
788  integer(c_int), intent(out) :: number_of_parameter_files
789  end subroutine get_number_of_parameter_files
790  end interface
791  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
792  integer(c_int), intent(out) :: number_of_parameter_files
793  type(kim_simulator_model_type), pointer :: simulator_model
794 
795  call c_f_pointer(simulator_model_handle%p, simulator_model)
796  call get_number_of_parameter_files(simulator_model, &
797  number_of_parameter_files)
799 
806  recursive subroutine kim_simulator_model_get_parameter_file_name( &
807  simulator_model_handle, index, parameter_file_name, ierr)
808  use kim_interoperable_types_module, only : kim_simulator_model_type
809  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
810  implicit none
811  interface
812  integer(c_int) recursive function get_parameter_file_name( &
813  simulator_model, index, parameter_file_name) &
814  bind(c, name="KIM_SimulatorModel_GetParameterFileName")
815  use, intrinsic :: iso_c_binding
816  use kim_interoperable_types_module, only : kim_simulator_model_type
817  implicit none
818  type(kim_simulator_model_type), intent(in) :: simulator_model
819  integer(c_int), intent(in), value :: index
820  type(c_ptr), intent(out) :: parameter_file_name
821  end function get_parameter_file_name
822  end interface
823  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
824  integer(c_int), intent(in) :: index
825  character(len=*, kind=c_char), intent(out) :: parameter_file_name
826  integer(c_int), intent(out) :: ierr
827  type(kim_simulator_model_type), pointer :: simulator_model
828 
829  type(c_ptr) pparameter_file_name
830 
831  call c_f_pointer(simulator_model_handle%p, simulator_model)
832  ierr = get_parameter_file_name(simulator_model, index-1, &
833  pparameter_file_name)
834  call kim_convert_c_char_ptr_to_string(pparameter_file_name, &
835  parameter_file_name)
837 
845  simulator_model_handle, ptr)
846  use kim_interoperable_types_module, only : kim_simulator_model_type
847  implicit none
848  interface
849  recursive subroutine set_simulator_buffer_pointer(simulator_model, ptr) &
850  bind(c, name="KIM_SimulatorModel_SetSimulatorBufferPointer")
851  use, intrinsic :: iso_c_binding
852  use kim_interoperable_types_module, only : kim_simulator_model_type
853  implicit none
854  type(kim_simulator_model_type), intent(in) :: simulator_model
855  type(c_ptr), intent(in), value :: ptr
856  end subroutine set_simulator_buffer_pointer
857  end interface
858  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
859  type(c_ptr), intent(in) :: ptr
860  type(kim_simulator_model_type), pointer :: simulator_model
861 
862  call c_f_pointer(simulator_model_handle%p, simulator_model)
863  call set_simulator_buffer_pointer(simulator_model, ptr)
865 
873  simulator_model_handle, ptr)
874  use kim_interoperable_types_module, only : kim_simulator_model_type
875  implicit none
876  interface
877  recursive subroutine get_simulator_buffer_pointer(simulator_model, ptr) &
878  bind(c, name="KIM_SimulatorModel_GetSimulatorBufferPointer")
879  use, intrinsic :: iso_c_binding
880  use kim_interoperable_types_module, only : kim_simulator_model_type
881  implicit none
882  type(kim_simulator_model_type), intent(in) :: simulator_model
883  type(c_ptr), intent(out) :: ptr
884  end subroutine get_simulator_buffer_pointer
885  end interface
886  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
887  type(c_ptr), intent(out) :: ptr
888  type(kim_simulator_model_type), pointer :: simulator_model
889 
890  call c_f_pointer(simulator_model_handle%p, simulator_model)
891  call get_simulator_buffer_pointer(simulator_model, ptr)
893 
899  recursive subroutine kim_simulator_model_to_string(simulator_model_handle, &
900  string)
901  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
902  use kim_interoperable_types_module, only : kim_simulator_model_type
903  implicit none
904  interface
905  type(c_ptr) recursive function model_string(simulator_model) &
906  bind(c, name="KIM_SimulatorModel_ToString")
907  use, intrinsic :: iso_c_binding
908  use kim_interoperable_types_module, only : kim_simulator_model_type
909  implicit none
910  type(kim_simulator_model_type), intent(in) :: simulator_model
911  end function model_string
912  end interface
913  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
914  character(len=*, kind=c_char), intent(out) :: string
915  type(kim_simulator_model_type), pointer :: simulator_model
916 
917  type(c_ptr) :: p
918 
919  call c_f_pointer(simulator_model_handle%p, simulator_model)
920  p = model_string(simulator_model)
921  call kim_convert_c_char_ptr_to_string(p, string)
922  end subroutine kim_simulator_model_to_string
923 
929  recursive subroutine kim_simulator_model_set_log_id(simulator_model_handle, &
930  log_id)
931  use kim_interoperable_types_module, only : kim_simulator_model_type
932  implicit none
933  interface
934  recursive subroutine set_log_id(simulator_model, log_id) &
935  bind(c, name="KIM_SimulatorModel_SetLogID")
936  use, intrinsic :: iso_c_binding
937  use kim_interoperable_types_module, only : kim_simulator_model_type
938  implicit none
939  type(kim_simulator_model_type), intent(in) :: simulator_model
940  character(c_char), intent(in) :: log_id(*)
941  end subroutine set_log_id
942  end interface
943  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
944  character(len=*, kind=c_char), intent(in) :: log_id
945  type(kim_simulator_model_type), pointer :: simulator_model
946 
947  call c_f_pointer(simulator_model_handle%p, simulator_model)
948  call set_log_id(simulator_model, trim(log_id)//c_null_char)
949  end subroutine kim_simulator_model_set_log_id
950 
957  recursive subroutine kim_simulator_model_push_log_verbosity( &
958  simulator_model_handle, log_verbosity)
959  use kim_log_verbosity_module, only : kim_log_verbosity_type
960  use kim_interoperable_types_module, only : kim_simulator_model_type
961  implicit none
962  interface
963  recursive subroutine push_log_verbosity(simulator_model, log_verbosity) &
964  bind(c, name="KIM_SimulatorModel_PushLogVerbosity")
965  use, intrinsic :: iso_c_binding
966  use kim_log_verbosity_module, only : kim_log_verbosity_type
967  use kim_interoperable_types_module, only : kim_simulator_model_type
968  implicit none
969  type(kim_simulator_model_type), intent(in) :: simulator_model
970  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
971  end subroutine push_log_verbosity
972  end interface
973  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
974  type(kim_log_verbosity_type), intent(in) :: log_verbosity
975  type(kim_simulator_model_type), pointer :: simulator_model
976 
977  call c_f_pointer(simulator_model_handle%p, simulator_model)
978  call push_log_verbosity(simulator_model, log_verbosity)
980 
986  recursive subroutine kim_simulator_model_pop_log_verbosity( &
987  simulator_model_handle)
988  use kim_log_verbosity_module, only : kim_log_verbosity_type
989  use kim_interoperable_types_module, only : kim_simulator_model_type
990  implicit none
991  interface
992  recursive subroutine pop_log_verbosity(simulator_model) &
993  bind(c, name="KIM_SimulatorModel_PopLogVerbosity")
994  use, intrinsic :: iso_c_binding
995  use kim_log_verbosity_module, only : kim_log_verbosity_type
996  use kim_interoperable_types_module, only : kim_simulator_model_type
997  implicit none
998  type(kim_simulator_model_type), intent(in) :: simulator_model
999  end subroutine pop_log_verbosity
1000  end interface
1001  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
1002  type(kim_simulator_model_type), pointer :: simulator_model
1003 
1004  call c_f_pointer(simulator_model_handle%p, simulator_model)
1005  call pop_log_verbosity(simulator_model)
1007 end module kim_simulator_model_module
recursive subroutine, public kim_simulator_model_create(simulator_model_name, simulator_model_handle, ierr)
Create a new KIM API SimulatorModel object.
recursive subroutine kim_simulator_model_close_template_map(simulator_model_handle)
Close the template map and perform template substitutions.
recursive subroutine kim_simulator_model_get_number_of_parameter_files(simulator_model_handle, number_of_parameter_files)
Get the number of parameter files provided by the SimulatorModel.
recursive subroutine kim_simulator_model_set_simulator_buffer_pointer(simulator_model_handle, ptr)
Set the Simulator's buffer pointer within the SimulatorModel object.
recursive subroutine kim_simulator_model_push_log_verbosity(simulator_model_handle, log_verbosity)
Push a new LogVerbosity onto the SimulatorModel object's Log object verbosity stack.
integer(c_int) recursive function kim_simulator_model_template_map_is_open(simulator_model_handle)
Determine if the template map is open.
recursive subroutine kim_simulator_model_get_parameter_file_name(simulator_model_handle, index, parameter_file_name, ierr)
Get the basename (file name without path) of a particular parameter file. The file is located in the ...
recursive subroutine kim_simulator_model_get_number_of_simulator_fields(simulator_model_handle, number_of_simulator_fields)
Get the number of simulator fields provided by the SimulatorModel.
type(kim_simulator_model_handle_type), save, public, protected kim_simulator_model_null_handle
NULL handle for use in comparisons.
recursive subroutine kim_simulator_model_get_specification_file_name(simulator_model_handle, specification_file_name)
Get the SimulatorModel's specification file basename (file name without path). The file is located in...
Provides the primary interface to a KIM API SimulatorModel object and is meant to be used by simulato...
recursive subroutine kim_simulator_model_add_template_map(simulator_model_handle, key, value, ierr)
Add a new key-value entry to the template map.
recursive subroutine kim_simulator_model_get_simulator_buffer_pointer(simulator_model_handle, ptr)
Get the Simulator's buffer pointer from the SimulatorModel object.
recursive subroutine kim_simulator_model_set_log_id(simulator_model_handle, log_id)
Set the identity of the Log object associated with the SimulatorModel object.
recursive subroutine kim_simulator_model_pop_log_verbosity(simulator_model_handle)
Pop a LogVerbosity from the SimulatorModel object's Log object verbosity stack.
recursive subroutine kim_simulator_model_get_simulator_field_metadata(simulator_model_handle, field_index, extent, field_name, ierr)
Get the metadata for the simulator field of interest.
recursive subroutine, public kim_simulator_model_destroy(simulator_model_handle)
Destroy a previously SimulatorModel::Create'd object.
recursive subroutine kim_simulator_model_get_simulator_field_line(simulator_model_handle, field_index, line_index, line_value, ierr)
Get a line for the simulator field of interest with all template substitutions performed (Requires th...
recursive subroutine kim_simulator_model_get_number_of_supported_species(simulator_model_handle, number_of_supported_species)
Get the number of species supported by the SimulatorModel.
recursive subroutine kim_simulator_model_get_parameter_file_directory_name(simulator_model_handle, directory_name)
Get absolute path name of the temporary directory where parameter files provided by the simulator mod...
recursive subroutine kim_simulator_model_get_supported_species(simulator_model_handle, index, species_name, ierr)
Get a species name supported by the SimulatorModel.
recursive subroutine kim_simulator_model_to_string(simulator_model_handle, string)
Get a string representing the internal state of the SimulatorModel object.
recursive subroutine kim_simulator_model_open_and_initialize_template_map(simulator_model_handle)
Open and initialize the template map for simulator field line substitutions.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.