Skip to content

Commit

Permalink
Dimension check
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Dec 17, 2024
1 parent 159430d commit 009f127
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions pyscf/tdscf/_lr_eig.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,25 +445,25 @@ def eig(aop, x0, precond, tol_residual=1e-5, nroots=1, x0sym=None, pick=None,
xt_norm = np.linalg.norm(xt, axis=1)
xt_to_keep = (dx_norm > tol_residual) & (xt_norm > max(lindep**.5, tol_residual))
xt = xt[xt_to_keep]
xt /= xt_norm[xt_to_keep, None]

if x0sym is None:
xt = _symmetric_orth(xt)
else:
xt_ir = xt_ir[xt_to_keep]
xt_orth = []
xt_orth_ir = []
for ir in set(xt_ir):
idx = np.where(xt_ir == ir)[0]
xt_sub = _symmetric_orth(xt[idx])
xt_orth.append(xt_sub)
xt_orth_ir.append([ir] * len(xt_sub))
if xt_orth:
xt = np.vstack(xt_orth)
xs_ir = np.hstack([xs_ir, *xt_orth_ir])
if len(xt) > 0:
xt /= xt_norm[xt_to_keep, None]
if x0sym is None:
xt = _symmetric_orth(xt)
else:
xt = []
xt_orth = xt_orth_ir = xt_sub = None
xt_ir = xt_ir[xt_to_keep]
xt_orth = []
xt_orth_ir = []
for ir in set(xt_ir):
idx = np.where(xt_ir == ir)[0]
xt_sub = _symmetric_orth(xt[idx])
xt_orth.append(xt_sub)
xt_orth_ir.append([ir] * len(xt_sub))
if xt_orth:
xt = np.vstack(xt_orth)
xs_ir = np.hstack([xs_ir, *xt_orth_ir])
else:
xt = []
xt_orth = xt_orth_ir = xt_sub = None

if len(xt) == 0:
log.debug(f'Linear dependency in trial subspace. |r| for each state {dx_norm}')
Expand Down

0 comments on commit 009f127

Please sign in to comment.