matscipy.calculators.manybody.explicit_forms.harmonic

Harmonic potentials for bonds and triplets.

Classes

HarmonicAngle(a0, k, atoms)

Defines a harmonic angle potential.

HarmonicBond(r0, k)

Defines a harmonic bond.

ZeroPair()

Defines a non-interacting pair potential.

ZeroTriplet()

Defines a non-interacting triplet potential.

class matscipy.calculators.manybody.explicit_forms.harmonic.ZeroPair

Bases: G

Defines a non-interacting pair potential.

Methods

__call__(r, xi, *args)

Return triplet energy only.

gradient(r, xi, *args)

Return triplet interaction only.

hessian(r, xi, *args)

Zero hessian.

gradient(r, xi, *args)

Return triplet interaction only.

hessian(r, xi, *args)

Zero hessian.

class matscipy.calculators.manybody.explicit_forms.harmonic.ZeroTriplet

Bases: G

Defines a non-interacting triplet potential.

Methods

__call__(*args)

Zero triplet energy.

gradient(*args)

Zero triplet force.

hessian(*args)

Zero triplet hessian.

gradient(*args)

Zero triplet force.

hessian(*args)

Zero triplet hessian.

class matscipy.calculators.manybody.explicit_forms.harmonic.HarmonicBond(r0, k)

Bases: F

Defines a harmonic bond.

Methods

__call__(r, xi, atype, ptype)

Compute spring potential energy.

gradient(r, xi, atype, ptype)

Compute spring force.

hessian(r, xi, atype, ptype)

Compute spring stiffness.

__init__(r0, k)

Initialize with equilibrium distance and stiffness.

gradient(r, xi, atype, ptype)

Compute spring force.

hessian(r, xi, atype, ptype)

Compute spring stiffness.

class matscipy.calculators.manybody.explicit_forms.harmonic.HarmonicAngle(a0, k, atoms: Atoms)

Bases: G

Defines a harmonic angle potential.

Methods

__call__(r_ij_c, r_ik_c, *args)

Angle harmonic energy.

gradient(r_ij_c, r_ik_c, *args)

Compute derivatives of \(G\) w/r to \(r_{ij}\) and \(r_{ik}\).

hessian(r_ij_c, r_ik_c, *args)

Compute derivatives of \(G\) w/r to \(r_{ij}\) and \(r_{ik}\).

__init__(a0, k, atoms: Atoms)

Initialize with equilibrium angle and stiffness.

Note: atoms are needed because mics are calculated for triplet distances. This will be removed once G is redefined to take triplet distances instead of vectors.

gradient(r_ij_c, r_ik_c, *args)

Compute derivatives of \(G\) w/r to \(r_{ij}\) and \(r_{ik}\).

We have the following partial derivatives:

\[\begin{split}\frac{\partial G}{\partial u_i}(\vec{u}, \vec{v}) & = h'(F(\vec{u}, \vec{v})) \frac{\partial F}{\partial u_i}(\vec{u}, \vec{v}) \\ \frac{\partial G}{\partial v_i}(\vec{u}, \vec{v}) & = h'(F(\vec{u}, \vec{v})) \frac{\partial F}{\partial v_i}(\vec{u}, \vec{v}) \\\end{split}\]

The partial derivatives of \(F\) are expressed as:

\[\begin{split}\frac{\partial F}{\partial u_i} = U_i & = \frac{\partial f}{\partial u}\frac{\partial u}{\partial u_i} + \frac{\partial f}{\partial w}\frac{\partial w}{\partial u_i}\\ \frac{\partial F}{\partial v_i} = V_i & = \frac{\partial f}{\partial v}\frac{\partial v}{\partial v_i} + \frac{\partial f}{\partial w}\frac{\partial w}{\partial v_i}\end{split}\]

We note the normal vectors as:

\[\begin{split}\bar{u}_i & = \frac{u_i}{u}\\ \bar{v}_i & = \frac{v_i}{v}\\ \bar{w}_i & = \frac{w_i}{w}\end{split}\]

So that we can write the following partial derivatives:

\[\begin{split}\frac{\partial u}{\partial u_i} & = \bar{u}_i\\ \frac{\partial v}{\partial v_i} & = \bar{v}_i\\ \frac{\partial w}{\partial u_i} & = -\bar{w}_i\\ \frac{\partial w}{\partial v_i} & = \bar{w}_i\end{split}\]

Which gives the final expressions for \(U_i\) and \(V_i\):

\[\begin{split}U_i &= \frac{\partial f}{\partial u} \bar{u}_i + \frac{\partial f}{\partial w} (-\bar{w}_i)\\ V_i &= \frac{\partial f}{\partial v} \bar{v}_i + \frac{\partial f}{\partial w} \bar{w}_i\end{split}\]

The remaining scalar partial derivatives are simple to derive and left to the reader :P .

hessian(r_ij_c, r_ik_c, *args)

Compute derivatives of \(G\) w/r to \(r_{ij}\) and \(r_{ik}\).

We have the following partial derivatives:

