-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing #27: Adding final update to energy vector
- Loading branch information
Showing
3 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest | ||
from pyqint import MoleculeBuilder, HF | ||
import numpy as np | ||
|
||
class TestEnergyDecomposition(unittest.TestCase): | ||
|
||
def test_hartree_fock_h2o(self): | ||
""" | ||
Test Hartree-Fock calculation on water using STO-3G basis set | ||
""" | ||
mol = MoleculeBuilder().from_name("h2o") | ||
|
||
res = HF().rhf(mol, 'sto3g') | ||
P = res['density'] | ||
T = res['kinetic'] | ||
V = res['nuclear'] | ||
H = res['fock'] | ||
enucrep = res['enucrep'] | ||
energy = res['energy'] | ||
|
||
np.testing.assert_almost_equal(0.5 * np.einsum('ji,ij', P, T+V+H) + enucrep, energy, decimal=16) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters