kim-api  2.2.1+v2.2.1.GNU.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--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_simulator_model_handle_type, &
46  ! Constants
48  ! Routines
49  operator(.eq.), &
50  operator(.ne.), &
53  kim_get_simulator_name_and_version, &
54  kim_get_number_of_supported_species, &
55  kim_get_supported_species, &
56  kim_open_and_initialize_template_map, &
57  kim_template_map_is_open, &
58  kim_add_template_map, &
59  kim_close_template_map, &
60  kim_get_number_of_simulator_fields, &
61  kim_get_simulator_field_metadata, &
62  kim_get_simulator_field_line, &
63  kim_get_parameter_file_directory_name, &
64  kim_get_specification_file_name, &
65  kim_get_number_of_parameter_files, &
66  kim_get_parameter_file_name, &
67  kim_get_parameter_file_basename, &
68  kim_set_simulator_buffer_pointer, &
69  kim_get_simulator_buffer_pointer, &
70  kim_to_string, &
71  kim_set_log_id, &
72  kim_push_log_verbosity, &
73  kim_pop_log_verbosity
74 
80  type, bind(c) :: kim_simulator_model_handle_type
81  type(c_ptr) :: p = c_null_ptr
82  end type kim_simulator_model_handle_type
83 
87  type(kim_simulator_model_handle_type), protected, save &
89 
93  interface operator(.eq.)
94  module procedure kim_simulator_model_handle_equal
95  end interface operator(.eq.)
96 
100  interface operator(.ne.)
101  module procedure kim_simulator_model_handle_not_equal
102  end interface operator(.ne.)
103 
110  interface kim_get_simulator_name_and_version
111  module procedure kim_simulator_model_get_simulator_name_and_version
112  end interface kim_get_simulator_name_and_version
113 
120  interface kim_get_number_of_supported_species
122  end interface kim_get_number_of_supported_species
123 
130  interface kim_get_supported_species
132  end interface kim_get_supported_species
133 
140  interface kim_open_and_initialize_template_map
142  end interface kim_open_and_initialize_template_map
143 
150  interface kim_template_map_is_open
152  end interface kim_template_map_is_open
153 
159  interface kim_add_template_map
160  module procedure kim_simulator_model_add_template_map
161  end interface kim_add_template_map
162 
169  interface kim_close_template_map
171  end interface kim_close_template_map
172 
179  interface kim_get_number_of_simulator_fields
181  end interface kim_get_number_of_simulator_fields
182 
189  interface kim_get_simulator_field_metadata
191  end interface kim_get_simulator_field_metadata
192 
199  interface kim_get_simulator_field_line
201  end interface kim_get_simulator_field_line
202 
209  interface kim_get_parameter_file_directory_name
211  end interface kim_get_parameter_file_directory_name
212 
219  interface kim_get_specification_file_name
221  end interface kim_get_specification_file_name
222 
229  interface kim_get_number_of_parameter_files
231  end interface kim_get_number_of_parameter_files
232 
242  interface kim_get_parameter_file_name
244  end interface kim_get_parameter_file_name
245 
252  interface kim_get_parameter_file_basename
254  end interface kim_get_parameter_file_basename
255 
262  interface kim_set_simulator_buffer_pointer
264  end interface kim_set_simulator_buffer_pointer
265 
272  interface kim_get_simulator_buffer_pointer
274  end interface kim_get_simulator_buffer_pointer
275 
281  interface kim_to_string
282  module procedure kim_simulator_model_to_string
283  end interface kim_to_string
284 
290  interface kim_set_log_id
291  module procedure kim_simulator_model_set_log_id
292  end interface kim_set_log_id
293 
300  interface kim_push_log_verbosity
302  end interface kim_push_log_verbosity
303 
309  interface kim_pop_log_verbosity
311  end interface kim_pop_log_verbosity
312 
313 contains
317  logical recursive function kim_simulator_model_handle_equal(lhs, rhs)
318  implicit none
319  type(kim_simulator_model_handle_type), intent(in) :: lhs
320  type(kim_simulator_model_handle_type), intent(in) :: rhs
321 
322  if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
323  kim_simulator_model_handle_equal = .true.
324  else
325  kim_simulator_model_handle_equal = c_associated(lhs%p, rhs%p)
326  end if
327  end function kim_simulator_model_handle_equal
328 
332  logical recursive function kim_simulator_model_handle_not_equal(lhs, rhs)
333  implicit none
334  type(kim_simulator_model_handle_type), intent(in) :: lhs
335  type(kim_simulator_model_handle_type), intent(in) :: rhs
336 
337  kim_simulator_model_handle_not_equal = .not. (lhs == rhs)
338  end function kim_simulator_model_handle_not_equal
339 
345  recursive subroutine kim_simulator_model_create(simulator_model_name, &
346  simulator_model_handle, ierr)
347  implicit none
348  interface
349  integer(c_int) recursive function create( &
350  simulator_model_name, simulator_model) &
351  bind(c, name="KIM_SimulatorModel_Create")
352  use, intrinsic :: iso_c_binding
353  implicit none
354  character(c_char), intent(in) :: simulator_model_name(*)
355  type(c_ptr), intent(out) :: simulator_model
356  end function create
357  end interface
358  character(len=*, kind=c_char), intent(in) :: simulator_model_name
359  type(kim_simulator_model_handle_type), intent(out) :: simulator_model_handle
360  integer(c_int), intent(out) :: ierr
361 
362  type(c_ptr) :: psimulator_model
363 
364  ierr = create(trim(simulator_model_name)//c_null_char, psimulator_model)
365  simulator_model_handle%p = psimulator_model
366  end subroutine kim_simulator_model_create
367 
373  recursive subroutine kim_simulator_model_destroy(simulator_model_handle)
374  implicit none
375  interface
376  recursive subroutine destroy(simulator_model) &
377  bind(c, name="KIM_SimulatorModel_Destroy")
378  use, intrinsic :: iso_c_binding
379  implicit none
380  type(c_ptr), intent(inout) :: simulator_model
381  end subroutine destroy
382  end interface
383  type(kim_simulator_model_handle_type), intent(inout) :: &
384  simulator_model_handle
385 
386  type(c_ptr) :: psimulator_model
387  psimulator_model = simulator_model_handle%p
388  call destroy(psimulator_model)
389  simulator_model_handle%p = c_null_ptr
390  end subroutine kim_simulator_model_destroy
391 
398  recursive subroutine kim_simulator_model_get_simulator_name_and_version( &
399  simulator_model_handle, simulator_name, simulator_version)
400  use kim_interoperable_types_module, only: kim_simulator_model_type
401  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
402  implicit none
403  interface
404  recursive subroutine get_simulator_name_and_version( &
405  simulator_model, simulator_name, simulator_version) &
406  bind(c, name="KIM_SimulatorModel_GetSimulatorNameAndVersion")
407  use, intrinsic :: iso_c_binding
408  use kim_interoperable_types_module, only: kim_simulator_model_type
409  implicit none
410  type(kim_simulator_model_type), intent(in) :: simulator_model
411  type(c_ptr), intent(out) :: simulator_name
412  type(c_ptr), intent(out) :: simulator_version
413  end subroutine get_simulator_name_and_version
414  end interface
415  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
416  character(len=*, kind=c_char), intent(out) :: simulator_name
417  character(len=*, kind=c_char), intent(out) :: simulator_version
418  type(kim_simulator_model_type), pointer :: simulator_model
419 
420  type(c_ptr) psimulator_name, psimulator_version
421 
422  call c_f_pointer(simulator_model_handle%p, simulator_model)
423  call get_simulator_name_and_version(simulator_model, psimulator_name, &
424  psimulator_version)
425  call kim_convert_c_char_ptr_to_string(psimulator_name, simulator_name)
426  call kim_convert_c_char_ptr_to_string(psimulator_version, simulator_version)
427  end subroutine kim_simulator_model_get_simulator_name_and_version
428 
436  simulator_model_handle, number_of_supported_species)
437  use kim_interoperable_types_module, only: kim_simulator_model_type
438  implicit none
439  interface
440  recursive subroutine get_number_of_supported_species( &
441  simulator_model, number_of_supported_species) &
442  bind(c, name="KIM_SimulatorModel_GetNumberOfSupportedSpecies")
443  use, intrinsic :: iso_c_binding
444  use kim_interoperable_types_module, only: kim_simulator_model_type
445  implicit none
446  type(kim_simulator_model_type), intent(in) :: simulator_model
447  integer(c_int), intent(out) :: number_of_supported_species
448  end subroutine get_number_of_supported_species
449  end interface
450  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
451  integer(c_int), intent(out) :: number_of_supported_species
452  type(kim_simulator_model_type), pointer :: simulator_model
453 
454  call c_f_pointer(simulator_model_handle%p, simulator_model)
455  call get_number_of_supported_species(simulator_model, &
456  number_of_supported_species)
458 
465  recursive subroutine kim_simulator_model_get_supported_species( &
466  simulator_model_handle, index, species_name, ierr)
467  use kim_interoperable_types_module, only: kim_simulator_model_type
468  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
469  implicit none
470  interface
471  integer(c_int) recursive function get_supported_species( &
472  simulator_model, index, species_name) &
473  bind(c, name="KIM_SimulatorModel_GetSupportedSpecies")
474  use, intrinsic :: iso_c_binding
475  use kim_interoperable_types_module, only: kim_simulator_model_type
476  implicit none
477  type(kim_simulator_model_type), intent(in) :: simulator_model
478  integer(c_int), intent(in), value :: index
479  type(c_ptr), intent(out) :: species_name
480  end function get_supported_species
481  end interface
482  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
483  integer(c_int), intent(in) :: index
484  character(len=*, kind=c_char), intent(out) :: species_name
485  integer(c_int), intent(out) :: ierr
486  type(kim_simulator_model_type), pointer :: simulator_model
487 
488  type(c_ptr) pspecies_name
489 
490  call c_f_pointer(simulator_model_handle%p, simulator_model)
491  ierr = get_supported_species(simulator_model, index - 1, pspecies_name)
492  call kim_convert_c_char_ptr_to_string(pspecies_name, species_name)
494 
502  simulator_model_handle)
503  use kim_interoperable_types_module, only: kim_simulator_model_type
504  implicit none
505  interface
506  recursive subroutine open_and_initialize_template_map(simulator_model) &
507  bind(c, name="KIM_SimulatorModel_OpenAndInitializeTemplateMap")
508  use, intrinsic :: iso_c_binding
509  use kim_interoperable_types_module, only: kim_simulator_model_type
510  implicit none
511  type(kim_simulator_model_type), intent(in) :: simulator_model
512  end subroutine open_and_initialize_template_map
513  end interface
514  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
515  type(kim_simulator_model_type), pointer :: simulator_model
516 
517  call c_f_pointer(simulator_model_handle%p, simulator_model)
518  call open_and_initialize_template_map(simulator_model)
520 
527  integer(c_int) recursive function kim_simulator_model_template_map_is_open( &
528  simulator_model_handle)
529  use kim_interoperable_types_module, only: kim_simulator_model_type
530  implicit none
531  interface
532  integer(c_int) recursive function template_map_is_open(simulator_model) &
533  bind(c, name="KIM_SimulatorModel_TemplateMapIsOpen")
534  use, intrinsic :: iso_c_binding
535  use kim_interoperable_types_module, only: kim_simulator_model_type
536  implicit none
537  type(kim_simulator_model_type), intent(in) :: simulator_model
538  end function template_map_is_open
539  end interface
540  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
541  type(kim_simulator_model_type), pointer :: simulator_model
542 
543  call c_f_pointer(simulator_model_handle%p, simulator_model)
544  kim_simulator_model_template_map_is_open = template_map_is_open( &
545  simulator_model)
547 
553  recursive subroutine kim_simulator_model_add_template_map( &
554  simulator_model_handle, key, value, ierr)
555  use kim_interoperable_types_module, only: kim_simulator_model_type
556  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
557  implicit none
558  interface
559  integer(c_int) recursive function add_template_map( &
560  simulator_model, key, value) &
561  bind(c, name="KIM_SimulatorModel_AddTemplateMap")
562  use, intrinsic :: iso_c_binding
563  use kim_interoperable_types_module, only: kim_simulator_model_type
564  implicit none
565  type(kim_simulator_model_type), intent(in) :: simulator_model
566  character(c_char), intent(in) :: key(*)
567  character(c_char), intent(in) :: value(*)
568  end function add_template_map
569  end interface
570  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
571  character(len=*, kind=c_char), intent(in) :: key
572  character(len=*, kind=c_char), intent(in) :: value
573  integer(c_int), intent(out) :: ierr
574  type(kim_simulator_model_type), pointer :: simulator_model
575 
576  call c_f_pointer(simulator_model_handle%p, simulator_model)
577  ierr = add_template_map(simulator_model, trim(key)//c_null_char, &
578  trim(value)//c_null_char)
580 
587  recursive subroutine kim_simulator_model_close_template_map( &
588  simulator_model_handle)
589  use kim_interoperable_types_module, only: kim_simulator_model_type
590  implicit none
591  interface
592  recursive subroutine close_template_map(simulator_model) &
593  bind(c, name="KIM_SimulatorModel_CloseTemplateMap")
594  use, intrinsic :: iso_c_binding
595  use kim_interoperable_types_module, only: kim_simulator_model_type
596  implicit none
597  type(kim_simulator_model_type), intent(in) :: simulator_model
598  end subroutine close_template_map
599  end interface
600  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
601  type(kim_simulator_model_type), pointer :: simulator_model
602 
603  call c_f_pointer(simulator_model_handle%p, simulator_model)
604  call close_template_map(simulator_model)
606 
614  simulator_model_handle, number_of_simulator_fields)
615  use kim_interoperable_types_module, only: kim_simulator_model_type
616  implicit none
617  interface
618  recursive subroutine get_number_of_simulator_fields( &
619  simulator_model, number_of_simulator_fields) &
620  bind(c, name="KIM_SimulatorModel_GetNumberOfSimulatorFields")
621  use, intrinsic :: iso_c_binding
622  use kim_interoperable_types_module, only: kim_simulator_model_type
623  implicit none
624  type(kim_simulator_model_type), intent(in) :: simulator_model
625  integer(c_int), intent(out) :: number_of_simulator_fields
626  end subroutine get_number_of_simulator_fields
627  end interface
628  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
629  integer(c_int), intent(out) :: number_of_simulator_fields
630  type(kim_simulator_model_type), pointer :: simulator_model
631 
632  call c_f_pointer(simulator_model_handle%p, simulator_model)
633  call get_number_of_simulator_fields(simulator_model, &
634  number_of_simulator_fields)
636 
644  simulator_model_handle, field_index, extent, field_name, ierr)
645  use kim_interoperable_types_module, only: kim_simulator_model_type
646  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
647  implicit none
648  interface
649  integer(c_int) recursive function get_simulator_field_metadata( &
650  simulator_model, field_index, extent, field_name) &
651  bind(c, name="KIM_SimulatorModel_GetSimulatorFieldMetadata")
652  use, intrinsic :: iso_c_binding
653  use kim_interoperable_types_module, only: kim_simulator_model_type
654  implicit none
655  type(kim_simulator_model_type), intent(in) :: simulator_model
656  integer(c_int), intent(in), value :: field_index
657  integer(c_int), intent(out) :: extent
658  type(c_ptr), intent(out) :: field_name
659  end function get_simulator_field_metadata
660  end interface
661  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
662  integer(c_int), intent(in) :: field_index
663  integer(c_int), intent(out) :: extent
664  character(len=*, kind=c_char), intent(out) :: field_name
665  integer(c_int), intent(out) :: ierr
666  type(kim_simulator_model_type), pointer :: simulator_model
667 
668  type(c_ptr) pfield_name
669 
670  call c_f_pointer(simulator_model_handle%p, simulator_model)
671  ierr = get_simulator_field_metadata(simulator_model, field_index - 1, &
672  extent, pfield_name)
673  call kim_convert_c_char_ptr_to_string(pfield_name, field_name)
675 
682  recursive subroutine kim_simulator_model_get_simulator_field_line( &
683  simulator_model_handle, field_index, line_index, line_value, ierr)
684  use kim_interoperable_types_module, only: kim_simulator_model_type
685  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
686  implicit none
687  interface
688  integer(c_int) recursive function get_simulator_field_line( &
689  simulator_model, field_index, line_index, line_value) &
690  bind(c, name="KIM_SimulatorModel_GetSimulatorFieldLine")
691  use, intrinsic :: iso_c_binding
692  use kim_interoperable_types_module, only: kim_simulator_model_type
693  implicit none
694  type(kim_simulator_model_type), intent(in) :: simulator_model
695  integer(c_int), intent(in), value :: field_index
696  integer(c_int), intent(in), value :: line_index
697  type(c_ptr), intent(out) :: line_value
698  end function get_simulator_field_line
699  end interface
700  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
701  integer(c_int), intent(in), value :: field_index
702  integer(c_int), intent(in), value :: line_index
703  character(len=*, kind=c_char), intent(out) :: line_value
704  integer(c_int), intent(out) :: ierr
705  type(kim_simulator_model_type), pointer :: simulator_model
706 
707  type(c_ptr) pline_value
708 
709  call c_f_pointer(simulator_model_handle%p, simulator_model)
710  ierr = get_simulator_field_line(simulator_model, field_index - 1, &
711  line_index - 1, pline_value)
712  call kim_convert_c_char_ptr_to_string(pline_value, line_value)
714 
722  simulator_model_handle, directory_name)
723  use kim_interoperable_types_module, only: kim_simulator_model_type
724  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
725  implicit none
726  interface
727  recursive subroutine get_parameter_file_directory_name(simulator_model, &
728  directory_name) &
729  bind(c, name="KIM_SimulatorModel_GetParameterFileDirectoryName")
730  use, intrinsic :: iso_c_binding
731  use kim_interoperable_types_module, only: kim_simulator_model_type
732  implicit none
733  type(kim_simulator_model_type), intent(in) :: simulator_model
734  type(c_ptr), intent(out) :: directory_name
735  end subroutine get_parameter_file_directory_name
736  end interface
737  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
738  character(len=*, kind=c_char), intent(out) :: directory_name
739  type(kim_simulator_model_type), pointer :: simulator_model
740 
741  type(c_ptr) pdirectory_name
742 
743  call c_f_pointer(simulator_model_handle%p, simulator_model)
744  call get_parameter_file_directory_name(simulator_model, pdirectory_name)
745  call kim_convert_c_char_ptr_to_string(pdirectory_name, directory_name)
747 
755  simulator_model_handle, specification_file_name)
756  use kim_interoperable_types_module, only: kim_simulator_model_type
757  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
758  implicit none
759  interface
760  recursive subroutine get_specification_file_name( &
761  simulator_model, specification_file_name) &
762  bind(c, name="KIM_SimulatorModel_GetSpecificationFileName")
763  use, intrinsic :: iso_c_binding
764  use kim_interoperable_types_module, only: kim_simulator_model_type
765  implicit none
766  type(kim_simulator_model_type), intent(in) :: simulator_model
767  type(c_ptr), intent(out) :: specification_file_name
768  end subroutine get_specification_file_name
769  end interface
770  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
771  character(len=*, kind=c_char), intent(out) :: specification_file_name
772  type(kim_simulator_model_type), pointer :: simulator_model
773 
774  type(c_ptr) pspecification_file_name
775 
776  call c_f_pointer(simulator_model_handle%p, simulator_model)
777  call get_specification_file_name(simulator_model, pspecification_file_name)
778  call kim_convert_c_char_ptr_to_string(pspecification_file_name, &
779  specification_file_name)
781 
789  simulator_model_handle, number_of_parameter_files)
790  use kim_interoperable_types_module, only: kim_simulator_model_type
791  implicit none
792  interface
793  recursive subroutine get_number_of_parameter_files( &
794  simulator_model, number_of_parameter_files) &
795  bind(c, name="KIM_SimulatorModel_GetNumberOfParameterFiles")
796  use, intrinsic :: iso_c_binding
797  use kim_interoperable_types_module, only: kim_simulator_model_type
798  implicit none
799  type(kim_simulator_model_type), intent(in) :: simulator_model
800  integer(c_int), intent(out) :: number_of_parameter_files
801  end subroutine get_number_of_parameter_files
802  end interface
803  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
804  integer(c_int), intent(out) :: number_of_parameter_files
805  type(kim_simulator_model_type), pointer :: simulator_model
806 
807  call c_f_pointer(simulator_model_handle%p, simulator_model)
808  call get_number_of_parameter_files(simulator_model, &
809  number_of_parameter_files)
811 
821  recursive subroutine kim_simulator_model_get_parameter_file_name( &
822  simulator_model_handle, index, parameter_file_name, ierr)
823  use kim_interoperable_types_module, only: kim_simulator_model_type
824  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
825  implicit none
826  interface
827  integer(c_int) recursive function get_parameter_file_name( &
828  simulator_model, index, parameter_file_name) &
829  bind(c, name="KIM_SimulatorModel_GetParameterFileName")
830  use, intrinsic :: iso_c_binding
831  use kim_interoperable_types_module, only: kim_simulator_model_type
832  implicit none
833  type(kim_simulator_model_type), intent(in) :: simulator_model
834  integer(c_int), intent(in), value :: index
835  type(c_ptr), intent(out) :: parameter_file_name
836  end function get_parameter_file_name
837  end interface
838  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
839  integer(c_int), intent(in) :: index
840  character(len=*, kind=c_char), intent(out) :: parameter_file_name
841  integer(c_int), intent(out) :: ierr
842  type(kim_simulator_model_type), pointer :: simulator_model
843 
844  type(c_ptr) pparameter_file_name
845 
846  call c_f_pointer(simulator_model_handle%p, simulator_model)
847  ierr = get_parameter_file_name(simulator_model, index - 1, &
848  pparameter_file_name)
849  call kim_convert_c_char_ptr_to_string(pparameter_file_name, &
850  parameter_file_name)
852 
860  simulator_model_handle, index, parameter_file_basename, ierr)
861  use kim_interoperable_types_module, only: kim_simulator_model_type
862  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
863  implicit none
864  interface
865  integer(c_int) recursive function get_parameter_file_basename( &
866  simulator_model, index, parameter_file_basename) &
867  bind(c, name="KIM_SimulatorModel_GetParameterFileBasename")
868  use, intrinsic :: iso_c_binding
869  use kim_interoperable_types_module, only: kim_simulator_model_type
870  implicit none
871  type(kim_simulator_model_type), intent(in) :: simulator_model
872  integer(c_int), intent(in), value :: index
873  type(c_ptr), intent(out) :: parameter_file_basename
874  end function get_parameter_file_basename
875  end interface
876  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
877  integer(c_int), intent(in) :: index
878  character(len=*, kind=c_char), intent(out) :: parameter_file_basename
879  integer(c_int), intent(out) :: ierr
880  type(kim_simulator_model_type), pointer :: simulator_model
881 
882  type(c_ptr) pparameter_file_basename
883 
884  call c_f_pointer(simulator_model_handle%p, simulator_model)
885  ierr = get_parameter_file_basename(simulator_model, index - 1, &
886  pparameter_file_basename)
887  call kim_convert_c_char_ptr_to_string(pparameter_file_basename, &
888  parameter_file_basename)
890 
898  simulator_model_handle, ptr)
899  use kim_interoperable_types_module, only: kim_simulator_model_type
900  implicit none
901  interface
902  recursive subroutine set_simulator_buffer_pointer(simulator_model, ptr) &
903  bind(c, name="KIM_SimulatorModel_SetSimulatorBufferPointer")
904  use, intrinsic :: iso_c_binding
905  use kim_interoperable_types_module, only: kim_simulator_model_type
906  implicit none
907  type(kim_simulator_model_type), intent(in) :: simulator_model
908  type(c_ptr), intent(in), value :: ptr
909  end subroutine set_simulator_buffer_pointer
910  end interface
911  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
912  type(c_ptr), intent(in) :: ptr
913  type(kim_simulator_model_type), pointer :: simulator_model
914 
915  call c_f_pointer(simulator_model_handle%p, simulator_model)
916  call set_simulator_buffer_pointer(simulator_model, ptr)
918 
926  simulator_model_handle, ptr)
927  use kim_interoperable_types_module, only: kim_simulator_model_type
928  implicit none
929  interface
930  recursive subroutine get_simulator_buffer_pointer(simulator_model, ptr) &
931  bind(c, name="KIM_SimulatorModel_GetSimulatorBufferPointer")
932  use, intrinsic :: iso_c_binding
933  use kim_interoperable_types_module, only: kim_simulator_model_type
934  implicit none
935  type(kim_simulator_model_type), intent(in) :: simulator_model
936  type(c_ptr), intent(out) :: ptr
937  end subroutine get_simulator_buffer_pointer
938  end interface
939  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
940  type(c_ptr), intent(out) :: ptr
941  type(kim_simulator_model_type), pointer :: simulator_model
942 
943  call c_f_pointer(simulator_model_handle%p, simulator_model)
944  call get_simulator_buffer_pointer(simulator_model, ptr)
946 
952  recursive subroutine kim_simulator_model_to_string(simulator_model_handle, &
953  string)
954  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
955  use kim_interoperable_types_module, only: kim_simulator_model_type
956  implicit none
957  interface
958  type(c_ptr) recursive function model_string(simulator_model) &
959  bind(c, name="KIM_SimulatorModel_ToString")
960  use, intrinsic :: iso_c_binding
961  use kim_interoperable_types_module, only: kim_simulator_model_type
962  implicit none
963  type(kim_simulator_model_type), intent(in) :: simulator_model
964  end function model_string
965  end interface
966  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
967  character(len=*, kind=c_char), intent(out) :: string
968  type(kim_simulator_model_type), pointer :: simulator_model
969 
970  type(c_ptr) :: p
971 
972  call c_f_pointer(simulator_model_handle%p, simulator_model)
973  p = model_string(simulator_model)
974  call kim_convert_c_char_ptr_to_string(p, string)
975  end subroutine kim_simulator_model_to_string
976 
982  recursive subroutine kim_simulator_model_set_log_id(simulator_model_handle, &
983  log_id)
984  use kim_interoperable_types_module, only: kim_simulator_model_type
985  implicit none
986  interface
987  recursive subroutine set_log_id(simulator_model, log_id) &
988  bind(c, name="KIM_SimulatorModel_SetLogID")
989  use, intrinsic :: iso_c_binding
990  use kim_interoperable_types_module, only: kim_simulator_model_type
991  implicit none
992  type(kim_simulator_model_type), intent(in) :: simulator_model
993  character(c_char), intent(in) :: log_id(*)
994  end subroutine set_log_id
995  end interface
996  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
997  character(len=*, kind=c_char), intent(in) :: log_id
998  type(kim_simulator_model_type), pointer :: simulator_model
999 
1000  call c_f_pointer(simulator_model_handle%p, simulator_model)
1001  call set_log_id(simulator_model, trim(log_id)//c_null_char)
1002  end subroutine kim_simulator_model_set_log_id
1003 
1010  recursive subroutine kim_simulator_model_push_log_verbosity( &
1011  simulator_model_handle, log_verbosity)
1012  use kim_log_verbosity_module, only: kim_log_verbosity_type
1013  use kim_interoperable_types_module, only: kim_simulator_model_type
1014  implicit none
1015  interface
1016  recursive subroutine push_log_verbosity(simulator_model, log_verbosity) &
1017  bind(c, name="KIM_SimulatorModel_PushLogVerbosity")
1018  use, intrinsic :: iso_c_binding
1019  use kim_log_verbosity_module, only: kim_log_verbosity_type
1020  use kim_interoperable_types_module, only: kim_simulator_model_type
1021  implicit none
1022  type(kim_simulator_model_type), intent(in) :: simulator_model
1023  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
1024  end subroutine push_log_verbosity
1025  end interface
1026  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
1027  type(kim_log_verbosity_type), intent(in) :: log_verbosity
1028  type(kim_simulator_model_type), pointer :: simulator_model
1029 
1030  call c_f_pointer(simulator_model_handle%p, simulator_model)
1031  call push_log_verbosity(simulator_model, log_verbosity)
1033 
1039  recursive subroutine kim_simulator_model_pop_log_verbosity( &
1040  simulator_model_handle)
1041  use kim_log_verbosity_module, only: kim_log_verbosity_type
1042  use kim_interoperable_types_module, only: kim_simulator_model_type
1043  implicit none
1044  interface
1045  recursive subroutine pop_log_verbosity(simulator_model) &
1046  bind(c, name="KIM_SimulatorModel_PopLogVerbosity")
1047  use, intrinsic :: iso_c_binding
1048  use kim_log_verbosity_module, only: kim_log_verbosity_type
1049  use kim_interoperable_types_module, only: kim_simulator_model_type
1050  implicit none
1051  type(kim_simulator_model_type), intent(in) :: simulator_model
1052  end subroutine pop_log_verbosity
1053  end interface
1054  type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
1055  type(kim_simulator_model_type), pointer :: simulator_model
1056 
1057  call c_f_pointer(simulator_model_handle%p, simulator_model)
1058  call pop_log_verbosity(simulator_model)
1060 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_basename(simulator_model_handle, index, parameter_file_basename, 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_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.