votca 2026-dev
Loading...
Searching...
No Matches
gridbox.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 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_GRIDBOX_H
22#define VOTCA_XTP_GRIDBOX_H
23
24// Local VOTCA includes
25#include "aoshell.h"
26#include "grid_containers.h"
27
28namespace votca {
29namespace xtp {
30
35class GridBox {
36
37 public:
38 void FindSignificantShells(const AOBasis& basis);
39 AOShell::AOValues CalcAOValues(const Eigen::Vector3d& point) const;
40
41 // Added for GGA XC-gradient support -- same pattern as CalcAOValues
42 // above (loop over significant_shells, pack into box-local ranges via
43 // aoranges), calling AOShell::EvalAOspaceHessian instead of
44 // EvalAOspace.
46 const Eigen::Vector3d& point) const;
47
48 const std::vector<Eigen::Vector3d>& getGridPoints() const { return grid_pos; }
49
50 const std::vector<double>& getGridWeights() const { return weights; }
51
52 const std::vector<Index>& getOwnerAtoms() const { return owner_atoms; }
53
54 const std::vector<const AOShell*>& getShells() const {
55 return significant_shells;
56 }
57
58 const std::vector<GridboxRange>& getAOranges() const { return aoranges; }
59
60 Index size() const { return Index(grid_pos.size()); }
61
62 Index Shellsize() const { return Index(significant_shells.size()); }
63
64 Index Matrixsize() const { return matrix_size; }
65
66 void addGridBox(const GridBox& box) {
67 grid_pos.insert(grid_pos.end(), box.grid_pos.begin(), box.grid_pos.end());
68 weights.insert(weights.end(), box.weights.begin(), box.weights.end());
69 owner_atoms.insert(owner_atoms.end(), box.owner_atoms.begin(),
70 box.owner_atoms.end());
71 return;
72 }
73
75 grid_pos.push_back(point.grid_pos);
76 weights.push_back(point.grid_weight);
77 owner_atoms.push_back(point.owner_atom);
78 };
79
80 void addShell(const AOShell* shell) {
81 significant_shells.push_back(shell);
82 matrix_size += shell->getNumFunc();
83 };
84
86
87 Eigen::MatrixXd ReadFromBigMatrix(const Eigen::MatrixXd& bigmatrix) const;
88
89 Eigen::VectorXd ReadFromBigVector(const Eigen::VectorXd& bigvector) const;
90
91 void AddtoBigMatrix(Eigen::MatrixXd& bigmatrix,
92 const Eigen::MatrixXd& smallmatrix) const;
93
94 static bool compareGridboxes(GridBox& box1, GridBox& box2) {
95 if (box1.Matrixsize() != box2.Matrixsize()) {
96 return false;
97 }
98 if (box1.Shellsize() != box2.Shellsize()) {
99 return false;
100 }
101 for (Index i = 0; i < Index(box1.significant_shells.size()); ++i) {
102 if (box1.significant_shells[i] != box2.significant_shells[i]) {
103 return false;
104 }
105 }
106 return true;
107 }
108
109 private:
111 std::vector<GridboxRange> aoranges;
112 std::vector<GridboxRange> ranges;
113 std::vector<GridboxRange> inv_ranges;
114 std::vector<Eigen::Vector3d> grid_pos;
115 std::vector<const AOShell*> significant_shells;
116 std::vector<double> weights;
117 // Parallel to grid_pos/weights: which atom each point's radial/angular
118 // quadrature was generated from. Added for the SSW grid-weight nuclear
119 // derivative (Vxc_Potential::GridWeightGradient); not used by any
120 // existing (deriv_order=0) code path.
121 std::vector<Index> owner_atoms;
122};
123
124} // namespace xtp
125} // namespace votca
126#endif // VOTCA_XTP_GRIDBOX_H
Container to hold Basisfunctions for all atoms.
Definition aobasis.h:42
Index getNumFunc() const
Definition aoshell.h:103
void PrepareForIntegration()
Definition gridbox.cc:108
const std::vector< Eigen::Vector3d > & getGridPoints() const
Definition gridbox.h:48
std::vector< Index > owner_atoms
Definition gridbox.h:121
Eigen::MatrixXd ReadFromBigMatrix(const Eigen::MatrixXd &bigmatrix) const
Definition gridbox.cc:84
void AddtoBigMatrix(Eigen::MatrixXd &bigmatrix, const Eigen::MatrixXd &smallmatrix) const
Definition gridbox.cc:71
void addShell(const AOShell *shell)
Definition gridbox.h:80
void addGridBox(const GridBox &box)
Definition gridbox.h:66
std::vector< GridboxRange > inv_ranges
Definition gridbox.h:113
std::vector< double > weights
Definition gridbox.h:116
const std::vector< const AOShell * > & getShells() const
Definition gridbox.h:54
const std::vector< GridboxRange > & getAOranges() const
Definition gridbox.h:58
const std::vector< double > & getGridWeights() const
Definition gridbox.h:50
const std::vector< Index > & getOwnerAtoms() const
Definition gridbox.h:52
std::vector< const AOShell * > significant_shells
Definition gridbox.h:115
AOShell::AOValuesHessian CalcAOValuesHessian(const Eigen::Vector3d &point) const
Definition gridbox.cc:55
std::vector< Eigen::Vector3d > grid_pos
Definition gridbox.h:114
Eigen::VectorXd ReadFromBigVector(const Eigen::VectorXd &bigvector) const
Definition gridbox.cc:98
static bool compareGridboxes(GridBox &box1, GridBox &box2)
Definition gridbox.h:94
AOShell::AOValues CalcAOValues(const Eigen::Vector3d &point) const
Definition gridbox.cc:44
Index size() const
Definition gridbox.h:60
std::vector< GridboxRange > aoranges
Definition gridbox.h:111
Index Matrixsize() const
Definition gridbox.h:64
std::vector< GridboxRange > ranges
Definition gridbox.h:112
void FindSignificantShells(const AOBasis &basis)
Definition gridbox.cc:27
Index Shellsize() const
Definition gridbox.h:62
void addGridPoint(const GridContainers::Cartesian_gridpoint &point)
Definition gridbox.h:74
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26