votca 2026-dev
Loading...
Searching...
No Matches
dftengine.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2023 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20#pragma once
21#ifndef VOTCA_XTP_DFTENGINE_H
22#define VOTCA_XTP_DFTENGINE_H
23
24// Standard includes
25#include <map>
26
27// VOTCA includes
29
30// Local VOTCA includes
31#include "ERIs.h"
32#include "activeregion.h"
33#include "convergenceacc.h"
34#include "dfttimings.h"
35#include "hirshfeldpartition.h"
36#include "uks_convergenceacc.h"
37
38#include "ecpaobasis.h"
39#include "extended_hueckel.h"
40#include "logger.h"
41#include "qmmolecule.h"
42#include "staticsite.h"
43#include "vxc_grid.h"
44#include "vxc_potential.h"
45
46namespace votca {
47namespace xtp {
48class Orbitals;
57 std::string eris_key;
58 bool has_eris = false;
60 std::string ewald_key;
61 Eigen::MatrixXd ewald_matrix;
62 // AO potential of the permanent moments of the external sites; the induced
63 // dipoles change between QM/MM iterations and are integrated every run.
64 std::string multipole_key;
65 Eigen::MatrixXd multipole_sites; // one row per site: pos, rank, Q
66 Eigen::MatrixXd multipole_matrix;
67};
68
69class DFTEngineTestAccess;
70
78
88
89class DFTEngine {
90 public:
92 void Initialize(tools::Property& options);
93
95 void setLogger(Logger* pLog) { pLog_ = pLog; }
96
100 std::vector<std::unique_ptr<StaticSite> >* externalsites) {
101 externalsites_ = externalsites;
102 }
103
104 void setEwaldgrid(const Vxc_Grid& ewaldgrid) {
105 external_ewaldgrid_ = ewaldgrid;
106 has_ewaldgrid_ = true;
107 }
108
109 // The nuclei's share of the external Ewald potential, sum_A Z_A
110 // phi(R_A). Added to E0 alongside the grid's contribution to H0 -- the
111 // grid integrates against the DENSITY and so reaches the electrons
112 // only, exactly as IntegrateExternalMultipoles pairs its AO matrix with
113 // ExternalRepulsion for the multipole route.
114 void setEwaldNuclearEnergy(double energy) { ewald_nuclear_energy_ = energy; }
115
120 void setWarmStart(bool warm_start) { warm_start_ = warm_start; }
121
125 void setSetupCache(DFTSetupCache* cache) { setup_cache_ = cache; }
126
129 void setSCFToleranceFloor(double energy, double error);
130 void ReturnSetupCache();
131
134 bool Evaluate(Orbitals& orb);
135
152 bool RunCDFT(Orbitals& orb, HirshfeldPartition::Constraint& constraint);
153
160
162 std::string getDFTBasisName() const { return dftbasis_name_; };
163
174 std::vector<Eigen::MatrixXd> StaticResponse(
175 const Orbitals& orb, const std::vector<Eigen::MatrixXd>& perturbations,
176 double tolerance = 1e-7, Index max_iterations = 100);
177
183 bool singlet = true;
184 Index vmin = 0; // absolute MO indices of the BSE window
186 Index rpamin = 0; // absolute MO indices of the static RPA screening
190 Eigen::VectorXd X;
191 Eigen::VectorXd Y;
197 std::vector<Index> qp_levels;
200 Eigen::VectorXd energies_bse;
202 Eigen::VectorXd energies_rpa;
203 double eta = 1e-4; // broadening of the static RPA (RPA::eta_)
204
211 bool qp_response = false;
215 Eigen::VectorXd qp_energies;
216 std::string sigma_integrator = "ppm"; // gw.sigma_integrator: ppm, exact
217 double sigma_eta = 1e-3; // gw.eta
218 double ppm_imag = 0.5; // imaginary fitting frequency of the PPM
222 bool qp_selfconsistent = false;
223 std::string out_of_window_shift = "max";
228 bool density_only = false;
229 };
232 double omega = 0.0;
235 Eigen::MatrixXd gradient;
237 std::vector<Eigen::MatrixXd> qp_gradients;
243 Eigen::MatrixXd relaxed_density;
245 std::vector<Eigen::MatrixXd> qp_relaxed_densities;
247 double qp_rebuild_error = 0.0;
249 double rpa_rebuild_error = 0.0;
250 };
251
259 const BSEGradientInput& input);
260
267 bool singlet,
268 Index index);
269
274 const Orbitals& orb, const std::vector<Index>& levels);
275
281 static bool ConfigureQPResponse(BSEGradientInput& input, const Orbitals& orb,
282 const tools::Property& gwbse, Logger* log);
283
295 Eigen::MatrixXd RelaxedDensityMatrix(const Orbitals& orb,
296 const QMState& state,
297 const tools::Property& gwbse,
298 bool qp_response = true);
299
301 const std::string& getGridName() const { return grid_name_; }
302
309 void setExternalPotentialMatrix(const Eigen::MatrixXd& v) {
311 }
312
315 std::vector<HirshfeldPartition::AtomicReference> HirshfeldReferences(
316 const QMMolecule& mol) const;
319 struct SpinDensity {
320 Eigen::MatrixXd alpha;
321 Eigen::MatrixXd beta;
322
324 Eigen::MatrixXd total() const { return alpha + beta; }
325
327 Eigen::MatrixXd spin() const { return alpha - beta; }
328 };
329
335
341
345
349
350 // development path RKS vs UKS
351 void setForceUKSPath(bool force) { force_uks_path_ = force; }
352
353 private:
355
358 void Prepare(Orbitals& orb, Index numofelectrons = -1);
359
363
369 const Eigen::MatrixXd& H0, const Vxc_Potential<Vxc_Grid>& vxcpotential,
370 const Eigen::MatrixXd& alpha_new, const Eigen::MatrixXd& beta_new);
371 Eigen::MatrixXd RKSOrbitalHessian(const Vxc_Potential<Vxc_Grid>& vxc,
372 const tools::EigenSystem& mos,
373 const Eigen::MatrixXd& F,
374 const Eigen::MatrixXd& X);
375 Eigen::MatrixXd UKSOrbitalHessian(const Vxc_Potential<Vxc_Grid>& vxc,
376 const tools::EigenSystem& mos_alpha,
377 const tools::EigenSystem& mos_beta,
378 const Eigen::MatrixXd& F_alpha,
379 const Eigen::MatrixXd& F_beta,
380 const Eigen::MatrixXd& X);
381
382 std::vector<Eigen::MatrixXd> CoupledResponse(
383 const Vxc_Potential<Vxc_Grid>& vxc, const Eigen::MatrixXd& P0,
384 const Eigen::MatrixXd& C_occ, const Eigen::MatrixXd& C_virt,
385 const std::vector<Eigen::MatrixXd>& U,
386 const Vxc_Potential<Vxc_Grid>::FXCKernel* fxc_kernel = nullptr);
387
389 Eigen::MatrixXd OrthogonalizeGuess(const Eigen::MatrixXd& GuessMOs) const;
391 void PrintMOs(const Eigen::VectorXd& MOEnergies, Log::Level level);
393 void PrintMOsUKS(const Eigen::VectorXd& alpha_energies,
394 const Eigen::VectorXd& beta_energies,
395 Log::Level level) const;
397 void CalcElDipole(const Orbitals& orb) const;
398
401 std::array<Eigen::MatrixXd, 2> CalcERIs_EXX(const Eigen::MatrixXd& MOCoeff,
402 const Eigen::MatrixXd& Dmat,
403 double error) const;
404
406 Eigen::MatrixXd CalcERIs(const Eigen::MatrixXd& Dmat, double error) const;
407
411
413 bool EvaluateAndTime(Orbitals& orb);
415 void ReportDimensionsAndMemory() const;
416
418 void ConfigOrbfile(Orbitals& orb);
423 Eigen::MatrixXd McWeenyPurification(Eigen::MatrixXd& Dmat_in,
424 AOOverlap& overlap);
425
427 Mat_p_Energy SetupH0(const QMMolecule& mol) const;
431 const QMMolecule& mol,
432 const std::vector<std::unique_ptr<StaticSite> >& multipoles) const;
436 const Orbitals& extdensity) const;
438 Eigen::MatrixXd IntegrateExternalField(const QMMolecule& mol) const;
439
445 const Mat_p_Energy& H0, const QMMolecule& mol,
446 const Vxc_Potential<Vxc_Grid>& vxcpotential) const;
447
449 Eigen::MatrixXd AtomicGuess(const QMMolecule& mol) const;
450
452 Eigen::VectorXd BuildEHTOrbitalEnergies(const QMMolecule& mol) const;
454 Eigen::MatrixXd BuildEHTHamiltonian(const QMMolecule& mol) const;
461 const Mat_p_Energy& H0, const QMMolecule& mol,
462 const Vxc_Potential<Vxc_Grid>& vxcpotential) const;
463
474
487 Eigen::MatrixXd RunAtomicDFT_unrestricted(
488 const QMAtom& uniqueAtom, bool use_hunds_rule_occupation = false) const;
489
496 std::map<std::string, Eigen::MatrixXd> ComputeHirshfeldReferenceDensities(
497 const QMMolecule& mol) const;
498
504 std::vector<Index> atom_indices;
505 // Charge relative to the neutral fragment (sum of its nuclear charges);
506 // +1.0 means one electron removed. BuildCDFTConstraint converts it to an
507 // absolute electron count (CP2K's TARGET convention).
508 double target_charge = 0.0;
509 double initial_lambda = 0.0;
510 // "warmstart" (default) or "fresh", see dftpackage.xml. Kept as a string
511 // so that invalid values are rejected by the XML choices validation.
512 std::string guess_strategy = "warmstart";
513 };
514
521 const QMMolecule& mol, const CDFTConstraintSpec& spec) const;
522
524 double NuclearRepulsion(const QMMolecule& mol) const;
527 double ExternalRepulsion(
528 const QMMolecule& mol,
529 const std::vector<std::unique_ptr<StaticSite> >& multipoles) const;
532 Eigen::MatrixXd SphericalAverageShells(const Eigen::MatrixXd& dmat,
533 const AOBasis& dftbasis) const;
534
537 void TruncateBasis(Orbitals& orb, std::vector<Index>& activeatoms,
538 Mat_p_Energy& H0,
539 Eigen::MatrixXd InitialActiveDensityMatrix,
540 Eigen::MatrixXd v_embedding,
541 Eigen::MatrixXd InitialInactiveMOs);
542
545 void TruncMOsFullBasis(Orbitals& orb, std::vector<Index> activeatoms,
546 std::vector<Index> numfuncpatom);
549 Eigen::MatrixXd InsertZeroCols(Eigen::MatrixXd MOsMatrix, Index startidx,
550 Index numofzerocols);
552 Eigen::MatrixXd InsertZeroRows(Eigen::MatrixXd MOsMatrix, Index startidx,
553 Index numofzerorows);
554
556 bool EvaluateClosedShell(Orbitals& orb, const Mat_p_Energy& H0,
557 const Vxc_Potential<Vxc_Grid>& vxcpotential);
558
561 bool EvaluateUKS(Orbitals& orb, const Mat_p_Energy& H0,
562 const Vxc_Potential<Vxc_Grid>& vxcpotential);
563
586 void ComputeAndStoreForces(Orbitals& orb, const Eigen::MatrixXd& Dmat,
587 const Vxc_Potential<Vxc_Grid>& vxcpotential) const;
588
595 Eigen::MatrixXd ComputeOverlapPulayGradientUKS(
596 const QMMolecule& mol, const tools::EigenSystem& MOs_alpha,
597 const tools::EigenSystem& MOs_beta) const;
598
602 Eigen::MatrixXd ComputeNonXCGradientUKS(
603 const QMMolecule& mol, const UKSConvergenceAcc::SpinDensity& Dspin,
604 const tools::EigenSystem& MOs_alpha,
605 const tools::EigenSystem& MOs_beta) const;
606
620 Orbitals& orb, const UKSConvergenceAcc::SpinDensity& Dspin,
621 const tools::EigenSystem& MOs_alpha, const tools::EigenSystem& MOs_beta,
622 const Vxc_Potential<Vxc_Grid>& vxcpotential) const;
623
625
626 // basis sets
627 std::string auxbasis_name_;
628 std::string dftbasis_name_;
629 std::string ecp_name_;
633
635 // Pre-screening
637 // Eigenvalues of the AO overlap below this are removed from S^-1/2
638 // (xtpdft.overlap_tolerance).
640 // Shell pairs whose RI three-centre integrals are bounded by less than this
641 // are not stored (xtpdft.ri_pair_threshold).
642 double ri_pair_threshold_ = 1e-10;
643
644 // numerical integration Vxc
645 std::string grid_name_;
646
647 // AO Matrices
649
650 std::string initial_guess_;
651
652 // Only used if initial_guess_ == "dimer_guess", see
653 // BuildDimerGuessFromMonomerFiles.
656
657 // Convergence
661 // DIIS variables
663 // Electron repulsion integrals
665 // Wall-clock accounting, reported at the end of Evaluate()
667 bool warm_start_ = false;
668 bool warm_started_ = false;
670 std::string eris_key_; // key of the RI integrals in ERIs_
673 std::string RISetupKey() const;
676 bool UsableAsWarmStart(const Orbitals& orb, const std::string& previous_basis,
677 std::string& reason) const;
678
679 // external charges
680 std::vector<std::unique_ptr<StaticSite> >* externalsites_ = nullptr;
681
682 // exchange and correlation
683 double ScaHFX_ = 0.0;
685
687 // integrate external density
688 std::string orbfilename_;
689 std::string gridquality_;
690 std::string state_;
691
693 QMMolecule("molecule made of atoms participating in Active region", 1);
694
695 Eigen::Vector3d extfield_ = Eigen::Vector3d::Zero();
697 // xtpdft.polarizability: static polarizability after the SCF
699 Eigen::MatrixXd ext_potential_matrix_;
700
705
706 // truncation
707 Eigen::MatrixXd H0_trunc_;
709 Eigen::MatrixXd v_embedding_trunc_;
713 double E_nuc_;
715 std::vector<Index> active_and_border_atoms_;
716 std::vector<Index> numfuncpatom_;
717
718 // QMEwald
720 bool has_ewaldgrid_ = false;
722 // Spin-DFT Extension
729 bool force_uks_path_ = false;
730 // xtpdft.compute_forces: compute the nuclear gradient after the SCF.
731 // Off by default because of its cost (one-electron and overlap
732 // derivatives, RI-J, XC and, for hybrids, RI-K gradients).
733 bool compute_forces_ = false;
734
735 // CDFT constraints added to the UKS Fock matrix; empty (no-op) for
736 // ordinary runs. Set by RunCDFT, which updates each lambda between
737 // warm-started EvaluateUKS calls.
738 std::vector<HirshfeldPartition::Constraint> constraints_;
739
740 // CDFT outer-loop control, used only by RunCDFT. Read from
741 // cdft.max_iterations/cdft.population_tolerance in Initialize() if
742 // cdft.enabled; the defaults apply when RunCDFT is called directly.
745
746 bool cdft_enabled_ = false;
748};
749
750} // namespace xtp
751} // namespace votca
752
753#endif // VOTCA_XTP_DFTENGINE_H
class to manage program options with xml serialization functionality
Definition property.h:55
Container to hold Basisfunctions for all atoms.
Definition aobasis.h:42
Electronic ground-state via Density-Functional Theory.
Definition dftengine.h:89
Eigen::MatrixXd CalcERIs(const Eigen::MatrixXd &Dmat, double error) const
Build the Coulomb matrix contribution from the current density matrix.
Definition dftengine.cc:739
void setWarmStart(bool warm_start)
Definition dftengine.h:120
Eigen::MatrixXd ComputeOverlapPulayGradientUKS(const QMMolecule &mol, const tools::EigenSystem &MOs_alpha, const tools::EigenSystem &MOs_beta) const
Definition dftengine.cc:550
void setExternalcharges(std::vector< std::unique_ptr< StaticSite > > *externalsites)
Definition dftengine.h:99
bool EvaluateTruncatedActiveRegion(Orbitals &trunc_orb)
ActiveRegion::Options active_growth_
Definition dftengine.h:702
std::string auxbasis_name_
Definition dftengine.h:627
std::string getDFTBasisName() const
Return the configured AO basis-set name for the DFT calculation.
Definition dftengine.h:162
std::string gridquality_
Definition dftengine.h:689
tools::EigenSystem ModelPotentialGuess(const Mat_p_Energy &H0, const QMMolecule &mol, const Vxc_Potential< Vxc_Grid > &vxcpotential) const
Definition dftengine.cc:796
Mat_p_Energy IntegrateExternalMultipoles(const QMMolecule &mol, const std::vector< std::unique_ptr< StaticSite > > &multipoles) const
void setEwaldgrid(const Vxc_Grid &ewaldgrid)
Definition dftengine.h:104
friend class DFTEngineTestAccess
Definition dftengine.h:354
tools::EigenSystem IndependentElectronGuess(const Mat_p_Energy &H0) const
Generate an initial guess by diagonalizing the core Hamiltonian only.
Definition dftengine.cc:785
void setSCFToleranceFloor(double energy, double error)
Eigen::MatrixXd InitialActiveDmat_trunc_
Definition dftengine.h:708
std::string eris_key_
Definition dftengine.h:670
void TruncMOsFullBasis(Orbitals &orb, std::vector< Index > activeatoms, std::vector< Index > numfuncpatom)
Orbitals BuildDimerGuessFromMonomerFiles(const QMMolecule &dimer_mol) const
void ComputePolarizability(Orbitals &orb)
Definition dftengine.cc:844
double cdft_population_tolerance_
Definition dftengine.h:744
Eigen::MatrixXd ext_potential_matrix_
Definition dftengine.h:699
void ComputeAndStoreForces(Orbitals &orb, const Eigen::MatrixXd &Dmat, const Vxc_Potential< Vxc_Grid > &vxcpotential) const
Definition dftengine.cc:397
bool EvaluateClosedShell(Orbitals &orb, const Mat_p_Energy &H0, const Vxc_Potential< Vxc_Grid > &vxcpotential)
Run the restricted closed-shell SCF loop and store the converged result.
void setLogger(Logger *pLog)
Attach the logger used for SCF progress and diagnostics.
Definition dftengine.h:95
void TruncateBasis(Orbitals &orb, std::vector< Index > &activeatoms, Mat_p_Energy &H0, Eigen::MatrixXd InitialActiveDensityMatrix, Eigen::MatrixXd v_embedding, Eigen::MatrixXd InitialInactiveMOs)
void PrintMOsUKS(const Eigen::VectorXd &alpha_energies, const Eigen::VectorXd &beta_energies, Log::Level level) const
Print separate alpha and beta orbital energies for a UKS calculation.
Definition dftengine.cc:313
void ReportDimensionsAndMemory() const
Basis dimensions and the memory of the large intermediates.
Definition dftengine.cc:750
std::string dftbasis_name_
Definition dftengine.h:628
DFTSetupCache * setup_cache_
Definition dftengine.h:669
bool EvaluateUKS(Orbitals &orb, const Mat_p_Energy &H0, const Vxc_Potential< Vxc_Grid > &vxcpotential)
Eigen::MatrixXd RunAtomicDFT_unrestricted(const QMAtom &uniqueAtom, bool use_hunds_rule_occupation=false) const
Mat_p_Energy IntegrateExternalDensity(const QMMolecule &mol, const Orbitals &extdensity) const
Eigen::MatrixXd RelaxedDensityMatrix(const Orbitals &orb, const QMState &state, const tools::Property &gwbse, bool qp_response=true)
std::vector< Eigen::MatrixXd > CoupledResponse(const Vxc_Potential< Vxc_Grid > &vxc, const Eigen::MatrixXd &P0, const Eigen::MatrixXd &C_occ, const Eigen::MatrixXd &C_virt, const std::vector< Eigen::MatrixXd > &U, const Vxc_Potential< Vxc_Grid >::FXCKernel *fxc_kernel=nullptr)
std::string ecp_name_
Definition dftengine.h:629
std::string grid_name_
Definition dftengine.h:645
bool EvaluateActiveRegion(Orbitals &orb)
void Prepare(Orbitals &orb, Index numofelectrons=-1)
Vxc_Grid external_ewaldgrid_
Definition dftengine.h:719
std::string initial_guess_
Definition dftengine.h:650
std::string orbfilename_
Definition dftengine.h:688
UKSConvergenceAcc::SpinFock BuildUKSFock(const Eigen::MatrixXd &H0, const Vxc_Potential< Vxc_Grid > &vxcpotential, const Eigen::MatrixXd &alpha_new, const Eigen::MatrixXd &beta_new)
static BSEGradientInput QPGradientInputFromOrbitals(const Orbitals &orb, const std::vector< Index > &levels)
Eigen::MatrixXd AtomicGuess(const QMMolecule &mol) const
Build an atomic-density based initial guess in the AO basis.
bool EvaluateAndTime(Orbitals &orb)
Evaluate() without the timing report.
Definition dftengine.cc:876
std::vector< HirshfeldPartition::AtomicReference > HirshfeldReferences(const QMMolecule &mol) const
Eigen::MatrixXd InsertZeroRows(Eigen::MatrixXd MOsMatrix, Index startidx, Index numofzerorows)
Insert zero rows into an MO coefficient matrix at the requested position.
Eigen::MatrixXd BuildEHTHamiltonian(const QMMolecule &mol) const
Build the extended-Hückel Hamiltonian for the current molecule.
Eigen::MatrixXd IntegrateExternalField(const QMMolecule &mol) const
Integrate a homogeneous external electric field into the AO basis.
void setExternalPotentialMatrix(const Eigen::MatrixXd &v)
Definition dftengine.h:309
Eigen::Vector3d extfield_
Definition dftengine.h:695
std::array< Eigen::MatrixXd, 2 > CalcERIs_EXX(const Eigen::MatrixXd &MOCoeff, const Eigen::MatrixXd &Dmat, double error) const
Definition dftengine.cc:713
Eigen::MatrixXd UKSOrbitalHessian(const Vxc_Potential< Vxc_Grid > &vxc, const tools::EigenSystem &mos_alpha, const tools::EigenSystem &mos_beta, const Eigen::MatrixXd &F_alpha, const Eigen::MatrixXd &F_beta, const Eigen::MatrixXd &X)
Eigen::MatrixXd H0_trunc_
Definition dftengine.h:707
Index NumberOfRestrictedOccupiedOrbitals() const
Definition dftengine.h:338
HirshfeldPartition::Constraint BuildCDFTConstraint(const QMMolecule &mol, const CDFTConstraintSpec &spec) const
void Initialize(tools::Property &options)
Read DFT, grid, and SCF settings from the user options tree.
Definition dftengine.cc:99
BSEGradientResult BSEExcitationGradient(const Orbitals &orb, const BSEGradientInput &input)
const std::string & getGridName() const
Name of the integration grid of the SCF (xtpdft.integration_grid).
Definition dftengine.h:301
std::string xc_functional_name_
Definition dftengine.h:684
void CalcElDipole(const Orbitals &orb) const
Evaluate and print the electronic dipole moment from the final density.
Definition dftengine.cc:373
double ExternalRepulsion(const QMMolecule &mol, const std::vector< std::unique_ptr< StaticSite > > &multipoles) const
ConvergenceAcc::options conv_opt_
Definition dftengine.h:660
void SetupInvariantMatrices()
Precompute AO matrices that remain unchanged throughout the SCF procedure.
tools::EigenSystem ExtendedHuckelDFTGuess(const Mat_p_Energy &H0, const QMMolecule &mol, const Vxc_Potential< Vxc_Grid > &vxcpotential) const
static BSEGradientInput BSEGradientInputFromOrbitals(const Orbitals &orb, bool singlet, Index index)
std::map< std::string, Eigen::MatrixXd > ComputeHirshfeldReferenceDensities(const QMMolecule &mol) const
std::string active_atoms_as_string_
Definition dftengine.h:701
void ComputeAndStoreForcesUKS(Orbitals &orb, const UKSConvergenceAcc::SpinDensity &Dspin, const tools::EigenSystem &MOs_alpha, const tools::EigenSystem &MOs_beta, const Vxc_Potential< Vxc_Grid > &vxcpotential) const
Definition dftengine.cc:626
static bool ConfigureQPResponse(BSEGradientInput &input, const Orbitals &orb, const tools::Property &gwbse, Logger *log)
void ConfigOrbfile(Orbitals &orb)
Propagate basis-set, XC, and metadata settings into the orbital container.
Eigen::VectorXd BuildEHTOrbitalEnergies(const QMMolecule &mol) const
Build orbital energies used in the extended-Hückel starting guess.
std::vector< Eigen::MatrixXd > StaticResponse(const Orbitals &orb, const std::vector< Eigen::MatrixXd > &perturbations, double tolerance=1e-7, Index max_iterations=100)
std::vector< HirshfeldPartition::Constraint > constraints_
Definition dftengine.h:738
QMMolecule activemol_
Definition dftengine.h:692
bool UsableAsWarmStart(const Orbitals &orb, const std::string &previous_basis, std::string &reason) const
Definition dftengine.cc:996
void PrintMOs(const Eigen::VectorXd &MOEnergies, Log::Level level)
Print a one-spin list of orbital energies and occupations to the logger.
Definition dftengine.cc:293
Eigen::MatrixXd RKSOrbitalHessian(const Vxc_Potential< Vxc_Grid > &vxc, const tools::EigenSystem &mos, const Eigen::MatrixXd &F, const Eigen::MatrixXd &X)
void setForceUKSPath(bool force)
Definition dftengine.h:351
std::vector< Index > numfuncpatom_
Definition dftengine.h:716
AOOverlap dftAOoverlap_
Definition dftengine.h:648
std::vector< Index > active_and_border_atoms_
Definition dftengine.h:715
void setEwaldNuclearEnergy(double energy)
Definition dftengine.h:114
Mat_p_Energy SetupH0(const QMMolecule &mol) const
Assemble the one-electron core Hamiltonian for the current molecule.
tools::EigenSystem ExtendedHuckelGuess(const QMMolecule &mol) const
bool IsRestrictedOpenShell() const
Definition dftengine.h:332
Eigen::MatrixXd OrthogonalizeGuess(const Eigen::MatrixXd &GuessMOs) const
Orthonormalize an initial MO guess with respect to the AO overlap matrix.
Eigen::MatrixXd v_embedding_trunc_
Definition dftengine.h:709
Eigen::MatrixXd SphericalAverageShells(const Eigen::MatrixXd &dmat, const AOBasis &dftbasis) const
ConvergenceAcc::options BuildConvergenceOptions() const
bool Evaluate(Orbitals &orb)
Definition dftengine.cc:823
CDFTConstraintSpec cdft_constraint_spec_
Definition dftengine.h:747
Eigen::MatrixXd ComputeNonXCGradientUKS(const QMMolecule &mol, const UKSConvergenceAcc::SpinDensity &Dspin, const tools::EigenSystem &MOs_alpha, const tools::EigenSystem &MOs_beta) const
Definition dftengine.cc:583
bool RunCDFT(Orbitals &orb, HirshfeldPartition::Constraint &constraint)
std::string dimer_guess_orbB_name_
Definition dftengine.h:655
SpinDensity BuildSpinDensity(const tools::EigenSystem &MOs) const
std::vector< std::unique_ptr< StaticSite > > * externalsites_
Definition dftengine.h:680
Eigen::MatrixXd McWeenyPurification(Eigen::MatrixXd &Dmat_in, AOOverlap &overlap)
void setSetupCache(DFTSetupCache *cache)
Definition dftengine.h:125
Vxc_Potential< Vxc_Grid > SetupVxc(const QMMolecule &mol)
std::string RISetupKey() const
double NuclearRepulsion(const QMMolecule &mol) const
Compute the classical nucleus-nucleus repulsion energy.
ConvergenceAcc conv_accelerator_
Definition dftengine.h:662
Eigen::MatrixXd InsertZeroCols(Eigen::MatrixXd MOsMatrix, Index startidx, Index numofzerocols)
std::string dimer_guess_orbA_name_
Definition dftengine.h:654
Wall-clock accounting for the parts of a DFT run.
Definition dfttimings.h:45
Container to hold ECPs for all atoms.
Definition ecpaobasis.h:43
Takes a density matrix and and an auxiliary basis set and calculates the electron repulsion integrals...
Definition ERIs.h:35
Logger is used for thread-safe output of messages.
Definition logger.h:164
Container for molecular orbitals and derived one-particle data.
Definition orbitals.h:47
container for QM atoms
Definition qmatom.h:37
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
Definition qmstate.h:135
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
Level
be loud and noisy
Definition globals.h:28
Eigen::VectorXd energies_rpa
energies of the levels rpamin..rpamax in the static RPA screening
Definition dftengine.h:202
Eigen::VectorXd qp_energies
QP energies of qpmin..qpmax (must equal energies_bse there).
Definition dftengine.h:215
double qp_rebuild_error
with qp_response: max |E - rebuilt QP energy| over the QP window
Definition dftengine.h:247
double omega
X^T H X from the rebuilt BSE Hamiltonian (equals the BSE eigenvalue).
Definition dftengine.h:232
double rpa_rebuild_error
with qp_selfconsistent: max |R - rebuilt RPA energy|
Definition dftengine.h:249
std::vector< Eigen::MatrixXd > qp_gradients
for qp_levels: dE_p/dR per level (natoms x 3 each), Hartree/Bohr
Definition dftengine.h:237
std::vector< Eigen::MatrixXd > qp_relaxed_densities
for qp_levels: the same per level, dE_p/dlambda = Tr(h' P_p)
Definition dftengine.h:245
Eigen::MatrixXd spin() const
Return the spin density P^alpha - P^beta.
Definition dftengine.h:327
Eigen::MatrixXd total() const
Return the total density P = P^alpha + P^beta.
Definition dftengine.h:324
Parts of the DFT setup that stay the same between runs on the same molecule with the same basis sets,...
Definition dftengine.h:56
std::string multipole_key
Definition dftengine.h:64
Eigen::MatrixXd multipole_sites
Definition dftengine.h:65
Eigen::MatrixXd multipole_matrix
Definition dftengine.h:66
Eigen::MatrixXd ewald_matrix
Definition dftengine.h:61