kim-api 2.3.0+AppleClang.AppleClang.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
Loading...
Searching...
No Matches
kim_simulator_model_module.f90
Go to the documentation of this file.
1!
2! KIM-API: An API for interatomic models
3! Copyright (c) 2013--2022, Regents of the University of Minnesota.
4! All rights reserved.
5!
6! Contributors:
7! Ryan S. Elliott
8!
9! SPDX-License-Identifier: LGPL-2.1-or-later
10!
11! This library is free software; you can redistribute it and/or
12! modify it under the terms of the GNU Lesser General Public
13! License as published by the Free Software Foundation; either
14! version 2.1 of the License, or (at your option) any later version.
15!
16! This library is distributed in the hope that it will be useful,
17! but WITHOUT ANY WARRANTY; without even the implied warranty of
18! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19! Lesser General Public License for more details.
20!
21! You should have received a copy of the GNU Lesser General Public License
22! along with this library; if not, write to the Free Software Foundation,
23! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24!
25
26!
27! Release: This file is part of the kim-api-2.3.0 package.
28!
29
36 use, intrinsic :: iso_c_binding
37 implicit none
38 private
39
40 public &
41 ! Derived types
43 ! Constants
45 ! Routines
46 operator(.eq.), &
47 operator(.ne.), &
71
77 type, bind(c) :: kim_simulator_model_handle_type
78 type(c_ptr) :: p = c_null_ptr
80
84 type(kim_simulator_model_handle_type), protected, save &
86
90 interface operator(.eq.)
91 module procedure kim_simulator_model_handle_equal
92 end interface operator(.eq.)
93
97 interface operator(.ne.)
98 module procedure kim_simulator_model_handle_not_equal
99 end interface operator(.ne.)
100
108 module procedure kim_simulator_model_get_simulator_name_and_version
110
120
129 end interface kim_get_supported_species
130
140
149 end interface kim_template_map_is_open
150
158 end interface kim_add_template_map
159
168 end interface kim_close_template_map
169
179
189
198 end interface kim_get_simulator_field_line
199
209
219
229
241 end interface kim_get_parameter_file_name
242
252
262
272
279 module procedure kim_simulator_model_to_string
280 end interface kim_to_string
281
288 module procedure kim_simulator_model_set_log_id
289 end interface kim_set_log_id
290
299 end interface kim_push_log_verbosity
300
308 end interface kim_pop_log_verbosity
309
310contains
314 logical recursive function kim_simulator_model_handle_equal(lhs, rhs)
315 implicit none
316 type(kim_simulator_model_handle_type), intent(in) :: lhs
317 type(kim_simulator_model_handle_type), intent(in) :: rhs
318
319 if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
320 kim_simulator_model_handle_equal = .true.
321 else
322 kim_simulator_model_handle_equal = c_associated(lhs%p, rhs%p)
323 end if
324 end function kim_simulator_model_handle_equal
325
329 logical recursive function kim_simulator_model_handle_not_equal(lhs, rhs)
330 implicit none
331 type(kim_simulator_model_handle_type), intent(in) :: lhs
332 type(kim_simulator_model_handle_type), intent(in) :: rhs
333
334 kim_simulator_model_handle_not_equal = .not. (lhs == rhs)
335 end function kim_simulator_model_handle_not_equal
336
342 recursive subroutine kim_simulator_model_create(simulator_model_name, &
343 simulator_model_handle, ierr)
344 implicit none
345 interface
346 integer(c_int) recursive function create( &
347 simulator_model_name, simulator_model) &
348 bind(c, name="KIM_SimulatorModel_Create")
349 use, intrinsic :: iso_c_binding
350 implicit none
351 character(c_char), intent(in) :: simulator_model_name(*)
352 type(c_ptr), intent(out) :: simulator_model
353 end function create
354 end interface
355 character(len=*, kind=c_char), intent(in) :: simulator_model_name
356 type(kim_simulator_model_handle_type), intent(out) :: simulator_model_handle
357 integer(c_int), intent(out) :: ierr
358
359 type(c_ptr) :: psimulator_model
360
361 ierr = create(trim(simulator_model_name)//c_null_char, psimulator_model)
362 simulator_model_handle%p = psimulator_model
363 end subroutine kim_simulator_model_create
364
370 recursive subroutine kim_simulator_model_destroy(simulator_model_handle)
371 implicit none
372 interface
373 recursive subroutine destroy(simulator_model) &
374 bind(c, name="KIM_SimulatorModel_Destroy")
375 use, intrinsic :: iso_c_binding
376 implicit none
377 type(c_ptr), intent(inout) :: simulator_model
378 end subroutine destroy
379 end interface
380 type(kim_simulator_model_handle_type), intent(inout) :: &
381 simulator_model_handle
382
383 type(c_ptr) :: psimulator_model
384 psimulator_model = simulator_model_handle%p
385 call destroy(psimulator_model)
386 simulator_model_handle%p = c_null_ptr
387 end subroutine kim_simulator_model_destroy
388
395 recursive subroutine kim_simulator_model_get_simulator_name_and_version( &
396 simulator_model_handle, simulator_name, simulator_version)
397 use kim_interoperable_types_module, only: kim_simulator_model_type
398 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
399 implicit none
400 interface
401 recursive subroutine get_simulator_name_and_version( &
402 simulator_model, simulator_name, simulator_version) &
403 bind(c, name="KIM_SimulatorModel_GetSimulatorNameAndVersion")
404 use, intrinsic :: iso_c_binding
405 use kim_interoperable_types_module, only: kim_simulator_model_type
406 implicit none
407 type(kim_simulator_model_type), intent(in) :: simulator_model
408 type(c_ptr), intent(out) :: simulator_name
409 type(c_ptr), intent(out) :: simulator_version
410 end subroutine get_simulator_name_and_version
411 end interface
412 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
413 character(len=*, kind=c_char), intent(out) :: simulator_name
414 character(len=*, kind=c_char), intent(out) :: simulator_version
415 type(kim_simulator_model_type), pointer :: simulator_model
416
417 type(c_ptr) psimulator_name, psimulator_version
418
419 call c_f_pointer(simulator_model_handle%p, simulator_model)
420 call get_simulator_name_and_version(simulator_model, psimulator_name, &
421 psimulator_version)
422 call kim_convert_c_char_ptr_to_string(psimulator_name, simulator_name)
423 call kim_convert_c_char_ptr_to_string(psimulator_version, simulator_version)
424 end subroutine kim_simulator_model_get_simulator_name_and_version
425
433 simulator_model_handle, number_of_supported_species)
434 use kim_interoperable_types_module, only: kim_simulator_model_type
435 implicit none
436 interface
437 recursive subroutine get_number_of_supported_species( &
438 simulator_model, number_of_supported_species) &
439 bind(c, name="KIM_SimulatorModel_GetNumberOfSupportedSpecies")
440 use, intrinsic :: iso_c_binding
441 use kim_interoperable_types_module, only: kim_simulator_model_type
442 implicit none
443 type(kim_simulator_model_type), intent(in) :: simulator_model
444 integer(c_int), intent(out) :: number_of_supported_species
446 end interface
447 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
448 integer(c_int), intent(out) :: number_of_supported_species
449 type(kim_simulator_model_type), pointer :: simulator_model
450
451 call c_f_pointer(simulator_model_handle%p, simulator_model)
452 call get_number_of_supported_species(simulator_model, &
453 number_of_supported_species)
455
463 simulator_model_handle, index, species_name, ierr)
464 use kim_interoperable_types_module, only: kim_simulator_model_type
465 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
466 implicit none
467 interface
468 integer(c_int) recursive function get_supported_species( &
469 simulator_model, index, species_name) &
470 bind(c, name="KIM_SimulatorModel_GetSupportedSpecies")
471 use, intrinsic :: iso_c_binding
472 use kim_interoperable_types_module, only: kim_simulator_model_type
473 implicit none
474 type(kim_simulator_model_type), intent(in) :: simulator_model
475 integer(c_int), intent(in), value :: index
476 type(c_ptr), intent(out) :: species_name
477 end function get_supported_species
478 end interface
479 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
480 integer(c_int), intent(in) :: index
481 character(len=*, kind=c_char), intent(out) :: species_name
482 integer(c_int), intent(out) :: ierr
483 type(kim_simulator_model_type), pointer :: simulator_model
484
485 type(c_ptr) pspecies_name
486
487 call c_f_pointer(simulator_model_handle%p, simulator_model)
488 ierr = get_supported_species(simulator_model, index - 1, pspecies_name)
489 call kim_convert_c_char_ptr_to_string(pspecies_name, species_name)
491
499 simulator_model_handle)
500 use kim_interoperable_types_module, only: kim_simulator_model_type
501 implicit none
502 interface
503 recursive subroutine open_and_initialize_template_map(simulator_model) &
504 bind(c, name="KIM_SimulatorModel_OpenAndInitializeTemplateMap")
505 use, intrinsic :: iso_c_binding
506 use kim_interoperable_types_module, only: kim_simulator_model_type
507 implicit none
508 type(kim_simulator_model_type), intent(in) :: simulator_model
510 end interface
511 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
512 type(kim_simulator_model_type), pointer :: simulator_model
513
514 call c_f_pointer(simulator_model_handle%p, simulator_model)
515 call open_and_initialize_template_map(simulator_model)
517
524 integer(c_int) recursive function kim_simulator_model_template_map_is_open( &
525 simulator_model_handle)
526 use kim_interoperable_types_module, only: kim_simulator_model_type
527 implicit none
528 interface
529 integer(c_int) recursive function template_map_is_open(simulator_model) &
530 bind(c, name="KIM_SimulatorModel_TemplateMapIsOpen")
531 use, intrinsic :: iso_c_binding
532 use kim_interoperable_types_module, only: kim_simulator_model_type
533 implicit none
534 type(kim_simulator_model_type), intent(in) :: simulator_model
535 end function template_map_is_open
536 end interface
537 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
538 type(kim_simulator_model_type), pointer :: simulator_model
539
540 call c_f_pointer(simulator_model_handle%p, simulator_model)
542 simulator_model)
544
551 simulator_model_handle, key, value, ierr)
552 use kim_interoperable_types_module, only: kim_simulator_model_type
553 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
554 implicit none
555 interface
556 integer(c_int) recursive function add_template_map( &
557 simulator_model, key, value) &
558 bind(c, name="KIM_SimulatorModel_AddTemplateMap")
559 use, intrinsic :: iso_c_binding
560 use kim_interoperable_types_module, only: kim_simulator_model_type
561 implicit none
562 type(kim_simulator_model_type), intent(in) :: simulator_model
563 character(c_char), intent(in) :: key(*)
564 character(c_char), intent(in) :: value(*)
565 end function add_template_map
566 end interface
567 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
568 character(len=*, kind=c_char), intent(in) :: key
569 character(len=*, kind=c_char), intent(in) :: value
570 integer(c_int), intent(out) :: ierr
571 type(kim_simulator_model_type), pointer :: simulator_model
572
573 call c_f_pointer(simulator_model_handle%p, simulator_model)
574 ierr = add_template_map(simulator_model, trim(key)//c_null_char, &
575 trim(value)//c_null_char)
577
585 simulator_model_handle)
586 use kim_interoperable_types_module, only: kim_simulator_model_type
587 implicit none
588 interface
589 recursive subroutine close_template_map(simulator_model) &
590 bind(c, name="KIM_SimulatorModel_CloseTemplateMap")
591 use, intrinsic :: iso_c_binding
592 use kim_interoperable_types_module, only: kim_simulator_model_type
593 implicit none
594 type(kim_simulator_model_type), intent(in) :: simulator_model
595 end subroutine close_template_map
596 end interface
597 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
598 type(kim_simulator_model_type), pointer :: simulator_model
599
600 call c_f_pointer(simulator_model_handle%p, simulator_model)
601 call close_template_map(simulator_model)
603
611 simulator_model_handle, number_of_simulator_fields)
612 use kim_interoperable_types_module, only: kim_simulator_model_type
613 implicit none
614 interface
615 recursive subroutine get_number_of_simulator_fields( &
616 simulator_model, number_of_simulator_fields) &
617 bind(c, name="KIM_SimulatorModel_GetNumberOfSimulatorFields")
618 use, intrinsic :: iso_c_binding
619 use kim_interoperable_types_module, only: kim_simulator_model_type
620 implicit none
621 type(kim_simulator_model_type), intent(in) :: simulator_model
622 integer(c_int), intent(out) :: number_of_simulator_fields
623 end subroutine get_number_of_simulator_fields
624 end interface
625 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
626 integer(c_int), intent(out) :: number_of_simulator_fields
627 type(kim_simulator_model_type), pointer :: simulator_model
628
629 call c_f_pointer(simulator_model_handle%p, simulator_model)
630 call get_number_of_simulator_fields(simulator_model, &
631 number_of_simulator_fields)
633
641 simulator_model_handle, field_index, extent, field_name, ierr)
642 use kim_interoperable_types_module, only: kim_simulator_model_type
643 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
644 implicit none
645 interface
646 integer(c_int) recursive function get_simulator_field_metadata( &
647 simulator_model, field_index, extent, field_name) &
648 bind(c, name="KIM_SimulatorModel_GetSimulatorFieldMetadata")
649 use, intrinsic :: iso_c_binding
650 use kim_interoperable_types_module, only: kim_simulator_model_type
651 implicit none
652 type(kim_simulator_model_type), intent(in) :: simulator_model
653 integer(c_int), intent(in), value :: field_index
654 integer(c_int), intent(out) :: extent
655 type(c_ptr), intent(out) :: field_name
657 end interface
658 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
659 integer(c_int), intent(in) :: field_index
660 integer(c_int), intent(out) :: extent
661 character(len=*, kind=c_char), intent(out) :: field_name
662 integer(c_int), intent(out) :: ierr
663 type(kim_simulator_model_type), pointer :: simulator_model
664
665 type(c_ptr) pfield_name
666
667 call c_f_pointer(simulator_model_handle%p, simulator_model)
668 ierr = get_simulator_field_metadata(simulator_model, field_index - 1, &
669 extent, pfield_name)
670 call kim_convert_c_char_ptr_to_string(pfield_name, field_name)
672
680 simulator_model_handle, field_index, line_index, line_value, ierr)
681 use kim_interoperable_types_module, only: kim_simulator_model_type
682 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
683 implicit none
684 interface
685 integer(c_int) recursive function get_simulator_field_line( &
686 simulator_model, field_index, line_index, line_value) &
687 bind(c, name="KIM_SimulatorModel_GetSimulatorFieldLine")
688 use, intrinsic :: iso_c_binding
689 use kim_interoperable_types_module, only: kim_simulator_model_type
690 implicit none
691 type(kim_simulator_model_type), intent(in) :: simulator_model
692 integer(c_int), intent(in), value :: field_index
693 integer(c_int), intent(in), value :: line_index
694 type(c_ptr), intent(out) :: line_value
695 end function get_simulator_field_line
696 end interface
697 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
698 integer(c_int), intent(in), value :: field_index
699 integer(c_int), intent(in), value :: line_index
700 character(len=*, kind=c_char), intent(out) :: line_value
701 integer(c_int), intent(out) :: ierr
702 type(kim_simulator_model_type), pointer :: simulator_model
703
704 type(c_ptr) pline_value
705
706 call c_f_pointer(simulator_model_handle%p, simulator_model)
707 ierr = get_simulator_field_line(simulator_model, field_index - 1, &
708 line_index - 1, pline_value)
709 call kim_convert_c_char_ptr_to_string(pline_value, line_value)
711
719 simulator_model_handle, directory_name)
720 use kim_interoperable_types_module, only: kim_simulator_model_type
721 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
722 implicit none
723 interface
724 recursive subroutine get_parameter_file_directory_name(simulator_model, &
725 directory_name) &
726 bind(c, name="KIM_SimulatorModel_GetParameterFileDirectoryName")
727 use, intrinsic :: iso_c_binding
728 use kim_interoperable_types_module, only: kim_simulator_model_type
729 implicit none
730 type(kim_simulator_model_type), intent(in) :: simulator_model
731 type(c_ptr), intent(out) :: directory_name
733 end interface
734 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
735 character(len=*, kind=c_char), intent(out) :: directory_name
736 type(kim_simulator_model_type), pointer :: simulator_model
737
738 type(c_ptr) pdirectory_name
739
740 call c_f_pointer(simulator_model_handle%p, simulator_model)
741 call get_parameter_file_directory_name(simulator_model, pdirectory_name)
742 call kim_convert_c_char_ptr_to_string(pdirectory_name, directory_name)
744
752 simulator_model_handle, specification_file_name)
753 use kim_interoperable_types_module, only: kim_simulator_model_type
754 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
755 implicit none
756 interface
757 recursive subroutine get_specification_file_name( &
758 simulator_model, specification_file_name) &
759 bind(c, name="KIM_SimulatorModel_GetSpecificationFileName")
760 use, intrinsic :: iso_c_binding
761 use kim_interoperable_types_module, only: kim_simulator_model_type
762 implicit none
763 type(kim_simulator_model_type), intent(in) :: simulator_model
764 type(c_ptr), intent(out) :: specification_file_name
765 end subroutine get_specification_file_name
766 end interface
767 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
768 character(len=*, kind=c_char), intent(out) :: specification_file_name
769 type(kim_simulator_model_type), pointer :: simulator_model
770
771 type(c_ptr) pspecification_file_name
772
773 call c_f_pointer(simulator_model_handle%p, simulator_model)
774 call get_specification_file_name(simulator_model, pspecification_file_name)
775 call kim_convert_c_char_ptr_to_string(pspecification_file_name, &
776 specification_file_name)
778
786 simulator_model_handle, number_of_parameter_files)
787 use kim_interoperable_types_module, only: kim_simulator_model_type
788 implicit none
789 interface
790 recursive subroutine get_number_of_parameter_files( &
791 simulator_model, number_of_parameter_files) &
792 bind(c, name="KIM_SimulatorModel_GetNumberOfParameterFiles")
793 use, intrinsic :: iso_c_binding
794 use kim_interoperable_types_module, only: kim_simulator_model_type
795 implicit none
796 type(kim_simulator_model_type), intent(in) :: simulator_model
797 integer(c_int), intent(out) :: number_of_parameter_files
798 end subroutine get_number_of_parameter_files
799 end interface
800 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
801 integer(c_int), intent(out) :: number_of_parameter_files
802 type(kim_simulator_model_type), pointer :: simulator_model
803
804 call c_f_pointer(simulator_model_handle%p, simulator_model)
805 call get_number_of_parameter_files(simulator_model, &
806 number_of_parameter_files)
808
819 simulator_model_handle, index, parameter_file_name, ierr)
820 use kim_interoperable_types_module, only: kim_simulator_model_type
821 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
822 implicit none
823 interface
824 integer(c_int) recursive function get_parameter_file_name( &
825 simulator_model, index, parameter_file_name) &
826 bind(c, name="KIM_SimulatorModel_GetParameterFileName")
827 use, intrinsic :: iso_c_binding
828 use kim_interoperable_types_module, only: kim_simulator_model_type
829 implicit none
830 type(kim_simulator_model_type), intent(in) :: simulator_model
831 integer(c_int), intent(in), value :: index
832 type(c_ptr), intent(out) :: parameter_file_name
833 end function get_parameter_file_name
834 end interface
835 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
836 integer(c_int), intent(in) :: index
837 character(len=*, kind=c_char), intent(out) :: parameter_file_name
838 integer(c_int), intent(out) :: ierr
839 type(kim_simulator_model_type), pointer :: simulator_model
840
841 type(c_ptr) pparameter_file_name
842
843 call c_f_pointer(simulator_model_handle%p, simulator_model)
844 ierr = get_parameter_file_name(simulator_model, index - 1, &
845 pparameter_file_name)
846 call kim_convert_c_char_ptr_to_string(pparameter_file_name, &
847 parameter_file_name)
849
857 simulator_model_handle, index, parameter_file_basename, ierr)
858 use kim_interoperable_types_module, only: kim_simulator_model_type
859 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
860 implicit none
861 interface
862 integer(c_int) recursive function get_parameter_file_basename( &
863 simulator_model, index, parameter_file_basename) &
864 bind(c, name="KIM_SimulatorModel_GetParameterFileBasename")
865 use, intrinsic :: iso_c_binding
866 use kim_interoperable_types_module, only: kim_simulator_model_type
867 implicit none
868 type(kim_simulator_model_type), intent(in) :: simulator_model
869 integer(c_int), intent(in), value :: index
870 type(c_ptr), intent(out) :: parameter_file_basename
871 end function get_parameter_file_basename
872 end interface
873 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
874 integer(c_int), intent(in) :: index
875 character(len=*, kind=c_char), intent(out) :: parameter_file_basename
876 integer(c_int), intent(out) :: ierr
877 type(kim_simulator_model_type), pointer :: simulator_model
878
879 type(c_ptr) pparameter_file_basename
880
881 call c_f_pointer(simulator_model_handle%p, simulator_model)
882 ierr = get_parameter_file_basename(simulator_model, index - 1, &
883 pparameter_file_basename)
884 call kim_convert_c_char_ptr_to_string(pparameter_file_basename, &
885 parameter_file_basename)
887
895 simulator_model_handle, ptr)
896 use kim_interoperable_types_module, only: kim_simulator_model_type
897 implicit none
898 interface
899 recursive subroutine set_simulator_buffer_pointer(simulator_model, ptr) &
900 bind(c, name="KIM_SimulatorModel_SetSimulatorBufferPointer")
901 use, intrinsic :: iso_c_binding
902 use kim_interoperable_types_module, only: kim_simulator_model_type
903 implicit none
904 type(kim_simulator_model_type), intent(in) :: simulator_model
905 type(c_ptr), intent(in), value :: ptr
906 end subroutine set_simulator_buffer_pointer
907 end interface
908 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
909 type(c_ptr), intent(in) :: ptr
910 type(kim_simulator_model_type), pointer :: simulator_model
911
912 call c_f_pointer(simulator_model_handle%p, simulator_model)
913 call set_simulator_buffer_pointer(simulator_model, ptr)
915
923 simulator_model_handle, ptr)
924 use kim_interoperable_types_module, only: kim_simulator_model_type
925 implicit none
926 interface
927 recursive subroutine get_simulator_buffer_pointer(simulator_model, ptr) &
928 bind(c, name="KIM_SimulatorModel_GetSimulatorBufferPointer")
929 use, intrinsic :: iso_c_binding
930 use kim_interoperable_types_module, only: kim_simulator_model_type
931 implicit none
932 type(kim_simulator_model_type), intent(in) :: simulator_model
933 type(c_ptr), intent(out) :: ptr
934 end subroutine get_simulator_buffer_pointer
935 end interface
936 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
937 type(c_ptr), intent(out) :: ptr
938 type(kim_simulator_model_type), pointer :: simulator_model
939
940 call c_f_pointer(simulator_model_handle%p, simulator_model)
941 call get_simulator_buffer_pointer(simulator_model, ptr)
943
949 recursive subroutine kim_simulator_model_to_string(simulator_model_handle, &
950 string)
951 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
952 use kim_interoperable_types_module, only: kim_simulator_model_type
953 implicit none
954 interface
955 type(c_ptr) recursive function model_string(simulator_model) &
956 bind(c, name="KIM_SimulatorModel_ToString")
957 use, intrinsic :: iso_c_binding
958 use kim_interoperable_types_module, only: kim_simulator_model_type
959 implicit none
960 type(kim_simulator_model_type), intent(in) :: simulator_model
961 end function model_string
962 end interface
963 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
964 character(len=*, kind=c_char), intent(out) :: string
965 type(kim_simulator_model_type), pointer :: simulator_model
966
967 type(c_ptr) :: p
968
969 call c_f_pointer(simulator_model_handle%p, simulator_model)
970 p = model_string(simulator_model)
971 call kim_convert_c_char_ptr_to_string(p, string)
972 end subroutine kim_simulator_model_to_string
973
979 recursive subroutine kim_simulator_model_set_log_id(simulator_model_handle, &
980 log_id)
981 use kim_interoperable_types_module, only: kim_simulator_model_type
982 implicit none
983 interface
984 recursive subroutine set_log_id(simulator_model, log_id) &
985 bind(c, name="KIM_SimulatorModel_SetLogID")
986 use, intrinsic :: iso_c_binding
987 use kim_interoperable_types_module, only: kim_simulator_model_type
988 implicit none
989 type(kim_simulator_model_type), intent(in) :: simulator_model
990 character(c_char), intent(in) :: log_id(*)
991 end subroutine set_log_id
992 end interface
993 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
994 character(len=*, kind=c_char), intent(in) :: log_id
995 type(kim_simulator_model_type), pointer :: simulator_model
996
997 call c_f_pointer(simulator_model_handle%p, simulator_model)
998 call set_log_id(simulator_model, trim(log_id)//c_null_char)
999 end subroutine kim_simulator_model_set_log_id
1000
1008 simulator_model_handle, log_verbosity)
1010 use kim_interoperable_types_module, only: kim_simulator_model_type
1011 implicit none
1012 interface
1013 recursive subroutine push_log_verbosity(simulator_model, log_verbosity) &
1014 bind(c, name="KIM_SimulatorModel_PushLogVerbosity")
1015 use, intrinsic :: iso_c_binding
1017 use kim_interoperable_types_module, only: kim_simulator_model_type
1018 implicit none
1019 type(kim_simulator_model_type), intent(in) :: simulator_model
1020 type(kim_log_verbosity_type), intent(in), value :: log_verbosity
1021 end subroutine push_log_verbosity
1022 end interface
1023 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
1024 type(kim_log_verbosity_type), intent(in) :: log_verbosity
1025 type(kim_simulator_model_type), pointer :: simulator_model
1026
1027 call c_f_pointer(simulator_model_handle%p, simulator_model)
1028 call push_log_verbosity(simulator_model, log_verbosity)
1030
1037 simulator_model_handle)
1039 use kim_interoperable_types_module, only: kim_simulator_model_type
1040 implicit none
1041 interface
1042 recursive subroutine pop_log_verbosity(simulator_model) &
1043 bind(c, name="KIM_SimulatorModel_PopLogVerbosity")
1044 use, intrinsic :: iso_c_binding
1046 use kim_interoperable_types_module, only: kim_simulator_model_type
1047 implicit none
1048 type(kim_simulator_model_type), intent(in) :: simulator_model
1049 end subroutine pop_log_verbosity
1050 end interface
1051 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
1052 type(kim_simulator_model_type), pointer :: simulator_model
1053
1054 call c_f_pointer(simulator_model_handle%p, simulator_model)
1055 call pop_log_verbosity(simulator_model)
Add a new key-value entry to the template map.
Close the template map and perform template substitutions.
Get the number of parameter files provided by the SimulatorModel.
Get the number of simulator fields provided by the SimulatorModel.
Get the number of species supported by the SimulatorModel.
Get the basename (file name without path) of a particular parameter file. The file is located in the ...
Get absolute path name of the temporary directory where parameter files provided by the simulator mod...
Get the basename (file name without path) of a particular parameter file. The file is located in the ...
Get the Simulator's buffer pointer from the SimulatorModel object.
Get a line for the simulator field of interest with all template substitutions performed (Requires th...
Get the metadata for the simulator field of interest.
Get the SimulatorModel's simulator name and version.
Get the SimulatorModel's specification file basename (file name without path). The file is located in...
Get a species name supported by the SimulatorModel.
Open and initialize the template map for simulator field line substitutions.
Pop a LogVerbosity from the SimulatorModel object's Log object verbosity stack.
Push a new LogVerbosity onto the SimulatorModel object's Log object verbosity stack.
Set the identity of the Log object associated with the SimulatorModel object.
Set the Simulator's buffer pointer within the SimulatorModel object.
Get a string representing the internal state of the SimulatorModel object.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.
Provides the primary interface to a KIM API SimulatorModel object and is meant to be used by simulato...
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_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...
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_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, public kim_simulator_model_create(simulator_model_name, simulator_model_handle, ierr)
Create a new KIM API SimulatorModel object.
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_pop_log_verbosity(simulator_model_handle)
Pop a LogVerbosity from the SimulatorModel object's Log object verbosity stack.
recursive subroutine kim_simulator_model_open_and_initialize_template_map(simulator_model_handle)
Open and initialize the template map for simulator field line substitutions.
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_simulator_field_metadata(simulator_model_handle, field_index, extent, field_name, ierr)
Get the metadata for the simulator field of interest.
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, public kim_simulator_model_destroy(simulator_model_handle)
Destroy a previously SimulatorModel::Create'd object.
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_set_simulator_buffer_pointer(simulator_model_handle, ptr)
Set the Simulator's buffer pointer within the SimulatorModel 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_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_close_template_map(simulator_model_handle)
Close the template map and perform template substitutions.
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.
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_number_of_simulator_fields(simulator_model_handle, number_of_simulator_fields)
Get the number of simulator fields provided by the SimulatorModel.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.
Provides the primary interface to a KIM API SimulatorModel object and is meant to be used by simulato...