pylj.forcefields

The forcefields packaged with pylj.

class pylj.forcefields.buckingham(constants)[source]

Bases: object

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

Parameters:

constants (float, array_like) – An array of length three consisting of the A, B and C parameters for the Buckingham function.

energy(dr)[source]

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

\[E = Ae^{(-Bdr)} - \frac{C}{dr^6}\]

Attributes:

dr (float): The distance between particles.

returns:
  • float (array_like)

  • The potential energy between the particles.

force(dr)[source]

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

\[f = ABe^{(-Bdr)} - \frac{6C}{dr^7}\]

Attributes:

dr (float): The distance between particles.

returns:
  • float (array_like)

  • The force between the particles.

mixing(constants2)[source]

Calculates mixing for two sets of constants

..math::

a_{12} = sqrt{a_1 * a_2} b_{12} = sqrt{b_1 * b_2} c_{12} = sqrt{c_1 * c_2}

Attributes:

constants_2: float, array_like

The second set of constantss

class pylj.forcefields.lennard_jones(constants)[source]

Bases: lennard_jones_sigma_epsilon

Converts a/b variant values to sigma/epsilon variant then maps to lennard_jones_sigma_epsilon class

..math::

sigma = frac{a}{b}^(frac{1}{6}) sigma = frace{b^2}{4*a}

Parameters:

constants (float, array_like) – An array of length two consisting of the A and B parameters for the 12-6 Lennard-Jones function

mixing(constants_2)[source]

Converts second set of a/b constants into sigma/epsilon for use in mixing method. Then converts changed self sigma/epsilon values back to a/b

..math::

a = 4*epsilon*(sigma^12) b = 4*epsilon*(sigma^6)

Parameters:

constants_2: float, array_like

The second set of constantss

class pylj.forcefields.lennard_jones_sigma_epsilon(constants)[source]

Bases: object

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

Parameters:

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

energy(dr)[source]

Calculate the energy 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}\]

Attributes:

dr (float): The distance between particles.

returns:
  • float (array_like)

  • The potential energy between the particles.

force(dr)[source]

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

\[f = \frac{48e*a^{12}}{dr^{13}} - \frac{24e*a^{6}}{dr^7}\]

Attributes:

dr (float): The distance between particles.

returns:
  • float (array_like)

  • The force between the particles.

mixing(constants_2)[source]

Calculates mixing for two sets of constants

..math::

sigma_{12} = frac{sigma_1 + sigma_2}{2} epsilon{12} = sqrt{epsilon_1 * epsilon_2}

Parameters:

constants_2: float, array_like

The second set of constantss

class pylj.forcefields.square_well(constants, max_val=inf)[source]

Bases: object

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

Parameters:
  • 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

energy(dr)[source]

Calculate the energy 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 }\]

Attributes:

dr (float): The distance between particles.

returns:

float – The potential energy between the particles.

rtype:

array_like

force()[source]

The force of a pair of particles using a square well model is given by:

\[\]

f = { if sigma <= dr < lambda * sigma:

f = inf

else:

f = 0

}

Therefore the force here will always be infinite, and therefore not possible to simulate