Skip to content

Commit

Permalink
Fix tdrhf
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Aug 10, 2024
1 parent beda77d commit 1e8aef3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pyscf/pbc/tdscf/test/test_rhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def setUpClass(cls):

cls.nstates = 5 # make sure first `nstates_test` states are converged
cls.nstates_test = 2

@classmethod
def tearDownClass(cls):
cls.cell.stdout.close()
Expand Down Expand Up @@ -98,6 +99,7 @@ def setUpClass(cls):

cls.nstates = 5 # make sure first `nstates_test` states are converged
cls.nstates_test = 2

@classmethod
def tearDownClass(cls):
cls.cell.stdout.close()
Expand Down
4 changes: 2 additions & 2 deletions pyscf/tdscf/rhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def add_hf_(a, b, hyb=1):
eri_mo = eri_mo.reshape(nocc,nmo,nmo,nmo)
k_fac = alpha - hyb
a -= numpy.einsum('ijba->iajb', eri_mo[:nocc,:nocc,nocc:,nocc:]) * k_fac
b -= numpy.einsum('ibja->iajb', eri_mo[:nocc,nocc:,:nocc,nocc:]) * k_fac
b -= numpy.einsum('jaib->iajb', eri_mo[:nocc,nocc:,:nocc,nocc:]) * k_fac

xctype = ni._xc_type(mf.xc)
dm0 = mf.make_rdm1(mo_coeff, mo_occ)
Expand Down Expand Up @@ -940,7 +940,7 @@ def vind(xys):
# (B*)X + (A*)Y
# = <ab||ij> Xjb + <aj||ib> Yjb
# = (<mb||nj> Xjb + <mj||nb> Yjb) Cma* Cni
v1vo = lib.einsum('xpq,qo,pv->xov', v1ao.conj(), orbo, orbv.conj())
v1vo = lib.einsum('xpq,qo,pv->xov', v1ao, orbo, orbv.conj())
v1ov += numpy.einsum('xia,ia->xia', xs, e_ia) # AX
v1vo += numpy.einsum('xia,ia->xia', ys, e_ia.conj()) # (A*)Y

Expand Down
4 changes: 2 additions & 2 deletions pyscf/tdscf/uhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def add_hf_(a, b, hyb=1):
b_aa, b_ab, b_bb = b
k_fac = alpha - hyb
a_aa -= numpy.einsum('ijba->iajb', eri_aa[:nocc_a,:nocc_a,nocc_a:,nocc_a:]) * k_fac
b_aa -= numpy.einsum('ibja->iajb', eri_aa[:nocc_a,nocc_a:,:nocc_a,nocc_a:]) * k_fac
b_aa -= numpy.einsum('jaib->iajb', eri_aa[:nocc_a,nocc_a:,:nocc_a,nocc_a:]) * k_fac
a_bb -= numpy.einsum('ijba->iajb', eri_bb[:nocc_b,:nocc_b,nocc_b:,nocc_b:]) * k_fac
b_bb -= numpy.einsum('ibja->iajb', eri_bb[:nocc_b,nocc_b:,:nocc_b,nocc_b:]) * k_fac
b_bb -= numpy.einsum('jaib->iajb', eri_bb[:nocc_b,nocc_b:,:nocc_b,nocc_b:]) * k_fac

xctype = ni._xc_type(mf.xc)
dm0 = mf.make_rdm1(mo_coeff, mo_occ)
Expand Down

0 comments on commit 1e8aef3

Please sign in to comment.