votca 2026-dev
Loading...
Searching...
No Matches
chargeresponsefit.cc
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// Standard includes
21#include <exception>
22#include <sstream>
23#include <stdexcept>
24
25// VOTCA includes
27
28// Local VOTCA includes
29#include "votca/xtp/aomatrix.h"
30#include "votca/xtp/basisset.h"
32#include "votca/xtp/dftengine.h"
34#include "votca/xtp/logger.h"
35#include "votca/xtp/orbitals.h"
36
37namespace votca {
38namespace xtp {
39
40namespace {
41// relative size below which an atom's Hirshfeld weights in a grid box are
42// dropped from its weight matrix (see WeightMatrices)
43constexpr double kWeightCutoff = 1e-14;
44
45// Hirshfeld weights of all atoms at a point (rows: atoms), zero where the
46// promolecule density is negligible (as HirshfeldPartition::EvaluateWeight)
47Eigen::VectorXd Weights(
48 const std::vector<HirshfeldPartition::AtomicReference>& atoms,
49 const Eigen::Vector3d& point) {
50 Eigen::VectorXd rho(Index(atoms.size()));
51 for (Index j = 0; j < rho.size(); ++j) {
53 atoms[std::size_t(j)].basis, atoms[std::size_t(j)].density, point);
54 }
55 const double denominator = rho.sum();
56 constexpr double kNegligibleDenominator = 1.e-12;
57 if (denominator < kNegligibleDenominator) {
58 return Eigen::VectorXd::Zero(rho.size());
59 }
60 return rho / denominator;
61}
62} // namespace
63
64std::vector<Eigen::MatrixXd> ChargeResponseFit::WeightMatrices(
65 const std::vector<HirshfeldPartition::AtomicReference>& atoms,
66 const AOBasis& basis, const Vxc_Grid& grid) {
67 const Index n_atoms = Index(atoms.size());
68 const Index n_ao = basis.AOBasisSize();
69 std::vector<Eigen::MatrixXd> W(std::size_t(n_atoms),
70 Eigen::MatrixXd::Zero(n_ao, n_ao));
71 std::vector<Eigen::MatrixXd*> targets;
72 for (Eigen::MatrixXd& m : W) {
73 targets.push_back(&m);
74 }
75 // one lock per atom matrix, or thread-local copies (no single critical
76 // section around all n_atoms scatter-adds of every box)
77 GridBoxAccumulator acc(targets);
78 std::exception_ptr eptr = nullptr;
79#pragma omp parallel for schedule(guided)
80 for (Index i = 0; i < grid.getBoxesSize(); ++i) {
81 try {
82 const GridBox& box = grid[i];
83 if (!box.Matrixsize()) {
84 continue;
85 }
86 const std::vector<Eigen::Vector3d>& points = box.getGridPoints();
87 const std::vector<double>& weights = box.getGridWeights();
88 const Index n_points = Index(points.size());
89 Eigen::MatrixXd ao(box.Matrixsize(), n_points);
90 Eigen::MatrixXd w(n_points, n_atoms);
91 for (Index p = 0; p < n_points; ++p) {
92 ao.col(p) = box.CalcAOValues(points[std::size_t(p)]).values;
93 w.row(p) = weights[std::size_t(p)] *
94 Weights(atoms, points[std::size_t(p)]).transpose();
95 }
96 // Hirshfeld weights decay exponentially with the distance to their
97 // atom: an atom whose weighted share in this box is below
98 // kWeightCutoff of the box's largest grid weight contributes nothing
99 // measurable (checked by max |sum_k W_k - S| in Fit)
100 const double wmax =
101 Eigen::Map<const Eigen::VectorXd>(weights.data(), n_points)
102 .cwiseAbs()
103 .maxCoeff();
104 std::vector<Eigen::MatrixXd> local(static_cast<std::size_t>(n_atoms));
105 for (Index k = 0; k < n_atoms; ++k) {
106 if (w.col(k).cwiseAbs().maxCoeff() <= kWeightCutoff * wmax) {
107 continue;
108 }
109 local[std::size_t(k)].noalias() =
110 ao * w.col(k).asDiagonal() * ao.transpose();
111 }
112 std::vector<const Eigen::MatrixXd*> blocks;
113 for (const Eigen::MatrixXd& m : local) {
114 blocks.push_back(&m);
115 }
116 acc.Add(box, blocks);
117 } catch (...) {
118#pragma omp critical
119 {
120 if (!eptr) {
121 eptr = std::current_exception();
122 }
123 }
124 }
125 }
126 if (eptr) {
127 std::rethrow_exception(eptr);
128 }
129 acc.Finish();
130 for (Eigen::MatrixXd& m : W) {
131 m = 0.5 * (m + m.transpose()).eval();
132 }
133 return W;
134}
135
136std::vector<Eigen::Matrix3d> ChargeResponseFit::AtomicPolarizabilities(
137 const std::vector<HirshfeldPartition::AtomicReference>& atoms,
138 const std::vector<Eigen::Vector3d>& positions, const AOBasis& basis,
139 const Vxc_Grid& grid, const std::array<Eigen::MatrixXd, 3>& dP_field) {
140 const Index n_atoms = Index(atoms.size());
141 if (Index(positions.size()) != n_atoms) {
142 throw std::runtime_error(
143 "ChargeResponseFit: positions and Hirshfeld references differ in "
144 "size");
145 }
146 for (const Eigen::MatrixXd& m : dP_field) {
147 if (m.rows() != basis.AOBasisSize() || m.cols() != basis.AOBasisSize()) {
148 throw std::runtime_error(
149 "ChargeResponseFit: density response does not match the basis");
150 }
151 }
152 std::vector<Eigen::Matrix3d> alpha(std::size_t(n_atoms),
153 Eigen::Matrix3d::Zero());
154 std::exception_ptr eptr = nullptr;
155#pragma omp parallel for schedule(guided)
156 for (Index i = 0; i < grid.getBoxesSize(); ++i) {
157 try {
158 const GridBox& box = grid[i];
159 if (!box.Matrixsize()) {
160 continue;
161 }
162 std::array<Eigen::MatrixXd, 3> dP_box;
163 for (Index c = 0; c < 3; ++c) {
164 dP_box[std::size_t(c)] =
165 box.ReadFromBigMatrix(dP_field[std::size_t(c)]);
166 }
167 const std::vector<Eigen::Vector3d>& points = box.getGridPoints();
168 const std::vector<double>& weights = box.getGridWeights();
169 std::vector<Eigen::Matrix3d> local(std::size_t(n_atoms),
170 Eigen::Matrix3d::Zero());
171 for (std::size_t p = 0; p < points.size(); ++p) {
172 const Eigen::VectorXd w = Weights(atoms, points[p]);
173 if (w.cwiseAbs().maxCoeff() == 0.0) {
174 continue;
175 }
176 const Eigen::VectorXd ao = box.CalcAOValues(points[p]).values;
177 Eigen::Vector3d rho;
178 for (Index c = 0; c < 3; ++c) {
179 rho(c) = ao.dot(dP_box[std::size_t(c)] * ao);
180 }
181 for (Index k = 0; k < n_atoms; ++k) {
182 const Eigen::Vector3d d = points[p] - positions[std::size_t(k)];
183 local[std::size_t(k)] -= (weights[p] * w(k)) * d * rho.transpose();
184 }
185 }
186#pragma omp critical
187 {
188 for (Index k = 0; k < n_atoms; ++k) {
189 alpha[std::size_t(k)] += local[std::size_t(k)];
190 }
191 }
192 } catch (...) {
193#pragma omp critical
194 {
195 if (!eptr) {
196 eptr = std::current_exception();
197 }
198 }
199 }
200 }
201 if (eptr) {
202 std::rethrow_exception(eptr);
203 }
204 return alpha;
205}
206
208 const std::vector<Eigen::Vector3d>& positions,
209 const std::vector<Eigen::MatrixXd>& W,
210 const std::vector<Eigen::MatrixXd>& dP_potential,
211 const std::array<Eigen::MatrixXd, 3>& dipole,
212 const std::array<Eigen::MatrixXd, 3>& dP_field,
213 const std::vector<Eigen::Matrix3d>& alpha_atoms) {
214 const Index n = Index(positions.size());
215 if (Index(W.size()) != n || Index(dP_potential.size()) != n ||
216 Index(alpha_atoms.size()) != n || n < 2) {
217 throw std::runtime_error(
218 "ChargeResponseFit::Analyse: inconsistent number of atoms");
219 }
220 Result r;
221 Eigen::MatrixXd pi(n, n);
222 for (Index j = 0; j < n; ++j) {
223 for (Index k = 0; k < n; ++k) {
224 pi(j, k) =
225 -W[std::size_t(j)].cwiseProduct(dP_potential[std::size_t(k)]).sum();
226 }
227 }
228 r.pi_asymmetry = (pi - pi.transpose()).norm() / pi.norm();
229 const Eigen::MatrixXd projector =
230 Eigen::MatrixXd::Identity(n, n) -
231 Eigen::MatrixXd::Constant(n, n, 1.0 / double(n));
232 r.pi = projector * (0.5 * (pi + pi.transpose())) * projector;
233 r.pi = 0.5 * (r.pi + r.pi.transpose()).eval();
234 Eigen::SelfAdjointEigenSolver<Eigen::MatrixXd> es(r.pi,
235 Eigen::EigenvaluesOnly);
236 r.pi_eigenvalues = es.eigenvalues();
237 if (r.pi_eigenvalues(0) < -1e-6 * r.pi_eigenvalues(n - 1)) {
238 std::stringstream message;
239 message << "ChargeResponseFit: Pi is not positive semidefinite (lowest "
240 "eigenvalue "
241 << r.pi_eigenvalues(0)
242 << "); tighten the SCF convergence or change the step";
243 throw std::runtime_error(message.str());
244 }
245
246 for (Index a = 0; a < 3; ++a) {
247 for (Index c = 0; c < 3; ++c) {
248 r.alpha(a, c) =
249 -dipole[std::size_t(a)].cwiseProduct(dP_field[std::size_t(c)]).sum();
250 }
251 }
252 r.alpha = 0.5 * (r.alpha + r.alpha.transpose()).eval();
253
254 Eigen::MatrixX3d X(n, 3);
255 for (Index k = 0; k < n; ++k) {
256 X.row(k) = positions[std::size_t(k)].transpose();
257 }
258 X.rowwise() -= X.colwise().mean();
259 r.alpha_ct = X.transpose() * r.pi * X;
260 r.alpha_res = r.alpha - r.alpha_ct;
261 Eigen::SelfAdjointEigenSolver<Eigen::Matrix3d> eres(r.alpha_res,
262 Eigen::EigenvaluesOnly);
263 if (eres.eigenvalues()(0) <= 0.0) {
264 std::stringstream message;
265 message << "ChargeResponseFit: alpha - X^T Pi X is not positive definite "
266 "(eigenvalues "
267 << eres.eigenvalues().transpose()
268 << " bohr^3); the charge response over-polarizes";
269 throw std::runtime_error(message.str());
270 }
271
272 r.alpha_atoms = alpha_atoms;
273 r.res_weights.resize(n);
274 for (Index k = 0; k < n; ++k) {
275 r.res_weights(k) = std::max(alpha_atoms[std::size_t(k)].trace(), 0.0);
276 }
277 if (!(r.res_weights.sum() > 0.0)) {
278 throw std::runtime_error(
279 "ChargeResponseFit: no positive Hirshfeld atomic polarizability");
280 }
281 r.res_weights /= r.res_weights.sum();
282 for (Index k = 0; k < n; ++k) {
283 r.alpha_res_atoms.push_back(r.res_weights(k) * r.alpha_res);
284 }
285 return r;
286}
287
289 const QMMolecule& mol, const AOBasis& basis, double tol) {
290 Inversion inv;
291 const Index n = mol.size();
292 Eigen::Vector3d centre = Eigen::Vector3d::Zero();
293 for (const QMAtom& atom : mol) {
294 centre += atom.getPos();
295 }
296 centre /= double(n);
297 std::vector<Index> map(static_cast<std::size_t>(n), -1);
298 for (Index k = 0; k < n; ++k) {
299 const Eigen::Vector3d image = 2.0 * centre - mol[k].getPos();
300 for (Index j = 0; j < n; ++j) {
301 if ((mol[j].getPos() - image).norm() < tol &&
302 mol[j].getElement() == mol[k].getElement()) {
303 map[std::size_t(k)] = j;
304 break;
305 }
306 }
307 if (map[std::size_t(k)] < 0) {
308 return inv;
309 }
310 }
311 const Index n_ao = basis.AOBasisSize();
312 Eigen::MatrixXd T = Eigen::MatrixXd::Zero(n_ao, n_ao);
313 for (Index k = 0; k < n; ++k) {
314 const std::vector<const AOShell*> from = basis.getShellsofAtom(k);
315 const std::vector<const AOShell*> to =
316 basis.getShellsofAtom(map[std::size_t(k)]);
317 if (from.size() != to.size()) {
318 return inv;
319 }
320 for (std::size_t s = 0; s < from.size(); ++s) {
321 if (from[s]->getL() != to[s]->getL()) {
322 return inv;
323 }
324 const double parity = (Index(from[s]->getL()) % 2 == 0) ? 1.0 : -1.0;
325 for (Index f = 0; f < from[s]->getNumFunc(); ++f) {
326 T(to[s]->getStartIndex() + f, from[s]->getStartIndex() + f) = parity;
327 }
328 }
329 }
330 inv.atom_map = map;
331 inv.T = T;
332 return inv;
333}
334
336 const tools::Property& dftoptions, Orbitals& orb, const FitOptions& fit,
337 Logger& log) {
338 if (orb.getSpin() != 1) {
339 throw std::runtime_error(
340 "ChargeResponseFit: closed-shell molecules only (spin 1)");
341 }
342 if (!fit.analytic && !(fit.step > 0.0)) {
343 throw std::runtime_error("ChargeResponseFit: step must be positive");
344 }
345 if (fit.analytic && !(fit.tolerance > 0.0)) {
346 throw std::runtime_error("ChargeResponseFit: tolerance must be positive");
347 }
348 const double step = fit.step;
349 const QMMolecule& mol = orb.QMAtoms();
350 const Index n_atoms = mol.size();
351 // DFTEngine::Initialize takes a non-const tree
352 tools::Property options = dftoptions;
353
354 DFTSetupCache cache;
355 // one SCF of mol with the electron potential energy operator v (none if
356 // empty), warm-started from the ground state for the perturbed ones
357 auto scf = [&](const Eigen::MatrixXd& v, Orbitals& target) {
358 DFTEngine engine;
359 engine.setLogger(&log);
360 engine.Initialize(options);
361 engine.setSetupCache(&cache);
362 engine.setWarmStart(v.size() > 0);
363 if (v.size() > 0) {
365 }
366 const bool ok = engine.Evaluate(target);
367 engine.ReturnSetupCache();
368 if (!ok) {
369 throw std::runtime_error("ChargeResponseFit: SCF did not converge");
370 }
371 };
372
373 XTP_LOG(Log::error, log) << TimeStamp()
374 << " Charge-response fit: ground state"
375 << std::flush;
376 scf(Eigen::MatrixXd(), orb);
377
378 DFTEngine setup;
379 setup.setLogger(&log);
380 setup.Initialize(options);
381 AOBasis basis;
382 {
383 BasisSet bs;
384 bs.Load(options.get("basisset").as<std::string>());
385 basis.Fill(bs, mol);
386 }
387 Vxc_Grid grid;
388 grid.GridSetup(setup.getGridName(), mol, basis);
389 const std::vector<HirshfeldPartition::AtomicReference> atoms =
390 setup.HirshfeldReferences(mol);
391 const std::vector<Eigen::MatrixXd> W = WeightMatrices(atoms, basis, grid);
392 {
393 AOOverlap overlap;
394 overlap.Fill(basis);
395 Eigen::MatrixXd sum = -overlap.Matrix();
396 for (const Eigen::MatrixXd& w : W) {
397 sum += w;
398 }
399 XTP_LOG(Log::error, log)
400 << TimeStamp() << " Hirshfeld weight matrices: max |sum_k W_k - S| = "
401 << sum.cwiseAbs().maxCoeff() << std::flush;
402 }
403 AODipole dipole;
404 dipole.setCenter(mol.getPos());
405 dipole.Fill(basis);
406
407 // central differences: dP = (P(+step) - P(-step)) / (2 step)
408 auto response = [&](const Eigen::MatrixXd& h, const std::string& label) {
409 Eigen::MatrixXd dP = Eigen::MatrixXd::Zero(h.rows(), h.cols());
410 for (double sign : {1.0, -1.0}) {
411 XTP_LOG(Log::error, log)
412 << TimeStamp() << " Perturbation " << label
413 << (sign > 0 ? " +" : " -") << step << std::flush;
414 Orbitals perturbed = orb;
415 scf(sign * step * h, perturbed);
416 dP += sign * perturbed.DensityMatrixGroundState();
417 }
418 return Eigen::MatrixXd(dP / (2.0 * step));
419 };
420 Inversion inv;
421 if (fit.use_inversion) {
422 inv = FindInversion(mol, basis);
423 if (!inv.atom_map.empty()) {
424 XTP_LOG(Log::error, log)
425 << TimeStamp()
426 << " Inversion centre: one atom of each pair is perturbed"
427 << std::flush;
428 }
429 }
430 // the atoms whose response is computed; the others are their images
431 std::vector<Index> perturbed;
432 for (Index k = 0; k < n_atoms; ++k) {
433 if (inv.atom_map.empty() || inv.atom_map[std::size_t(k)] >= k) {
434 perturbed.push_back(k);
435 }
436 }
437 std::vector<Eigen::MatrixXd> dP_potential(static_cast<std::size_t>(n_atoms));
438 std::array<Eigen::MatrixXd, 3> dP_field;
439 if (fit.analytic) {
440 std::vector<Eigen::MatrixXd> h;
441 for (Index k : perturbed) {
442 h.push_back(W[std::size_t(k)]);
443 }
444 for (Index c = 0; c < 3; ++c) {
445 h.push_back(dipole.Matrix()[std::size_t(c)]);
446 }
447 XTP_LOG(Log::error, log) << TimeStamp() << " Coupled-perturbed KS for "
448 << h.size() << " perturbations" << std::flush;
449 DFTEngine engine;
450 engine.setLogger(&log);
451 engine.Initialize(options);
452 const std::vector<Eigen::MatrixXd> dP =
453 engine.StaticResponse(orb, h, fit.tolerance);
454 for (std::size_t j = 0; j < perturbed.size(); ++j) {
455 dP_potential[std::size_t(perturbed[j])] = dP[j];
456 }
457 for (std::size_t c = 0; c < 3; ++c) {
458 dP_field[c] = dP[perturbed.size() + c];
459 }
460 } else {
461 for (Index k : perturbed) {
462 dP_potential[std::size_t(k)] =
463 response(W[std::size_t(k)],
464 "w_" + std::to_string(k) + " (" + mol[k].getElement() + ")");
465 }
466 const std::array<std::string, 3> axes = {"x", "y", "z"};
467 for (Index c = 0; c < 3; ++c) {
468 dP_field[std::size_t(c)] = response(dipole.Matrix()[std::size_t(c)],
469 "field " + axes[std::size_t(c)]);
470 }
471 }
472 for (Index k = 0; k < n_atoms; ++k) {
473 if (!inv.atom_map.empty() && inv.atom_map[std::size_t(k)] < k) {
474 dP_potential[std::size_t(k)] =
475 inv.T * dP_potential[std::size_t(inv.atom_map[std::size_t(k)])] *
476 inv.T.transpose();
477 }
478 }
479
480 std::vector<Eigen::Vector3d> positions;
481 for (const QMAtom& atom : mol) {
482 positions.push_back(atom.getPos());
483 }
484 const std::vector<Eigen::Matrix3d> alpha_atoms =
485 AtomicPolarizabilities(atoms, positions, basis, grid, dP_field);
486 return Analyse(positions, W, dP_potential, dipole.Matrix(), dP_field,
487 alpha_atoms);
488}
489
490} // namespace xtp
491} // namespace votca
class to manage program options with xml serialization functionality
Definition property.h:55
Property & get(const std::string &key)
get existing property
Definition property.cc:79
T as() const
return value as type
Definition property.h:283
Container to hold Basisfunctions for all atoms.
Definition aobasis.h:42
const std::vector< const AOShell * > getShellsofAtom(Index AtomId) const
Definition aobasis.cc:63
Index AOBasisSize() const
Definition aobasis.h:46
void Fill(const BasisSet &bs, const QMMolecule &atoms)
Definition aobasis.cc:85
void setCenter(const Eigen::Vector3d &r)
Definition aomatrix.h:98
const std::array< Eigen::MatrixXd, 3 > & Matrix() const
Definition aomatrix.h:96
void Fill(const AOBasis &aobasis) final
void Fill(const AOBasis &aobasis) final
const Eigen::MatrixXd & Matrix() const
Definition aomatrix.h:52
const Eigen::Vector3d & getPos() const
void Load(const std::string &name)
Definition basisset.cc:149
static Inversion FindInversion(const QMMolecule &mol, const AOBasis &basis, double tol=1e-4)
static std::vector< Eigen::Matrix3d > AtomicPolarizabilities(const std::vector< HirshfeldPartition::AtomicReference > &atoms, const std::vector< Eigen::Vector3d > &positions, const AOBasis &basis, const Vxc_Grid &grid, const std::array< Eigen::MatrixXd, 3 > &dP_field)
static Result Analyse(const std::vector< Eigen::Vector3d > &positions, const std::vector< Eigen::MatrixXd > &W, const std::vector< Eigen::MatrixXd > &dP_potential, const std::array< Eigen::MatrixXd, 3 > &dipole, const std::array< Eigen::MatrixXd, 3 > &dP_field, const std::vector< Eigen::Matrix3d > &alpha_atoms)
static std::vector< Eigen::MatrixXd > WeightMatrices(const std::vector< HirshfeldPartition::AtomicReference > &atoms, const AOBasis &basis, const Vxc_Grid &grid)
static Result Fit(const tools::Property &dftoptions, Orbitals &orb, const FitOptions &fit, Logger &log)
Electronic ground-state via Density-Functional Theory.
Definition dftengine.h:89
void setWarmStart(bool warm_start)
Definition dftengine.h:120
void setLogger(Logger *pLog)
Attach the logger used for SCF progress and diagnostics.
Definition dftengine.h:95
std::vector< HirshfeldPartition::AtomicReference > HirshfeldReferences(const QMMolecule &mol) const
void setExternalPotentialMatrix(const Eigen::MatrixXd &v)
Definition dftengine.h:273
void Initialize(tools::Property &options)
Read DFT, grid, and SCF settings from the user options tree.
Definition dftengine.cc:99
const std::string & getGridName() const
Name of the integration grid of the SCF (xtpdft.integration_grid).
Definition dftengine.h:265
std::vector< Eigen::MatrixXd > StaticResponse(const Orbitals &orb, const std::vector< Eigen::MatrixXd > &perturbations, double tolerance=1e-7, Index max_iterations=100)
bool Evaluate(Orbitals &orb)
Definition dftengine.cc:823
void setSetupCache(DFTSetupCache *cache)
Definition dftengine.h:125
Adds per-grid-box blocks into a set of AO matrices from inside an OpenMP loop over grid boxes.
void Finish()
sums the thread-local copies into the targets (call outside the loop)
void Add(const GridBox &box, const std::vector< const Eigen::MatrixXd * > &small)
const std::vector< Eigen::Vector3d > & getGridPoints() const
Definition gridbox.h:55
Eigen::MatrixXd ReadFromBigMatrix(const Eigen::MatrixXd &bigmatrix) const
Definition gridbox.cc:97
const std::vector< double > & getGridWeights() const
Definition gridbox.h:57
AOShell::AOValues CalcAOValues(const Eigen::Vector3d &point) const
Definition gridbox.cc:44
Index Matrixsize() const
Definition gridbox.h:75
static double EvaluateAtomicDensity(const AOBasis &atom_basis, const Eigen::MatrixXd &reference_density, const Eigen::Vector3d &point)
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
Index getSpin() const
Return the stored spin multiplicity.
Definition orbitals.h:252
const QMMolecule & QMAtoms() const
Return read-only access to the molecular geometry.
Definition orbitals.h:262
container for QM atoms
Definition qmatom.h:37
Timestamp returns the current time as a string Example: cout << TimeStamp().
Definition logger.h:224
void GridSetup(const std::string &type, const QMMolecule &atoms, const AOBasis &basis)
Definition vxc_grid.cc:230
Index getBoxesSize() const
Definition vxc_grid.h:42
#define XTP_LOG(level, log)
Definition logger.h:40
Charge transport classes.
Definition ERIs.h:28
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
double step
finite differences: strength of each perturbation
std::vector< Eigen::Matrix3d > alpha_res_atoms
std::vector< Eigen::Matrix3d > alpha_atoms
Parts of the DFT setup that stay the same between runs on the same molecule with the same basis sets,...
Definition dftengine.h:56