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.1 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_lists, &
49  kim_model_get_neighbor_list_values, &
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_lists(model_handle, &
188  number_of_neighbor_lists)
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_neighbor_lists
194  end subroutine kim_model_get_number_of_neighbor_lists
195 
196  subroutine kim_model_get_neighbor_list_values(model_handle, cutoffs, &
197  padding_neighbor_hints, half_list_hints, ierr)
198  use, intrinsic :: iso_c_binding
199  import kim_model_handle_type
200  implicit none
201  type(kim_model_handle_type), intent(in) :: model_handle
202  real(c_double), intent(out) :: cutoffs(:)
203  integer(c_int), intent(out) :: padding_neighbor_hints(:)
204  integer(c_int), intent(out) :: half_list_hints(:)
205  integer(c_int), intent(out) :: ierr
206  end subroutine kim_model_get_neighbor_list_values
207 
208  subroutine kim_model_get_units(model_handle, length_unit, energy_unit, &
209  charge_unit, temperature_unit, time_unit)
210  use, intrinsic :: iso_c_binding
211  use kim_unit_system_module, only : kim_length_unit_type, &
212  kim_energy_unit_type, kim_charge_unit_type, kim_temperature_unit_type, &
213  kim_time_unit_type
214  import kim_model_handle_type
215  type(kim_model_handle_type), intent(in) :: model_handle
216  type(kim_length_unit_type), intent(out) :: length_unit
217  type(kim_energy_unit_type), intent(out) :: energy_unit
218  type(kim_charge_unit_type), intent(out) :: charge_unit
219  type(kim_temperature_unit_type), intent(out) :: temperature_unit
220  type(kim_time_unit_type), intent(out) :: time_unit
221  end subroutine kim_model_get_units
222 
223  subroutine kim_model_compute_arguments_create(model_handle, &
224  compute_arguments_handle, ierr)
225  use, intrinsic :: iso_c_binding
226  use kim_compute_arguments_module, only : &
227  kim_compute_arguments_handle_type
228  import kim_model_handle_type
229  implicit none
230  type(kim_model_handle_type), intent(in) :: model_handle
231  type(kim_compute_arguments_handle_type), intent(out) :: &
232  compute_arguments_handle
233  integer(c_int), intent(out) :: ierr
235 
236  subroutine kim_model_compute_arguments_destroy(model_handle, &
237  compute_arguments_handle, ierr)
238  use, intrinsic :: iso_c_binding
239  use kim_compute_arguments_module, only: &
240  kim_compute_arguments_handle_type
241  import kim_model_handle_type
242  implicit none
243  type(kim_model_handle_type), intent(in) :: model_handle
244  type(kim_compute_arguments_handle_type), intent(inout) :: &
245  compute_arguments_handle
246  integer(c_int), intent(out) :: ierr
248 
249  subroutine kim_model_compute(model_handle, compute_arguments_handle, ierr)
250  use, intrinsic :: iso_c_binding
251  use kim_compute_arguments_module, only : kim_compute_arguments_handle_type
252  import kim_model_handle_type
253  implicit none
254  type(kim_model_handle_type), intent(in) :: model_handle
255  type(kim_compute_arguments_handle_type), intent(in) :: &
256  compute_arguments_handle
257  integer(c_int), intent(out) :: ierr
258  end subroutine kim_model_compute
259 
261  model_handle, ierr)
262  use, intrinsic :: iso_c_binding
263  import kim_model_handle_type
264  implicit none
265  type(kim_model_handle_type), intent(in) :: model_handle
266  integer(c_int), intent(out) :: ierr
267  end subroutine kim_model_clear_then_refresh
268 
269  subroutine kim_model_get_species_support_and_code(model_handle, &
270  species_name, species_is_supported, code, ierr)
271  use, intrinsic :: iso_c_binding
272  use kim_species_name_module, only : kim_species_name_type
273  import kim_model_handle_type
274  implicit none
275  type(kim_model_handle_type), intent(in) :: model_handle
276  type(kim_species_name_type), intent(in), value :: species_name
277  integer(c_int), intent(out) :: species_is_supported
278  integer(c_int), intent(out) :: code
279  integer(c_int), intent(out) :: ierr
280  end subroutine kim_model_get_species_support_and_code
281 
282  subroutine kim_model_get_number_of_parameters(model_handle, &
283  number_of_parameters)
284  use, intrinsic :: iso_c_binding
285  import kim_model_handle_type
286  implicit none
287  type(kim_model_handle_type), intent(in) :: model_handle
288  integer(c_int), intent(out) :: number_of_parameters
290 
291  subroutine kim_model_get_parameter_data_type_extent_and_description( &
292  model_handle, index, data_type, extent, description, ierr)
293  use, intrinsic :: iso_c_binding
294  use :: kim_data_type_module, only : kim_data_type_type
295  import kim_model_handle_type
296  implicit none
297  type(kim_model_handle_type), intent(in) :: model_handle
298  integer(c_int), intent(in), value :: index
299  type(kim_data_type_type), intent(out) :: data_type
300  integer(c_int), intent(out) :: extent
301  character(len=*, kind=c_char), intent(out) :: description
302  integer(c_int), intent(out) :: ierr
303  end subroutine kim_model_get_parameter_data_type_extent_and_description
304 
305  subroutine kim_model_set_simulator_buffer_pointer(model_handle, ptr)
306  use, intrinsic :: iso_c_binding
307  import kim_model_handle_type
308  implicit none
309  type(kim_model_handle_type), intent(in) :: model_handle
310  type(c_ptr), intent(in), value :: ptr
312 
313  subroutine kim_model_get_simulator_buffer_pointer(model_handle, ptr)
314  use, intrinsic :: iso_c_binding
315  import kim_model_handle_type
316  implicit none
317  type(kim_model_handle_type), intent(in) :: model_handle
318  type(c_ptr), intent(out) :: ptr
319  end subroutine kim_model_get_simulator_buffer_pointer
320 
321  subroutine kim_model_string(model_handle, string)
322  use, intrinsic :: iso_c_binding
323  import kim_model_handle_type
324  implicit none
325  type(kim_model_handle_type), intent(in) :: model_handle
326  character(len=*, kind=c_char), intent(out) :: string
327  end subroutine kim_model_string
328 
329  subroutine kim_model_set_log_id(model_handle, log_id)
330  use, intrinsic :: iso_c_binding
331  import kim_model_handle_type
332  implicit none
333  type(kim_model_handle_type), intent(in) :: model_handle
334  character(len=*, kind=c_char), intent(in) :: log_id
335  end subroutine kim_model_set_log_id
336 
337  subroutine kim_model_push_log_verbosity(model_handle, log_verbosity)
338  use, intrinsic :: iso_c_binding
339  use kim_log_verbosity_module, only : kim_log_verbosity_type
340  import kim_model_handle_type
341  implicit none
342  type(kim_model_handle_type), intent(in) :: model_handle
343  type(kim_log_verbosity_type), intent(in) :: log_verbosity
344  end subroutine kim_model_push_log_verbosity
345 
346  subroutine kim_model_pop_log_verbosity(model_handle)
347  use, intrinsic :: iso_c_binding
348  use kim_log_verbosity_module, only : kim_log_verbosity_type
349  import kim_model_handle_type
350  implicit none
351  type(kim_model_handle_type), intent(in) :: model_handle
352  end subroutine kim_model_pop_log_verbosity
353  end interface
354 end module kim_model_module
type(kim_model_handle_type), public, protected kim_model_null_handle