Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
83 changes: 0 additions & 83 deletions src/scf/matrix_builder/j_four_center.cpp

This file was deleted.

84 changes: 0 additions & 84 deletions src/scf/matrix_builder/k_four_center.cpp

This file was deleted.

17 changes: 4 additions & 13 deletions src/scf/matrix_builder/matrix_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,25 @@

namespace scf::matrix_builder {

DECLARE_MODULE(AOIntegralsDriver);
DECLARE_MODULE(SCFIntegralsDriver);
DECLARE_MODULE(DensityMatrix);
DECLARE_MODULE(DeterminantDriver);
DECLARE_MODULE(ElectronicEnergy);
DECLARE_MODULE(Fock);
DECLARE_MODULE(JFourCenter);
DECLARE_MODULE(KFourCenter);

inline void load_modules(pluginplay::ModuleManager& mm) {
mm.add_module<AOIntegralsDriver>("AO integral driver");
mm.add_module<SCFIntegralsDriver>("SCF integral driver");
mm.add_module<DensityMatrix>("Density matrix builder");
mm.add_module<DeterminantDriver>("Determinant driver");
mm.add_module<ElectronicEnergy>("Electronic energy");
mm.add_module<Fock>("Fock matrix builder");
mm.add_module<JFourCenter>("Four center J builder");
mm.add_module<KFourCenter>("Four center K builder");
}

inline void set_defaults(pluginplay::ModuleManager& mm) {
const auto ao_driver = "AO integral driver";
mm.change_submod(ao_driver, "Coulomb matrix", "Four center J builder");
mm.change_submod(ao_driver, "Exchange matrix", "Four center K builder");
// TODO: Re-enable when PluginPlay doesn't choke on loops in modules
// mm.change_submod(ao_driver, "Fock matrix", "Fock Matrix Builder");
const auto ao_driver = "SCF integral driver";
mm.change_submod(ao_driver, "Fock matrix", "Fock Matrix Builder");
mm.change_submod(ao_driver, "Density matrix", "Density matrix builder");

mm.change_submod("Fock matrix builder", "Two center evaluator", ao_driver);

const auto det_driver = "Determinant driver";
mm.change_submod(det_driver, "Two center evaluator", ao_driver);
mm.change_submod(det_driver, "Fock matrix", "Fock matrix builder");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,82 +32,60 @@ using simde::type::aos;
using simde::type::tensor;

using pt = simde::aos_op_base_aos;
using t_e_pt = simde::aos_t_e_aos;
using v_en_pt = simde::aos_v_en_aos;
using j_e_pt = simde::aos_j_e_aos;
using k_e_pt = simde::aos_k_e_aos;
using f_e_pt = simde::aos_f_e_aos;
using rho_e_pt = simde::aos_rho_e_aos<simde::type::cmos>;

class AODispatcher : public chemist::qm_operator::OperatorVisitor {
private:
using base_type = chemist::qm_operator::OperatorVisitor;

public:
using t_e_type = simde::type::t_e_type;
using v_en_type = simde::type::v_en_type;
using j_e_type = simde::type::j_e_type;
using k_e_type = simde::type::k_e_type;
using f_e_type = simde::type::fock;
using rho_e_type = simde::type::rho_e<simde::type::cmos>;

using submods_type = pluginplay::type::submodule_map;

AODispatcher(const aos& bra, const aos& ket, submodule_map& submods,
tensor& t) :
m_pbra_(&bra), m_pket_(&ket), m_psubmods_(&submods), m_ptensor_(&t) {}

void run(const t_e_type& t_e) {
chemist::braket::BraKet input(*m_pbra_, t_e, *m_pket_);
*m_ptensor_ = m_psubmods_->at("Kinetic").run_as<t_e_pt>(input);
}

void run(const v_en_type& v_en) {
chemist::braket::BraKet input(*m_pbra_, v_en, *m_pket_);
const auto key = "Electron-Nuclear attraction";
*m_ptensor_ = m_psubmods_->at(key).run_as<v_en_pt>(input);
}

void run(const j_e_type& j_e) {
chemist::braket::BraKet input(*m_pbra_, j_e, *m_pket_);
const auto key = "Coulomb matrix";
*m_ptensor_ = m_psubmods_->at(key).run_as<j_e_pt>(input);
}

void run(const k_e_type& k_e) {
chemist::braket::BraKet input(*m_pbra_, k_e, *m_pket_);
const auto key = "Exchange matrix";
*m_ptensor_ = m_psubmods_->at(key).run_as<k_e_pt>(input);
}
base_type(false),
m_pbra_(&bra),
m_pket_(&ket),
m_psubmods_(&submods),
m_ptensor_(&t) {}

// void run(const f_e_type& f_e) {
// chemist::braket::BraKet input(*m_pbra_, f_e, *m_pket_);
// const auto key = "Fock matrix";
// *m_ptensor_ = m_psubmods_->at(key).run_as<f_e_pt>(input);
// m_evaluated_ = true;
// }

void run(const rho_e_type& rho_e) {
chemist::braket::BraKet input(*m_pbra_, rho_e, *m_pket_);
const auto key = "Density matrix";
*m_ptensor_ = m_psubmods_->at(key).run_as<rho_e_pt>(input);
m_evaluated_ = true;
}

bool evaluated() const noexcept { return m_evaluated_; }

private:
const aos* m_pbra_;
const aos* m_pket_;
bool m_evaluated_ = false;
submodule_map* m_psubmods_;
tensor* m_ptensor_;
};

MODULE_CTOR(AOIntegralsDriver) {
MODULE_CTOR(SCFIntegralsDriver) {
description(desc);
satisfies_property_type<pt>();
add_submodule<t_e_pt>("Kinetic");
add_submodule<v_en_pt>("Electron-Nuclear attraction");
add_submodule<j_e_pt>("Coulomb matrix");
add_submodule<k_e_pt>("Exchange matrix");
// add_submodule<f_e_pt>("Fock matrix");
add_submodule<pt>("Fundamental matrices");
add_submodule<f_e_pt>("Fock matrix");
add_submodule<rho_e_pt>("Density matrix");
}

MODULE_RUN(AOIntegralsDriver) {
MODULE_RUN(SCFIntegralsDriver) {
const auto&& [braket] = pt::unwrap_inputs(inputs);
const auto& bra = braket.bra();
const auto& op = braket.op();
Expand All @@ -116,6 +94,9 @@ MODULE_RUN(AOIntegralsDriver) {
tensor t;
AODispatcher visitor(bra, ket, submods, t);
op.visit(visitor);
if(!visitor.evaluated()) {
t = submods.at("Fundamental matrices").run_as<pt>(braket);
}

auto rv = results();
return pt::wrap_results(rv, std::move(t));
Expand Down
13 changes: 7 additions & 6 deletions tests/cxx/integration_tests/integration_tests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,21 @@ namespace test_scf {

/// Factors out setting submodules for SCF plugin from other plugins
inline auto load_modules() {
pluginplay::ModuleManager mm;
auto rv = std::make_shared<parallelzone::runtime::RuntimeView>();
pluginplay::ModuleManager mm(rv, nullptr);
scf::load_modules(mm);
integrals::load_modules(mm);
nux::load_modules(mm);

mm.change_submod("SCF Driver", "Hamiltonian",
"Born-Oppenheimer approximation");

mm.change_submod("Four center J builder", "Four-center ERI", "ERI4");
mm.change_submod("Four center K builder", "Four-center ERI", "ERI4");
const auto ao_driver_key = "SCF integral driver";
mm.change_submod(ao_driver_key, "Fundamental matrices",
"AO integral driver");

const auto ao_driver_key = "AO integral driver";
mm.change_submod(ao_driver_key, "Kinetic", "Kinetic");
mm.change_submod(ao_driver_key, "Electron-Nuclear attraction", "Nuclear");
mm.change_submod("Fock Matrix Builder", "Two center evaluator",
"AO integral driver");

mm.change_submod("Diagonalization Fock update", "Overlap matrix builder",
"Overlap");
Expand Down
36 changes: 0 additions & 36 deletions tests/cxx/integration_tests/matrix_builder/j_four_center.cpp

This file was deleted.

Loading