pylj.forcefields

The forcefields packaged with pylj.

pylj.forcefields.buckingham[source]

Calculate the energy or force for a pair of particles using the Buckingham forcefield.

\[E = Ae^{(-Bdr)} - \frac{C}{dr^6}\]
\[f = ABe^{(-Bdr)} - \frac{6C}{dr^7}\]
Parameters:
  • dr (float, array_like) – The distances between all the pairs of particles.
  • constants (float, array_like) – An array of length three consisting of the A, B and C parameters for the Buckingham function.
  • force (bool (optional)) – If true, the negative first derivative will be found.
Returns:

float – The potential energy or force between the particles.

Return type:

array_like

pylj.forcefields.lennard_jones[source]

Calculate the energy or force for a pair of particles using the Lennard-Jones (A/B variant) forcefield.

\[E = \frac{A}{dr^{12}} - \frac{B}{dr^6}\]
\[f = \frac{12A}{dr^{13}} - \frac{6B}{dr^7}\]
Parameters:
  • dr (float, array_like) – The distances between the all pairs of particles.
  • constants (float, array_like) – An array of length two consisting of the A and B parameters for the 12-6 Lennard-Jones function
  • force (bool (optional)) – If true, the negative first derivative will be found.
Returns:

float – The potential energy or force between the particles.

Return type:

array_like

pylj.forcefields.lennard_jones_sigma_epsilon[source]

Calculate the energy or force for a pair of particles using the Lennard-Jones (sigma/epsilon variant) forcefield.

\[E = \frac{4e*a^{12}}{dr^{12}} - \frac{4e*a^{6}}{dr^6}\]
\[f = \frac{48e*a^{12}}{dr^{13}} - \frac{24e*a^{6}}{dr^7}\]
Parameters:
  • dr (float, array_like) – The distances between the all pairs of particles.
  • constants (float, array_like) – An array of length two consisting of the sigma (a) and epsilon (e) parameters for the 12-6 Lennard-Jones function
  • force (bool (optional)) – If true, the negative first derivative will be found.
Returns:

float – The potential energy or force between the particles.

Return type:

array_like

pylj.forcefields.square_well(dr, constants, max_val=inf, force=False)[source]

Calculate the energy or force for a pair of particles using a square well model.

\[E = { if dr < sigma: E = max_val elif sigma <= dr < lambda * sigma: E = -epsilon elif r >= lambda * sigma: E = 0 }\]
\[f = { if sigma <= dr < lambda * sigma: f = inf else: f = 0 }\]
Parameters:
  • dr (float, array_like) – The distances between all the pairs of particles.
  • constants (float, array_like) – An array of length three consisting of the epsilon, sigma, and lambda parameters for the square well model.
  • max_val (int (optional)) – Upper bound for values in square well - replaces usual infinite values
  • force (bool (optional)) – If true, the negative first derivative will be found.
Returns:

float – The potential energy between the particles.

Return type:

array_like