potentials
Pair potentials.
PairPotential turns a distance dependence into a complete calculator. A
subclass sets cutoff and implements pair, returning the pair energy and its
derivative; analytic forces, stress, per-atom energies and the neighbour list
follow from those.
class Morse(PairPotential):
cutoff = 8.0
def pair(self, r, zi, zj):
x = np.exp(-self.a * (r - self.r0))
return self.d * (x**2 - 2 * x), -2 * self.a * self.d * (x**2 - x)
The virial is written once here rather than in each subclass, since it is the
easiest part to get wrong: dE/deps_ab = sum_pairs phi'(r) v_a v_b / r, summed
over the pair vectors, which carry their lattice translations.
ExternalStress
Bases: Calculator
A constant applied stress, to add to another calculator.
The energy is V0 sigma : eps, with eps = sym(F) - I the small strain of
the cell h = h0 F from a reference cell h0, and V0 its volume. A
structure that minimises E + V0 sigma : eps has its own stress equal to
-sigma. With sigma = P I this is a hydrostatic pressure, to first order
in the strain.
relax(crystal, calc + ExternalStress(sigma_gpa, reference_cell))
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stress
|
(3, 3) applied stress in GPa, in the ASE sign convention (positive is tensile on the structure's own stress) |
required | |
reference_cell
|
(3, 3) lattice vectors as rows that the strain is measured from |
required |
Source code in chmpy/calc/potentials.py
LennardJones
Bases: PairPotential
The 12-6 Lennard-Jones potential, one set of parameters for all elements.
Cheap, differentiable and with a known minimum, which makes it the test fixture for the optimiser as well as a usable potential for rare gases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epsilon
|
float
|
well depth in eV |
0.0103
|
sigma
|
float
|
distance at which the potential crosses zero, Angstroms |
3.4
|
cutoff
|
interaction range, Angstroms |
required |
Source code in chmpy/calc/potentials.py
PairPotential
Bases: Calculator
A calculator for an energy that is a sum over pairs of a function of distance.
Subclasses set cutoff and implement pair. Everything else -- forces,
stress, per-atom energies, neighbour lists -- follows from those.
Attributes:
| Name | Type | Description |
|---|---|---|
cutoff |
float
|
interaction range in Angstroms |
skin |
float
|
Verlet skin for the neighbour list, as a fraction of the cutoff |
shift_energy |
bool
|
subtract |
Source code in chmpy/calc/potentials.py
pair(r, zi, zj)
The pair energy and its derivative with respect to distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
ndarray
|
(P,) pair distances in Angstroms |
required |
zi
|
ndarray
|
(P,) atomic number of the first atom of each pair |
required |
zj
|
ndarray
|
(P,) atomic number of the second atom |
required |
Returns:
| Type | Description |
|---|---|
|
(energy, denergy_dr), both (P,), in eV and eV/A |