| 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 |
/* Ellad B. Tadmor */ |
| 9 |
/* Daniel Karls */ |
| 10 |
/* */ |
| 11 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 12 |
/* */ |
| 13 |
/* This library is free software; you can redistribute it and/or */ |
| 14 |
/* modify it under the terms of the GNU Lesser General Public */ |
| 15 |
/* License as published by the Free Software Foundation; either */ |
| 16 |
/* version 2.1 of the License, or (at your option) any later version. */ |
| 17 |
/* */ |
| 18 |
/* This library is distributed in the hope that it will be useful, */ |
| 19 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 20 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ |
| 21 |
/* Lesser General Public License for more details. */ |
| 22 |
/* */ |
| 23 |
/* You should have received a copy of the GNU Lesser General Public License */ |
| 24 |
/* along with this library; if not, write to the Free Software Foundation, */ |
| 25 |
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ |
| 26 |
/* */ |
| 27 |
|
| 28 |
/* */ |
| 29 |
/* Release: This file is part of the kim-api.git repository. */ |
| 30 |
/* */ |
| 31 |
|
| 32 |
/** |
| 33 |
\page features Features of the %KIM API package |
| 34 |
|
| 35 |
Previous Section: \ref index. |
| 36 |
|
| 37 |
This version of the %KIM API package is distributed under the |
| 38 |
[LGPL-2.1-or-later Open Source |
| 39 |
License](https://spdx.org/licenses/LGPL-2.1-or-later.html). |
| 40 |
|
| 41 |
The current version of the %KIM API package supports the following features: |
| 42 |
|
| 43 |
- **Programming Languages**: Currently supported programming languages include |
| 44 |
C, C++, Fortran. |
| 45 |
|
| 46 |
- **Best Practice API Design**: The guiding design principle for the %KIM API |
| 47 |
has been *simplicity*. In addition to this, general API design *best |
| 48 |
practices* have been used. These include: implementation hiding (pimpl |
| 49 |
idiom), loose coupling, minimal-completeness, ease of use (discoverable, |
| 50 |
difficult to misuse, consistent, orthogonal), static factory methods, use of |
| 51 |
namespaces, const-correctness, and avoiding the use of abbreviations. |
| 52 |
|
| 53 |
- **Language Idiom Support**: Wherever it makes sense and is possible the %KIM |
| 54 |
API supports common idioms of the native language. For example, all C API |
| 55 |
routines that return an error status do so using the C function return value. |
| 56 |
For Fortran, all such API routines are SUBROUTINES and have their final |
| 57 |
argument as an error status. |
| 58 |
|
| 59 |
- **Extensible, Strongly-Typed Enumerations**: \anchor extensible_enumeration |
| 60 |
The %KIM API implements a set of typed constants for each category of entity |
| 61 |
that it defines (KIM::ChargeUnit, KIM::ComputeArgumentName, |
| 62 |
KIM::ComputeCallbackName, KIM::DataType, KIM::EnergyUnit, KIM::LanguageName, |
| 63 |
KIM::LengthUnit, KIM::LogVerbosity, KIM::ModelRoutineName, KIM::Numbering, |
| 64 |
KIM::SpeciesName, KIM::SupportStatus, KIM::TemperatureUnit, KIM::TimeUnit, |
| 65 |
KIM::Collection, KIM::CollectionItemType). |
| 66 |
This allows for backward-compatible additions to the enumerations in future |
| 67 |
versions of the %KIM API. Further, the strong-typing greatly facilitates |
| 68 |
debugging. |
| 69 |
|
| 70 |
- **Discoverable Collections Interface**: Support is provided (via a |
| 71 |
KIM::Collections object) for programatic discovery of all |
| 72 |
KIM::CollectionItemType%s (Model Drivers, Portable Models, and Simulator |
| 73 |
Models) in each of the KIM::Collection%s which are configured and |
| 74 |
installed on the computing system. |
| 75 |
|
| 76 |
- **Portable Model Interface (the %KIM API/PMI)**: |
| 77 |
|
| 78 |
See \ref kim_api_pmi "The KIM API/PMI" for a description of the PMI. Features |
| 79 |
for the PMI include |
| 80 |
|
| 81 |
- **Numbering Origin Support**: Support for automatic translation between |
| 82 |
zero-based numbering of particles (C-style numbering beginning with zero) |
| 83 |
and one-based numbering (Fortran-style numbering beginning with one). |
| 84 |
|
| 85 |
- **Data Communication**: Communication of an arbitrary number of *arguments* |
| 86 |
and *callback* routines between a *portable model* (interatomic potential) |
| 87 |
and a *simulator* (simulation code that uses a model). |
| 88 |
|
| 89 |
- **Data types**: integer and double. |
| 90 |
|
| 91 |
Each of the data types can be used to create multi-dimensional array |
| 92 |
arguments that are exchanged between models and simulators. The %KIM API |
| 93 |
standard defines the dimension and extent of these arrays for each |
| 94 |
argument. However, this information is not discoverable at run-time. |
| 95 |
Thus, it is left to the programmer to ensure that the correct values are |
| 96 |
used. |
| 97 |
|
| 98 |
Currently, the %KIM API does not define any (more complex) data structures. |
| 99 |
However, in the future (as the need arises, and in consultation with the |
| 100 |
atomistic and molecular simulation community) additional data types and |
| 101 |
data structures may be introduced. |
| 102 |
|
| 103 |
- **Physical Units**: The %KIM API standard defines the physical units for |
| 104 |
each argument exchanged between a model and simulator. A simulator |
| 105 |
provides a set of *requested units* to define a unit system and a model |
| 106 |
either accepts this unit system (and performs appropriate unit conversions |
| 107 |
for its parameters), or it rejects the request and reports the unit system |
| 108 |
to be used. |
| 109 |
|
| 110 |
- **Neighbor lists**: Neighbor list routines are expected to be provided by |
| 111 |
the calling simulator. All neighbor lists are full, unsorted lists that |
| 112 |
must contain all particles within the specified cutoff distance (but may |
| 113 |
contain additional particles). A model must request one or more neighbor |
| 114 |
lists, each with an associated cutoff distance. (Cutoff distances are |
| 115 |
typically distinct, but may repeat. Repeated cutoff distances allow a |
| 116 |
model to simultaneously access the neighbors of multiple particles without |
| 117 |
needing to make copies of the neighbor list(s).) A simulator must provide |
| 118 |
all such requested lists and should ensure that these lists contain only a |
| 119 |
small number of particles that are located outside the cutoff distance. |
| 120 |
Models must provide "hints" in a standard format (explained \ref |
| 121 |
neighbor_list_hint "here") about how they use neighbor lists. These hints |
| 122 |
allow the simulator to, optionally, optimize its neighbor list build |
| 123 |
algorithm. |
| 124 |
|
| 125 |
- **Particle Species**: The %KIM API provides the ability to designate the |
| 126 |
physical species of each particle in a simulation. Currently, only one |
| 127 |
identifier is provided for each element in the periodic table, along with |
| 128 |
some user-defined species for development purposes and toy models. In the |
| 129 |
future support for models that require multiple types of each element may |
| 130 |
be added. |
| 131 |
|
| 132 |
- **Model Parameters**: The %KIM philosophy views a *portable model* as a |
| 133 |
well-defined computational code that includes specific values for all |
| 134 |
parameters needed to perform an actual computation. However, it is often |
| 135 |
useful to explore how a model's predictions vary as the values of its |
| 136 |
parameters are varied. For this reason, the %KIM API allows a portable |
| 137 |
model to (optionally) "publish" its parameters so that a simulator may |
| 138 |
modify them during the course of a simulation. This feature is also useful |
| 139 |
for codes designed to fit interatomic models. |
| 140 |
|
| 141 |
- **Model Drivers**: The %KIM API package provides the ability to create |
| 142 |
model driver routines. A model driver is an implementation of an |
| 143 |
interatomic potential functional-form. A portable model for a given |
| 144 |
material can be created which uses an existing model driver by providing a |
| 145 |
file or files with the appropriate parameter values for the material system |
| 146 |
of interest. |
| 147 |
|
| 148 |
- **Simulator Model Interface (the %KIM API/SMI)**: |
| 149 |
|
| 150 |
See \ref kim_api_smi "The KIM API/SMI" for a description of the SMI. |
| 151 |
Features of the SMI include |
| 152 |
|
| 153 |
- **Simulator Model (SM) Specification File**: The SM specification file |
| 154 |
records simulator input commands and other important metadata needed to run |
| 155 |
the SM in its native simulator. |
| 156 |
|
| 157 |
- **Simulator Name and Version Tracking**: The SM's associated simulator name |
| 158 |
and version are recorded in the specification file to allow for explicitly |
| 159 |
verifying compatibility of the SM package with the simulator's identity and |
| 160 |
version. |
| 161 |
|
| 162 |
- **Supported Species List**: The SM's supported species strings (arbitrary |
| 163 |
strings identifying the atomic species the model simulates) are recorded in |
| 164 |
the specification file and are made available to the simulator. |
| 165 |
|
| 166 |
- **Parameter Files**: Any number of parameter files may be encapsulated |
| 167 |
within the SM package and provided to the simulator in a simple and |
| 168 |
unobtrusive manner. |
| 169 |
|
| 170 |
- **Flexible Simulator Field/Line Framework**: Simulator input commands and |
| 171 |
additional metadata necessary to run the SM are stored in the SM |
| 172 |
specification file. A flexible framework of "Simulator Fields" containing |
| 173 |
one or more "Simulator Field Lines" give each simulator maximum flexibility |
| 174 |
in defining its own specialized interface and satisfying its own needs. |
| 175 |
|
| 176 |
- **Template Substitution**: Simulator Field Lines can contain template keys |
| 177 |
that will be replaced by values stored in a "Template Map". The template |
| 178 |
map contains mappings defined by the %KIM API/SMI as well as custom |
| 179 |
mappings defined by the simulator. This mechanism provides flexibility and |
| 180 |
dynamic behavior allowing the simulator's handling of the SM to be adjusted |
| 181 |
at run time. |
| 182 |
|
| 183 |
- **Logging capabilities**: The %KIM API package provides a full-featured |
| 184 |
logging capability that facilitates the identification and debugging of |
| 185 |
errors. In addition to built-in support for logging within model codes, the |
| 186 |
%KIM API also provides access to logging capabilities for general use by |
| 187 |
simulator codes. |
| 188 |
|
| 189 |
- **Caching capabilities**: \anchor cache_buffer_pointers The %KIM API package |
| 190 |
provides a mechanism to store a pointer to a memory (cache) buffer in the |
| 191 |
main API objects (KIM::Model, KIM::ComputeArguments, and |
| 192 |
KIM::SimulatorModel). In each object there is a "SimulatorBufferPointer" |
| 193 |
which is for use by the simulator. For the KIM::Model and |
| 194 |
KIM::ComputeArguments objects there is also a "ModelBufferPointer" which is |
| 195 |
for use by the portable model's routines. (These buffer pointers are not to |
| 196 |
be used for communication between the simulator and model, and therefore the |
| 197 |
ModelBufferPointer is not accessible to the simulator and vise-versa.) |
| 198 |
|
| 199 |
- **Semantic Versioning**: The %KIM API package conforms to the [Semantic |
| 200 |
Versioning 2.0.0](https://semver.org) standard. This standard is useful |
| 201 |
because its version numbers and the way they change convey meaning about the |
| 202 |
underlying code and what has been modified from one version to the next. In |
| 203 |
addition, the %KIM API provides basic tools for comparing and parsing Semantic |
| 204 |
Version strings. |
| 205 |
|
| 206 |
|
| 207 |
Next Section: \ref theory. |
| 208 |
|
| 209 |
*/ |
| 210 |
|
| 211 |
LocalWords: yyyy Ellad Tadmor Karls kim api pimpl discoverable const ref |
| 212 |
LocalWords: DataType LanguageName SpeciesName LengthUnit EnergyUnit TimeUnit |
| 213 |
LocalWords: ChargeUnit TemperatureUnit ArgumentName CallbackName interatomic |
| 214 |
LocalWords: SupportStatus atomistic Versioning ComputeArgumentName PMI SMI SM |
| 215 |
LocalWords: ComputeCallbackName ModelBufferPointer SimulatorBufferPointer pmi |
| 216 |
LocalWords: programatic metadata SM's smi |