MRChemSoft / mrchem

MultiResolution Chemistry
GNU Lesser General Public License v3.0
30 stars 21 forks source link

one- and two-electron operators #289

Open ilfreddy opened 4 years ago

ilfreddy commented 4 years ago

Is there any good (code-related) reason to keep 1- and 2-el operators separate in the code? As a matter of coding, this distinction seems to me rather arbitrary. I'm starting to code ZORA and I am implementing the ZORA "potential" (1-V/2c^2) and its inverse "kappa". In this first implementation I'm only considering the nuclear potential and therefore the ZORA potential is a 1-el operator. I have also implemented the corresponding kinetic energy operator (p kappa p)/2. As long as V is the nuclear potential all such operators will be 1-el, but as soon as I will add the coulomb and xc pieces, they will become 2-el operators and I will have to move them to the other folder. Does not make much sense to me.

stigrj commented 4 years ago

At some point in the past these were actually two different base classes OneElectronOperator and TwoElectronOperator. I think it might be a good idea to re-introduce this separation, so that a TwoElectronOperator takes an OrbitalVector as a second argument to setup, instead of to its constructor, i.e. instead of this (P is Poisson operator)

CoulombOperator J(P, Phi);
J.setup(prec);

we do this

CoulombOperator J(P);
J.setup(prec, Phi);

This way the operator is not tied to a particular Phi.

stigrj commented 4 years ago

But short answer: no it doesn't matter, put it where ever you want

ilfreddy commented 4 years ago

But then if you don't need Phi in the constructor, why would you want two base classes? Setup is anyway different for each derived class (or is it?). Or do you assume that each operator has a setup(prec)?

stigrj commented 4 years ago

All operators must have a setup(prec) function

ilfreddy commented 4 years ago

OK. I have no strong opinion about having the base classes. If you thin k it is a good idea, we can do it.