Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integral / cumulant export APIs #429

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4bb7465
First commit.
shuhangli98 Mar 5, 2024
4f3f31f
Waiting for spin-adaptation.
shuhangli98 Mar 5, 2024
5967d57
Waiting for Spin-adaptation.
shuhangli98 Mar 5, 2024
f915f40
First ionization. Spin orbital
shuhangli98 Mar 15, 2024
3ad7579
Spin-integration. No Cu3.
shuhangli98 Mar 18, 2024
41f5ec9
Something wrong.
shuhangli98 Mar 20, 2024
0436c52
Wicked contraction. Spin-orbital.
shuhangli98 Apr 1, 2024
fee7bbd
A fast spin-orbital Hbar construction algorithm based on Wick&d.
shuhangli98 Apr 2, 2024
afda9ec
Save.
shuhangli98 Apr 24, 2024
b445a9a
Full effective Hamiltonian.
shuhangli98 May 14, 2024
973af44
Save.
shuhangli98 May 14, 2024
a38b37d
Full hbar for spin orbital DSRG.
shuhangli98 May 24, 2024
50386f1
spin orbital rdms
shuhangli98 May 24, 2024
6b32d28
a small bug
shuhangli98 May 24, 2024
eb09c97
Spin-integrated RDMs.
shuhangli98 Jun 7, 2024
384ba3f
Merge branch 'main' of https://github.com/evangelistalab/forte into e…
shuhangli98 Jun 21, 2024
8a50b27
Clean-up.
shuhangli98 Jun 21, 2024
29b8b00
add options
shuhangli98 Jun 21, 2024
ec3a22b
save
shuhangli98 Jun 25, 2024
b3b2c0f
merge
shuhangli98 Jun 29, 2024
58c8a6f
update from the local
shuhangli98 Aug 29, 2024
bda82dc
dp1
shuhangli98 Sep 9, 2024
2b9049c
WIP 4rdm
brianz98 Sep 11, 2024
377bb35
able to compile
shuhangli98 Sep 12, 2024
646e1eb
Looks good, I think.
shuhangli98 Sep 13, 2024
d7c51d9
Tests pass
brianz98 Sep 13, 2024
226f826
test rdms
brianz98 Sep 15, 2024
7af699c
save from local
shuhangli98 Sep 15, 2024
e77cb25
Fix compile issues
brianz98 Sep 17, 2024
094e4d0
Merge branch 'main' into rdm4
brianz98 Sep 17, 2024
7780d65
Add to_double's
brianz98 Sep 17, 2024
4336ec6
Working 4rdm test
brianz98 Sep 17, 2024
f5ea32d
Review response 1
brianz98 Sep 20, 2024
6b6a24d
oops
brianz98 Sep 20, 2024
d3a95c4
4-cumulant
shuhangli98 Sep 21, 2024
483039b
Merge branch 'main' into rdm4
shuhangli98 Sep 21, 2024
7e08440
4-cumulant
shuhangli98 Sep 21, 2024
40a5fdc
Various additions to rdm base class
brianz98 Sep 21, 2024
cef3c21
save
shuhangli98 Oct 3, 2024
24da599
merge rdm4 to eom-dsrg
shuhangli98 Oct 3, 2024
7dddb8c
print
shuhangli98 Oct 8, 2024
6fe621f
an inefficient way
shuhangli98 Oct 10, 2024
718780b
save
shuhangli98 Nov 1, 2024
65e2b98
with ref_relax
shuhangli98 Nov 6, 2024
11eb4dd
ref_relax
shuhangli98 Nov 12, 2024
ee285f8
Merge main into eom-dsrg
brianz98 Nov 15, 2024
426cc7b
Export SA-MRDSRG ints
brianz98 Nov 15, 2024
bb89c72
Degno full for SI
brianz98 Nov 15, 2024
d878f0d
Roll back changes made to semicanonicalize
brianz98 Nov 15, 2024
39d5c52
Re enable spinorbital
brianz98 Dec 3, 2024
bfc5ff5
Re-enable SO cumulants
brianz98 Dec 3, 2024
eb2c3f8
Export scalar energy for de gno
brianz98 Dec 3, 2024
50ba434
Mbar option
brianz98 Dec 5, 2024
8d6de79
override compute_Heff_full
shuhangli98 Dec 9, 2024
e35bf56
update_Hbar WIP
shuhangli98 Dec 10, 2024
6647a5a
Correct relaxed GNO Hbar
shuhangli98 Dec 11, 2024
01c9a53
skip unrelaxed dipole calculation
shuhangli98 Dec 11, 2024
788d594
fix spin-orbital rdms and prepare_forte_object
shuhangli98 Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 90 additions & 3 deletions forte/api/forte_python_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ PYBIND11_MODULE(_forte, m) {
},
"Return the cumulants of the RDMs in a spinorbital basis. Spinorbitals follow the ordering "
"abab...");

