votca 2024.2-dev
Loading...
Searching...
No Matches
amplitude_integration.cc
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// Local VOTCA includes
23
24namespace votca {
25namespace xtp {
26
27template <class Grid>
28std::vector<std::vector<double> >
30 const Eigen::VectorXd& amplitude) {
31
32 auto result = SetupAmplitudeContainer();
33
34#pragma omp parallel for schedule(guided)
35 for (Index i = 0; i < grid_.getBoxesSize(); ++i) {
36 const GridBox& box = grid_[i];
37 if (!box.Matrixsize()) {
38 continue;
39 }
40 const Eigen::VectorXd amplitude_here = box.ReadFromBigVector(amplitude);
41 const std::vector<Eigen::Vector3d>& points = box.getGridPoints();
42 const std::vector<double>& weights = box.getGridWeights();
43 // iterate over gridpoints
44 for (Index p = 0; p < box.size(); p++) {
45 AOShell::AOValues ao = box.CalcAOValues(points[p]);
46 result[i][p] = weights[p] * amplitude_here.dot(ao.values);
47 }
48 }
49 return result;
50}
51
52template <class Grid>
53std::vector<std::vector<double> >
55 std::vector<std::vector<double> > amplitudes =
56 std::vector<std::vector<double> >(grid_.getBoxesSize());
57 for (Index i = 0; i < grid_.getBoxesSize(); i++) {
58 amplitudes[i] = std::vector<double>(grid_[i].size(), 0.0);
59 }
60 return amplitudes;
61}
62
64
65} // namespace xtp
66} // namespace votca
std::vector< std::vector< double > > IntegrateAmplitude(const Eigen::VectorXd &amplitude)
std::vector< std::vector< double > > SetupAmplitudeContainer()
const std::vector< Eigen::Vector3d > & getGridPoints() const
Definition gridbox.h:41
const std::vector< double > & getGridWeights() const
Definition gridbox.h:43
Eigen::VectorXd ReadFromBigVector(const Eigen::VectorXd &bigvector) const
Definition gridbox.cc:82
AOShell::AOValues CalcAOValues(const Eigen::Vector3d &point) const
Definition gridbox.cc:44
Index size() const
Definition gridbox.h:51
Index Matrixsize() const
Definition gridbox.h:55
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26