21#include <boost/format.hpp>
44 std::string archive_filename) {
48 std::string tasks_string = options.
get(
".tasks").
as<std::string>();
52 std::vector<std::string> tasks = tokenizedTasks.ToVector();
54 do_guess_ = std::find(tasks.begin(), tasks.end(),
"guess") != tasks.end();
55 do_dft_input_ = std::find(tasks.begin(), tasks.end(),
"input") != tasks.end();
56 do_dft_run_ = std::find(tasks.begin(), tasks.end(),
"dft") != tasks.end();
57 do_dft_parse_ = std::find(tasks.begin(), tasks.end(),
"parse") != tasks.end();
58 do_gwbse_ = std::find(tasks.begin(), tasks.end(),
"gwbse") != tasks.end();
60 std::find(tasks.begin(), tasks.end(),
"localize") != tasks.end();
62 std::find(tasks.begin(), tasks.end(),
"dft_in_dft") != tasks.end();
76 if (options.
exists(
".logging_file")) {
98 Logger gwbse_engine_logger(
pLog_->getReportLevel());
106 logger = &gwbse_engine_logger;
114 <<
"Guess requested, reading molecular orbitals" << flush;
125 throw std::runtime_error(
"\n DFT-run failed. Stopping!");
136 bool Logfile_parse =
qmpackage_->ParseLogFile(orbitals);
137 if (!Logfile_parse) {
138 throw std::runtime_error(
"\n Parsing DFT logfile " +
dftlog_file_ +
139 " failed. Stopping!");
141 bool Orbfile_parse =
qmpackage_->ParseMOsFile(orbitals);
142 if (!Orbfile_parse) {
143 throw std::runtime_error(
"\n Parsing DFT orbfile " +
MO_file_ +
144 " failed. Stopping!");
154 throw std::runtime_error(
155 "MO localization not implemented for open-shell systems");
164 <<
"Loading serialized data from " <<
archive_file_ << flush;
167 if (orbitals.
getLMOs().size() == 0) {
168 throw std::runtime_error(
169 "Can't do DFT in DFT embedding without localization");
177 throw std::runtime_error(
178 "DFT-in-DFT not implemented for open-shell systems");
181 bool run_success =
qmpackage_->RunActiveRegion();
183 throw std::runtime_error(
"\n DFT in DFT embedding failed. Stopping!");
185 bool Logfile_parse =
qmpackage_->ParseLogFile(orbitals);
186 if (!Logfile_parse) {
187 throw std::runtime_error(
"\n Parsing DFT logfile " +
dftlog_file_ +
188 " failed. Stopping!");
190 bool Orbfile_parse =
qmpackage_->ParseMOsFile(orbitals);
191 if (!Orbfile_parse) {
192 throw std::runtime_error(
"\n Parsing DFT orbfile " +
MO_file_ +
193 " failed. Stopping!");
205 "inactive_screening",
"none"));
209 orbitals, inactive_mode,
211 "inactive_screening_complete_g",
false),
213 "inactive_screening_radius", 0.0) *
219 if (active_electrons % 2 != 0) {
220 throw std::runtime_error(
221 "Embedded GWBSE currently supports only closed-shell active "
222 "spaces with an even number of electrons");
225 Index active_occ = active_electrons / 2;
246 orbitals = orb_embedded;
265 if (!ofs.is_open()) {
266 throw std::runtime_error(
"Bad file handle: " +
logger_file_);
268 ofs << (*pLog) << std::endl;
std::string archive_file_
void WriteLoggerToFile(Logger *pLog)
tools::Property gwbse_options_
void ExcitationEnergies(Orbitals &orbitals)
std::string guess_archiveA_
tools::Property localize_options_
void Initialize(tools::Property &options, std::string archive_filename)
std::string guess_archiveB_
Electronic excitations from GW-BSE.
void addoutput(tools::Property &summary)
void setInactiveScreening(InactiveScreeningInput input)
void Initialize(tools::Property &options)
void setLogger(Logger *pLog)
static tools::EigenSystem CompleteGOrbitals(const tools::EigenSystem &embedded, Index n_active_occupied, const InactiveScreeningInput &input)
The MOs GW-BSE works with for complete G: the inactive occupied orbitals (semicanonical,...
static InactiveScreeningInput Prepare(const Orbitals &full, InactiveScreeningInput::Mode mode, bool complete_g=false, double radius=0.0)
The input for GWBSE, from the full reference orbitals (before they are replaced by the embedded ones)...
Logger is used for thread-safe output of messages.
void setPreface(Log::Level level, const std::string &preface)
void setMultithreading(bool maverick)
Container for molecular orbitals and derived one-particle data.
Index getNumOfActiveElectrons()
Return the number of electrons assigned to the active region.
Index getCharge() const
Return the stored total charge.
void PrepareDimerGuess(const Orbitals &orbitalsA, const Orbitals &orbitalsB)
Guess for a dimer based on monomer orbitals.
void setNumberOfAlphaElectrons(Index electrons)
Store the total number of alpha electrons.
const Eigen::MatrixXd & getLMOs() const
Return localized molecular orbitals, if available.
void setNumberOfBetaElectrons(Index electrons)
Store the total number of beta electrons.
void setNumberOfOccupiedLevels(Index occupied_levels)
const tools::EigenSystem & MOs() const
Return read-only access to alpha/restricted molecular orbitals.
void ReadFromCpt(const std::string &filename)
Read the orbital container from a checkpoint file on disk.
void setNumberOfOccupiedLevelsBeta(Index occupied_levels_beta)
Store the number of occupied beta-spin orbitals.
void setChargeAndSpin(Index charge, Index spin)
bool isOpenShell() const
Report whether the stored state corresponds to an open-shell system.
const tools::EigenSystem & getEmbeddedMOs() const
Return molecular orbitals obtained from an embedding calculation.
void computePML(Orbitals &orbitals)
#define XTP_LOG(level, log)
Charge transport classes.
Provides a means for comparing floating point numbers.