def get_init_guess(norb, nelec, nroots, hdiag_csf, smult, csd_mask, wfnsym_str=None, idx_sym=None): ''' The existing _get_init_guess function will work in the csf basis if I pass it with na, nb = ncsf, 1. This might change in future PySCF versions though. ...For point-group symmetry, I pass the direct_spin1.py version of _get_init_guess with na, nb = ncsf_sym, 1 and hdiag_csf including only csfs of the right point-group symmetry. This should clean up the symmetry-breaking "noise" in direct_spin1_symm.py! ''' neleca, nelecb = _unpack_nelec(nelec) ncsf_tot = count_all_csfs(norb, neleca, nelecb, smult) if idx_sym is None: ncsf_sym = ncsf_tot ci = _get_init_guess(ncsf_sym, 1, nroots, hdiag_csf) else: ncsf_sym = np.count_nonzero(idx_sym) assert ( ncsf_sym >= nroots ), "Can't find {} roots among only {} CSFs of symmetry {}".format( nroots, ncsf_sym, wfnsym_str) ci = _get_init_guess(ncsf_sym, 1, nroots, hdiag_csf[idx_sym]) ci = unpack_sym_ci(ci, idx_sym) ci = transform_civec_csf2det(ci, norb, neleca, nelecb, smult, csd_mask=csd_mask)[0] return ci
def get_init_guess(self, ci_strs, norb, nelec, nroots, hdiag): '''Initial guess is the single Slater determinant ''' na = len(ci_strs[0]) nb = len(ci_strs[1]) ci0 = direct_spin1._get_init_guess(na, nb, nroots, hdiag) return [_as_SCIvector(x, ci_strs) for x in ci0]
def get_init_guess(norb, nelec, nroots, hdiag_csf, transformer): ''' The existing _get_init_guess function will work in the csf basis if I pass it with na, nb = ncsf, 1. This might change in future PySCF versions though. ...For point-group symmetry, I pass the direct_spin1.py version of _get_init_guess with na, nb = ncsf_sym, 1 and hdiag_csf including only csfs of the right point-group symmetry. This should clean up the symmetry-breaking "noise" in direct_spin1_symm.py! ''' neleca, nelecb = _unpack_nelec (nelec) ncsf_sym = transformer.ncsf assert (ncsf_sym >= nroots), "Can't find {} roots among only {} CSFs of symmetry {}".format (nroots, ncsf_sym, transformer.wfnsym) hdiag_csf = transformer.pack_csf (hdiag_csf) ci = _get_init_guess (ncsf_sym, 1, nroots, hdiag_csf) return transformer.vec_csf2det (ci)