KIM API V2
kim_model_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--2018, 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-v2.0.0-beta.0 package.
31 !
32 
33 
35  use, intrinsic :: iso_c_binding
37  implicit none
38  private
39 
40  public &
41  kim_model_handle_type, &
43  operator (.eq.), &
44  operator (.ne.), &
45  kim_model_create, &
47  kim_model_get_influence_distance, &
48  kim_model_get_number_of_neighbor_list_cutoffs, &
49  kim_model_get_neighbor_list_cutoffs, &
50  kim_model_get_units, &
55  kim_model_get_species_support_and_code, &
57  kim_model_get_parameter_data_type_extent_and_description, &
58  kim_model_get_parameter, &
59  kim_model_set_parameter, &
61  kim_model_get_simulator_buffer_pointer, &
62  kim_model_string, &
63  kim_model_set_log_id, &
64  kim_model_push_log_verbosity, &
66 
67  type, bind(c) :: kim_model_handle_type
68  type(c_ptr) :: p = c_null_ptr
69  end type kim_model_handle_type
70 
71  type(kim_model_handle_type), protected &
73 
74  interface operator (.eq.)
75  logical function kim_model_handle_equal(left, right)
76  use, intrinsic :: iso_c_binding
77  import kim_model_handle_type
78  implicit none
79  type(kim_model_handle_type), intent(in) :: left
80  type(kim_model_handle_type), intent(in) :: right
81  end function kim_model_handle_equal
82  end interface operator (.eq.)
83 
84  interface operator (.ne.)
85  logical function kim_model_handle_not_equal(left, right)
86  use, intrinsic :: iso_c_binding
87  import kim_model_handle_type
88  implicit none
89  type(kim_model_handle_type), intent(in) :: left
90  type(kim_model_handle_type), intent(in) :: right
91  end function kim_model_handle_not_equal
92  end interface operator (.ne.)
93 
94  interface kim_model_get_parameter
95  subroutine kim_model_get_parameter_integer(model_handle, parameter_index, &
96  array_index, parameter_value, ierr)
97  use, intrinsic :: iso_c_binding
98  import kim_model_handle_type
99  implicit none
100  type(kim_model_handle_type), intent(in) :: model_handle
101  integer(c_int), intent(in), value :: parameter_index
102  integer(c_int), intent(in), value :: array_index
103  integer(c_int), intent(out) :: parameter_value
104  integer(c_int), intent(out) :: ierr
105  end subroutine kim_model_get_parameter_integer
106 
107  subroutine kim_model_get_parameter_double(model_handle, parameter_index, &
108  array_index, parameter_value, ierr)
109  use, intrinsic :: iso_c_binding
110  import kim_model_handle_type
111  implicit none
112  type(kim_model_handle_type), intent(in) :: model_handle
113  integer(c_int), intent(in), value :: parameter_index
114  integer(c_int), intent(in), value :: array_index
115  real(c_double), intent(out) :: parameter_value
116  integer(c_int), intent(out) :: ierr
117  end subroutine kim_model_get_parameter_double
118  end interface kim_model_get_parameter
119 
120  interface kim_model_set_parameter
121  subroutine kim_model_set_parameter_integer(model_handle, parameter_index, &
122  array_index, parameter_value, ierr)
123  use, intrinsic :: iso_c_binding
124  import kim_model_handle_type
125  implicit none
126  type(kim_model_handle_type), intent(in) :: model_handle
127  integer(c_int), intent(in), value :: parameter_index
128  integer(c_int), intent(in), value :: array_index
129  integer(c_int), intent(in), value :: parameter_value
130  integer(c_int), intent(out) :: ierr
131  end subroutine kim_model_set_parameter_integer
132 
133  subroutine kim_model_set_parameter_double(model_handle, parameter_index, &
134  array_index, parameter_value, ierr)
135  use, intrinsic :: iso_c_binding
136  import kim_model_handle_type
137  implicit none
138  type(kim_model_handle_type), intent(in) :: model_handle
139  integer(c_int), intent(in), value :: parameter_index
140  integer(c_int), intent(in), value :: array_index
141  real(c_double), intent(in), value :: parameter_value
142  integer(c_int), intent(out) :: ierr
143  end subroutine kim_model_set_parameter_double
144  end interface kim_model_set_parameter
145 
146  interface
147  subroutine kim_model_create(numbering, requested_length_unit, &
148  requested_energy_unit, requested_charge_unit, &
149  requested_temperature_unit, requested_time_unit, model_name, &
150  requested_units_accepted, model_handle, ierr)
151  use, intrinsic :: iso_c_binding
152  use kim_numbering_module, only : kim_numbering_type
153  use kim_unit_system_module, only : kim_length_unit_type, &
154  kim_energy_unit_type, kim_charge_unit_type, kim_temperature_unit_type, &
155  kim_time_unit_type
156  import kim_model_handle_type
157  implicit none
158  type(kim_numbering_type), intent(in), value :: numbering
159  type(kim_length_unit_type), intent(in), value :: requested_length_unit
160  type(kim_energy_unit_type), intent(in), value :: requested_energy_unit
161  type(kim_charge_unit_type), intent(in), value :: requested_charge_unit
162  type(kim_temperature_unit_type), intent(in), value :: &
163  requested_temperature_unit
164  type(kim_time_unit_type), intent(in), value :: requested_time_unit
165  character(len=*, kind=c_char), intent(in) :: model_name
166  type(kim_model_handle_type), intent(out) :: model_handle
167  integer(c_int), intent(out) :: requested_units_accepted
168  integer(c_int), intent(out) :: ierr
169  end subroutine kim_model_create
170 
171  subroutine kim_model_destroy(model_handle)
172  use, intrinsic :: iso_c_binding
173  import kim_model_handle_type
174  implicit none
175  type(kim_model_handle_type), intent(inout) :: model_handle
176  end subroutine kim_model_destroy
177 
178  subroutine kim_model_get_influence_distance(model_handle, &
179  influence_distance)
180  use, intrinsic :: iso_c_binding
181  import kim_model_handle_type
182  implicit none
183  type(kim_model_handle_type), intent(in) :: model_handle
184  real(c_double), intent(out) :: influence_distance
185  end subroutine kim_model_get_influence_distance
186 
187  subroutine kim_model_get_number_of_neighbor_list_cutoffs(model_handle, &
188  number_of_cutoffs)
189  use, intrinsic :: iso_c_binding
190  import kim_model_handle_type
191  implicit none
192  type(kim_model_handle_type), intent(in) :: model_handle
193  integer(c_int), intent(out) :: number_of_cutoffs
194  end subroutine kim_model_get_number_of_neighbor_list_cutoffs
195 
196  subroutine kim_model_get_neighbor_list_cutoffs(model_handle, cutoffs, ierr)
197  use, intrinsic :: iso_c_binding
198  import kim_model_handle_type
199  implicit none
200  type(kim_model_handle_type), intent(in) :: model_handle
201  real(c_double), intent(out) :: cutoffs(:)
202  integer(c_int), intent(out) :: ierr
203  end subroutine kim_model_get_neighbor_list_cutoffs
204 
205  subroutine kim_model_get_units(model_handle, length_unit, energy_unit, &
206  charge_unit, temperature_unit, time_unit)
207  use, intrinsic :: iso_c_binding
208  use kim_unit_system_module, only : kim_length_unit_type, &
209  kim_energy_unit_type, kim_charge_unit_type, kim_temperature_unit_type, &
210  kim_time_unit_type
211  import kim_model_handle_type
212  type(kim_model_handle_type), intent(in) :: model_handle
213  type(kim_length_unit_type), intent(out) :: length_unit
214  type(kim_energy_unit_type), intent(out) :: energy_unit
215  type(kim_charge_unit_type), intent(out) :: charge_unit
216  type(kim_temperature_unit_type), intent(out) :: temperature_unit
217  type(kim_time_unit_type), intent(out) :: time_unit
218  end subroutine kim_model_get_units
219 
220  subroutine kim_model_compute_arguments_create(model_handle, &
221  compute_arguments_handle, ierr)
222  use, intrinsic :: iso_c_binding
223  use kim_compute_arguments_module, only : &
224  kim_compute_arguments_handle_type
225  import kim_model_handle_type
226  implicit none
227  type(kim_model_handle_type), intent(in) :: model_handle
228  type(kim_compute_arguments_handle_type), intent(out) :: &
229  compute_arguments_handle
230  integer(c_int), intent(out) :: ierr
232 
233  subroutine kim_model_compute_arguments_destroy(model_handle, &
234  compute_arguments_handle, ierr)
235  use, intrinsic :: iso_c_binding
236  use kim_compute_arguments_module, only: &
237  kim_compute_arguments_handle_type
238  import kim_model_handle_type
239  implicit none
240  type(kim_model_handle_type), intent(in) :: model_handle
241  type(kim_compute_arguments_handle_type), intent(inout) :: &
242  compute_arguments_handle
243  integer(c_int), intent(out) :: ierr
245 
246  subroutine kim_model_compute(model_handle, compute_arguments_handle, ierr)
247  use, intrinsic :: iso_c_binding
248  use kim_compute_arguments_module, only : kim_compute_arguments_handle_type
249  import kim_model_handle_type
250  implicit none
251  type(kim_model_handle_type), intent(in) :: model_handle
252  type(kim_compute_arguments_handle_type), intent(in) :: &
253  compute_arguments_handle
254  integer(c_int), intent(out) :: ierr
255  end subroutine kim_model_compute
256 
258  model_handle, ierr)
259  use, intrinsic :: iso_c_binding
260  import kim_model_handle_type
261  implicit none
262  type(kim_model_handle_type), intent(in) :: model_handle
263  integer(c_int), intent(out) :: ierr
265 
266  subroutine kim_model_get_species_support_and_code(model_handle, &
267  species_name, species_is_supported, code, ierr)
268  use, intrinsic :: iso_c_binding
269  use kim_species_name_module, only : kim_species_name_type
270  import kim_model_handle_type
271  implicit none
272  type(kim_model_handle_type), intent(in) :: model_handle
273  type(kim_species_name_type), intent(in), value :: species_name
274  integer(c_int), intent(out) :: species_is_supported
275  integer(c_int), intent(out) :: code
276  integer(c_int), intent(out) :: ierr
277  end subroutine kim_model_get_species_support_and_code
278 
279  subroutine kim_model_get_number_of_parameters(model_handle, &
280  number_of_parameters)
281  use, intrinsic :: iso_c_binding
282  import kim_model_handle_type
283  implicit none
284  type(kim_model_handle_type), intent(in) :: model_handle
285  integer(c_int), intent(out) :: number_of_parameters
287 
288  subroutine kim_model_get_parameter_data_type_extent_and_description( &
289  model_handle, index, data_type, extent, description, ierr)
290  use, intrinsic :: iso_c_binding
291  use :: kim_data_type_module, only : kim_data_type_type
292  import kim_model_handle_type
293  implicit none
294  type(kim_model_handle_type), intent(in) :: model_handle
295  integer(c_int), intent(in), value :: index
296  type(kim_data_type_type), intent(out) :: data_type
297  integer(c_int), intent(out) :: extent
298  character(len=*, kind=c_char), intent(out) :: description
299  integer(c_int), intent(out) :: ierr
300  end subroutine kim_model_get_parameter_data_type_extent_and_description
301 
302  subroutine kim_model_set_simulator_buffer_pointer(model_handle, ptr)
303  use, intrinsic :: iso_c_binding
304  import kim_model_handle_type
305  implicit none
306  type(kim_model_handle_type), intent(in) :: model_handle
307  type(c_ptr), intent(in), value :: ptr
309 
310  subroutine kim_model_get_simulator_buffer_pointer(model_handle, ptr)
311  use, intrinsic :: iso_c_binding
312  import kim_model_handle_type
313  implicit none
314  type(kim_model_handle_type), intent(in) :: model_handle
315  type(c_ptr), intent(out) :: ptr
316  end subroutine kim_model_get_simulator_buffer_pointer
317 
318  subroutine kim_model_string(model_handle, string)
319  use, intrinsic :: iso_c_binding
320  import kim_model_handle_type
321  implicit none
322  type(kim_model_handle_type), intent(in) :: model_handle
323  character(len=*, kind=c_char), intent(out) :: string
324  end subroutine kim_model_string
325 
326  subroutine kim_model_set_log_id(model_handle, log_id)
327  use, intrinsic :: iso_c_binding
328  import kim_model_handle_type
329  implicit none
330  type(kim_model_handle_type), intent(in) :: model_handle
331  character(len=*, kind=c_char), intent(in) :: log_id
332  end subroutine kim_model_set_log_id
333 
334  subroutine kim_model_push_log_verbosity(model_handle, log_verbosity)
335  use, intrinsic :: iso_c_binding
336  use kim_log_verbosity_module, only : kim_log_verbosity_type
337  import kim_model_handle_type
338  implicit none
339  type(kim_model_handle_type), intent(in) :: model_handle
340  type(kim_log_verbosity_type), intent(in) :: log_verbosity
341  end subroutine kim_model_push_log_verbosity
342 
343  subroutine kim_model_pop_log_verbosity(model_handle)
344  use, intrinsic :: iso_c_binding
345  use kim_log_verbosity_module, only : kim_log_verbosity_type
346  import kim_model_handle_type
347  implicit none
348  type(kim_model_handle_type), intent(in) :: model_handle
349  end subroutine kim_model_pop_log_verbosity
350  end interface
351 end module kim_model_module
type(kim_model_handle_type), public, protected kim_model_null_handle