52 influenceDistance_(8.1500),
53 cutoff_(influenceDistance_),
54 cutoffSq_(cutoff_*cutoff_),
55 paddingNeighborHints_(1),
58 *
error = ConvertUnits(modelCreate,
62 requestedTemperatureUnit,
71 &paddingNeighborHints_,
78 reinterpret_cast<KIM::func *>(&(LennardJones_Ar::Destroy)));
81 reinterpret_cast<KIM::func *>(&(LennardJones_Ar::Refresh)));
84 reinterpret_cast<KIM::func *>(&(LennardJones_Ar::Compute)));
87 reinterpret_cast<KIM::func *>
88 (&(LennardJones_Ar::ComputeArgumentsCreate)));
91 reinterpret_cast<KIM::func *>
92 (&(LennardJones_Ar::ComputeArgumentsDestroy)));
133 &(model->paddingNeighborHints_),
134 &(model->halfListHints_));
146 int const * numberOfParticlesPointer;
155 double const epsilon = lj->epsilon_;
156 double const sigma = lj->sigma_;
157 double const cutoffSq = lj->cutoffSq_;
162 &numberOfParticlesPointer)
180 LOG_ERROR(
"Unable to get argument pointers");
189 for (
int i = 0; i < extent; ++i)
195 int i, j, jj, numberOfNeighbors;
196 int const * neighbors;
198 double xcoord, ycoord, zcoord;
199 double xrij, yrij, zrij;
201 double r2inv, r6inv, dphiByR, dEidrByR;
202 double xdf, ydf, zdf;
203 double const fortyEight = 48.0 * epsilon * pow(sigma, 12.0);
204 double const twentyFour = 24.0 * epsilon * pow(sigma, 6.0);
205 double const four12 = 4.0 * epsilon * pow(sigma, 12.0);
206 double const four6 = 4.0 * epsilon * pow(sigma, 6.0);
216 0, i, &numberOfNeighbors, &neighbors);
218 for (jj = 0; jj < numberOfNeighbors; ++jj)
229 rij2 = xrij*xrij + yrij*yrij + zrij*zrij;
234 r6inv = r2inv*r2inv*r2inv;
235 phi = 0.5 * r6inv * (four12*r6inv - four6);
236 dphiByR = r6inv * (twentyFour - fortyEight*r6inv) * r2inv;
246 dEidrByR = 0.5*dphiByR;
249 xdf = dEidrByR * xrij;
250 ydf = dEidrByR * yrij;
251 zdf = dEidrByR * zrij;
304 double influenceDistance_;
307 int const paddingNeighborHints_;
308 int const halfListHints_;
330 double convertLength = 1.0;
332 fromLength, fromEnergy, fromCharge, fromTemperature, fromTime,
333 requestedLengthUnit, requestedEnergyUnit, requestedChargeUnit,
334 requestedTemperatureUnit, requestedTimeUnit,
335 1.0, 0.0, 0.0, 0.0, 0.0,
339 LOG_ERROR(
"Unable to convert length unit");
342 influenceDistance_ *= convertLength;
343 cutoff_ = influenceDistance_;
344 cutoffSq_ = cutoff_*cutoff_;
345 sigma_ *= convertLength;
348 double convertEnergy = 1.0;
350 fromLength, fromEnergy, fromCharge, fromTemperature, fromTime,
351 requestedLengthUnit, requestedEnergyUnit, requestedChargeUnit,
352 requestedTemperatureUnit, requestedTimeUnit,
353 0.0, 1.0, 0.0, 0.0, 0.0,
357 LOG_ERROR(
"Unable to convert energy unit");
360 epsilon_ *= convertEnergy;
371 LOG_ERROR(
"Unable to set units to requested values");
396 LennardJones_Ar *
const model =
new LennardJones_Ar(modelCreate,
400 requestedTemperatureUnit,
TemperatureUnit const unused
int SetSpeciesCode(SpeciesName const speciesName, int const code)
int SetModelNumbering(Numbering const numbering)
ComputeArgumentName const coordinates
int SetComputePointer(LanguageName const languageName, func *const fptr)
static int ComputeArgumentsDestroy(KIM::ModelCompute const *const modelCompute, KIM::ModelComputeArgumentsDestroy *const modelComputeArgumentsDestroy)
int SetUnits(LengthUnit const lengthUnit, EnergyUnit const energyUnit, ChargeUnit const chargeUnit, TemperatureUnit const temperatureUnit, TimeUnit const timeUnit)
void GetModelBufferPointer(void **const ptr) const
void SetInfluenceDistancePointer(double const *const influenceDistance)
static int Refresh(KIM::ModelRefresh *const modelRefresh)
void SetModelBufferPointer(void *const ptr)
SupportStatus const required
int GetArgumentPointer(ComputeArgumentName const computeArgumentName, int const **const ptr) const
ComputeArgumentName const particleContributing
ComputeArgumentName const partialEnergy
int SetComputeArgumentsDestroyPointer(LanguageName const languageName, func *const fptr)
void SetNeighborListPointers(int const numberOfNeighborLists, double const *const cutoffs, int const *const paddingNeighborHints, int const *const halfListHints)
static int ComputeArgumentsCreate(KIM::ModelCompute const *const modelCompute, KIM::ModelComputeArgumentsCreate *const modelComputeArgumentsCreate)
#define LOG_ERROR(message)
int SetComputeArgumentsCreatePointer(LanguageName const languageName, func *const fptr)
void SetNeighborListPointers(int const numberOfNeighborLists, double const *const cutoffs, int const *const paddingNeighborHints, int const *const halfListHints)
int SetRefreshPointer(LanguageName const languageName, func *const fptr)
ComputeArgumentName const partialForces
void GetModelBufferPointer(void **const ptr) const
ComputeArgumentName const particleSpeciesCodes
int SetArgumentSupportStatus(ComputeArgumentName const clomputeArgumentName, SupportStatus const supportStatus)
ComputeArgumentName const numberOfParticles
void SetInfluenceDistancePointer(double const *const influenceDistance)
int GetNeighborList(int const neighborListIndex, int const particleNumber, int *const numberOfNeighbors, int const **const neighborsOfParticle) const
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 GetModelBufferPointer(void **const ptr) const
LennardJones_Ar(KIM::ModelCreate *const modelCreate, KIM::LengthUnit const requestedLengthUnit, KIM::EnergyUnit const requestedEnergyUnit, KIM::ChargeUnit const requestedChargeUnit, KIM::TemperatureUnit const requestedTemperatureUnit, KIM::TimeUnit const requestedTimeUnit, int *const error)
int ConvertUnit(LengthUnit const fromLengthUnit, EnergyUnit const fromEnergyUnit, ChargeUnit const fromChargeUnit, TemperatureUnit const fromTemperatureUnit, TimeUnit const fromTimeUnit, LengthUnit const toLengthUnit, EnergyUnit const toEnergyUnit, ChargeUnit const toChargeUnit, TemperatureUnit const toTemperatureUnit, TimeUnit const toTimeUnit, double const lengthExponent, double const energyExponent, double const chargeExponent, double const temperatureExponent, double const timeExponent, double *const conversionFactor) const
static int Destroy(KIM::ModelDestroy *const modelDestroy)
Numbering const zeroBased
static int Compute(KIM::ModelCompute const *const modelCompute, KIM::ModelComputeArguments const *const modelComputeArguments)
int SetDestroyPointer(LanguageName const languageName, func *const fptr)