/* */ /* CDDL HEADER START */ /* */ /* The contents of this file are subject to the terms of the Common */ /* Development and Distribution License Version 1.0 (the "License"). */ /* */ /* You can obtain a copy of the license at */ /* http://www.opensource.org/licenses/CDDL-1.0. See the License for the */ /* specific language governing permissions and limitations under the License. */ /* */ /* When distributing Covered Code, include this CDDL HEADER in each file and */ /* include the License file in a prominent location with the name */ /* LICENSE.CDDL. */ /* If applicable, add the following below this CDDL HEADER, with the fields */ /* enclosed by brackets "[]" replaced with your own identifying information: */ /* */ /* Portions Copyright (c) [yyyy] [name of copyright owner]. */ /* All rights reserved. */ /* */ /* CDDL HEADER END */ /* */ /* */ /* Copyright (c) 2017--2020, Regents of the University of Minnesota. */ /* All rights reserved. */ /* */ /* Contributors: */ /* Ryan S. Elliott */ /* Ellad B. Tadmor */ /* Daniel Karls */ /* */ /* */ /* Release: This file is part of the kim-api.git repository. */ /* */ /** \page implementation Implementation Previous Section: \ref theory. \anchor kim_api_pmi ## The KIM API Portable Model Interface (KIM API/PMI) In code, Portable Models (PMs) and Model Drivers (MDs) consist of up to eight routines which perform specific tasks. -# The ModelCreate (or \em ModelDriverCreate ) routine (required), which performs initialization tasks for the KIM::Model object. -# The ModelComputeArgumentsCreate routine (required), which performs initialization tasks for a KIM::ComputeArguments object. -# The \em ModelCompute routine (required), which uses the configuration information stored in a KIM::ComputeArguments object to perform the PM's core computational tasks. -# The ModelExtension routine (optional), which provides a mechanism for creating and using non-standard extensions to the %KIM API. -# The ModelRefresh routine (required if parameter pointers are set, otherwise should not be provided), which performs updates after a simulator makes changes to the PM's parameters (if this is supported). -# The ModelWriteParameterizedModel (optional) routine, which can be used to write the parameter files and CMake file necessary to create a new parameterized PM from the current set of in-memory parameters. -# The \em ModelComputeArgumentsDestroy routine (required), which performs finalization tasks for a KIM::ComputeArguments object. -# The ModelDestroy routine (required), which performs finalization tasks for the KIM::Model object. The %KIM API/PMI provides a separate interface to be used by the PM or MD. For each of the routines itemized above, the following table lists (i) the associated KIM::ModelRoutineName extensible enumeration constant, (ii) links to the associated %KIM API/PMI interface(s) available within the routine, (iii) links to the routine's prototype (in C++, C, and Fortran), and (iv) whether the %KIM API/PMI requires a PM or MD to provide the routine, or if it is optional.
| Model Routine Name constant | %KIM API/PMI Interface | Routine prototype (C++; C; Fortran) | %KIM API/PMI Required / Optional |
|---|---|---|---|
| KIM::MODEL_ROUTINE_NAME::Create |
KIM::ModelCreate or
KIM::ModelDriverCreate |
KIM::ModelCreateFunction,
KIM::ModelDriverCreateFunction; \ref KIM_ModelCreateFunction, \ref KIM_ModelDriverCreateFunction; kim_model_module::kim_model_create | required |
| KIM::MODEL_ROUTINE_NAME::ComputeArgumentsCreate | KIM::ModelComputeArgumentsCreate |
KIM::ModelComputeArgumentsCreateFunction;
\ref KIM_ModelComputeArgumentsCreateFunction; kim_model_module::kim_model_compute_arguments_create | required |
| KIM::MODEL_ROUTINE_NAME::Compute |
KIM::ModelCompute and
KIM::ModelComputeArguments |
KIM::ModelComputeFunction;
\ref KIM_ModelComputeFunction; kim_model_module::kim_model_compute | required |
| KIM::MODEL_ROUTINE_NAME::Extension | KIM::ModelExtension |
KIM::ModelExtensionFunction;
\ref KIM_ModelExtensionFunction; kim_model_module::kim_model_extension | optional |
| KIM::MODEL_ROUTINE_NAME::Refresh | KIM::ModelRefresh |
KIM::ModelRefreshFunction;
\ref KIM_ModelRefreshFunction; kim_model_module::kim_model_clear_then_refresh | required if one or more parameter pointers set, otherwise should not be provided |
| KIM::MODEL_ROUTINE_NAME::WriteParameterizedModel | KIM::ModelWriteParameterizedModel |
KIM::ModelWriteParameterizedModelFunction;
\ref KIM_ModelWriteParameterizedModelFunction; kim_model_module::kim_model_write_parameterized_model | optional |
| KIM::MODEL_ROUTINE_NAME::ComputeArgumentsDestroy | KIM::ModelComputeArgumentsDestroy |
KIM::ModelComputeArgumentsDestroyFunction;
\ref KIM_ModelComputeArgumentsDestroyFunction; kim_model_module::kim_model_compute_arguments_destroy | required |
| KIM::MODEL_ROUTINE_NAME::Destroy | KIM::ModelDestroy |
KIM::ModelDestroyFunction;
\ref KIM_ModelDestroyFunction; kim_model_module::kim_model_destroy | required |