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