pylj.forcefields¶
The forcefields packaged with pylj.
- class pylj.forcefields.buckingham(constants)[source]¶
Bases:
objectCalculate 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.
- class pylj.forcefields.lennard_jones(constants)[source]¶
Bases:
lennard_jones_sigma_epsilonConverts 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
- class pylj.forcefields.lennard_jones_sigma_epsilon(constants)[source]¶
Bases:
objectCalculate 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.
- class pylj.forcefields.square_well(constants, max_val=inf)[source]¶
Bases:
objectCalculate 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