Skip to content

Commit

Permalink
core: FCI convention option for DETs
Browse files Browse the repository at this point in the history
  • Loading branch information
hczhai committed May 4, 2024
1 parent 29f2cb0 commit cda3cec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pyblock2/driver/core.py
Expand Up @@ -5291,7 +5291,7 @@ def get_trans_4pdm(self, bra, ket, *args, **kwargs):
return self.get_npdm(ket, pdm_type=4, bra=bra, *args, **kwargs)

def get_csf_coefficients(
self, ket, cutoff=0.1, given_dets=None, max_print=200, iprint=1
self, ket, cutoff=0.1, given_dets=None, max_print=200, fci_conv=False, iprint=1
):
"""
Find the dominant Configuration State Functions (CSFs, in SU2 mode)
Expand Down Expand Up @@ -5321,6 +5321,10 @@ def get_csf_coefficients(
When the number of computed CSF/DET is larger than this number, only the
dominant ones will be printed. When ``iprint == 0``, this argument has no
effect and nothing will be printed.
fci_conv : bool
If True, will set the DET coefficients to match the FCI convention,
by multiplying ``dvals`` by +1/-1. Only have effects in SZ/SGF modes.
Default is False.
iprint : int
Verbosity. Default is 1.
Expand Down Expand Up @@ -5361,8 +5365,10 @@ def get_csf_coefficients(
uniq.add(tuple(ddet))
dtrie.append(bw.b.VectorUInt8(ddet))
dtrie.evaluate(bw.bs.UnfusedMPS(ket), cutoff)
if fci_conv:
dtrie.convert_phase(bw.b.VectorInt(list(range(ket.n_sites))))
if iprint:
print("dtrie finished", time.perf_counter() - tx)
print("DTRIE T = %10.3f" % (time.perf_counter() - tx))
dname = "CSF" if SymmetryTypes.SU2 in bw.symm_type else "DET"
if iprint:
print("Number of %s = %10d (cutoff = %9.5g)" % (dname, len(dtrie), cutoff))
Expand Down
3 changes: 2 additions & 1 deletion src/dmrg/determinant.hpp
Expand Up @@ -1174,7 +1174,8 @@ struct DeterminantTRIE<S, FL, typename S::is_sg_t>
#pragma omp parallel for schedule(static) num_threads(ntg)
for (int i = 0; i < vals.size(); i++) {
vector<uint8_t> det = (*this)[i];
vals[i] *= phase_change_orb_order(det, reorder);
if (reorder.size() != 0)
vals[i] *= phase_change_orb_order(det, reorder);
}
threading->activate_normal();
}
Expand Down

0 comments on commit cda3cec

Please sign in to comment.