Skip to content

Commit

Permalink
Just starting local-CC design.
Browse files Browse the repository at this point in the history
  • Loading branch information
lothian committed Jul 16, 2021
1 parent 3ec3a05 commit b0ed450
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pycc/ccenergy.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ccenergy(object):
Computes the T1 and T2 residuals for a given set of amplitudes and Fock operator
"""

def __init__(self, scf_wfn):
def __init__(self, scf_wfn, local):
"""
Parameters
----------
Expand All @@ -84,6 +84,8 @@ def __init__(self, scf_wfn):
self.nmo = self.ref.nmo() # all MOs/AOs
self.nv = self.nmo - self.no - self.nfzc # active virt

H = Hamiltonian(scf_wfn, local=local)

# Get MOs
C = self.ref.Ca_subset("AO", "ACTIVE")
npC = np.asarray(C) # as numpy array
Expand Down
30 changes: 30 additions & 0 deletions pycc/hamiltonian.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
if __name__ == "__main__":
raise Exception("This file cannot be invoked on its own.")


import psi4
import numpy as np

class Hamiltonian(object):


def __init__(self, ref, local=None):
self.ref = ref

if (local != None):
C_occ = self.ref.Ca_subset("AO", "ACTIVE_OCC")
Local = psi4.core.Localizer.build("PIPEK_MEZEY", ref.bassiset(), C_occ)

# Get MOs
C = self.ref.Ca_subset("AO", "ACTIVE")
npC = np.asarray(C) # as numpy array

# Get MO Fock matrix
self.F = np.asarray(self.ref.Fa())
self.F = np.einsum('uj,vi,uv', npC, npC, self.F)

# Get MO two-electron integrals in Dirac notation
mints = psi4.core.MintsHelper(self.ref.basisset())
self.ERI = np.asarray(mints.mo_eri(C, C, C, C)) # (pr|qs)
self.ERI = self.ERI.swapaxes(1,2) # <pq|rs>
self.L = 2.0 * self.ERI - self.ERI.swapaxes(2,3) # 2 <pq|rs> - <pq|sr>
4 changes: 4 additions & 0 deletions pycc/local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class local(object):

def __init__(self, wfn):

0 comments on commit b0ed450

Please sign in to comment.