Debian Codegraph @

docs/src/theory.txt

raw
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 theory Theory for the Portable Model Interface
34
35 Previous Section: \ref features.
36
37 \anchor energy_per_particle The %KIM API Portable Model Interface (PMI) is
38 concerned with "simulators" and "portable models" (PMs). Conceptually, a %KIM
39 PM is a subprogram that defines an energy-per-particle function, \f$E_i\f$, and
40 an "influence distance", \f$r_{\text{infl}}\f$, that identifies the particle
41 separation range over which \f$E_i\f$ depends on the position of its
42 neighboring particles. (Note, this is not necessarily equal to the neighbor
43 list cutoff radius used by a model.) A %KIM PM is defined for a specific
44 material system (a specific set of particle species: e.g., Al, Ni, and Cu) and
45 contains all parameter values necessary for evaluating \f$E_i\f$ for any
46 configuration containing particles of the supported species. A %KIM PM will,
47 typically, also have the ability to compute other quantities related to the
48 energy-per-particle, such as the force on a particle or the particle's virial.
49
50 Conceptually, a KIM-PMI-compliant simulator is a computer program that is
51 compatible with the %KIM API/PMI and performs a numerical simulation based on
52 the energy, forces, etc. of a set of particles. This could be a molecular
53 dynamics simulation, a Monte Carlo simulation, or other similar simulation
54 technique. Such a simulator treats a %KIM PM as a black box. It constructs an
55 atomistic "Configuration" of interest and passes this configuration to a %KIM
56 PM along with a list of quantities (energy, force, virial, etc.) to be
57 computed. The model then performs the requested computation and passes the
58 results back to the simulator. Once the simulator has received the model's
59 results it may use these values to advance its simulation and update the
60 atomistic configuration. Typically, this sequence of events is repeated in an
61 iterative process until the simulator determines it has reached convergence or
62 some other stopping condition is achieved.
63
64 The purpose of the %KIM API/PMI is to coordinate the information exchange
65 between KIM-compliant simulators and %KIM PMs. It does this through the
66 definition of various concepts and quantities, and by providing a set of
67 subroutines that facilitate the necessary communication between simulators and
68 PMs. A simulator supporting the %KIM API/PMI can work with all %KIM PMs (as
69 long as they can agree on units and the necessary species are supported by the
70 model) and vice versa.
71
72 Of central importance to the information exchange process is the definition of
73 an atomistic "Configuration", \f$\mathcal{C}\f$. Abstractly, a configuration
74 consists of a set of particles \f$C_p\f$ and their associated data. For each
75 particle \f$i \in C_p\f$, the following additional data must be defined.
76
77 -# The particle's species (H, He, Li, etc.).
78
79 -# The particle's position vector \f$\mathbf{r}^{(i)} = r^{(i)}_j
80 \mathbf{e}_j = r^{(i)}_1 \mathbf{e}_1 + r^{(i)}_2 \mathbf{e}_2 + r^{(i)}_3
81 \mathbf{e}_3,\f$ where \f$\mathbf{e}_j, \; j=1,2,3\f$ are unit vectors
82 along the global fixed Cartesian coordinate system \f$x\f$, \f$y\f$, and
83 \f$z\f$ directions, respectively.
84
85 -# The particle's "Contributing Status", which is either "contributing" or
86 "non-contributing". Non-contributing particles exist as part of the
87 configuration only to provide the proper environment for the contributing
88 particles. Thus, non-contributing particles (sometimes called "ghost" or
89 "padding" particles) can be thought of as providing the appropriate
90 boundary conditions for the configuration.
91
92 Before proceeding further, we introduce the notation \f$\mathbf{r}^{(i,j)}
93 \equiv \mathbf{r}^{(j)} - \mathbf{r}^{(i)}\f$ for the relative position vector
94 from particle \f$i\f$ to particle \f$j\f$, and the notation \f$r^{(i,j)}\f$ for
95 the magnitude of the vector \f$\mathbf{r}^{(i,j)}\f$. Note that \f$r^{(j,i)} =
96 r^{(i,j)}\f$ and these are simply two different notations for the same
97 quantity.
98
99 Returning to the definition and description of a configuration, a
100 configuration's set of particles may be partitioned into two disjoint sets: The
101 set of contributing particles \f$C_{cp}\f$, and the set of non-contributing
102 particles \f$C_{ncp}\f$. So that
103
104 \f[
105 C_{p} = C_{cp} \cup C_{ncp} \quad \text{and} \quad C_{cp} \cap C_{ncp}
106 = \emptyset.
107 \f]
108
109 For a particle \f$i \in C_p\f$, define the particle's ("punctured") influence
110 neighborhood, \f$\mathcal{N}^{(i)}_{r_\text{infl}}\f$, as the subset of
111 particles (not including the particle, itself) in the configuration that are
112 located no more than \f$r_{\text{infl}}\f$ away from particle \f$i\f$. That
113 is,
114
115 \f[
116 \mathcal{N}^{(i)}_{r_\text{infl}} \equiv \{ j \in C_p \;|\;
117 0 < r^{(i,j)} \le r_{\text{infl}} \}.
118 \f]
119
120 Finally, define the closure of the particle's influence neighborhood,
121 \f$\bar{\mathcal{N}}^{(i)}_{r_{\text{infl}}}\f$:
122
123 \f[
124 \bar{\mathcal{N}}^{(i)}_{r_{\text{infl}}} \equiv
125 \mathcal{N}^{(i)}_{r_{\text{infl}}} \cup
126 \{i\}.
127 \f]
128
129 With the above definitions, it is possible to more specifically identify the
130 functional dependence for a %KIM PM's energy-per-particle function, \f$E_i\f$:
131
132 \f[
133 E_i = \bar{E}_i(\mathbf{r}^{(j)} \;|\; j \in
134 \bar{\mathcal{N}}^{(i)}_{r_{\text{infl}}}).
135 \f]
136
137 In fact, due to the principle of material frame indifference, this function must
138 only be a function of the <em>distances</em> between these particles:
139
140 \f[
141 E_i = \tilde{E}_i( r^{(j,k)} \;|\; j,k \in
142 \bar{\mathcal{N}}^{(i)}_{r_{\text{infl}}})
143 .
144 \f]
145
146 Further, it is required that the energy-per-particle function is independent of
147 the particle numbering. That is, the value of the energy function cannot
148 depend on the order in which the particles are labeled with a unique
149 identification number.
150
151 It is usually most convenient to work with the function of position vectors,
152 \f$\bar{E}_i(\mathbf{r}^{(j)})\f$. However, in some cases it is advantageous
153 to work with the function of distances, \f$\tilde{E}_i(r^{(j,k)})\f$. When the
154 distinction is unimportant the unaccented notation, \f$E_i\f$, will be
155 used.
156
157 \anchor partial_energy Now a configuration's "Partial Energy" may be defined as
158 the sum of its contributing particles' energies:
159
160 \f[
161 E^\mathcal{C} = \sum_{i \in C_{cp}} E_i.
162 \f]
163
164 From this definition of the configuration's partial energy, a set of additional
165 quantities may be derived that are often of interest in simulations.
166
167 \anchor partial_particle_energy First, define formally, the configuration's
168 "Partial Particle Energy" for particle \f$i\f$, \f$E^{\mathcal{C}}_i\f$, as
169 simply the model's energy-per-particle value for contributing particles and
170 zero for non-contributing particles,
171
172 \f[
173 E^{\mathcal{C}}_i \equiv
174 \begin{cases}
175 E_i, & i \in C_{cp},\\
176 0, & i \in C_{ncp}.
177 \end{cases}
178 \f]
179
180 \anchor partial_forces Second, the configuration's "Partial Force" on particle
181 \f$j\f$, \f$\mathbf{f}^{\mathcal{C}(j)}\f$, is defined as the negative of the
182 derivative of the configuration's partial energy with respect to the particle's
183 position vector:
184
185 \f[
186 \mathbf{f}^{\mathcal{C}(j)} \equiv - \frac{\partial E^{\mathcal{C}}}{\partial
187 \mathbf{r}^{(j)}}, \quad j \in C_{p}.
188 \f]
189
190 Note that, in general, <em>every</em> particle (both contributing and
191 non-contributing) has a partial force.
192
193 \anchor partial_virial Third, the configuration's "Partial Virial" tensor,
194 \f$\mathbf{V}^{\mathcal{C}}\f$, is defined in terms of the partial forces:
195
196 \f[
197 \mathbf{V}^{\mathcal{C}} \equiv - \sum_{i \in C_{p}}
198 \mathbf{f}^{\mathcal{C}(i)} \otimes \mathbf{r}^{(i)}
199 =
200 \sum_{i \in C_{p}} \frac{\partial E^{\mathcal{C}}}{\partial \mathbf{r}^{(i)}}
201 \otimes \mathbf{r}^{(i)},
202 \f]
203
204 where \f$\otimes\f$ is the tensor product operation.
205
206 Although the partial virial tensor is given in terms of the absolute particle
207 positions, \f$\mathbf{r}^{(i)}\f$, it can be shown to be independent of the
208 coordinate origin. Indeed,
209
210 \f{align*}{
211 \mathbf{V}^{\mathcal{C}} =
212 \sum_{i \in C_{p}} \frac{\partial E^{\mathcal{C}}}{\partial \mathbf{r}^{(i)}}
213 \otimes \mathbf{r}^{(i)}
214 &=
215 \frac{1}{2} \left[
216 \sum_{i \in C_{p}}
217 \frac{\partial E^{\mathcal{C}}}{\partial \mathbf{r}^{(i)}}
218 \otimes \mathbf{r}^{(i)}
219 +
220 \sum_{j \in C_{p}}
221 \frac{\partial E^{\mathcal{C}}}{\partial \mathbf{r}^{(j)}}
222 \otimes \mathbf{r}^{(j)}
223 \right] \\
224 &=
225 \frac{1}{2} \left[
226 \sum_{i \in C_{p}} \sum_{j \in C_{p}}
227 \frac{\partial E^{\mathcal{C}}}{\partial r^{(i,j)}}
228 \frac{\partial r^{(i,j)}}{\partial \mathbf{r}^{(i)}}
229 \otimes \mathbf{r}^{(i)}
230 +
231 \sum_{j \in C_{p}} \sum_{i \in C_{p}}
232 \frac{\partial E^{\mathcal{C}}}{\partial {r}^{(i,j)}}
233 \frac{\partial r^{(i,j)}}{\partial \mathbf{r}^{(j)}}
234 \otimes \mathbf{r}^{(j)}
235 \right] \\
236 &=
237 \frac{1}{2} \left[
238 \sum_{i \in C_{p}} \sum_{j \in C_{p}}
239 \frac{\partial E^{\mathcal{C}}}{\partial r^{(i,j)}}
240 \frac{\mathbf{r}^{(i,j)}}{r^{(i,j)}}
241 \otimes \mathbf{r}^{(i)}
242 +
243 \sum_{j \in C_{p}} \sum_{i \in C_{p}}
244 \frac{\partial E^{\mathcal{C}}}{\partial {r}^{(i,j)}}
245 \frac{\mathbf{r}^{(j,i)}}{r^{(i,j)}}
246 \otimes \mathbf{r}^{(j)}
247 \right] \\
248 &=
249 \frac{1}{2} \left[
250 \sum_{i \in C_{p}} \sum_{j \in C_{p}}
251 \frac{\partial E^{\mathcal{C}}}{\partial r^{(i,j)}}
252 \frac{\mathbf{r}^{(i,j)}}{r^{(i,j)}}
253 \otimes \mathbf{r}^{(i)}
254 +
255 \sum_{j \in C_{p}} \sum_{i \in C_{p}}
256 \frac{\partial E^{\mathcal{C}}}{\partial {r}^{(i,j)}}
257 \left(-\frac{\mathbf{r}^{(i,j)}}{r^{(i,j)}}\right)
258 \otimes \mathbf{r}^{(j)}
259 \right] \\
260 &=
261 \frac{1}{2} \left[
262 \sum_{i \in C_{p}} \sum_{j \in C_{p}}
263 \frac{\partial E^{\mathcal{C}}}{\partial r^{(i,j)}}
264 \frac{\mathbf{r}^{(i,j)}}{r^{(i,j)}}
265 \otimes \left(\mathbf{r}^{(i)} - \mathbf{r}^{(j)}\right)
266 \right] \\
267 &=
268 \frac{1}{2} \left[
269 \sum_{i \in C_{p}} \sum_{j \in C_{p}}
270 \frac{\partial E^{\mathcal{C}}}{\partial r^{(i,j)}}
271 \frac{\mathbf{r}^{(i,j)}}{r^{(i,j)}}
272 \otimes \mathbf{r}^{(i,j)}
273 \right].
274 \f}
275
276 So, an equivalent definition for the virial tensor is
277
278 \f[
279 \mathbf{V}^{\mathcal{C}} \equiv
280 \sum_{i, j \in C_{p}}
281 \left(
282 \frac{1}{2 r^{(i,j)}} \frac{\partial E^{\mathcal{C}}}{\partial r^{(i,j)}}
283 \right)
284 \mathbf{r}^{(i,j)} \otimes \mathbf{r}^{(i,j)}.
285 \f]
286
287 \anchor partial_particle_virial It is common to partition the partial virial
288 into particle contributions, the "Partial Particle Virial" tensors
289 \f$\mathbf{V}^{\mathcal{C}(i)}\f$ such that
290
291 \f[
292 \mathbf{V}^{\mathcal{C}} = \sum_{i \in C_{p}}
293 \mathbf{V}^{\mathcal{C}(i)}.
294 \f]
295
296 However, this decomposition is not unique, and different definitions of the
297 particle virial tensor are found in the literature. For example, here are two
298 common definitions:
299
300 \f{gather*}{
301 \mathbf{V}^{\mathcal{C}(i)} \equiv \sum_{j \in C_{p}}
302 \left(
303 \frac{1}{2 r^{(i,j)}} \frac{\partial E^{\mathcal{C}}}{\partial r^{(i,j)}}
304 \right)
305 \mathbf{r}^{(i,j)} \otimes \mathbf{r}^{(i,j)};
306 &&
307 \mathbf{V}^{\mathcal{C}(i)} \equiv \sum_{j, k \in C_{p}}
308 \left(
309 \frac{1}{2 r^{(j,k)}}
310 \frac{\partial E^{\mathcal{C}}_i}{\partial r^{(j,k)}}
311 \right)
312 \mathbf{r}^{(j,k)} \otimes \mathbf{r}^{(j,k)}.
313 \f}
314
315 Notice, in the first definition the configuration's partial energy
316 \f$E^{\mathcal{C}}\f$ is used, whereas in the second definition the partial
317 particle energy \f$E^{\mathcal{C}}_i\f$ of particle \f$i\f$ is used. Further,
318 it is obvious by inspection that with these definitions the sum of partial
319 particle virial tensors equals the partial virial tensor.
320
321 Thus, the %KIM API/PMI does not impose a specific definition for a PM's partial
322 particle virial tensor. It simply requires that the PM's definition satisfies
323 the summation formula \f$\mathbf{V}^{\mathcal{C}} = \sum_{i \in C_{p}}
324 \mathbf{V}^{\mathcal{C}(i)}\f$.
325
326 ## Domain Decomposition
327
328 The definitions of a configuration's partial energy, forces, and virial are
329 designed to allow for easy (and low communication) parallel computation via
330 domain decomposition. This section presents a simple example that illustrates
331 how this works.
332
333 Start with a configuration of particles corresponding to a finite strip of a
334 centered square lattice.
335
336 \image html square-lattice-configuration-1.jpg
337 \image latex square-lattice-configuration-1.pdf
338
339 The total energy of the system, particle energy, the total force on each
340 particle, the total virial tensor, and the particle virial tensors can be
341 computed using a single configuration. In this case, the configuration is
342 \f$\mathcal{T}\f$, the set of particles is \f$T_p\f$, the set of contributing
343 particles is \f$T_{cp} = T_p\f$, and the set of non-contributing particles is
344 \f$T_{ncp}=\emptyset\f$. Then, the total energy is \f$E=E^\mathcal{T}\f$, the
345 particle energy is \f$E_i=E^{\mathcal{T}}_i\f$, the total force is
346 \f$\mathbf{f}^{(i)}=\mathbf{f}^{\mathcal{T}(i)}\f$, the total virial tensor is
347 \f$\mathbf{V} = \mathbf{V}^{\mathcal{T}}\f$, and the particle virial tensor
348 \f$\mathbf{V}^{(i)} = \mathbf{V}^{\mathcal{T}(i)}\f$. Next, it is shown how to
349 compute \f$E\f$, \f$E_i\f$, \f$\mathbf{f}^{(i)}\f$, \f$\mathbf{V}\f$,
350 and \f$\mathbf{V}^{(i)}\f$
351 using a decomposition into two domains.
352
353 Partition \f$T_p\f$ into two disjoint subsets, \f$A_p\f$ and \f$B_p\f$. That
354 is, \f$A_p \cap B_p = \emptyset\f$ and \f$A_p \cup B_p = T_p\f$.
355
356 \image html square-lattice-configuration-2.jpg
357 \image latex square-lattice-configuration-2.pdf
358
359
360 Next, define configuration \f$\mathcal{C}\f$ to have particles \f$C_p=T_p\f$
361 with \f$C_{cp}=A_p\f$ and \f$C_{ncp}=B_p\f$, and configuration
362 \f$\mathcal{D}\f$ to have particles \f$D_p=T_p\f$ with \f$D_{cp}=B_p\f$ and
363 \f$D_{ncp}=A_p\f$. (In practice, one can get away with including only those
364 non-contributing particles that fall within the "influence distance" of at
365 least one contributing particle.) Then, we can add up (or "assemble") the
366 values using the contributions from each domain
367
368 \f{align*}{
369 E &= E^\mathcal{C} + E^\mathcal{D},\\
370 \mathbf{f}^{(i)} &= \mathbf{f}^{\mathcal{C}(i)} +
371 \mathbf{f}^{\mathcal{D}(i)},\\
372 \mathbf{V} &= \mathbf{V}^{\mathcal{C}} +
373 \mathbf{V}^{\mathcal{D}}, \\
374 \mathbf{V}^{(i)} &= \mathbf{V}^{\mathcal{C}(i)} +
375 \mathbf{V}^{\mathcal{D}(i)}.
376 \f}
377
378 Here it becomes clear why the %KIM API/PMI prepends the term "Partial" to all
379 of its standard quantity names. In general, the quantities computed by a PM
380 are only one "partial" contribution to a total. For example, here we can say
381 that the force on particle \f$i\f$, \f$\mathbf{f}^{(i)}\f$, is the sum of
382 \f$\mathcal{C}\f$'s partial force \f$\mathbf{f}^{\mathcal{C}(i)}\f$ and
383 \f$\mathcal{D}\f$'s partial force \f$\mathbf{f}^{\mathcal{D}(i)}\f$.
384
385 For the particle energies, we can just take the value from the (only) domain
386 where the particle is contributing
387
388 \f[
389 E_i =
390 \begin{cases}
391 E^{\mathcal{C}}_i & \text{if $i \in C_{cp}$},\\
392 E^{\mathcal{D}}_i & \text{if $i \in D_{cp}$}.
393 \end{cases}
394 \f]
395
396 Next Section: \ref implementation.
397
398 */
399
400 LocalWords: yyyy Ellad Tadmor Karls kim api infl Ni Cu virial monte Li
401 LocalWords: carlo atomistic mathcal mathbf equiv ac cp ncp emptyset le otimes
402 LocalWords: unaccented html jpg pdf np ref em PMI PMs PM's