Class EvaluatorPairForceShiftedLJ#

Class Documentation#

class EvaluatorPairForceShiftedLJ#

Class for evaluating the force shifted LJ pair potential.

This evaluator is a variant of the Lennard-Jones pair potential, for which the force goes smoothly to zero at \( r = r_{\mathrm{cut}} \). EvaluatorPairForceShiftedLJ evaluates the function:

\[ V(r) = V_{LJ}(r) + \Delta V(r) \]
, where
\[ V_{\mathrm{LJ}}(r) = 4 \varepsilon \left[ \left( \frac{\sigma}{r} \right)^{12} - \left( \frac{\sigma}{r} \right)^{6} \right] \]
is the standard Lennard-Jones pair potential and
\[ \Delta V(r) = -(r - r_{\mathrm{cut}}) \frac{\partial V_{\mathrm{LJ}}}{\partial r}(r_{\mathrm{cut}}) \]
. The constant value \( -\frac{1}{r} \frac{\partial V}{\partial r}(r_{\mathrm{cut}}) \) is subtracted from force_divr . The two parameters lj1 and lj2 are the same as for the (non-force-shifted) LJ potential.

Public Types

typedef EvaluatorPairLJ::param_type param_type#

Define the parameter type used by this pair potential evaluator.

Public Functions

DEVICE inline void load_shared(char *&ptr, unsigned int &available_bytes)#
HOSTDEVICE inline void allocate_shared(char *&ptr, unsigned int &available_bytes) const#
DEVICE inline EvaluatorPairForceShiftedLJ(
Scalar _rsq,
Scalar _rcutsq,
const param_type &_params
)#

Constructs the pair potential evaluator.

Parameters:
  • _rsq – Squared distance between the particles

  • _rcutsq – Squared distance at which the potential and the force go to 0

  • _params – Per type pair parameters of this potential

DEVICE inline void setDiameter(Scalar di, Scalar dj)#

Accept the optional diameter values.

Parameters:
  • di – Diameter of particle i

  • dj – Diameter of particle j

DEVICE inline void setCharge(Scalar qi, Scalar qj)#

Accept the optional diameter values.

Parameters:
  • qi – Charge of particle i

  • qj – Charge of particle j

DEVICE inline bool evalForceAndEnergy(
Scalar &force_divr,
Scalar &pair_eng,
bool energy_shift
)#

Evaluate the force and energy.

Note

There is no need to check if rsq < rcutsq in this method. Cutoff tests are performed in PotentialPair.

Parameters:
  • force_divr – Output parameter to write the computed force divided by r.

  • pair_eng – Output parameter to write the computed pair energy

  • energy_shift – If true, the potential must be shifted so that V(r) is continuous at the cutoff

Returns:

True if they are evaluated or false if they are not because we are beyond the cutoff

DEVICE inline Scalar evalPressureLRCIntegral()#
DEVICE inline Scalar evalEnergyLRCIntegral()#
inline std::string getShapeSpec() const#

Public Static Functions

DEVICE static inline bool needsDiameter()#

LJ doesn’t use diameter.

DEVICE static inline bool needsCharge()#

LJ doesn’t use charge.

static inline std::string getName()#

Get the name of this potential.

Returns:

The potential name.

Protected Attributes

Scalar rsq#

Stored rsq from the constructor.

Scalar rcutsq#

Stored rcutsq from the constructor.

Scalar lj1#

lj1 parameter extracted from the params passed to the constructor

Scalar lj2#

lj2 parameter extracted from the params passed to the constructor