38 throw std::runtime_error(
40 " must always be region 0. Currently only one qm region is possible.");
53 if (prop.
exists(
"statetracker")) {
60 throw std::runtime_error(
61 "No statetracker options for excited states found");
67 if (prop.
exists(
"statetracker")) {
74 throw std::runtime_error(
"No statetracker options for KS states found");
79 prop.
get(
"grid_for_potential").
as<std::string>();
87 if (prop.
get(
"dftpackage.xtpdft.dft_in_dft.activeatoms")
104 std::string info =
"not converged";
105 bool converged =
false;
111 <<
" Region:" << this->
identify() <<
" " << this->
getId() <<
" is "
112 << info <<
" deltaE=" << Echange <<
" RMS Dmat=" << Dchange
113 <<
" MaxDmat=" << Dmax << std::flush;
121 std::accumulate(interact_energies.begin(), interact_energies.end(), 0.0);
124 <<
" Calculated interaction potentials with other regions. E[hrt]= "
125 << e_ext << std::flush;
146 if (!Logfile_parse) {
148 errormsg_ =
"Parsing DFT logfile failed.";
152 if (!Orbfile_parse) {
154 errormsg_ =
"Parsing DFT orbfile failed.";
159 throw std::runtime_error(
160 "MO localization not implemented for open-shell systems");
168 throw std::runtime_error(
169 "DFT-in-DFT not implemented for open-shell systems");
172 std::unique_ptr<QMPackage> xtpdft =
174 xtpdft->setLog(&
log_);
183 xtpdft->setCharge(
charge);
185 std::vector<double> energies = std::vector<double>(regions.size(), 0.0);
186 for (std::unique_ptr<Region>& reg : regions) {
187 Index id = reg->getId();
188 if (
id == this->
getId()) {
195 <<
TimeStamp() <<
" Evaluating interaction between "
197 << reg->identify() <<
" " << reg->getId() << std::flush;
198 if (reg->identify() == Staticdummy.
identify()) {
200 xtpdft->AddRegion(*staticregion);
201 }
else if (reg->identify() == Polardummy.
identify()) {
203 xtpdft->AddRegion(*polarregion);
205 throw std::runtime_error(
206 "Interaction of regions with types:" + this->
identify() +
" and " +
207 reg->identify() +
" not implemented");
211 e_ext = std::accumulate(interact_energies.begin(), interact_energies.end(),
215 <<
" Calculated interaction potentials with other regions. E[hrt]= "
216 << e_ext << std::flush;
218 xtpdft->WriteInputFile(
orb_);
219 bool active_run = xtpdft->RunActiveRegion();
221 throw std::runtime_error(
"\n DFT in DFT embedding failed. Stopping!");
223 Logfile_parse = xtpdft->ParseLogFile(
orb_);
224 if (!Logfile_parse) {
225 throw std::runtime_error(
"\n Parsing DFT logfile failed. Stopping!");
245 throw std::runtime_error(
"GWBSE not implemented for open-shell systems");
299 nuccharge += a.getNuccharge();
309 charge = double(nuccharge - electrons);
351 throw std::runtime_error(
352 "QMRegion-QMRegion interaction is not implemented yet.");
371#pragma omp parallel for
372 for (
Index i = 0; i <
Index(segments.size()); ++i) {
378 std::vector<PolarSegment>& segments)
const {
394 double N_comp = dmat.cwiseProduct(overlap.
Matrix()).sum();
395 if (std::abs(Ngrid - N_comp) > 0.001) {
398 <<
"WARNING: Calculated Densities at Numerical Grid, Number of "
400 << Ngrid <<
" is far away from the the real value " << N_comp
401 <<
", you should increase the accuracy of the integration grid."
404#pragma omp parallel for
405 for (
Index i = 0; i <
Index(segments.size()); ++i) {
446 r(state,
"initial_state");
void WriteContainer(T &container)
Container to hold Basisfunctions for all atoms.
const std::string & Name() const
void Fill(const AOBasis &aobasis) final
const Eigen::MatrixXd & Matrix() const
const std::string & getType() const
void push_back(const T &atom)
CheckpointReader openChild(const std::string &childName) const
CheckpointWriter openChild(const std::string &childName) const
Eigen::Vector3d IntegrateField(const Eigen::Vector3d &rvector) const
double IntegrateDensity(const Eigen::MatrixXd &density_matrix)
Electronic excitations from GW-BSE.
void Initialize(tools::Property &options)
void setLogger(Logger *pLog)
const Eigen::MatrixXd getTruncMOsFullBasis() const
Index getNumOfActiveElectrons()
void ReadBasisSetsFromCpt(CheckpointReader r)
double getDFTTotalEnergy() const
const AOBasis & getAuxBasis() const
Index getNumberOfAlphaElectrons() const
std::string getCalculationType() const
void setNumberOfAlphaElectrons(Index electrons)
void WriteBasisSetsToCpt(CheckpointWriter w) const
Eigen::MatrixXd DensityMatrixFull(const QMState &state) const
void SetupAuxBasis(std::string aux_basis_name)
double getExcitedStateEnergy(const QMState &state) const
void setNumberOfOccupiedLevels(Index occupied_levels)
const tools::EigenSystem & MOs() const
const QMMolecule & QMAtoms() const
void ReadFromCpt(const std::string &filename)
void WriteToCpt(const std::string &filename) const
void SetupDftBasis(std::string basis_name)
const tools::EigenSystem & getEmbeddedMOs() const
Index getNumberOfBetaElectrons() const
const AOBasis & getDftBasis() const
void computePML(Orbitals &orbitals)
std::string identify() const override
Class to represent Atom/Site in electrostatic+polarization.
void AddContainer(const AtomContainer< QMAtom > &container)
void AppendResult(tools::Property &prop) const override
StateTracker statetracker_
hist< Eigen::MatrixXd > Dmat_hist_
std::string grid_accuracy_for_ext_interaction_
std::string identify() const override
void AddNucleiFields(std::vector< PolarSegment > &segments, const StaticSegment &seg) const
std::unique_ptr< QMPackage > qmpackage_
void push_back(const QMMolecule &mol)
void WriteToCpt(CheckpointWriter &w) const override
double InteractwithStaticRegion(const StaticRegion ®ion) override
double InteractwithPolarRegion(const PolarRegion ®ion) override
void WritePDB(csg::PDBWriter &writer) const override
void ReadFromCpt(CheckpointReader &r) override
bool Converged() const override
void Evaluate(std::vector< std::unique_ptr< Region > > ®ions) override
tools::Property localize_options_
double InteractwithQMRegion(const QMRegion ®ion) override
void ApplyQMFieldToPolarSegments(std::vector< PolarSegment > &segments) const
void Initialize(const tools::Property &prop) override
double charge() const override
tools::Property dftoptions_
tools::Property gwbseoptions_
bool isSingleParticleState() const
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
void FromString(const std::string &statestring)
std::string ToString() const
const QMStateType & Type() const
std::vector< double > ApplyInfluenceOfOtherRegions(std::vector< std::unique_ptr< Region > > ®ions)
void Initialize(const tools::Property &options)
void setLogger(Logger *log)
QMState CalcStateAndUpdate(const Orbitals &orbitals)
void setInitialState(const QMState &state)
void ReadFromCpt(CheckpointReader &r)
void WriteToCpt(CheckpointWriter &w) const
QMState CalcState(const Orbitals &orbitals) const
QMState InitialState() const
std::string identify() const override
Class to represent Atom/Site in electrostatic.
Timestamp returns the current time as a string Example: cout << TimeStamp()
void GridSetup(const std::string &type, const QMMolecule &atoms, const AOBasis &basis)
Mediates interaction between polar and static sites.
void WriteToCpt(CheckpointWriter &w) const
void ReadFromCpt(CheckpointReader &r)
void push_back(const T &metric)
#define XTP_LOG(level, log)
ClassicalSegment< StaticSite > StaticSegment
base class for all analysis tools