votca 2026-dev
Loading...
Searching...
No Matches
inactivescreening.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2026 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_INACTIVESCREENING_H
22#define VOTCA_XTP_INACTIVESCREENING_H
23
24// Standard includes
25#include <string>
26#include <vector>
27
28// Local VOTCA includes
29#include "aobasis.h"
30#include "eigen.h"
31#include "orbitals.h"
32#include "threecenter.h"
33
34namespace votca {
35namespace xtp {
36
51 Eigen::MatrixXd occupied; // AO x n_inactive
52 Eigen::VectorXd occupied_energies;
53 Eigen::MatrixXd virtuals; // AO x n_virtual
54 Eigen::VectorXd virtual_energies;
55 // max |Q^2 - Q| of the projector of the inactive density onto the
56 // occupied space; 0 if the inactive density is made of occupied orbitals
57 double idempotency_error = 0.0;
58
59 Index size() const { return occupied.cols(); }
60 bool empty() const { return occupied.cols() == 0; }
61};
62
78 enum class Mode { None, Block, Exact };
80 Eigen::MatrixXd occupied;
81 Eigen::VectorXd occupied_energies;
82 Eigen::MatrixXd virtuals;
83 Eigen::VectorXd virtual_energies;
85 double idempotency_error = 0.0;
86 // block mode with a spatial cutoff: inactive orbitals left out
88 double radius = 0.0; // bohr; 0: all
89 // complete G: the inactive occupied orbitals (semicanonical) also enter
90 // the self-energy; they are put in front of the active ones
91 // (InactiveScreening::CompleteGOrbitals) and excluded from the RPA
92 bool complete_g = false;
93 Eigen::MatrixXd inactive_occupied;
94 Eigen::VectorXd inactive_energies;
95
96 bool empty() const { return mode == Mode::None; }
97 static Mode Parse(const std::string& name);
98 static std::string Name(Mode mode);
99};
100
119 public:
128 static InactiveSpace BuildSpace(const Orbitals& full, Index ncore = 0);
129
140 static Eigen::MatrixXd Response(
141 const AOBasis& auxbasis, const AOBasis& dftbasis,
142 const Eigen::MatrixXd& occupied, const Eigen::VectorXd& occupied_energies,
143 const Eigen::MatrixXd& virtuals, const Eigen::VectorXd& virtual_energies,
144 double chunk_bytes = 4e9, double imaginary_frequency = 0.0);
145
149 static std::vector<Eigen::MatrixXd> Responses(
150 const AOBasis& auxbasis, const AOBasis& dftbasis,
151 const Eigen::MatrixXd& occupied, const Eigen::VectorXd& occupied_energies,
152 const Eigen::MatrixXd& virtuals, const Eigen::VectorXd& virtual_energies,
153 double chunk_bytes, const std::vector<double>& imaginary_frequencies,
154 const Eigen::MatrixXd& inv_sqrt = Eigen::MatrixXd());
155
156 static Eigen::MatrixXd Response(const AOBasis& auxbasis,
157 const AOBasis& dftbasis,
158 const InactiveSpace& space,
159 double chunk_bytes = 4e9,
160 double imaginary_frequency = 0.0) {
161 return Response(auxbasis, dftbasis, space.occupied, space.occupied_energies,
162 space.virtuals, space.virtual_energies, chunk_bytes,
163 imaginary_frequency);
164 }
165
171 static InactiveScreeningInput Prepare(const Orbitals& full,
173 bool complete_g = false,
174 double radius = 0.0);
175
185 static InactiveSpace NearSpace(const Orbitals& full, double radius,
186 Index& n_far);
187
196 const tools::EigenSystem& embedded, Index n_active_occupied,
197 const InactiveScreeningInput& input);
198
206 static Eigen::MatrixXd Kernel(const AOBasis& auxbasis,
207 const AOBasis& dftbasis,
208 const InactiveScreeningInput& input,
209 const tools::EigenSystem& embedded, Index homo,
210 double chunk_bytes,
211 double imaginary_frequency = 0.0,
212 Index first_active = 0);
213
227 static std::vector<Eigen::MatrixXd> Kernels(
228 const AOBasis& auxbasis, const AOBasis& dftbasis,
229 const InactiveScreeningInput& input, const TCMatrix_gwbse& active,
230 const Eigen::VectorXd& rpa_energies, Index homo, Index rpamin,
231 Index rpamax, double chunk_bytes,
232 const std::vector<double>& imaginary_frequencies,
233 double virtual_cutoff = 0.0);
234
247 struct PoleFit {
248 Eigen::VectorXd energies;
249 Eigen::MatrixXd vectors; // aux x poles
250 Index dropped = 0; // directions of Y(0) below the tolerance
251 Index clipped = 0; // modes with l outside (0, 1)
252 };
253 static PoleFit FitPoles(const Eigen::MatrixXd& Y0, const Eigen::MatrixXd& Yi,
254 double w_i, double tolerance = 1e-10);
255
260 static Eigen::MatrixXd ReactionField(
261 const Eigen::MatrixXd& Y,
262 const Eigen::MatrixXd& R_env = Eigen::MatrixXd());
263};
264
265} // namespace xtp
266} // namespace votca
267
268#endif // VOTCA_XTP_INACTIVESCREENING_H
Container to hold Basisfunctions for all atoms.
Definition aobasis.h:42
Static screening by the inactive region of a PbE calculation.
static Eigen::MatrixXd ReactionField(const Eigen::MatrixXd &Y, const Eigen::MatrixXd &R_env=Eigen::MatrixXd())
The reaction field R with 1 + R = ((1 + R_env)^-1 + Y)^-1; without an environment (R_env empty) R = (...
static Eigen::MatrixXd Response(const AOBasis &auxbasis, const AOBasis &dftbasis, const InactiveSpace &space, double chunk_bytes=4e9, double imaginary_frequency=0.0)
static PoleFit FitPoles(const Eigen::MatrixXd &Y0, const Eigen::MatrixXd &Yi, double w_i, double tolerance=1e-10)
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 Eigen::MatrixXd Kernel(const AOBasis &auxbasis, const AOBasis &dftbasis, const InactiveScreeningInput &input, const tools::EigenSystem &embedded, Index homo, double chunk_bytes, double imaginary_frequency=0.0, Index first_active=0)
Y, the response of the inactive region: X_B (block) or X_full - X_A (exact), static or at an imaginar...
static std::vector< Eigen::MatrixXd > Kernels(const AOBasis &auxbasis, const AOBasis &dftbasis, const InactiveScreeningInput &input, const TCMatrix_gwbse &active, const Eigen::VectorXd &rpa_energies, Index homo, Index rpamin, Index rpamax, double chunk_bytes, const std::vector< double > &imaginary_frequencies, double virtual_cutoff=0.0)
Y at several imaginary frequencies, as GWBSE uses it: one integral pass for the full (exact) or inact...
static std::vector< Eigen::MatrixXd > Responses(const AOBasis &auxbasis, const AOBasis &dftbasis, const Eigen::MatrixXd &occupied, const Eigen::VectorXd &occupied_energies, const Eigen::MatrixXd &virtuals, const Eigen::VectorXd &virtual_energies, double chunk_bytes, const std::vector< double > &imaginary_frequencies, const Eigen::MatrixXd &inv_sqrt=Eigen::MatrixXd())
static InactiveSpace BuildSpace(const Orbitals &full, Index ncore=0)
The inactive space from the full reference orbitals and the inactive density stored by DFTEngine::Eva...
static Eigen::MatrixXd Response(const AOBasis &auxbasis, const AOBasis &dftbasis, const Eigen::MatrixXd &occupied, const Eigen::VectorXd &occupied_energies, const Eigen::MatrixXd &virtuals, const Eigen::VectorXd &virtual_energies, double chunk_bytes=4e9, double imaginary_frequency=0.0)
X = sum_ia 4/(e_a - e_i) M_ia M_ia^T over the given occupied and virtual orbitals,...
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)...
static InactiveSpace NearSpace(const Orbitals &full, double radius, Index &n_far)
Block mode with a spatial cutoff: the inactive LMOs whose charge centroid lies within radius (bohr) o...
Container for molecular orbitals and derived one-particle data.
Definition orbitals.h:47
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
What GWBSE needs to add the static screening of the inactive region: the mode and the orbitals of the...
static Mode Parse(const std::string &name)
static std::string Name(Mode mode)
Poles in the form of transitions that reproduce a response at zero and at one imaginary frequency: Y(...
Occupied orbitals of the inactive region of a projection-based embedding, with the virtual space they...
Eigen::VectorXd occupied_energies