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_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  if (ier)
371  {
372  LOG_ERROR("ProcessDEDrTerm callback error");
373  ier = TRUE;
374  return ier;
375  }
376  }
377 
378  /* contribution to process_d2Edr2 */
379  if (comp_process_d2Edr2)
380  {
381  R_pairs[0] = R_pairs[1] = R;
382  Rij_pairs[0][0] = Rij_pairs[1][0] = Rij[0];
383  Rij_pairs[0][1] = Rij_pairs[1][1] = Rij[1];
384  Rij_pairs[0][2] = Rij_pairs[1][2] = Rij[2];
385  i_pairs[0] = i_pairs[1] = i;
386  j_pairs[0] = j_pairs[1] = j;
387 
389  modelComputeArguments,
390  d2Eidr,
391  pR_pairs,
392  pRij_pairs,
393  pi_pairs,
394  pj_pairs);
395  if (ier)
396  {
397  LOG_ERROR("ProcessD2EDr2Term callback error");
398  ier = TRUE;
399  return ier;
400  }
401  }
402 
403  /* contribution to forces */
404  if (comp_force)
405  {
406  for (k = 0; k < DIM; ++k)
407  {
408  force[i * DIM + k]
409  += dEidr * Rij[k] / R; /* accumulate force on i */
410  force[j * DIM + k]
411  -= dEidr * Rij[k] / R; /* accumulate force on j */
412  }
413  }
414  }
415  } /* if (i < j) */
416  } /* loop on jj */
417  } /* if contributing */
418  } /* loop on i */
419  LOG_INFORMATION("Finished compute loop");
420 
421  return FALSE;
422 }
423 
424 /* compute function */
425 #undef KIM_LOGGER_FUNCTION_NAME
426 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
427 #undef KIM_LOGGER_OBJECT_NAME
428 #define KIM_LOGGER_OBJECT_NAME modelCompute
429 
430 static int
431 model_compute(KIM_ModelCompute const * const modelCompute,
432  KIM_ModelComputeArguments const * const modelComputeArguments)
433 {
434  /* local variables */
435  int ier;
436  int i;
437  int k;
438  int comp_energy;
439  int comp_force;
440  int comp_particleEnergy;
441  int comp_process_dEdr;
442  int comp_process_d2Edr2;
443 
444  int * particleSpeciesCodes;
445  int * particleContributing;
446  buffer * bufferPointer;
447  double * cutoff;
448  double cutsq;
449  double epsilon;
450  double C;
451  double Rzero;
452  double shift;
453  double * coords;
454  double * energy;
455  double * force;
456  double * particleEnergy;
457  int * nParts;
458  double dummy;
459 
460  /* check to see if we have been asked to compute the forces, */
461  /* particleEnergy, and d1Edr */
462  LOG_INFORMATION("Checking if call backs are present.");
464  modelComputeArguments,
466  &comp_process_dEdr);
468  modelComputeArguments,
470  &comp_process_d2Edr2);
471 
472  LOG_INFORMATION("Getting data pointers");
474  modelComputeArguments,
476  &nParts)
478  modelComputeArguments,
480  &particleSpeciesCodes)
482  modelComputeArguments,
484  &particleContributing)
486  modelComputeArguments,
488  &coords)
490  modelComputeArguments,
492  &energy)
494  modelComputeArguments,
496  &force)
498  modelComputeArguments,
500  &particleEnergy);
501  if (ier)
502  {
503  LOG_ERROR("get data pointers failed");
504  return ier;
505  }
506 
507  comp_energy = (energy != NULL);
508  comp_force = (force != NULL);
509  comp_particleEnergy = (particleEnergy != NULL);
510 
511  /* Check to be sure that the species are correct */
512 
513  ier = TRUE; /* assume an error */
514  for (i = 0; i < *nParts; ++i)
515  {
516  if (SPECCODE != particleSpeciesCodes[i])
517  {
518  LOG_ERROR("Unexpected species code detected");
519  return ier;
520  }
521  }
522  ier = FALSE; /* everything is ok */
523 
524  /* initialize potential energies, forces, and virial term */
525  LOG_INFORMATION("Initializing data");
526  if (comp_particleEnergy)
527  {
528  for (i = 0; i < *nParts; ++i) { particleEnergy[i] = 0.0; }
529  }
530  if (comp_energy) { *energy = 0.0; }
531 
532  if (comp_force)
533  {
534  for (i = 0; i < *nParts; ++i)
535  {
536  for (k = 0; k < DIM; ++k) { force[i * DIM + k] = 0.0; }
537  }
538  }
539 
540  /* Compute energy and forces */
541 
542  /* set value of parameters */
544  (void **) &bufferPointer);
545  cutoff = &(bufferPointer->cutoff[0]);
546  cutsq = (*cutoff) * (*cutoff);
547  epsilon = EPSILON;
548  C = PARAM_C;
549  Rzero = RZERO;
550  /* set value of parameter shift */
551  dummy = 0.0;
552  /* call calc_phi with r=cutoff and shift=0.0 */
553  calc_phi(&epsilon, &C, &Rzero, &dummy, cutoff, *cutoff, &shift);
554  /* set shift to -shift */
555  shift = -(shift);
556 
557  /* do computation for short list */
558  ier = loops(modelCompute,
559  modelComputeArguments,
560  0 /* neighborListIndex */,
561  nParts,
562  particleContributing,
563  energy,
564  particleEnergy,
565  force,
566  coords,
567  cutsq,
568  epsilon,
569  C,
570  Rzero,
571  shift,
572  cutoff,
573  comp_energy,
574  comp_force,
575  comp_particleEnergy,
576  comp_process_dEdr,
577  comp_process_d2Edr2);
578  if (ier) return TRUE;
579 
580  cutoff = &(bufferPointer->cutoff[1]);
581  cutsq = (*cutoff) * (*cutoff);
582  epsilon = EPSILON / 4.0;
583  C = PARAM_C / 2.0;
584  Rzero = RZERO * 1.5;
585  /* set value of parameter shift */
586  dummy = 0.0;
587  /* call calc_phi with r=cutoff and shift=0.0 */
588  calc_phi(&epsilon, &C, &Rzero, &dummy, cutoff, *cutoff, &shift);
589  /* set shift to -shift */
590  shift = -(shift);
591 
592  /* do computation for short list */
593  ier = loops(modelCompute,
594  modelComputeArguments,
595  1 /* neighborListIndex */,
596  nParts,
597  particleContributing,
598  energy,
599  particleEnergy,
600  force,
601  coords,
602  cutsq,
603  epsilon,
604  C,
605  Rzero,
606  shift,
607  cutoff,
608  comp_energy,
609  comp_force,
610  comp_particleEnergy,
611  comp_process_dEdr,
612  comp_process_d2Edr2);
613  if (ier) return TRUE;
614 
615  /* everything is great */
616  ier = FALSE;
617 
618  return ier;
619 }
620 
621 
622 /* Create function */
623 #undef KIM_LOGGER_FUNCTION_NAME
624 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCreate_LogEntry
625 #undef KIM_LOGGER_OBJECT_NAME
626 #define KIM_LOGGER_OBJECT_NAME modelCreate
627 
628 int model_create(KIM_ModelCreate * const modelCreate,
629  KIM_LengthUnit const requestedLengthUnit,
630  KIM_EnergyUnit const requestedEnergyUnit,
631  KIM_ChargeUnit const requestedChargeUnit,
632  KIM_TemperatureUnit const requestedTemperatureUnit,
633  KIM_TimeUnit const requestedTimeUnit)
634 {
635  buffer * bufferPointer;
636  int error;
637 
638  /* use function pointer definitions to verify prototypes */
645 
646  (void) create; /* avoid unused parameter warnings */
647  (void) requestedLengthUnit;
648  (void) requestedEnergyUnit;
649  (void) requestedChargeUnit;
650  (void) requestedTemperatureUnit;
651  (void) requestedTimeUnit;
652 
653  /* set units */
654  LOG_INFORMATION("Set model units");
655  error = KIM_ModelCreate_SetUnits(modelCreate, /* ignoring requested units */
661 
662  /* register species */
663  LOG_INFORMATION("Setting species code");
664  error = error
666  modelCreate, KIM_SPECIES_NAME_Ar, SPECCODE);
667 
668  /* register numbering */
669  LOG_INFORMATION("Setting model numbering");
670  error = error
671  || KIM_ModelCreate_SetModelNumbering(modelCreate,
673 
674  /* register function pointers */
675  LOG_INFORMATION("Register model function pointers");
676  error = error
678  modelCreate,
681  TRUE,
682  (KIM_Function *) CACreate)
683  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
686  TRUE,
687  (KIM_Function *) compute)
689  modelCreate,
692  TRUE,
693  (KIM_Function *) CADestroy)
694  || KIM_ModelCreate_SetRoutinePointer(modelCreate,
697  TRUE,
698  (KIM_Function *) destroy);
699 
700  /* allocate buffer */
701  bufferPointer = (buffer *) malloc(sizeof(buffer));
702 
703  /* store model buffer in KIM object */
704  LOG_INFORMATION("Set influence distance and cutoffs");
705  KIM_ModelCreate_SetModelBufferPointer(modelCreate, bufferPointer);
706 
707  /* set buffer values */
708  bufferPointer->influenceDistance = CUTOFF;
709  bufferPointer->cutoff[0] = CUTOFF / 2.0;
710  bufferPointer->cutoff[1] = CUTOFF;
713 
714  /* register influence distance */
716  modelCreate, &(bufferPointer->influenceDistance));
717 
718  /* register cutoff */
720  modelCreate,
722  &(bufferPointer->cutoff[0]),
723  &(bufferPointer
725 
726  if (error)
727  {
728  free(bufferPointer);
729  LOG_ERROR("Unable to successfully initialize model");
730  return TRUE;
731  }
732  else
733  return FALSE;
734 }
735 
736 /* Initialization function */
737 #undef KIM_LOGGER_FUNCTION_NAME
738 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelDestroy_LogEntry
739 #undef KIM_LOGGER_OBJECT_NAME
740 #define KIM_LOGGER_OBJECT_NAME modelDestroy
741 
742 int model_destroy(KIM_ModelDestroy * const modelDestroy)
743 {
744  buffer * bufferPointer;
745 
746  LOG_INFORMATION("Getting buffer");
748  (void **) &bufferPointer);
749  LOG_INFORMATION("Freeing model memory");
750  free(bufferPointer);
751 
752  return FALSE;
753 }
754 
755 /* compute arguments create routine */
756 #undef KIM_LOGGER_FUNCTION_NAME
757 #define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
758 #undef KIM_LOGGER_OBJECT_NAME
759 #define KIM_LOGGER_OBJECT_NAME modelCompute
760 
762  KIM_ModelCompute const * const modelCompute,
763  KIM_ModelComputeArgumentsCreate * const modelComputeArgumentsCreate)
764 {
765  int error;
766 
767  (void) modelCompute; /* avoid unused parameter warning */
768 
769  /* register arguments */
770  LOG_INFORMATION("Register argument supportStatus");
772  modelComputeArgumentsCreate,
775  error = error
777  modelComputeArgumentsCreate,
780  error = error
782  modelComputeArgumentsCreate,
785 
786  /* register call backs */
787  LOG_INFORMATION("Register call back supportStatus");
788  error = error
790  modelComputeArgumentsCreate,
793  error = error
795  modelComputeArgumentsCreate,
798 
799  if (error)
800  {
801  LOG_ERROR("Unable to successfully initialize compute arguments");
802  return TRUE;
803  }
804  else
805  return FALSE;
806 }
807 
808 /* compute arguments destroy routine */
810  KIM_ModelCompute const * const modelCompute,
811  KIM_ModelComputeArgumentsDestroy * const modelComputeArgumentsDestroy)
812 {
813  (void) modelCompute; /* avoid unused parameter warning */
814  (void) modelComputeArgumentsDestroy; /* avoid unused parameter warning */
815 
816  /* Nothing further to do */
817 
818  return FALSE;
819 }
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.