hessian
A starting curvature model, built from the geometry alone.
Bonds are stiff and lattice modes are soft, by two orders of magnitude in a molecular crystal. An optimiser starting from the identity has to discover that from curvature pairs, taking short steps along the soft directions until it does; starting from a model of it costs no energy evaluations at all.
The model here is the usual stretch one -- a spring along every interatomic
vector, stiffer for close pairs -- in the exponential form of Packwood et al.'s
preconditioner, k(r) = mu exp(-A (r / r_nn - 1)).
It is built for any Coordinates without per-class code. The model energy
depends only on interatomic
distances, so its Hessian is G^T diag(k) G, where G[p, k] is how much pair
p stretches per unit of degree of freedom k. That row of G is obtained by
moving each degree of freedom and watching the pair vectors -- which costs
nothing, since no energy is evaluated. Symmetry-adapted coordinates, cell
strains and rigid bodies all come out right, including the periodic images,
because the pair vectors carry their lattice translations with them.
stretch_hessian(coordinates, gamma=DEFAULT_GAMMA, decay=DEFAULT_DECAY, cutoff=None, ridge=DEFAULT_RIDGE, step=1e-05)
A model Hessian in the optimiser's scaled coordinates.
The model is normalised to a mean diagonal of gamma, so what it supplies
is the shape of the curvature -- which directions are stiff relative to
which -- and not its magnitude. That distinction is the difference between
this helping and hurting. Absolute spring constants in eV/A^2 are wrong by
a large factor for any given material (measured: about ninety times too
stiff for Lennard-Jones argon), and a model that is uniformly too stiff
makes every Newton step too short by that factor, so the optimiser crawls.
The anisotropy, meanwhile, is roughly right, and it is what the identity
gets wrong; BFGS learns an overall scale within a couple of steps but takes
far longer to learn a hundredfold spread across directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
the parameterisation to build it for |
required | |
gamma
|
float
|
mean diagonal of the returned model |
DEFAULT_GAMMA
|
decay
|
float
|
exponential fall-off of the stiffness with distance |
DEFAULT_DECAY
|
cutoff
|
float | None
|
pair cutoff in Angstroms; defaults to three times the nearest-neighbour distance |
None
|
ridge
|
float
|
added to the diagonal as a fraction of its mean, so that directions no pair constrains still have positive curvature |
DEFAULT_RIDGE
|
step
|
float
|
displacement used to measure how pairs stretch per degree of freedom. No energies are evaluated, so this is cheap and its only requirement is to stay in the linear regime. |
1e-05
|
Returns:
| Type | Description |
|---|---|
ndarray
|
(n_dof, n_dof) positive-definite curvature model, ready to hand to |
ndarray
|
|