MRChemSoft / mrchem

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

Modernize energy calculation #267

Closed bjorgve closed 4 years ago

bjorgve commented 4 years ago

Previously, the kinetic energy could not be calculated accurately, and the total energy was found through massaging equations and sorcery. Now, however, thanks to the ABGV derivative operator (yes, this should have been fixed ages ago), the kinetic energy can be calculated accurately, in the traditional approach. This should make it allot easier to add energy contributions from other potentials like V_ff (periodic), V_r (solvation) and V_ext (external electric field).

Tests appear to work for all cases apart from for H_SCF_finite_electric_field, I'm not sure why, but probably some sorcery, that no longer should be necessary, was done to make it work to begin with.

The Hartree--Fock test also fails, but I suspect this is due to errors in the reference values.

As a sidenote H_SCF_finite_electric_field does not appear to test the E_nex, it is zero. Is this tested somewhere else?

codecov[bot] commented 4 years ago

Codecov Report

Merging #267 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #267   +/-   ##
=======================================
  Coverage   54.44%   54.44%           
=======================================
  Files         105      105           
  Lines        8319     8319           
=======================================
  Hits         4529     4529           
  Misses       3790     3790
Impacted Files Coverage Δ
src/qmoperators/one_electron/NuclearOperator.h 100% <ø> (ø) :arrow_up:
src/qmoperators/two_electron/CoulombOperator.h 100% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e823616...b559431. Read the comment docs.

stigrj commented 4 years ago

This snowballed a bit. I completely removed the EnergyOptimizer and moved the OrbitalOptimizer up into the GroundStateSolver base. @bjorgve you'll have to self-review this one