40 use,
intrinsic :: iso_c_binding
46 kim_collections_handle_type, &
57 kim_get_item_library_file_name_and_collection, &
58 kim_cache_list_of_item_metadata_files, &
59 kim_get_item_metadata_file_length, &
60 kim_get_item_metadata_file_values, &
61 kim_cache_list_of_item_names_by_type, &
62 kim_get_item_name_by_type, &
63 kim_cache_list_of_item_names_by_collection_and_type, &
64 kim_get_item_name_by_collection_and_type, &
65 kim_get_item_library_file_name_by_collection_and_type, &
66 kim_cache_list_of_item_metadata_files_by_collection_and_type, &
67 kim_get_item_metadata_file_length_by_collection_and_type, &
68 kim_get_item_metadata_file_values_by_collection_and_type, &
69 kim_get_project_name_and_sem_ver, &
70 kim_get_environment_variable_name, &
71 kim_get_configuration_file_environment_variable, &
72 kim_get_configuration_file_name, &
73 kim_cache_list_of_directory_names, &
74 kim_get_directory_name, &
76 kim_push_log_verbosity, &
85 type, bind(c) :: kim_collections_handle_type
86 type(c_ptr) :: p = c_null_ptr
87 end type kim_collections_handle_type
92 type(kim_collections_handle_type),
protected,
save &
98 interface operator (.eq.)
99 module procedure kim_collections_handle_equal
100 end interface operator (.eq.)
105 interface operator (.ne.)
106 module procedure kim_collections_handle_not_equal
107 end interface operator (.ne.)
114 interface kim_get_item_type
115 module procedure kim_collections_get_item_type
116 end interface kim_get_item_type
124 interface kim_get_item_library_file_name_and_collection
126 end interface kim_get_item_library_file_name_and_collection
134 interface kim_cache_list_of_item_metadata_files
136 end interface kim_cache_list_of_item_metadata_files
145 interface kim_get_item_metadata_file_length
147 end interface kim_get_item_metadata_file_length
155 interface kim_get_item_metadata_file_values
157 end interface kim_get_item_metadata_file_values
165 interface kim_cache_list_of_item_names_by_type
167 end interface kim_cache_list_of_item_names_by_type
174 interface kim_get_item_name_by_type
176 end interface kim_get_item_name_by_type
184 interface kim_cache_list_of_item_names_by_collection_and_type
187 end interface kim_cache_list_of_item_names_by_collection_and_type
195 interface kim_get_item_name_by_collection_and_type
197 end interface kim_get_item_name_by_collection_and_type
206 interface kim_get_item_library_file_name_by_collection_and_type
209 end interface kim_get_item_library_file_name_by_collection_and_type
218 interface kim_cache_list_of_item_metadata_files_by_collection_and_type
221 end interface kim_cache_list_of_item_metadata_files_by_collection_and_type
230 interface kim_get_item_metadata_file_length_by_collection_and_type
233 end interface kim_get_item_metadata_file_length_by_collection_and_type
241 interface kim_get_item_metadata_file_values_by_collection_and_type
244 end interface kim_get_item_metadata_file_values_by_collection_and_type
252 interface kim_get_project_name_and_sem_ver
254 end interface kim_get_project_name_and_sem_ver
262 interface kim_get_environment_variable_name
264 end interface kim_get_environment_variable_name
272 interface kim_get_configuration_file_environment_variable
274 end interface kim_get_configuration_file_environment_variable
282 interface kim_get_configuration_file_name
284 end interface kim_get_configuration_file_name
292 interface kim_cache_list_of_directory_names
294 end interface kim_cache_list_of_directory_names
301 interface kim_get_directory_name
303 end interface kim_get_directory_name
310 interface kim_set_log_id
312 end interface kim_set_log_id
319 interface kim_push_log_verbosity
321 end interface kim_push_log_verbosity
328 interface kim_pop_log_verbosity
330 end interface kim_pop_log_verbosity
336 logical recursive function kim_collections_handle_equal(lhs, rhs)
338 type(kim_collections_handle_type),
intent(in) :: lhs
339 type(kim_collections_handle_type),
intent(in) :: rhs
341 if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p)))
then 342 kim_collections_handle_equal = .true.
344 kim_collections_handle_equal = c_associated(lhs%p, rhs%p)
346 end function kim_collections_handle_equal
351 logical recursive function kim_collections_handle_not_equal(lhs, rhs)
353 type(kim_collections_handle_type),
intent(in) :: lhs
354 type(kim_collections_handle_type),
intent(in) :: rhs
356 kim_collections_handle_not_equal = .not. (lhs .eq. rhs)
357 end function kim_collections_handle_not_equal
367 integer(c_int) recursive function create(collections) &
368 bind(c, name=
"KIM_Collections_Create")
369 use,
intrinsic :: iso_c_binding
371 type(c_ptr),
intent(out) :: collections
374 type(kim_collections_handle_type),
intent(out) :: collections_handle
375 integer(c_int),
intent(out) :: ierr
377 type(c_ptr) :: pcollections
379 ierr = create(pcollections)
380 collections_handle%p = pcollections
391 recursive subroutine destroy(collections) &
392 bind(c, name=
"KIM_Collections_Destroy")
393 use,
intrinsic :: iso_c_binding
395 type(c_ptr),
intent(inout) :: collections
396 end subroutine destroy
398 type(kim_collections_handle_type),
intent(inout) :: collections_handle
400 type(c_ptr) :: pcollections
401 pcollections = collections_handle%p
402 call destroy(pcollections)
403 collections_handle%p = c_null_ptr
411 recursive subroutine kim_collections_get_item_type(collections_handle, &
412 item_name, item_type, ierr)
413 use kim_interoperable_types_module
, only : kim_collections_type
417 integer(c_int) recursive function get_item_type(collections, &
418 item_name, item_type) bind(c, name="KIM_Collections_GetItemType")
419 use,
intrinsic :: iso_c_binding
420 use kim_interoperable_types_module
, only : kim_collections_type
422 kim_collection_item_type_type
424 type(kim_collections_type),
intent(in) :: collections
425 character(c_char),
intent(in) :: item_name(*)
426 type(kim_collection_item_type_type),
intent(out) :: item_type
427 end function get_item_type
429 type(kim_collections_handle_type),
intent(in) :: collections_handle
430 character(len=*, kind=c_char),
intent(in) :: item_name
431 type(kim_collection_item_type_type),
intent(out) :: item_type
432 integer(c_int),
intent(out) :: ierr
433 type(kim_collections_type),
pointer :: collections
435 call c_f_pointer(collections_handle%p, collections)
436 ierr = get_item_type(collections, trim(item_name)//c_null_char, item_type)
437 end subroutine kim_collections_get_item_type
445 recursive subroutine &
447 collections_handle, item_type, item_name, file_name, collection, ierr)
448 use kim_interoperable_types_module
, only : kim_collections_type
449 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
454 integer(c_int) recursive function &
455 get_item_library_file_name_and_collection(collections, item_type, &
456 item_name, file_name, collection) &
457 bind(c, name=
"KIM_Collections_GetItemLibraryFileNameAndCollection")
458 use,
intrinsic :: iso_c_binding
459 use kim_interoperable_types_module
, only : kim_collections_type
462 kim_collection_item_type_type
464 type(kim_collections_type),
intent(in) :: collections
465 type(kim_collection_item_type_type),
intent(in),
value :: item_type
466 character(c_char),
intent(in) :: item_name(*)
467 type(c_ptr),
intent(out) :: file_name
468 type(kim_collection_type),
intent(out) :: collection
469 end function get_item_library_file_name_and_collection
471 type(kim_collections_handle_type),
intent(in) :: collections_handle
472 type(kim_collection_item_type_type),
intent(in) :: item_type
473 character(len=*, kind=c_char),
intent(in) :: item_name
474 character(len=*, kind=c_char),
intent(out) :: file_name
475 type(kim_collection_type),
intent(out) :: collection
476 integer(c_int),
intent(out) :: ierr
477 type(kim_collections_type),
pointer :: collections
479 type(c_ptr) :: pfile_name
481 call c_f_pointer(collections_handle%p, collections)
482 ierr = get_item_library_file_name_and_collection(collections, item_type, &
483 trim(item_name)//c_null_char, pfile_name, collection)
484 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
494 collections_handle, item_type, item_name, extent, ierr)
495 use kim_interoperable_types_module
, only : kim_collections_type
499 integer(c_int) recursive function cache_list_of_item_metadata_files( &
500 collections, item_type, item_name, extent) &
501 bind(c, name=
"KIM_Collections_CacheListOfItemMetadataFiles")
502 use,
intrinsic :: iso_c_binding
503 use kim_interoperable_types_module
, only : kim_collections_type
505 kim_collection_item_type_type
507 type(kim_collections_type),
intent(in) :: collections
508 type(kim_collection_item_type_type),
intent(in),
value :: item_type
509 character(c_char),
intent(in) :: item_name(*)
510 integer(c_int),
intent(out) :: extent
511 end function cache_list_of_item_metadata_files
513 type(kim_collections_handle_type),
intent(in) :: collections_handle
514 type(kim_collection_item_type_type),
intent(in) :: item_type
515 character(len=*, kind=c_char),
intent(in) :: item_name
516 integer(c_int),
intent(out) :: extent
517 integer(c_int),
intent(out) :: ierr
518 type(kim_collections_type),
pointer :: collections
520 call c_f_pointer(collections_handle%p, collections)
521 ierr = cache_list_of_item_metadata_files(collections, item_type, &
522 trim(item_name)//c_null_char, extent)
533 collections_handle, index, file_length, available_as_string, ierr)
534 use kim_interoperable_types_module
, only : kim_collections_type
537 integer(c_int) recursive function get_item_metadata_file_length( &
538 collections, index, file_name, file_length, file_raw_data, &
539 available_as_string, file_string) &
540 bind(c, name=
"KIM_Collections_GetItemMetadataFile_fortran")
541 use,
intrinsic :: iso_c_binding
542 use kim_interoperable_types_module
, only : kim_collections_type
544 type(kim_collections_type),
intent(in) :: collections
545 integer(c_int),
intent(in),
value :: index
546 type(c_ptr),
intent(out) :: file_name
547 integer(c_long),
intent(out) :: file_length
548 type(c_ptr),
intent(out) :: file_raw_data
549 integer(c_int),
intent(out) :: available_as_string
550 type(c_ptr),
intent(out) :: file_string
551 end function get_item_metadata_file_length
553 type(kim_collections_handle_type),
intent(in) :: collections_handle
554 integer(c_int),
intent(in) :: index
555 integer(c_long),
intent(out) :: file_length
556 integer(c_int),
intent(out) :: available_as_string
557 integer(c_int),
intent(out) :: ierr
558 type(kim_collections_type),
pointer :: collections
560 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
562 call c_f_pointer(collections_handle%p, collections)
563 ierr = get_item_metadata_file_length(collections, index-1, pfile_name, &
564 file_length, pfile_raw_data, available_as_string, pfile_string)
574 collections_handle, index, file_name, file_raw_data, file_string, ierr)
575 use kim_interoperable_types_module
, only : kim_collections_type
576 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
579 integer(c_int) recursive function get_item_metadata_file_values( &
580 collections, index, file_name, file_length, file_raw_data, &
581 available_as_string, file_string) &
582 bind(c, name=
"KIM_Collections_GetItemMetadataFile_fortran")
583 use,
intrinsic :: iso_c_binding
584 use kim_interoperable_types_module
, only : kim_collections_type
586 type(kim_collections_type),
intent(in) :: collections
587 integer(c_int),
intent(in),
value :: index
588 type(c_ptr),
intent(out) :: file_name
589 integer(c_long),
intent(out) :: file_length
590 type(c_ptr),
intent(out) :: file_raw_data
591 integer(c_int),
intent(out) :: available_as_string
592 type(c_ptr),
intent(out) :: file_string
593 end function get_item_metadata_file_values
595 type(kim_collections_handle_type),
intent(in) :: collections_handle
596 integer(c_int),
intent(in) :: index
597 character(len=*, kind=c_char),
intent(out) :: file_name
598 integer(c_signed_char),
intent(out) :: file_raw_data(:)
599 character(len=*, kind=c_char),
intent(out) :: file_string
600 integer(c_int),
intent(out) :: ierr
601 type(kim_collections_type),
pointer :: collections
603 integer(c_long) file_length
604 integer(c_int) available_as_string
605 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
606 integer(c_signed_char),
pointer :: file_raw_data_fpointer(:)
608 call c_f_pointer(collections_handle%p, collections)
609 ierr = get_item_metadata_file_values(collections, index-1, pfile_name, &
610 file_length, pfile_raw_data, available_as_string, pfile_string)
611 if (ierr .eq. 0)
then 612 if (
size(file_raw_data) < file_length)
then 616 if (available_as_string .eq. 1)
then 617 if (len(file_string) < file_length)
then 623 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
624 if (c_associated(pfile_raw_data))
then 625 call c_f_pointer(pfile_raw_data, file_raw_data_fpointer, [file_length])
627 nullify(file_raw_data_fpointer)
629 file_raw_data = file_raw_data_fpointer(1:file_length)
631 if (available_as_string .eq. 1)
then 632 call kim_convert_c_char_ptr_to_string(pfile_string, file_string)
644 collections_handle, item_type, extent, ierr)
645 use kim_interoperable_types_module
, only : kim_collections_type
649 integer(c_int) recursive function cache_list_of_item_names_by_type( &
650 collections, item_type, extent) &
651 bind(c, name=
"KIM_Collections_CacheListOfItemNamesByType")
652 use,
intrinsic :: iso_c_binding
653 use kim_interoperable_types_module
, only : kim_collections_type
655 kim_collection_item_type_type
657 type(kim_collections_type),
intent(in) :: collections
658 type(kim_collection_item_type_type),
intent(in),
value :: item_type
659 integer(c_int),
intent(out) :: extent
660 end function cache_list_of_item_names_by_type
662 type(kim_collections_handle_type),
intent(in) :: collections_handle
663 type(kim_collection_item_type_type),
intent(in) :: item_type
664 integer(c_int),
intent(out) :: extent
665 integer(c_int),
intent(out) :: ierr
666 type(kim_collections_type),
pointer :: collections
668 call c_f_pointer(collections_handle%p, collections)
669 ierr = cache_list_of_item_names_by_type(collections, item_type, extent)
678 collections_handle, index, item_name, ierr)
679 use kim_interoperable_types_module
, only : kim_collections_type
680 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
683 integer(c_int) recursive function get_item_name_by_type(collections, &
684 index, item_name) bind(c, name="KIM_Collections_GetItemNameByType")
685 use,
intrinsic :: iso_c_binding
686 use kim_interoperable_types_module
, only : kim_collections_type
688 type(kim_collections_type),
intent(in) :: collections
689 integer(c_int),
intent(in),
value :: index
690 type(c_ptr),
intent(out) :: item_name
691 end function get_item_name_by_type
693 type(kim_collections_handle_type),
intent(in) :: collections_handle
694 integer(c_int),
intent(in) :: index
695 character(len=*, kind=c_char),
intent(out) :: item_name
696 integer(c_int),
intent(out) :: ierr
697 type(kim_collections_type),
pointer :: collections
699 type(c_ptr) pitem_name
701 call c_f_pointer(collections_handle%p, collections)
702 ierr = get_item_name_by_type(collections, index-1, pitem_name)
703 call kim_convert_c_char_ptr_to_string(pitem_name, item_name)
712 recursive subroutine &
714 collections_handle, collection, item_type, extent, ierr)
715 use kim_interoperable_types_module
, only : kim_collections_type
720 integer(c_int) recursive function &
721 cache_list_of_item_names_by_collection_and_type(collections, &
722 collection, item_type, extent) &
723 bind(c, name=
"KIM_Collections_CacheListOfItemNamesByCollectionAndType")
724 use,
intrinsic :: iso_c_binding
725 use kim_interoperable_types_module
, only : kim_collections_type
728 kim_collection_item_type_type
730 type(kim_collections_type),
intent(in) :: collections
731 type(kim_collection_type),
intent(in),
value :: collection
732 type(kim_collection_item_type_type),
intent(in),
value :: item_type
733 integer(c_int),
intent(out) :: extent
734 end function cache_list_of_item_names_by_collection_and_type
736 type(kim_collections_handle_type),
intent(in) :: collections_handle
737 type(kim_collection_type),
intent(in) :: collection
738 type(kim_collection_item_type_type),
intent(in) :: item_type
739 integer(c_int),
intent(out) :: extent
740 integer(c_int),
intent(out) :: ierr
741 type(kim_collections_type),
pointer :: collections
743 call c_f_pointer(collections_handle%p, collections)
744 ierr = cache_list_of_item_names_by_collection_and_type(collections, &
745 collection, item_type, extent)
755 collections_handle, index, item_name, ierr)
756 use kim_interoperable_types_module
, only : kim_collections_type
757 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
760 integer(c_int) recursive function get_item_name_by_collection_and_type( &
761 collections, index, item_name) &
762 bind(c, name=
"KIM_Collections_GetItemNameByCollectionAndType")
763 use,
intrinsic :: iso_c_binding
764 use kim_interoperable_types_module
, only : kim_collections_type
766 type(kim_collections_type),
intent(in) :: collections
767 integer(c_int),
intent(in),
value :: index
768 type(c_ptr),
intent(out) :: item_name
769 end function get_item_name_by_collection_and_type
771 type(kim_collections_handle_type),
intent(in) :: collections_handle
772 integer(c_int),
intent(in) :: index
773 character(len=*, kind=c_char),
intent(out) :: item_name
774 integer(c_int),
intent(out) :: ierr
775 type(kim_collections_type),
pointer :: collections
777 type(c_ptr) pitem_name
779 call c_f_pointer(collections_handle%p, collections)
780 ierr = get_item_name_by_collection_and_type(collections, index-1, &
782 call kim_convert_c_char_ptr_to_string(pitem_name, item_name)
792 recursive subroutine &
794 collections_handle, collection, item_type, item_name, file_name, ierr)
795 use kim_interoperable_types_module
, only : kim_collections_type
796 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
801 integer(c_int) recursive function &
802 get_item_library_file_name_by_coll_and_type(collections, collection, &
803 item_type, item_name, file_name) bind(c, &
804 name=
"KIM_Collections_GetItemLibraryFileNameByCollectionAndType")
805 use,
intrinsic :: iso_c_binding
806 use kim_interoperable_types_module
, only : kim_collections_type
809 kim_collection_item_type_type
811 type(kim_collections_type),
intent(in) :: collections
812 type(kim_collection_type),
intent(in),
value :: collection
813 type(kim_collection_item_type_type),
intent(in),
value :: item_type
814 character(c_char),
intent(in) :: item_name(*)
815 type(c_ptr),
intent(out) :: file_name
816 end function get_item_library_file_name_by_coll_and_type
818 type(kim_collections_handle_type),
intent(in) :: collections_handle
819 type(kim_collection_type),
intent(in) :: collection
820 type(kim_collection_item_type_type),
intent(in) :: item_type
821 character(len=*, kind=c_char),
intent(in) :: item_name
822 character(len=*, kind=c_char),
intent(out) :: file_name
823 integer(c_int),
intent(out) :: ierr
824 type(kim_collections_type),
pointer :: collections
826 type(c_ptr) pfile_name
828 call c_f_pointer(collections_handle%p, collections)
829 ierr = get_item_library_file_name_by_coll_and_type(collections, &
830 collection, item_type, trim(item_name)//c_null_char, pfile_name)
831 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
841 recursive subroutine &
843 collections_handle, collection, item_type, item_name, extent, ierr)
844 use kim_interoperable_types_module
, only : kim_collections_type
849 integer(c_int) recursive function &
850 cache_list_of_item_metadata_files_by_coll_and_type(collections, &
851 collection, item_type, item_name, extent) bind(c, &
852 name=
"KIM_Collections_CacheListOfItemMetadataFilesByCollectionAndType")
853 use,
intrinsic :: iso_c_binding
854 use kim_interoperable_types_module
, only : kim_collections_type
857 kim_collection_item_type_type
859 type(kim_collections_type),
intent(in) :: collections
860 type(kim_collection_type),
intent(in),
value :: collection
861 type(kim_collection_item_type_type),
intent(in),
value :: item_type
862 character(c_char),
intent(in) :: item_name(*)
863 integer(c_int),
intent(out) :: extent
864 end function cache_list_of_item_metadata_files_by_coll_and_type
866 type(kim_collections_handle_type),
intent(in) :: collections_handle
867 type(kim_collection_type),
intent(in) :: collection
868 type(kim_collection_item_type_type),
intent(in) :: item_type
869 character(len=*, kind=c_char),
intent(in) :: item_name
870 integer(c_int),
intent(out) :: extent
871 integer(c_int),
intent(out) :: ierr
872 type(kim_collections_type),
pointer :: collections
874 call c_f_pointer(collections_handle%p, collections)
875 ierr = cache_list_of_item_metadata_files_by_coll_and_type(collections, &
876 collection, item_type, trim(item_name)//c_null_char, extent)
885 recursive subroutine &
887 collections_handle, index, file_length, available_as_string, ierr)
888 use kim_interoperable_types_module
, only : kim_collections_type
891 integer(c_int) recursive function &
892 get_item_metadata_file_length_by_coll_and_type(collections, index, &
893 file_name, file_length, file_raw_data, available_as_string, &
896 name=
"KIM_Collections_GetItemMetadataFileByCollectionAndType_fortran")
897 use,
intrinsic :: iso_c_binding
898 use kim_interoperable_types_module
, only : kim_collections_type
900 type(kim_collections_type),
intent(in) :: collections
901 integer(c_int),
intent(in),
value :: index
902 type(c_ptr),
intent(out) :: file_name
903 integer(c_long),
intent(out) :: file_length
904 type(c_ptr),
intent(out) :: file_raw_data
905 integer(c_int),
intent(out) :: available_as_string
906 type(c_ptr),
intent(out) :: file_string
907 end function get_item_metadata_file_length_by_coll_and_type
909 type(kim_collections_handle_type),
intent(in) :: collections_handle
910 integer(c_int),
intent(in),
value :: index
911 integer(c_long),
intent(out) :: file_length
912 integer(c_int),
intent(out) :: available_as_string
913 integer(c_int),
intent(out) :: ierr
914 type(kim_collections_type),
pointer :: collections
916 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
918 call c_f_pointer(collections_handle%p, collections)
919 ierr = get_item_metadata_file_length_by_coll_and_type(collections, &
920 index-1, pfile_name, file_length, pfile_raw_data, available_as_string, &
930 recursive subroutine &
932 collections_handle, index, file_name, file_raw_data, file_string, ierr)
933 use kim_interoperable_types_module
, only : kim_collections_type
934 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
937 integer(c_int) recursive function &
938 get_item_metadata_file_values_by_coll_and_type(collections, index, &
939 file_name, file_length, file_raw_data, available_as_string, &
942 name=
"KIM_Collections_GetItemMetadataFileByCollectionAndType_fortran")
943 use,
intrinsic :: iso_c_binding
944 use kim_interoperable_types_module
, only : kim_collections_type
946 type(kim_collections_type),
intent(in) :: collections
947 integer(c_int),
intent(in),
value :: index
948 type(c_ptr),
intent(out) :: file_name
949 integer(c_long),
intent(out) :: file_length
950 type(c_ptr),
intent(out) :: file_raw_data
951 integer(c_int),
intent(out) :: available_as_string
952 type(c_ptr),
intent(out) :: file_string
953 end function get_item_metadata_file_values_by_coll_and_type
955 type(kim_collections_handle_type),
intent(in) :: collections_handle
956 integer(c_int),
intent(in) :: index
957 character(len=*, kind=c_char),
intent(out) :: file_name
958 integer(c_signed_char),
intent(out) :: file_raw_data(:)
959 character(len=*, kind=c_char),
intent(out) :: file_string
960 integer(c_int),
intent(out) :: ierr
961 type(kim_collections_type),
pointer :: collections
963 integer(c_long) file_length
964 integer(c_int) available_as_string
965 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
966 integer(c_signed_char),
pointer :: file_raw_data_fpointer(:)
968 call c_f_pointer(collections_handle%p, collections)
969 ierr = get_item_metadata_file_values_by_coll_and_type(collections, &
970 index-1, pfile_name, file_length, pfile_raw_data, available_as_string, &
972 if (ierr .eq. 0)
then 973 if (
size(file_raw_data) < file_length)
then 977 if (available_as_string .eq. 1)
then 978 if (len(file_string) < file_length)
then 984 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
985 if (c_associated(pfile_raw_data))
then 986 call c_f_pointer(pfile_raw_data, file_raw_data_fpointer, [file_length])
988 nullify(file_raw_data_fpointer)
990 file_raw_data = file_raw_data_fpointer(1:file_length)
992 if (available_as_string .eq. 1)
then 993 call kim_convert_c_char_ptr_to_string(pfile_string, file_string)
1005 collections_handle, project_name, sem_ver)
1006 use kim_interoperable_types_module
, only : kim_collections_type
1007 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1010 recursive subroutine get_project_name_and_sem_ver(collections, &
1011 project_name, sem_ver) &
1012 bind(c, name=
"KIM_Collections_GetProjectNameAndSemVer")
1013 use,
intrinsic :: iso_c_binding
1014 use kim_interoperable_types_module
, only : kim_collections_type
1016 type(kim_collections_type),
intent(in) :: collections
1017 type(c_ptr),
intent(out) :: project_name
1018 type(c_ptr),
intent(out) :: sem_ver
1019 end subroutine get_project_name_and_sem_ver
1021 type(kim_collections_handle_type),
intent(in) :: collections_handle
1022 character(len=*, kind=c_char),
intent(out) :: project_name
1023 character(len=*, kind=c_char),
intent(out) :: sem_ver
1024 type(kim_collections_type),
pointer :: collections
1026 type(c_ptr) pproject_name, psem_ver
1028 call c_f_pointer(collections_handle%p, collections)
1029 call get_project_name_and_sem_ver(collections, pproject_name, psem_ver)
1030 call kim_convert_c_char_ptr_to_string(pproject_name, project_name)
1031 call kim_convert_c_char_ptr_to_string(psem_ver, sem_ver)
1041 collections_handle, item_type, name, ierr)
1042 use kim_interoperable_types_module
, only : kim_collections_type
1043 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1047 integer(c_int) recursive function get_environment_variable_name( &
1048 collections, item_type, name) &
1049 bind(c, name=
"KIM_Collections_GetEnvironmentVariableName")
1050 use,
intrinsic :: iso_c_binding
1051 use kim_interoperable_types_module
, only : kim_collections_type
1053 kim_collection_item_type_type
1055 type(kim_collections_type),
intent(in) :: collections
1056 type(kim_collection_item_type_type),
intent(in),
value :: item_type
1057 type(c_ptr),
intent(out) :: name
1058 end function get_environment_variable_name
1060 type(kim_collections_handle_type),
intent(in) :: collections_handle
1061 type(kim_collection_item_type_type),
intent(in) :: item_type
1062 character(len=*, kind=c_char),
intent(out) :: name
1063 integer(c_int),
intent(out) :: ierr
1064 type(kim_collections_type),
pointer :: collections
1068 call c_f_pointer(collections_handle%p, collections)
1069 ierr = get_environment_variable_name(collections, item_type, pname)
1070 call kim_convert_c_char_ptr_to_string(pname, name)
1079 recursive subroutine &
1081 collections_handle, name,
value)
1082 use kim_interoperable_types_module
, only : kim_collections_type
1083 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1086 recursive subroutine get_configuration_file_environment_variable( &
1087 collections, name, value) &
1088 bind(c, name=
"KIM_Collections_GetConfigurationFileEnvironmentVariable")
1089 use,
intrinsic :: iso_c_binding
1090 use kim_interoperable_types_module
, only : kim_collections_type
1092 type(kim_collections_type),
intent(in) :: collections
1093 type(c_ptr),
intent(out) :: name
1094 type(c_ptr),
intent(out) :: value
1095 end subroutine get_configuration_file_environment_variable
1097 type(kim_collections_handle_type),
intent(in) :: collections_handle
1098 character(len=*, kind=c_char),
intent(out) :: name
1099 character(len=*, kind=c_char),
intent(out) :: value
1100 type(kim_collections_type),
pointer :: collections
1102 type(c_ptr) pname, pvalue
1104 call c_f_pointer(collections_handle%p, collections)
1105 call get_configuration_file_environment_variable(collections, pname, pvalue)
1106 call kim_convert_c_char_ptr_to_string(pname, name)
1107 call kim_convert_c_char_ptr_to_string(pvalue,
value)
1117 collections_handle, file_name)
1118 use kim_interoperable_types_module
, only : kim_collections_type
1119 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1122 recursive subroutine get_configuration_file_name(collections, file_name) &
1123 bind(c, name=
"KIM_Collections_GetConfigurationFileName")
1124 use,
intrinsic :: iso_c_binding
1125 use kim_interoperable_types_module
, only : kim_collections_type
1127 type(kim_collections_type),
intent(in) :: collections
1128 type(c_ptr),
intent(out) :: file_name
1129 end subroutine get_configuration_file_name
1131 type(kim_collections_handle_type),
intent(in) :: collections_handle
1132 character(len=*, kind=c_char),
intent(out) :: file_name
1133 type(kim_collections_type),
pointer :: collections
1135 type(c_ptr) pfile_name
1137 call c_f_pointer(collections_handle%p, collections)
1138 call get_configuration_file_name(collections, pfile_name)
1139 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
1149 collections_handle, collection, item_type, extent, ierr)
1150 use kim_interoperable_types_module
, only : kim_collections_type
1155 integer(c_int) recursive function cache_list_of_directory_names( &
1156 collections, collection, item_type, extent) &
1157 bind(c, name=
"KIM_Collections_CacheListOfDirectoryNames")
1158 use,
intrinsic :: iso_c_binding
1159 use kim_interoperable_types_module
, only : kim_collections_type
1162 kim_collection_item_type_type
1164 type(kim_collections_type),
intent(in) :: collections
1165 type(kim_collection_type),
intent(in),
value :: collection
1166 type(kim_collection_item_type_type),
intent(in),
value :: item_type
1167 integer(c_int),
intent(out) :: extent
1168 end function cache_list_of_directory_names
1170 type(kim_collections_handle_type),
intent(in) :: collections_handle
1171 type(kim_collection_type),
intent(in) :: collection
1172 type(kim_collection_item_type_type),
intent(in) :: item_type
1173 integer(c_int),
intent(out) :: extent
1174 integer(c_int),
intent(out) :: ierr
1175 type(kim_collections_type),
pointer :: collections
1177 call c_f_pointer(collections_handle%p, collections)
1178 ierr = cache_list_of_directory_names(collections, collection, item_type, &
1188 index, directory_name, ierr)
1189 use kim_interoperable_types_module
, only : kim_collections_type
1190 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1193 integer(c_int) recursive function get_directory_name(collections, index, &
1195 bind(c, name=
"KIM_Collections_GetDirectoryName")
1196 use,
intrinsic :: iso_c_binding
1197 use kim_interoperable_types_module
, only : kim_collections_type
1199 type(kim_collections_type),
intent(in) :: collections
1200 integer(c_int),
intent(in),
value :: index
1201 type(c_ptr),
intent(out) :: directory_name
1202 end function get_directory_name
1204 type(kim_collections_handle_type),
intent(in) :: collections_handle
1205 integer(c_int),
intent(in) :: index
1206 character(len=*, kind=c_char),
intent(out) :: directory_name
1207 integer(c_int),
intent(out) :: ierr
1208 type(kim_collections_type),
pointer :: collections
1210 type(c_ptr) pdirectory_name
1212 call c_f_pointer(collections_handle%p, collections)
1213 ierr = get_directory_name(collections, index-1, pdirectory_name)
1214 call kim_convert_c_char_ptr_to_string(pdirectory_name, directory_name)
1223 use kim_interoperable_types_module
, only : kim_collections_type
1226 recursive subroutine set_log_id(collections, log_id) &
1227 bind(c, name=
"KIM_Collections_SetLogID")
1228 use,
intrinsic :: iso_c_binding
1229 use kim_interoperable_types_module
, only : kim_collections_type
1231 type(kim_collections_type),
intent(in) :: collections
1232 character(c_char),
intent(in) :: log_id(*)
1233 end subroutine set_log_id
1235 type(kim_collections_handle_type),
intent(in) :: collections_handle
1236 character(len=*, kind=c_char),
intent(in) :: log_id
1237 type(kim_collections_type),
pointer :: collections
1239 call c_f_pointer(collections_handle%p, collections)
1240 call set_log_id(collections, trim(log_id)//c_null_char)
1251 use kim_interoperable_types_module
, only : kim_collections_type
1254 recursive subroutine push_log_verbosity(collections, log_verbosity) &
1255 bind(c, name=
"KIM_Collections_PushLogVerbosity")
1256 use,
intrinsic :: iso_c_binding
1258 use kim_interoperable_types_module
, only : kim_collections_type
1260 type(kim_collections_type),
intent(in) :: collections
1261 type(kim_log_verbosity_type),
intent(in),
value :: log_verbosity
1262 end subroutine push_log_verbosity
1264 type(kim_collections_handle_type),
intent(in) :: collections_handle
1265 type(kim_log_verbosity_type),
intent(in) :: log_verbosity
1266 type(kim_collections_type),
pointer :: collections
1268 call c_f_pointer(collections_handle%p, collections)
1269 call push_log_verbosity(collections, log_verbosity)
1279 use kim_interoperable_types_module
, only : kim_collections_type
1282 recursive subroutine pop_log_verbosity(collections) &
1283 bind(c, name=
"KIM_Collections_PopLogVerbosity")
1284 use,
intrinsic :: iso_c_binding
1286 use kim_interoperable_types_module
, only : kim_collections_type
1288 type(kim_collections_type),
intent(in) :: collections
1289 end subroutine pop_log_verbosity
1291 type(kim_collections_handle_type),
intent(in) :: collections_handle
1292 type(kim_collections_type),
pointer :: collections
1294 call c_f_pointer(collections_handle%p, collections)
1295 call pop_log_verbosity(collections)
recursive subroutine kim_collections_get_item_metadata_file_length_by_coll_and_type(collections_handle, index, file_length, available_as_string, ierr)
Get the name and content of one of an item's metadata files.
recursive subroutine kim_collections_get_item_library_file_name_by_coll_and_type(collections_handle, collection, item_type, item_name, file_name, ierr)
Get the item's library file name.
An Extensible Enumeration for the CollectionItemType's supported by the KIM API.
recursive subroutine kim_collections_set_log_id(collections_handle, log_id)
Set the identity of the Log object associated with the Collections object.
recursive subroutine, public kim_collections_create(collections_handle, ierr)
Create a new KIM API Collections object.
Provides the interface to the KIM API Collections and is meant to be used by simulators.
recursive subroutine kim_collections_get_item_name_by_type(collections_handle, index, item_name, ierr)
Get the name of an item from the cached list.
recursive subroutine kim_collections_cache_list_of_item_names_by_collection_and_type(collections_handle, collection, item_type, extent, ierr)
Cache a list of all item names of a specific type in a specific collection.
recursive subroutine kim_collections_get_environment_variable_name(collections_handle, item_type, name, ierr)
Get the names of environment variables that store configuration settings for the KIM::COLLECTION::env...
recursive subroutine kim_collections_push_log_verbosity(collections_handle, log_verbosity)
Push a new LogVerbosity onto the Collections object's Log object verbosity stack. ...
recursive subroutine kim_collections_get_directory_name(collections_handle, index, directory_name, ierr)
Get the name of a directory from the cached list.
recursive subroutine kim_collections_get_item_metadata_file_length(collections_handle, index, file_length, available_as_string, ierr)
Get item metadata file length and determine if the file is available as a string. ...
type(kim_collections_handle_type), save, public, protected kim_collections_null_handle
NULL handle for use in comparisons.
recursive subroutine kim_collections_get_item_metadata_file_values_by_coll_and_type(collections_handle, index, file_name, file_raw_data, file_string, ierr)
Get the item's metadata file values.
recursive subroutine kim_collections_get_item_name_by_collection_and_type(collections_handle, index, item_name, ierr)
Get the name of an item from the cached list.
recursive subroutine kim_colls_cache_list_of_item_metadata_files_by_coll_and_type(collections_handle, collection, item_type, item_name, extent, ierr)
Cache a list of an item's metadata files.
recursive subroutine kim_collections_get_configuration_file_environment_variable(collections_handle, name, value)
Get the name and value of the environment variable that stores the name of the KIM API user configura...
recursive subroutine kim_collections_cache_list_of_item_names_by_type(collections_handle, item_type, extent, ierr)
Cache a list of all item names of a specific type in the KIM API collections.
recursive subroutine kim_collections_cache_list_of_directory_names(collections_handle, collection, item_type, extent, ierr)
Cache a list of directory names where a specific KIM API collection stores library files for a specif...
recursive subroutine kim_collections_get_configuration_file_name(collections_handle, file_name)
Get the absolute file and path name of the KIM API user configuration file.
recursive subroutine kim_collections_get_item_library_file_name_and_collection(collections_handle, item_type, item_name, file_name, collection, ierr)
Get the item's library file name and its KIM::Collection.
recursive subroutine kim_collections_cache_list_of_item_metadata_files(collections_handle, item_type, item_name, extent, ierr)
Cache a list of an item's metadata files.
recursive subroutine kim_collections_get_project_name_and_sem_ver(collections_handle, project_name, sem_ver)
Get the KIM API project name and full Semantic Version string.
An Extensible Enumeration for the Collection's supported by the KIM API.
recursive subroutine kim_collections_get_item_metadata_file_values(collections_handle, index, file_name, file_raw_data, file_string, ierr)
Get the item's metadata file values.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.
recursive subroutine kim_collections_pop_log_verbosity(collections_handle)
Pop a LogVerbosity from the Collections object's Log object verbosity stack.
recursive subroutine, public kim_collections_destroy(collections_handle)
Destroy a previously Collections::Create'd object.