1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434
|
!
! KIM-API: An API for interatomic models
! Copyright (c) 2013--2022, Regents of the University of Minnesota.
! All rights reserved.
!
! Contributors:
! Ryan S. Elliott
!
! SPDX-License-Identifier: LGPL-2.1-or-later
!
! This library is free software; you can redistribute it and/or
! modify it under the terms of the GNU Lesser General Public
! License as published by the Free Software Foundation; either
! version 2.1 of the License, or (at your option) any later version.
!
! This library is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public License
! along with this library; if not, write to the Free Software Foundation,
! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
!
!
! Release: This file is part of the kim-api.git repository.
!
!> \brief \copybrief KIM::Model
!!
!! \sa KIM::Model, KIM_Model
!!
!! \since 2.0
module kim_model_module
use, intrinsic :: iso_c_binding
implicit none
private
public &
! Derived types
kim_model_handle_type, &
! Constants
KIM_MODEL_NULL_HANDLE, &
! Routines
operator(.eq.), &
operator(.ne.), &
kim_model_create, &
kim_model_destroy, &
kim_is_routine_present, &
kim_get_influence_distance, &
kim_get_number_of_neighbor_lists, &
kim_get_neighbor_list_values, &
kim_get_units, &
kim_compute_arguments_create, &
kim_compute_arguments_destroy, &
kim_compute, &
kim_extension, &
kim_clear_then_refresh, &
kim_write_parameterized_model, &
kim_get_species_support_and_code, &
kim_get_number_of_parameters, &
kim_get_parameter_metadata, &
kim_get_parameter, &
kim_set_parameter, &
kim_set_simulator_buffer_pointer, &
kim_get_simulator_buffer_pointer, &
kim_to_string, &
kim_set_log_id, &
kim_push_log_verbosity, &
kim_pop_log_verbosity
!> \brief \copybrief KIM::Model
!!
!! \sa KIM::Model, KIM_Model
!!
!! \since 2.0
type, bind(c) :: kim_model_handle_type
type(c_ptr) :: p = c_null_ptr
end type kim_model_handle_type
!> \brief NULL handle for use in comparisons.
!!
!! \since 2.0
type(kim_model_handle_type), protected, save &
:: KIM_MODEL_NULL_HANDLE
!> \brief Compares kim_model_handle_type's for equality.
!!
!! \since 2.0
interface operator(.eq.)
module procedure kim_model_handle_equal
end interface operator(.eq.)
!> \brief Compares kim_model_handle_type's for inequality.
!!
!! \since 2.0
interface operator(.ne.)
module procedure kim_model_handle_not_equal
end interface operator(.ne.)
!> \brief \copybrief KIM::Model::IsRoutinePresent
!!
!! \sa KIM::Model::IsRoutinePresent, KIM_Model_IsRoutinePresent
!!
!! \since 2.0
interface kim_is_routine_present
module procedure kim_model_is_routine_present
end interface kim_is_routine_present
!> \brief \copybrief KIM::Model::GetInfluenceDistance
!!
!! \sa KIM::Model::GetInfluenceDistance, KIM_Model_GetInfluenceDistance
!!
!! \since 2.0
interface kim_get_influence_distance
module procedure kim_model_get_influence_distance
end interface kim_get_influence_distance
!> \brief Get Model's number of neighbor lists.
!!
!! \sa KIM::Model::GetNeighborListPointers, KIM_Model_GetNeighborListPointers
!!
!! \since 2.0
interface kim_get_number_of_neighbor_lists
module procedure kim_model_get_number_of_neighbor_lists
end interface kim_get_number_of_neighbor_lists
!> \brief Get Model's neighbor list values
!!
!! \sa KIM::Model::GetNeighborListPointers, KIM_Model_GetNeighborListPointers
!!
!! \since 2.0
interface kim_get_neighbor_list_values
module procedure kim_model_get_neighbor_list_values
end interface kim_get_neighbor_list_values
!> \brief \copybrief KIM::Model::GetUnits
!!
!! \sa KIM::Model::GetUnits, KIM_Model_GetUnits
!!
!! \since 2.0
interface kim_get_units
module procedure kim_model_get_units
end interface kim_get_units
!> \brief \copybrief KIM::Model::ComputeArgumentsCreate
!!
!! \sa KIM::Model::ComputeArgumentsCreate, KIM_Model_ComputeArgumentsCreate
!!
!! \since 2.0
interface kim_compute_arguments_create
module procedure kim_model_compute_arguments_create
end interface kim_compute_arguments_create
!> \brief \copybrief KIM::Model::ComputeArgumentsDestroy
!!
!! \sa KIM::Model::ComputeArgumentsDestroy, KIM_Model_ComputeArgumentsDestroy
!!
!! \since 2.0
interface kim_compute_arguments_destroy
module procedure kim_model_compute_arguments_destroy
end interface kim_compute_arguments_destroy
!> \brief \copybrief KIM::Model::Compute
!!
!! \sa KIM::Model::Compute, KIM_Model_Compute
!!
!! \since 2.0
interface kim_compute
module procedure kim_model_compute
end interface kim_compute
!> \brief \copybrief KIM::Model::Extension
!!
!! \sa KIM::Model::Extension, KIM_Model_Extension
!!
!! \since 2.0
interface kim_extension
module procedure kim_model_extension
end interface kim_extension
!> \brief \copybrief KIM::Model::ClearThenRefresh
!!
!! \sa KIM::Model::ClearThenRefresh, KIM_Model_ClearThenRefresh
!!
!! \since 2.0
interface kim_clear_then_refresh
module procedure kim_model_clear_then_refresh
end interface kim_clear_then_refresh
!> \brief \copybrief KIM::Model::WriteParameterizedModel
!!
!! \sa KIM::Model::WriteParameterizedModel, KIM_Model_WriteParameterizedModel
!!
!! \since 2.0
interface kim_write_parameterized_model
module procedure kim_model_write_parameterized_model
end interface kim_write_parameterized_model
!> \brief \copybrief KIM::Model::GetSpeciesSupportAndCode
!!
!! \sa KIM::Model::GetSpeciesSupportAndCode,
!! KIM_Model_GetSpeciesSupportAndCode
!!
!! \since 2.0
interface kim_get_species_support_and_code
module procedure kim_model_get_species_support_and_code
end interface kim_get_species_support_and_code
!> \brief \copybrief KIM::Model::GetNumberOfParameters
!!
!! \sa KIM::Model::GetNumberOfParameters, KIM_Model_GetNumberOfParameters
!!
!! \since 2.0
interface kim_get_number_of_parameters
module procedure kim_model_get_number_of_parameters
end interface kim_get_number_of_parameters
!> \brief \copybrief KIM::Model::GetParameterMetadata
!!
!! \sa KIM::Model::GetParameterMetadata, KIM_Model_GetParameterMetadata
!!
!! \since 2.0
interface kim_get_parameter_metadata
module procedure kim_model_get_parameter_metadata
end interface kim_get_parameter_metadata
!> \brief \copybrief KIM::Model::GetParameter
!!
!! \sa KIM::Model::GetParameter, KIM_Model_GetParameterInteger,
!! KIM_Model_GetParameterDouble
!!
!! \since 2.0
interface kim_get_parameter
module procedure kim_model_get_parameter_integer
module procedure kim_model_get_parameter_double
end interface kim_get_parameter
!> \brief \copybrief KIM::Model::SetParameter
!!
!! \sa KIM::Model::SetParameter, KIM_Model_SetParameterInteger,
!! KIM_Model_SetParameterDouble
!!
!! \since 2.0
interface kim_set_parameter
module procedure kim_model_set_parameter_integer
module procedure kim_model_set_parameter_double
end interface kim_set_parameter
!> \brief \copybrief KIM::Model::SetSimulatorBufferPointer
!!
!! \sa KIM::Model::SetSimulatorBufferPointer,
!! KIM_Model_SetSimulatorBufferPointer
!!
!! \since 2.0
interface kim_set_simulator_buffer_pointer
module procedure kim_model_set_simulator_buffer_pointer
end interface kim_set_simulator_buffer_pointer
!> \brief \copybrief KIM::Model::GetSimulatorBufferPointer
!!
!! \sa KIM::Model::GetSimulatorBufferPointer,
!! KIM_Model_GetSimulatorBufferPointer
!!
!! \since 2.0
interface kim_get_simulator_buffer_pointer
module procedure kim_model_get_simulator_buffer_pointer
end interface kim_get_simulator_buffer_pointer
!> \brief \copybrief KIM::Model::ToString
!!
!! \sa KIM::Model::ToString, KIM_Model_ToString
!!
!! \since 2.0
interface kim_to_string
module procedure kim_model_to_string
end interface kim_to_string
!> \brief \copybrief KIM::Model::SetLogID
!!
!! \sa KIM::Model::SetLogID, KIM_Model_SetLogID
!!
!! \since 2.0
interface kim_set_log_id
module procedure kim_model_set_log_id
end interface kim_set_log_id
!> \brief \copybrief KIM::Model::PushLogVerbosity
!!
!! \sa KIM::Model::PushLogVerbosity, KIM_Model_PushLogVerbosity
!!
!! \since 2.0
interface kim_push_log_verbosity
module procedure kim_model_push_log_verbosity
end interface kim_push_log_verbosity
!> \brief \copybrief KIM::Model::PopLogVerbosity
!!
!! \sa KIM::Model::, KIM_Model_PopLogVerbosity
!!
!! \since 2.0
interface kim_pop_log_verbosity
module procedure kim_model_pop_log_verbosity
end interface kim_pop_log_verbosity
contains
!> \brief Compares kim_model_handle_type's for equality.
!!
!! \since 2.0
logical recursive function kim_model_handle_equal(lhs, rhs)
implicit none
type(kim_model_handle_type), intent(in) :: lhs
type(kim_model_handle_type), intent(in) :: rhs
if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
kim_model_handle_equal = .true.
else
kim_model_handle_equal = c_associated(lhs%p, rhs%p)
end if
end function kim_model_handle_equal
!> \brief Compares kim_model_handle_type's for inequality.
!!
!! \since 2.0
logical recursive function kim_model_handle_not_equal(lhs, rhs)
implicit none
type(kim_model_handle_type), intent(in) :: lhs
type(kim_model_handle_type), intent(in) :: rhs
kim_model_handle_not_equal = .not. (lhs == rhs)
end function kim_model_handle_not_equal
!> \brief \copybrief KIM::Model::Create
!!
!! A Fortran PM must provide a KIM::MODEL_ROUTINE_NAME::Create routine. The
!! interface for this is given here.
!!
!! A PM not employing a MD should use the following interface (see also
!! KIM::ModelCreateFunction, \ref KIM_ModelCreateFunction)
!!
!! \code{.f90}
!! interface
!! recursive subroutine create( &
!! model_create_handle, requested_length_unit, requested_energy_unit, &
!! requested_charge_unit, requested_temperature_unit, &
!! requested_time_unit, ierr) bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_headers_module
!! implicit none
!! type(kim_model_create_handle_type), intent(in) :: model_create_handle
!! type(kim_length_unit_type), intent(in), value :: requested_length_unit
!! type(kim_energy_unit_type), intent(in), value :: requested_energy_unit
!! type(kim_charge_unit_type), intent(in), value :: requested_charge_unit
!! type(kim_temperature_unit_type), intent(in), value :: &
!! requested_temperature_unit
!! type(kim_time_unit_type), intent(in), value :: requested_time_unit
!! integer(c_int), intent(out) :: ierr
!! end subroutine create
!! end interface
!! \endcode
!!
!! A MD should use the following interface (see also
!! KIM::ModelDriverCreateFunction, \ref KIM_ModelDriverCreateFunction)
!!
!! \code{.f90}
!! interface
!! recursive subroutine create( &
!! model_driver_create_handle, requested_length_unit, &
!! requested_energy_unit, requested_charge_unit, &
!! requested_temperature_unit, requested_time_unit, ierr) bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_driver_headers_module
!! implicit none
!! type(kim_model_driver_create_handle_type), intent(in) :: &
!! model_create_handle
!! type(kim_length_unit_type), intent(in), value :: requested_length_unit
!! type(kim_energy_unit_type), intent(in), value :: requested_energy_unit
!! type(kim_charge_unit_type), intent(in), value :: requested_charge_unit
!! type(kim_temperature_unit_type), intent(in), value :: &
!! requested_temperature_unit
!! type(kim_time_unit_type), intent(in), value :: requested_time_unit
!! integer(c_int), intent(out) :: ierr
!! end subroutine create
!! end interface
!! \endcode
!!
!! \sa KIM::Model::Create, KIM_Model_Create
!!
!! \since 2.0
recursive subroutine kim_model_create( &
numbering, requested_length_unit, requested_energy_unit, &
requested_charge_unit, requested_temperature_unit, requested_time_unit, &
model_name, requested_units_accepted, model_handle, ierr)
use kim_numbering_module, only: kim_numbering_type
use kim_unit_system_module, only: kim_length_unit_type, &
kim_energy_unit_type, &
kim_charge_unit_type, &
kim_temperature_unit_type, &
kim_time_unit_type
implicit none
interface
integer(c_int) recursive function create( &
numbering, requested_length_unit, requested_energy_unit, &
requested_charge_unit, requested_temperature_unit, &
requested_time_unit, model_name, requested_units_accepted, model) &
bind(c, name="KIM_Model_Create")
use, intrinsic :: iso_c_binding
use kim_numbering_module, only: kim_numbering_type
use kim_unit_system_module, only: kim_length_unit_type, &
kim_energy_unit_type, &
kim_charge_unit_type, &
kim_temperature_unit_type, &
kim_time_unit_type
implicit none
type(kim_numbering_type), intent(in), value :: numbering
type(kim_length_unit_type), intent(in), value :: requested_length_unit
type(kim_energy_unit_type), intent(in), value :: requested_energy_unit
type(kim_charge_unit_type), intent(in), value :: requested_charge_unit
type(kim_temperature_unit_type), intent(in), value :: &
requested_temperature_unit
type(kim_time_unit_type), intent(in), value :: requested_time_unit
character(c_char), intent(in) :: model_name(*)
integer(c_int), intent(out) :: requested_units_accepted
type(c_ptr), intent(out) :: model
end function create
end interface
type(kim_numbering_type), intent(in) :: numbering
type(kim_length_unit_type), intent(in) :: requested_length_unit
type(kim_energy_unit_type), intent(in) :: requested_energy_unit
type(kim_charge_unit_type), intent(in) :: requested_charge_unit
type(kim_temperature_unit_type), intent(in) :: &
requested_temperature_unit
type(kim_time_unit_type), intent(in) :: requested_time_unit
character(len=*, kind=c_char), intent(in) :: model_name
integer(c_int), intent(out) :: requested_units_accepted
type(kim_model_handle_type), intent(out) :: model_handle
integer(c_int), intent(out) :: ierr
type(c_ptr) :: pmodel
ierr = create(numbering, requested_length_unit, requested_energy_unit, &
requested_charge_unit, requested_temperature_unit, &
requested_time_unit, trim(model_name)//c_null_char, &
requested_units_accepted, pmodel)
model_handle%p = pmodel
end subroutine kim_model_create
!> \brief \copybrief KIM::Model::Destroy
!!
!! A Fortran PM must provide a KIM::MODEL_ROUTINE_NAME::Destroy routine. The
!! interface for this is given here (see also KIM::ModelDestroyFunction, \ref
!! KIM_ModelDestroyFunction).
!!
!! \code{.f90}
!! interface
!! recursive subroutine destroy(model_destroy_handle, ierr) bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_headers_module
!! implicit none
!! type(kim_model_destroy_handle_type), intent(in) :: model_destroy_handle
!! integer(c_int), intent(out) :: ierr
!! end subroutine destroy
!! end interface
!! \endcode
!!
!! \sa KIM::Model::Destroy, KIM_Model_Destroy
!!
!! \since 2.0
recursive subroutine kim_model_destroy(model_handle)
implicit none
interface
recursive subroutine destroy(model) bind(c, name="KIM_Model_Destroy")
use, intrinsic :: iso_c_binding
implicit none
type(c_ptr), intent(inout) :: model
end subroutine destroy
end interface
type(kim_model_handle_type), intent(inout) :: model_handle
type(c_ptr) :: pmodel
pmodel = model_handle%p
call destroy(pmodel)
model_handle%p = c_null_ptr
end subroutine kim_model_destroy
!> \brief \copybrief KIM::Model::IsRoutinePresent
!!
!! \sa KIM::Model::IsRoutinePresent, KIM_Model_IsRoutinePresent
!!
!! \since 2.0
recursive subroutine kim_model_is_routine_present( &
model_handle, model_routine_name, present, required, ierr)
use kim_interoperable_types_module, only: kim_model_type
use kim_model_routine_name_module, only: kim_model_routine_name_type
implicit none
interface
integer(c_int) recursive function is_routine_present( &
model, model_routine_name, present, required) &
bind(c, name="KIM_Model_IsRoutinePresent")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
use kim_model_routine_name_module, only: kim_model_routine_name_type
implicit none
type(kim_model_type), intent(in) :: model
type(kim_model_routine_name_type), intent(in), value &
:: model_routine_name
integer(c_int), intent(out) :: present
integer(c_int), intent(out) :: required
end function is_routine_present
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(kim_model_routine_name_type), intent(in) :: model_routine_name
integer(c_int), intent(out) :: present
integer(c_int), intent(out) :: required
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = is_routine_present(model, model_routine_name, present, required)
end subroutine kim_model_is_routine_present
!> \brief \copybrief KIM::Model::GetInfluenceDistance
!!
!! \sa KIM::Model::GetInfluenceDistance, KIM_Model_GetInfluenceDistance
!!
!! \since 2.0
recursive subroutine kim_model_get_influence_distance( &
model_handle, influence_distance)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine get_influence_distance(model, influence_distance) &
bind(c, name="KIM_Model_GetInfluenceDistance")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
real(c_double), intent(out) :: influence_distance
end subroutine get_influence_distance
end interface
type(kim_model_handle_type), intent(in) :: model_handle
real(c_double), intent(out) :: influence_distance
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
call get_influence_distance(model, influence_distance)
end subroutine kim_model_get_influence_distance
!> \brief Get Model's number of neighbor lists.
!!
!! \sa KIM::Model::GetNeighborListPointers, KIM_Model_GetNeighborListPointers
!!
!! \since 2.0
recursive subroutine kim_model_get_number_of_neighbor_lists( &
model_handle, number_of_neighbor_lists)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine get_neighbor_list_pointers( &
model, number_of_neighbor_lists, cutoffs_ptr, &
model_will_not_request_neighbors_of_noncontributing__ptr) &
bind(c, name="KIM_Model_GetNeighborListPointers")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
integer(c_int), intent(out) :: number_of_neighbor_lists
type(c_ptr), intent(out) :: cutoffs_ptr
type(c_ptr), intent(out) :: &
model_will_not_request_neighbors_of_noncontributing__ptr
end subroutine get_neighbor_list_pointers
end interface
type(kim_model_handle_type), intent(in) :: model_handle
integer(c_int), intent(out) :: number_of_neighbor_lists
type(kim_model_type), pointer :: model
type(c_ptr) cutoffs_ptr, hint_ptr
call c_f_pointer(model_handle%p, model)
call get_neighbor_list_pointers(model, number_of_neighbor_lists, &
cutoffs_ptr, hint_ptr)
end subroutine kim_model_get_number_of_neighbor_lists
!> \brief Get Model's neighbor list values
!!
!! \sa KIM::Model::GetNeighborListPointers, KIM_Model_GetNeighborListPointers
!!
!! \since 2.0
recursive subroutine kim_model_get_neighbor_list_values( &
model_handle, cutoffs, &
model_will_not_request_neighbors_of_noncontributing_particles, ierr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine get_neighbor_list_pointers( &
model, number_of_neighbor_lists, cutoffs_ptr, &
model_will_not_request_neighbors_of_noncontributing__ptr) &
bind(c, name="KIM_Model_GetNeighborListPointers")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
integer(c_int), intent(out) :: number_of_neighbor_lists
type(c_ptr), intent(out) :: cutoffs_ptr
type(c_ptr), intent(out) :: &
model_will_not_request_neighbors_of_noncontributing__ptr
end subroutine get_neighbor_list_pointers
end interface
type(kim_model_handle_type), intent(in) :: model_handle
real(c_double), intent(out) :: cutoffs(:)
integer(c_int), intent(out) :: &
model_will_not_request_neighbors_of_noncontributing_particles(:)
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
integer(c_int) number_of_neighbor_lists
real(c_double), pointer :: cutoffs_fpointer(:)
integer(c_int), pointer :: &
model_will_not_request_neighbors_of_noncontributing__fpointer(:)
type(c_ptr) cutoffs_ptr
type(c_ptr) model_will_not_request_neighbors_of_noncontributing__ptr
call c_f_pointer(model_handle%p, model)
call get_neighbor_list_pointers( &
model, number_of_neighbor_lists, cutoffs_ptr, &
model_will_not_request_neighbors_of_noncontributing__ptr)
if (c_associated(cutoffs_ptr)) then
call c_f_pointer(cutoffs_ptr, cutoffs_fpointer, &
[number_of_neighbor_lists])
else
nullify (cutoffs_fpointer)
end if
if (size(cutoffs) < number_of_neighbor_lists) then
ierr = 1
else
ierr = 0
cutoffs = cutoffs_fpointer(1:number_of_neighbor_lists)
end if
if (c_associated( &
model_will_not_request_neighbors_of_noncontributing__ptr)) then
call c_f_pointer( &
model_will_not_request_neighbors_of_noncontributing__ptr, &
model_will_not_request_neighbors_of_noncontributing__fpointer, &
[number_of_neighbor_lists])
else
nullify ( &
model_will_not_request_neighbors_of_noncontributing__fpointer)
end if
if (size( &
model_will_not_request_neighbors_of_noncontributing_particles) &
< number_of_neighbor_lists) then
ierr = 1
else
ierr = 0
model_will_not_request_neighbors_of_noncontributing_particles = &
model_will_not_request_neighbors_of_noncontributing__fpointer( &
1:number_of_neighbor_lists)
end if
end subroutine kim_model_get_neighbor_list_values
!> \brief \copybrief KIM::Model::GetUnits
!!
!! \sa KIM::Model::GetUnits, KIM_Model_GetUnits
!!
!! \since 2.0
recursive subroutine kim_model_get_units( &
model_handle, length_unit, energy_unit, charge_unit, temperature_unit, &
time_unit)
use kim_unit_system_module, only: kim_length_unit_type, &
kim_energy_unit_type, &
kim_charge_unit_type, &
kim_temperature_unit_type, &
kim_time_unit_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine get_units( &
model, length_unit, energy_unit, charge_unit, temperature_unit, &
time_unit) &
bind(c, name="KIM_Model_GetUnits")
use, intrinsic :: iso_c_binding
use kim_unit_system_module, only: kim_length_unit_type, &
kim_energy_unit_type, &
kim_charge_unit_type, &
kim_temperature_unit_type, &
kim_time_unit_type
use kim_interoperable_types_module, only: kim_model_type
type(kim_model_type), intent(in) :: model
type(kim_length_unit_type), intent(out) :: length_unit
type(kim_energy_unit_type), intent(out) :: energy_unit
type(kim_charge_unit_type), intent(out) :: charge_unit
type(kim_temperature_unit_type), intent(out) :: temperature_unit
type(kim_time_unit_type), intent(out) :: time_unit
end subroutine get_units
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(kim_length_unit_type), intent(out) :: length_unit
type(kim_energy_unit_type), intent(out) :: energy_unit
type(kim_charge_unit_type), intent(out) :: charge_unit
type(kim_temperature_unit_type), intent(out) :: temperature_unit
type(kim_time_unit_type), intent(out) :: time_unit
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
call get_units(model, length_unit, energy_unit, charge_unit, &
temperature_unit, time_unit)
end subroutine kim_model_get_units
!> \brief \copybrief KIM::Model::ComputeArgumentsCreate
!!
!! A Fortran PM must provide a
!! KIM::MODEL_ROUTINE_NAME::ComputeArgumentsCreate routine. The interface
!! for this is given here (see also KIM::ModelComputeArgumentsCreateFunction,
!! \ref KIM_ModelComputeArgumentsCreateFunction).
!!
!! \code{.f90}
!! interface
!! recursive subroutine compute_arguments_create( &
!! model_compute_handle, model_compute_arguments_create_handle, ierr) &
!! bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_headers_module
!! implicit none
!! type(kim_model_compute_handle_type), intent(in) :: model_compute_handle
!! type(kim_model_compute_arguments_create_handle_type), intent(in) &
!! :: model_compute_arguments_create_handle
!! integer(c_int), intent(out) :: ierr
!! end subroutine compute_arguments_create
!! end interface
!! \endcode
!!
!! \sa KIM::Model::ComputeArgumentsCreate, KIM_Model_ComputeArgumentsCreate
!!
!! \since 2.0
recursive subroutine kim_model_compute_arguments_create( &
model_handle, compute_arguments_handle, ierr)
use kim_compute_arguments_module, only: &
kim_compute_arguments_handle_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function compute_arguments_create( &
model, compute_arguments) &
bind(c, name="KIM_Model_ComputeArgumentsCreate")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
type(c_ptr), intent(out) :: compute_arguments
end function compute_arguments_create
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(kim_compute_arguments_handle_type), intent(out) :: &
compute_arguments_handle
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
type(c_ptr) :: pcompute_arguments
call c_f_pointer(model_handle%p, model)
ierr = compute_arguments_create(model, pcompute_arguments)
if (ierr == 0) then
compute_arguments_handle%p = pcompute_arguments
end if
end subroutine kim_model_compute_arguments_create
!> \brief \copybrief KIM::Model::ComputeArgumentsDestroy
!!
!! A Fortran PM must provide a
!! KIM::MODEL_ROUTINE_NAME::ComputeArgumentsDestroy routine. The interface
!! for this is given here (see also
!! KIM::ModelComputeArgumentsDestroyFunction, \ref
!! KIM_ModelComputeArgumentsDestroyFunction).
!!
!! \code{.f90}
!! interface
!! recursive subroutine compute_arguments_destroy( &
!! model_compute_handle, model_compute_arguments_destroy_handle, ierr) &
!! bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_headers_module
!! implicit none
!! type(kim_model_compute_handle_type), intent(in) :: model_compute_handle
!! type(kim_model_compute_arguments_destroy_handle_type), intent(in) &
!! :: model_compute_arguments_destroy_handle
!! integer(c_int), intent(out) :: ierr
!! end subroutine compute_arguments_destroy
!! end interface
!! \endcode
!!
!! \sa KIM::Model::ComputeArgumentsDestroy, KIM_Model_ComputeArgumentsDestroy
!!
!! \since 2.0
recursive subroutine kim_model_compute_arguments_destroy( &
model_handle, compute_arguments_handle, ierr)
use kim_compute_arguments_module, only: kim_compute_arguments_handle_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function compute_arguments_destroy( &
model, compute_arguments) &
bind(c, name="KIM_Model_ComputeArgumentsDestroy")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
type(c_ptr), intent(inout) :: compute_arguments
end function compute_arguments_destroy
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(kim_compute_arguments_handle_type), intent(inout) :: &
compute_arguments_handle
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
type(c_ptr) pcompute_arguments
call c_f_pointer(model_handle%p, model)
pcompute_arguments = compute_arguments_handle%p
ierr = compute_arguments_destroy(model, pcompute_arguments)
if (ierr /= 0) then
compute_arguments_handle%p = c_null_ptr
end if
end subroutine kim_model_compute_arguments_destroy
!> \brief \copybrief KIM::Model::Compute
!!
!! A Fortran PM must provide a KIM::MODEL_ROUTINE_NAME::Compute routine. The
!! interface for this is given here (see also KIM::ModelComputeFunction, \ref
!! KIM_ModelComputeFunction).
!!
!! \code{.f90}
!! interface
!! recursive subroutine compute( &
!! model_compute_handle, model_compute_arguments_handle, ierr) &
!! bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_headers_module
!! implicit none
!! type(kim_model_compute_handle_type), intent(in) :: model_compute_handle
!! type(kim_model_compute_arguments_handle_type), intent(in) :: &
!! model_compute_arguments_handle
!! integer(c_int), intent(out) :: ierr
!! end subroutine compute
!! end interface
!! \endcode
!!
!! \sa KIM::Model::Compute, KIM_Model_Compute
!!
!! \since 2.0
recursive subroutine kim_model_compute( &
model_handle, compute_arguments_handle, ierr)
use kim_compute_arguments_module, only: kim_compute_arguments_handle_type
use kim_interoperable_types_module, only: kim_compute_arguments_type, &
kim_model_type
implicit none
interface
integer(c_int) recursive function compute(model, compute_arguments) &
bind(c, name="KIM_Model_Compute")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_compute_arguments_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
type(kim_compute_arguments_type), intent(in) :: compute_arguments
end function compute
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(kim_compute_arguments_handle_type), intent(in) :: &
compute_arguments_handle
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
type(kim_compute_arguments_type), pointer :: compute_arguments
call c_f_pointer(model_handle%p, model)
call c_f_pointer(compute_arguments_handle%p, compute_arguments)
ierr = compute(model, compute_arguments)
end subroutine kim_model_compute
!> \brief \copybrief KIM::Model::Extension
!!
!! A Fortran PM may provide a KIM::MODEL_ROUTINE_NAME::Extension routine.
!! The interface for this is given here (see also
!! KIM::ModelExtensionFunction, \ref KIM_ModelExtensionFunction).
!!
!! \code{.f90}
!! interface
!! recursive subroutine extension( &
!! model_extension_handle, extension_structure, ierr) &
!! bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_headers_module
!! implicit none
!! type(kim_model_extension_handle_type), intent(in) :: &
!! model_extension_handle
!! type(c_ptr), intent(in), value :: extension_structure
!! integer(c_int), intent(out) :: ierr
!! end subroutine extension
!! end interface
!! \endcode
!!
!! \sa KIM::Model::Extension, KIM_Model_Extension
!!
!! \since 2.0
recursive subroutine kim_model_extension( &
model_handle, extension_id, extension_structure, ierr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function extension( &
model, extension_id, extension_structure) &
bind(c, name="KIM_Model_Extension")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
character(c_char), intent(in) :: extension_id(*)
type(c_ptr), intent(in), value :: extension_structure
end function extension
end interface
type(kim_model_handle_type), intent(in) :: model_handle
character(len=*, kind=c_char), intent(in) :: extension_id
type(c_ptr), intent(in) :: extension_structure
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = extension(model, trim(extension_id)//c_null_char, &
extension_structure)
end subroutine kim_model_extension
!> \brief \copybrief KIM::Model::ClearThenRefresh
!!
!! A Fortran PM may need to provide a KIM::MODEL_ROUTINE_NAME::Refresh
!! routine. The interface for this is given here (see also
!! KIM::ModelRefreshFunction, \ref KIM_ModelRefreshFunction).
!!
!! \code{.f90}
!! interface
!! recursive subroutine refresh(model_refresh_handle, ierr) bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_headers_module
!! implicit none
!! type(kim_model_refresh_handle_type), intent(in) :: model_refresh_handle
!! integer(c_int), intent(out) :: ierr
!! end subroutine refresh
!! end interface
!! \endcode
!!
!! \sa KIM::Model::ClearThenRefresh, KIM_Model_ClearThenRefresh
!!
!! \since 2.0
recursive subroutine kim_model_clear_then_refresh(model_handle, ierr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function clear_then_refresh(model) &
bind(c, name="KIM_Model_ClearThenRefresh")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
end function clear_then_refresh
end interface
type(kim_model_handle_type), intent(in) :: model_handle
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = clear_then_refresh(model)
end subroutine kim_model_clear_then_refresh
!> \brief \copybrief KIM::Model::WriteParameterizedModel
!!
!! A Fortran PM using a MD may provide a
!! KIM::MODEL_ROUTINE_NAME::WriteParameterizedMdoel routine. The interface
!! for this is given here (see also
!! KIM::ModelWriteParameterizedModelFunction, \ref
!! KIM_ModelWriteParameterizedModelFunction).
!!
!! \code{.f90}
!! interface
!! recursive subroutine write_parameterized_model( &
!! model_write_parameterized_model_handle, ierr) bind(c)
!! use, intrinsic :: iso_c_binding
!! use kim_model_headers_module
!! implicit none
!! type(kim_model_write_parameterized_model_handle_type), intent(in) &
!! :: model_write_parameterized_model_handle
!! integer(c_int), intent(out) :: ierr
!! end subroutine write_parameterized_model
!! end interface
!! \endcode
!!
!! \sa KIM::Model::WriteParameterizedModel, KIM_Model_WriteParameterizedModel
!!
!! \since 2.0
recursive subroutine kim_model_write_parameterized_model( &
model_handle, path, model_name, ierr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function write_parameterized_model( &
model, path, model_name) &
bind(c, name="KIM_Model_WriteParameterizedModel")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
character(c_char), intent(in) :: path(*)
character(c_char), intent(in) :: model_name(*)
end function write_parameterized_model
end interface
type(kim_model_handle_type), intent(in) :: model_handle
character(len=*, kind=c_char), intent(in) :: path
character(len=*, kind=c_char), intent(in) :: model_name
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = write_parameterized_model(model, trim(path)//c_null_char, &
trim(model_name)//c_null_char)
end subroutine kim_model_write_parameterized_model
!> \brief \copybrief KIM::Model::GetSpeciesSupportAndCode
!!
!! \sa KIM::Model::GetSpeciesSupportAndCode,
!! KIM_Model_GetSpeciesSupportAndCode
!!
!! \since 2.0
recursive subroutine kim_model_get_species_support_and_code( &
model_handle, species_name, species_is_supported, code, ierr)
use kim_species_name_module, only: kim_species_name_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function get_species_support_and_code( &
model, species_name, species_is_supported, code) &
bind(c, name="KIM_Model_GetSpeciesSupportAndCode")
use, intrinsic :: iso_c_binding
use kim_species_name_module, only: kim_species_name_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
type(kim_species_name_type), intent(in), value :: species_name
integer(c_int), intent(out) :: species_is_supported
integer(c_int), intent(out) :: code
end function get_species_support_and_code
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(kim_species_name_type), intent(in) :: species_name
integer(c_int), intent(out) :: species_is_supported
integer(c_int), intent(out) :: code
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = get_species_support_and_code(model, species_name, &
species_is_supported, code)
end subroutine kim_model_get_species_support_and_code
!> \brief \copybrief KIM::Model::GetNumberOfParameters
!!
!! \sa KIM::Model::GetNumberOfParameters, KIM_Model_GetNumberOfParameters
!!
!! \since 2.0
recursive subroutine kim_model_get_number_of_parameters( &
model_handle, number_of_parameters)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine get_number_of_parameters( &
model, number_of_parameters) &
bind(c, name="KIM_Model_GetNumberOfParameters")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
integer(c_int), intent(out) :: number_of_parameters
end subroutine get_number_of_parameters
end interface
type(kim_model_handle_type), intent(in) :: model_handle
integer(c_int), intent(out) :: number_of_parameters
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
call get_number_of_parameters(model, number_of_parameters)
end subroutine kim_model_get_number_of_parameters
!> \brief \copybrief KIM::Model::GetParameterMetadata
!!
!! \sa KIM::Model::GetParameterMetadata, KIM_Model_GetParameterMetadata
!!
!! \since 2.0
recursive subroutine kim_model_get_parameter_metadata( &
model_handle, parameter_index, data_type, extent, name, description, ierr)
use kim_data_type_module, only: kim_data_type_type
use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function get_parameter_metadata( &
model, parameter_index, data_type, extent, name, description) &
bind(c, name="KIM_Model_GetParameterMetadata")
use, intrinsic :: iso_c_binding
use kim_data_type_module, only: kim_data_type_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
integer(c_int), intent(in), value :: parameter_index
type(kim_data_type_type), intent(out) :: data_type
integer(c_int), intent(out) :: extent
type(c_ptr), intent(out) :: name
type(c_ptr), intent(out) :: description
end function get_parameter_metadata
end interface
type(kim_model_handle_type), intent(in) :: model_handle
integer(c_int), intent(in) :: parameter_index
type(kim_data_type_type), intent(out) :: data_type
integer(c_int), intent(out) :: extent
character(len=*, kind=c_char), intent(out) :: name
character(len=*, kind=c_char), intent(out) :: description
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
type(c_ptr) :: pname, pdesc
call c_f_pointer(model_handle%p, model)
ierr = get_parameter_metadata(model, parameter_index - 1, data_type, &
extent, pname, pdesc)
call kim_convert_c_char_ptr_to_string(pname, name)
call kim_convert_c_char_ptr_to_string(pdesc, description)
end subroutine kim_model_get_parameter_metadata
!> \brief \copybrief KIM::Model::GetParameter
!!
!! \sa KIM::Model::GetParameter, KIM_Model_GetParameterInteger
!!
!! \since 2.0
recursive subroutine kim_model_get_parameter_integer( &
model_handle, parameter_index, array_index, parameter_value, ierr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function get_parameter_integer( &
model, parameter_index, array_index, parameter_value) &
bind(c, name="KIM_Model_GetParameterInteger")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
integer(c_int), intent(in), value :: parameter_index
integer(c_int), intent(in), value :: array_index
integer(c_int), intent(out) :: parameter_value
end function get_parameter_integer
end interface
type(kim_model_handle_type), intent(in) :: model_handle
integer(c_int), intent(in) :: parameter_index
integer(c_int), intent(in) :: array_index
integer(c_int), intent(out) :: parameter_value
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = get_parameter_integer(model, parameter_index - 1, array_index - 1, &
parameter_value)
end subroutine kim_model_get_parameter_integer
!> \brief \copybrief KIM::Model::GetParameter
!!
!! \sa KIM::Model::GetParameter, KIM_Model_GetParameterDouble
!!
!! \since 2.0
recursive subroutine kim_model_get_parameter_double( &
model_handle, parameter_index, array_index, parameter_value, ierr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function get_parameter_double( &
model, parameter_index, array_index, parameter_value) &
bind(c, name="KIM_Model_GetParameterDouble")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
integer(c_int), intent(in), value :: parameter_index
integer(c_int), intent(in), value :: array_index
real(c_double), intent(out) :: parameter_value
end function get_parameter_double
end interface
type(kim_model_handle_type), intent(in) :: model_handle
integer(c_int), intent(in) :: parameter_index
integer(c_int), intent(in) :: array_index
real(c_double), intent(out) :: parameter_value
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = get_parameter_double(model, parameter_index - 1, array_index - 1, &
parameter_value)
end subroutine kim_model_get_parameter_double
!> \brief \copybrief KIM::Model::SetParameter
!!
!! \sa KIM::Model::SetParameter, KIM_Model_SetParameterInteger
!!
!! \since 2.0
recursive subroutine kim_model_set_parameter_integer( &
model_handle, parameter_index, array_index, parameter_value, ierr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function set_parameter_integer( &
model, parameter_index, array_index, parameter_value) &
bind(c, name="KIM_Model_SetParameterInteger")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
integer(c_int), intent(in), value :: parameter_index
integer(c_int), intent(in), value :: array_index
integer(c_int), intent(in), value :: parameter_value
end function set_parameter_integer
end interface
type(kim_model_handle_type), intent(in) :: model_handle
integer(c_int), intent(in) :: parameter_index
integer(c_int), intent(in) :: array_index
integer(c_int), intent(in) :: parameter_value
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = set_parameter_integer(model, parameter_index - 1, array_index - 1, &
parameter_value)
end subroutine kim_model_set_parameter_integer
!> \brief \copybrief KIM::Model::SetParameter
!!
!! \sa KIM::Model::SetParameter, KIM_Model_SetParameterDouble
!!
!! \since 2.0
recursive subroutine kim_model_set_parameter_double( &
model_handle, parameter_index, array_index, parameter_value, ierr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
integer(c_int) recursive function set_parameter_double( &
model, parameter_index, array_index, parameter_value) &
bind(c, name="KIM_Model_SetParameterDouble")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
integer(c_int), intent(in), value :: parameter_index
integer(c_int), intent(in), value :: array_index
real(c_double), intent(in), value :: parameter_value
end function set_parameter_double
end interface
type(kim_model_handle_type), intent(in) :: model_handle
integer(c_int), intent(in) :: parameter_index
integer(c_int), intent(in) :: array_index
real(c_double), intent(in) :: parameter_value
integer(c_int), intent(out) :: ierr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
ierr = set_parameter_double(model, parameter_index - 1, array_index - 1, &
parameter_value)
end subroutine kim_model_set_parameter_double
!> \brief \copybrief KIM::Model::SetSimulatorBufferPointer
!!
!! \sa KIM::Model::SetSimulatorBufferPointer,
!! KIM_Model_SetSimulatorBufferPointer
!!
!! \since 2.0
recursive subroutine kim_model_set_simulator_buffer_pointer(model_handle, ptr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine set_simulator_buffer_pointer(model, ptr) &
bind(c, name="KIM_Model_SetSimulatorBufferPointer")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
type(c_ptr), intent(in), value :: ptr
end subroutine set_simulator_buffer_pointer
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(c_ptr), intent(in) :: ptr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
call set_simulator_buffer_pointer(model, ptr)
end subroutine kim_model_set_simulator_buffer_pointer
!> \brief \copybrief KIM::Model::GetSimulatorBufferPointer
!!
!! \sa KIM::Model::GetSimulatorBufferPointer,
!! KIM_Model_GetSimulatorBufferPointer
!!
!! \since 2.0
recursive subroutine kim_model_get_simulator_buffer_pointer(model_handle, ptr)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine get_simulator_buffer_pointer(model, ptr) &
bind(c, name="KIM_Model_GetSimulatorBufferPointer")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
type(c_ptr), intent(out) :: ptr
end subroutine get_simulator_buffer_pointer
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(c_ptr), intent(out) :: ptr
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
call get_simulator_buffer_pointer(model, ptr)
end subroutine kim_model_get_simulator_buffer_pointer
!> \brief \copybrief KIM::Model::ToString
!!
!! \sa KIM::Model::ToString, KIM_Model_ToString
!!
!! \since 2.0
recursive subroutine kim_model_to_string(model_handle, string)
use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
type(c_ptr) recursive function model_string(model) &
bind(c, name="KIM_Model_ToString")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
end function model_string
end interface
type(kim_model_handle_type), intent(in) :: model_handle
character(len=*, kind=c_char), intent(out) :: string
type(kim_model_type), pointer :: model
type(c_ptr) :: p
call c_f_pointer(model_handle%p, model)
p = model_string(model)
call kim_convert_c_char_ptr_to_string(p, string)
end subroutine kim_model_to_string
!> \brief \copybrief KIM::Model::SetLogID
!!
!! \sa KIM::Model::SetLogID, KIM_Model_SetLogID
!!
!! \since 2.0
recursive subroutine kim_model_set_log_id(model_handle, log_id)
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine set_log_id(model, log_id) &
bind(c, name="KIM_Model_SetLogID")
use, intrinsic :: iso_c_binding
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
character(c_char), intent(in) :: log_id(*)
end subroutine set_log_id
end interface
type(kim_model_handle_type), intent(in) :: model_handle
character(len=*, kind=c_char), intent(in) :: log_id
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
call set_log_id(model, trim(log_id)//c_null_char)
end subroutine kim_model_set_log_id
!> \brief \copybrief KIM::Model::PushLogVerbosity
!!
!! \sa KIM::Model::PushLogVerbosity, KIM_Model_PushLogVerbosity
!!
!! \since 2.0
recursive subroutine kim_model_push_log_verbosity(model_handle, log_verbosity)
use kim_log_verbosity_module, only: kim_log_verbosity_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine push_log_verbosity(model, log_verbosity) &
bind(c, name="KIM_Model_PushLogVerbosity")
use, intrinsic :: iso_c_binding
use kim_log_verbosity_module, only: kim_log_verbosity_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
type(kim_log_verbosity_type), intent(in), value :: log_verbosity
end subroutine push_log_verbosity
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(kim_log_verbosity_type), intent(in) :: log_verbosity
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
call push_log_verbosity(model, log_verbosity)
end subroutine kim_model_push_log_verbosity
!> \brief \copybrief KIM::Model::PopLogVerbosity
!!
!! \sa KIM::Model::, KIM_Model_PopLogVerbosity
!!
!! \since 2.0
recursive subroutine kim_model_pop_log_verbosity(model_handle)
use kim_log_verbosity_module, only: kim_log_verbosity_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
interface
recursive subroutine pop_log_verbosity(model) &
bind(c, name="KIM_Model_PopLogVerbosity")
use, intrinsic :: iso_c_binding
use kim_log_verbosity_module, only: kim_log_verbosity_type
use kim_interoperable_types_module, only: kim_model_type
implicit none
type(kim_model_type), intent(in) :: model
end subroutine pop_log_verbosity
end interface
type(kim_model_handle_type), intent(in) :: model_handle
type(kim_model_type), pointer :: model
call c_f_pointer(model_handle%p, model)
call pop_log_verbosity(model)
end subroutine kim_model_pop_log_verbosity
end module kim_model_module
|