Skip to content

Commit

Permalink
Merge branch 'feature/pt2' of github.com:wavefunction91/MACIS into fe…
Browse files Browse the repository at this point in the history
…ature/pt2
  • Loading branch information
David Williams-Young committed Sep 13, 2023
2 parents e224338 + 5e9f7fe commit 0b82008
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
8 changes: 4 additions & 4 deletions include/macis/asci/determinant_contributions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct asci_contrib {
WfnT state;
double c_times_matel;
double h_diag;

auto rv() const { return c_times_matel / h_diag; }
};

Expand Down Expand Up @@ -61,7 +61,7 @@ void append_singles_asci_contributions(
// Calculate fast diagonal matrix element
auto h_diag =
ham_gen.fast_diag_single(eps_same[i], eps_same[a], i, a, root_diag);
//h_el /= (E0 - h_diag);
// h_el /= (E0 - h_diag);

// Append to return values
asci_contributions.push_back({ex_det, coeff * h_el, E0 - h_diag});
Expand Down Expand Up @@ -131,7 +131,7 @@ void append_ss_doubles_asci_contributions(
auto h_diag =
ham_gen.fast_diag_ss_double(eps_same[i], eps_same[j], eps_same[a],
eps_same[b], i, j, a, b, root_diag);
//h_el /= (E0 - h_diag);
// h_el /= (E0 - h_diag);

// Append {det, c*h_el}
asci_contributions.push_back({ex_det, coeff * h_el, E0 - h_diag});
Expand Down Expand Up @@ -176,7 +176,7 @@ void append_os_doubles_asci_contributions(
auto h_diag = ham_gen.fast_diag_os_double(eps_alpha[i], eps_beta[j],
eps_alpha[a], eps_beta[b],
i, j, a, b, root_diag);
//h_el /= (E0 - h_diag);
// h_el /= (E0 - h_diag);

asci_contributions.push_back({ex_det, coeff * h_el, E0 - h_diag});
} // BJ loop
Expand Down
2 changes: 1 addition & 1 deletion include/macis/asci/determinant_search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ std::vector<wfn_t<N>> asci_search(
// Finalize scores
for(auto& x : asci_pairs) {
x.c_times_matel = -std::abs(x.c_times_matel);
x.h_diag = std::abs(x.h_diag);
x.h_diag = std::abs(x.h_diag);
}

// Insert all dets with their coefficients as seeds
Expand Down
3 changes: 2 additions & 1 deletion include/macis/asci/determinant_sort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ void keep_only_largest_copy_asci_pairs(

// Keep only max value
else {
cur_it->c_times_matel = std::max(cur_it->c_times_matel, it->c_times_matel);
cur_it->c_times_matel =
std::max(cur_it->c_times_matel, it->c_times_matel);
}
}

Expand Down
10 changes: 5 additions & 5 deletions include/macis/asci/mask_constraints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ void generate_constraint_singles_contributions_ss(
const size_t LDV2 = LDV * LDV;
for(int ii = 0; ii < no; ++ii) {
const auto i = fls(o);
o.flip(i); // Disable "i"-bit so it's not used in FLS next iteration
o.flip(i); // Disable "i"-bit so it's not used in FLS next iteration
auto v_cpy = v;
for(int aa = 0; aa < nv; ++aa) {
const auto a = fls(v_cpy);
v_cpy.flip(a); // Disable "a"-bit so it's not used in FLS next iteration
v_cpy.flip(a); // Disable "a"-bit so it's not used in FLS next iteration

double h_el = T_pq[a + i * LDT];
const double* G_ov = G_kpq + a * LDG + i * LDG2;
Expand All @@ -250,7 +250,7 @@ void generate_constraint_singles_contributions_ss(

// Compute Fast Diagonal Matrix Element
auto h_diag = ham_gen.fast_diag_single(eps[i], eps[a], i, a, root_diag);
//h_el /= (E0 - h_diag);
// h_el /= (E0 - h_diag);

asci_contributions.push_back({ex_det, coeff * h_el, E0 - h_diag});
}
Expand Down Expand Up @@ -305,7 +305,7 @@ void generate_constraint_doubles_contributions_ss(
// Evaluate fast diagonal matrix element
auto h_diag = ham_gen.fast_diag_ss_double(eps[i], eps[j], eps[a], eps[b],
i, j, a, b, root_diag);
//h_el /= (E0 - h_diag);
// h_el /= (E0 - h_diag);

asci_contributions.push_back({full_ex, coeff * h_el, E0 - h_diag});
}
Expand Down Expand Up @@ -366,7 +366,7 @@ void generate_constraint_doubles_contributions_os(
auto h_diag =
ham_gen.fast_diag_os_double(eps_same[i], eps_othr[j], eps_same[a],
eps_othr[b], i, j, a, b, root_diag);
//h_el /= (E0 - h_diag);
// h_el /= (E0 - h_diag);

asci_contributions.push_back({ex_det, coeff * h_el, E0 - h_diag});
} // BJ
Expand Down
12 changes: 6 additions & 6 deletions tests/standalone_driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <iomanip>
#include <iostream>
#include <macis/asci/grow.hpp>
#include <macis/asci/refine.hpp>
#include <macis/asci/pt2.hpp>
#include <macis/asci/refine.hpp>
#include <macis/hamiltonian_generator/double_loop.hpp>
#include <macis/util/detail/rdm_files.hpp>
#include <macis/util/fcidump.hpp>
Expand Down Expand Up @@ -384,9 +384,10 @@ int main(int argc, char** argv) {
}
#endif
if(pt2) {
EPT2 = macis::asci_pt2_constraint( dets.begin(), dets.end(), E0 -(E_inactive + E_core), C, n_active,
ham_gen.T(), ham_gen.G_red(), ham_gen.V_red(),ham_gen.G(), ham_gen.V(),
ham_gen MACIS_MPI_CODE(, MPI_COMM_WORLD));
EPT2 = macis::asci_pt2_constraint(
dets.begin(), dets.end(), E0 - (E_inactive + E_core), C, n_active,
ham_gen.T(), ham_gen.G_red(), ham_gen.V_red(), ham_gen.G(),
ham_gen.V(), ham_gen MACIS_MPI_CODE(, MPI_COMM_WORLD));
}
}

Expand All @@ -397,8 +398,7 @@ int main(int argc, char** argv) {
console->info("E(CI+PT2) = {:.12f} Eh", E0 + EPT2);
}


// MCSCF
// MCSCF
} else if(job == Job::MCSCF) {
// Possibly read active RDMs
if(rdm_fname.size()) {
Expand Down

0 comments on commit 0b82008

Please sign in to comment.