kim-api  2.1.1+v2.1.1.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
ex_model_Ar_P_Morse_07C.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"
45 #include <math.h>
46 #include <stdio.h>
47 #include <stdlib.h>
48 
49 #define TRUE 1
50 #define FALSE 0
51 
52 /******************************************************************************/
53 /* Below are the definitions and values of all Model parameters */
54 /******************************************************************************/
55 #define DIM 3 /* dimensionality of space */
56 #define SPECCODE 1 /* internal species code */
57 #define CUTOFF 8.15 /* Angstroms */
58 #define EPSILON -0.0134783698072604 /* eV */
59 #define PARAM_C 1.545 /* 1/Angstroms */
60 #define RZERO 3.786 /* Angstroms */
61 
62 /* Model buffer definition */
63 struct buffer
64 {
66  double cutoff;
68 };
69 typedef struct buffer buffer;
70 
71 /* Define prototype for Model create */
72 int model_create(KIM_ModelCreate * const modelCreate,
73  KIM_LengthUnit const requestedLengthUnit,
74  KIM_EnergyUnit const requestedEnergyUnit,
75  KIM_ChargeUnit const requestedChargeUnit,
76  KIM_TemperatureUnit const requestedTemperatureUnit,
77  KIM_TimeUnit const requestedTimeUnit);
78 
79 /* Define prototype for other routines */
80 
81 static int compute_arguments_create(
82  KIM_ModelCompute const * const modelCompute,
83  KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate);
84 static int
85 model_compute(KIM_ModelCompute const * const modelCompute,
86  KIM_ModelComputeArguments const * const modelComputeArguments);
87 static int compute_arguments_destroy(
88  KIM_ModelCompute const * const modelCompute,
89  KIM_ModelComputeArgumentsDestroy * const modelComputeArgumentsDestroy);
90 static int model_destroy(KIM_ModelDestroy * const modelDestroy);
91 
92 /* Define prototypes for pair potential calculations */
93 static void calc_phi(double * epsilon,
94  double * C,
95  double * Rzero,
96  double * shift,
97  double * cutoff,
98  double r,
99  double * phi);
100 
101 static void calc_phi_dphi(double * epsilon,
102  double * C,
103  double * Rzero,
104  double * shift,
105  double * cutoff,
106  double r,
107  double * phi,
108  double * dphi);
109 
110 static void calc_phi_d2phi(double * epsilon,
111  double * C,
112  double * Rzero,
113  double * shift,
114  double * cutoff,
115  double r,
116  double * phi,
117  double * dphi,
118  double * d2phi);
119 
120 /* Calculate pair potential phi(r) */
121 static void calc_phi(double * epsilon,
122  double * C,
123  double * Rzero,
124  double * shift,
125  double * cutoff,
126  double r,
127  double * phi)
128 {
129  /* local variables */
130  double ep;
131  double ep2;
132 
133  ep = exp(-(*C) * (r - *Rzero));
134  ep2 = ep * ep;
135 
136  if (r > *cutoff)
137  {
138  /* Argument exceeds cutoff radius */
139  *phi = 0.0;
140  }
141  else
142  {
143  *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
144  }
145 
146  return;
147 }
148 
149 /* Calculate pair potential phi(r) and its derivative dphi(r) */
150 static void calc_phi_dphi(double * epsilon,
151  double * C,
152  double * Rzero,
153  double * shift,
154  double * cutoff,
155  double r,
156  double * phi,
157  double * dphi)
158 {
159  /* local variables */
160  double ep;
161  double ep2;
162 
163  ep = exp(-(*C) * (r - *Rzero));
164  ep2 = ep * ep;
165 
166  if (r > *cutoff)
167  {
168  /* Argument exceeds cutoff radius */
169  *phi = 0.0;
170  *dphi = 0.0;
171  }
172  else
173  {
174  *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
175  *dphi = 2.0 * (*epsilon) * (*C) * (-ep + ep2);
176  }
177 
178  return;
179 }
180 
181 /* Calculate pair potential phi(r) and its 1st & 2nd derivatives dphi(r), */
182 /* d2phi(r) */
183 static void calc_phi_d2phi(double * epsilon,
184  double * C,
185  double * Rzero,
186  double * shift,
187  double * cutoff,
188  double r,
189  double * phi,
190  double * dphi,
191  double * d2phi)
192 {
193  /* local variables */
194  double ep;
195  double ep2;
196 
197  ep = exp(-(*C) * (r - *Rzero));
198  ep2 = ep * ep;
199 
200  if (r > *cutoff)
201  {
202  /* Argument exceeds cutoff radius */
203  *phi = 0.0;
204  *dphi = 0.0;
205  *d2phi = 0.0;
206  }
207  else
208  {
209  *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
210  *dphi = 2.0 * (*epsilon) * (*C) * (-ep + ep2);
211  *d2phi = 2.0 * (*epsilon) * (*C) * (*C) * (ep - 2.0 * ep2);
212  }
213 
214  return;
215 }
216 
217 /* compute function */
218 #undef KIM_LOGGER_FUNCTION_NAME
219 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
220 #undef KIM_LOGGER_OBJECT_NAME
221 #define KIM_LOGGER_OBJECT_NAME modelCompute
222 
223 static int
224 model_compute(KIM_ModelCompute const * const modelCompute,
225  KIM_ModelComputeArguments const * const modelComputeArguments)
226 {
227  /* local variables */
228  double R;
229  double R_pairs[2];
230  double * pR_pairs = &(R_pairs[0]);
231  double Rsqij;
232  double phi;
233  double dphi;
234  double d2phi;
235  double dEidr = 0.0;
236  double d2Eidr = 0.0;
237  double Rij[DIM];
238  double * pRij = &(Rij[0]);
239  double Rij_pairs[2][3];
240  double const * pRij_pairs = &(Rij_pairs[0][0]);
241  int ier;
242  int i;
243  int i_pairs[2];
244  int * pi_pairs = &(i_pairs[0]);
245  int j;
246  int j_pairs[2];
247  int * pj_pairs = &(j_pairs[0]);
248  int jj;
249  int k;
250  int const * neighListOfCurrentPart;
251  int comp_energy;
252  int comp_force;
253  int comp_particleEnergy;
254  int comp_process_dEdr;
255  int comp_process_d2Edr2;
256 
257  int * nParts;
258  int * particleSpeciesCodes;
259  int * particleContributing;
260  buffer * bufferPointer;
261  double * cutoff;
262  double cutsq;
263  double epsilon;
264  double C;
265  double Rzero;
266  double shift;
267  double * coords;
268  double * energy;
269  double * force;
270  double * particleEnergy;
271  int numOfPartNeigh;
272  double dummy;
273 
274  /* check to see if we have been asked to compute the forces, */
275  /* particleEnergy, and d1Edr */
276  LOG_INFORMATION("Checking if call backs are present.");
278  modelComputeArguments,
280  &comp_process_dEdr);
282  modelComputeArguments,
284  &comp_process_d2Edr2);
285 
286  LOG_INFORMATION("Getting data pointers");
288  modelComputeArguments,
290  &nParts)
292  modelComputeArguments,
294  &particleSpeciesCodes)
296  modelComputeArguments,
298  &particleContributing)
300  modelComputeArguments,
302  &coords)
304  modelComputeArguments,
306  &energy)
308  modelComputeArguments,
310  &force)
312  modelComputeArguments,
314  &particleEnergy);
315  if (ier)
316  {
317  LOG_ERROR("get data pointers failed");
318  return ier;
319  }
320 
321  comp_energy = (energy != NULL);
322  comp_force = (force != NULL);
323  comp_particleEnergy = (particleEnergy != NULL);
324 
325  /* set value of parameters */
327  (void **) &bufferPointer);
328  cutoff = &(bufferPointer->cutoff);
329  cutsq = (*cutoff) * (*cutoff);
330  epsilon = EPSILON;
331  C = PARAM_C;
332  Rzero = RZERO;
333  /* set value of parameter shift */
334  dummy = 0.0;
335  /* call calc_phi with r=cutoff and shift=0.0 */
336  calc_phi(&epsilon, &C, &Rzero, &dummy, cutoff, *cutoff, &shift);
337  /* set shift to -shift */
338  shift = -(shift);
339 
340  /* Check to be sure that the species are correct */
341 
342  ier = TRUE; /* assume an error */
343  for (i = 0; i < *nParts; ++i)
344  {
345  if (SPECCODE != particleSpeciesCodes[i])
346  {
347  LOG_ERROR("Unexpected species code detected");
348  return ier;
349  }
350  }
351  ier = FALSE; /* everything is ok */
352 
353  /* initialize potential energies, forces, and virial term */
354  LOG_INFORMATION("Initializing data");
355  if (comp_particleEnergy)
356  {
357  for (i = 0; i < *nParts; ++i) { particleEnergy[i] = 0.0; }
358  }
359  if (comp_energy) { *energy = 0.0; }
360 
361  if (comp_force)
362  {
363  for (i = 0; i < *nParts; ++i)
364  {
365  for (k = 0; k < DIM; ++k) { force[i * DIM + k] = 0.0; }
366  }
367  }
368 
369  /* Compute energy and forces */
370 
371  /* loop over particles and compute enregy and forces */
372  LOG_INFORMATION("Starting main compute loop");
373  for (i = 0; i < *nParts; ++i)
374  {
375  if (particleContributing[i])
376  {
377  ier = KIM_ModelComputeArguments_GetNeighborList(modelComputeArguments,
378  0,
379  i,
380  &numOfPartNeigh,
381  &neighListOfCurrentPart);
382  if (ier)
383  {
384  /* some sort of problem, exit */
385  LOG_ERROR("GetNeighborList failed");
386  ier = TRUE;
387  return ier;
388  }
389 
390  /* loop over the neighbors of particle i */
391  for (jj = 0; jj < numOfPartNeigh; ++jj)
392  {
393  j = neighListOfCurrentPart[jj]; /* get neighbor ID */
394 
395  if (!(particleContributing[j] && (j < i)))
396  {
397  /* short-circuit half-list */
398 
399  /* compute relative position vector and squared distance */
400  Rsqij = 0.0;
401  for (k = 0; k < DIM; ++k)
402  {
403  Rij[k] = coords[j * DIM + k] - coords[i * DIM + k];
404 
405  /* compute squared distance */
406  Rsqij += Rij[k] * Rij[k];
407  }
408 
409  /* compute energy and force */
410  if (Rsqij < cutsq)
411  {
412  /* particles are interacting ? */
413  R = sqrt(Rsqij);
414  if (comp_process_d2Edr2)
415  {
416  /* compute pair potential and its derivatives */
418  &epsilon, &C, &Rzero, &shift, cutoff, R, &phi, &dphi, &d2phi);
419 
420  /* compute dEidr */
421  if (particleContributing[j])
422  {
423  dEidr = dphi;
424  d2Eidr = d2phi;
425  }
426  else
427  {
428  dEidr = 0.5 * dphi;
429  d2Eidr = 0.5 * d2phi;
430  }
431  }
432  else if (comp_force || comp_process_dEdr)
433  {
434  /* compute pair potential and its derivative */
436  &epsilon, &C, &Rzero, &shift, cutoff, R, &phi, &dphi);
437 
438  /* compute dEidr */
439  if (particleContributing[j]) { dEidr = dphi; }
440  else
441  {
442  dEidr = 0.5 * dphi;
443  }
444  }
445  else
446  {
447  /* compute just pair potential */
448  calc_phi(&epsilon, &C, &Rzero, &shift, cutoff, R, &phi);
449  }
450 
451  /* contribution to energy */
452  if (comp_particleEnergy)
453  {
454  particleEnergy[i] += 0.5 * phi;
455  if (particleContributing[j]) { particleEnergy[j] += 0.5 * phi; }
456  }
457  if (comp_energy)
458  {
459  if (particleContributing[j]) { *energy += phi; }
460  else
461  {
462  *energy += 0.5 * phi;
463  }
464  }
465 
466  /* contribution to process_dEdr */
467  if (comp_process_dEdr)
468  {
470  modelComputeArguments, dEidr, R, pRij, i, j);
471  if (ier)
472  {
473  LOG_ERROR("ProcessDEDrTerm callback error");
474  ier = TRUE;
475  return ier;
476  }
477  }
478 
479  /* contribution to process_d2Edr2 */
480  if (comp_process_d2Edr2)
481  {
482  R_pairs[0] = R_pairs[1] = R;
483  Rij_pairs[0][0] = Rij_pairs[1][0] = Rij[0];
484  Rij_pairs[0][1] = Rij_pairs[1][1] = Rij[1];
485  Rij_pairs[0][2] = Rij_pairs[1][2] = Rij[2];
486  i_pairs[0] = i_pairs[1] = i;
487  j_pairs[0] = j_pairs[1] = j;
488 
490  modelComputeArguments,
491  d2Eidr,
492  pR_pairs,
493  pRij_pairs,
494  pi_pairs,
495  pj_pairs);
496  if (ier)
497  {
498  LOG_ERROR("ProcessDEDrTerm callback error");
499  ier = TRUE;
500  return ier;
501  }
502  }
503 
504  /* contribution to forces */
505  if (comp_force)
506  {
507  for (k = 0; k < DIM; ++k)
508  {
509  force[i * DIM + k]
510  += dEidr * Rij[k] / R; /* accumulate force on i */
511  force[j * DIM + k]
512  -= dEidr * Rij[k] / R; /* accumulate force on j */
513  }
514  }
515  }
516  } /* if (i < j) */
517  } /* loop on jj */
518  } /* if contributing */
519  } /* loop on i */
520  LOG_INFORMATION("Finished compute loop");
521 
522  /* everything is great */
523  ier = FALSE;
524 
525  return ier;
526 }
527 
528 /* Create function */
529 #undef KIM_LOGGER_FUNCTION_NAME
530 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCreate_LogEntry
531 #undef KIM_LOGGER_OBJECT_NAME
532 #define KIM_LOGGER_OBJECT_NAME modelCreate
533 
534 int model_create(KIM_ModelCreate * const modelCreate,
535  KIM_LengthUnit const requestedLengthUnit,
536  KIM_EnergyUnit const requestedEnergyUnit,
537  KIM_ChargeUnit const requestedChargeUnit,
538  KIM_TemperatureUnit const requestedTemperatureUnit,
539  KIM_TimeUnit const requestedTimeUnit)
540 {
541  buffer * bufferPointer;
542  int error;
543 
544  /* use function pointer definitions to verify prototypes */
551 
552  (void) create; /* avoid unused parameter warnings */
553  (void) requestedLengthUnit;
554  (void) requestedEnergyUnit;
555  (void) requestedChargeUnit;
556  (void) requestedTemperatureUnit;
557  (void) requestedTimeUnit;
558 
559  /* set units */
560  LOG_INFORMATION("Set model units");
561  error = KIM_ModelCreate_SetUnits(modelCreate, /* ignoring requested units */
567 
568  /* register species */
569  LOG_INFORMATION("Setting species code");
570  error = error
572  modelCreate, KIM_SPECIES_NAME_Ar, SPECCODE);
573 
574  /* register numbering */
575  LOG_INFORMATION("Setting model numbering");
576  error = error
577  || KIM_ModelCreate_SetModelNumbering(modelCreate,
579 
580  /* register function pointers */
581  LOG_INFORMATION("Register model function pointers");
582  error = error
584  modelCreate,
587  TRUE,
588  (KIM_Function *) CACreate)
589  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
592  TRUE,
593  (KIM_Function *) compute)
595  modelCreate,
598  TRUE,
599  (KIM_Function *) CADestroy)
600  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
603  TRUE,
604  (KIM_Function *) destroy);
605 
606  /* allocate buffer */
607  bufferPointer = (buffer *) malloc(sizeof(buffer));
608 
609  /* store model buffer in KIM object */
610  LOG_INFORMATION("Set influence distance and cutoffs");
611  KIM_ModelCreate_SetModelBufferPointer(modelCreate, bufferPointer);
612 
613  /* set buffer values */
614  bufferPointer->influenceDistance = CUTOFF;
615  bufferPointer->cutoff = CUTOFF;
617 
618  /* register influence distance */
620  modelCreate, &(bufferPointer->influenceDistance));
621 
622  /* register cutoff */
624  modelCreate,
625  1,
626  &(bufferPointer->cutoff),
628 
629  if (error)
630  {
631  free(bufferPointer);
632  LOG_ERROR("Unable to successfully initialize model");
633  return TRUE;
634  }
635  else
636  return FALSE;
637 }
638 
639 /* Destroy function */
640 #undef KIM_LOGGER_FUNCTION_NAME
641 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelDestroy_LogEntry
642 #undef KIM_LOGGER_OBJECT_NAME
643 #define KIM_LOGGER_OBJECT_NAME modelDestroy
644 
645 int model_destroy(KIM_ModelDestroy * const modelDestroy)
646 {
647  buffer * bufferPointer;
648 
649  LOG_INFORMATION("Getting buffer");
651  (void **) &bufferPointer);
652  LOG_INFORMATION("Freeing model memory");
653  free(bufferPointer);
654 
655  return FALSE;
656 }
657 
658 /* compute arguments create routine */
659 #undef KIM_LOGGER_FUNCTION_NAME
660 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
661 #undef KIM_LOGGER_OBJECT_NAME
662 #define KIM_LOGGER_OBJECT_NAME modelCompute
663 
665  KIM_ModelCompute const * const modelCompute,
666  KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate)
667 {
668  int error;
669 
670  (void) modelCompute; /* avoid unused parameter warning */
671 
672  /* register arguments */
673  LOG_INFORMATION("Register argument supportStatus");
675  modelComputeArgumentsCreate,
678  error = error
680  modelComputeArgumentsCreate,
683  error = error
685  modelComputeArgumentsCreate,
688 
689  /* register call backs */
690  LOG_INFORMATION("Register call back supportStatus");
691  error = error
693  modelComputeArgumentsCreate,
696  error = error
698  modelComputeArgumentsCreate,
701 
702  if (error)
703  {
704  LOG_ERROR("Unable to successfully initialize compute arguments");
705  return TRUE;
706  }
707  else
708  return FALSE;
709 }
710 
711 /* compute arguments destroy routine */
713  KIM_ModelCompute const * const modelCompute,
714  KIM_ModelComputeArgumentsDestroy * const modelComputeArgumentsDestroy)
715 {
716  (void) modelCompute; /* avoid unused parameter warning */
717  (void) modelComputeArgumentsDestroy; /* avoid unused parameter warning */
718 
719  /* Nothing further to do */
720 
721  return FALSE;
722 }
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.
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.
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)
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.
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.
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.
#define PARAM_C
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_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.
#define EPSILON
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...
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.
struct KIM_ModelDestroy KIM_ModelDestroy
Forward declaration.
KIM_TimeUnit const KIM_TIME_UNIT_unused
Indicates that a TimeUnit is not used.
static void calc_phi_dphi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi, double *dphi)
#define TRUE
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.
#define FALSE
void KIM_ModelCreate_SetModelBufferPointer(KIM_ModelCreate *const modelCreate, void *const ptr)
Set the Model&#39;s buffer pointer within the Model object.
static void calc_phi_d2phi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi, double *dphi, double *d2phi)
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.
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
static int compute_arguments_create(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate)
#define RZERO
#define CUTOFF
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.
static int model_compute(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArguments const *const modelComputeArguments)
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_ComputeArgumentsDestroy
The standard ComputeArgumentsDestroy routine.
static int compute_arguments_destroy(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsDestroy *const modelComputeArgumentsDestroy)
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
static void calc_phi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi)
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.
static int model_destroy(KIM_ModelDestroy *const modelDestroy)
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.
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.
#define DIM
struct KIM_ModelComputeArguments KIM_ModelComputeArguments
Forward declaration.
KIM_LengthUnit const KIM_LENGTH_UNIT_A
The standard angstrom unit of length.
#define SPECCODE
LogVerbosity const error
The standard error verbosity.
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.