def get_init_guess(self, ci_strs, norb, nelec, nroots, hdiag): '''Initial guess is the single Slater determinant ''' wfnsym = direct_spin1_symm._id_wfnsym(self, norb, nelec, self.wfnsym) airreps = direct_spin1_symm._gen_strs_irrep(ci_strs[0], self.orbsym) birreps = direct_spin1_symm._gen_strs_irrep(ci_strs[1], self.orbsym) ci0 = direct_spin1_symm._get_init_guess(airreps, birreps, nroots, hdiag, self.orbsym, wfnsym) return [selected_ci._as_SCIvector(x, ci_strs) for x in ci0]
def get_init_guess(self, ci_strs, norb, nelec, nroots, hdiag): '''Initial guess is the single Slater determinant ''' wfnsym = direct_spin1_symm._id_wfnsym(self, norb, nelec, self.orbsym, self.wfnsym) airreps = direct_spin1_symm._gen_strs_irrep(ci_strs[0], self.orbsym) birreps = direct_spin1_symm._gen_strs_irrep(ci_strs[1], self.orbsym) ci0 = direct_spin1_symm._get_init_guess(airreps, birreps, nroots, hdiag, self.orbsym, wfnsym) return [selected_ci._as_SCIvector(x, ci_strs) for x in ci0]
def make_confsym (norb, neleca, nelecb, econf_det_mask, orbsym): strsa = cistring.gen_strings4orblist(range(norb), neleca) airreps = birreps = _gen_strs_irrep(strsa, orbsym) if neleca != nelecb: strsb = cistring.gen_strings4orblist(range(norb), nelecb) birreps = _gen_strs_irrep(strsb, orbsym) nconf, addr = np.unique (econf_det_mask, return_index=True) nconf = nconf.size # Note: econf_det_mask[addr] = np.arange (nconf) # All determinants of the same configuration have the same point group conf_addra = addr // len (birreps) conf_addrb = addr % len (birreps) confsym = airreps[conf_addra] ^ birreps[conf_addrb] return confsym
def get_init_guess(norb, nelec, nroots, hdiag, orbsym, wfnsym=0): neleca, nelecb = direct_spin1._unpack_nelec(nelec) assert (neleca == nelecb) strsa = cistring.gen_strings4orblist(range(norb), neleca) airreps = direct_spin1_symm._gen_strs_irrep(strsa, orbsym) na = nb = len(airreps) init_strs = [] iroot = 0 for addr in numpy.argsort(hdiag): addra = addr // nb addrb = addr % nb if airreps[addra] ^ airreps[addrb] == wfnsym: if (addrb, addra) not in init_strs: init_strs.append((addra, addrb)) iroot += 1 if iroot >= nroots: break ci0 = [] for addra, addrb in init_strs: x = numpy.zeros((na, nb)) if addra == addrb == 0: x[addra, addrb] = 1 else: x[addra, addrb] = x[addrb, addra] = numpy.sqrt(.5) ci0.append(x.ravel()) # Add noise #ci0[0][0 ] += 1e-5 #ci0[0][-1] -= 1e-5 if len(ci0) == 0: raise RuntimeError('No determinant matches the target symmetry %s' % wfnsym) return ci0