Skip to content

Commit

Permalink
Adding custom basis set interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ifilot committed Jan 14, 2024
1 parent 28b7230 commit 8987213
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyqint/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,7 @@ def get_nuclei(self):
self.__charges[aidx] = getattr(el, atom[0])
self.__nuclei.append([atom[1], self.__charges[aidx]])

# populate number of electrons
self.__nelec = np.sum(self.__charges)

return self.__nuclei
27 changes: 27 additions & 0 deletions tests/test_custom_basis_set.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import unittest
from pyqint import Molecule, cgf, HF
import numpy as np

class TestCustomBasisSet(unittest.TestCase):

def test_custom_basis_set_h2(self):
mol = Molecule()
mol.add_atom('H', 0.0000, 0.0000, 0.3561150187, unit='angstrom')
mol.add_atom('H', 0.0000, 0.0000, -0.3561150187, unit='angstrom')
nuclei = mol.get_nuclei()

cgfs = []
for n in nuclei:
_cgf = cgf(n[0])

_cgf.add_gto(0.154329, 3.425251, 0, 0, 0)
_cgf.add_gto(0.535328, 0.623914, 0, 0, 0)
_cgf.add_gto(0.444635, 0.168855, 0, 0, 0)

cgfs.append(_cgf)

res = HF().rhf(mol, basis=cgfs)
np.testing.assert_almost_equal(res['energy'], -1.1175059, 5)

if __name__ == '__main__':
unittest.main()

0 comments on commit 8987213

Please sign in to comment.