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, &
413 use kim_interoperable_types_module
, only : kim_collections_type
417 integer(c_int) recursive function get_item_type(collections, item_type) &
418 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 type(kim_collection_item_type_type),
intent(out) :: item_type
426 end function get_item_type
428 type(kim_collections_handle_type),
intent(in) :: collections_handle
429 type(kim_collection_item_type_type),
intent(out) :: item_type
430 integer(c_int),
intent(out) :: ierr
431 type(kim_collections_type),
pointer :: collections
433 call c_f_pointer(collections_handle%p, collections)
434 ierr = get_item_type(collections, item_type)
435 end subroutine kim_collections_get_item_type
443 recursive subroutine &
445 collections_handle, item_name, file_name, collection, ierr)
446 use kim_interoperable_types_module
, only : kim_collections_type
447 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
451 integer(c_int) recursive function &
452 get_item_library_file_name_and_collection(collections, item_name, &
453 file_name, collection) &
454 bind(c, name=
"KIM_Collections_GetItemLibraryFileNameAndCollection")
455 use,
intrinsic :: iso_c_binding
456 use kim_interoperable_types_module
, only : kim_collections_type
459 type(kim_collections_type),
intent(in) :: collections
460 character(c_char),
intent(in) :: item_name(*)
461 type(c_ptr),
intent(out) :: file_name
462 type(kim_collection_type),
intent(out) :: collection
463 end function get_item_library_file_name_and_collection
465 type(kim_collections_handle_type),
intent(in) :: collections_handle
466 character(len=*, kind=c_char),
intent(in) :: item_name
467 character(len=*, kind=c_char),
intent(out) :: file_name
468 type(kim_collection_type),
intent(out) :: collection
469 integer(c_int),
intent(out) :: ierr
470 type(kim_collections_type),
pointer :: collections
472 type(c_ptr) :: pfile_name
474 call c_f_pointer(collections_handle%p, collections)
475 ierr = get_item_library_file_name_and_collection(collections, &
476 trim(item_name)//c_null_char, pfile_name, collection)
477 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
487 collections_handle, item_type, item_name, extent, ierr)
488 use kim_interoperable_types_module
, only : kim_collections_type
492 integer(c_int) recursive function cache_list_of_item_metadata_files( &
493 collections, item_type, item_name, extent) &
494 bind(c, name=
"KIM_Collections_CacheListOfItemMetadataFiles")
495 use,
intrinsic :: iso_c_binding
496 use kim_interoperable_types_module
, only : kim_collections_type
498 kim_collection_item_type_type
500 type(kim_collections_type),
intent(in) :: collections
501 type(kim_collection_item_type_type),
intent(in),
value :: item_type
502 character(c_char),
intent(in) :: item_name(*)
503 integer(c_int),
intent(out) :: extent
504 end function cache_list_of_item_metadata_files
506 type(kim_collections_handle_type),
intent(in) :: collections_handle
507 type(kim_collection_item_type_type),
intent(in) :: item_type
508 character(len=*, kind=c_char),
intent(in) :: item_name
509 integer(c_int),
intent(out) :: extent
510 integer(c_int),
intent(out) :: ierr
511 type(kim_collections_type),
pointer :: collections
513 call c_f_pointer(collections_handle%p, collections)
514 ierr = cache_list_of_item_metadata_files(collections, item_type, &
515 trim(item_name)//c_null_char, extent)
526 collections_handle, index, file_length, available_as_string, ierr)
527 use kim_interoperable_types_module
, only : kim_collections_type
530 integer(c_int) recursive function get_item_metadata_file_length( &
531 collections, index, file_name, file_length, file_raw_data, &
532 available_as_string, file_string) &
533 bind(c, name=
"KIM_Collections_GetItemMetadataFile")
534 use,
intrinsic :: iso_c_binding
535 use kim_interoperable_types_module
, only : kim_collections_type
537 type(kim_collections_type),
intent(in) :: collections
538 integer(c_int),
intent(in),
value :: index
539 type(c_ptr),
intent(out) :: file_name
540 integer(c_int),
intent(out) :: file_length
541 type(c_ptr),
intent(out) :: file_raw_data
542 integer(c_int),
intent(out) :: available_as_string
543 type(c_ptr),
intent(out) :: file_string
544 end function get_item_metadata_file_length
546 type(kim_collections_handle_type),
intent(in) :: collections_handle
547 integer(c_int),
intent(in) :: index
548 integer(c_long),
intent(out) :: file_length
549 integer(c_int),
intent(out) :: available_as_string
550 integer(c_int),
intent(out) :: ierr
551 type(kim_collections_type),
pointer :: collections
553 integer(c_int) dfile_length
554 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
556 call c_f_pointer(collections_handle%p, collections)
557 ierr = get_item_metadata_file_length(collections, index-1, pfile_name, &
558 dfile_length, pfile_raw_data, available_as_string, pfile_string)
559 if (ierr .eq. 0)
then 560 if (dfile_length < 0)
then 561 file_length = 2*(2147483648_c_long) + int(dfile_length, c_long)
563 file_length = int(dfile_length, c_long)
575 collections_handle, index, file_name, file_raw_data, file_string, ierr)
576 use kim_interoperable_types_module
, only : kim_collections_type
577 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
580 integer(c_int) recursive function get_item_metadata_file_values( &
581 collections, index, file_name, file_length, file_raw_data, &
582 available_as_string, file_string) &
583 bind(c, name=
"KIM_Collections_GetItemMetadataFile")
584 use,
intrinsic :: iso_c_binding
585 use kim_interoperable_types_module
, only : kim_collections_type
587 type(kim_collections_type),
intent(in) :: collections
588 integer(c_int),
intent(in),
value :: index
589 type(c_ptr),
intent(out) :: file_name
590 integer(c_int),
intent(out) :: file_length
591 type(c_ptr),
intent(out) :: file_raw_data
592 integer(c_int),
intent(out) :: available_as_string
593 type(c_ptr),
intent(out) :: file_string
594 end function get_item_metadata_file_values
596 type(kim_collections_handle_type),
intent(in) :: collections_handle
597 integer(c_int),
intent(in) :: index
598 character(len=*, kind=c_char),
intent(out) :: file_name
599 integer(c_signed_char),
intent(out) :: file_raw_data(:)
600 character(len=*, kind=c_char),
intent(out) :: file_string
601 integer(c_int),
intent(out) :: ierr
602 type(kim_collections_type),
pointer :: collections
604 integer(c_int) dfile_length
605 integer(c_long) file_length
606 integer(c_int) available_as_string
607 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
608 integer(c_signed_char),
pointer :: file_raw_data_fpointer(:)
610 call c_f_pointer(collections_handle%p, collections)
611 ierr = get_item_metadata_file_values(collections, index-1, pfile_name, &
612 dfile_length, pfile_raw_data, available_as_string, pfile_string)
613 if (ierr .eq. 0)
then 614 if (dfile_length < 0)
then 615 file_length = 2*(2147483648_c_long) + int(dfile_length, c_long)
617 file_length = int(dfile_length, c_long)
619 if (
size(file_raw_data) < file_length)
then 623 if (available_as_string .eq. 1)
then 624 if (len(file_string) < file_length)
then 630 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
631 if (c_associated(pfile_raw_data))
then 632 call c_f_pointer(pfile_raw_data, file_raw_data_fpointer, [file_length])
634 nullify(file_raw_data_fpointer)
636 file_raw_data = file_raw_data_fpointer(1:file_length)
638 if (available_as_string .eq. 1)
then 639 call kim_convert_c_char_ptr_to_string(pfile_string, file_string)
651 collections_handle, item_type, extent, ierr)
652 use kim_interoperable_types_module
, only : kim_collections_type
656 integer(c_int) recursive function cache_list_of_item_names_by_type( &
657 collections, item_type, extent) &
658 bind(c, name=
"KIM_Collections_CacheListOfItemNamesByType")
659 use,
intrinsic :: iso_c_binding
660 use kim_interoperable_types_module
, only : kim_collections_type
662 kim_collection_item_type_type
664 type(kim_collections_type),
intent(in) :: collections
665 type(kim_collection_item_type_type),
intent(in),
value :: item_type
666 integer(c_int),
intent(out) :: extent
667 end function cache_list_of_item_names_by_type
669 type(kim_collections_handle_type),
intent(in) :: collections_handle
670 type(kim_collection_item_type_type),
intent(in) :: item_type
671 integer(c_int),
intent(out) :: extent
672 integer(c_int),
intent(out) :: ierr
673 type(kim_collections_type),
pointer :: collections
675 call c_f_pointer(collections_handle%p, collections)
676 ierr = cache_list_of_item_names_by_type(collections, item_type, extent)
685 collections_handle, index, item_name, ierr)
686 use kim_interoperable_types_module
, only : kim_collections_type
687 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
690 integer(c_int) recursive function get_item_name_by_type(collections, &
691 index, item_name) bind(c, name="KIM_Collections_GetItemNameByType")
692 use,
intrinsic :: iso_c_binding
693 use kim_interoperable_types_module
, only : kim_collections_type
695 type(kim_collections_type),
intent(in) :: collections
696 integer(c_int),
intent(in),
value :: index
697 type(c_ptr),
intent(out) :: item_name
698 end function get_item_name_by_type
700 type(kim_collections_handle_type),
intent(in) :: collections_handle
701 integer(c_int),
intent(in) :: index
702 character(len=*, kind=c_char),
intent(out) :: item_name
703 integer(c_int),
intent(out) :: ierr
704 type(kim_collections_type),
pointer :: collections
706 type(c_ptr) pitem_name
708 call c_f_pointer(collections_handle%p, collections)
709 ierr = get_item_name_by_type(collections, index-1, pitem_name)
710 call kim_convert_c_char_ptr_to_string(pitem_name, item_name)
719 recursive subroutine &
721 collections_handle, collection, item_type, extent, ierr)
722 use kim_interoperable_types_module
, only : kim_collections_type
727 integer(c_int) recursive function &
728 cache_list_of_item_names_by_collection_and_type(collections, &
729 collection, item_type, extent) &
730 bind(c, name=
"KIM_Collections_CacheListOfItemNamesByCollectionAndType")
731 use,
intrinsic :: iso_c_binding
732 use kim_interoperable_types_module
, only : kim_collections_type
735 kim_collection_item_type_type
737 type(kim_collections_type),
intent(in) :: collections
738 type(kim_collection_type),
intent(in),
value :: collection
739 type(kim_collection_item_type_type),
intent(in),
value :: item_type
740 integer(c_int),
intent(out) :: extent
741 end function cache_list_of_item_names_by_collection_and_type
743 type(kim_collections_handle_type),
intent(in) :: collections_handle
744 type(kim_collection_type),
intent(in) :: collection
745 type(kim_collection_item_type_type),
intent(in) :: item_type
746 integer(c_int),
intent(out) :: extent
747 integer(c_int),
intent(out) :: ierr
748 type(kim_collections_type),
pointer :: collections
750 call c_f_pointer(collections_handle%p, collections)
751 ierr = cache_list_of_item_names_by_collection_and_type(collections, &
752 collection, item_type, extent)
762 collections_handle, index, item_name, ierr)
763 use kim_interoperable_types_module
, only : kim_collections_type
764 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
767 integer(c_int) recursive function get_item_name_by_collection_and_type( &
768 collections, index, item_name) &
769 bind(c, name=
"KIM_Collections_GetItemNameByCollectionAndType")
770 use,
intrinsic :: iso_c_binding
771 use kim_interoperable_types_module
, only : kim_collections_type
773 type(kim_collections_type),
intent(in) :: collections
774 integer(c_int),
intent(in),
value :: index
775 type(c_ptr),
intent(out) :: item_name
776 end function get_item_name_by_collection_and_type
778 type(kim_collections_handle_type),
intent(in) :: collections_handle
779 integer(c_int),
intent(in) :: index
780 character(len=*, kind=c_char),
intent(out) :: item_name
781 integer(c_int),
intent(out) :: ierr
782 type(kim_collections_type),
pointer :: collections
784 type(c_ptr) pitem_name
786 call c_f_pointer(collections_handle%p, collections)
787 ierr = get_item_name_by_collection_and_type(collections, index-1, &
789 call kim_convert_c_char_ptr_to_string(pitem_name, item_name)
799 recursive subroutine &
801 collections_handle, collection, item_type, item_name, file_name, ierr)
802 use kim_interoperable_types_module
, only : kim_collections_type
803 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
808 integer(c_int) recursive function &
809 get_item_library_file_name_by_coll_and_type(collections, collection, &
810 item_type, item_name, file_name) bind(c, &
811 name=
"KIM_Collections_GetItemLibraryFileNameByCollectionAndType")
812 use,
intrinsic :: iso_c_binding
813 use kim_interoperable_types_module
, only : kim_collections_type
816 kim_collection_item_type_type
818 type(kim_collections_type),
intent(in) :: collections
819 type(kim_collection_type),
intent(in),
value :: collection
820 type(kim_collection_item_type_type),
intent(in),
value :: item_type
821 character(c_char),
intent(in) :: item_name(*)
822 type(c_ptr),
intent(out) :: file_name
823 end function get_item_library_file_name_by_coll_and_type
825 type(kim_collections_handle_type),
intent(in) :: collections_handle
826 type(kim_collection_type),
intent(in) :: collection
827 type(kim_collection_item_type_type),
intent(in) :: item_type
828 character(len=*, kind=c_char),
intent(in) :: item_name
829 character(len=*, kind=c_char),
intent(out) :: file_name
830 integer(c_int),
intent(out) :: ierr
831 type(kim_collections_type),
pointer :: collections
833 type(c_ptr) pfile_name
835 call c_f_pointer(collections_handle%p, collections)
836 ierr = get_item_library_file_name_by_coll_and_type(collections, &
837 collection, item_type, trim(item_name)//c_null_char, pfile_name)
838 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
848 recursive subroutine &
850 collections_handle, collection, item_type, item_name, extent, ierr)
851 use kim_interoperable_types_module
, only : kim_collections_type
856 integer(c_int) recursive function &
857 cache_list_of_item_metadata_files_by_coll_and_type(collections, &
858 collection, item_type, item_name, extent) bind(c, &
859 name=
"KIM_Collections_CacheListOfItemMetadataFilesByCollectionAndType")
860 use,
intrinsic :: iso_c_binding
861 use kim_interoperable_types_module
, only : kim_collections_type
864 kim_collection_item_type_type
866 type(kim_collections_type),
intent(in) :: collections
867 type(kim_collection_type),
intent(in),
value :: collection
868 type(kim_collection_item_type_type),
intent(in),
value :: item_type
869 character(c_char),
intent(in) :: item_name(*)
870 integer(c_int),
intent(out) :: extent
871 end function cache_list_of_item_metadata_files_by_coll_and_type
873 type(kim_collections_handle_type),
intent(in) :: collections_handle
874 type(kim_collection_type),
intent(in) :: collection
875 type(kim_collection_item_type_type),
intent(in) :: item_type
876 character(len=*, kind=c_char),
intent(in) :: item_name
877 integer(c_int),
intent(out) :: extent
878 integer(c_int),
intent(out) :: ierr
879 type(kim_collections_type),
pointer :: collections
881 call c_f_pointer(collections_handle%p, collections)
882 ierr = cache_list_of_item_metadata_files_by_coll_and_type(collections, &
883 collection, item_type, trim(item_name)//c_null_char, extent)
892 recursive subroutine &
894 collections_handle, index, file_length, available_as_string, ierr)
895 use kim_interoperable_types_module
, only : kim_collections_type
898 integer(c_int) recursive function &
899 get_item_metadata_file_length_by_coll_and_type(collections, index, &
900 file_name, file_length, file_raw_data, available_as_string, &
902 bind(c, name=
"KIM_Collections_GetItemMetadataFileByCollectionAndType")
903 use,
intrinsic :: iso_c_binding
904 use kim_interoperable_types_module
, only : kim_collections_type
906 type(kim_collections_type),
intent(in) :: collections
907 integer(c_int),
intent(in),
value :: index
908 type(c_ptr),
intent(out) :: file_name
909 integer(c_int),
intent(out) :: file_length
910 type(c_ptr),
intent(out) :: file_raw_data
911 integer(c_int),
intent(out) :: available_as_string
912 type(c_ptr),
intent(out) :: file_string
913 end function get_item_metadata_file_length_by_coll_and_type
915 type(kim_collections_handle_type),
intent(in) :: collections_handle
916 integer(c_int),
intent(in),
value :: index
917 integer(c_long),
intent(out) :: file_length
918 integer(c_int),
intent(out) :: available_as_string
919 integer(c_int),
intent(out) :: ierr
920 type(kim_collections_type),
pointer :: collections
922 integer(c_int) dfile_length
923 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
925 call c_f_pointer(collections_handle%p, collections)
926 ierr = get_item_metadata_file_length_by_coll_and_type(collections, &
927 index-1, pfile_name, dfile_length, pfile_raw_data, available_as_string, &
929 if (ierr .eq. 0)
then 930 if (dfile_length < 0)
then 931 file_length = 2*(2147483648_c_long) + int(dfile_length, c_long)
933 file_length = int(dfile_length, c_long)
944 recursive subroutine &
946 collections_handle, index, file_name, file_raw_data, file_string, ierr)
947 use kim_interoperable_types_module
, only : kim_collections_type
948 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
951 integer(c_int) recursive function &
952 get_item_metadata_file_values_by_coll_and_type(collections, index, &
953 file_name, file_length, file_raw_data, available_as_string, &
955 bind(c, name=
"KIM_Collections_GetItemMetadataFileByCollectionAndType")
956 use,
intrinsic :: iso_c_binding
957 use kim_interoperable_types_module
, only : kim_collections_type
959 type(kim_collections_type),
intent(in) :: collections
960 integer(c_int),
intent(in),
value :: index
961 type(c_ptr),
intent(out) :: file_name
962 integer(c_int),
intent(out) :: file_length
963 type(c_ptr),
intent(out) :: file_raw_data
964 integer(c_int),
intent(out) :: available_as_string
965 type(c_ptr),
intent(out) :: file_string
966 end function get_item_metadata_file_values_by_coll_and_type
968 type(kim_collections_handle_type),
intent(in) :: collections_handle
969 integer(c_int),
intent(in) :: index
970 character(len=*, kind=c_char),
intent(out) :: file_name
971 integer(c_signed_char),
intent(out) :: file_raw_data(:)
972 character(len=*, kind=c_char),
intent(out) :: file_string
973 integer(c_int),
intent(out) :: ierr
974 type(kim_collections_type),
pointer :: collections
976 integer(c_int) dfile_length
977 integer(c_long) file_length
978 integer(c_int) available_as_string
979 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
980 integer(c_signed_char),
pointer :: file_raw_data_fpointer(:)
982 call c_f_pointer(collections_handle%p, collections)
983 ierr = get_item_metadata_file_values_by_coll_and_type(collections, &
984 index-1, pfile_name, dfile_length, pfile_raw_data, available_as_string, &
986 if (ierr .eq. 0)
then 987 if (dfile_length < 0)
then 988 file_length = 2*(2147483648_c_long) + int(dfile_length, c_long)
990 file_length = int(dfile_length, c_long)
992 if (
size(file_raw_data) < file_length)
then 996 if (available_as_string .eq. 1)
then 997 if (len(file_string) < file_length)
then 1003 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
1004 if (c_associated(pfile_raw_data))
then 1005 call c_f_pointer(pfile_raw_data, file_raw_data_fpointer, [file_length])
1007 nullify(file_raw_data_fpointer)
1009 file_raw_data = file_raw_data_fpointer(1:file_length)
1011 if (available_as_string .eq. 1)
then 1012 call kim_convert_c_char_ptr_to_string(pfile_string, file_string)
1024 collections_handle, project_name, sem_ver)
1025 use kim_interoperable_types_module
, only : kim_collections_type
1026 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1029 recursive subroutine get_project_name_and_sem_ver(collections, &
1030 project_name, sem_ver) &
1031 bind(c, name=
"KIM_Collections_GetProjectNameAndSemVer")
1032 use,
intrinsic :: iso_c_binding
1033 use kim_interoperable_types_module
, only : kim_collections_type
1035 type(kim_collections_type),
intent(in) :: collections
1036 type(c_ptr),
intent(out) :: project_name
1037 type(c_ptr),
intent(out) :: sem_ver
1038 end subroutine get_project_name_and_sem_ver
1040 type(kim_collections_handle_type),
intent(in) :: collections_handle
1041 character(len=*, kind=c_char),
intent(out) :: project_name
1042 character(len=*, kind=c_char),
intent(out) :: sem_ver
1043 type(kim_collections_type),
pointer :: collections
1045 type(c_ptr) pproject_name, psem_ver
1047 call c_f_pointer(collections_handle%p, collections)
1048 call get_project_name_and_sem_ver(collections, pproject_name, psem_ver)
1049 call kim_convert_c_char_ptr_to_string(pproject_name, project_name)
1050 call kim_convert_c_char_ptr_to_string(psem_ver, sem_ver)
1060 collections_handle, item_type, name, ierr)
1061 use kim_interoperable_types_module
, only : kim_collections_type
1062 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1066 integer(c_int) recursive function get_environment_variable_name( &
1067 collections, item_type, name) &
1068 bind(c, name=
"KIM_Collections_GetEnvironmentVariableName")
1069 use,
intrinsic :: iso_c_binding
1070 use kim_interoperable_types_module
, only : kim_collections_type
1072 kim_collection_item_type_type
1074 type(kim_collections_type),
intent(in) :: collections
1075 type(kim_collection_item_type_type),
intent(in),
value :: item_type
1076 type(c_ptr),
intent(out) :: name
1077 end function get_environment_variable_name
1079 type(kim_collections_handle_type),
intent(in) :: collections_handle
1080 type(kim_collection_item_type_type),
intent(in) :: item_type
1081 character(len=*, kind=c_char),
intent(out) :: name
1082 integer(c_int),
intent(out) :: ierr
1083 type(kim_collections_type),
pointer :: collections
1087 call c_f_pointer(collections_handle%p, collections)
1088 ierr = get_environment_variable_name(collections, item_type, pname)
1089 call kim_convert_c_char_ptr_to_string(pname, name)
1098 recursive subroutine &
1100 collections_handle, name,
value)
1101 use kim_interoperable_types_module
, only : kim_collections_type
1102 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1105 recursive subroutine get_configuration_file_environment_variable( &
1106 collections, name, value) &
1107 bind(c, name=
"KIM_Collections_GetConfigurationFileEnvironmentVariable")
1108 use,
intrinsic :: iso_c_binding
1109 use kim_interoperable_types_module
, only : kim_collections_type
1111 type(kim_collections_type),
intent(in) :: collections
1112 type(c_ptr),
intent(out) :: name
1113 type(c_ptr),
intent(out) :: value
1114 end subroutine get_configuration_file_environment_variable
1116 type(kim_collections_handle_type),
intent(in) :: collections_handle
1117 character(len=*, kind=c_char),
intent(out) :: name
1118 character(len=*, kind=c_char),
intent(out) :: value
1119 type(kim_collections_type),
pointer :: collections
1121 type(c_ptr) pname, pvalue
1123 call c_f_pointer(collections_handle%p, collections)
1124 call get_configuration_file_environment_variable(collections, pname, pvalue)
1125 call kim_convert_c_char_ptr_to_string(pname, name)
1126 call kim_convert_c_char_ptr_to_string(pvalue,
value)
1136 collections_handle, file_name)
1137 use kim_interoperable_types_module
, only : kim_collections_type
1138 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1141 recursive subroutine get_configuration_file_name(collections, file_name) &
1142 bind(c, name=
"KIM_Collections_GetConfigurationFileName")
1143 use,
intrinsic :: iso_c_binding
1144 use kim_interoperable_types_module
, only : kim_collections_type
1146 type(kim_collections_type),
intent(in) :: collections
1147 type(c_ptr),
intent(out) :: file_name
1148 end subroutine get_configuration_file_name
1150 type(kim_collections_handle_type),
intent(in) :: collections_handle
1151 character(len=*, kind=c_char),
intent(out) :: file_name
1152 type(kim_collections_type),
pointer :: collections
1154 type(c_ptr) pfile_name
1156 call c_f_pointer(collections_handle%p, collections)
1157 call get_configuration_file_name(collections, pfile_name)
1158 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
1168 collections_handle, collection, item_type, extent, ierr)
1169 use kim_interoperable_types_module
, only : kim_collections_type
1174 integer(c_int) recursive function cache_list_of_directory_names( &
1175 collections, collection, item_type, extent) &
1176 bind(c, name=
"KIM_Collections_CacheListOfDirectoryNames")
1177 use,
intrinsic :: iso_c_binding
1178 use kim_interoperable_types_module
, only : kim_collections_type
1181 kim_collection_item_type_type
1183 type(kim_collections_type),
intent(in) :: collections
1184 type(kim_collection_type),
intent(in),
value :: collection
1185 type(kim_collection_item_type_type),
intent(in),
value :: item_type
1186 integer(c_int),
intent(out) :: extent
1187 end function cache_list_of_directory_names
1189 type(kim_collections_handle_type),
intent(in) :: collections_handle
1190 type(kim_collection_type),
intent(in) :: collection
1191 type(kim_collection_item_type_type),
intent(in) :: item_type
1192 integer(c_int),
intent(out) :: extent
1193 integer(c_int),
intent(out) :: ierr
1194 type(kim_collections_type),
pointer :: collections
1196 call c_f_pointer(collections_handle%p, collections)
1197 ierr = cache_list_of_directory_names(collections, collection, item_type, &
1207 index, directory_name, ierr)
1208 use kim_interoperable_types_module
, only : kim_collections_type
1209 use kim_convert_string_module
, only : kim_convert_c_char_ptr_to_string
1212 integer(c_int) recursive function get_directory_name(collections, index, &
1214 bind(c, name=
"KIM_Collections_GetDirectoryName")
1215 use,
intrinsic :: iso_c_binding
1216 use kim_interoperable_types_module
, only : kim_collections_type
1218 type(kim_collections_type),
intent(in) :: collections
1219 integer(c_int),
intent(in),
value :: index
1220 type(c_ptr),
intent(out) :: directory_name
1221 end function get_directory_name
1223 type(kim_collections_handle_type),
intent(in) :: collections_handle
1224 integer(c_int),
intent(in) :: index
1225 character(len=*, kind=c_char),
intent(out) :: directory_name
1226 integer(c_int),
intent(out) :: ierr
1227 type(kim_collections_type),
pointer :: collections
1229 type(c_ptr) pdirectory_name
1231 call c_f_pointer(collections_handle%p, collections)
1232 ierr = get_directory_name(collections, index-1, pdirectory_name)
1233 call kim_convert_c_char_ptr_to_string(pdirectory_name, directory_name)
1242 use kim_interoperable_types_module
, only : kim_collections_type
1245 recursive subroutine set_log_id(collections, log_id) &
1246 bind(c, name=
"KIM_Collections_SetLogID")
1247 use,
intrinsic :: iso_c_binding
1248 use kim_interoperable_types_module
, only : kim_collections_type
1250 type(kim_collections_type),
intent(in) :: collections
1251 character(c_char),
intent(in) :: log_id(*)
1252 end subroutine set_log_id
1254 type(kim_collections_handle_type),
intent(in) :: collections_handle
1255 character(len=*, kind=c_char),
intent(in) :: log_id
1256 type(kim_collections_type),
pointer :: collections
1258 call c_f_pointer(collections_handle%p, collections)
1259 call set_log_id(collections, trim(log_id)//c_null_char)
1270 use kim_interoperable_types_module
, only : kim_collections_type
1273 recursive subroutine push_log_verbosity(collections, log_verbosity) &
1274 bind(c, name=
"KIM_Collections_PushLogVerbosity")
1275 use,
intrinsic :: iso_c_binding
1277 use kim_interoperable_types_module
, only : kim_collections_type
1279 type(kim_collections_type),
intent(in) :: collections
1280 type(kim_log_verbosity_type),
intent(in),
value :: log_verbosity
1281 end subroutine push_log_verbosity
1283 type(kim_collections_handle_type),
intent(in) :: collections_handle
1284 type(kim_log_verbosity_type),
intent(in) :: log_verbosity
1285 type(kim_collections_type),
pointer :: collections
1287 call c_f_pointer(collections_handle%p, collections)
1288 call push_log_verbosity(collections, log_verbosity)
1298 use kim_interoperable_types_module
, only : kim_collections_type
1301 recursive subroutine pop_log_verbosity(collections) &
1302 bind(c, name=
"KIM_Collections_PopLogVerbosity")
1303 use,
intrinsic :: iso_c_binding
1305 use kim_interoperable_types_module
, only : kim_collections_type
1307 type(kim_collections_type),
intent(in) :: collections
1308 end subroutine pop_log_verbosity
1310 type(kim_collections_handle_type),
intent(in) :: collections_handle
1311 type(kim_collections_type),
pointer :: collections
1313 call c_f_pointer(collections_handle%p, collections)
1314 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_and_collection(collections_handle, item_name, file_name, collection, ierr)
Get the item's library file name and its KIM::Collection.
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_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.