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