kim-api  2.1.4-git+v2.1.3-git-3-g4c859c7f.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
ex_model_Ar_P_Morse_MultiCutoff.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 #define NUMBER_OF_CUTOFFS 2
64 struct buffer
65 {
66  double influenceDistance;
67  double cutoff[NUMBER_OF_CUTOFFS];
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 static int
82 model_compute(KIM_ModelCompute const * const modelCompute,
83  KIM_ModelComputeArguments const * const modelComputeArguments);
84 static int compute_arguments_create(
85  KIM_ModelCompute const * const modelCompute,
86  KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate);
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 /* function to loop over particles */
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 int loops(KIM_ModelCompute const * const modelCompute,
224  KIM_ModelComputeArguments const * const modelComputeArguments,
225  int neighborListIndex,
226  int * nParts,
227  int * particleContributing,
228  double * energy,
229  double * particleEnergy,
230  double * force,
231  double * coords,
232  double cutsq,
233  double epsilon,
234  double C,
235  double Rzero,
236  double shift,
237  double * cutoff,
238  int comp_energy,
239  int comp_force,
240  int comp_particleEnergy,
241  int comp_process_dEdr,
242  int comp_process_d2Edr2)
243 {
244  int ier;
245  int i;
246  int numOfPartNeigh;
247  int const * neighListOfCurrentPart;
248  int jj;
249  int j;
250  double Rsqij;
251  int k;
252  double Rij[DIM];
253  double phi;
254  double dphi;
255  double d2phi;
256  double dEidr;
257  double d2Eidr;
258  double * pRij = &(Rij[0]);
259  double Rij_pairs[2][3];
260  double const * pRij_pairs = &(Rij_pairs[0][0]);
261  int i_pairs[2];
262  int * pi_pairs = &(i_pairs[0]);
263  int j_pairs[2];
264  int * pj_pairs = &(j_pairs[0]);
265  double R;
266  double R_pairs[2];
267  double * pR_pairs = &(R_pairs[0]);
268 
269  /* loop over particles and compute enregy and forces */
270  LOG_INFORMATION("Starting main compute loop");
271  for (i = 0; i < *nParts; ++i)
272  {
273  if (particleContributing[i])
274  {
275  ier = KIM_ModelComputeArguments_GetNeighborList(modelComputeArguments,
276  neighborListIndex,
277  i,
278  &numOfPartNeigh,
279  &neighListOfCurrentPart);
280  if (ier)
281  {
282  /* some sort of problem, exit */
283  LOG_ERROR("GetNeighborList failed");
284  ier = TRUE;
285  return ier;
286  }
287 
288  /* loop over the neighbors of particle i */
289  for (jj = 0; jj < numOfPartNeigh; ++jj)
290  {
291  j = neighListOfCurrentPart[jj]; /* get neighbor ID */
292 
293  if (!(particleContributing[j] && (j < i)))
294  {
295  /* short-circuit half-list */
296 
297  /* compute relative position vector and squared distance */
298  Rsqij = 0.0;
299  for (k = 0; k < DIM; ++k)
300  {
301  Rij[k] = coords[j * DIM + k] - coords[i * DIM + k];
302 
303  /* compute squared distance */
304  Rsqij += Rij[k] * Rij[k];
305  }
306 
307  /* compute energy and force */
308  if (Rsqij < cutsq)
309  {
310  /* particles are interacting ? */
311  R = sqrt(Rsqij);
312  if (comp_process_d2Edr2)
313  {
314  /* compute pair potential and its derivatives */
316  &epsilon, &C, &Rzero, &shift, cutoff, R, &phi, &dphi, &d2phi);
317 
318  /* compute dEidr */
319  if (particleContributing[j])
320  {
321  dEidr = dphi;
322  d2Eidr = d2phi;
323  }
324  else
325  {
326  dEidr = 0.5 * dphi;
327  d2Eidr = 0.5 * d2phi;
328  }
329  }
330  else if (comp_force || comp_process_dEdr)
331  {
332  /* compute pair potential and its derivative */
334  &epsilon, &C, &Rzero, &shift, cutoff, R, &phi, &dphi);
335 
336  /* compute dEidr */
337  if (particleContributing[j]) { dEidr = dphi; }
338  else
339  {
340  dEidr = 0.5 * dphi;
341  }
342  }
343  else
344  {
345  /* compute just pair potential */
346  calc_phi(&epsilon, &C, &Rzero, &shift, cutoff, R, &phi);
347  }
348 
349  /* contribution to energy */
350  if (comp_particleEnergy)
351  {
352  particleEnergy[i] += 0.5 * phi;
353  if (particleContributing[j]) { particleEnergy[j] += 0.5 * phi; }
354  }
355  if (comp_energy)
356  {
357  if (particleContributing[j]) { *energy += phi; }
358  else
359  {
360  *energy += 0.5 * phi;
361  }
362  }
363 
364  /* contribution to process_dEdr */
365  if (comp_process_dEdr)
366  {
368  modelComputeArguments, dEidr, R, pRij, i, j);
369  if (ier)
370  {
371  LOG_ERROR("ProcessDEDrTerm callback error");
372  ier = TRUE;
373  return ier;
374  }
375  }
376 
377  /* contribution to process_d2Edr2 */
378  if (comp_process_d2Edr2)
379  {
380  R_pairs[0] = R_pairs[1] = R;
381  Rij_pairs[0][0] = Rij_pairs[1][0] = Rij[0];
382  Rij_pairs[0][1] = Rij_pairs[1][1] = Rij[1];
383  Rij_pairs[0][2] = Rij_pairs[1][2] = Rij[2];
384  i_pairs[0] = i_pairs[1] = i;
385  j_pairs[0] = j_pairs[1] = j;
386 
388  modelComputeArguments,
389  d2Eidr,
390  pR_pairs,
391  pRij_pairs,
392  pi_pairs,
393  pj_pairs);
394  if (ier)
395  {
396  LOG_ERROR("ProcessD2EDr2Term callback error");
397  ier = TRUE;
398  return ier;
399  }
400  }
401 
402  /* contribution to forces */
403  if (comp_force)
404  {
405  for (k = 0; k < DIM; ++k)
406  {
407  force[i * DIM + k]
408  += dEidr * Rij[k] / R; /* accumulate force on i */
409  force[j * DIM + k]
410  -= dEidr * Rij[k] / R; /* accumulate force on j */
411  }
412  }
413  }
414  } /* if (i < j) */
415  } /* loop on jj */
416  } /* if contributing */
417  } /* loop on i */
418  LOG_INFORMATION("Finished compute loop");
419 
420  return FALSE;
421 }
422 
423 /* compute function */
424 #undef KIM_LOGGER_FUNCTION_NAME
425 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
426 #undef KIM_LOGGER_OBJECT_NAME
427 #define KIM_LOGGER_OBJECT_NAME modelCompute
428 
429 static int
430 model_compute(KIM_ModelCompute const * const modelCompute,
431  KIM_ModelComputeArguments const * const modelComputeArguments)
432 {
433  /* local variables */
434  int ier;
435  int i;
436  int k;
437  int comp_energy;
438  int comp_force;
439  int comp_particleEnergy;
440  int comp_process_dEdr;
441  int comp_process_d2Edr2;
442 
443  int * particleSpeciesCodes;
444  int * particleContributing;
445  buffer * bufferPointer;
446  double * cutoff;
447  double cutsq;
448  double epsilon;
449  double C;
450  double Rzero;
451  double shift;
452  double * coords;
453  double * energy;
454  double * force;
455  double * particleEnergy;
456  int * nParts;
457  double dummy;
458 
459  /* check to see if we have been asked to compute the forces, */
460  /* particleEnergy, and d1Edr */
461  LOG_INFORMATION("Checking if call backs are present.");
463  modelComputeArguments,
465  &comp_process_dEdr);
467  modelComputeArguments,
469  &comp_process_d2Edr2);
470 
471  LOG_INFORMATION("Getting data pointers");
473  modelComputeArguments,
475  &nParts)
477  modelComputeArguments,
479  &particleSpeciesCodes)
481  modelComputeArguments,
483  &particleContributing)
485  modelComputeArguments,
487  &coords)
489  modelComputeArguments,
491  &energy)
493  modelComputeArguments,
495  &force)
497  modelComputeArguments,
499  &particleEnergy);
500  if (ier)
501  {
502  LOG_ERROR("get data pointers failed");
503  return ier;
504  }
505 
506  comp_energy = (energy != NULL);
507  comp_force = (force != NULL);
508  comp_particleEnergy = (particleEnergy != NULL);
509 
510  /* Check to be sure that the species are correct */
511 
512  ier = TRUE; /* assume an error */
513  for (i = 0; i < *nParts; ++i)
514  {
515  if (SPECCODE != particleSpeciesCodes[i])
516  {
517  LOG_ERROR("Unexpected species code detected");
518  return ier;
519  }
520  }
521  ier = FALSE; /* everything is ok */
522 
523  /* initialize potential energies, forces, and virial term */
524  LOG_INFORMATION("Initializing data");
525  if (comp_particleEnergy)
526  {
527  for (i = 0; i < *nParts; ++i) { particleEnergy[i] = 0.0; }
528  }
529  if (comp_energy) { *energy = 0.0; }
530 
531  if (comp_force)
532  {
533  for (i = 0; i < *nParts; ++i)
534  {
535  for (k = 0; k < DIM; ++k) { force[i * DIM + k] = 0.0; }
536  }
537  }
538 
539  /* Compute energy and forces */
540 
541  /* set value of parameters */
543  (void **) &bufferPointer);
544  cutoff = &(bufferPointer->cutoff[0]);
545  cutsq = (*cutoff) * (*cutoff);
546  epsilon = EPSILON;
547  C = PARAM_C;
548  Rzero = RZERO;
549  /* set value of parameter shift */
550  dummy = 0.0;
551  /* call calc_phi with r=cutoff and shift=0.0 */
552  calc_phi(&epsilon, &C, &Rzero, &dummy, cutoff, *cutoff, &shift);
553  /* set shift to -shift */
554  shift = -(shift);
555 
556  /* do computation for short list */
557  ier = loops(modelCompute,
558  modelComputeArguments,
559  0 /* neighborListIndex */,
560  nParts,
561  particleContributing,
562  energy,
563  particleEnergy,
564  force,
565  coords,
566  cutsq,
567  epsilon,
568  C,
569  Rzero,
570  shift,
571  cutoff,
572  comp_energy,
573  comp_force,
574  comp_particleEnergy,
575  comp_process_dEdr,
576  comp_process_d2Edr2);
577  if (ier) return TRUE;
578 
579  cutoff = &(bufferPointer->cutoff[1]);
580  cutsq = (*cutoff) * (*cutoff);
581  epsilon = EPSILON / 4.0;
582  C = PARAM_C / 2.0;
583  Rzero = RZERO * 1.5;
584  /* set value of parameter shift */
585  dummy = 0.0;
586  /* call calc_phi with r=cutoff and shift=0.0 */
587  calc_phi(&epsilon, &C, &Rzero, &dummy, cutoff, *cutoff, &shift);
588  /* set shift to -shift */
589  shift = -(shift);
590 
591  /* do computation for short list */
592  ier = loops(modelCompute,
593  modelComputeArguments,
594  1 /* neighborListIndex */,
595  nParts,
596  particleContributing,
597  energy,
598  particleEnergy,
599  force,
600  coords,
601  cutsq,
602  epsilon,
603  C,
604  Rzero,
605  shift,
606  cutoff,
607  comp_energy,
608  comp_force,
609  comp_particleEnergy,
610  comp_process_dEdr,
611  comp_process_d2Edr2);
612  if (ier) return TRUE;
613 
614  /* everything is great */
615  ier = FALSE;
616 
617  return ier;
618 }
619 
620 
621 /* Create function */
622 #undef KIM_LOGGER_FUNCTION_NAME
623 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCreate_LogEntry
624 #undef KIM_LOGGER_OBJECT_NAME
625 #define KIM_LOGGER_OBJECT_NAME modelCreate
626 
627 int model_create(KIM_ModelCreate * const modelCreate,
628  KIM_LengthUnit const requestedLengthUnit,
629  KIM_EnergyUnit const requestedEnergyUnit,
630  KIM_ChargeUnit const requestedChargeUnit,
631  KIM_TemperatureUnit const requestedTemperatureUnit,
632  KIM_TimeUnit const requestedTimeUnit)
633 {
634  buffer * bufferPointer;
635  int error;
636 
637  /* use function pointer definitions to verify prototypes */
644 
645  (void) create; /* avoid unused parameter warnings */
646  (void) requestedLengthUnit;
647  (void) requestedEnergyUnit;
648  (void) requestedChargeUnit;
649  (void) requestedTemperatureUnit;
650  (void) requestedTimeUnit;
651 
652  /* set units */
653  LOG_INFORMATION("Set model units");
654  error = KIM_ModelCreate_SetUnits(modelCreate, /* ignoring requested units */
660 
661  /* register species */
662  LOG_INFORMATION("Setting species code");
663  error = error
665  modelCreate, KIM_SPECIES_NAME_Ar, SPECCODE);
666 
667  /* register numbering */
668  LOG_INFORMATION("Setting model numbering");
669  error = error
670  || KIM_ModelCreate_SetModelNumbering(modelCreate,
672 
673  /* register function pointers */
674  LOG_INFORMATION("Register model function pointers");
675  error = error
677  modelCreate,
680  TRUE,
681  (KIM_Function *) CACreate)
682  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
685  TRUE,
686  (KIM_Function *) compute)
688  modelCreate,
691  TRUE,
692  (KIM_Function *) CADestroy)
693  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
696  TRUE,
697  (KIM_Function *) destroy);
698 
699  /* allocate buffer */
700  bufferPointer = (buffer *) malloc(sizeof(buffer));
701 
702  /* store model buffer in KIM object */
703  LOG_INFORMATION("Set influence distance and cutoffs");
704  KIM_ModelCreate_SetModelBufferPointer(modelCreate, bufferPointer);
705 
706  /* set buffer values */
707  bufferPointer->influenceDistance = CUTOFF;
708  bufferPointer->cutoff[0] = CUTOFF / 2.0;
709  bufferPointer->cutoff[1] = CUTOFF;
712 
713  /* register influence distance */
715  modelCreate, &(bufferPointer->influenceDistance));
716 
717  /* register cutoff */
719  modelCreate,
721  &(bufferPointer->cutoff[0]),
722  &(bufferPointer
724 
725  if (error)
726  {
727  free(bufferPointer);
728  LOG_ERROR("Unable to successfully initialize model");
729  return TRUE;
730  }
731  else
732  return FALSE;
733 }
734 
735 /* Initialization function */
736 #undef KIM_LOGGER_FUNCTION_NAME
737 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelDestroy_LogEntry
738 #undef KIM_LOGGER_OBJECT_NAME
739 #define KIM_LOGGER_OBJECT_NAME modelDestroy
740 
741 int model_destroy(KIM_ModelDestroy * const modelDestroy)
742 {
743  buffer * bufferPointer;
744 
745  LOG_INFORMATION("Getting buffer");
747  (void **) &bufferPointer);
748  LOG_INFORMATION("Freeing model memory");
749  free(bufferPointer);
750 
751  return FALSE;
752 }
753 
754 /* compute arguments create routine */
755 #undef KIM_LOGGER_FUNCTION_NAME
756 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
757 #undef KIM_LOGGER_OBJECT_NAME
758 #define KIM_LOGGER_OBJECT_NAME modelCompute
759 
761  KIM_ModelCompute const * const modelCompute,
762  KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate)
763 {
764  int error;
765 
766  (void) modelCompute; /* avoid unused parameter warning */
767 
768  /* register arguments */
769  LOG_INFORMATION("Register argument supportStatus");
771  modelComputeArgumentsCreate,
774  error = error
776  modelComputeArgumentsCreate,
779  error = error
781  modelComputeArgumentsCreate,
784 
785  /* register call backs */
786  LOG_INFORMATION("Register call back supportStatus");
787  error = error
789  modelComputeArgumentsCreate,
792  error = error
794  modelComputeArgumentsCreate,
797 
798  if (error)
799  {
800  LOG_ERROR("Unable to successfully initialize compute arguments");
801  return TRUE;
802  }
803  else
804  return FALSE;
805 }
806 
807 /* compute arguments destroy routine */
809  KIM_ModelCompute const * const modelCompute,
810  KIM_ModelComputeArgumentsDestroy * const modelComputeArgumentsDestroy)
811 {
812  (void) modelCompute; /* avoid unused parameter warning */
813  (void) modelComputeArgumentsDestroy; /* avoid unused parameter warning */
814 
815  /* Nothing further to do */
816 
817  return FALSE;
818 }
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.
int loops(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArguments const *const modelComputeArguments, int neighborListIndex, int *nParts, int *particleContributing, double *energy, double *particleEnergy, double *force, double *coords, double cutsq, double epsilon, double C, double Rzero, double shift, double *cutoff, int comp_energy, int comp_force, int comp_particleEnergy, int comp_process_dEdr, int comp_process_d2Edr2)
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_partialParticleEnergy
The standard partialParticleEnergy argument.
void() KIM_Function(void)
Generic function type.
static void calc_phi_dphi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi, double *dphi)
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.
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_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.
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.
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...
static int compute_arguments_destroy(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsDestroy *const modelComputeArgumentsDestroy)
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 int model_destroy(KIM_ModelDestroy *const modelDestroy)
#define NUMBER_OF_CUTOFFS
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.
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_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.
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.
static int compute_arguments_create(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate)
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
KIM_EnergyUnit const KIM_ENERGY_UNIT_eV
The standard electronvolt unit of energy.
int modelWillNotRequestNeighborsOfNoncontributingParticles
static void calc_phi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi)
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.
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.
static int model_compute(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArguments const *const modelComputeArguments)
struct KIM_ModelComputeArguments KIM_ModelComputeArguments
Forward declaration.
KIM_LengthUnit const KIM_LENGTH_UNIT_A
The standard angstrom unit of length.
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.