def HFGF(atoms,charge=0): nclosed,nopen = atoms.get_closedopen() if nopen: raise Exception("HFGF only works for closed shell cases") bfs = getbasis(atoms) nvirt = len(bfs)-nclosed S,h,Ints = getints(bfs,atoms) hf_energy,hf_orbe,hf_orbs = scf(atoms,S,h,Ints,charge) print_orbe(hf_orbe,nclosed,nvirt) sigma = Sigma2(hf_orbe,hf_orbs,Ints,len(bfs),nclosed) for i in [4,5,6,7,8,9]: print "Correcting orbital %d, HF Eorb = %f" % (i+1,hf_orbe[i]) del0,dele = sigma.eval(i) print "-> Eorb = %f %f" % (hf_orbe[i]+del0,hf_orbe[i]+dele) return
def test(): # Jaguar gets -0.0276516 h for this: from Ints import getbasis, getints from hartree_fock import scf from IO import mtx2file from Molecule import Molecule atoms = Molecule('h2', [(1, (1., 0, 0)), (1, (-1., 0, 0))]) bfs = getbasis(atoms) S, h, Ints = getints(bfs, atoms) en, orbe, orbs = scf(atoms, S, h, Ints, 0, 0.0001, 10) print "SCF completed, E = ", en emp2 = MP2(Ints, orbs, orbe, 1, 9) print "MP2 correction = ", emp2 print "Final energy = ", en + emp2 return
def HFGF(atoms, charge=0): nclosed, nopen = atoms.get_closedopen() if nopen: raise Exception("HFGF only works for closed shell cases") bfs = getbasis(atoms) nvirt = len(bfs) - nclosed S, h, Ints = getints(bfs, atoms) hf_energy, hf_orbe, hf_orbs = scf(atoms, S, h, Ints, charge) print_orbe(hf_orbe, nclosed, nvirt) sigma = Sigma2(hf_orbe, hf_orbs, Ints, len(bfs), nclosed) for i in [4, 5, 6, 7, 8, 9]: print "Correcting orbital %d, HF Eorb = %f" % (i + 1, hf_orbe[i]) del0, dele = sigma.eval(i) print "-> Eorb = %f %f" % (hf_orbe[i] + del0, hf_orbe[i] + dele) return
def test(): # Jaguar gets -0.0276516 h for this: from Ints import getbasis,getints from hartree_fock import scf from IO import mtx2file from Molecule import Molecule atoms = Molecule('h2',[(1,(1.,0,0)),(1,(-1.,0,0))]) bfs = getbasis(atoms) S,h,Ints = getints(bfs,atoms) en,orbe,orbs = scf(atoms,S,h,Ints,0,0.0001,10) print "SCF completed, E = ",en emp2 = MP2(Ints,orbs,orbe,1,9) print "MP2 correction = ",emp2 print "Final energy = ",en+emp2 return