Lennard-Jones

LjNd

class LjNd : public minim::NewPotential<LjNd>

Lennard-Jones potential in an arbitrary number of dimensions.

Pairwise interaction of particles, with energy \( 4 \epsilon \left[ (\sigma/r)^{12} - (\sigma/r)^{6} \right] \), where \( r \) is the particle separation. The repulsive \( r^{-12} \) and attractive \( r^{-6} \) terms give a potential well of depth \( \epsilon \) at separation \( \sigma 2^{1/6} \).

The number of particles is inferred from the length of the coordinates, and all pairs are used as energy elements.

Subclassed by minim::Lj2d, minim::Lj3d

System size

int nDim

The number of spatial dimensions.

int nParticle

The number of particles.

inline LjNd(int nDim)

Construct a potential for the given number of dimensions.

inline LjNd(int nDim, double sigma, double epsilon)

Construct a potential with the given dimension and parameters.

Parameters

double sigma = 1

The Lennard-Jones length parameter.

double epsilon = 1

The Lennard-Jones energy parameter.

LjNd &setSigma(double sigma)

Set the Lennard-Jones length parameter.

LjNd &setEpsilon(double epsilon)

Set the Lennard-Jones energy parameter.

Overrides

virtual void init(const vector<double> &coords) override

Initialise the potential with the coordinates of a new state.

virtual void elementEnergyGradient(const vector<double> &coords, const Element &el, double *e, vector<double> *g) const override

Compute the energy and gradient of a single element.

Lj2d

class Lj2d : public minim::LjNd

Lennard-Jones potential in two dimensions.

Lj3d

class Lj3d : public minim::LjNd

Lennard-Jones potential in three dimensions.