Skip to content

Commit

Permalink
change codes according to review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
puzhichen committed Jan 20, 2025
1 parent fcdf0de commit 9dadcd9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gpu4pyscf/tdscf/rhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ class TDBase(lib.StreamObject):
get_ab = NotImplemented

def get_precond(self, hdiag):
t=1.0e-4
threshold_t=1.0e-4
def precond(x, e, *args):
n_states = x.shape[0]
diagd = cp.repeat(hdiag.reshape(1,-1), n_states, axis=0)
e = e.reshape(-1,1)
diagd = hdiag - (e-self.level_shift)
diagd = cp.where(abs(diagd) < t, cp.sign(diagd)*t, diagd)
diagd = cp.where(abs(diagd) < threshold_t, cp.sign(diagd)*threshold_t, diagd)
a_size = x.shape[1]//2
diagd[:,a_size:] = diagd[:,a_size:]*(-1)
return x/diagd
Expand Down Expand Up @@ -173,13 +173,13 @@ class TDA(TDBase):
__doc__ = tdhf_cpu.TDA.__doc__

def get_precond(self, hdiag):
t=1.0e-4
threshold_t=1.0e-4
def precond(x, e, *args):
n_states = x.shape[0]
diagd = cp.repeat(hdiag.reshape(1,-1), n_states, axis=0)
e = e.reshape(-1,1)
diagd = hdiag - (e-self.level_shift)
diagd = cp.where(abs(diagd) < t, cp.sign(diagd)*t, diagd)
diagd = cp.where(abs(diagd) < threshold_t, cp.sign(diagd)*threshold_t, diagd)
return x/diagd
return precond

Expand Down

0 comments on commit 9dadcd9

Please sign in to comment.