kim-api  2.1.4-git+v2.1.3-git-1-g7847914a.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
kim_model_driver_create_module.f90
Go to the documentation of this file.
1 !
2 ! CDDL HEADER START
3 !
4 ! The contents of this file are subject to the terms of the Common Development
5 ! and Distribution License Version 1.0 (the "License").
6 !
7 ! You can obtain a copy of the license at
8 ! http://www.opensource.org/licenses/CDDL-1.0. See the License for the
9 ! specific language governing permissions and limitations under the License.
10 !
11 ! When distributing Covered Code, include this CDDL HEADER in each file and
12 ! include the License file in a prominent location with the name LICENSE.CDDL.
13 ! If applicable, add the following below this CDDL HEADER, with the fields
14 ! enclosed by brackets "[]" replaced with your own identifying information:
15 !
16 ! Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
17 !
18 ! CDDL HEADER END
19 !
20 
21 !
22 ! Copyright (c) 2016--2019, Regents of the University of Minnesota.
23 ! All rights reserved.
24 !
25 ! Contributors:
26 ! Ryan S. Elliott
27 !
28 
29 !
30 ! Release: This file is part of the kim-api.git repository.
31 !
32 
33 
40  use, intrinsic :: iso_c_binding
41  implicit none
42  private
43 
44  public &
45  ! Derived types
46  kim_model_driver_create_handle_type, &
47 
48  ! Constants
50 
51  ! Routines
52  operator (.eq.), &
53  operator (.ne.), &
54  kim_get_number_of_parameter_files, &
55  kim_get_parameter_file_name, &
56  kim_set_model_numbering, &
57  kim_set_influence_distance_pointer, &
58  kim_set_neighbor_list_pointers, &
59  kim_set_routine_pointer, &
60  kim_set_species_code, &
61  kim_set_parameter_pointer, &
62  kim_set_model_buffer_pointer, &
63  kim_set_units, &
64  kim_convert_unit, &
65  kim_log_entry, &
66  kim_to_string
67 
68 
74  type, bind(c) :: kim_model_driver_create_handle_type
75  type(c_ptr) :: p = c_null_ptr
76  end type kim_model_driver_create_handle_type
77 
81  type(kim_model_driver_create_handle_type), protected, save &
83 
87  interface operator (.eq.)
88  module procedure kim_model_driver_create_handle_equal
89  end interface operator (.eq.)
90 
94  interface operator (.ne.)
95  module procedure kim_model_driver_create_handle_not_equal
96  end interface operator (.ne.)
97 
104  interface kim_get_number_of_parameter_files
105  module procedure kim_model_driver_create_get_number_of_parameter_files
106  end interface kim_get_number_of_parameter_files
107 
114  interface kim_get_parameter_file_name
116  end interface kim_get_parameter_file_name
117 
124  interface kim_set_model_numbering
126  end interface kim_set_model_numbering
127 
134  interface kim_set_influence_distance_pointer
136  end interface kim_set_influence_distance_pointer
137 
144  interface kim_set_neighbor_list_pointers
146  end interface kim_set_neighbor_list_pointers
147 
154  interface kim_set_routine_pointer
156  end interface kim_set_routine_pointer
157 
164  interface kim_set_species_code
166  end interface kim_set_species_code
167 
175  interface kim_set_parameter_pointer
178  end interface kim_set_parameter_pointer
179 
186  interface kim_set_model_buffer_pointer
188  end interface kim_set_model_buffer_pointer
189 
195  interface kim_set_units
196  module procedure kim_model_driver_create_set_units
197  end interface kim_set_units
198 
204  interface kim_convert_unit
205  module procedure kim_model_driver_create_convert_unit
206  end interface kim_convert_unit
207 
213  interface kim_log_entry
214  module procedure kim_model_driver_create_log_entry
215  end interface kim_log_entry
216 
222  interface kim_to_string
223  module procedure kim_model_driver_create_to_string
224  end interface kim_to_string
225 
226 contains
230  logical recursive function kim_model_driver_create_handle_equal(lhs, rhs)
231  implicit none
232  type(kim_model_driver_create_handle_type), intent(in) :: lhs
233  type(kim_model_driver_create_handle_type), intent(in) :: rhs
234 
235  if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
236  kim_model_driver_create_handle_equal = .true.
237  else
238  kim_model_driver_create_handle_equal = c_associated(lhs%p, rhs%p)
239  end if
240  end function kim_model_driver_create_handle_equal
241 
245  logical recursive function kim_model_driver_create_handle_not_equal(lhs, rhs)
246  implicit none
247  type(kim_model_driver_create_handle_type), intent(in) :: lhs
248  type(kim_model_driver_create_handle_type), intent(in) :: rhs
249 
250  kim_model_driver_create_handle_not_equal = .not. (lhs .eq. rhs)
251  end function kim_model_driver_create_handle_not_equal
252 
259  recursive subroutine kim_model_driver_create_get_number_of_parameter_files( &
260  model_driver_create_handle, number_of_parameter_files)
261  use kim_interoperable_types_module, only : kim_model_driver_create_type
262  implicit none
263  interface
264  recursive subroutine get_number_of_parameter_files(model_driver_create, &
265  number_of_parameter_files) bind(c, &
266  name="KIM_ModelDriverCreate_GetNumberOfParameterFiles")
267  use, intrinsic :: iso_c_binding
268  use kim_interoperable_types_module, only : kim_model_driver_create_type
269  implicit none
270  type(kim_model_driver_create_type), intent(in) &
272  integer(c_int), intent(out) :: number_of_parameter_files
273  end subroutine get_number_of_parameter_files
274  end interface
275  type(kim_model_driver_create_handle_type), intent(in) &
276  :: model_driver_create_handle
277  integer(c_int), intent(out) :: number_of_parameter_files
278  type(kim_model_driver_create_type), pointer :: model_driver_create
279 
280  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
281  call get_number_of_parameter_files(model_driver_create, &
282  number_of_parameter_files)
283  end subroutine kim_model_driver_create_get_number_of_parameter_files
284 
292  model_driver_create_handle, index, parameter_file_name, ierr)
293  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
294  use kim_interoperable_types_module, only : kim_model_driver_create_type
295  implicit none
296  interface
297  integer(c_int) recursive function get_parameter_file_name( &
298  model_driver_create, index, parameter_file_name) &
299  bind(c, name="KIM_ModelDriverCreate_GetParameterFileName")
300  use, intrinsic :: iso_c_binding
301  use kim_interoperable_types_module, only : kim_model_driver_create_type
302  implicit none
303  type(kim_model_driver_create_type), intent(in) &
304  :: model_driver_create
305  integer(c_int), intent(in), value :: index
306  type(c_ptr), intent(out) :: parameter_file_name
307  end function get_parameter_file_name
308  end interface
309  type(kim_model_driver_create_handle_type), intent(in) &
310  :: model_driver_create_handle
311  integer(c_int), intent(in) :: index
312  character(len=*, kind=c_char), intent(out) :: parameter_file_name
313  integer(c_int), intent(out) :: ierr
314  type(kim_model_driver_create_type), pointer :: model_driver_create
315 
316  type(c_ptr) :: p
317 
318  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
319  ierr = get_parameter_file_name(model_driver_create, &
320  index-1, p)
321  call kim_convert_c_char_ptr_to_string(p, parameter_file_name)
323 
330  recursive subroutine kim_model_driver_create_set_model_numbering( &
331  model_driver_create_handle, numbering, ierr)
332  use kim_numbering_module, only : kim_numbering_type
333  use kim_interoperable_types_module, only : kim_model_driver_create_type
334  implicit none
335  interface
336  integer(c_int) recursive function set_model_numbering( &
337  model_driver_create, numbering) &
338  bind(c, name="KIM_ModelDriverCreate_SetModelNumbering")
339  use, intrinsic :: iso_c_binding
340  use kim_numbering_module, only : kim_numbering_type
341  use kim_interoperable_types_module, only : kim_model_driver_create_type
342  implicit none
343  type(kim_model_driver_create_type), intent(in) &
344  :: model_driver_create
345  type(kim_numbering_type), intent(in), value :: numbering
346  end function set_model_numbering
347  end interface
348  type(kim_model_driver_create_handle_type), intent(in) &
349  :: model_driver_create_handle
350  type(kim_numbering_type), intent(in) :: numbering
351  integer(c_int), intent(out) :: ierr
352  type(kim_model_driver_create_type), pointer :: model_driver_create
353 
354  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
355  ierr = set_model_numbering(model_driver_create, numbering)
357 
365  model_driver_create_handle, influence_distance)
366  use kim_interoperable_types_module, only : kim_model_driver_create_type
367  implicit none
368  interface
369  recursive subroutine set_influence_distance_pointer(model_driver_create, &
370  influence_distance) &
371  bind(c, name="KIM_ModelDriverCreate_SetInfluenceDistancePointer")
372  use, intrinsic :: iso_c_binding
373  use kim_interoperable_types_module, only : kim_model_driver_create_type
374  implicit none
375  type(kim_model_driver_create_type), intent(in) &
376  :: model_driver_create
377  type(c_ptr), intent(in), value :: influence_distance
378  end subroutine set_influence_distance_pointer
379  end interface
380  type(kim_model_driver_create_handle_type), intent(in) &
381  :: model_driver_create_handle
382  real(c_double), intent(in), target :: influence_distance
383  type(kim_model_driver_create_type), pointer :: model_driver_create
384 
385  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
386  call set_influence_distance_pointer(model_driver_create, &
387  c_loc(influence_distance))
389 
397  model_driver_create_handle, number_of_neighbor_lists, cutoffs, &
398  model_will_not_request_neighbors_of_noncontributing_particles)
399  use kim_interoperable_types_module, only : kim_model_driver_create_type
400  implicit none
401  interface
402  recursive subroutine set_neighbor_list_pointers(model_driver_create, &
403  number_of_neighbor_lists, cutoffs_ptr, &
404  model_will_not_request_neighbors_of_noncontributing_particles) &
405  bind(c, name="KIM_ModelDriverCreate_SetNeighborListPointers")
406  use, intrinsic :: iso_c_binding
407  use kim_interoperable_types_module, only : kim_model_driver_create_type
408  implicit none
409  type(kim_model_driver_create_type), intent(in) &
410  :: model_driver_create
411  integer(c_int), intent(in), value :: number_of_neighbor_lists
412  type(c_ptr), intent(in), value :: cutoffs_ptr
413  type(c_ptr), intent(in), value :: &
414  model_will_not_request_neighbors_of_noncontributing_particles
415  end subroutine set_neighbor_list_pointers
416  end interface
417  type(kim_model_driver_create_handle_type), intent(in) &
418  :: model_driver_create_handle
419  integer(c_int), intent(in) :: number_of_neighbor_lists
420  real(c_double), intent(in), target :: cutoffs(number_of_neighbor_lists)
421  integer(c_int), intent(in), target :: &
422  model_will_not_request_neighbors_of_noncontributing_particles( &
423  number_of_neighbor_lists)
424 
425  type(kim_model_driver_create_type), pointer :: model_driver_create
426 
427  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
428  call set_neighbor_list_pointers(model_driver_create, &
429  number_of_neighbor_lists, c_loc(cutoffs), &
430  c_loc(model_will_not_request_neighbors_of_noncontributing_particles))
432 
439  recursive subroutine kim_model_driver_create_set_routine_pointer( &
440  model_driver_create_handle, model_routine_name, language_name, required, &
441  fptr, ierr)
442  use kim_model_routine_name_module, only : kim_model_routine_name_type
443  use kim_language_name_module, only : kim_language_name_type
444  use kim_interoperable_types_module, only : kim_model_driver_create_type
445  implicit none
446  interface
447  integer(c_int) recursive function set_routine_pointer( &
448  model_driver_create, model_routine_name, language_name, required, &
449  fptr) bind(c, name="KIM_ModelDriverCreate_SetRoutinePointer")
450  use, intrinsic :: iso_c_binding
451  use kim_model_routine_name_module, only : kim_model_routine_name_type
452  use kim_language_name_module, only : kim_language_name_type
453  use kim_interoperable_types_module, only : kim_model_driver_create_type
454  implicit none
455  type(kim_model_driver_create_type), intent(in) &
456  :: model_driver_create
457  type(kim_model_routine_name_type), intent(in), value &
458  :: model_routine_name
459  type(kim_language_name_type), intent(in), value :: language_name
460  integer(c_int), intent(in), value :: required
461  type(c_funptr), intent(in), value :: fptr
462  end function set_routine_pointer
463  end interface
464  type(kim_model_driver_create_handle_type), intent(in) &
465  :: model_driver_create_handle
466  type(kim_model_routine_name_type), intent(in) :: model_routine_name
467  type(kim_language_name_type), intent(in) :: language_name
468  integer(c_int), intent(in) :: required
469  type(c_funptr), intent(in), value :: fptr ! must be left as "value"!?!
470  integer(c_int), intent(out) :: ierr
471  type(kim_model_driver_create_type), pointer :: model_driver_create
472 
473  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
474  ierr = set_routine_pointer(model_driver_create, model_routine_name, &
475  language_name, required, fptr)
477 
484  recursive subroutine kim_model_driver_create_set_species_code( &
485  model_driver_create_handle, species_name, code, ierr)
486  use kim_species_name_module, only : kim_species_name_type
487  use kim_interoperable_types_module, only : kim_model_driver_create_type
488  implicit none
489  interface
490  integer(c_int) recursive function set_species_code(model_driver_create, &
491  species_name, code) &
492  bind(c, name="KIM_ModelDriverCreate_SetSpeciesCode")
493  use, intrinsic :: iso_c_binding
494  use kim_species_name_module, only : kim_species_name_type
495  use kim_interoperable_types_module, only : kim_model_driver_create_type
496  implicit none
497  type(kim_model_driver_create_type), intent(in) &
498  :: model_driver_create
499  type(kim_species_name_type), intent(in), value :: species_name
500  integer(c_int), intent(in), value :: code
501  end function set_species_code
502  end interface
503  type(kim_model_driver_create_handle_type), intent(in) &
504  :: model_driver_create_handle
505  type(kim_species_name_type), intent(in) :: species_name
506  integer(c_int), intent(in) :: code
507  integer(c_int), intent(out) :: ierr
508  type(kim_model_driver_create_type), pointer :: model_driver_create
509 
510  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
511  ierr = set_species_code(model_driver_create, species_name, code)
513 
521  model_driver_create_handle, int1, name, description, ierr)
522  use kim_interoperable_types_module, only : kim_model_driver_create_type
523  implicit none
524  type(kim_model_driver_create_handle_type), intent(in) &
525  :: model_driver_create_handle
526  integer(c_int), intent(in), target :: int1(:)
527  character(len=*, kind=c_char), intent(in) :: name
528  character(len=*, kind=c_char), intent(in) :: description
529  integer(c_int), intent(out) :: ierr
530  type(kim_model_driver_create_type), pointer :: model_driver_create
531 
532  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
533  call set_parameter(model_driver_create, size(int1, 1, c_int), int1, &
534  name, description, ierr)
535  return
536 
537  contains
538  recursive subroutine set_parameter(model_driver_create, extent, int1, &
539  name, description, ierr)
540  use kim_interoperable_types_module, only : kim_model_driver_create_type
541  implicit none
542  interface
543  integer(c_int) recursive function set_parameter_pointer_integer( &
544  model_driver_create, extent, ptr, name, description) &
545  bind(c, name="KIM_ModelDriverCreate_SetParameterPointerInteger")
546  use, intrinsic :: iso_c_binding
547  use kim_interoperable_types_module, only : &
548  kim_model_driver_create_type
549  implicit none
550  type(kim_model_driver_create_type), intent(in) &
551  :: model_driver_create
552  integer(c_int), intent(in), value :: extent
553  type(c_ptr), intent(in), value :: ptr
554  character(c_char), intent(in) :: name(*)
555  character(c_char), intent(in) :: description(*)
556  end function set_parameter_pointer_integer
557  end interface
558  type(kim_model_driver_create_type), intent(in) &
559  :: model_driver_create
560  integer(c_int), intent(in) :: extent
561  integer(c_int), intent(in), target :: int1(extent)
562  character(len=*, kind=c_char), intent(in) :: name
563  character(len=*, kind=c_char), intent(in) :: description
564  integer(c_int), intent(out) :: ierr
565 
566  ierr = set_parameter_pointer_integer(model_driver_create, extent, &
567  c_loc(int1), trim(name)//c_null_char, &
568  trim(description)//c_null_char)
569  end subroutine set_parameter
571 
579  model_driver_create_handle, double1, name, description, ierr)
580  use kim_interoperable_types_module, only : kim_model_driver_create_type
581  implicit none
582  type(kim_model_driver_create_handle_type), intent(in) &
583  :: model_driver_create_handle
584  real(c_double), intent(in), target :: double1(:)
585  character(len=*, kind=c_char), intent(in) :: name
586  character(len=*, kind=c_char), intent(in) :: description
587  integer(c_int), intent(out) :: ierr
588  type(kim_model_driver_create_type), pointer :: model_driver_create
589 
590  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
591  call set_parameter(model_driver_create, size(double1, 1, c_int), &
592  double1, name, description, ierr)
593  return
594 
595  contains
596  recursive subroutine set_parameter(model_driver_create, extent, double1, &
597  name, description, ierr)
598  use kim_interoperable_types_module, only : kim_model_driver_create_type
599  implicit none
600  interface
601  integer(c_int) recursive function set_parameter_pointer_double( &
602  model_driver_create, extent, ptr, name, description) &
603  bind(c, name="KIM_ModelDriverCreate_SetParameterPointerDouble")
604  use, intrinsic :: iso_c_binding
605  use kim_interoperable_types_module, only : &
606  kim_model_driver_create_type
607  implicit none
608  type(kim_model_driver_create_type), intent(in) &
609  :: model_driver_create
610  integer(c_int), intent(in), value :: extent
611  type(c_ptr), intent(in), value :: ptr
612  character(c_char), intent(in) :: name(*)
613  character(c_char), intent(in) :: description(*)
614  end function set_parameter_pointer_double
615  end interface
616  type(kim_model_driver_create_type), intent(in) &
617  :: model_driver_create
618  integer(c_int), intent(in) :: extent
619  real(c_double), intent(in), target :: double1(extent)
620  character(len=*, kind=c_char), intent(in) :: name
621  character(len=*, kind=c_char), intent(in) :: description
622  integer(c_int), intent(out) :: ierr
623 
624  ierr = set_parameter_pointer_double(model_driver_create, extent, &
625  c_loc(double1), trim(name)//c_null_char, &
626  trim(description)//c_null_char)
627  end subroutine set_parameter
629 
637  model_driver_create_handle, ptr)
638  use kim_interoperable_types_module, only : kim_model_driver_create_type
639  implicit none
640  interface
641  recursive subroutine set_model_buffer_pointer(model_driver_create, ptr) &
642  bind(c, name="KIM_ModelDriverCreate_SetModelBufferPointer")
643  use, intrinsic :: iso_c_binding
644  use kim_interoperable_types_module, only : kim_model_driver_create_type
645  implicit none
646  type(kim_model_driver_create_type), intent(in) &
647  :: model_driver_create
648  type(c_ptr), intent(in), value :: ptr
649  end subroutine set_model_buffer_pointer
650  end interface
651  type(kim_model_driver_create_handle_type), intent(in) &
652  :: model_driver_create_handle
653  type(c_ptr), intent(in) :: ptr
654  type(kim_model_driver_create_type), pointer :: model_driver_create
655 
656  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
657  call set_model_buffer_pointer(model_driver_create, ptr)
659 
665  recursive subroutine kim_model_driver_create_set_units( &
666  model_driver_create_handle, length_unit, energy_unit, charge_unit, &
667  temperature_unit, time_unit, ierr)
669  kim_length_unit_type, &
670  kim_energy_unit_type, &
671  kim_charge_unit_type, &
672  kim_temperature_unit_type, &
673  kim_time_unit_type
674  use kim_interoperable_types_module, only : kim_model_driver_create_type
675  implicit none
676  interface
677  integer(c_int) recursive function set_units(model_driver_create, &
678  length_unit, energy_unit, charge_unit, temperature_unit, time_unit) &
679  bind(c, name="KIM_ModelDriverCreate_SetUnits")
680  use, intrinsic :: iso_c_binding
681  use kim_unit_system_module, only : &
682  kim_length_unit_type, &
683  kim_energy_unit_type, &
684  kim_charge_unit_type, &
685  kim_temperature_unit_type, &
686  kim_time_unit_type
687  use kim_interoperable_types_module, only : kim_model_driver_create_type
688  implicit none
689  type(kim_model_driver_create_type), intent(in) &
690  :: model_driver_create
691  type(kim_length_unit_type), intent(in), value :: length_unit
692  type(kim_energy_unit_type), intent(in), value :: energy_unit
693  type(kim_charge_unit_type), intent(in), value :: charge_unit
694  type(kim_temperature_unit_type), intent(in), value :: temperature_unit
695  type(kim_time_unit_type), intent(in), value :: time_unit
696  end function set_units
697  end interface
698  type(kim_model_driver_create_handle_type), intent(in) &
699  :: model_driver_create_handle
700  type(kim_length_unit_type), intent(in) :: length_unit
701  type(kim_energy_unit_type), intent(in) :: energy_unit
702  type(kim_charge_unit_type), intent(in) :: charge_unit
703  type(kim_temperature_unit_type), intent(in) :: temperature_unit
704  type(kim_time_unit_type), intent(in) :: time_unit
705  integer(c_int), intent(out) :: ierr
706  type(kim_model_driver_create_type), pointer :: model_driver_create
707 
708  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
709  ierr = set_units(model_driver_create, length_unit, energy_unit, &
710  charge_unit, temperature_unit, time_unit)
711  end subroutine kim_model_driver_create_set_units
712 
718  recursive subroutine kim_model_driver_create_convert_unit( &
719  from_length_unit, from_energy_unit, &
720  from_charge_unit, from_temperature_unit, from_time_unit, &
721  to_length_unit, to_energy_unit, to_charge_unit, to_temperature_unit, &
722  to_time_unit, length_exponent, energy_exponent, charge_exponent, &
723  temperature_exponent, time_exponent, conversion_factor, ierr)
724  use kim_unit_system_module, only : kim_length_unit_type
725  use kim_unit_system_module, only : kim_energy_unit_type
726  use kim_unit_system_module, only : kim_charge_unit_type
727  use kim_unit_system_module, only : kim_temperature_unit_type
728  use kim_unit_system_module, only : kim_time_unit_type
729  implicit none
730  interface
731  integer(c_int) recursive function convert_unit( &
732  from_length_unit, from_energy_unit, &
733  from_charge_unit, from_temperature_unit, from_time_unit, &
734  to_length_unit, to_energy_unit, to_charge_unit, to_temperature_unit, &
735  to_time_unit, length_exponent, energy_exponent, charge_exponent, &
736  temperature_exponent, time_exponent, conversion_factor) &
737  bind(c, name="KIM_ModelDriverCreate_ConvertUnit")
738  use, intrinsic :: iso_c_binding
739  use kim_unit_system_module, only : kim_length_unit_type
740  use kim_unit_system_module, only : kim_energy_unit_type
741  use kim_unit_system_module, only : kim_charge_unit_type
742  use kim_unit_system_module, only : kim_temperature_unit_type
743  use kim_unit_system_module, only : kim_time_unit_type
744  implicit none
745  type(kim_length_unit_type), intent(in), value :: from_length_unit
746  type(kim_energy_unit_type), intent(in), value :: from_energy_unit
747  type(kim_charge_unit_type), intent(in), value :: from_charge_unit
748  type(kim_temperature_unit_type), intent(in), value :: &
749  from_temperature_unit
750  type(kim_time_unit_type), intent(in), value :: from_time_unit
751  type(kim_length_unit_type), intent(in), value :: to_length_unit
752  type(kim_energy_unit_type), intent(in), value :: to_energy_unit
753  type(kim_charge_unit_type), intent(in), value :: to_charge_unit
754  type(kim_temperature_unit_type), intent(in), value :: &
755  to_temperature_unit
756  type(kim_time_unit_type), intent(in), value :: to_time_unit
757  real(c_double), intent(in), value :: length_exponent
758  real(c_double), intent(in), value :: energy_exponent
759  real(c_double), intent(in), value :: charge_exponent
760  real(c_double), intent(in), value :: temperature_exponent
761  real(c_double), intent(in), value :: time_exponent
762  real(c_double), intent(out) :: conversion_factor
763  end function convert_unit
764  end interface
765  type(kim_length_unit_type), intent(in) :: from_length_unit
766  type(kim_energy_unit_type), intent(in) :: from_energy_unit
767  type(kim_charge_unit_type), intent(in) :: from_charge_unit
768  type(kim_temperature_unit_type), intent(in) :: from_temperature_unit
769  type(kim_time_unit_type), intent(in) :: from_time_unit
770  type(kim_length_unit_type), intent(in) :: to_length_unit
771  type(kim_energy_unit_type), intent(in) :: to_energy_unit
772  type(kim_charge_unit_type), intent(in) :: to_charge_unit
773  type(kim_temperature_unit_type), intent(in) :: to_temperature_unit
774  type(kim_time_unit_type), intent(in) :: to_time_unit
775  real(c_double), intent(in) :: length_exponent
776  real(c_double), intent(in) :: energy_exponent
777  real(c_double), intent(in) :: charge_exponent
778  real(c_double), intent(in) :: temperature_exponent
779  real(c_double), intent(in) :: time_exponent
780  real(c_double), intent(out) :: conversion_factor
781  integer(c_int), intent(out) :: ierr
782 
783  ierr = convert_unit(from_length_unit, &
784  from_energy_unit, from_charge_unit, from_temperature_unit, &
785  from_time_unit, to_length_unit, to_energy_unit, to_charge_unit, &
786  to_temperature_unit, to_time_unit, length_exponent, energy_exponent, &
787  charge_exponent, temperature_exponent, time_exponent, conversion_factor)
789 
795  recursive subroutine kim_model_driver_create_log_entry( &
796  model_driver_create_handle, log_verbosity, message)
797  use kim_log_verbosity_module, only : kim_log_verbosity_type
798  use kim_interoperable_types_module, only : kim_model_driver_create_type
799  implicit none
800  interface
801  recursive subroutine log_entry(model_driver_create, log_verbosity, &
802  message, line_number, file_name) &
803  bind(c, name="KIM_ModelDriverCreate_LogEntry")
804  use, intrinsic :: iso_c_binding
805  use kim_log_verbosity_module, only : kim_log_verbosity_type
806  use kim_interoperable_types_module, only : kim_model_driver_create_type
807  implicit none
808  type(kim_model_driver_create_type), intent(in) &
809  :: model_driver_create
810  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
811  character(c_char), intent(in) :: message(*)
812  integer(c_int), intent(in), value :: line_number
813  character(c_char), intent(in) :: file_name(*)
814  end subroutine log_entry
815  end interface
816  type(kim_model_driver_create_handle_type), intent(in) &
817  :: model_driver_create_handle
818  type(kim_log_verbosity_type), intent(in) :: log_verbosity
819  character(len=*, kind=c_char), intent(in) :: message
820  type(kim_model_driver_create_type), pointer :: model_driver_create
821 
822  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
823  call log_entry(model_driver_create, log_verbosity, &
824  trim(message)//c_null_char, 0, ""//c_null_char)
825  end subroutine kim_model_driver_create_log_entry
826 
832  recursive subroutine kim_model_driver_create_to_string( &
833  model_driver_create_handle, string)
834  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
835  use kim_interoperable_types_module, only : kim_model_driver_create_type
836  implicit none
837  interface
838  type(c_ptr) recursive function model_driver_create_string( &
839  model_driver_create) &
840  bind(c, name="KIM_ModelDriverCreate_ToString")
841  use, intrinsic :: iso_c_binding
842  use kim_interoperable_types_module, only : kim_model_driver_create_type
843  implicit none
844  type(kim_model_driver_create_type), intent(in) &
845  :: model_driver_create
846  end function model_driver_create_string
847  end interface
848  type(kim_model_driver_create_handle_type), intent(in) &
849  :: model_driver_create_handle
850  character(len=*, kind=c_char), intent(out) :: string
851  type(kim_model_driver_create_type), pointer :: model_driver_create
852 
853  type(c_ptr) :: p
854 
855  call c_f_pointer(model_driver_create_handle%p, model_driver_create)
856  p = model_driver_create_string(model_driver_create)
857  call kim_convert_c_char_ptr_to_string(p, string)
858  end subroutine kim_model_driver_create_to_string
recursive subroutine kim_model_driver_create_convert_unit(from_length_unit, from_energy_unit, from_charge_unit, from_temperature_unit, from_time_unit, to_length_unit, to_energy_unit, to_charge_unit, to_temperature_unit, to_time_unit, length_exponent, energy_exponent, charge_exponent, temperature_exponent, time_exponent, conversion_factor, ierr)
Get the multiplicative factor to convert between a derived unit represented in two different sets of ...
Provides the interface to a KIM API Model object for use by models within their MODEL_ROUTINE_NAME::C...
recursive subroutine kim_model_driver_create_get_parameter_file_name(model_driver_create_handle, index, parameter_file_name, ierr)
Get a particular parameter file name.
recursive subroutine kim_model_driver_create_set_neighbor_list_pointers(model_driver_create_handle, number_of_neighbor_lists, cutoffs, model_will_not_request_neighbors_of_noncontributing_particles)
Set the Model's neighbor list data pointers.
recursive subroutine kim_model_driver_create_set_influence_distance_pointer(model_driver_create_handle, influence_distance)
Set the Model's influence distance data pointer.
recursive subroutine kim_model_driver_create_log_entry(model_driver_create_handle, log_verbosity, message)
Write a log entry into the log file.
An Extensible Enumeration for the ModelRoutineName's supported by the KIM API.
recursive subroutine kim_model_driver_create_set_parameter_pointer_integer(model_driver_create_handle, int1, name, description, ierr)
Set the next parameter data pointer to be provided by the model.
recursive subroutine kim_model_driver_create_set_units(model_driver_create_handle, length_unit, energy_unit, charge_unit, temperature_unit, time_unit, ierr)
Set the Model's base unit values.
recursive subroutine kim_model_driver_create_set_model_numbering(model_driver_create_handle, numbering, ierr)
Set the Model's particle Numbering.
An Extensible Enumeration for the Numbering's supported by the KIM API.
recursive subroutine kim_model_driver_create_set_species_code(model_driver_create_handle, species_name, code, ierr)
Set integer code for supported SpeciesName.
An Extensible Enumeration for the LanguageName's supported by the KIM API.
recursive subroutine kim_model_driver_create_set_model_buffer_pointer(model_driver_create_handle, ptr)
Set the Model's buffer pointer within the Model object.
An Extensible Enumeration for the SpeciesName's supported by the KIM API.
int model_driver_create(KIM_ModelDriverCreate *const modelDriverCreate, KIM_LengthUnit const requestedLengthUnit, KIM_EnergyUnit const requestedEnergyUnit, KIM_ChargeUnit const requestedChargeUnit, KIM_TemperatureUnit const requestedTemperatureUnit, KIM_TimeUnit const requestedTimeUnit)
recursive subroutine set_parameter(model_create, extent, int1, name, description, ierr)
recursive subroutine kim_model_driver_create_to_string(model_driver_create_handle, string)
Get a string representing the internal state of the Model object.
type(kim_model_driver_create_handle_type), save, public, protected kim_model_driver_create_null_handle
NULL handle for use in comparisons.
recursive subroutine kim_model_driver_create_set_routine_pointer(model_driver_create_handle, model_routine_name, language_name, required, fptr, ierr)
Set the function pointer for the ModelRoutineName of interest.
recursive subroutine kim_model_driver_create_set_parameter_pointer_double(model_driver_create_handle, double1, name, description, ierr)
Set the next parameter data pointer to be provided by the model.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.