Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Clang Robot committed Sep 13, 2023
1 parent 0b82008 commit 222968f
Show file tree
Hide file tree
Showing 25 changed files with 357 additions and 364 deletions.
36 changes: 14 additions & 22 deletions include/macis/asci/alpha_constraint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,34 @@ namespace macis {

template <typename WfnTraits>
class alpha_constraint {

public:
using wfn_traits = WfnTraits;
using wfn_type = typename WfnTraits::wfn_type;
using spin_wfn_type = spin_wfn_t<wfn_type>;
public:
using wfn_traits = WfnTraits;
using wfn_type = typename WfnTraits::wfn_type;
using spin_wfn_type = spin_wfn_t<wfn_type>;
using spin_wfn_traits = wavefunction_traits<spin_wfn_type>;
using constraint_type = spin_wfn_type;

private:
private:
constraint_type C_;
constraint_type B_;
uint32_t C_min_;
uint32_t count_;

public:
uint32_t C_min_;
uint32_t count_;

alpha_constraint(constraint_type C, constraint_type B, uint32_t C_min) :
C_(C), B_(B), C_min_(C_min), count_(spin_wfn_traits::count(C)) {}
public:
alpha_constraint(constraint_type C, constraint_type B, uint32_t C_min)
: C_(C), B_(B), C_min_(C_min), count_(spin_wfn_traits::count(C)) {}

alpha_constraint(const alpha_constraint&) = default;
alpha_constraint& operator=(const alpha_constraint&) = default;

alpha_constraint(alpha_constraint&& other) noexcept = default;
alpha_constraint& operator=(alpha_constraint&&) noexcept = default;


inline auto C() const { return C_; }
inline auto B() const { return B_; }
inline auto C() const { return C_; }
inline auto B() const { return B_; }
inline auto C_min() const { return C_min_; }
inline auto count() const { return count_; }


inline spin_wfn_type c_mask_union(spin_wfn_type state) const {
return state & C_;
}
Expand All @@ -58,13 +54,9 @@ class alpha_constraint {

template <typename WfnType>
inline bool satisfies_constraint(WfnType state) const {
return overlap(state) == count_ and
return overlap(state) == count_ and
spin_wfn_traits::count(symmetric_difference(state) >> C_min_) == 0;
}



};


}
} // namespace macis
32 changes: 19 additions & 13 deletions include/macis/asci/determinant_contributions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ struct asci_contrib {
template <typename WfnT>
using asci_contrib_container = std::vector<asci_contrib<WfnT>>;


template <Spin Sigma, typename WfnType, typename SpinWfnType>
void append_singles_asci_contributions(
double coeff, WfnType state_full, SpinWfnType state_same,
Expand All @@ -52,7 +51,8 @@ void append_singles_asci_contributions(
if(std::abs(h_el) < h_el_tol) continue;

// Calculate Excited Determinant
auto ex_det = wfn_traits::template single_excitation_no_check<Sigma>(state_full, i, a);
auto ex_det = wfn_traits::template single_excitation_no_check<Sigma>(
state_full, i, a);

// Calculate Excitation Sign in a Canonical Way
auto sign = single_excitation_sign(state_same, a, i);
Expand All @@ -72,10 +72,10 @@ void append_singles_asci_contributions(
template <Spin Sigma, typename WfnType, typename SpinWfnType>
void append_ss_doubles_asci_contributions(
double coeff, WfnType state_full, SpinWfnType state_same,
SpinWfnType state_other,
const std::vector<uint32_t>& ss_occ, const std::vector<uint32_t>& vir,
const std::vector<uint32_t>& os_occ, const double* eps_same,
const double* G, size_t LDG, double h_el_tol, double root_diag, double E0,
SpinWfnType state_other, const std::vector<uint32_t>& ss_occ,
const std::vector<uint32_t>& vir, const std::vector<uint32_t>& os_occ,
const double* eps_same, const double* G, size_t LDG, double h_el_tol,
double root_diag, double E0,
const HamiltonianGeneratorBase<double>& ham_gen,
asci_contrib_container<WfnType>& asci_contributions) {
using wfn_traits = wavefunction_traits<WfnType>;
Expand Down Expand Up @@ -114,14 +114,16 @@ void append_ss_doubles_asci_contributions(
// TODO: Can this be made faster since the orbital indices are known
// in advance?
// Compute excited determinant (spin)
const auto full_ex_spin = spin_wfn_traits::double_excitation_no_check(SpinWfnType(0), i,j,a,b);
const auto full_ex_spin = spin_wfn_traits::double_excitation_no_check(
SpinWfnType(0), i, j, a, b);
const auto ex_det_spin = state_same ^ full_ex_spin;

// Calculate the sign in a canonical way
double sign = doubles_sign(state_same, ex_det_spin, full_ex_spin);

// Calculate full excited determinant
auto ex_det = wfn_traits::template from_spin<Sigma>(ex_det_spin, state_other);
auto ex_det =
wfn_traits::template from_spin<Sigma>(ex_det_spin, state_other);
#endif

// Update sign of matrix element
Expand All @@ -148,7 +150,8 @@ void append_os_doubles_asci_contributions(
const std::vector<uint32_t>& vir_alpha,
const std::vector<uint32_t>& vir_beta, const double* eps_alpha,
const double* eps_beta, const double* V, size_t LDV, double h_el_tol,
double root_diag, double E0, const HamiltonianGeneratorBase<double>& ham_gen,
double root_diag, double E0,
const HamiltonianGeneratorBase<double>& ham_gen,
asci_contrib_container<WfnType>& asci_contributions) {
using wfn_traits = wavefunction_traits<WfnType>;
const size_t LDV2 = LDV * LDV;
Expand All @@ -166,10 +169,13 @@ void append_os_doubles_asci_contributions(

double sign_beta = single_excitation_sign(state_beta, b, j);
double sign = sign_alpha * sign_beta;
//auto ex_det = state_full;
//ex_det.flip(a).flip(i).flip(j + N).flip(b + N);
auto ex_det = wfn_traits::template single_excitation_no_check<Spin::Alpha>(state_full, a, i);
ex_det = wfn_traits::template single_excitation_no_check<Spin::Beta>(ex_det, b, j);
// auto ex_det = state_full;
// ex_det.flip(a).flip(i).flip(j + N).flip(b + N);
auto ex_det =
wfn_traits::template single_excitation_no_check<Spin::Alpha>(
state_full, a, i);
ex_det = wfn_traits::template single_excitation_no_check<Spin::Beta>(
ex_det, b, j);
auto h_el = sign * V_aibj;

// Evaluate fast diagonal element
Expand Down
28 changes: 14 additions & 14 deletions include/macis/asci/determinant_search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ asci_contrib_container<wfn_t<N>> asci_contributions_standard(
// Alias state data
auto state = *(cdets_begin + i);
auto state_alpha = wfn_traits::alpha_string(state);
auto state_beta = wfn_traits::beta_string(state);
auto state_beta = wfn_traits::beta_string(state);
auto coeff = C[i];

// Get occupied and virtual indices
Expand Down Expand Up @@ -150,10 +150,11 @@ asci_contrib_container<wfn_t<N>> asci_contributions_constraint(
wavefunction_iterator_t<N> cdets_end, const double E_ASCI,
const std::vector<double>& C, size_t norb, const double* T_pq,
const double* G_red, const double* V_red, const double* G_pqrs,
const double* V_pqrs, HamiltonianGenerator<wfn_t<N>>& ham_gen, MPI_Comm comm) {
const double* V_pqrs, HamiltonianGenerator<wfn_t<N>>& ham_gen,
MPI_Comm comm) {
using clock_type = std::chrono::high_resolution_clock;
using duration_type = std::chrono::duration<double, std::milli>;
using wfn_traits = wavefunction_traits<wfn_t<N>>;
using wfn_traits = wavefunction_traits<wfn_t<N>>;
using spin_wfn_type = spin_wfn_t<wfn_t<N>>;
using spin_wfn_traits = wavefunction_traits<spin_wfn_type>;

Expand Down Expand Up @@ -294,9 +295,9 @@ asci_contrib_container<wfn_t<N>> asci_contributions_constraint(
const auto& occ_beta = bcd.occ_beta;
const auto& orb_ens_alpha = bcd.orb_ens_alpha;
generate_constraint_singles_contributions_ss(
coeff, det|beta, con, occ_alpha, occ_beta,
orb_ens_alpha.data(), T_pq, norb, G_red, norb, V_red, norb,
h_el_tol, h_diag, E_ASCI, ham_gen, asci_pairs);
coeff, det | beta, con, occ_alpha, occ_beta, orb_ens_alpha.data(),
T_pq, norb, G_red, norb, V_red, norb, h_el_tol, h_diag, E_ASCI,
ham_gen, asci_pairs);
}

// AAAA excitations
Expand All @@ -307,9 +308,8 @@ asci_contrib_container<wfn_t<N>> asci_contributions_constraint(
const auto& occ_beta = bcd.occ_beta;
const auto& orb_ens_alpha = bcd.orb_ens_alpha;
generate_constraint_doubles_contributions_ss(
coeff, det|beta, con, occ_alpha, occ_beta,
orb_ens_alpha.data(), G_pqrs, norb, h_el_tol, h_diag, E_ASCI,
ham_gen, asci_pairs);
coeff, det | beta, con, occ_alpha, occ_beta, orb_ens_alpha.data(),
G_pqrs, norb, h_el_tol, h_diag, E_ASCI, ham_gen, asci_pairs);
}

// AABB excitations
Expand All @@ -322,7 +322,7 @@ asci_contrib_container<wfn_t<N>> asci_contributions_constraint(
const auto& orb_ens_alpha = bcd.orb_ens_alpha;
const auto& orb_ens_beta = bcd.orb_ens_beta;
generate_constraint_doubles_contributions_os(
coeff, det|beta, con, occ_alpha, occ_beta, vir_beta,
coeff, det | beta, con, occ_alpha, occ_beta, vir_beta,
orb_ens_alpha.data(), orb_ens_beta.data(), V_pqrs, norb, h_el_tol,
h_diag, E_ASCI, ham_gen, asci_pairs);
}
Expand All @@ -340,7 +340,7 @@ asci_contrib_container<wfn_t<N>> asci_contributions_constraint(

const auto state = det | beta;
const auto state_alpha = wfn_traits::alpha_string(state);
const auto state_beta = wfn_traits::beta_string(beta);
const auto state_beta = wfn_traits::beta_string(beta);
// BB Excitations
append_singles_asci_contributions<Spin::Beta>(
coeff, state, state_beta, occ_beta, vir_beta, occ_alpha,
Expand All @@ -349,9 +349,9 @@ asci_contrib_container<wfn_t<N>> asci_contributions_constraint(

// BBBB Excitations
append_ss_doubles_asci_contributions<Spin::Beta>(
coeff, state, state_beta, state_alpha, occ_beta, vir_beta, occ_alpha,
eps_beta.data(), G_pqrs, norb, h_el_tol, h_diag, E_ASCI, ham_gen,
asci_pairs);
coeff, state, state_beta, state_alpha, occ_beta, vir_beta,
occ_alpha, eps_beta.data(), G_pqrs, norb, h_el_tol, h_diag,
E_ASCI, ham_gen, asci_pairs);

} // Beta Loop
} // Triplet Check
Expand Down
2 changes: 1 addition & 1 deletion include/macis/asci/iteration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#pragma once
#include <macis/asci/determinant_search.hpp>
#include <macis/solvers/selected_ci_diag.hpp>
#include <macis/mcscf/mcscf.hpp>
#include <macis/solvers/selected_ci_diag.hpp>

namespace macis {

Expand Down
Loading

0 comments on commit 222968f

Please sign in to comment.