kim-api 2.3.0+AppleClang.AppleClang.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
Loading...
Searching...
No Matches
ex_model_Ar_P_Morse_07C.c
Go to the documentation of this file.
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/* Stephen M. Whalen */
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/* */
30/* ex_model_Ar_P_Morse_07C pair potential KIM Model */
31/* shifted to have zero energy at the cutoff radius */
32/* */
33/* Language: C */
34/* */
35/******************************************************************************/
36
37
38#include "KIM_LogMacros.h"
39#include "KIM_ModelHeaders.h"
40#include <math.h>
41#include <stdio.h>
42#include <stdlib.h>
43
44#define TRUE 1
45#define FALSE 0
46
47/******************************************************************************/
48/* Below are the definitions and values of all Model parameters */
49/******************************************************************************/
50#define DIM 3 /* dimensionality of space */
51#define SPECCODE 1 /* internal species code */
52#define CUTOFF 8.15 /* Angstroms */
53#define EPSILON -0.0134783698072604 /* eV */
54#define PARAM_C 1.545 /* 1/Angstroms */
55#define RZERO 3.786 /* Angstroms */
56
57/* Model buffer definition */
58struct buffer
59{
61 double cutoff;
63};
64typedef struct buffer buffer;
65
66/* Define prototype for Model create */
67int model_create(KIM_ModelCreate * const modelCreate,
68 KIM_LengthUnit const requestedLengthUnit,
69 KIM_EnergyUnit const requestedEnergyUnit,
70 KIM_ChargeUnit const requestedChargeUnit,
71 KIM_TemperatureUnit const requestedTemperatureUnit,
72 KIM_TimeUnit const requestedTimeUnit);
73
74/* Define prototype for other routines */
75
77 KIM_ModelCompute const * const modelCompute,
78 KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate);
79static int
80model_compute(KIM_ModelCompute const * const modelCompute,
81 KIM_ModelComputeArguments const * const modelComputeArguments);
83 KIM_ModelCompute const * const modelCompute,
84 KIM_ModelComputeArgumentsDestroy * const modelComputeArgumentsDestroy);
85static int model_destroy(KIM_ModelDestroy * const modelDestroy);
86
87/* Define prototypes for pair potential calculations */
88static void calc_phi(double * epsilon,
89 double * C,
90 double * Rzero,
91 double * shift,
92 double * cutoff,
93 double r,
94 double * phi);
95
96static void calc_phi_dphi(double * epsilon,
97 double * C,
98 double * Rzero,
99 double * shift,
100 double * cutoff,
101 double r,
102 double * phi,
103 double * dphi);
104
105static void calc_phi_d2phi(double * epsilon,
106 double * C,
107 double * Rzero,
108 double * shift,
109 double * cutoff,
110 double r,
111 double * phi,
112 double * dphi,
113 double * d2phi);
114
115/* Calculate pair potential phi(r) */
116static void calc_phi(double * epsilon,
117 double * C,
118 double * Rzero,
119 double * shift,
120 double * cutoff,
121 double r,
122 double * phi)
123{
124 /* local variables */
125 double ep;
126 double ep2;
127
128 ep = exp(-(*C) * (r - *Rzero));
129 ep2 = ep * ep;
130
131 if (r > *cutoff)
132 {
133 /* Argument exceeds cutoff radius */
134 *phi = 0.0;
135 }
136 else
137 {
138 *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
139 }
140
141 return;
142}
143
144/* Calculate pair potential phi(r) and its derivative dphi(r) */
145static void calc_phi_dphi(double * epsilon,
146 double * C,
147 double * Rzero,
148 double * shift,
149 double * cutoff,
150 double r,
151 double * phi,
152 double * dphi)
153{
154 /* local variables */
155 double ep;
156 double ep2;
157
158 ep = exp(-(*C) * (r - *Rzero));
159 ep2 = ep * ep;
160
161 if (r > *cutoff)
162 {
163 /* Argument exceeds cutoff radius */
164 *phi = 0.0;
165 *dphi = 0.0;
166 }
167 else
168 {
169 *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
170 *dphi = 2.0 * (*epsilon) * (*C) * (-ep + ep2);
171 }
172
173 return;
174}
175
176/* Calculate pair potential phi(r) and its 1st & 2nd derivatives dphi(r), */
177/* d2phi(r) */
178static void calc_phi_d2phi(double * epsilon,
179 double * C,
180 double * Rzero,
181 double * shift,
182 double * cutoff,
183 double r,
184 double * phi,
185 double * dphi,
186 double * d2phi)
187{
188 /* local variables */
189 double ep;
190 double ep2;
191
192 ep = exp(-(*C) * (r - *Rzero));
193 ep2 = ep * ep;
194
195 if (r > *cutoff)
196 {
197 /* Argument exceeds cutoff radius */
198 *phi = 0.0;
199 *dphi = 0.0;
200 *d2phi = 0.0;
201 }
202 else
203 {
204 *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
205 *dphi = 2.0 * (*epsilon) * (*C) * (-ep + ep2);
206 *d2phi = 2.0 * (*epsilon) * (*C) * (*C) * (ep - 2.0 * ep2);
207 }
208
209 return;
210}
211
212/* compute function */
213#undef KIM_LOGGER_FUNCTION_NAME
214#define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
215#undef KIM_LOGGER_OBJECT_NAME
216#define KIM_LOGGER_OBJECT_NAME modelCompute
217
218static int
219model_compute(KIM_ModelCompute const * const modelCompute,
220 KIM_ModelComputeArguments const * const modelComputeArguments)
221{
222 /* local variables */
223 double R;
224 double R_pairs[2];
225 double * pR_pairs = &(R_pairs[0]);
226 double Rsqij;
227 double phi;
228 double dphi;
229 double d2phi;
230 double dEidr = 0.0;
231 double d2Eidr = 0.0;
232 double Rij[DIM];
233 double * pRij = &(Rij[0]);
234 double Rij_pairs[2][3];
235 double const * pRij_pairs = &(Rij_pairs[0][0]);
236 int ier;
237 int i;
238 int i_pairs[2];
239 int * pi_pairs = &(i_pairs[0]);
240 int j;
241 int j_pairs[2];
242 int * pj_pairs = &(j_pairs[0]);
243 int jj;
244 int k;
245 int const * neighListOfCurrentPart;
246 int comp_energy;
247 int comp_force;
248 int comp_particleEnergy;
249 int comp_process_dEdr;
250 int comp_process_d2Edr2;
251
252 int * nParts;
253 int * particleSpeciesCodes;
254 int * particleContributing;
255 buffer * bufferPointer;
256 double * cutoff;
257 double cutsq;
258 double epsilon;
259 double C;
260 double Rzero;
261 double shift;
262 double * coords;
263 double * energy;
264 double * force;
265 double * particleEnergy;
266 int numOfPartNeigh;
267 double dummy;
268
269 /* check to see if we have been asked to compute the forces, */
270 /* particleEnergy, and d1Edr */
271 LOG_INFORMATION("Checking if call backs are present.");
273 modelComputeArguments,
275 &comp_process_dEdr);
277 modelComputeArguments,
279 &comp_process_d2Edr2);
280
281 LOG_INFORMATION("Getting data pointers");
283 modelComputeArguments,
285 &nParts)
287 modelComputeArguments,
289 &particleSpeciesCodes)
291 modelComputeArguments,
293 &particleContributing)
295 modelComputeArguments,
297 &coords)
299 modelComputeArguments,
301 &energy)
303 modelComputeArguments,
305 &force)
307 modelComputeArguments,
309 &particleEnergy);
310 if (ier)
311 {
312 LOG_ERROR("get data pointers failed");
313 return ier;
314 }
315
316 comp_energy = (energy != NULL);
317 comp_force = (force != NULL);
318 comp_particleEnergy = (particleEnergy != NULL);
319
320 /* set value of parameters */
322 (void **) &bufferPointer);
323 cutoff = &(bufferPointer->cutoff);
324 cutsq = (*cutoff) * (*cutoff);
325 epsilon = EPSILON;
326 C = PARAM_C;
327 Rzero = RZERO;
328 /* set value of parameter shift */
329 dummy = 0.0;
330 /* call calc_phi with r=cutoff and shift=0.0 */
331 calc_phi(&epsilon, &C, &Rzero, &dummy, cutoff, *cutoff, &shift);
332 /* set shift to -shift */
333 shift = -(shift);
334
335 /* Check to be sure that the species are correct */
336
337 ier = TRUE; /* assume an error */
338 for (i = 0; i < *nParts; ++i)
339 {
340 if (SPECCODE != particleSpeciesCodes[i])
341 {
342 LOG_ERROR("Unexpected species code detected");
343 return ier;
344 }
345 }
346 ier = FALSE; /* everything is ok */
347
348 /* initialize potential energies, forces, and virial term */
349 LOG_INFORMATION("Initializing data");
350 if (comp_particleEnergy)
351 {
352 for (i = 0; i < *nParts; ++i) { particleEnergy[i] = 0.0; }
353 }
354 if (comp_energy) { *energy = 0.0; }
355
356 if (comp_force)
357 {
358 for (i = 0; i < *nParts; ++i)
359 {
360 for (k = 0; k < DIM; ++k) { force[i * DIM + k] = 0.0; }
361 }
362 }
363
364 /* Compute energy and forces */
365
366 /* loop over particles and compute enregy and forces */
367 LOG_INFORMATION("Starting main compute loop");
368 for (i = 0; i < *nParts; ++i)
369 {
370 if (particleContributing[i])
371 {
372 ier = KIM_ModelComputeArguments_GetNeighborList(modelComputeArguments,
373 0,
374 i,
375 &numOfPartNeigh,
376 &neighListOfCurrentPart);
377 if (ier)
378 {
379 /* some sort of problem, exit */
380 LOG_ERROR("GetNeighborList failed");
381 ier = TRUE;
382 return ier;
383 }
384
385 /* loop over the neighbors of particle i */
386 for (jj = 0; jj < numOfPartNeigh; ++jj)
387 {
388 j = neighListOfCurrentPart[jj]; /* get neighbor ID */
389
390 if (!(particleContributing[j] && (j < i)))
391 {
392 /* short-circuit half-list */
393
394 /* compute relative position vector and squared distance */
395 Rsqij = 0.0;
396 for (k = 0; k < DIM; ++k)
397 {
398 Rij[k] = coords[j * DIM + k] - coords[i * DIM + k];
399
400 /* compute squared distance */
401 Rsqij += Rij[k] * Rij[k];
402 }
403
404 /* compute energy and force */
405 if (Rsqij < cutsq)
406 {
407 /* particles are interacting ? */
408 R = sqrt(Rsqij);
409 if (comp_process_d2Edr2)
410 {
411 /* compute pair potential and its derivatives */
413 &epsilon, &C, &Rzero, &shift, cutoff, R, &phi, &dphi, &d2phi);
414
415 /* compute dEidr */
416 if (particleContributing[j])
417 {
418 dEidr = dphi;
419 d2Eidr = d2phi;
420 }
421 else
422 {
423 dEidr = 0.5 * dphi;
424 d2Eidr = 0.5 * d2phi;
425 }
426 }
427 else if (comp_force || comp_process_dEdr)
428 {
429 /* compute pair potential and its derivative */
431 &epsilon, &C, &Rzero, &shift, cutoff, R, &phi, &dphi);
432
433 /* compute dEidr */
434 if (particleContributing[j]) { dEidr = dphi; }
435 else
436 {
437 dEidr = 0.5 * dphi;
438 }
439 }
440 else
441 {
442 /* compute just pair potential */
443 calc_phi(&epsilon, &C, &Rzero, &shift, cutoff, R, &phi);
444 }
445
446 /* contribution to energy */
447 if (comp_particleEnergy)
448 {
449 particleEnergy[i] += 0.5 * phi;
450 if (particleContributing[j]) { particleEnergy[j] += 0.5 * phi; }
451 }
452 if (comp_energy)
453 {
454 if (particleContributing[j]) { *energy += phi; }
455 else
456 {
457 *energy += 0.5 * phi;
458 }
459 }
460
461 /* contribution to process_dEdr */
462 if (comp_process_dEdr)
463 {
465 modelComputeArguments, dEidr, R, pRij, i, j);
466 if (ier)
467 {
468 LOG_ERROR("ProcessDEDrTerm callback error");
469 ier = TRUE;
470 return ier;
471 }
472 }
473
474 /* contribution to process_d2Edr2 */
475 if (comp_process_d2Edr2)
476 {
477 R_pairs[0] = R_pairs[1] = R;
478 Rij_pairs[0][0] = Rij_pairs[1][0] = Rij[0];
479 Rij_pairs[0][1] = Rij_pairs[1][1] = Rij[1];
480 Rij_pairs[0][2] = Rij_pairs[1][2] = Rij[2];
481 i_pairs[0] = i_pairs[1] = i;
482 j_pairs[0] = j_pairs[1] = j;
483
485 modelComputeArguments,
486 d2Eidr,
487 pR_pairs,
488 pRij_pairs,
489 pi_pairs,
490 pj_pairs);
491 if (ier)
492 {
493 LOG_ERROR("ProcessDEDrTerm callback error");
494 ier = TRUE;
495 return ier;
496 }
497 }
498
499 /* contribution to forces */
500 if (comp_force)
501 {
502 for (k = 0; k < DIM; ++k)
503 {
504 force[i * DIM + k]
505 += dEidr * Rij[k] / R; /* accumulate force on i */
506 force[j * DIM + k]
507 -= dEidr * Rij[k] / R; /* accumulate force on j */
508 }
509 }
510 }
511 } /* if (i < j) */
512 } /* loop on jj */
513 } /* if contributing */
514 } /* loop on i */
515 LOG_INFORMATION("Finished compute loop");
516
517 /* everything is great */
518 ier = FALSE;
519
520 return ier;
521}
522
523/* Create function */
524#undef KIM_LOGGER_FUNCTION_NAME
525#define KIM_LOGGER_FUNCTION_NAME KIM_ModelCreate_LogEntry
526#undef KIM_LOGGER_OBJECT_NAME
527#define KIM_LOGGER_OBJECT_NAME modelCreate
528
529int model_create(KIM_ModelCreate * const modelCreate,
530 KIM_LengthUnit const requestedLengthUnit,
531 KIM_EnergyUnit const requestedEnergyUnit,
532 KIM_ChargeUnit const requestedChargeUnit,
533 KIM_TemperatureUnit const requestedTemperatureUnit,
534 KIM_TimeUnit const requestedTimeUnit)
535{
536 buffer * bufferPointer;
537 int error;
538
539 /* use function pointer definitions to verify prototypes */
546
547 (void) create; /* avoid unused parameter warnings */
548 (void) requestedLengthUnit;
549 (void) requestedEnergyUnit;
550 (void) requestedChargeUnit;
551 (void) requestedTemperatureUnit;
552 (void) requestedTimeUnit;
553
554 /* set units */
555 LOG_INFORMATION("Set model units");
556 error = KIM_ModelCreate_SetUnits(modelCreate, /* ignoring requested units */
562
563 /* register species */
564 LOG_INFORMATION("Setting species code");
565 error = error
567 modelCreate, KIM_SPECIES_NAME_Ar, SPECCODE);
568
569 /* register numbering */
570 LOG_INFORMATION("Setting model numbering");
571 error = error
574
575 /* register function pointers */
576 LOG_INFORMATION("Register model function pointers");
577 error = error
579 modelCreate,
582 TRUE,
583 (KIM_Function *) CACreate)
587 TRUE,
590 modelCreate,
593 TRUE,
594 (KIM_Function *) CADestroy)
598 TRUE,
599 (KIM_Function *) destroy);
600
601 /* allocate buffer */
602 bufferPointer = (buffer *) malloc(sizeof(buffer));
603
604 /* store model buffer in KIM object */
605 LOG_INFORMATION("Set influence distance and cutoffs");
606 KIM_ModelCreate_SetModelBufferPointer(modelCreate, bufferPointer);
607
608 /* set buffer values */
609 bufferPointer->influenceDistance = CUTOFF;
610 bufferPointer->cutoff = CUTOFF;
612
613 /* register influence distance */
615 modelCreate, &(bufferPointer->influenceDistance));
616
617 /* register cutoff */
619 modelCreate,
620 1,
621 &(bufferPointer->cutoff),
623
624 if (error)
625 {
626 free(bufferPointer);
627 LOG_ERROR("Unable to successfully initialize model");
628 return TRUE;
629 }
630 else
631 return FALSE;
632}
633
634/* Destroy function */
635#undef KIM_LOGGER_FUNCTION_NAME
636#define KIM_LOGGER_FUNCTION_NAME KIM_ModelDestroy_LogEntry
637#undef KIM_LOGGER_OBJECT_NAME
638#define KIM_LOGGER_OBJECT_NAME modelDestroy
639
640int model_destroy(KIM_ModelDestroy * const modelDestroy)
641{
642 buffer * bufferPointer;
643
644 LOG_INFORMATION("Getting buffer");
646 (void **) &bufferPointer);
647 LOG_INFORMATION("Freeing model memory");
648 free(bufferPointer);
649
650 return FALSE;
651}
652
653/* compute arguments create routine */
654#undef KIM_LOGGER_FUNCTION_NAME
655#define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
656#undef KIM_LOGGER_OBJECT_NAME
657#define KIM_LOGGER_OBJECT_NAME modelCompute
658
660 KIM_ModelCompute const * const modelCompute,
661 KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate)
662{
663 int error;
664
665 (void) modelCompute; /* avoid unused parameter warning */
666
667 /* register arguments */
668 LOG_INFORMATION("Register argument supportStatus");
670 modelComputeArgumentsCreate,
673 error = error
675 modelComputeArgumentsCreate,
678 error = error
680 modelComputeArgumentsCreate,
683
684 /* register call backs */
685 LOG_INFORMATION("Register call back supportStatus");
686 error = error
688 modelComputeArgumentsCreate,
691 error = error
693 modelComputeArgumentsCreate,
696
697 if (error)
698 {
699 LOG_ERROR("Unable to successfully initialize compute arguments");
700 return TRUE;
701 }
702 else
703 return FALSE;
704}
705
706/* compute arguments destroy routine */
708 KIM_ModelCompute const * const modelCompute,
709 KIM_ModelComputeArgumentsDestroy * const modelComputeArgumentsDestroy)
710{
711 (void) modelCompute; /* avoid unused parameter warning */
712 (void) modelComputeArgumentsDestroy; /* avoid unused parameter warning */
713
714 /* Nothing further to do */
715
716 return FALSE;
717}
KIM_ChargeUnit const KIM_CHARGE_UNIT_unused
Indicates that a ChargeUnit is not used.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_numberOfParticles
The standard numberOfParticles argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_particleContributing
The standard particleContributing argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_coordinates
The standard coordinates argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_particleSpeciesCodes
The standard particleSpeciesCodes argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_partialForces
The standard partialForces argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_partialParticleEnergy
The standard partialParticleEnergy argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_partialEnergy
The standard partialEnergy argument.
KIM_ComputeCallbackName const KIM_COMPUTE_CALLBACK_NAME_ProcessD2EDr2Term
The standard ProcessD2EDr2Term callback.
KIM_ComputeCallbackName const KIM_COMPUTE_CALLBACK_NAME_ProcessDEDrTerm
The standard ProcessDEDrTerm callback.
KIM_EnergyUnit const KIM_ENERGY_UNIT_eV
The standard electronvolt unit of energy.
int KIM_ModelComputeArgumentsCreateFunction(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate)
Prototype for MODEL_ROUTINE_NAME::ComputeArgumentsCreate routine.
int KIM_ModelDestroyFunction(KIM_ModelDestroy *const modelDestroy)
Prototype for MODEL_ROUTINE_NAME::Destroy routine.
struct KIM_ModelComputeArgumentsCreate KIM_ModelComputeArgumentsCreate
Forward declaration.
struct KIM_ModelComputeArgumentsDestroy KIM_ModelComputeArgumentsDestroy
Forward declaration.
struct KIM_ModelCreate KIM_ModelCreate
Forward declaration.
struct KIM_ModelDestroy KIM_ModelDestroy
Forward declaration.
struct KIM_ModelCompute KIM_ModelCompute
Forward declaration.
struct KIM_ModelComputeArguments KIM_ModelComputeArguments
Forward declaration.
void() KIM_Function(void)
Generic function type.
int KIM_ModelCreateFunction(KIM_ModelCreate *const modelCreate, KIM_LengthUnit const requestedLengthUnit, KIM_EnergyUnit const requestedEnergyUnit, KIM_ChargeUnit const requestedChargeUnit, KIM_TemperatureUnit const requestedTemperatureUnit, KIM_TimeUnit const requestedTimeUnit)
Prototype for MODEL_ROUTINE_NAME::Create routine.
int KIM_ModelComputeArgumentsDestroyFunction(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsDestroy *const modelComputeArgumentsDestroy)
Prototype for MODEL_ROUTINE_NAME::ComputeArgumentsDestroy routine.
int KIM_ModelComputeFunction(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArguments const *const modelComputeArguments)
Prototype for MODEL_ROUTINE_NAME::Compute routine.
KIM_LanguageName const KIM_LANGUAGE_NAME_c
The standard c language.
KIM_LengthUnit const KIM_LENGTH_UNIT_A
The standard angstrom unit of length.
#define LOG_ERROR(message)
Convenience macro for ERROR Log entries with compile-time optimization.
#define LOG_INFORMATION(message)
Convenience macro for INFORMATION Log entries with compile-time optimization.
void KIM_ModelCompute_GetModelBufferPointer(KIM_ModelCompute const *const modelCompute, void **const ptr)
Get the Model's buffer pointer within the Model object.
int KIM_ModelComputeArguments_GetNeighborList(KIM_ModelComputeArguments const *const modelComputeArguments, int const neighborListIndex, int const particleNumber, int *const numberOfNeighbors, int const **const neighborsOfParticle)
Get the neighbor list for a particle of interest corresponding to a particular neighbor list cutoff d...
int KIM_ModelComputeArguments_GetArgumentPointerInteger(KIM_ModelComputeArguments const *const modelComputeArguments, KIM_ComputeArgumentName const computeArgumentName, int **const ptr)
Get the data pointer for a ComputeArgumentName.
int KIM_ModelComputeArguments_GetArgumentPointerDouble(KIM_ModelComputeArguments const *const modelComputeArguments, KIM_ComputeArgumentName const computeArgumentName, double **const ptr)
Get the data pointer for a ComputeArgumentName.
int KIM_ModelComputeArguments_IsCallbackPresent(KIM_ModelComputeArguments const *const modelComputeArguments, KIM_ComputeCallbackName const computeCallbackName, int *const present)
Determine if the Simulator has provided a non-NULL function pointer for a ComputeCallbackName of inte...
int KIM_ModelComputeArguments_ProcessDEDrTerm(KIM_ModelComputeArguments const *const modelComputeArguments, double const de, double const r, double const *const dx, int const i, int const j)
Call the Simulator's COMPUTE_CALLBACK_NAME::ProcessDEDrTerm routine.
int KIM_ModelComputeArguments_ProcessD2EDr2Term(KIM_ModelComputeArguments const *const modelComputeArguments, double const de, double const *const r, double const *const dx, int const *const i, int const *const j)
Call the Simulator's COMPUTE_CALLBACK_NAME::ProcessD2EDr2Term routine.
int KIM_ModelComputeArgumentsCreate_SetCallbackSupportStatus(KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate, KIM_ComputeCallbackName const computeCallbackName, KIM_SupportStatus const supportStatus)
Set the SupportStatus of a ComputeCallbackName.
int KIM_ModelComputeArgumentsCreate_SetArgumentSupportStatus(KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate, KIM_ComputeArgumentName const computeArgumentName, KIM_SupportStatus const supportStatus)
Set the SupportStatus of a ComputeArgumentName.
int KIM_ModelCreate_SetSpeciesCode(KIM_ModelCreate *const modelCreate, KIM_SpeciesName const speciesName, int const code)
Set integer code for supported SpeciesName.
int KIM_ModelCreate_SetRoutinePointer(KIM_ModelCreate *const modelCreate, KIM_ModelRoutineName const modelRoutineName, KIM_LanguageName const languageName, int const required, KIM_Function *const fptr)
Set the function pointer for the ModelRoutineName of interest.
int KIM_ModelCreate_SetUnits(KIM_ModelCreate *const modelCreate, KIM_LengthUnit const lengthUnit, KIM_EnergyUnit const energyUnit, KIM_ChargeUnit const chargeUnit, KIM_TemperatureUnit const temperatureUnit, KIM_TimeUnit const timeUnit)
Set the Model's base unit values.
void KIM_ModelCreate_SetModelBufferPointer(KIM_ModelCreate *const modelCreate, void *const ptr)
Set the Model's buffer pointer within the Model object.
void KIM_ModelCreate_SetInfluenceDistancePointer(KIM_ModelCreate *const modelCreate, double const *const influenceDistance)
Set the Model's influence distance data pointer.
void KIM_ModelCreate_SetNeighborListPointers(KIM_ModelCreate *const modelCreate, int const numberOfNeighborLists, double const *const cutoffs, int const *const modelWillNotRequestNeighborsOfNoncontributingParticles)
Set the Model's neighbor list data pointers.
int KIM_ModelCreate_SetModelNumbering(KIM_ModelCreate *const modelCreate, KIM_Numbering const numbering)
Set the Model's particle Numbering.
void KIM_ModelDestroy_GetModelBufferPointer(KIM_ModelDestroy const *const modelDestroy, void **const ptr)
Get the Model's buffer pointer within the Model object.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_Destroy
The standard Destroy routine.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_Compute
The standard Compute routine.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_ComputeArgumentsCreate
The standard ComputeArgumentsCreate routine.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_ComputeArgumentsDestroy
The standard ComputeArgumentsDestroy routine.
KIM_Numbering const KIM_NUMBERING_zeroBased
The standard zeroBased numbering.
KIM_SpeciesName const KIM_SPECIES_NAME_Ar
The standard Argon species.
KIM_SupportStatus const KIM_SUPPORT_STATUS_optional
The standard optional status.
KIM_TemperatureUnit const KIM_TEMPERATURE_UNIT_unused
Indicates that a TemperatureUnit is not used.
KIM_TimeUnit const KIM_TIME_UNIT_unused
Indicates that a TimeUnit is not used.
#define EPSILON
#define PARAM_C
#define CUTOFF
static void calc_phi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi)
#define RZERO
static int model_compute(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArguments const *const modelComputeArguments)
static void calc_phi_d2phi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi, double *dphi, double *d2phi)
static int model_destroy(KIM_ModelDestroy *const modelDestroy)
#define TRUE
#define FALSE
#define DIM
static void calc_phi_dphi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi, double *dphi)
#define SPECCODE
int model_create(KIM_ModelCreate *const modelCreate, KIM_LengthUnit const requestedLengthUnit, KIM_EnergyUnit const requestedEnergyUnit, KIM_ChargeUnit const requestedChargeUnit, KIM_TemperatureUnit const requestedTemperatureUnit, KIM_TimeUnit const requestedTimeUnit)
An Extensible Enumeration for the ChargeUnit's supported by the KIM API.
An Extensible Enumeration for the EnergyUnit's supported by the KIM API.
An Extensible Enumeration for the LengthUnit's supported by the KIM API.
An Extensible Enumeration for the TemperatureUnit's supported by the KIM API.
An Extensible Enumeration for the TimeUnit's supported by the KIM API.
Definition: KIM_TimeUnit.h:42
int modelWillNotRequestNeighborsOfNoncontributingParticles
double influenceDistance