m.def("get_gas_occupation", &get_gas_occupation);
m.def("get_ci_occupation_patterns", &get_ci_occupation_patterns);

Expand Down Expand Up @@ -250,6 +249,65 @@ PYBIND11_MODULE(_forte, m) {
.def("compute_gradient", &MASTER_DSRG::compute_gradient, "Compute the DSRG gradient")
.def("compute_Heff_actv", &MASTER_DSRG::compute_Heff_actv,
"Return the DSRG dressed ActiveSpaceIntegrals")
.def("save_Heff_full_ambit", [](MASTER_DSRG& self) {
const auto Heff = self.save_Heff_full();
return py::make_tuple(Heff.first, Heff.second.at(0), Heff.second.at(1));
})
.def("save_Heff_full", [](MASTER_DSRG& self) {
const auto Heff = self.save_Heff_full();
return py::make_tuple(Heff.first, blockedtensor_to_np(Heff.second.at(0)), blockedtensor_to_np(Heff.second.at(1)));
})
.def("update_Heff_full", [](MASTER_DSRG& self, double H0, BlockedTensor H1, BlockedTensor H2, std::shared_ptr<RDMs> rdms) {
const auto Heff = self.update_Heff_full(H0, H1, H2, rdms);
return py::make_tuple(Heff.first, blockedtensor_to_np(Heff.second.at(0)), blockedtensor_to_np(Heff.second.at(1)));
})
.def("compute_Heff_full_degno", [](MASTER_DSRG& self) {
const auto Heff = self.compute_Heff_full_degno();
return py::make_tuple(Heff.first, blockedtensor_to_np(Heff.second.at(0)), blockedtensor_to_np(Heff.second.at(1)));
})
.def("compute_mbar", &MASTER_DSRG::compute_mbar, "compute full transformed dipole integrals")
.def("compute_Mbar0_full", &MASTER_DSRG::compute_Mbar0_full, "Return full transformed zero-body dipole integrals")
.def("compute_Mbar1_full", [](MASTER_DSRG& self) {
const auto Mbar1 = self.compute_Mbar1_full();
return py::make_tuple(blockedtensor_to_np(Mbar1.at(0)), blockedtensor_to_np(Mbar1.at(1)),
blockedtensor_to_np(Mbar1.at(2)));
})
.def("compute_Mbar2_full", [](MASTER_DSRG& self) {
const auto Mbar2 = self.compute_Mbar2_full();
return py::make_tuple(blockedtensor_to_np(Mbar2.at(0)), blockedtensor_to_np(Mbar2.at(1)),
blockedtensor_to_np(Mbar2.at(2)));
})
.def("get_gamma1", [](MASTER_DSRG& self) {
const auto gamma1 = self.get_gamma1();
return blockedtensor_to_np(gamma1);
})
.def("get_eta1", [](MASTER_DSRG& self) {
const auto eta1 = self.get_eta1();
return blockedtensor_to_np(eta1);
})
.def("get_lambda2", [](MASTER_DSRG& self) {
const auto lambda2 = self.get_lambda2();
return blockedtensor_to_np(lambda2);
})
.def("get_lambda3", [](MASTER_DSRG& self) {
const auto lambda3 = self.get_lambda3();
py::dict pyrdm;
pyrdm[py::str("aaaaaa")] = ambit_to_np(lambda3.at(0));
pyrdm[py::str("aaAaaA")] = ambit_to_np(lambda3.at(1));
pyrdm[py::str("aAAaAA")] = ambit_to_np(lambda3.at(2));
pyrdm[py::str("AAAAAA")] = ambit_to_np(lambda3.at(3));
return pyrdm;
})
.def("get_lambda4", [](MASTER_DSRG& self) {
const auto lambda4 = self.get_lambda4();
py::dict pyrdm;
pyrdm[py::str("aaaaaaaa")] = ambit_to_np(lambda4.at(0));
pyrdm[py::str("aaaAaaaA")] = ambit_to_np(lambda4.at(1));
pyrdm[py::str("aaAAaaAA")] = ambit_to_np(lambda4.at(2));
pyrdm[py::str("aAAAaAAA")] = ambit_to_np(lambda4.at(3));
pyrdm[py::str("AAAAAAAA")] = ambit_to_np(lambda4.at(4));
return pyrdm;
})
.def("deGNO_DMbar_actv", &MASTER_DSRG::deGNO_DMbar_actv,
"Return the DSRG dressed dipole integrals")
.def("nuclear_dipole", &MASTER_DSRG::nuclear_dipole,
Expand All @@ -268,13 +326,22 @@ PYBIND11_MODULE(_forte, m) {
.def("set_ci_vectors", &MASTER_DSRG::set_ci_vectors,
"Set the CI eigenvector for DSRG-MRPT2 analytic gradients")
.def("set_active_space_solver", &MASTER_DSRG::set_active_space_solver,
"Set the shared pointer for ActiveSpaceSolver");
"Set the shared pointer for ActiveSpaceSolver")
.def("set_rdms", &MASTER_DSRG::set_rdms, "Set external RDMs (dangerous, use with caution)");

// export SADSRG
py::class_<SADSRG>(m, "SADSRG")
.def("compute_energy", &SADSRG::compute_energy, "Compute the DSRG energy")
.def("compute_Heff_actv", &SADSRG::compute_Heff_actv,
"Return the DSRG dressed ActiveSpaceIntegrals")
.def("compute_Heff_full", [](SADSRG& self) {
const auto Heff = self.compute_Heff_full();
return py::make_tuple(blockedtensor_to_np(Heff.at(0)), blockedtensor_to_np(Heff.at(1)));
})
.def("compute_Heff_full_degno", [](SADSRG& self) {
const auto Heff = self.compute_Heff_full_degno();
return py::make_tuple(Heff.first, blockedtensor_to_np(Heff.second.at(0)), blockedtensor_to_np(Heff.second.at(1)));
})
.def("compute_mp_eff_actv", &SADSRG::compute_mp_eff_actv,
"Return the DSRG dressed ActiveMultipoleIntegrals")
.def("set_Uactv", &SADSRG::set_Uactv, "Ua"_a,
Expand All @@ -299,7 +366,27 @@ PYBIND11_MODULE(_forte, m) {
py::class_<MRDSRG_SO>(m, "MRDSRG_SO")
.def("compute_energy", &MRDSRG_SO::compute_energy, "Compute DSRG energy")
.def("compute_Heff_actv", &MRDSRG_SO::compute_Heff_actv,
"Return the DSRG dressed ActiveSpaceIntegrals");
"Return the DSRG dressed ActiveSpaceIntegrals")
.def("save_Heff_full", [](MRDSRG_SO& self) {
const auto Heff = self.save_Heff_full();
return py::make_tuple(Heff.first, blockedtensor_to_np(Heff.second.at(0)), blockedtensor_to_np(Heff.second.at(1)));
})
.def("get_gamma1", [](MRDSRG_SO& self) {
const auto gamma1 = self.get_gamma1();
return blockedtensor_to_np(gamma1);
})
.def("get_eta1", [](MRDSRG_SO& self) {
const auto eta1 = self.get_eta1();
return blockedtensor_to_np(eta1);
})
.def("get_lambda2", [](MRDSRG_SO& self) {
const auto lambda2 = self.get_lambda2();
return blockedtensor_to_np(lambda2);
})
.def("get_lambda3", [](MRDSRG_SO& self) {
const auto lambda3 = self.get_lambda3();
return blockedtensor_to_np(lambda3);
});

// export DSRG_MRPT spin-adapted code
py::class_<DSRG_MRPT>(m, "DSRG_MRPT")
Expand Down
3 changes: 2 additions & 1 deletion forte/api/integrals_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ void export_ForteIntegrals(py::module& m) {
.def(
"print_ints",
[](const ForteIntegrals& ints) { psi::outfile->Printf("\n%s", ints.repr().c_str()); },
"Print the integrals");
"Print the integrals")
.def("mo_dipole_ints", &ForteIntegrals::mo_dipole_ints, "mo_dipole_ints");
}
} // namespace forte
Loading
Loading