Skip to content

Commit

Permalink
working on molresponse
Browse files Browse the repository at this point in the history
  • Loading branch information
ahurta92 committed Jul 1, 2024
1 parent 9e18abf commit 9410b7e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/apps/molresponse/response_coordinator2/coordinator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "madness/chem/SCF.h"
#include "madness/world/worldmem.h"
#include "response_data_base.hpp"
#include "response_parameters.h"
#include "sstream"
#include "string"
#include "write_test_input.h"
Expand Down Expand Up @@ -530,7 +531,7 @@ class ResponseCalcManager {
* @param moldft_path
*/
auto set_frequency_path_and_restart(World &world, const double &frequency,
std::filesystem::path &restart_path, bool restart)
std::filesystem::path &restart_path, bool restart,ResponseParameters &parameters)
-> std::filesystem::path {

if (world.rank() == 0) { ::print("restart path", restart_path); }
Expand All @@ -552,8 +553,6 @@ class ResponseCalcManager {
if (world.rank() == 0) { ::print("save path", save_path); }
if (world.rank() == 0) { ::print("save string", save_string); }

ResponseParameters parameters(parameter_manager.get_molresponse_params());


if (world.rank() == 0) {
parameters.set_user_defined_value("save", true);
Expand Down Expand Up @@ -594,17 +593,16 @@ class ResponseCalcManager {
* @param restart_path
* @return
*/
auto RunResponse(World &world, const std::string &filename, double frequency, const std::string &property,
const std::string &xc,
const std::filesystem::path &moldft_path, std::filesystem::path restart_path,
const std::string &precision)
auto RunResponse(World &world, const std::string &filename, double frequency, std::filesystem::path restart_path)
-> std::pair<std::filesystem::path, bool> {
// Set the response parameters
ResponseParameters r_params{};
//set_frequency_response_parameters(world, r_params, property, xc, frequency, precision);
ResponseParameters r_params=parameter_manager.get_molresponse_params();
r_params.set_user_defined_value("omega", frequency);
auto save_path = set_frequency_path_and_restart(world, frequency,
restart_path,
true);
true,r_params);


if (world.rank() == 0) { molresponse::write_response_input(r_params, filename); }
// if rbase exists and converged I just return save path and true
if (std::filesystem::exists("response_base.json")) {
Expand All @@ -617,7 +615,7 @@ class ResponseCalcManager {
}
auto calc_params = initialize_calc_params(world, std::string(filename));
RHS_Generator rhs_generator;
if (property == "dipole") {
if (op == "dipole") {
rhs_generator = dipole_generator;
} else {
rhs_generator = nuclear_generator;
Expand Down Expand Up @@ -658,7 +656,7 @@ class ResponseCalcManager {
* @param xc
* @param property
*/
void runFrequencyTests(World &world) {
void run_molresponse(World &world) {
std::filesystem::current_path(moldft_path);
// add a restart path
auto restart_path = addPath(moldft_path,
Expand All @@ -677,7 +675,7 @@ class ResponseCalcManager {
} else {
throw Response_Convergence_Error{};
}
//success = RunResponse(world, "response.in", freq, schema.op, schema.xc, schema.moldft_path, restart_path,
success = RunResponse(world, "response.in", freq, restart_path);
// high_prec);
if (world.rank() == 0) { ::print("Frequency ", freq, " completed"); }
}
Expand All @@ -696,7 +694,7 @@ class ResponseCalcManager {
std::filesystem::current_path(moldft_path);
ResponseParameters r_params{};
auto save_path = set_frequency_path_and_restart(world, freq,
restart_path, true);
restart_path, true, r_params);


if (std::filesystem::exists("response_base.json")) {
Expand Down Expand Up @@ -848,7 +846,7 @@ class ResponseCalcManager {
if (true) {
// if the first order response calculations haven't been run then run them
if (world.rank() == 0) { ::print("Running first order response calculations"); }
runFrequencyTests(world);
run_molresponse(world);
} else {
if (world.rank() == 0) {
::print("First order response calculations haven't been run and can't be run");
Expand Down
23 changes: 23 additions & 0 deletions src/apps/molresponse/response_coordinator2/test_coordinator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,27 @@ TEST_CASE("Run MOLDFT") {
// Now we need to write a function
}

TEST_CASE("Run MOLDFT + MOLRESPONSE") {
// Set up the run directories
using namespace madness;

World &world = World::get_default();
std::cout.precision(6);


path input_json("resources/inputs/freq_input.json");
path mol_input("resources/molecules/He.mol");


ParameterManager params(world, input_json, mol_input);
auto response_manager = ResponseCalcManager(world, params);

response_manager.run_moldft(world,true);

response_manager.run_molresponse(world);

// The json is converted into a temporary getKW file which is then read by the parser.
// Now we need to write a function
}


0 comments on commit 9410b7e

Please sign in to comment.