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