55#define EPSILON -0.0134783698072604
85 void *
const extensionStructure);
92static void calc_phi(
double * epsilon,
132 ep = exp(-(*C) * (r - *Rzero));
142 *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
162 ep = exp(-(*C) * (r - *Rzero));
173 *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
174 *dphi = 2.0 * (*epsilon) * (*C) * (-ep + ep2);
196 ep = exp(-(*C) * (r - *Rzero));
208 *phi = (*epsilon) * (-ep2 + 2.0 * ep) + *shift;
209 *dphi = 2.0 * (*epsilon) * (*C) * (-ep + ep2);
210 *d2phi = 2.0 * (*epsilon) * (*C) * (*C) * (ep - 2.0 * ep2);
217#undef KIM_LOGGER_FUNCTION_NAME
218#define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
219#undef KIM_LOGGER_OBJECT_NAME
220#define KIM_LOGGER_OBJECT_NAME modelCompute
229 double * pR_pairs = &(R_pairs[0]);
237 double * pRij = &(Rij[0]);
238 double Rij_pairs[2][3];
239 double const * pRij_pairs = &(Rij_pairs[0][0]);
243 int * pi_pairs = &(i_pairs[0]);
246 int * pj_pairs = &(j_pairs[0]);
249 int const * neighListOfCurrentPart;
252 int comp_particleEnergy;
253 int comp_process_dEdr;
254 int comp_process_d2Edr2;
257 int * particleSpeciesCodes;
258 int * particleContributing;
269 double * particleEnergy;
277 modelComputeArguments,
281 modelComputeArguments,
283 &comp_process_d2Edr2);
287 modelComputeArguments,
291 modelComputeArguments,
293 &particleSpeciesCodes)
295 modelComputeArguments,
297 &particleContributing)
299 modelComputeArguments,
303 modelComputeArguments,
307 modelComputeArguments,
311 modelComputeArguments,
320 comp_energy = (energy != NULL);
321 comp_force = (force != NULL);
322 comp_particleEnergy = (particleEnergy != NULL);
326 (
void **) &bufferPointer);
328 cutsq = (*cutoff) * (*cutoff);
342 for (i = 0; i < *nParts; ++i)
344 if (
SPECCODE != particleSpeciesCodes[i])
346 LOG_ERROR(
"Unexpected species code detected");
354 if (comp_particleEnergy)
356 for (i = 0; i < *nParts; ++i) { particleEnergy[i] = 0.0; }
358 if (comp_energy) { *energy = 0.0; }
362 for (i = 0; i < *nParts; ++i)
364 for (k = 0; k <
DIM; ++k) { force[i *
DIM + k] = 0.0; }
372 for (i = 0; i < *nParts; ++i)
374 if (particleContributing[i])
380 &neighListOfCurrentPart);
390 for (jj = 0; jj < numOfPartNeigh; ++jj)
392 j = neighListOfCurrentPart[jj];
394 if (!(particleContributing[j] && (j < i)))
400 for (k = 0; k <
DIM; ++k)
402 Rij[k] = coords[j *
DIM + k] - coords[i *
DIM + k];
405 Rsqij += Rij[k] * Rij[k];
413 if (comp_process_d2Edr2)
417 &epsilon, &C, &Rzero, &shift,
cutoff, R, &phi, &dphi, &d2phi);
420 if (particleContributing[j])
428 d2Eidr = 0.5 * d2phi;
431 else if (comp_force || comp_process_dEdr)
435 &epsilon, &C, &Rzero, &shift,
cutoff, R, &phi, &dphi);
438 if (particleContributing[j]) { dEidr = dphi; }
451 if (comp_particleEnergy)
453 particleEnergy[i] += 0.5 * phi;
454 if (particleContributing[j]) { particleEnergy[j] += 0.5 * phi; }
458 if (particleContributing[j]) { *energy += phi; }
461 *energy += 0.5 * phi;
466 if (comp_process_dEdr)
469 modelComputeArguments, dEidr, R, pRij, i, j);
472 LOG_ERROR(
"ProcessDEDrTerm callback error");
479 if (comp_process_d2Edr2)
481 R_pairs[0] = R_pairs[1] = R;
482 Rij_pairs[0][0] = Rij_pairs[1][0] = Rij[0];
483 Rij_pairs[0][1] = Rij_pairs[1][1] = Rij[1];
484 Rij_pairs[0][2] = Rij_pairs[1][2] = Rij[2];
485 i_pairs[0] = i_pairs[1] = i;
486 j_pairs[0] = j_pairs[1] = j;
489 modelComputeArguments,
497 LOG_ERROR(
"ProcessDEDrTerm callback error");
506 for (k = 0; k <
DIM; ++k)
509 += dEidr * Rij[k] / R;
511 -= dEidr * Rij[k] / R;
528#undef KIM_LOGGER_FUNCTION_NAME
529#define KIM_LOGGER_FUNCTION_NAME KIM_ModelExtension_LogEntry
530#undef KIM_LOGGER_OBJECT_NAME
531#define KIM_LOGGER_OBJECT_NAME modelExtension
533 void *
const extensionStructure)
535 char const * extensionID;
562#undef KIM_LOGGER_FUNCTION_NAME
563#define KIM_LOGGER_FUNCTION_NAME KIM_ModelCreate_LogEntry
564#undef KIM_LOGGER_OBJECT_NAME
565#define KIM_LOGGER_OBJECT_NAME modelCreate
587 (void) requestedLengthUnit;
588 (void) requestedEnergyUnit;
589 (void) requestedChargeUnit;
590 (void) requestedTemperatureUnit;
591 (void) requestedTimeUnit;
671 LOG_ERROR(
"Unable to successfully initialize model");
679#undef KIM_LOGGER_FUNCTION_NAME
680#define KIM_LOGGER_FUNCTION_NAME KIM_ModelDestroy_LogEntry
681#undef KIM_LOGGER_OBJECT_NAME
682#define KIM_LOGGER_OBJECT_NAME modelDestroy
690 (
void **) &bufferPointer);
698#undef KIM_LOGGER_FUNCTION_NAME
699#define KIM_LOGGER_FUNCTION_NAME KIM_ModelCompute_LogEntry
700#undef KIM_LOGGER_OBJECT_NAME
701#define KIM_LOGGER_OBJECT_NAME modelCompute
714 modelComputeArgumentsCreate,
719 modelComputeArgumentsCreate,
724 modelComputeArgumentsCreate,
732 modelComputeArgumentsCreate,
737 modelComputeArgumentsCreate,
743 LOG_ERROR(
"Unable to successfully initialize compute arguments");
756 (void) modelComputeArgumentsDestroy;
KIM_ChargeUnit const KIM_CHARGE_UNIT_unused
Indicates that a ChargeUnit is not used.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_numberOfParticles
The standard numberOfParticles argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_particleContributing
The standard particleContributing argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_coordinates
The standard coordinates argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_particleSpeciesCodes
The standard particleSpeciesCodes argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_partialForces
The standard partialForces argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_partialParticleEnergy
The standard partialParticleEnergy argument.
KIM_ComputeArgumentName const KIM_COMPUTE_ARGUMENT_NAME_partialEnergy
The standard partialEnergy argument.
KIM_ComputeCallbackName const KIM_COMPUTE_CALLBACK_NAME_ProcessD2EDr2Term
The standard ProcessD2EDr2Term callback.
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.
int KIM_ModelComputeArgumentsCreateFunction(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate)
Prototype for MODEL_ROUTINE_NAME::ComputeArgumentsCreate routine.
int KIM_ModelDestroyFunction(KIM_ModelDestroy *const modelDestroy)
Prototype for MODEL_ROUTINE_NAME::Destroy routine.
struct KIM_ModelComputeArgumentsCreate KIM_ModelComputeArgumentsCreate
Forward declaration.
struct KIM_ModelComputeArgumentsDestroy KIM_ModelComputeArgumentsDestroy
Forward declaration.
struct KIM_ModelCreate KIM_ModelCreate
Forward declaration.
struct KIM_ModelDestroy KIM_ModelDestroy
Forward declaration.
struct KIM_ModelCompute KIM_ModelCompute
Forward declaration.
int KIM_ModelExtensionFunction(KIM_ModelExtension *const modelExtension, void *const extensionStructure)
Prototype for MODEL_ROUTINE_NAME::Extension routine.
struct KIM_ModelComputeArguments KIM_ModelComputeArguments
Forward declaration.
void() KIM_Function(void)
Generic function type.
struct KIM_ModelExtension KIM_ModelExtension
Forward declaration.
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_ModelComputeArgumentsDestroyFunction(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArgumentsDestroy *const modelComputeArgumentsDestroy)
Prototype for MODEL_ROUTINE_NAME::ComputeArgumentsDestroy routine.
int KIM_ModelComputeFunction(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArguments const *const modelComputeArguments)
Prototype for MODEL_ROUTINE_NAME::Compute routine.
KIM_LanguageName const KIM_LANGUAGE_NAME_c
The standard c language.
KIM_LengthUnit const KIM_LENGTH_UNIT_A
The standard angstrom unit of length.
#define LOG_ERROR(message)
Convenience macro for ERROR Log entries with compile-time optimization.
#define LOG_INFORMATION(message)
Convenience macro for INFORMATION Log entries with compile-time optimization.
void KIM_ModelCompute_GetModelBufferPointer(KIM_ModelCompute const *const modelCompute, void **const ptr)
Get the Model's buffer pointer within the Model object.
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...
int KIM_ModelComputeArguments_GetArgumentPointerInteger(KIM_ModelComputeArguments const *const modelComputeArguments, KIM_ComputeArgumentName const computeArgumentName, int **const ptr)
Get the data pointer for a ComputeArgumentName.
int KIM_ModelComputeArguments_GetArgumentPointerDouble(KIM_ModelComputeArguments const *const modelComputeArguments, KIM_ComputeArgumentName const computeArgumentName, double **const ptr)
Get the data pointer for a ComputeArgumentName.
int KIM_ModelComputeArguments_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...
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's COMPUTE_CALLBACK_NAME::ProcessDEDrTerm routine.
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's COMPUTE_CALLBACK_NAME::ProcessD2EDr2Term routine.
int KIM_ModelComputeArgumentsCreate_SetCallbackSupportStatus(KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate, KIM_ComputeCallbackName const computeCallbackName, KIM_SupportStatus const supportStatus)
Set the SupportStatus of a ComputeCallbackName.
int KIM_ModelComputeArgumentsCreate_SetArgumentSupportStatus(KIM_ModelComputeArgumentsCreate *const modelComputeArgumentsCreate, KIM_ComputeArgumentName const computeArgumentName, KIM_SupportStatus const supportStatus)
Set the SupportStatus of a ComputeArgumentName.
int KIM_ModelCreate_SetSpeciesCode(KIM_ModelCreate *const modelCreate, KIM_SpeciesName const speciesName, int const code)
Set integer code for supported SpeciesName.
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_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's base unit values.
void KIM_ModelCreate_SetModelBufferPointer(KIM_ModelCreate *const modelCreate, void *const ptr)
Set the Model's buffer pointer within the Model object.
void KIM_ModelCreate_SetInfluenceDistancePointer(KIM_ModelCreate *const modelCreate, double const *const influenceDistance)
Set the Model's influence distance data pointer.
void KIM_ModelCreate_SetNeighborListPointers(KIM_ModelCreate *const modelCreate, int const numberOfNeighborLists, double const *const cutoffs, int const *const modelWillNotRequestNeighborsOfNoncontributingParticles)
Set the Model's neighbor list data pointers.
int KIM_ModelCreate_SetModelNumbering(KIM_ModelCreate *const modelCreate, KIM_Numbering const numbering)
Set the Model's particle Numbering.
void KIM_ModelDestroy_GetModelBufferPointer(KIM_ModelDestroy const *const modelDestroy, void **const ptr)
Get the Model's buffer pointer within the Model object.
void KIM_ModelExtension_GetExtensionID(KIM_ModelExtension const *const modelExtension, char const **const extensionID)
Get the extension identification string.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_Destroy
The standard Destroy routine.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_Compute
The standard Compute routine.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_Extension
The standard Extension routine.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_ComputeArgumentsCreate
The standard ComputeArgumentsCreate routine.
KIM_ModelRoutineName const KIM_MODEL_ROUTINE_NAME_ComputeArgumentsDestroy
The standard ComputeArgumentsDestroy routine.
KIM_Numbering const KIM_NUMBERING_zeroBased
The standard zeroBased numbering.
KIM_SpeciesName const KIM_SPECIES_NAME_Ar
The standard Argon species.
KIM_SupportStatus const KIM_SUPPORT_STATUS_optional
The standard optional status.
#define KIM_SUPPORTED_EXTENSIONS_ID
KIM_TemperatureUnit const KIM_TEMPERATURE_UNIT_unused
Indicates that a TemperatureUnit is not used.
KIM_TimeUnit const KIM_TIME_UNIT_unused
Indicates that a TimeUnit is not used.
static int model_extension(KIM_ModelExtension *const modelExtension, void *const extensionStructure)
static void calc_phi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi)
static int model_compute(KIM_ModelCompute const *const modelCompute, KIM_ModelComputeArguments const *const modelComputeArguments)
static void calc_phi_d2phi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi, double *dphi, double *d2phi)
static int model_destroy(KIM_ModelDestroy *const modelDestroy)
static void calc_phi_dphi(double *epsilon, double *C, double *Rzero, double *shift, double *cutoff, double r, double *phi, double *dphi)
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)
An Extensible Enumeration for the ChargeUnit's supported by the KIM API.
An Extensible Enumeration for the EnergyUnit's supported by the KIM API.
An Extensible Enumeration for the LengthUnit's supported by the KIM API.
The only standard extension defined by the KIM API.
int numberOfSupportedExtensions
The number of extensions supported by the Model.
char supportedExtensionID[KIM_MAX_NUMBER_OF_EXTENSIONS][KIM_MAX_EXTENSION_ID_LENGTH]
The unique extension ID's of each supported extension.
int supportedExtensionRequired[KIM_MAX_NUMBER_OF_EXTENSIONS]
An Extensible Enumeration for the TemperatureUnit's supported by the KIM API.
An Extensible Enumeration for the TimeUnit's supported by the KIM API.
int modelWillNotRequestNeighborsOfNoncontributingParticles