analytical second order derivatives (Hessians) #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Semiclassical propagators such as the Herman-Kluk propagator (https://doi.org/10.1063/1.450142) require a local
harmonic approximation to the potential energy surface around the instantaneous position of each trajectory. Computing the Hessian numerically for each time step during a molecular dynamics simulation would be too inaccurate and time-consuming. Being able to compute Hessians efficiently is probably also useful for other applications such as optimizations of the molecular geometry.
torchtools_hessian.py
contains another torch implementation of the sGDML predictor, which in addition to energies and gradients/forces can also evaluate the Hessians analytically for a batch of geometries. This is done by differentiating the kernel a third time w/r/t to the cartesian coordinates. It is assumed that the descriptor is the Coulomb matrix.An analytical Hessian calculation is roughly 4 times more expensive than a gradient calculation.
test_torchtools_hessian.py
checks that the proposed predictor produces the same energies and gradients as the current implementation. It is a little bit slower than the current implementation when only energies and gradients are requested. The analytical Hessians are checked against finite-difference Hessians computed with ASE.I hope this might be useful.