Skip to content

Commit

Permalink
merge rdm4 to eom-dsrg
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhangli98 committed Oct 3, 2024
1 parent cef3c21 commit 24da599
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 43 deletions.
32 changes: 7 additions & 25 deletions forte/mrdsrg-so/mrdsrg_so.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,6 @@ void MRDSRG_SO::startup() {

source_ = foptions_->get_str("SOURCE");

dsrg_trans_type_ = foptions_->get_str("DSRG_TRANS_TYPE");
if (dsrg_trans_type_ == "CC" && foptions_->get_str("CORR_LEVEL") == "QDSRG2") {
outfile->Printf(
"\n Warning: DSRG_TRANS_TYPE option CC is not supported with CORR_LEVEL QDSRG2.");
outfile->Printf("\n Changed DSRG_TRANS_TYPE option to UNITARY");
dsrg_trans_type_ = "UNITARY";
}

ntamp_ = foptions_->get_int("NTAMP");
intruder_tamp_ = foptions_->get_double("INTRUDER_TAMP");

Expand Down Expand Up @@ -775,8 +767,6 @@ void MRDSRG_SO::compute_hbar() {
BlockedTensor C1 = ambit::BlockedTensor::build(tensor_type_, "C1", {"gg"});
BlockedTensor C2 = ambit::BlockedTensor::build(tensor_type_, "C2", {"gggg"});

bool do_wicked = foptions_->get_bool("DO_WICKED");

// compute Hbar recursively
for (int n = 1; n <= maxn; ++n) {
// prefactor before n-nested commutator
Expand All @@ -786,6 +776,7 @@ void MRDSRG_SO::compute_hbar() {
double C0 = 0.0;
C1.zero();
C2.zero();

// zero-body
H1_T1_C0(O1, T1, factor, C0);
H1_T2_C0(O1, T2, factor, C0);
Expand All @@ -808,21 +799,12 @@ void MRDSRG_SO::compute_hbar() {
// outfile->Printf("\n |H2| = %20.12f", C2.norm(1));
// outfile->Printf("\n --------------------------------");

if (dsrg_trans_type_ == "UNITARY") {
// [H, A] = [H, T] + [H, T]^dagger
C0 *= 2.0;
O1["pq"] = C1["pq"];
C1["pq"] += O1["qp"];
O2["pqrs"] = C2["pqrs"];
C2["pqrs"] += O2["rspq"];
}

if (do_wicked) {
O2["pqrs"] = C2["pqrs"];
C2["pqrs"] -= O2["qprs"];
C2["pqrs"] -= O2["pqsr"];
C2["pqrs"] += O2["qpsr"];
}
// [H, A] = [H, T] + [H, T]^dagger
C0 *= 2.0;
O1["pq"] = C1["pq"];
C1["pq"] += O1["qp"];
O2["pqrs"] = C2["pqrs"];
C2["pqrs"] += O2["rspq"];

// Hbar += C
Hbar0 += C0;
Expand Down
17 changes: 0 additions & 17 deletions forte/mrdsrg-so/mrdsrg_so.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ class MRDSRG_SO : public DynamicCorrelationSolver {
/// Order of the Taylor expansion of f(z) = (1-exp(-z^2))/z
int taylor_order_;

/// DSRG transformation type
std::string dsrg_trans_type_;

std::shared_ptr<BlockedTensorFactory> BTF_;
TensorType tensor_type_;

Expand Down Expand Up @@ -213,11 +210,6 @@ class MRDSRG_SO : public DynamicCorrelationSolver {
void H1_T2_C0(BlockedTensor& H1, BlockedTensor& T2, const double& alpha, double& C0);
void H2_T2_C0(BlockedTensor& H2, BlockedTensor& T2, const double& alpha, double& C0);

void H1_T1_C0(BlockedTensor& H1, BlockedTensor& T1, const double& alpha, double& C0);
void H2_T1_C0(BlockedTensor& H2, BlockedTensor& T1, const double& alpha, double& C0);
void H1_T2_C0(BlockedTensor& H1, BlockedTensor& T2, const double& alpha, double& C0);
void H2_T2_C0(BlockedTensor& H2, BlockedTensor& T2, const double& alpha, double& C0);

/// Compute one-body term of commutator [H, T]
void H1_T1_C1(BlockedTensor& H1, BlockedTensor& T1, const double& alpha, BlockedTensor& C1);
void H1_T2_C1(BlockedTensor& H1, BlockedTensor& T2, const double& alpha, BlockedTensor& C1);
Expand All @@ -226,22 +218,13 @@ class MRDSRG_SO : public DynamicCorrelationSolver {
void H3_T1_C1(BlockedTensor& H3, BlockedTensor& T1, const double& alpha, BlockedTensor& C1);
void H3_T2_C1(BlockedTensor& H3, BlockedTensor& T2, const double& alpha, BlockedTensor& C1);

void H1_T1_C1(BlockedTensor& H1, BlockedTensor& T1, const double& alpha, BlockedTensor& C1);
void H1_T2_C1(BlockedTensor& H1, BlockedTensor& T2, const double& alpha, BlockedTensor& C1);
void H2_T1_C1(BlockedTensor& H2, BlockedTensor& T1, const double& alpha, BlockedTensor& C1);
void H2_T2_C1(BlockedTensor& H2, BlockedTensor& T2, const double& alpha, BlockedTensor& C1);

/// Compute two-body term of commutator [H, T]
void H2_T1_C2(BlockedTensor& H2, BlockedTensor& T1, const double& alpha, BlockedTensor& C2);
void H1_T2_C2(BlockedTensor& H1, BlockedTensor& T2, const double& alpha, BlockedTensor& C2);
void H2_T2_C2(BlockedTensor& H2, BlockedTensor& T2, const double& alpha, BlockedTensor& C2);
void H3_T1_C2(BlockedTensor& H3, BlockedTensor& T1, const double& alpha, BlockedTensor& C2);
void H3_T2_C2(BlockedTensor& H3, BlockedTensor& T2, const double& alpha, BlockedTensor& C2);

void H2_T1_C2(BlockedTensor& H2, BlockedTensor& T1, const double& alpha, BlockedTensor& C2);
void H1_T2_C2(BlockedTensor& H1, BlockedTensor& T2, const double& alpha, BlockedTensor& C2);
void H2_T2_C2(BlockedTensor& H2, BlockedTensor& T2, const double& alpha, BlockedTensor& C2);

/// Compute three-body term of commutator [H, T]
void H2_T2_C3(BlockedTensor& H2, BlockedTensor& T2, const double& alpha, BlockedTensor& C3);

Expand Down
8 changes: 7 additions & 1 deletion forte/proc/dsrg.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ def __init__(self, active_space_solver, state_weights_map, mo_space_info, ints,
"\n DSRG relaxation only supports UNITARY transformation. Setting RELAX_REF to NONE.")
self.relax_ref = "NONE"

self.max_rdm_level = 3 if options.get_str("THREEPDC") != "ZERO" else 2
if options.get_str("FOURPDC") != "ZERO":
self.max_rdm_level = 4
elif options.get_str("THREEPDC") != "ZERO":
self.max_rdm_level = 3
else:
self.max_rdm_level = 2

if options.get_str("DSRG_3RDM_ALGORITHM") == "DIRECT":
as_type = options.get_str("ACTIVE_SPACE_SOLVER")
if as_type == "BLOCK2" and self.solver_type in ["SA-MRDSRG", "SA_MRDSRG"]:
Expand Down

0 comments on commit 24da599

Please sign in to comment.