Skip to content

Commit

Permalink
Harris functional correctly working
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloAMC committed Sep 11, 2023
1 parent 04b236d commit b669e04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/install_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
run: |
pytest -v tests/integration/test_non_xc_energy.py
pytest -v tests/integration/test_classical_functionals.py
pytest -v tests/integration/test_Harris.py
pytest -v tests/integration/test_predict_B88.py
pytest -v tests/integration/test_predict_B3LYP.py
7 changes: 4 additions & 3 deletions grad_dft/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,13 @@ def Harris_energy(

energy = jnp.einsum("sr,sr->", molecule.mo_occ, molecule.mo_energy)

energy -= coulomb_energy(molecule.rdm1, molecule.rep_tensor)/2.
energy += molecule.nuclear_repulsion
coulomb_e = -coulomb_energy(molecule.rdm1, molecule.rep_tensor)

xc_energy, xcfock = xc_energy_and_grads(params, molecule.rdm1, molecule, *args, **kwargs)

return energy + xc_energy - jnp.einsum("sij,sij->", molecule.rdm1, xcfock)
return energy + xc_energy - jnp.einsum("sij,sij->", molecule.rdm1, xcfock) + coulomb_e + molecule.nuclear_repulsion

return Harris_energy



Expand Down

0 comments on commit b669e04

Please sign in to comment.