From a8d1b31c6d463b5cd5cf886fa758c204affebbf1 Mon Sep 17 00:00:00 2001 From: Matthew R Hermes Date: Thu, 14 Nov 2024 12:37:58 -0600 Subject: [PATCH] Smult-projected trial vectors --- my_pyscf/lassi/excitations.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/my_pyscf/lassi/excitations.py b/my_pyscf/lassi/excitations.py index e5b11e1c..40d5099a 100644 --- a/my_pyscf/lassi/excitations.py +++ b/my_pyscf/lassi/excitations.py @@ -394,7 +394,7 @@ def fixedpoint (self, h1, h2, norb_f, nelec_f, ecore=0, ci0=None, orbsym=None, e = 0 ci1 = ci0 log.info ('Entering product-state fixed-point CI iteration') - ci0 = self.get_init_guess (ci1, norb_f, nelec_f, h1, h2, nroots=nroots) + ci1 = ci0 = self.get_init_guess (ci1, norb_f, nelec_f, h1, h2, nroots=nroots) for it in range (max_cycle_macro): e_last = e e, si_p, si_q, ci0 = self._eig (h0, h1, h2, ci1, nroots=nroots)[:4] @@ -500,16 +500,23 @@ def _1shot (self, h0, h1, h2, ci0, hpq_xq, hpp_xp, nroots=1, ovlp_thresh=1e-3): ci1 = [] for s, c0, c1, c2 in zip (self.fcisolvers, ci0, hpq_xq, hpp_xp): x = np.concatenate ([c0,c1,c2],axis=0) - nx, ndeta, ndetb = x.shape - x = x.reshape (nx,ndeta*ndetb) + if isinstance (s, CSFFCISolver): + ndeta, ndetb = s.transformer.ndeta, s.transformer.ndetb + x = s.transformer.vec_det2csf (x) + else: + nx, ndeta, ndetb = x.shape + x = x.reshape (nx, ndeta*ndetb) x_norm = linalg.norm (x, axis=1) x = x[x_norm>0,:] x_norm = x_norm[x_norm>0] x /= x_norm[:,None] ovlp = x.conj () @ x.T x = canonical_orth_(ovlp).T @ x - nx = x.shape[0] - ci1.append (x.reshape (nx,ndeta,ndetb)) + nx = len (x) + if isinstance (s, CSFFCISolver): + x = s.transformer.vec_csf2det (x) + ci1.append (x.reshape (nx, ndeta, ndetb)) + assert (x.shape[0]>=nroots), '{} {} {} {} {}'.format (x.shape, nroots, c0.shape, c1.shape, c2.shape) e, si_p, si_q, ci1, disc_svals = self._eig (h0, h1, h2, ci1, ovlp_thresh=ovlp_thresh, nroots=nroots) self.log.info ('Sum of discarded singular values = %e', disc_svals)