Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIIS to local CC methods #59

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pycc/ccwfn.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import time
import numpy as np
import torch
from .utils import helper_diis, cc_contract
from .utils_Bij import helper_diis, cc_contract #in progress
from .hamiltonian import Hamiltonian
from .local import Local
from .cctriples import t_tjl, t3c_ijk
Expand Down
11 changes: 6 additions & 5 deletions pycc/lccwfn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#from timer import Timer
import numpy as np
from opt_einsum import contract

from utils_Bij import helper_ldiis

class lccwfn(object):
"""
Expand Down Expand Up @@ -109,7 +109,8 @@ def solve_lcc(self, e_conv=1e-7, r_conv=1e-7, maxiter=100, max_diis=8,start_diis
#self.r2_t = Timer("r2")
#self.energy_t = Timer("energy")

#ldiis = helper_ldiis(self.t1, self.t2, max_diis)
ldiis = helper_ldiis(self.no, self.t1, self.t2, max_diis, self.Local)


elcc = self.lcc_energy(self.Local.Fov,self.Local.Loovv,self.t1, self.t2)
print("CC Iter %3d: lCC Ecorr = %.15f dE = % .5E MP2" % (0,elcc,-elcc))
Expand Down Expand Up @@ -156,9 +157,9 @@ def solve_lcc(self, e_conv=1e-7, r_conv=1e-7, maxiter=100, max_diis=8,start_diis
#print(Timer.timers)
return elcc

#ldiis.add_error_vector(self.t1,self.t2)
#if niter >= start_diis:
#self.t1, self.t2 = ldiis.extrapolate(self.t1, self.t2)
ldiis.add_error_vector(self.t1,self.t2)
if niter >= start_diis:
self.t1, self.t2 = ldiis.extrapolate(self.t1, self.t2)

def local_residuals(self, t1, t2):
"""
Expand Down
39 changes: 39 additions & 0 deletions pycc/test_032_pnoccd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
Test basic PNO-CCD energy
"""
# Import package, test suite, and other packages as needed
import psi4
from ccwfn import ccwfn
from lccwfn import lccwfn
from data.molecules import *

psi4.set_memory('2 GB')
psi4.core.set_output_file('output.dat', False)
psi4.set_options({'basis': 'aug-cc-pvdz',
'scf_type': 'pk',
'mp2_type': 'conv',
'freeze_core': 'false',
'e_convergence': 1e-13,
'd_convergence': 1e-13,
'r_convergence': 1e-13,
'diis': 1})
mol = psi4.geometry(moldict["H2O"])
rhf_e, rhf_wfn = psi4.energy('SCF', return_wfn=True)

maxiter = 100
e_conv = 1e-12
r_conv = 1e-12

#simulation code of pno-ccd
ccd_sim = ccwfn(rhf_wfn, model='CCSD',local='PNO', local_cutoff=1e-7,it2_opt=False,filter=True)
eccd_sim = ccd_sim.solve_cc(e_conv, r_conv, maxiter)

#pno-ccd
lccd = ccwfn(rhf_wfn,model='CCSD', local='PNO', local_cutoff=1e-7,it2_opt=False)
elccd = lccd.lccwfn.solve_lcc(e_conv, r_conv, maxiter)

print("eccd_sim",eccd_sim)
print("elccd", elccd)
assert(abs(eccd_sim - elccd) < 1e-5)


Loading