39 use,
intrinsic :: iso_c_binding
45 kim_collections_handle_type, &
54 kim_get_item_library_file_name_and_collection, &
55 kim_cache_list_of_item_metadata_files, &
56 kim_get_item_metadata_file_length, &
57 kim_get_item_metadata_file_values, &
58 kim_cache_list_of_item_names_by_type, &
59 kim_get_item_name_by_type, &
60 kim_cache_list_of_item_names_by_collection_and_type, &
61 kim_get_item_name_by_collection_and_type, &
62 kim_get_item_library_file_name_by_collection_and_type, &
63 kim_cache_list_of_item_metadata_files_by_collection_and_type, &
64 kim_get_item_metadata_file_length_by_collection_and_type, &
65 kim_get_item_metadata_file_values_by_collection_and_type, &
66 kim_get_project_name_and_sem_ver, &
67 kim_get_environment_variable_name, &
68 kim_get_configuration_file_environment_variable, &
69 kim_get_configuration_file_name, &
70 kim_cache_list_of_directory_names, &
71 kim_get_directory_name, &
73 kim_push_log_verbosity, &
81 type, bind(c) :: kim_collections_handle_type
82 type(c_ptr) :: p = c_null_ptr
83 end type kim_collections_handle_type
88 type(kim_collections_handle_type),
protected,
save &
94 interface operator(.eq.)
95 module procedure kim_collections_handle_equal
96 end interface operator(.eq.)
101 interface operator(.ne.)
102 module procedure kim_collections_handle_not_equal
103 end interface operator(.ne.)
110 interface kim_get_item_type
111 module procedure kim_collections_get_item_type
112 end interface kim_get_item_type
120 interface kim_get_item_library_file_name_and_collection
122 end interface kim_get_item_library_file_name_and_collection
130 interface kim_cache_list_of_item_metadata_files
132 end interface kim_cache_list_of_item_metadata_files
141 interface kim_get_item_metadata_file_length
143 end interface kim_get_item_metadata_file_length
151 interface kim_get_item_metadata_file_values
153 end interface kim_get_item_metadata_file_values
161 interface kim_cache_list_of_item_names_by_type
163 end interface kim_cache_list_of_item_names_by_type
170 interface kim_get_item_name_by_type
172 end interface kim_get_item_name_by_type
180 interface kim_cache_list_of_item_names_by_collection_and_type
183 end interface kim_cache_list_of_item_names_by_collection_and_type
191 interface kim_get_item_name_by_collection_and_type
193 end interface kim_get_item_name_by_collection_and_type
202 interface kim_get_item_library_file_name_by_collection_and_type
205 end interface kim_get_item_library_file_name_by_collection_and_type
214 interface kim_cache_list_of_item_metadata_files_by_collection_and_type
217 end interface kim_cache_list_of_item_metadata_files_by_collection_and_type
226 interface kim_get_item_metadata_file_length_by_collection_and_type
229 end interface kim_get_item_metadata_file_length_by_collection_and_type
237 interface kim_get_item_metadata_file_values_by_collection_and_type
240 end interface kim_get_item_metadata_file_values_by_collection_and_type
248 interface kim_get_project_name_and_sem_ver
250 end interface kim_get_project_name_and_sem_ver
258 interface kim_get_environment_variable_name
260 end interface kim_get_environment_variable_name
268 interface kim_get_configuration_file_environment_variable
270 end interface kim_get_configuration_file_environment_variable
278 interface kim_get_configuration_file_name
280 end interface kim_get_configuration_file_name
288 interface kim_cache_list_of_directory_names
290 end interface kim_cache_list_of_directory_names
297 interface kim_get_directory_name
299 end interface kim_get_directory_name
306 interface kim_set_log_id
308 end interface kim_set_log_id
315 interface kim_push_log_verbosity
317 end interface kim_push_log_verbosity
324 interface kim_pop_log_verbosity
326 end interface kim_pop_log_verbosity
332 logical recursive function kim_collections_handle_equal(lhs, rhs)
334 type(kim_collections_handle_type),
intent(in) :: lhs
335 type(kim_collections_handle_type),
intent(in) :: rhs
337 if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p)))
then 338 kim_collections_handle_equal = .true.
340 kim_collections_handle_equal = c_associated(lhs%p, rhs%p)
342 end function kim_collections_handle_equal
347 logical recursive function kim_collections_handle_not_equal(lhs, rhs)
349 type(kim_collections_handle_type),
intent(in) :: lhs
350 type(kim_collections_handle_type),
intent(in) :: rhs
352 kim_collections_handle_not_equal = .not. (lhs == rhs)
353 end function kim_collections_handle_not_equal
363 integer(c_int) recursive function create(collections) &
364 bind(c, name=
"KIM_Collections_Create")
365 use,
intrinsic :: iso_c_binding
367 type(c_ptr),
intent(out) :: collections
370 type(kim_collections_handle_type),
intent(out) :: collections_handle
371 integer(c_int),
intent(out) :: ierr
373 type(c_ptr) :: pcollections
375 ierr = create(pcollections)
376 collections_handle%p = pcollections
387 recursive subroutine destroy(collections) &
388 bind(c, name=
"KIM_Collections_Destroy")
389 use,
intrinsic :: iso_c_binding
391 type(c_ptr),
intent(inout) :: collections
392 end subroutine destroy
394 type(kim_collections_handle_type),
intent(inout) :: collections_handle
396 type(c_ptr) :: pcollections
397 pcollections = collections_handle%p
398 call destroy(pcollections)
399 collections_handle%p = c_null_ptr
407 recursive subroutine kim_collections_get_item_type(collections_handle, &
408 item_name, item_type, ierr)
409 use kim_interoperable_types_module
, only: kim_collections_type
413 integer(c_int) recursive function get_item_type( &
414 collections, item_name, item_type) &
415 bind(c, name=
"KIM_Collections_GetItemType")
416 use,
intrinsic :: iso_c_binding
417 use kim_interoperable_types_module
, only: kim_collections_type
419 kim_collection_item_type_type
421 type(kim_collections_type),
intent(in) :: collections
422 character(c_char),
intent(in) :: item_name(*)
423 type(kim_collection_item_type_type),
intent(out) :: item_type
424 end function get_item_type
426 type(kim_collections_handle_type),
intent(in) :: collections_handle
427 character(len=*, kind=c_char),
intent(in) :: item_name
428 type(kim_collection_item_type_type),
intent(out) :: item_type
429 integer(c_int),
intent(out) :: ierr
430 type(kim_collections_type),
pointer :: collections
432 call c_f_pointer(collections_handle%p, collections)
433 ierr = get_item_type(collections, trim(item_name)//c_null_char, item_type)
434 end subroutine kim_collections_get_item_type
442 recursive subroutine &
444 collections_handle, item_type, item_name, file_name, collection, ierr)
445 use kim_interoperable_types_module
, only: kim_collections_type
446 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( &
453 collections, item_type, item_name, 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 kim_collection_item_type_type
461 type(kim_collections_type),
intent(in) :: collections
462 type(kim_collection_item_type_type),
intent(in),
value :: item_type
463 character(c_char),
intent(in) :: item_name(*)
464 type(c_ptr),
intent(out) :: file_name
465 type(kim_collection_type),
intent(out) :: collection
466 end function get_item_library_file_name_and_collection
468 type(kim_collections_handle_type),
intent(in) :: collections_handle
469 type(kim_collection_item_type_type),
intent(in) :: item_type
470 character(len=*, kind=c_char),
intent(in) :: item_name
471 character(len=*, kind=c_char),
intent(out) :: file_name
472 type(kim_collection_type),
intent(out) :: collection
473 integer(c_int),
intent(out) :: ierr
474 type(kim_collections_type),
pointer :: collections
476 type(c_ptr) :: pfile_name
478 call c_f_pointer(collections_handle%p, collections)
479 ierr = get_item_library_file_name_and_collection( &
482 trim(item_name)//c_null_char, &
485 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
495 collections_handle, item_type, item_name, extent, ierr)
496 use kim_interoperable_types_module
, only: kim_collections_type
500 integer(c_int) recursive function cache_list_of_item_metadata_files( &
501 collections, item_type, item_name, extent) &
502 bind(c, name=
"KIM_Collections_CacheListOfItemMetadataFiles")
503 use,
intrinsic :: iso_c_binding
504 use kim_interoperable_types_module
, only: kim_collections_type
506 kim_collection_item_type_type
508 type(kim_collections_type),
intent(in) :: collections
509 type(kim_collection_item_type_type),
intent(in),
value :: item_type
510 character(c_char),
intent(in) :: item_name(*)
511 integer(c_int),
intent(out) :: extent
512 end function cache_list_of_item_metadata_files
514 type(kim_collections_handle_type),
intent(in) :: collections_handle
515 type(kim_collection_item_type_type),
intent(in) :: item_type
516 character(len=*, kind=c_char),
intent(in) :: item_name
517 integer(c_int),
intent(out) :: extent
518 integer(c_int),
intent(out) :: ierr
519 type(kim_collections_type),
pointer :: collections
521 call c_f_pointer(collections_handle%p, collections)
522 ierr = cache_list_of_item_metadata_files(collections, item_type, &
523 trim(item_name)//c_null_char, &
535 collections_handle, index, file_length, available_as_string, ierr)
536 use kim_interoperable_types_module
, only: kim_collections_type
539 integer(c_int) recursive function get_item_metadata_file( &
540 collections, index, file_name, file_length, file_raw_data, &
541 available_as_string, file_string) &
542 bind(c, name=
"KIM_Collections_GetItemMetadataFile_fortran")
543 use,
intrinsic :: iso_c_binding
544 use kim_interoperable_types_module
, only: kim_collections_type
546 type(kim_collections_type),
intent(in) :: collections
547 integer(c_int),
intent(in),
value :: index
548 type(c_ptr),
intent(out) :: file_name
549 integer(c_long),
intent(out) :: file_length
550 type(c_ptr),
intent(out) :: file_raw_data
551 integer(c_int),
intent(out) :: available_as_string
552 type(c_ptr),
intent(out) :: file_string
553 end function get_item_metadata_file
555 type(kim_collections_handle_type),
intent(in) :: collections_handle
556 integer(c_int),
intent(in) :: index
557 integer(c_long),
intent(out) :: file_length
558 integer(c_int),
intent(out) :: available_as_string
559 integer(c_int),
intent(out) :: ierr
560 type(kim_collections_type),
pointer :: collections
562 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
564 call c_f_pointer(collections_handle%p, collections)
565 ierr = get_item_metadata_file(collections, &
570 available_as_string, &
581 collections_handle, index, file_name, file_raw_data, file_string, ierr)
582 use kim_interoperable_types_module
, only: kim_collections_type
583 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
586 integer(c_int) recursive function get_item_metadata_file( &
587 collections, index, file_name, file_length, file_raw_data, &
588 available_as_string, file_string) &
589 bind(c, name=
"KIM_Collections_GetItemMetadataFile_fortran")
590 use,
intrinsic :: iso_c_binding
591 use kim_interoperable_types_module
, only: kim_collections_type
593 type(kim_collections_type),
intent(in) :: collections
594 integer(c_int),
intent(in),
value :: index
595 type(c_ptr),
intent(out) :: file_name
596 integer(c_long),
intent(out) :: file_length
597 type(c_ptr),
intent(out) :: file_raw_data
598 integer(c_int),
intent(out) :: available_as_string
599 type(c_ptr),
intent(out) :: file_string
600 end function get_item_metadata_file
602 type(kim_collections_handle_type),
intent(in) :: collections_handle
603 integer(c_int),
intent(in) :: index
604 character(len=*, kind=c_char),
intent(out) :: file_name
605 integer(c_signed_char),
intent(out) :: file_raw_data(:)
606 character(len=*, kind=c_char),
intent(out) :: file_string
607 integer(c_int),
intent(out) :: ierr
608 type(kim_collections_type),
pointer :: collections
610 integer(c_long) file_length
611 integer(c_int) available_as_string
612 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
613 integer(c_signed_char),
pointer :: file_raw_data_fpointer(:)
615 call c_f_pointer(collections_handle%p, collections)
616 ierr = get_item_metadata_file(collections, &
621 available_as_string, &
624 if (
size(file_raw_data) < file_length)
then 628 if (available_as_string == 1)
then 629 if (len(file_string) < file_length)
then 635 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
636 if (c_associated(pfile_raw_data))
then 637 call c_f_pointer(pfile_raw_data, file_raw_data_fpointer, [file_length])
639 nullify (file_raw_data_fpointer)
641 file_raw_data = file_raw_data_fpointer(1:file_length)
643 if (available_as_string == 1)
then 644 call kim_convert_c_char_ptr_to_string(pfile_string, file_string)
656 collections_handle, item_type, extent, ierr)
657 use kim_interoperable_types_module
, only: kim_collections_type
661 integer(c_int) recursive function cache_list_of_item_names_by_type( &
662 collections, item_type, extent) &
663 bind(c, name=
"KIM_Collections_CacheListOfItemNamesByType")
664 use,
intrinsic :: iso_c_binding
665 use kim_interoperable_types_module
, only: kim_collections_type
667 kim_collection_item_type_type
669 type(kim_collections_type),
intent(in) :: collections
670 type(kim_collection_item_type_type),
intent(in),
value :: item_type
671 integer(c_int),
intent(out) :: extent
672 end function cache_list_of_item_names_by_type
674 type(kim_collections_handle_type),
intent(in) :: collections_handle
675 type(kim_collection_item_type_type),
intent(in) :: item_type
676 integer(c_int),
intent(out) :: extent
677 integer(c_int),
intent(out) :: ierr
678 type(kim_collections_type),
pointer :: collections
680 call c_f_pointer(collections_handle%p, collections)
681 ierr = cache_list_of_item_names_by_type(collections, item_type, extent)
690 collections_handle, index, item_name, ierr)
691 use kim_interoperable_types_module
, only: kim_collections_type
692 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
695 integer(c_int) recursive function get_item_name_by_type( &
696 collections, index, item_name) &
697 bind(c, name=
"KIM_Collections_GetItemNameByType")
698 use,
intrinsic :: iso_c_binding
699 use kim_interoperable_types_module
, only: kim_collections_type
701 type(kim_collections_type),
intent(in) :: collections
702 integer(c_int),
intent(in),
value :: index
703 type(c_ptr),
intent(out) :: item_name
704 end function get_item_name_by_type
706 type(kim_collections_handle_type),
intent(in) :: collections_handle
707 integer(c_int),
intent(in) :: index
708 character(len=*, kind=c_char),
intent(out) :: item_name
709 integer(c_int),
intent(out) :: ierr
710 type(kim_collections_type),
pointer :: collections
712 type(c_ptr) pitem_name
714 call c_f_pointer(collections_handle%p, collections)
715 ierr = get_item_name_by_type(collections, index - 1, pitem_name)
716 call kim_convert_c_char_ptr_to_string(pitem_name, item_name)
725 recursive subroutine &
727 collections_handle, collection, item_type, extent, ierr)
728 use kim_interoperable_types_module
, only: kim_collections_type
733 integer(c_int) recursive function &
734 cache_list_of_item_names_by_collection_and_type( &
735 collections, collection, item_type, extent) &
736 bind(c, name=
"KIM_Collections_CacheListOfItemNamesByCollectionAndType")
737 use,
intrinsic :: iso_c_binding
738 use kim_interoperable_types_module
, only: kim_collections_type
741 kim_collection_item_type_type
743 type(kim_collections_type),
intent(in) :: collections
744 type(kim_collection_type),
intent(in),
value :: collection
745 type(kim_collection_item_type_type),
intent(in),
value :: item_type
746 integer(c_int),
intent(out) :: extent
747 end function cache_list_of_item_names_by_collection_and_type
749 type(kim_collections_handle_type),
intent(in) :: collections_handle
750 type(kim_collection_type),
intent(in) :: collection
751 type(kim_collection_item_type_type),
intent(in) :: item_type
752 integer(c_int),
intent(out) :: extent
753 integer(c_int),
intent(out) :: ierr
754 type(kim_collections_type),
pointer :: collections
756 call c_f_pointer(collections_handle%p, collections)
757 ierr = cache_list_of_item_names_by_collection_and_type(collections, &
770 collections_handle, index, item_name, ierr)
771 use kim_interoperable_types_module
, only: kim_collections_type
772 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
775 integer(c_int) recursive function get_item_name_by_collection_and_type( &
776 collections, index, item_name) &
777 bind(c, name=
"KIM_Collections_GetItemNameByCollectionAndType")
778 use,
intrinsic :: iso_c_binding
779 use kim_interoperable_types_module
, only: kim_collections_type
781 type(kim_collections_type),
intent(in) :: collections
782 integer(c_int),
intent(in),
value :: index
783 type(c_ptr),
intent(out) :: item_name
784 end function get_item_name_by_collection_and_type
786 type(kim_collections_handle_type),
intent(in) :: collections_handle
787 integer(c_int),
intent(in) :: index
788 character(len=*, kind=c_char),
intent(out) :: item_name
789 integer(c_int),
intent(out) :: ierr
790 type(kim_collections_type),
pointer :: collections
792 type(c_ptr) pitem_name
794 call c_f_pointer(collections_handle%p, collections)
795 ierr = get_item_name_by_collection_and_type(collections, index - 1, &
797 call kim_convert_c_char_ptr_to_string(pitem_name, item_name)
807 recursive subroutine &
809 collections_handle, collection, item_type, item_name, file_name, ierr)
810 use kim_interoperable_types_module
, only: kim_collections_type
811 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
816 integer(c_int) recursive function &
817 get_item_library_file_name_by_coll_and_type( &
818 collections, collection, item_type, item_name, file_name) &
820 name=
"KIM_Collections_GetItemLibraryFileNameByCollectionAndType")
821 use,
intrinsic :: iso_c_binding
822 use kim_interoperable_types_module
, only: kim_collections_type
825 kim_collection_item_type_type
827 type(kim_collections_type),
intent(in) :: collections
828 type(kim_collection_type),
intent(in),
value :: collection
829 type(kim_collection_item_type_type),
intent(in),
value :: item_type
830 character(c_char),
intent(in) :: item_name(*)
831 type(c_ptr),
intent(out) :: file_name
832 end function get_item_library_file_name_by_coll_and_type
834 type(kim_collections_handle_type),
intent(in) :: collections_handle
835 type(kim_collection_type),
intent(in) :: collection
836 type(kim_collection_item_type_type),
intent(in) :: item_type
837 character(len=*, kind=c_char),
intent(in) :: item_name
838 character(len=*, kind=c_char),
intent(out) :: file_name
839 integer(c_int),
intent(out) :: ierr
840 type(kim_collections_type),
pointer :: collections
842 type(c_ptr) pfile_name
844 call c_f_pointer(collections_handle%p, collections)
845 ierr = get_item_library_file_name_by_coll_and_type( &
849 trim(item_name)//c_null_char, &
851 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
861 recursive subroutine &
863 collections_handle, collection, item_type, item_name, extent, ierr)
864 use kim_interoperable_types_module
, only: kim_collections_type
869 integer(c_int) recursive function &
870 cache_list_of_item_metadata_files_by_coll_and_type( &
871 collections, collection, item_type, item_name, extent) &
874 "KIM_Collections_CacheListOfItemMetadataFilesByCollectionAndType")
875 use,
intrinsic :: iso_c_binding
876 use kim_interoperable_types_module
, only: kim_collections_type
879 kim_collection_item_type_type
881 type(kim_collections_type),
intent(in) :: collections
882 type(kim_collection_type),
intent(in),
value :: collection
883 type(kim_collection_item_type_type),
intent(in),
value :: item_type
884 character(c_char),
intent(in) :: item_name(*)
885 integer(c_int),
intent(out) :: extent
886 end function cache_list_of_item_metadata_files_by_coll_and_type
888 type(kim_collections_handle_type),
intent(in) :: collections_handle
889 type(kim_collection_type),
intent(in) :: collection
890 type(kim_collection_item_type_type),
intent(in) :: item_type
891 character(len=*, kind=c_char),
intent(in) :: item_name
892 integer(c_int),
intent(out) :: extent
893 integer(c_int),
intent(out) :: ierr
894 type(kim_collections_type),
pointer :: collections
896 call c_f_pointer(collections_handle%p, collections)
897 ierr = cache_list_of_item_metadata_files_by_coll_and_type( &
901 trim(item_name)//c_null_char, &
911 recursive subroutine &
913 collections_handle, index, file_length, available_as_string, ierr)
914 use kim_interoperable_types_module
, only: kim_collections_type
917 integer(c_int) recursive function &
918 get_item_metadata_file_by_coll_and_type( &
919 collections, index, &
923 available_as_string, &
927 "KIM_Collections_GetItemMetadataFileByCollectionAndType_fortran")
928 use,
intrinsic :: iso_c_binding
929 use kim_interoperable_types_module
, only: kim_collections_type
931 type(kim_collections_type),
intent(in) :: collections
932 integer(c_int),
intent(in),
value :: index
933 type(c_ptr),
intent(out) :: file_name
934 integer(c_long),
intent(out) :: file_length
935 type(c_ptr),
intent(out) :: file_raw_data
936 integer(c_int),
intent(out) :: available_as_string
937 type(c_ptr),
intent(out) :: file_string
938 end function get_item_metadata_file_by_coll_and_type
940 type(kim_collections_handle_type),
intent(in) :: collections_handle
941 integer(c_int),
intent(in),
value :: index
942 integer(c_long),
intent(out) :: file_length
943 integer(c_int),
intent(out) :: available_as_string
944 integer(c_int),
intent(out) :: ierr
945 type(kim_collections_type),
pointer :: collections
947 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
949 call c_f_pointer(collections_handle%p, collections)
950 ierr = get_item_metadata_file_by_coll_and_type(collections, &
955 available_as_string, &
965 recursive subroutine &
967 collections_handle, index, file_name, file_raw_data, file_string, ierr)
968 use kim_interoperable_types_module
, only: kim_collections_type
969 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
972 integer(c_int) recursive function &
973 get_item_metadata_file_by_coll_and_type(collections, &
978 available_as_string, &
982 "KIM_Collections_GetItemMetadataFileByCollectionAndType_fortran")
983 use,
intrinsic :: iso_c_binding
984 use kim_interoperable_types_module
, only: kim_collections_type
986 type(kim_collections_type),
intent(in) :: collections
987 integer(c_int),
intent(in),
value :: index
988 type(c_ptr),
intent(out) :: file_name
989 integer(c_long),
intent(out) :: file_length
990 type(c_ptr),
intent(out) :: file_raw_data
991 integer(c_int),
intent(out) :: available_as_string
992 type(c_ptr),
intent(out) :: file_string
993 end function get_item_metadata_file_by_coll_and_type
995 type(kim_collections_handle_type),
intent(in) :: collections_handle
996 integer(c_int),
intent(in) :: index
997 character(len=*, kind=c_char),
intent(out) :: file_name
998 integer(c_signed_char),
intent(out) :: file_raw_data(:)
999 character(len=*, kind=c_char),
intent(out) :: file_string
1000 integer(c_int),
intent(out) :: ierr
1001 type(kim_collections_type),
pointer :: collections
1003 integer(c_long) file_length
1004 integer(c_int) available_as_string
1005 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
1006 integer(c_signed_char),
pointer :: file_raw_data_fpointer(:)
1008 call c_f_pointer(collections_handle%p, collections)
1009 ierr = get_item_metadata_file_by_coll_and_type(collections, &
1014 available_as_string, &
1017 if (
size(file_raw_data) < file_length)
then 1021 if (available_as_string == 1)
then 1022 if (len(file_string) < file_length)
then 1028 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
1029 if (c_associated(pfile_raw_data))
then 1030 call c_f_pointer(pfile_raw_data, file_raw_data_fpointer, [file_length])
1032 nullify (file_raw_data_fpointer)
1034 file_raw_data = file_raw_data_fpointer(1:file_length)
1036 if (available_as_string == 1)
then 1037 call kim_convert_c_char_ptr_to_string(pfile_string, file_string)
1049 collections_handle, project_name, sem_ver)
1050 use kim_interoperable_types_module
, only: kim_collections_type
1051 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
1054 recursive subroutine get_project_name_and_sem_ver(collections, &
1055 project_name, sem_ver) &
1056 bind(c, name=
"KIM_Collections_GetProjectNameAndSemVer")
1057 use,
intrinsic :: iso_c_binding
1058 use kim_interoperable_types_module
, only: kim_collections_type
1060 type(kim_collections_type),
intent(in) :: collections
1061 type(c_ptr),
intent(out) :: project_name
1062 type(c_ptr),
intent(out) :: sem_ver
1063 end subroutine get_project_name_and_sem_ver
1065 type(kim_collections_handle_type),
intent(in) :: collections_handle
1066 character(len=*, kind=c_char),
intent(out) :: project_name
1067 character(len=*, kind=c_char),
intent(out) :: sem_ver
1068 type(kim_collections_type),
pointer :: collections
1070 type(c_ptr) pproject_name, psem_ver
1072 call c_f_pointer(collections_handle%p, collections)
1073 call get_project_name_and_sem_ver(collections, pproject_name, psem_ver)
1074 call kim_convert_c_char_ptr_to_string(pproject_name, project_name)
1075 call kim_convert_c_char_ptr_to_string(psem_ver, sem_ver)
1085 collections_handle, item_type, name, ierr)
1086 use kim_interoperable_types_module
, only: kim_collections_type
1087 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
1091 integer(c_int) recursive function get_environment_variable_name( &
1092 collections, item_type, name) &
1093 bind(c, name=
"KIM_Collections_GetEnvironmentVariableName")
1094 use,
intrinsic :: iso_c_binding
1095 use kim_interoperable_types_module
, only: kim_collections_type
1097 kim_collection_item_type_type
1099 type(kim_collections_type),
intent(in) :: collections
1100 type(kim_collection_item_type_type),
intent(in),
value :: item_type
1101 type(c_ptr),
intent(out) :: name
1102 end function get_environment_variable_name
1104 type(kim_collections_handle_type),
intent(in) :: collections_handle
1105 type(kim_collection_item_type_type),
intent(in) :: item_type
1106 character(len=*, kind=c_char),
intent(out) :: name
1107 integer(c_int),
intent(out) :: ierr
1108 type(kim_collections_type),
pointer :: collections
1112 call c_f_pointer(collections_handle%p, collections)
1113 ierr = get_environment_variable_name(collections, item_type, pname)
1114 call kim_convert_c_char_ptr_to_string(pname, name)
1123 recursive subroutine &
1125 collections_handle, name,
value)
1126 use kim_interoperable_types_module
, only: kim_collections_type
1127 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
1130 recursive subroutine get_configuration_file_environment_variable( &
1131 collections, name, value) &
1132 bind(c, name=
"KIM_Collections_GetConfigurationFileEnvironmentVariable")
1133 use,
intrinsic :: iso_c_binding
1134 use kim_interoperable_types_module
, only: kim_collections_type
1136 type(kim_collections_type),
intent(in) :: collections
1137 type(c_ptr),
intent(out) :: name
1138 type(c_ptr),
intent(out) :: value
1139 end subroutine get_configuration_file_environment_variable
1141 type(kim_collections_handle_type),
intent(in) :: collections_handle
1142 character(len=*, kind=c_char),
intent(out) :: name
1143 character(len=*, kind=c_char),
intent(out) :: value
1144 type(kim_collections_type),
pointer :: collections
1146 type(c_ptr) pname, pvalue
1148 call c_f_pointer(collections_handle%p, collections)
1149 call get_configuration_file_environment_variable(collections, pname, pvalue)
1150 call kim_convert_c_char_ptr_to_string(pname, name)
1151 call kim_convert_c_char_ptr_to_string(pvalue,
value)
1161 collections_handle, file_name)
1162 use kim_interoperable_types_module
, only: kim_collections_type
1163 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
1166 recursive subroutine get_configuration_file_name(collections, file_name) &
1167 bind(c, name=
"KIM_Collections_GetConfigurationFileName")
1168 use,
intrinsic :: iso_c_binding
1169 use kim_interoperable_types_module
, only: kim_collections_type
1171 type(kim_collections_type),
intent(in) :: collections
1172 type(c_ptr),
intent(out) :: file_name
1173 end subroutine get_configuration_file_name
1175 type(kim_collections_handle_type),
intent(in) :: collections_handle
1176 character(len=*, kind=c_char),
intent(out) :: file_name
1177 type(kim_collections_type),
pointer :: collections
1179 type(c_ptr) pfile_name
1181 call c_f_pointer(collections_handle%p, collections)
1182 call get_configuration_file_name(collections, pfile_name)
1183 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
1193 collections_handle, collection, item_type, extent, ierr)
1194 use kim_interoperable_types_module
, only: kim_collections_type
1199 integer(c_int) recursive function cache_list_of_directory_names( &
1200 collections, collection, item_type, extent) &
1201 bind(c, name=
"KIM_Collections_CacheListOfDirectoryNames")
1202 use,
intrinsic :: iso_c_binding
1203 use kim_interoperable_types_module
, only: kim_collections_type
1206 kim_collection_item_type_type
1208 type(kim_collections_type),
intent(in) :: collections
1209 type(kim_collection_type),
intent(in),
value :: collection
1210 type(kim_collection_item_type_type),
intent(in),
value :: item_type
1211 integer(c_int),
intent(out) :: extent
1212 end function cache_list_of_directory_names
1214 type(kim_collections_handle_type),
intent(in) :: collections_handle
1215 type(kim_collection_type),
intent(in) :: collection
1216 type(kim_collection_item_type_type),
intent(in) :: item_type
1217 integer(c_int),
intent(out) :: extent
1218 integer(c_int),
intent(out) :: ierr
1219 type(kim_collections_type),
pointer :: collections
1221 call c_f_pointer(collections_handle%p, collections)
1222 ierr = cache_list_of_directory_names(collections, collection, item_type, &
1235 use kim_interoperable_types_module
, only: kim_collections_type
1236 use kim_convert_string_module
, only: kim_convert_c_char_ptr_to_string
1239 integer(c_int) recursive function get_directory_name(collections, index, &
1241 bind(c, name=
"KIM_Collections_GetDirectoryName")
1242 use,
intrinsic :: iso_c_binding
1243 use kim_interoperable_types_module
, only: kim_collections_type
1245 type(kim_collections_type),
intent(in) :: collections
1246 integer(c_int),
intent(in),
value :: index
1247 type(c_ptr),
intent(out) :: directory_name
1248 end function get_directory_name
1250 type(kim_collections_handle_type),
intent(in) :: collections_handle
1251 integer(c_int),
intent(in) :: index
1252 character(len=*, kind=c_char),
intent(out) :: directory_name
1253 integer(c_int),
intent(out) :: ierr
1254 type(kim_collections_type),
pointer :: collections
1256 type(c_ptr) pdirectory_name
1258 call c_f_pointer(collections_handle%p, collections)
1259 ierr = get_directory_name(collections, index - 1, pdirectory_name)
1260 call kim_convert_c_char_ptr_to_string(pdirectory_name, directory_name)
1269 use kim_interoperable_types_module
, only: kim_collections_type
1272 recursive subroutine set_log_id(collections, log_id) &
1273 bind(c, name=
"KIM_Collections_SetLogID")
1274 use,
intrinsic :: iso_c_binding
1275 use kim_interoperable_types_module
, only: kim_collections_type
1277 type(kim_collections_type),
intent(in) :: collections
1278 character(c_char),
intent(in) :: log_id(*)
1279 end subroutine set_log_id
1281 type(kim_collections_handle_type),
intent(in) :: collections_handle
1282 character(len=*, kind=c_char),
intent(in) :: log_id
1283 type(kim_collections_type),
pointer :: collections
1285 call c_f_pointer(collections_handle%p, collections)
1286 call set_log_id(collections, trim(log_id)//c_null_char)
1297 use kim_interoperable_types_module
, only: kim_collections_type
1300 recursive subroutine push_log_verbosity(collections, log_verbosity) &
1301 bind(c, name=
"KIM_Collections_PushLogVerbosity")
1302 use,
intrinsic :: iso_c_binding
1304 use kim_interoperable_types_module
, only: kim_collections_type
1306 type(kim_collections_type),
intent(in) :: collections
1307 type(kim_log_verbosity_type),
intent(in),
value :: log_verbosity
1308 end subroutine push_log_verbosity
1310 type(kim_collections_handle_type),
intent(in) :: collections_handle
1311 type(kim_log_verbosity_type),
intent(in) :: log_verbosity
1312 type(kim_collections_type),
pointer :: collections
1314 call c_f_pointer(collections_handle%p, collections)
1315 call push_log_verbosity(collections, log_verbosity)
1325 use kim_interoperable_types_module
, only: kim_collections_type
1328 recursive subroutine pop_log_verbosity(collections) &
1329 bind(c, name=
"KIM_Collections_PopLogVerbosity")
1330 use,
intrinsic :: iso_c_binding
1332 use kim_interoperable_types_module
, only: kim_collections_type
1334 type(kim_collections_type),
intent(in) :: collections
1335 end subroutine pop_log_verbosity
1337 type(kim_collections_handle_type),
intent(in) :: collections_handle
1338 type(kim_collections_type),
pointer :: collections
1340 call c_f_pointer(collections_handle%p, collections)
1341 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.