Skip to content

Commit

Permalink
make sure hyperpolarizability runs new exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
ahurta92 committed Jul 16, 2024
1 parent bc3855c commit f290a93
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
45 changes: 29 additions & 16 deletions src/apps/molresponse/FrequencyResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ void FrequencyResponse::iterate(World &world)
molresponse::end_timer(world, "Save:");
}






break;
}
}
Expand Down Expand Up @@ -622,7 +617,6 @@ std::pair<Tensor<double>, std::vector<std::string>> QuadraticResponse::compute_b
beta *= -2.0;
world.gop.fence();


return {beta, beta_indices};
}

Expand Down Expand Up @@ -1215,19 +1209,38 @@ X_space QuadraticResponse::compute_coulomb_term(World &world, const X_space &B,
return J;
}

auto Koperator(const vecfuncT &ket, const vecfuncT &bra)
{
const double lo = 1.e-10;
auto &world = ket[0].world();
Exchange<double, 3> k{world, lo};
k.set_bra_and_ket(bra, ket);
k.set_algorithm(k.multiworld_efficient);
return k;
};

X_space QuadraticResponse::compute_exchange_term(World &world, const X_space &A, const X_space &B, const X_space &x_apply) const
{

auto Koperator = [&](const vecfuncT &ket, const vecfuncT &bra)
{
const double lo = 1.e-10;
auto &world = ket[0].world();
Exchange<double, 3> k{world, lo};
k.set_bra_and_ket(bra, ket);

std::string algorithm_ = r_params.hfexalg();

if (algorithm_ == "multiworld")
{
k.set_algorithm(Exchange<double, 3>::Algorithm::multiworld_efficient);
}
else if (algorithm_ == "multiworld_row")
{
k.set_algorithm(Exchange<double, 3>::Algorithm::multiworld_efficient_row);
}
else if (algorithm_ == "largemem")
{
k.set_algorithm(Exchange<double, 3>::Algorithm::large_memory);
}
else if (algorithm_ == "smallmem")
{
k.set_algorithm(Exchange<double, 3>::Algorithm::small_memory);
}

return k;
};

// if the frequecy of A is 0 we run the static case
// else we run the dynamic case
auto K = X_space::zero_functions(world, A.num_states(), A.num_orbitals());
Expand Down
5 changes: 5 additions & 0 deletions src/apps/molresponse/ResponseBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ auto ResponseBase::ComputeHamiltonianPair(World &world) const -> std::pair<Tenso
// if (world.rank() == 0) print("selecting exchange multi world");
k.set_algorithm(Exchange<double, 3>::Algorithm::multiworld_efficient);
}
else if(r_params.hfexalg() =="multiworld_row")
{
// if (world.rank() == 0) print("selecting exchange multi world efficient");
k.set_algorithm(Exchange<double, 3>::Algorithm::multiworld_efficient_row);
}
else if (r_params.hfexalg() == "largemem")
{
// if (world.rank() == 0) print("selecting exchange large memory");
Expand Down
1 change: 1 addition & 0 deletions src/apps/molresponse/maddft/response_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,7 @@ class ResponseCalcManager
quad_parameters.set_user_defined_value("quadratic", true);
quad_parameters.set_user_defined_value("freq_range", molresponse_params.freq_range());
quad_parameters.set_user_defined_value("xc", moldft_params.xc());
quad_parameters.set_user_defined_value("hfexalg",molresponse_params.hfexalg());

if (op == "dipole")
{
Expand Down

0 comments on commit f290a93

Please sign in to comment.