kim-api 2.4.1+AppleClang.AppleClang.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
 
Loading...
Searching...
No Matches
kim_simulator_model_module.f90
Go to the documentation of this file.
1!
2! KIM-API: An API for interatomic models
3! Copyright (c) 2013--2022, Regents of the University of Minnesota.
4! All rights reserved.
5!
6! Contributors:
7! Ryan S. Elliott
8!
9! SPDX-License-Identifier: LGPL-2.1-or-later
10!
11! This library is free software; you can redistribute it and/or
12! modify it under the terms of the GNU Lesser General Public
13! License as published by the Free Software Foundation; either
14! version 2.1 of the License, or (at your option) any later version.
15!
16! This library is distributed in the hope that it will be useful,
17! but WITHOUT ANY WARRANTY; without even the implied warranty of
18! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19! Lesser General Public License for more details.
20!
21! You should have received a copy of the GNU Lesser General Public License
22! along with this library; if not, write to the Free Software Foundation,
23! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24!
25
26!
27! Release: This file is part of the kim-api-2.4.1 package.
28!
29
30!> \brief \copybrief KIM::SimulatorModel
31!!
32!! \sa KIM::SimulatorModel, KIM_SimulatorModel
33!!
34!! \since 2.1
36 use, intrinsic :: iso_c_binding
37 implicit none
38 private
39
40 public &
41 ! Derived types
43 ! Constants
45 ! Routines
46 operator(.eq.), &
47 operator(.ne.), &
71
72 !> \brief \copybrief KIM::SimulatorModel
73 !!
74 !! \sa KIM::SimulatorModel, KIM_SimulatorModel
75 !!
76 !! \since 2.1
77 type, bind(c) :: kim_simulator_model_handle_type
78 type(c_ptr) :: p = c_null_ptr
80
81 !> \brief NULL handle for use in comparisons.
82 !!
83 !! \since 2.1
86
87 !> \brief Compares kim_simulator_model_handle_type's for equality.
88 !!
89 !! \since 2.1
90 interface operator(.eq.)
91 module procedure kim_simulator_model_handle_equal
92 end interface operator(.eq.)
93
94 !> \brief Compares kim_simulator_model_handle_type's for inequality.
95 !!
96 !! \since 2.1
97 interface operator(.ne.)
98 module procedure kim_simulator_model_handle_not_equal
99 end interface operator(.ne.)
100
101 !> \brief \copybrief KIM::SimulatorModel::GetSimulatorNameAndVersion
102 !!
103 !! \sa KIM::SimulatorModel::GetSimulatorNameAndVersion,
104 !! KIM_SimulatorModel_GetSimulatorNameAndVersion
105 !!
106 !! \since 2.1
108 module procedure kim_simulator_model_get_simulator_name_and_version
110
111 !> \brief \copybrief KIM::SimulatorModel::GetNumberOfSupportedSpecies
112 !!
113 !! \sa KIM::SimulatorModel::GetNumberOfSupportedSpecies,
114 !! KIM_SimulatorModel_GetNumberOfSupportedSpecies
115 !!
116 !! \since 2.1
118 module procedure kim_simulator_model_get_number_of_supported_species
120
121 !> \brief \copybrief KIM::SimulatorModel::GetSupportedSpecies
122 !!
123 !! \sa KIM::SimulatorModel::GetSupportedSpecies,
124 !! KIM_SimulatorModel_GetSupportedSpecies
125 !!
126 !! \since 2.1
128 module procedure kim_simulator_model_get_supported_species
129 end interface kim_get_supported_species
130
131 !> \brief \copybrief KIM::SimulatorModel::OpenAndInitializeTemplateMap
132 !!
133 !! \sa KIM::SimulatorModel::OpenAndInitializeTemplateMap,
134 !! KIM_SimulatorModel_OpenAndInitializeTemplateMap
135 !!
136 !! \since 2.1
138 module procedure kim_simulator_model_open_and_initialize_template_map
140
141 !> \brief \copybrief KIM::SimulatorModel::TemplateMapIsOpen
142 !!
143 !! \sa KIM::SimulatorModel::TemplateMapIsOpen,
144 !! KIM_SimulatorModel_TemplateMapIsOpen
145 !!
146 !! \since 2.1
148 module procedure kim_simulator_model_template_map_is_open
149 end interface kim_template_map_is_open
150
151 !> \brief \copybrief KIM::SimulatorModel::AddTemplateMap
152 !!
153 !! \sa KIM::SimulatorModel::AddTemplateMap, KIM_SimulatorModel_AddTemplateMap
154 !!
155 !! \since 2.1
157 module procedure kim_simulator_model_add_template_map
158 end interface kim_add_template_map
159
160 !> \brief \copybrief KIM::SimulatorModel::CloseTemplateMap
161 !!
162 !! \sa KIM::SimulatorModel::CloseTemplateMap,
163 !! KIM_SimulatorModel_CloseTemplateMap
164 !!
165 !! \since 2.1
167 module procedure kim_simulator_model_close_template_map
168 end interface kim_close_template_map
169
170 !> \brief \copybrief KIM::SimulatorModel::GetNumberOfSimulatorFields
171 !!
172 !! \sa KIM::SimulatorModel::GetNumberOfSimulatorFields,
173 !! KIM_SimulatorModel_GetNumberOfSimulatorFields
174 !!
175 !! \since 2.1
177 module procedure kim_simulator_model_get_number_of_simulator_fields
179
180 !> \brief \copybrief KIM::SimulatorModel::GetSimulatorFieldMetadata
181 !!
182 !! \sa KIM::SimulatorModel::GetSimulatorFieldMetadata,
183 !! KIM_SimulatorModel_GetSimulatorFieldMetadata
184 !!
185 !! \since 2.1
187 module procedure kim_simulator_model_get_simulator_field_metadata
189
190 !> \brief \copybrief KIM::SimulatorModel::GetSimulatorFieldLine
191 !!
192 !! \sa KIM::SimulatorModel::GetSimulatorFieldLine,
193 !! KIM_SimulatorModel_GetSimulatorFieldLine
194 !!
195 !! \since 2.1
197 module procedure kim_simulator_model_get_simulator_field_line
198 end interface kim_get_simulator_field_line
199
200 !> \brief \copybrief KIM::SimulatorModel::GetParameterFileDirectoryName
201 !!
202 !! \sa KIM::SimulatorModel::GetParameterFileDirectoryName,
203 !! KIM_SimulatorModel_GetParameterFileDirectoryName
204 !!
205 !! \since 2.1
207 module procedure kim_simulator_model_get_parameter_file_directory_name
209
210 !> \brief \copybrief KIM::SimulatorModel::GetSpecificationFileName
211 !!
212 !! \sa KIM::SimulatorModel::GetSpecificationFileName,
213 !! KIM_SimulatorModel_GetSpecificationFileName
214 !!
215 !! \since 2.1
217 module procedure kim_simulator_model_get_specification_file_name
219
220 !> \brief \copybrief KIM::SimulatorModel::GetNumberOfParameterFiles
221 !!
222 !! \sa KIM::SimulatorModel::GetNumberOfParameterFiles,
223 !! KIM_SimulatorModel_GetNumberOfParameterFiles
224 !!
225 !! \since 2.1
227 module procedure kim_simulator_model_get_number_of_parameter_files
229
230 !> \brief \copybrief KIM::SimulatorModel::GetParameterFileName
231 !!
232 !! \sa KIM::SimulatorModel::GetParameterFileName,
233 !! KIM_SimulatorModel_GetParameterFileName
234 !!
235 !! \since 2.1
236 !!
237 !! \deprecated As of 2.2. Please use
238 !! kim_simulator_model_module::kim_get_parameter_file_basename() instead.
240 module procedure kim_simulator_model_get_parameter_file_name
241 end interface kim_get_parameter_file_name
242
243 !> \brief \copybrief KIM::SimulatorModel::GetParameterFileBasename
244 !!
245 !! \sa KIM::SimulatorModel::GetParameterFileBasename,
246 !! KIM_SimulatorModel_GetParameterFileBasename
247 !!
248 !! \since 2.2
250 module procedure kim_simulator_model_get_parameter_file_basename
252
253 !> \brief \copybrief KIM::SimulatorModel::SetSimulatorBufferPointer
254 !!
255 !! \sa KIM::SimulatorModel::SetSimulatorBufferPointer,
256 !! KIM_SimulatorModel_SetSimulatorBufferPointer
257 !!
258 !! \since 2.1
260 module procedure kim_simulator_model_set_simulator_buffer_pointer
262
263 !> \brief \copybrief KIM::SimulatorModel::GetSimulatorBufferPointer
264 !!
265 !! \sa KIM::SimulatorModel::GetSimulatorBufferPointer,
266 !! KIM_SimulatorModel_GetSimulatorBufferPointer
267 !!
268 !! \since 2.1
270 module procedure kim_simulator_model_get_simulator_buffer_pointer
272
273 !> \brief \copybrief KIM::SimulatorModel::ToString
274 !!
275 !! \sa KIM::SimulatorModel::ToString, KIM_SimulatorModel_ToString
276 !!
277 !! \since 2.1
279 module procedure kim_simulator_model_to_string
280 end interface kim_to_string
281
282 !> \brief \copybrief KIM::SimulatorModel::SetLogID
283 !!
284 !! \sa KIM::SimulatorModel::SetLogID, KIM_SimulatorModel_SetLogID
285 !!
286 !! \since 2.1
288 module procedure kim_simulator_model_set_log_id
289 end interface kim_set_log_id
290
291 !> \brief \copybrief KIM::SimulatorModel::PushLogVerbosity
292 !!
293 !! \sa KIM::SimulatorModel::PushLogVerbosity,
294 !! KIM_SimulatorModel_PushLogVerbosity
295 !!
296 !! \since 2.1
298 module procedure kim_simulator_model_push_log_verbosity
299 end interface kim_push_log_verbosity
300
301 !> \brief \copybrief KIM::SimulatorModel::PopLogVerbosity
302 !!
303 !! \sa KIM::SimulatorModel::, KIM_SimulatorModel_PopLogVerbosity
304 !!
305 !! \since 2.1
307 module procedure kim_simulator_model_pop_log_verbosity
308 end interface kim_pop_log_verbosity
309
310contains
311 !> \brief Compares kim_simulator_model_handle_type's for equality.
312 !!
313 !! \since 2.1
314 logical recursive function kim_simulator_model_handle_equal(lhs, rhs)
315 implicit none
316 type(kim_simulator_model_handle_type), intent(in) :: lhs
317 type(kim_simulator_model_handle_type), intent(in) :: rhs
318
319 if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
320 kim_simulator_model_handle_equal = .true.
321 else
322 kim_simulator_model_handle_equal = c_associated(lhs%p, rhs%p)
323 end if
324 end function kim_simulator_model_handle_equal
325
326 !> \brief Compares kim_simulator_model_handle_type's for inequality.
327 !!
328 !! \since 2.1
329 logical recursive function kim_simulator_model_handle_not_equal(lhs, rhs)
330 implicit none
331 type(kim_simulator_model_handle_type), intent(in) :: lhs
332 type(kim_simulator_model_handle_type), intent(in) :: rhs
333
334 kim_simulator_model_handle_not_equal = .not. (lhs == rhs)
335 end function kim_simulator_model_handle_not_equal
336
337 !> \brief \copybrief KIM::SimulatorModel::Create
338 !!
339 !! \sa KIM::SimulatorModel::Create, KIM_SimulatorModel_Create
340 !!
341 !! \since 2.1
342 recursive subroutine kim_simulator_model_create(simulator_model_name, &
343 simulator_model_handle, ierr)
344 implicit none
345 interface
346 integer(c_int) recursive function create( &
347 simulator_model_name, simulator_model) &
348 bind(c, name="KIM_SimulatorModel_Create")
349 use, intrinsic :: iso_c_binding
350 implicit none
351 character(c_char), intent(in) :: simulator_model_name(*)
352 type(c_ptr), intent(out) :: simulator_model
353 end function create
354 end interface
355 character(len=*, kind=c_char), intent(in) :: simulator_model_name
356 type(kim_simulator_model_handle_type), intent(out) :: simulator_model_handle
357 integer(c_int), intent(out) :: ierr
358
359 type(c_ptr) :: psimulator_model
360
361 ierr = create(trim(simulator_model_name)//c_null_char, psimulator_model)
362 simulator_model_handle%p = psimulator_model
363 end subroutine kim_simulator_model_create
364
365 !> \brief \copybrief KIM::SimulatorModel::Destroy
366 !!
367 !! \sa KIM::SimulatorModel::Destroy, KIM_SimulatorModel_Destroy
368 !!
369 !! \since 2.1
370 recursive subroutine kim_simulator_model_destroy(simulator_model_handle)
371 implicit none
372 interface
373 recursive subroutine destroy(simulator_model) &
374 bind(c, name="KIM_SimulatorModel_Destroy")
375 use, intrinsic :: iso_c_binding
376 implicit none
377 type(c_ptr), intent(inout) :: simulator_model
378 end subroutine destroy
379 end interface
380 type(kim_simulator_model_handle_type), intent(inout) :: &
381 simulator_model_handle
382
383 type(c_ptr) :: psimulator_model
384 psimulator_model = simulator_model_handle%p
385 call destroy(psimulator_model)
386 simulator_model_handle%p = c_null_ptr
387 end subroutine kim_simulator_model_destroy
388
389 !> \brief \copybrief KIM::SimulatorModel::GetSimulatorNameAndVersion
390 !!
391 !! \sa KIM::SimulatorModel::GetSimulatorNameAndVersion,
392 !! KIM_SimulatorModel_GetSimulatorNameAndVersion
393 !!
394 !! \since 2.1
395 recursive subroutine kim_simulator_model_get_simulator_name_and_version( &
396 simulator_model_handle, simulator_name, simulator_version)
397 use kim_interoperable_types_module, only: kim_simulator_model_type
398 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
399 implicit none
400 interface
401 recursive subroutine get_simulator_name_and_version( &
402 simulator_model, simulator_name, simulator_version) &
403 bind(c, name="KIM_SimulatorModel_GetSimulatorNameAndVersion")
404 use, intrinsic :: iso_c_binding
405 use kim_interoperable_types_module, only: kim_simulator_model_type
406 implicit none
407 type(kim_simulator_model_type), intent(in) :: simulator_model
408 type(c_ptr), intent(out) :: simulator_name
409 type(c_ptr), intent(out) :: simulator_version
410 end subroutine get_simulator_name_and_version
411 end interface
412 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
413 character(len=*, kind=c_char), intent(out) :: simulator_name
414 character(len=*, kind=c_char), intent(out) :: simulator_version
415 type(kim_simulator_model_type), pointer :: simulator_model
416
417 type(c_ptr) psimulator_name, psimulator_version
418
419 call c_f_pointer(simulator_model_handle%p, simulator_model)
420 call get_simulator_name_and_version(simulator_model, psimulator_name, &
421 psimulator_version)
422 call kim_convert_c_char_ptr_to_string(psimulator_name, simulator_name)
423 call kim_convert_c_char_ptr_to_string(psimulator_version, simulator_version)
424 end subroutine kim_simulator_model_get_simulator_name_and_version
425
426 !> \brief \copybrief KIM::SimulatorModel::GetNumberOfSupportedSpecies
427 !!
428 !! \sa KIM::SimulatorModel::GetNumberOfSupportedSpecies,
429 !! KIM_SimulatorModel_GetNumberOfSupportedSpecies
430 !!
431 !! \since 2.1
432 recursive subroutine kim_simulator_model_get_number_of_supported_species( &
433 simulator_model_handle, number_of_supported_species)
434 use kim_interoperable_types_module, only: kim_simulator_model_type
435 implicit none
436 interface
437 recursive subroutine get_number_of_supported_species( &
438 simulator_model, number_of_supported_species) &
439 bind(c, name="KIM_SimulatorModel_GetNumberOfSupportedSpecies")
440 use, intrinsic :: iso_c_binding
441 use kim_interoperable_types_module, only: kim_simulator_model_type
442 implicit none
443 type(kim_simulator_model_type), intent(in) :: simulator_model
444 integer(c_int), intent(out) :: number_of_supported_species
445 end subroutine get_number_of_supported_species
446 end interface
447 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
448 integer(c_int), intent(out) :: number_of_supported_species
449 type(kim_simulator_model_type), pointer :: simulator_model
450
451 call c_f_pointer(simulator_model_handle%p, simulator_model)
452 call get_number_of_supported_species(simulator_model, &
453 number_of_supported_species)
454 end subroutine kim_simulator_model_get_number_of_supported_species
455
456 !> \brief \copybrief KIM::SimulatorModel::GetSupportedSpecies
457 !!
458 !! \sa KIM::SimulatorModel::GetSupportedSpecies,
459 !! KIM_SimulatorModel_GetSupportedSpecies
460 !!
461 !! \since 2.1
462 recursive subroutine kim_simulator_model_get_supported_species( &
463 simulator_model_handle, index, species_name, ierr)
464 use kim_interoperable_types_module, only: kim_simulator_model_type
465 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
466 implicit none
467 interface
468 integer(c_int) recursive function get_supported_species( &
469 simulator_model, index, species_name) &
470 bind(c, name="KIM_SimulatorModel_GetSupportedSpecies")
471 use, intrinsic :: iso_c_binding
472 use kim_interoperable_types_module, only: kim_simulator_model_type
473 implicit none
474 type(kim_simulator_model_type), intent(in) :: simulator_model
475 integer(c_int), intent(in), value :: index
476 type(c_ptr), intent(out) :: species_name
477 end function get_supported_species
478 end interface
479 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
480 integer(c_int), intent(in) :: index
481 character(len=*, kind=c_char), intent(out) :: species_name
482 integer(c_int), intent(out) :: ierr
483 type(kim_simulator_model_type), pointer :: simulator_model
484
485 type(c_ptr) pspecies_name
486
487 call c_f_pointer(simulator_model_handle%p, simulator_model)
488 ierr = get_supported_species(simulator_model, index - 1, pspecies_name)
489 call kim_convert_c_char_ptr_to_string(pspecies_name, species_name)
490 end subroutine kim_simulator_model_get_supported_species
491
492 !> \brief \copybrief KIM::SimulatorModel::OpenAndInitializeTemplateMap
493 !!
494 !! \sa KIM::SimulatorModel::OpenAndInitializeTemplateMap,
495 !! KIM_SimulatorModel_OpenAndInitializeTemplateMap
496 !!
497 !! \since 2.1
498 recursive subroutine kim_simulator_model_open_and_initialize_template_map( &
499 simulator_model_handle)
500 use kim_interoperable_types_module, only: kim_simulator_model_type
501 implicit none
502 interface
503 recursive subroutine open_and_initialize_template_map(simulator_model) &
504 bind(c, name="KIM_SimulatorModel_OpenAndInitializeTemplateMap")
505 use, intrinsic :: iso_c_binding
506 use kim_interoperable_types_module, only: kim_simulator_model_type
507 implicit none
508 type(kim_simulator_model_type), intent(in) :: simulator_model
509 end subroutine open_and_initialize_template_map
510 end interface
511 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
512 type(kim_simulator_model_type), pointer :: simulator_model
513
514 call c_f_pointer(simulator_model_handle%p, simulator_model)
515 call open_and_initialize_template_map(simulator_model)
516 end subroutine kim_simulator_model_open_and_initialize_template_map
517
518 !> \brief \copybrief KIM::SimulatorModel::TemplateMapIsOpen
519 !!
520 !! \sa KIM::SimulatorModel::TemplateMapIsOpen,
521 !! KIM_SimulatorModel_TemplateMapIsOpen
522 !!
523 !! \since 2.1
524 integer(c_int) recursive function kim_simulator_model_template_map_is_open( &
525 simulator_model_handle)
526 use kim_interoperable_types_module, only: kim_simulator_model_type
527 implicit none
528 interface
529 integer(c_int) recursive function template_map_is_open(simulator_model) &
530 bind(c, name="KIM_SimulatorModel_TemplateMapIsOpen")
531 use, intrinsic :: iso_c_binding
532 use kim_interoperable_types_module, only: kim_simulator_model_type
533 implicit none
534 type(kim_simulator_model_type), intent(in) :: simulator_model
535 end function template_map_is_open
536 end interface
537 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
538 type(kim_simulator_model_type), pointer :: simulator_model
539
540 call c_f_pointer(simulator_model_handle%p, simulator_model)
541 kim_simulator_model_template_map_is_open = template_map_is_open( &
542 simulator_model)
543 end function kim_simulator_model_template_map_is_open
544
545 !> \brief \copybrief KIM::SimulatorModel::AddTemplateMap
546 !!
547 !! \sa KIM::SimulatorModel::AddTemplateMap, KIM_SimulatorModel_AddTemplateMap
548 !!
549 !! \since 2.1
550 recursive subroutine kim_simulator_model_add_template_map( &
551 simulator_model_handle, key, value, ierr)
552 use kim_interoperable_types_module, only: kim_simulator_model_type
553 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
554 implicit none
555 interface
556 integer(c_int) recursive function add_template_map( &
557 simulator_model, key, value) &
558 bind(c, name="KIM_SimulatorModel_AddTemplateMap")
559 use, intrinsic :: iso_c_binding
560 use kim_interoperable_types_module, only: kim_simulator_model_type
561 implicit none
562 type(kim_simulator_model_type), intent(in) :: simulator_model
563 character(c_char), intent(in) :: key(*)
564 character(c_char), intent(in) :: value(*)
565 end function add_template_map
566 end interface
567 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
568 character(len=*, kind=c_char), intent(in) :: key
569 character(len=*, kind=c_char), intent(in) :: value
570 integer(c_int), intent(out) :: ierr
571 type(kim_simulator_model_type), pointer :: simulator_model
572
573 call c_f_pointer(simulator_model_handle%p, simulator_model)
574 ierr = add_template_map(simulator_model, trim(key)//c_null_char, &
575 trim(value)//c_null_char)
576 end subroutine kim_simulator_model_add_template_map
577
578 !> \brief \copybrief KIM::SimulatorModel::CloseTemplateMap
579 !!
580 !! \sa KIM::SimulatorModel::CloseTemplateMap,
581 !! KIM_SimulatorModel_CloseTemplateMap
582 !!
583 !! \since 2.1
584 recursive subroutine kim_simulator_model_close_template_map( &
585 simulator_model_handle)
586 use kim_interoperable_types_module, only: kim_simulator_model_type
587 implicit none
588 interface
589 recursive subroutine close_template_map(simulator_model) &
590 bind(c, name="KIM_SimulatorModel_CloseTemplateMap")
591 use, intrinsic :: iso_c_binding
592 use kim_interoperable_types_module, only: kim_simulator_model_type
593 implicit none
594 type(kim_simulator_model_type), intent(in) :: simulator_model
595 end subroutine close_template_map
596 end interface
597 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
598 type(kim_simulator_model_type), pointer :: simulator_model
599
600 call c_f_pointer(simulator_model_handle%p, simulator_model)
601 call close_template_map(simulator_model)
602 end subroutine kim_simulator_model_close_template_map
603
604 !> \brief \copybrief KIM::SimulatorModel::GetNumberOfSimulatorFields
605 !!
606 !! \sa KIM::SimulatorModel::GetNumberOfSimulatorFields,
607 !! KIM_SimulatorModel_GetNumberOfSimulatorFields
608 !!
609 !! \since 2.1
610 recursive subroutine kim_simulator_model_get_number_of_simulator_fields( &
611 simulator_model_handle, number_of_simulator_fields)
612 use kim_interoperable_types_module, only: kim_simulator_model_type
613 implicit none
614 interface
615 recursive subroutine get_number_of_simulator_fields( &
616 simulator_model, number_of_simulator_fields) &
617 bind(c, name="KIM_SimulatorModel_GetNumberOfSimulatorFields")
618 use, intrinsic :: iso_c_binding
619 use kim_interoperable_types_module, only: kim_simulator_model_type
620 implicit none
621 type(kim_simulator_model_type), intent(in) :: simulator_model
622 integer(c_int), intent(out) :: number_of_simulator_fields
623 end subroutine get_number_of_simulator_fields
624 end interface
625 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
626 integer(c_int), intent(out) :: number_of_simulator_fields
627 type(kim_simulator_model_type), pointer :: simulator_model
628
629 call c_f_pointer(simulator_model_handle%p, simulator_model)
630 call get_number_of_simulator_fields(simulator_model, &
631 number_of_simulator_fields)
632 end subroutine kim_simulator_model_get_number_of_simulator_fields
633
634 !> \brief \copybrief KIM::SimulatorModel::GetSimulatorFieldMetadata
635 !!
636 !! \sa KIM::SimulatorModel::GetSimulatorFieldMetadata,
637 !! KIM_SimulatorModel_GetSimulatorFieldMetadata
638 !!
639 !! \since 2.1
640 recursive subroutine kim_simulator_model_get_simulator_field_metadata( &
641 simulator_model_handle, field_index, extent, field_name, ierr)
642 use kim_interoperable_types_module, only: kim_simulator_model_type
643 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
644 implicit none
645 interface
646 integer(c_int) recursive function get_simulator_field_metadata( &
647 simulator_model, field_index, extent, field_name) &
648 bind(c, name="KIM_SimulatorModel_GetSimulatorFieldMetadata")
649 use, intrinsic :: iso_c_binding
650 use kim_interoperable_types_module, only: kim_simulator_model_type
651 implicit none
652 type(kim_simulator_model_type), intent(in) :: simulator_model
653 integer(c_int), intent(in), value :: field_index
654 integer(c_int), intent(out) :: extent
655 type(c_ptr), intent(out) :: field_name
656 end function get_simulator_field_metadata
657 end interface
658 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
659 integer(c_int), intent(in) :: field_index
660 integer(c_int), intent(out) :: extent
661 character(len=*, kind=c_char), intent(out) :: field_name
662 integer(c_int), intent(out) :: ierr
663 type(kim_simulator_model_type), pointer :: simulator_model
664
665 type(c_ptr) pfield_name
666
667 call c_f_pointer(simulator_model_handle%p, simulator_model)
668 ierr = get_simulator_field_metadata(simulator_model, field_index - 1, &
669 extent, pfield_name)
670 call kim_convert_c_char_ptr_to_string(pfield_name, field_name)
671 end subroutine kim_simulator_model_get_simulator_field_metadata
672
673 !> \brief \copybrief KIM::SimulatorModel::GetSimulatorFieldLine
674 !!
675 !! \sa KIM::SimulatorModel::GetSimulatorFieldLine,
676 !! KIM_SimulatorModel_GetSimulatorFieldLine
677 !!
678 !! \since 2.1
679 recursive subroutine kim_simulator_model_get_simulator_field_line( &
680 simulator_model_handle, field_index, line_index, line_value, ierr)
681 use kim_interoperable_types_module, only: kim_simulator_model_type
682 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
683 implicit none
684 interface
685 integer(c_int) recursive function get_simulator_field_line( &
686 simulator_model, field_index, line_index, line_value) &
687 bind(c, name="KIM_SimulatorModel_GetSimulatorFieldLine")
688 use, intrinsic :: iso_c_binding
689 use kim_interoperable_types_module, only: kim_simulator_model_type
690 implicit none
691 type(kim_simulator_model_type), intent(in) :: simulator_model
692 integer(c_int), intent(in), value :: field_index
693 integer(c_int), intent(in), value :: line_index
694 type(c_ptr), intent(out) :: line_value
695 end function get_simulator_field_line
696 end interface
697 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
698 integer(c_int), intent(in), value :: field_index
699 integer(c_int), intent(in), value :: line_index
700 character(len=*, kind=c_char), intent(out) :: line_value
701 integer(c_int), intent(out) :: ierr
702 type(kim_simulator_model_type), pointer :: simulator_model
703
704 type(c_ptr) pline_value
705
706 call c_f_pointer(simulator_model_handle%p, simulator_model)
707 ierr = get_simulator_field_line(simulator_model, field_index - 1, &
708 line_index - 1, pline_value)
709 call kim_convert_c_char_ptr_to_string(pline_value, line_value)
710 end subroutine kim_simulator_model_get_simulator_field_line
711
712 !> \brief \copybrief KIM::SimulatorModel::GetParameterFileDirectoryName
713 !!
714 !! \sa KIM::SimulatorModel::GetParameterFileDirectoryName,
715 !! KIM_SimulatorModel_GetParameterFileDirectoryName
716 !!
717 !! \since 2.1
718 recursive subroutine kim_simulator_model_get_parameter_file_directory_name( &
719 simulator_model_handle, directory_name)
720 use kim_interoperable_types_module, only: kim_simulator_model_type
721 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
722 implicit none
723 interface
724 recursive subroutine get_parameter_file_directory_name(simulator_model, &
725 directory_name) &
726 bind(c, name="KIM_SimulatorModel_GetParameterFileDirectoryName")
727 use, intrinsic :: iso_c_binding
728 use kim_interoperable_types_module, only: kim_simulator_model_type
729 implicit none
730 type(kim_simulator_model_type), intent(in) :: simulator_model
731 type(c_ptr), intent(out) :: directory_name
732 end subroutine get_parameter_file_directory_name
733 end interface
734 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
735 character(len=*, kind=c_char), intent(out) :: directory_name
736 type(kim_simulator_model_type), pointer :: simulator_model
737
738 type(c_ptr) pdirectory_name
739
740 call c_f_pointer(simulator_model_handle%p, simulator_model)
741 call get_parameter_file_directory_name(simulator_model, pdirectory_name)
742 call kim_convert_c_char_ptr_to_string(pdirectory_name, directory_name)
743 end subroutine kim_simulator_model_get_parameter_file_directory_name
744
745 !> \brief \copybrief KIM::SimulatorModel::GetSpecificationFileName
746 !!
747 !! \sa KIM::SimulatorModel::GetSpecificationFileName,
748 !! KIM_SimulatorModel_GetSpecificationFileName
749 !!
750 !! \since 2.1
751 recursive subroutine kim_simulator_model_get_specification_file_name( &
752 simulator_model_handle, specification_file_name)
753 use kim_interoperable_types_module, only: kim_simulator_model_type
754 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
755 implicit none
756 interface
757 recursive subroutine get_specification_file_name( &
758 simulator_model, specification_file_name) &
759 bind(c, name="KIM_SimulatorModel_GetSpecificationFileName")
760 use, intrinsic :: iso_c_binding
761 use kim_interoperable_types_module, only: kim_simulator_model_type
762 implicit none
763 type(kim_simulator_model_type), intent(in) :: simulator_model
764 type(c_ptr), intent(out) :: specification_file_name
765 end subroutine get_specification_file_name
766 end interface
767 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
768 character(len=*, kind=c_char), intent(out) :: specification_file_name
769 type(kim_simulator_model_type), pointer :: simulator_model
770
771 type(c_ptr) pspecification_file_name
772
773 call c_f_pointer(simulator_model_handle%p, simulator_model)
774 call get_specification_file_name(simulator_model, pspecification_file_name)
775 call kim_convert_c_char_ptr_to_string(pspecification_file_name, &
776 specification_file_name)
777 end subroutine kim_simulator_model_get_specification_file_name
778
779 !> \brief \copybrief KIM::SimulatorModel::GetNumberOfParameterFiles
780 !!
781 !! \sa KIM::SimulatorModel::GetNumberOfParameterFiles,
782 !! KIM_SimulatorModel_GetNumberOfParameterFiles
783 !!
784 !! \since 2.1
785 recursive subroutine kim_simulator_model_get_number_of_parameter_files( &
786 simulator_model_handle, number_of_parameter_files)
787 use kim_interoperable_types_module, only: kim_simulator_model_type
788 implicit none
789 interface
790 recursive subroutine get_number_of_parameter_files( &
791 simulator_model, number_of_parameter_files) &
792 bind(c, name="KIM_SimulatorModel_GetNumberOfParameterFiles")
793 use, intrinsic :: iso_c_binding
794 use kim_interoperable_types_module, only: kim_simulator_model_type
795 implicit none
796 type(kim_simulator_model_type), intent(in) :: simulator_model
797 integer(c_int), intent(out) :: number_of_parameter_files
798 end subroutine get_number_of_parameter_files
799 end interface
800 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
801 integer(c_int), intent(out) :: number_of_parameter_files
802 type(kim_simulator_model_type), pointer :: simulator_model
803
804 call c_f_pointer(simulator_model_handle%p, simulator_model)
805 call get_number_of_parameter_files(simulator_model, &
806 number_of_parameter_files)
807 end subroutine kim_simulator_model_get_number_of_parameter_files
808
809 !> \brief \copybrief KIM::SimulatorModel::GetParameterFileName
810 !!
811 !! \sa KIM::SimulatorModel::GetParameterFileName,
812 !! KIM_SimulatorModel_GetParameterFileName
813 !!
814 !! \since 2.1
815 !!
816 !! \deprecated As of 2.2. Please use
817 !! kim_simulator_model_module::kim_get_parameter_file_basename() instead.
818 recursive subroutine kim_simulator_model_get_parameter_file_name( &
819 simulator_model_handle, index, parameter_file_name, ierr)
820 use kim_interoperable_types_module, only: kim_simulator_model_type
821 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
822 implicit none
823 interface
824 integer(c_int) recursive function get_parameter_file_name( &
825 simulator_model, index, parameter_file_name) &
826 bind(c, name="KIM_SimulatorModel_GetParameterFileName")
827 use, intrinsic :: iso_c_binding
828 use kim_interoperable_types_module, only: kim_simulator_model_type
829 implicit none
830 type(kim_simulator_model_type), intent(in) :: simulator_model
831 integer(c_int), intent(in), value :: index
832 type(c_ptr), intent(out) :: parameter_file_name
833 end function get_parameter_file_name
834 end interface
835 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
836 integer(c_int), intent(in) :: index
837 character(len=*, kind=c_char), intent(out) :: parameter_file_name
838 integer(c_int), intent(out) :: ierr
839 type(kim_simulator_model_type), pointer :: simulator_model
840
841 type(c_ptr) pparameter_file_name
842
843 call c_f_pointer(simulator_model_handle%p, simulator_model)
844 ierr = get_parameter_file_name(simulator_model, index - 1, &
845 pparameter_file_name)
846 call kim_convert_c_char_ptr_to_string(pparameter_file_name, &
847 parameter_file_name)
848 end subroutine kim_simulator_model_get_parameter_file_name
849
850 !> \brief \copybrief KIM::SimulatorModel::GetParameterFileBasename
851 !!
852 !! \sa KIM::SimulatorModel::GetParameterFileBasename,
853 !! KIM_SimulatorModel_GetParameterFileBasename
854 !!
855 !! \since 2.2
856 recursive subroutine kim_simulator_model_get_parameter_file_basename( &
857 simulator_model_handle, index, parameter_file_basename, ierr)
858 use kim_interoperable_types_module, only: kim_simulator_model_type
859 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
860 implicit none
861 interface
862 integer(c_int) recursive function get_parameter_file_basename( &
863 simulator_model, index, parameter_file_basename) &
864 bind(c, name="KIM_SimulatorModel_GetParameterFileBasename")
865 use, intrinsic :: iso_c_binding
866 use kim_interoperable_types_module, only: kim_simulator_model_type
867 implicit none
868 type(kim_simulator_model_type), intent(in) :: simulator_model
869 integer(c_int), intent(in), value :: index
870 type(c_ptr), intent(out) :: parameter_file_basename
871 end function get_parameter_file_basename
872 end interface
873 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
874 integer(c_int), intent(in) :: index
875 character(len=*, kind=c_char), intent(out) :: parameter_file_basename
876 integer(c_int), intent(out) :: ierr
877 type(kim_simulator_model_type), pointer :: simulator_model
878
879 type(c_ptr) pparameter_file_basename
880
881 call c_f_pointer(simulator_model_handle%p, simulator_model)
882 ierr = get_parameter_file_basename(simulator_model, index - 1, &
883 pparameter_file_basename)
884 call kim_convert_c_char_ptr_to_string(pparameter_file_basename, &
885 parameter_file_basename)
886 end subroutine kim_simulator_model_get_parameter_file_basename
887
888 !> \brief \copybrief KIM::SimulatorModel::SetSimulatorBufferPointer
889 !!
890 !! \sa KIM::SimulatorModel::SetSimulatorBufferPointer,
891 !! KIM_SimulatorModel_SetSimulatorBufferPointer
892 !!
893 !! \since 2.1
894 recursive subroutine kim_simulator_model_set_simulator_buffer_pointer( &
895 simulator_model_handle, ptr)
896 use kim_interoperable_types_module, only: kim_simulator_model_type
897 implicit none
898 interface
899 recursive subroutine set_simulator_buffer_pointer(simulator_model, ptr) &
900 bind(c, name="KIM_SimulatorModel_SetSimulatorBufferPointer")
901 use, intrinsic :: iso_c_binding
902 use kim_interoperable_types_module, only: kim_simulator_model_type
903 implicit none
904 type(kim_simulator_model_type), intent(in) :: simulator_model
905 type(c_ptr), intent(in), value :: ptr
906 end subroutine set_simulator_buffer_pointer
907 end interface
908 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
909 type(c_ptr), intent(in) :: ptr
910 type(kim_simulator_model_type), pointer :: simulator_model
911
912 call c_f_pointer(simulator_model_handle%p, simulator_model)
913 call set_simulator_buffer_pointer(simulator_model, ptr)
914 end subroutine kim_simulator_model_set_simulator_buffer_pointer
915
916 !> \brief \copybrief KIM::SimulatorModel::GetSimulatorBufferPointer
917 !!
918 !! \sa KIM::SimulatorModel::GetSimulatorBufferPointer,
919 !! KIM_SimulatorModel_GetSimulatorBufferPointer
920 !!
921 !! \since 2.1
922 recursive subroutine kim_simulator_model_get_simulator_buffer_pointer( &
923 simulator_model_handle, ptr)
924 use kim_interoperable_types_module, only: kim_simulator_model_type
925 implicit none
926 interface
927 recursive subroutine get_simulator_buffer_pointer(simulator_model, ptr) &
928 bind(c, name="KIM_SimulatorModel_GetSimulatorBufferPointer")
929 use, intrinsic :: iso_c_binding
930 use kim_interoperable_types_module, only: kim_simulator_model_type
931 implicit none
932 type(kim_simulator_model_type), intent(in) :: simulator_model
933 type(c_ptr), intent(out) :: ptr
934 end subroutine get_simulator_buffer_pointer
935 end interface
936 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
937 type(c_ptr), intent(out) :: ptr
938 type(kim_simulator_model_type), pointer :: simulator_model
939
940 call c_f_pointer(simulator_model_handle%p, simulator_model)
941 call get_simulator_buffer_pointer(simulator_model, ptr)
942 end subroutine kim_simulator_model_get_simulator_buffer_pointer
943
944 !> \brief \copybrief KIM::SimulatorModel::ToString
945 !!
946 !! \sa KIM::SimulatorModel::ToString, KIM_SimulatorModel_ToString
947 !!
948 !! \since 2.1
949 recursive subroutine kim_simulator_model_to_string(simulator_model_handle, &
950 string)
951 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
952 use kim_interoperable_types_module, only: kim_simulator_model_type
953 implicit none
954 interface
955 type(c_ptr) recursive function model_string(simulator_model) &
956 bind(c, name="KIM_SimulatorModel_ToString")
957 use, intrinsic :: iso_c_binding
958 use kim_interoperable_types_module, only: kim_simulator_model_type
959 implicit none
960 type(kim_simulator_model_type), intent(in) :: simulator_model
961 end function model_string
962 end interface
963 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
964 character(len=*, kind=c_char), intent(out) :: string
965 type(kim_simulator_model_type), pointer :: simulator_model
966
967 type(c_ptr) :: p
968
969 call c_f_pointer(simulator_model_handle%p, simulator_model)
970 p = model_string(simulator_model)
971 call kim_convert_c_char_ptr_to_string(p, string)
972 end subroutine kim_simulator_model_to_string
973
974 !> \brief \copybrief KIM::SimulatorModel::SetLogID
975 !!
976 !! \sa KIM::SimulatorModel::SetLogID, KIM_SimulatorModel_SetLogID
977 !!
978 !! \since 2.1
979 recursive subroutine kim_simulator_model_set_log_id(simulator_model_handle, &
980 log_id)
981 use kim_interoperable_types_module, only: kim_simulator_model_type
982 implicit none
983 interface
984 recursive subroutine set_log_id(simulator_model, log_id) &
985 bind(c, name="KIM_SimulatorModel_SetLogID")
986 use, intrinsic :: iso_c_binding
987 use kim_interoperable_types_module, only: kim_simulator_model_type
988 implicit none
989 type(kim_simulator_model_type), intent(in) :: simulator_model
990 character(c_char), intent(in) :: log_id(*)
991 end subroutine set_log_id
992 end interface
993 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
994 character(len=*, kind=c_char), intent(in) :: log_id
995 type(kim_simulator_model_type), pointer :: simulator_model
996
997 call c_f_pointer(simulator_model_handle%p, simulator_model)
998 call set_log_id(simulator_model, trim(log_id)//c_null_char)
999 end subroutine kim_simulator_model_set_log_id
1000
1001 !> \brief \copybrief KIM::SimulatorModel::PushLogVerbosity
1002 !!
1003 !! \sa KIM::SimulatorModel::PushLogVerbosity,
1004 !! KIM_SimulatorModel_PushLogVerbosity
1005 !!
1006 !! \since 2.1
1007 recursive subroutine kim_simulator_model_push_log_verbosity( &
1008 simulator_model_handle, log_verbosity)
1010 use kim_interoperable_types_module, only: kim_simulator_model_type
1011 implicit none
1012 interface
1013 recursive subroutine push_log_verbosity(simulator_model, log_verbosity) &
1014 bind(c, name="KIM_SimulatorModel_PushLogVerbosity")
1015 use, intrinsic :: iso_c_binding
1017 use kim_interoperable_types_module, only: kim_simulator_model_type
1018 implicit none
1019 type(kim_simulator_model_type), intent(in) :: simulator_model
1020 type(kim_log_verbosity_type), intent(in), value :: log_verbosity
1021 end subroutine push_log_verbosity
1022 end interface
1023 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
1024 type(kim_log_verbosity_type), intent(in) :: log_verbosity
1025 type(kim_simulator_model_type), pointer :: simulator_model
1026
1027 call c_f_pointer(simulator_model_handle%p, simulator_model)
1028 call push_log_verbosity(simulator_model, log_verbosity)
1029 end subroutine kim_simulator_model_push_log_verbosity
1030
1031 !> \brief \copybrief KIM::SimulatorModel::PopLogVerbosity
1032 !!
1033 !! \sa KIM::SimulatorModel::, KIM_SimulatorModel_PopLogVerbosity
1034 !!
1035 !! \since 2.1
1036 recursive subroutine kim_simulator_model_pop_log_verbosity( &
1037 simulator_model_handle)
1039 use kim_interoperable_types_module, only: kim_simulator_model_type
1040 implicit none
1041 interface
1042 recursive subroutine pop_log_verbosity(simulator_model) &
1043 bind(c, name="KIM_SimulatorModel_PopLogVerbosity")
1044 use, intrinsic :: iso_c_binding
1046 use kim_interoperable_types_module, only: kim_simulator_model_type
1047 implicit none
1048 type(kim_simulator_model_type), intent(in) :: simulator_model
1049 end subroutine pop_log_verbosity
1050 end interface
1051 type(kim_simulator_model_handle_type), intent(in) :: simulator_model_handle
1052 type(kim_simulator_model_type), pointer :: simulator_model
1053
1054 call c_f_pointer(simulator_model_handle%p, simulator_model)
1055 call pop_log_verbosity(simulator_model)
1056 end subroutine kim_simulator_model_pop_log_verbosity
Add a new key-value entry to the template map.
Close the template map and perform template substitutions.
Get the number of parameter files provided by the SimulatorModel.
Get the number of simulator fields provided by the SimulatorModel.
Get the number of species supported by the SimulatorModel.
Get the basename (file name without path) of a particular parameter file. The file is located in the ...
Get absolute path name of the temporary directory where parameter files provided by the simulator mod...
Get the basename (file name without path) of a particular parameter file. The file is located in the ...
Get the Simulator's buffer pointer from the SimulatorModel object.
Get a line for the simulator field of interest with all template substitutions performed (Requires th...
Get the metadata for the simulator field of interest.
Get the SimulatorModel's specification file basename (file name without path). The file is located in...
Get a species name supported by the SimulatorModel.
Open and initialize the template map for simulator field line substitutions.
Pop a LogVerbosity from the SimulatorModel object's Log object verbosity stack.
Push a new LogVerbosity onto the SimulatorModel object's Log object verbosity stack.
Set the identity of the Log object associated with the SimulatorModel object.
Set the Simulator's buffer pointer within the SimulatorModel object.
Get a string representing the internal state of the SimulatorModel object.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.
Provides the primary interface to a KIM API SimulatorModel object and is meant to be used by simulato...
recursive subroutine, public kim_simulator_model_create(simulator_model_name, simulator_model_handle, ierr)
Create a new KIM API SimulatorModel object.
type(kim_simulator_model_handle_type), save, public, protected kim_simulator_model_null_handle
NULL handle for use in comparisons.
recursive subroutine, public kim_simulator_model_destroy(simulator_model_handle)
Destroy a previously SimulatorModel::Create'd object.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.
Provides the primary interface to a KIM API SimulatorModel object and is meant to be used by simulato...