pylj.potentials#
The species and pair potentials packaged with pylj.
Atom species and pair potentials.
- pylj.potentials.check_positive_finite(name: str, value: float) None[source]#
Raises
ValueErrorunlessvalueis positive and finite.- Parameters:
name – The name of the parameter, for the error message.
value – The value to check.
- class pylj.potentials.Species(mass: float, name: str = '')[source]#
Bases:
objectAn atom species.
- Parameters:
mass – The atom mass, in atomic mass units.
name – A label for the species, such as “argon”.
- Raises:
ValueError – If the mass is not positive and finite.
- class pylj.potentials.PairPotential[source]#
Bases:
ABCThe interface every pair potential implements.
Both
energiesandforcestake an array of separationsdr, in metres, and return an array of the same shape.- min_separation#
The separation, in metres, below which the potential is unphysical. Zero, the default, means the potential is physical at every separation. A configuration treats any pair closer than this as forbidden: its energy is infinite, and asking for its force raises an error.
- Type:
float
- class pylj.potentials.LennardJones(*, epsilon: float, sigma: float)[source]#
Bases:
PairPotentialThe 12-6 Lennard-Jones pair potential.
\[E = 4 \epsilon \left[ (\sigma / r)^{12} - (\sigma / r)^{6} \right]\]- Parameters:
epsilon – The well depth, in joules.
sigma – The separation at which the pair energy is zero, in metres.
- Raises:
ValueError – If
epsilonorsigmais not positive and finite.
- class pylj.potentials.Buckingham(*, a: float, b: float, c: float)[source]#
Bases:
PairPotentialThe Buckingham pair potential.
\[E = A e^{-B r} - C / r^{6}\]The formula falls to minus infinity at short range, beyond a barrier.
energiesandforcesreturn it at every separation, andmin_separationis the separation at the top of that barrier.- Parameters:
a – The A parameter, an energy scale, in joules.
b – The B parameter, an inverse length, in reciprocal metres.
c – The C parameter, the dispersion coefficient, in joule metre^6.
- min_separation#
The separation of the top of the short-range barrier, in metres; zero when there is no barrier.
- Type:
float
- Raises:
ValueError – If
aorbis not positive and finite, ifcis negative or not finite, or if the barrier lies beyond 100 Angstrom.
- class pylj.potentials.SquareWell(*, epsilon: float, sigma: float, lambda_: float, max_val: float = inf)[source]#
Bases:
PairPotentialThe square-well pair potential.
The energy is
max_valbelowsigma, minusepsilonbetweensigmaandlambda_timessigma, and zero beyond. It has no finite force, so it is for Monte Carlo, which uses energies only.- Parameters:
epsilon – The well depth, in joules.
sigma – The hard-core diameter, in metres.
lambda – The outer edge of the well, in units of sigma.
max_val – The value used in place of the infinite hard core.
- Raises:
ValueError – If
epsilonorsigmais not positive and finite,lambda_is not greater than one, ormax_valis not positive.