analytical second order derivatives (Hessians) - #15
Open
humeniuka wants to merge 9 commits into
Open
Conversation
…second order derivatives of the potential energy (Hessians) in addition to energies and gradients. `test_torchtools_hessian.py` demonstrates that the new implementation of GDMLPredict(...) gives the same energies and gradients as the original GDMLTorchPredict(...) . The analytical Hessians are compared to numerical Hessian computed with ASE. Certain semiclassical propagators such as the Herman-Kluk propagator require a local harmonic approximation around each trajectory. Computing the Hessian numerically for each time step would be too inaccurate and time-consuming. The analytical Hessian calculation is roughly 5-10 times more expensive than a gradient calculation.
… the energy label is read as the first float in the line
…ordinary xyz file
…l index arrays to the GPU a 10x speed-up is achieved
…l index arrays to the GPU a 10x speed-up is achieved
… more expensive than a gradient calculation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.pycontains 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.pychecks 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.