Skip to content

Commit

Permalink
Add scalar energy in npz
Browse files Browse the repository at this point in the history
  • Loading branch information
brianz98 committed Nov 1, 2024
1 parent d4db0ac commit 41c8034
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions forte/api/forte_python_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ PYBIND11_MODULE(_forte, m) {
.def("compute_Heff_actv", &SADSRG::compute_Heff_actv,
"Return the DSRG dressed ActiveSpaceIntegrals")
.def("compute_Heff_full", [](SADSRG& self) {
const auto [Hbar1, Hbar2] = self.compute_Heff_full();
return py::make_tuple(blockedtensor_to_np(Hbar1), blockedtensor_to_np(Hbar2));
const auto [Edsrg, Hbar1, Hbar2] = self.compute_Heff_full();
return py::make_tuple(Edsrg, blockedtensor_to_np(Hbar1), blockedtensor_to_np(Hbar2));
})
.def("compute_Heff_full", &SADSRG::compute_Heff_full,
"Return the full DSRG dressed ActiveSpaceIntegrals")
Expand Down
4 changes: 2 additions & 2 deletions forte/mrdsrg-spin-adapted/sadsrg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,15 @@ std::shared_ptr<ActiveSpaceIntegrals> SADSRG::compute_Heff_actv() {
return fci_ints;
}

std::tuple<BlockedTensor,BlockedTensor> SADSRG::compute_Heff_full() {
std::tuple<double, BlockedTensor,BlockedTensor> SADSRG::compute_Heff_full() {
// de-normal-order DSRG transformed Hamiltonian
double Edsrg = Eref_ + Hbar0_;
if (foptions_->get_bool("FORM_HBAR3")) {
throw psi::PSIEXCEPTION("FORM_HBAR3 is not implemented for full Hamiltonian.");
} else {
deGNO_ints_full("Hamiltonian", Edsrg, Hbar1_, Hbar2_);
}
return std::make_tuple(Hbar1_, Hbar2_);
return std::make_tuple(Edsrg, Hbar1_, Hbar2_);

/*
auto Hbar1g = BTF_->build(tensor_type_, "Hbar1g", spin_cases({"gg"}));
Expand Down
2 changes: 1 addition & 1 deletion forte/mrdsrg-spin-adapted/sadsrg.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SADSRG : public DynamicCorrelationSolver {
std::shared_ptr<ActiveSpaceIntegrals> compute_Heff_actv() override;

/// Compute the full DSRG transformed Hamiltonian
std::tuple<BlockedTensor,BlockedTensor> compute_Heff_full();
std::tuple<double,BlockedTensor,BlockedTensor> compute_Heff_full();

/// Compute DSRG transformed multipole integrals
std::shared_ptr<ActiveMultipoleIntegrals> compute_mp_eff_actv() override;
Expand Down
6 changes: 3 additions & 3 deletions forte/proc/dsrg.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ def compute_energy(self):

if self.options.get_bool("FORM_DEGNO_FULL_HBAR") and self.solver_type in ["SA-MRDSRG", "SA_MRDSRG"]:
psi4.core.print_out(f"\n\n Computing full dressed integrals for SA-MR-LDSRG(2)")
Hbar1_full, Hbar2_full = self.dsrg_solver.compute_Heff_full()
np.savez("Hbar1_full.npz", **Hbar1_full)
np.savez("Hbar2_full.npz", **Hbar2_full)
E_dsrg, Hbar1_full, Hbar2_full = self.dsrg_solver.compute_Heff_full()
np.savez("Hbar_full.npz", scalar=E_dsrg, **Hbar1_full, **Hbar2_full)


# Reference relaxation procedure
for n in range(self.relax_maxiter):
Expand Down

0 comments on commit 41c8034

Please sign in to comment.