22 double cutoff,
double sigma,
double epsilon) {
23 using namespace autopas::utils::ArrayMath::literals;
26 const auto posIMinusPosJ = posI - posJ;
39 const auto sdr = sigma / dist;
41 const auto lj6 = sdr * sdr * sdr * sdr * sdr * sdr;
43 const auto lj12 = lj6 * lj6;
45 const auto potentialEnergy = 4.0 * epsilon * (lj12 - lj6);
47 return potentialEnergy;
59constexpr std::array<double, 3>
calculateLJForce(
const std::array<double, 3> &posI,
const std::array<double, 3> &posJ,
60 double cutoff,
double sigma,
double epsilon) {
61 using namespace autopas::utils::ArrayMath::literals;
64 const auto posIMinusPosJ = posI - posJ;
77 const auto r6 = dist * dist * dist * dist * dist * dist;
79 const auto sigma6 = sigma * sigma * sigma * sigma * sigma * sigma;
81 const auto dlj6 = sigma6 / (r6 * dist);
83 const auto dlj12 = (sigma6 * sigma6) / (r6 * r6 * dist);
85 const auto dUr = 48. * epsilon * (dlj12 - 0.5 * dlj6);
88 const auto fx = (posIMinusPosJ[0] / dist) * dUr;
89 const auto fy = (posIMinusPosJ[1] / dist) * dUr;
90 const auto fz = (posIMinusPosJ[2] / dist) * dUr;
92 const auto force = std::array<double, 3>{fx, fy, fz};
106constexpr std::array<double, 3>
calculateLJVirial(
const std::array<double, 3> &posI,
const std::array<double, 3> &posJ,
107 double cutoff,
double sigma,
double epsilon) {
108 using namespace autopas::utils::ArrayMath::literals;
113 const auto posIMinusPosJ = posI - posJ;
115 std::array<double, 3>{posIMinusPosJ[0] * force[0], posIMinusPosJ[1] * force[1], posIMinusPosJ[2] * force[2]};
129 double cutoff,
double sigma,
double epsilon) {
131 return virial[0] + virial[1] + virial[2];
constexpr double calculateLJPotential(const std::array< double, 3 > &posI, const std::array< double, 3 > &posJ, double cutoff, double sigma, double epsilon)
Calculates the potential energy between particle i and j using the Lennard Jones 12-6 potential.
Definition: LJPotential.h:21
constexpr std::array< double, 3 > calculateLJVirial(const std::array< double, 3 > &posI, const std::array< double, 3 > &posJ, double cutoff, double sigma, double epsilon)
Calculates the virial between particle i and j using the Lennard Jones 12-6 potential.
Definition: LJPotential.h:106
constexpr double calculateLJVirialTotal(const std::array< double, 3 > &posI, const std::array< double, 3 > &posJ, double cutoff, double sigma, double epsilon)
Calculates the sum of all components of the virial between particle i and j using the Lennard Jones 1...
Definition: LJPotential.h:128
constexpr std::array< double, 3 > calculateLJForce(const std::array< double, 3 > &posI, const std::array< double, 3 > &posJ, double cutoff, double sigma, double epsilon)
Calculates the force exerted by particle j on particle i using the 12-6 potential of Lennard Jones.
Definition: LJPotential.h:59
constexpr T dot(const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
Generates the dot product of two arrays.
Definition: ArrayMath.h:233