29 const Eigen::Vector3d& rvector)
const {
32 assert(!densities_.empty() &&
"Density not calculated");
33 for (
Index i = 0; i < grid_.getBoxesSize(); i++) {
34 const std::vector<Eigen::Vector3d>& points = grid_[i].getGridPoints();
35 const std::vector<double>& densities = densities_[i];
36 for (
Index j = 0; j < grid_[i].size(); j++) {
37 double dist = (points[j] - rvector).norm();
38 result -= densities[j] / dist;
46 const Eigen::Vector3d& rvector)
const {
48 Eigen::Vector3d result = Eigen::Vector3d::Zero();
49 assert(!densities_.empty() &&
"Density not calculated");
50 for (
Index i = 0; i < grid_.getBoxesSize(); i++) {
51 const std::vector<Eigen::Vector3d>& points = grid_[i].getGridPoints();
52 const std::vector<double>& densities = densities_[i];
53 for (
Index j = 0; j < grid_[i].size(); j++) {
54 Eigen::Vector3d r = points[j] - rvector;
55 result -= densities[j] * r / std::pow(r.norm(), 3);
63 densities_ = std::vector<std::vector<double> >(grid_.getBoxesSize());
64 for (
Index i = 0; i < grid_.getBoxesSize(); i++) {
65 densities_[i] = std::vector<double>(grid_[i].size(), 0.0);
71 const Eigen::MatrixXd& density_matrix) {
74 SetupDensityContainer();
76#pragma omp parallel for schedule(guided) reduction(+ : N)
77 for (
Index i = 0; i < grid_.getBoxesSize(); ++i) {
83 const std::vector<Eigen::Vector3d>& points = box.
getGridPoints();
88 double rho = ao.
values.dot(DMAT_here * ao.
values) * weights[p];
89 densities_[i][p] = rho;
98 const Eigen::MatrixXd& density_matrix) {
100 Eigen::Vector3d centroid = Eigen::Vector3d::Zero();
101 Eigen::Matrix3d gyration = Eigen::Matrix3d::Zero();
103 SetupDensityContainer();
104#pragma omp parallel for schedule(guided) reduction(+ : N) \
105 reduction(+ : centroid) reduction(+ : gyration)
106 for (
Index i = 0; i < grid_.getBoxesSize(); ++i) {
113 const std::vector<Eigen::Vector3d>& points = box.
getGridPoints();
118 double rho = ao.
values.dot(DMAT_here * ao.
values) * weights[p];
119 densities_[i][p] = rho;
121 centroid += rho * points[p];
122 gyration += rho * points[p] * points[p].transpose();
127 centroid = centroid / N;
128 gyration = gyration / N;
129 gyration = gyration - centroid * centroid.transpose();
139 const AOBasis& externalbasis)
const {
140 Eigen::MatrixXd Potential = Eigen::MatrixXd::Zero(
143 assert(!densities_.empty() &&
"Density not calculated");
144 for (
Index i = 0; i < grid_.getBoxesSize(); i++) {
145 const std::vector<Eigen::Vector3d>& points = grid_[i].getGridPoints();
146 const std::vector<double>& densities = densities_[i];
147 for (
Index j = 0; j < grid_[i].size(); j++) {
148 if (densities[j] < 1
e-12) {
153 Potential += densities[j] * esp.
Matrix();
Container to hold Basisfunctions for all atoms.
Index AOBasisSize() const
void FillPotential(const AOBasis &aobasis, const QMMolecule &atoms)
const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & Matrix() const
void SetupDensityContainer()
Gyrationtensor IntegrateGyrationTensor(const Eigen::MatrixXd &density_matrix)
double IntegratePotential(const Eigen::Vector3d &rvector) const
Eigen::Vector3d IntegrateField(const Eigen::Vector3d &rvector) const
double IntegrateDensity(const Eigen::MatrixXd &density_matrix)
const std::vector< Eigen::Vector3d > & getGridPoints() const
Eigen::MatrixXd ReadFromBigMatrix(const Eigen::MatrixXd &bigmatrix) const
const std::vector< double > & getGridWeights() const
AOShell::AOValues CalcAOValues(const Eigen::Vector3d &point) const
base class for all analysis tools