\[\begin{split}\frac{\partial^2 G}{\partial u_i\partial u_j}(\vec{u}, \vec{v}) & = h''(F) U_i U_j + h'(F)\frac{\partial U_i}{\partial u_j}\\ \frac{\partial^2 G}{\partial v_i\partial v_j}(\vec{u}, \vec{v}) & = h''(F) V_i V_j + h'(F)\frac{\partial V_i}{\partial v_j}\\ \frac{\partial^2 G}{\partial u_i\partial v_j}(\vec{u}, \vec{v}) & = h''(F) U_i V_j + h'(F)\frac{\partial U_i}{\partial v_j}\end{split}\]

The derivatives of \(U_i\) and \(V_i\) need careful treatment:

\[\begin{split}\frac{\partial U_i}{\partial u_j} = \frac{\partial}{\partial u_j}\left(\frac{\partial f}{\partial u}(u, v, w(\vec{u}, \vec{v}))\right) \frac{\partial u}{\partial u_i} + \frac{\partial f}{\partial u}\frac{\partial^2 u}{\partial u_i\partial u_j} + \frac{\partial}{\partial u_j}\left(\frac{\partial f}{\partial w}(u, v, w(\vec{u}, \vec{v}))\right) \frac{\partial w}{\partial u_i} + \frac{\partial f}{\partial w} \frac{\partial^2 w}{\partial u_i\partial u_j}\\ \frac{\partial V_i}{\partial v_j} = \frac{\partial}{\partial v_j}\left(\frac{\partial f}{\partial v}(u, v, w(\vec{u}, \vec{v}))\right) \frac{\partial v}{\partial v_i} + \frac{\partial f}{\partial v}\frac{\partial^2 v}{\partial v_i\partial v_j} + \frac{\partial}{\partial v_j}\left(\frac{\partial f}{\partial w}(u, v, w(\vec{u}, \vec{v}))\right) \frac{\partial w}{\partial v_i} + \frac{\partial f}{\partial w} \frac{\partial^2 w}{\partial v_i\partial v_j}\\ \frac{\partial U_i}{\partial v_j} = \frac{\partial}{\partial v_j}\left(\frac{\partial f}{\partial u}(u, v, w(\vec{u}, \vec{v}))\right) \frac{\partial u}{\partial u_i} + \frac{\partial f}{\partial u}\frac{\partial^2 u}{\partial u_i\partial v_j} + \frac{\partial}{\partial v_j}\left(\frac{\partial f}{\partial w}(u, v, w(\vec{u}, \vec{v}))\right) \frac{\partial w}{\partial u_i} + \frac{\partial f}{\partial w} \frac{\partial^2 w}{\partial u_i\partial v_j}\end{split}\]

For the simple partial derivatives in the above section, we have:

\[\begin{split}\frac{\partial^2 u}{\partial u_i\partial u_j} & = \bar{\bar{u}}_{ij} = \frac{\delta_{ij} - \bar{u}_i \bar{u}_j}{u}\\ \frac{\partial^2 v}{\partial v_i\partial v_j} & = \bar{\bar{u}}_{ij} = \frac{\delta_{ij} - \bar{v}_i \bar{v}_j}{v}\\ \frac{\partial^2 u}{\partial u_i\partial v_j} & = 0\\ \frac{\partial^2 w}{\partial u_i\partial u_j} & = \bar{\bar{w}}_{ij} = \frac{\delta_{ij} - \bar{w}_i \bar{w}_j}{w}\\ \frac{\partial^2 w}{\partial v_i\partial v_j} & = \bar{\bar{w}}_{ij}\\ \frac{\partial^2 w}{\partial u_i\partial v_j} & = -\bar{\bar{w}}_{ij}\end{split}\]

For the more complex partial derivatives:

\[\begin{split}\frac{\partial}{\partial u_j}\left(\frac{\partial f}{\partial u}(u, v, w(\vec{u}, \vec{v}))\right) & = \frac{\partial^2 f}{\partial u^2} \frac{\partial u}{\partial u_j} + \frac{\partial^2 f}{\partial u\partial w}\frac{\partial w}{\partial u_j}\\ \frac{\partial}{\partial u_j}\left(\frac{\partial f}{\partial w}(u, v, w(\vec{u}, \vec{v}))\right) & = \frac{\partial^2 f}{\partial w\partial u} \frac{\partial u}{\partial u_j} + \frac{\partial^2 f}{\partial w^2}\frac{\partial w}{\partial u_j}\\ \frac{\partial}{\partial v_j}\left(\frac{\partial f}{\partial v}(u, v, w(\vec{u}, \vec{v}))\right) & = \frac{\partial^2 f}{\partial v^2} \frac{\partial v}{\partial v_j} + \frac{\partial^2 f}{\partial v\partial w}\frac{\partial w}{\partial v_j}\\ \frac{\partial}{\partial v_j}\left(\frac{\partial f}{\partial w}(u, v, w(\vec{u}, \vec{v}))\right) & = \frac{\partial^2 f}{\partial w\partial v} \frac{\partial v}{\partial v_j} + \frac{\partial^2 f}{\partial w^2}\frac{\partial w}{\partial v_j}\\ \frac{\partial}{\partial v_j}\left(\frac{\partial f}{\partial u}(u, v, w(\vec{u}, \vec{v}))\right) & = \frac{\partial^2 f}{\partial u\partial v} \frac{\partial v}{\partial v_j} + \frac{\partial^2 f}{\partial u\partial w}\frac{\partial w}{\partial v_j}\\\end{split}\]

The remaining scalar derivatives are left to the reader.