votca 2026-dev
Loading...
Searching...
No Matches
hirshfeldpartition.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// Hirshfeld real-space partitioning, used as the weight function for CDFT
21// charge constraints. Hirshfeld is preferred over Becke/SSW partitioning,
22// which gives unphysical atomic charges for atoms of very different size
23// (cf. CP2K).
24//
25// The weight of atom i is w_i(r) = rho_i^free(r) / sum_j rho_j^free(r),
26// where rho_i^free is the spherically averaged density of the isolated
27// atom (DFTEngine::ComputeHirshfeldReferenceDensities). The reference
28// densities are passed in explicitly; as in DFTGradient, all methods are
29// static and do not access DFTEngine internals. Each reference density is
30// evaluated in its own single-atom basis centered on the atom, so no
31// embedding into the molecular AO basis is needed.
32
33#pragma once
34#ifndef VOTCA_XTP_HIRSHFELDPARTITION_H
35#define VOTCA_XTP_HIRSHFELDPARTITION_H
36
37// Standard includes
38#include <map>
39#include <string>
40#include <vector>
41
42// Local VOTCA includes
43#include "aobasis.h"
44#include "qmmolecule.h"
45#include "vxc_grid.h"
46
47namespace votca {
48namespace xtp {
49
51 public:
57 Eigen::MatrixXd density;
58 };
59
62 static std::vector<AtomicReference> BuildAtomicReferences(
63 const QMMolecule& mol, const std::string& basisset_name,
64 const std::map<std::string, Eigen::MatrixXd>& reference_densities);
65
73 static double EvaluateAtomicDensity(const AOBasis& atom_basis,
74 const Eigen::MatrixXd& reference_density,
75 const Eigen::Vector3d& point);
76
82 static Eigen::Vector3d EvaluateAtomicDensityGradient(
83 const AOBasis& atom_basis, const Eigen::MatrixXd& reference_density,
84 const Eigen::Vector3d& point);
85
89 static double EvaluateWeight(const std::vector<AtomicReference>& atoms,
90 Index target_atom_index,
91 const Eigen::Vector3d& point);
92
101 static Eigen::Vector3d EvaluateWeightGradient(
102 const std::vector<AtomicReference>& atoms, Index target_atom_index,
103 Index differentiate_atom_index, const Eigen::Vector3d& point);
104
114 static Eigen::Vector3d EvaluatePointWeightGradient(
115 const std::vector<AtomicReference>& atoms, Index target_atom_index,
116 const Eigen::Vector3d& point);
117
128 static Eigen::MatrixXd GridWeightDerivativeContribution(
129 const std::vector<AtomicReference>& atoms, Index target_atom_index,
130 const Eigen::MatrixXd& density_matrix, const QMMolecule& mol,
131 const Vxc_Grid& grid);
132
142 static Eigen::MatrixXd PulayAndTranslationContribution(
143 const std::vector<AtomicReference>& atoms, Index target_atom_index,
144 const Eigen::MatrixXd& density_matrix, const AOBasis& full_dftbasis,
145 const Vxc_Grid& grid);
146
152 static Eigen::MatrixXd WeightFunctionDerivativeContribution(
153 const std::vector<AtomicReference>& atoms, Index target_atom_index,
154 const Eigen::MatrixXd& density_matrix, const AOBasis& full_dftbasis,
155 const Vxc_Grid& grid);
156
162 static Eigen::MatrixXd ComputeCDFTForceContribution(
163 const std::vector<AtomicReference>& atoms, Index target_atom_index,
164 const Eigen::MatrixXd& density_matrix, const QMMolecule& mol,
165 const AOBasis& full_dftbasis, const Vxc_Grid& grid);
166
174 static Eigen::MatrixXd BuildWeightMatrix(
175 const std::vector<AtomicReference>& atoms, Index target_atom_index,
176 const AOBasis& full_dftbasis, const Vxc_Grid& grid);
177
185 struct Constraint {
186 Eigen::MatrixXd weight_matrix;
188 double lambda = 0.0;
191 };
192};
193
194} // namespace xtp
195} // namespace votca
196
197#endif // VOTCA_XTP_HIRSHFELDPARTITION_H
Container to hold Basisfunctions for all atoms.
Definition aobasis.h:42
static std::vector< AtomicReference > BuildAtomicReferences(const QMMolecule &mol, const std::string &basisset_name, const std::map< std::string, Eigen::MatrixXd > &reference_densities)
static double EvaluateWeight(const std::vector< AtomicReference > &atoms, Index target_atom_index, const Eigen::Vector3d &point)
static double EvaluateAtomicDensity(const AOBasis &atom_basis, const Eigen::MatrixXd &reference_density, const Eigen::Vector3d &point)
static Eigen::MatrixXd WeightFunctionDerivativeContribution(const std::vector< AtomicReference > &atoms, Index target_atom_index, const Eigen::MatrixXd &density_matrix, const AOBasis &full_dftbasis, const Vxc_Grid &grid)
static Eigen::Vector3d EvaluatePointWeightGradient(const std::vector< AtomicReference > &atoms, Index target_atom_index, const Eigen::Vector3d &point)
static Eigen::Vector3d EvaluateWeightGradient(const std::vector< AtomicReference > &atoms, Index target_atom_index, Index differentiate_atom_index, const Eigen::Vector3d &point)
static Eigen::MatrixXd GridWeightDerivativeContribution(const std::vector< AtomicReference > &atoms, Index target_atom_index, const Eigen::MatrixXd &density_matrix, const QMMolecule &mol, const Vxc_Grid &grid)
static Eigen::Vector3d EvaluateAtomicDensityGradient(const AOBasis &atom_basis, const Eigen::MatrixXd &reference_density, const Eigen::Vector3d &point)
static Eigen::MatrixXd BuildWeightMatrix(const std::vector< AtomicReference > &atoms, Index target_atom_index, const AOBasis &full_dftbasis, const Vxc_Grid &grid)
static Eigen::MatrixXd PulayAndTranslationContribution(const std::vector< AtomicReference > &atoms, Index target_atom_index, const Eigen::MatrixXd &density_matrix, const AOBasis &full_dftbasis, const Vxc_Grid &grid)
static Eigen::MatrixXd ComputeCDFTForceContribution(const std::vector< AtomicReference > &atoms, Index target_atom_index, const Eigen::MatrixXd &density_matrix, const QMMolecule &mol, const AOBasis &full_dftbasis, const Vxc_Grid &grid)
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26