leeping / geomeTRIC

Geometry optimization code that includes the TRIC coordinate system
https://geometric.readthedocs.io/
Other
147 stars 65 forks source link

permit Hessian computation through Engine? #183

Open corinwagen opened 7 months ago

corinwagen commented 7 months ago

Hello, thanks for the lovely and clean package!

I'm curious if you've considered adding a calc_hessian call to Engine(), so that analytic Hessians might be employed where possible? I know DLFIND takes Hessian callbacks, and since most quantum chemistry programs already have default machinery for computing Hessians it might be nice to offload some of the work (unless there's some special finite difference tricks you're employing here).

corin

leeping commented 7 months ago

Yes, that's something I'd like to do in a few months' time. (While we're at it, I would like to add an energy call as well.) I think at the most basic level one could modify the "job type" option in the quantum chemistry input file to request a Hessian or an energy instead of a gradient and then parse the result.

There are no special tricks for the current code for computing the Hessian, but it could be faster than the analytic Hessian in terms of wall time due to the capability of distributing the gradient calculations to many processors / nodes via Work Queue.

annulen commented 4 months ago

This feature could also be used to compute semiempirical (e.g., GFN2-xTB) Hessian instead of using model one. In particular, I've discovered that GFN2-xTB with --bhess mode of xtb (aka "Single-Point Hessian") produces very good starting Hessians (difference of --bhess vs normal Hessian is that the former creates artificial minimum at given geometry, therefore resulting Hessian doesn't have negative eigenvalues)

corinwagen commented 4 months ago

Right, we've been thinking about that as well - initial guess Hessian can make a big difference, cf. recent Merz work. Even a cheap semiempirical/ML Hessian probably beats a Schlegel-type guess...

leeping commented 4 months ago

It is possible to provide an initial Hessian at the start of the TS calculation by passing a file containing a square matrix in text format. The assumption is you could compute that Hessian separately using any method or software you like.

I am interested in supporting QM codes' native Hessians in a more integrated way; however, the run parameters are likely to be quite different from the gradient calculations given all of the approximations that could be used. Perhaps by adding two new command line arguments --hessian_engine and --hessian_input to specify the QM engine for the Hessian calculation and the associated input file, that could take care of most cases?

corinwagen commented 4 months ago

I've only used the API interface, so I don't have a strong opinion about CLI arguments, but that seems reasonable. I suppose Hessian engine could default to the regular (gradient) engine unless otherwise specified?