NWChemEx / SimDE

Software development kit for the NWChemEx Community.
https://nwchemex.github.io/SimDE/
Apache License 2.0
0 stars 0 forks source link

Start derivative PR #100

Closed ryanmrichard closed 1 year ago

ryanmrichard commented 1 year ago

This PR is intended to resolve #40 (and all derivatives).

Edit: I had some down time and implemented the PT, documented it, and added unit tests.

I sketched out the Derivative PT, but it's not implemented. The idea is that API looks like:

Tensor (args..., x);

where args... are the arguments to forward to underlying property type and x is the object you are taking the derivative with respect to. So for a nuclear gradient of an energy the call looks like:

auto [x] = mod.run_as<Derivative<AOEnergy, Molecule>>(aos, mol, mol);

(the molecule mol needs to be passed twice to signal it's the argument we're taking the derivative with respect to)

I also now realize NuclearGradient should be NuclearDerivative.

For convenience we should write some typedefs for common derivatives.

FWIW, Hessians are something like Derivative<Derivative<AOEnergy, Molecule>, Molecule> (or if the inner one is called NuclearGradient it becomes the more manageable Derivative<NuclearGradient, Molecule>).

ryanmrichard commented 1 year ago

This PR supersedes #69 and is r2g (once someone fixes the CI issue).