def update(self, **kwargs): from PyQuante.LA2 import trace2 from PyQuante.Ints import getJ from PyQuante.dft import getXC #self.DoAveraging = kwargs.get('DoAveraging',True) #if self.DoAveraging: # self.Averager = DIIS(self.S) if self.DoAveraging and self.dmat is not None: self.F = self.Averager.getF(self.F, self.dmat) self.dmat, self.entropy = self.solver.solve(self.F, **kwargs) D = self.dmat self.gr.setdens(D) self.J = getJ(self.ERI, D) self.Ej = 2 * trace2(D, self.J) self.Exc, self.XC = getXC(self.gr, self.nel, functional=self.functional) self.Eone = 2 * trace2(D, self.h) self.F = self.h + 2 * self.J + self.XC self.energy = self.Eone + self.Ej + self.Exc + self.Enuke + self.entropy return
def update(self,**kwargs): from PyQuante.LA2 import trace2 from PyQuante.Ints import getJ from PyQuante.dft import getXC #self.DoAveraging = kwargs.get('DoAveraging',True) #if self.DoAveraging: # self.Averager = DIIS(self.S) if self.DoAveraging and self.dmat is not None: self.F = self.Averager.getF(self.F,self.dmat) self.dmat,self.entropy = self.solver.solve(self.F,**kwargs) D = self.dmat self.gr.setdens(D) self.J = getJ(self.ERI,D) self.Ej = 2*trace2(D,self.J) self.Exc,self.XC = getXC(self.gr,self.nel, functional=self.functional) self.Eone = 2*trace2(D,self.h) self.F = self.h+2*self.J+self.XC self.energy = self.Eone + self.Ej + self.Exc + self.Enuke + self.entropy return
def pyq1_dft(atomtuples=[(2, (0, 0, 0))], basis='6-31G**', maxit=10, xcname='SVWN'): from PyQuante import Ints, settings, Molecule from PyQuante.dft import getXC from PyQuante.MG2 import MG2 as MolecularGrid from PyQuante.LA2 import mkdens, geigh, trace2 from PyQuante.Ints import getJ print("PyQ1 DFT run") atoms = Molecule('Pyq1', atomlist=atomtuples) bfs = Ints.getbasis(atoms, basis=basis) S, h, Ints = Ints.getints(bfs, atoms) nclosed, nopen = nel // 2, nel % 2 assert nopen == 0 enuke = atoms.get_enuke() grid_nrad = settings.DFTGridRadii grid_fineness = settings.DFTGridFineness gr = MolecularGrid(atoms, grid_nrad, grid_fineness) gr.set_bf_amps(bfs) orbe, orbs = geigh(h, S) eold = 0 for i in range(maxit): D = mkdens(orbs, 0, nclosed) gr.setdens(D) J = getJ(Ints, D) Exc, Vxc = getXC(gr, nel, functional=xcname) F = h + 2 * J + Vxc orbe, orbs = geigh(F, S) Ej = 2 * trace2(D, J) Eone = 2 * trace2(D, h) energy = Eone + Ej + Exc + enuke print(i, energy, Eone, Ej, Exc, enuke) if np.isclose(energy, eold): break eold = energy return energy
def pyq1_dft(atomtuples=[(2,(0,0,0))],basis = '6-31G**',maxit=10, xcname='SVWN'): from PyQuante import Ints,settings,Molecule from PyQuante.dft import getXC from PyQuante.MG2 import MG2 as MolecularGrid from PyQuante.LA2 import mkdens,geigh,trace2 from PyQuante.Ints import getJ print ("PyQ1 DFT run") atoms = Molecule('Pyq1',atomlist=atomtuples) bfs = Ints.getbasis(atoms,basis=basis) S,h,Ints = Ints.getints(bfs,atoms) nclosed,nopen = nel//2,nel%2 assert nopen==0 enuke = atoms.get_enuke() grid_nrad = settings.DFTGridRadii grid_fineness = settings.DFTGridFineness gr = MolecularGrid(atoms,grid_nrad,grid_fineness) gr.set_bf_amps(bfs) orbe,orbs = geigh(h,S) eold = 0 for i in range(maxit): D = mkdens(orbs,0,nclosed) gr.setdens(D) J = getJ(Ints,D) Exc,Vxc = getXC(gr,nel,functional=xcname) F = h+2*J+Vxc orbe,orbs = geigh(F,S) Ej = 2*trace2(D,J) Eone = 2*trace2(D,h) energy = Eone + Ej + Exc + enuke print (i,energy,Eone,Ej,Exc,enuke) if np.isclose(energy,eold): break eold = energy return energy
def update(self,**opts): from PyQuante.LA2 import trace2 from PyQuante.Ints import getJ from PyQuante.dft import getXC self.dmat,self.entropy = self.solver.solve(self.F,**opts) D = self.dmat self.gr.setdens(D) self.J = getJ(self.ERI,D) self.Ej = 2*trace2(D,self.J) self.Exc,self.XC = getXC(self.gr,self.nel,self.bfgrid, functional=self.functional) self.Eone = 2*trace2(D,self.h) self.F = self.h+2*self.J+self.XC self.energy = self.Eone + self.Ej + self.Exc + self.Enuke + self.entropy return