diff --git a/src/apps/molresponse/response_coordinator2/coordinator.hpp b/src/apps/molresponse/response_coordinator2/coordinator.hpp index 5f42bd05c7e..70f837772b3 100644 --- a/src/apps/molresponse/response_coordinator2/coordinator.hpp +++ b/src/apps/molresponse/response_coordinator2/coordinator.hpp @@ -114,6 +114,25 @@ class ParameterManager { ResponseParameters molresponse_params; public: + ParameterManager() = default; + + void print_params() const { + ::print("------------Parameter Manager---------------"); + ::print("Input File Path: ", input_file_path); + ::print("Input File Json Path: ", input_file_json_path); + ::print("Input File Base: ", input_file_base); + ::print("-------------------------------------------"); + } + explicit ParameterManager(World &world, commandlineparser par):parser(std::move(par)) { + molecule = Molecule(world, this->parser); + moldft_params = CalculationParameters(world, this->parser); + molresponse_params = ResponseParameters(world, this->parser); + all_input_json = {}; + all_input_json["dft"] = moldft_params.to_json_if_precedence("defined"); + all_input_json["response"] = molresponse_params.to_json_if_precedence("defined"); + all_input_json["molecule"] = molecule.to_json(); + write_json_input(); + } explicit ParameterManager(World &world, const path &file_path) { @@ -244,25 +263,6 @@ class ParameterManager { - } - - explicit ParameterManager(World - &world, commandlineparser - parser) : parser(std::move(parser)) { - - molecule = Molecule(world, this->parser); - moldft_params = CalculationParameters(world, this->parser); - - molresponse_params = ResponseParameters(world, this->parser); - - - all_input_json = {}; - all_input_json["dft"] = moldft_params.to_json_if_precedence("defined"); - all_input_json["response"] = molresponse_params.to_json_if_precedence("defined"); - all_input_json["molecule"] = molecule.to_json(); - - write_json_input(); - } json get_input_json() { diff --git a/src/apps/molresponse/response_coordinator2/mad-freq2.cpp b/src/apps/molresponse/response_coordinator2/mad-freq2.cpp index a2257b6251c..9910ea1710a 100644 --- a/src/apps/molresponse/response_coordinator2/mad-freq2.cpp +++ b/src/apps/molresponse/response_coordinator2/mad-freq2.cpp @@ -1,6 +1,8 @@ // // Created by adrianhurtado on 1/1/22. +#include "FrequencyResponse.hpp" #include "coordinator.hpp" +#include #if defined(HAVE_SYS_TYPES_H) && defined(HAVE_SYS_STAT_H) && defined(HAVE_UNISTD_H) @@ -20,6 +22,7 @@ using path = std::filesystem::path; using namespace madness; + auto main(int argc, char *argv[]) -> int { madness::initialize(argc, argv); @@ -28,14 +31,35 @@ auto main(int argc, char *argv[]) -> int { { World world(SafeMPI::COMM_WORLD); startup(world, argc, argv, true); + if (world.rank() == 0) print(info::print_revision_information()); try { + // I need to write a help and a print parameters function which will be called by the commandlineparser + print_meminfo(world.rank(), "startup"); + + ParameterManager params; + if(argc == 1) { + print("No input file found"); + path input_json("resources/inputs/freq_input.json"); + path mol_input("resources/molecules/H2O.mol"); + params=ParameterManager(world, input_json, mol_input); + }else if(argc == 2) { + print("Input file found"); + path input_file(argv[1]); + commandlineparser parser(argc, argv); + params=ParameterManager(world, parser); + }else if(argc == 3) { + print("Input and mol file found"); + path input_file(argv[1]); + path mol_input(argv[2]); + params=ParameterManager(world, input_file, mol_input); + }else { + error("Too many arguments"); + } + //print params + params.print_params(); - path input_json("resources/inputs/freq_input.json"); - path mol_input("resources/molecules/H2.mol"); - - ParameterManager params(world, input_json, mol_input); auto response_manager = ResponseCalcManager(world, params); if(world.rank() == 0) { diff --git a/src/apps/molresponse/response_coordinator2/test_coordinator.cpp b/src/apps/molresponse/response_coordinator2/test_coordinator.cpp index 581b0dfd8a3..8272a46bef8 100644 --- a/src/apps/molresponse/response_coordinator2/test_coordinator.cpp +++ b/src/apps/molresponse/response_coordinator2/test_coordinator.cpp @@ -123,7 +123,6 @@ TEST_CASE("Define parameters with input and mol file separately") { ParameterManager params(world, input_json, mol_input); auto response_manager = ResponseCalcManager(world, params); - response_manager.run_moldft(world,false); }