kim-api  2.1.4-git+v2.1.3-git-1-g7847914a.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 /* CDDL HEADER START */
3 /* */
4 /* The contents of this file are subject to the terms of the Common */
5 /* Development and Distribution License Version 1.0 (the "License"). */
6 /* */
7 /* You can obtain a copy of the license at */
8 /* http://www.opensource.org/licenses/CDDL-1.0. See the License for the */
9 /* specific language governing permissions and limitations under the License. */
10 /* */
11 /* When distributing Covered Code, include this CDDL HEADER in each file and */
12 /* include the License file in a prominent location with the name */
13 /* LICENSE.CDDL. If applicable, add the following below this CDDL HEADER, */
14 /* with the fields enclosed by brackets "[]" replaced with your own */
15 /* identifying information: */
16 /* */
17 /* Portions Copyright (c) [yyyy] [name of copyright owner]. */
18 /* All rights reserved. */
19 /* */
20 /* CDDL HEADER END */
21 /* */
22 
23 /* */
24 /* Copyright (c) 2013--2019, Regents of the University of Minnesota. */
25 /* All rights reserved. */
26 /* */
27 /* Contributors: */
28 /* Ryan S. Elliott */
29 /* Ellad B. Tadmor */
30 /* Stephen M. Whalen */
31 /* */
32 
33 /******************************************************************************/
34 /* */
35 /* ex_model_Ar_P_Morse_07C pair potential KIM Model */
36 /* shifted to have zero energy at the cutoff radius */
37 /* */
38 /* Language: C */
39 /* */
40 /******************************************************************************/
41 
42 
43 #include "KIM_LogMacros.h"
44 #include "KIM_ModelHeaders.h"
46 #include <math.h>
47 #include <stdio.h>
48 #include <stdlib.h>
49 #include <string.h>
50 
51 #define TRUE 1
52 #define FALSE 0
53 
54 /******************************************************************************/
55 /* Below are the definitions and values of all Model parameters */
56 /******************************************************************************/
57 #define DIM 3 /* dimensionality of space */
58 #define SPECCODE 1 /* internal species code */
59 #define CUTOFF 8.15 /* Angstroms */
60 #define EPSILON -0.0134783698072604 /* eV */
61 #define PARAM_C 1.545 /* 1/Angstroms */
62 #define RZERO 3.786 /* Angstroms */
63 
64 /* Model buffer definition */
65 struct buffer
66 {
67  double influenceDistance;
68  double cutoff;
70 };
71 typedef struct buffer buffer;
72 
73 /* Define prototype for Model create */
74 int model_create(KIM_ModelCreate * const modelCreate,
75  KIM_LengthUnit const requestedLengthUnit,
76  KIM_EnergyUnit const requestedEnergyUnit,
77  KIM_ChargeUnit const requestedChargeUnit,
78  KIM_TemperatureUnit const requestedTemperatureUnit,
79  KIM_TimeUnit const requestedTimeUnit);
80 
81 /* Define prototype for other routines */
82 
83 static int compute_arguments_create(
84  KIM_ModelCompute const * const modelCompute,
85  KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate);
86 static int
87 model_compute(KIM_ModelCompute const * const modelCompute,
88  KIM_ModelComputeArguments const * const modelComputeArguments);
89 static int model_extension(KIM_ModelExtension * const modelExtension,
90  void * const extensionStructure);
91 static int compute_arguments_destroy(
92  KIM_ModelCompute const * const modelCompute,
93  KIM_ModelComputeArgumentsDestroy * const modelComputeArgumentsDestroy);
94 static int model_destroy(KIM_ModelDestroy * const modelDestroy);
95 
96 /* Define prototypes for pair potential calculations */
97 static void calc_phi(double * epsilon,
98  double * C,
99  double * Rzero,
100  double * shift,
101  double * cutoff,
102  double r,
103  double * phi);
104 
105 static void calc_phi_dphi(double * epsilon,
106  double * C,
107  double * Rzero,
108  double * shift,
109  double * cutoff,
110  double r,
111  double * phi,
112  double * dphi);
113 
114 static void calc_phi_d2phi(double * epsilon,
115  double * C,
116  double * Rzero,
117  double * shift,
118  double * cutoff,
119  double r,
120  double * phi,
121  double * dphi,
122  double * d2phi);
123 
124 /* Calculate pair potential phi(r) */
125 static void calc_phi(double * epsilon,
126  double * C,
127  double * Rzero,
128  double * shift,
129  double * cutoff,
130  double r,
131  double * phi)
132 {
133  /* local variables */
134  double ep;
135  double ep2;
136 
137  ep = exp(-(*C) * (r - *Rzero));
138  ep2 = ep * ep;
139 
140  if (r > *cutoff)
141  {
142  /* Argument exceeds cutoff radius */
143  *phi = 0.0;
144  }
145  else
146  {
147  *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
148  }
149 
150  return;
151 }
152 
153 /* Calculate pair potential phi(r) and its derivative dphi(r) */
154 static void calc_phi_dphi(double * epsilon,
155  double * C,
156  double * Rzero,
157  double * shift,
158  double * cutoff,
159  double r,
160  double * phi,
161  double * dphi)
162 {
163  /* local variables */
164  double ep;
165  double ep2;
166 
167  ep = exp(-(*C) * (r - *Rzero));
168  ep2 = ep * ep;
169 
170  if (r > *cutoff)
171  {
172  /* Argument exceeds cutoff radius */
173  *phi = 0.0;
174  *dphi = 0.0;
175  }
176  else
177  {
178  *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
179  *dphi = 2.0 * (*epsilon) * (*C) * (-ep + ep2);
180  }
181 
182  return;
183 }
184 
185 /* Calculate pair potential phi(r) and its 1st & 2nd derivatives dphi(r), */
186 /* d2phi(r) */
187 static void calc_phi_d2phi(double * epsilon,
188  double * C,
189  double * Rzero,
190  double * shift,
191  double * cutoff,
192  double r,
193  double * phi,
194  double * dphi,
195  double * d2phi)
196 {
197  /* local variables */
198  double ep;
199  double ep2;
200 
201  ep = exp(-(*C) * (r - *Rzero));
202  ep2 = ep * ep;
203 
204  if (r > *cutoff)
205  {
206  /* Argument exceeds cutoff radius */
207  *phi = 0.0;
208  *dphi = 0.0;
209  *d2phi = 0.0;
210  }
211  else
212  {
213  *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
214  *dphi = 2.0 * (*epsilon) * (*C) * (-ep + ep2);
215  *d2phi = 2.0 * (*epsilon) * (*C) * (*C) * (ep - 2.0 * ep2);
216  }
217 
218  return;
219 }
220 
221 /* compute function */
222 #undef KIM_LOGGER_FUNCTION_NAME
223 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
224 #undef KIM_LOGGER_OBJECT_NAME
225 #define KIM_LOGGER_OBJECT_NAME modelCompute
226 
227 static int
228 model_compute(KIM_ModelCompute const * const modelCompute,
229  KIM_ModelComputeArguments const * const modelComputeArguments)
230 {
231  /* local variables */
232  double R;
233  double R_pairs[2];
234  double * pR_pairs = &(R_pairs[0]);
235  double Rsqij;
236  double phi;
237  double dphi;
238  double d2phi;
239  double dEidr = 0.0;
240  double d2Eidr = 0.0;
241  double Rij[DIM];
242  double * pRij = &(Rij[0]);
243  double Rij_pairs[2][3];
244  double const * pRij_pairs = &(Rij_pairs[0][0]);
245  int ier;
246  int i;
247  int i_pairs[2];
248  int * pi_pairs = &(i_pairs[0]);
249  int j;
250  int j_pairs[2];
251  int * pj_pairs = &(j_pairs[0]);
252  int jj;
253  int k;
254  int const * neighListOfCurrentPart;
255  int comp_energy;
256  int comp_force;
257  int comp_particleEnergy;
258  int comp_process_dEdr;
259  int comp_process_d2Edr2;
260 
261  int * nParts;
262  int * particleSpeciesCodes;
263  int * particleContributing;
264  buffer * bufferPointer;
265  double * cutoff;
266  double cutsq;
267  double epsilon;
268  double C;
269  double Rzero;
270  double shift;
271  double * coords;
272  double * energy;
273  double * force;
274  double * particleEnergy;
275  int numOfPartNeigh;
276  double dummy;
277 
278  /* check to see if we have been asked to compute the forces, */
279  /* particleEnergy, and d1Edr */
280  LOG_INFORMATION("Checking if call backs are present.");
282  modelComputeArguments,
284  &comp_process_dEdr);
286  modelComputeArguments,
288  &comp_process_d2Edr2);
289 
290  LOG_INFORMATION("Getting data pointers");
292  modelComputeArguments,
294  &nParts)
296  modelComputeArguments,
298  &particleSpeciesCodes)
300  modelComputeArguments,
302  &particleContributing)
304  modelComputeArguments,
306  &coords)
308  modelComputeArguments,
310  &energy)
312  modelComputeArguments,
314  &force)
316  modelComputeArguments,
318  &particleEnergy);
319  if (ier)
320  {
321  LOG_ERROR("get data pointers failed");
322  return ier;
323  }
324 
325  comp_energy = (energy != NULL);
326  comp_force = (force != NULL);
327  comp_particleEnergy = (particleEnergy != NULL);
328 
329  /* set value of parameters */
331  (void **) &bufferPointer);
332  cutoff = &(bufferPointer->cutoff);
333  cutsq = (*cutoff) * (*cutoff);
334  epsilon = EPSILON;
335  C = PARAM_C;
336  Rzero = RZERO;
337  /* set value of parameter shift */
338  dummy = 0.0;
339  /* call calc_phi with r=cutoff and shift=0.0 */
340  calc_phi(&epsilon, &C, &Rzero, &dummy, cutoff, *cutoff, &shift);
341  /* set shift to -shift */
342  shift = -(shift);
343 
344  /* Check to be sure that the species are correct */
345 
346  ier = TRUE; /* assume an error */
347  for (i = 0; i < *nParts; ++i)
348  {
349  if (SPECCODE != particleSpeciesCodes[i])
350  {
351  LOG_ERROR("Unexpected species code detected");
352  return ier;
353  }
354  }
355  ier = FALSE; /* everything is ok */
356 
357  /* initialize potential energies, forces, and virial term */
358  LOG_INFORMATION("Initializing data");
359  if (comp_particleEnergy)
360  {
361  for (i = 0; i < *nParts; ++i) { particleEnergy[i] = 0.0; }
362  }
363  if (comp_energy) { *energy = 0.0; }
364 
365  if (comp_force)
366  {
367  for (i = 0; i < *nParts; ++i)
368  {
369  for (k = 0; k < DIM; ++k) { force[i * DIM + k] = 0.0; }
370  }
371  }
372 
373  /* Compute energy and forces */
374 
375  /* loop over particles and compute enregy and forces */
376  LOG_INFORMATION("Starting main compute loop");
377  for (i = 0; i < *nParts; ++i)
378  {
379  if (particleContributing[i])
380  {
381  ier = KIM_ModelComputeArguments_GetNeighborList(modelComputeArguments,
382  0,
383  i,
384  &numOfPartNeigh,
385  &neighListOfCurrentPart);
386  if (ier)
387  {
388  /* some sort of problem, exit */
389  LOG_ERROR("GetNeighborList failed");
390  ier = TRUE;
391  return ier;
392  }
393 
394  /* loop over the neighbors of particle i */
395  for (jj = 0; jj < numOfPartNeigh; ++jj)
396  {
397  j = neighListOfCurrentPart[jj]; /* get neighbor ID */
398 
399  if (!(particleContributing[j] && (j < i)))
400  {
401  /* short-circuit half-list */
402 
403  /* compute relative position vector and squared distance */
404  Rsqij = 0.0;
405  for (k = 0; k < DIM; ++k)
406  {
407  Rij[k] = coords[j * DIM + k] - coords[i * DIM + k];
408 
409  /* compute squared distance */
410  Rsqij += Rij[k] * Rij[k];
411  }
412 
413  /* compute energy and force */
414  if (Rsqij < cutsq)
415  {
416  /* particles are interacting ? */
417  R = sqrt(Rsqij);
418  if (comp_process_d2Edr2)
419  {
420  /* compute pair potential and its derivatives */
422  &epsilon, &C, &Rzero, &shift, cutoff, R, &phi, &dphi, &d2phi);
423 
424  /* compute dEidr */
425  if (particleContributing[j])
426  {
427  dEidr = dphi;
428  d2Eidr = d2phi;
429  }
430  else
431  {
432  dEidr = 0.5 * dphi;
433  d2Eidr = 0.5 * d2phi;
434  }
435  }
436  else if (comp_force || comp_process_dEdr)
437  {
438  /* compute pair potential and its derivative */
440  &epsilon, &C, &Rzero, &shift, cutoff, R, &phi, &dphi);
441 
442  /* compute dEidr */
443  if (particleContributing[j]) { dEidr = dphi; }
444  else
445  {
446  dEidr = 0.5 * dphi;
447  }
448  }
449  else
450  {
451  /* compute just pair potential */
452  calc_phi(&epsilon, &C, &Rzero, &shift, cutoff, R, &phi);
453  }
454 
455  /* contribution to energy */
456  if (comp_particleEnergy)
457  {
458  particleEnergy[i] += 0.5 * phi;
459  if (particleContributing[j]) { particleEnergy[j] += 0.5 * phi; }
460  }
461  if (comp_energy)
462  {
463  if (particleContributing[j]) { *energy += phi; }
464  else
465  {
466  *energy += 0.5 * phi;
467  }
468  }
469 
470  /* contribution to process_dEdr */
471  if (comp_process_dEdr)
472  {
474  modelComputeArguments, dEidr, R, pRij, i, j);
475  if (ier)
476  {
477  LOG_ERROR("ProcessDEDrTerm callback error");
478  ier = TRUE;
479  return ier;
480  }
481  }
482 
483  /* contribution to process_d2Edr2 */
484  if (comp_process_d2Edr2)
485  {
486  R_pairs[0] = R_pairs[1] = R;
487  Rij_pairs[0][0] = Rij_pairs[1][0] = Rij[0];
488  Rij_pairs[0][1] = Rij_pairs[1][1] = Rij[1];
489  Rij_pairs[0][2] = Rij_pairs[1][2] = Rij[2];
490  i_pairs[0] = i_pairs[1] = i;
491  j_pairs[0] = j_pairs[1] = j;
492 
494  modelComputeArguments,
495  d2Eidr,
496  pR_pairs,
497  pRij_pairs,
498  pi_pairs,
499  pj_pairs);
500  if (ier)
501  {
502  LOG_ERROR("ProcessDEDrTerm callback error");
503  ier = TRUE;
504  return ier;
505  }
506  }
507 
508  /* contribution to forces */
509  if (comp_force)
510  {
511  for (k = 0; k < DIM; ++k)
512  {
513  force[i * DIM + k]
514  += dEidr * Rij[k] / R; /* accumulate force on i */
515  force[j * DIM + k]
516  -= dEidr * Rij[k] / R; /* accumulate force on j */
517  }
518  }
519  }
520  } /* if (i < j) */
521  } /* loop on jj */
522  } /* if contributing */
523  } /* loop on i */
524  LOG_INFORMATION("Finished compute loop");
525 
526  /* everything is great */
527  ier = FALSE;
528 
529  return ier;
530 }
531 
532 /* Extension function */
533 #undef KIM_LOGGER_FUNCTION_NAME
534 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelExtension_LogEntry
535 #undef KIM_LOGGER_OBJECT_NAME
536 #define KIM_LOGGER_OBJECT_NAME modelExtension
537 static int model_extension(KIM_ModelExtension * const modelExtension,
538  void * const extensionStructure)
539 {
540  char const * extensionID;
541  KIM_SupportedExtensions * supportedExtensions;
542 
543  KIM_ModelExtension_GetExtensionID(modelExtension, &extensionID);
544 
545  if (strcmp(extensionID, KIM_SUPPORTED_EXTENSIONS_ID) == 0)
546  {
547  supportedExtensions = (KIM_SupportedExtensions *) extensionStructure;
548 
549  supportedExtensions->numberOfSupportedExtensions = 2;
550  strcpy(supportedExtensions->supportedExtensionID[0],
552  supportedExtensions->supportedExtensionRequired[0] = 0;
553 
554  strcpy(supportedExtensions->supportedExtensionID[1], "Fake_Extension");
555  supportedExtensions->supportedExtensionRequired[1] = 0;
556 
557  return FALSE;
558  }
559  else
560  {
561  LOG_ERROR("Unknown ExtensionID.");
562  return TRUE;
563  }
564 }
565 
566 /* Create function */
567 #undef KIM_LOGGER_FUNCTION_NAME
568 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCreate_LogEntry
569 #undef KIM_LOGGER_OBJECT_NAME
570 #define KIM_LOGGER_OBJECT_NAME modelCreate
571 
572 int model_create(KIM_ModelCreate * const modelCreate,
573  KIM_LengthUnit const requestedLengthUnit,
574  KIM_EnergyUnit const requestedEnergyUnit,
575  KIM_ChargeUnit const requestedChargeUnit,
576  KIM_TemperatureUnit const requestedTemperatureUnit,
577  KIM_TimeUnit const requestedTimeUnit)
578 {
579  buffer * bufferPointer;
580  int error;
581 
582  /* use function pointer definitions to verify prototypes */
590 
591  (void) create; /* avoid unused parameter warnings */
592  (void) requestedLengthUnit;
593  (void) requestedEnergyUnit;
594  (void) requestedChargeUnit;
595  (void) requestedTemperatureUnit;
596  (void) requestedTimeUnit;
597 
598  /* set units */
599  LOG_INFORMATION("Set model units");
600  error = KIM_ModelCreate_SetUnits(modelCreate, /* ignoring requested units */
606 
607  /* register species */
608  LOG_INFORMATION("Setting species code");
609  error = error
611  modelCreate, KIM_SPECIES_NAME_Ar, SPECCODE);
612 
613  /* register numbering */
614  LOG_INFORMATION("Setting model numbering");
615  error = error
616  || KIM_ModelCreate_SetModelNumbering(modelCreate,
618 
619  /* register function pointers */
620  LOG_INFORMATION("Register model function pointers");
621  error = error
623  modelCreate,
626  TRUE,
627  (KIM_Function *) CACreate)
628  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
631  TRUE,
632  (KIM_Function *) compute)
633  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
636  FALSE,
637  (KIM_Function *) extension)
639  modelCreate,
642  TRUE,
643  (KIM_Function *) CADestroy)
644  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
647  TRUE,
648  (KIM_Function *) destroy);
649 
650  /* allocate buffer */
651  bufferPointer = (buffer *) malloc(sizeof(buffer));
652 
653  /* store model buffer in KIM object */
654  LOG_INFORMATION("Set influence distance and cutoffs");
655  KIM_ModelCreate_SetModelBufferPointer(modelCreate, bufferPointer);
656 
657  /* set buffer values */
658  bufferPointer->influenceDistance = CUTOFF;
659  bufferPointer->cutoff = CUTOFF;
661 
662  /* register influence distance */
664  modelCreate, &(bufferPointer->influenceDistance));
665 
666  /* register cutoff */
668  modelCreate,
669  1,
670  &(bufferPointer->cutoff),
672 
673  if (error)
674  {
675  free(bufferPointer);
676  LOG_ERROR("Unable to successfully initialize model");
677  return TRUE;
678  }
679  else
680  return FALSE;
681 }
682 
683 /* Destroy function */
684 #undef KIM_LOGGER_FUNCTION_NAME
685 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelDestroy_LogEntry
686 #undef KIM_LOGGER_OBJECT_NAME
687 #define KIM_LOGGER_OBJECT_NAME modelDestroy
688 
689 int model_destroy(KIM_ModelDestroy * const modelDestroy)
690 {
691  buffer * bufferPointer;
692 
693  LOG_INFORMATION("Getting buffer");
695  (void **) &bufferPointer);
696  LOG_INFORMATION("Freeing model memory");
697  free(bufferPointer);
698 
699  return FALSE;
700 }
701 
702 /* compute arguments create routine */
703 #undef KIM_LOGGER_FUNCTION_NAME
704 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
705 #undef KIM_LOGGER_OBJECT_NAME
706 #define KIM_LOGGER_OBJECT_NAME modelCompute
707 
709  KIM_ModelCompute const * const modelCompute,
710  KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate)
711 {
712  int error;
713 
714  (void) modelCompute; /* avoid unused parameter warning */
715 
716  /* register arguments */
717  LOG_INFORMATION("Register argument supportStatus");
719  modelComputeArgumentsCreate,
722  error = error
724  modelComputeArgumentsCreate,
727  error = error
729  modelComputeArgumentsCreate,
732 
733  /* register call backs */
734  LOG_INFORMATION("Register call back supportStatus");
735  error = error
737  modelComputeArgumentsCreate,
740  error = error
742  modelComputeArgumentsCreate,
745 
746  if (error)
747  {
748  LOG_ERROR("Unable to successfully initialize compute arguments");
749  return TRUE;
750  }
751  else
752  return FALSE;
753 }
754 
755 /* compute arguments destroy routine */
757  KIM_ModelCompute const * const modelCompute,
758  KIM_ModelComputeArgumentsDestroy * const modelComputeArgumentsDestroy)
759 {
760  (void) modelCompute; /* avoid unused parameter warning */
761  (void) modelComputeArgumentsDestroy; /* avoid unused parameter warning */
762 
763  /* Nothing further to do */
764 
765  return FALSE;
766 }
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:46
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.