votca 2024.1-dev
Loading...
Searching...
No Matches
aoshell.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2021 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_AOSHELL_H
22#define VOTCA_XTP_AOSHELL_H
23
24// Third party includes
25#include <boost/math/constants/constants.hpp>
26
27// VOTCA includes
29
30// Local VOTCA includes
31#include "basisset.h"
32#include "eigen.h"
33#include "qmatom.h"
34// include libint last otherwise it overrides eigen
35#include <libint2/shell.h>
36
37namespace votca {
38namespace xtp {
39
40class AOBasis;
41class AOShell;
42class SetupCptTable;
43
45
46 public:
48 friend class AOShell;
49
50 struct data {
54 double decay;
56 double x;
57 double y;
58 double z;
59 double scale;
60 };
61
67
68 static void SetupCptTable(CptTable& table);
69
70 void WriteData(data& d, const AOShell& s) const;
71
72 double getPowfactor() const { return powfactor_; }
73 double getDecay() const { return decay_; }
74 double getContraction() const { return contraction_; }
75
76 private:
77 static double CalcPowFactor(double decay) {
78 return std::pow(2.0 * decay / boost::math::constants::pi<double>(), 0.75);
79 }
80 double decay_;
82 double powfactor_; // used in evalspace to speed up DFT
83};
84
85/*
86 * shells in a Gaussian-basis expansion
87 */
88class AOShell {
89 friend AOBasis;
90
91 public:
92 AOShell(const Shell& shell, const QMAtom& atom, Index startIndex);
93
95 l_ = static_cast<L>(d.l);
98 pos_ = Eigen::Vector3d(d.x, d.y, d.z);
99 gaussians_.push_back(AOGaussianPrimitive(d));
100 }
101
102 L getL() const { return l_; }
103 Index getNumFunc() const { return NumFuncShell(l_); };
105 Index getStartIndex() const { return startIndex_; }
106 Index getOffset() const { return OffsetFuncShell(l_); }
108 Index getAtomIndex() const { return atomindex_; }
109 Index getSize() const { return gaussians_.size(); }
110
111 libint2::Shell LibintShell() const;
112
113 const Eigen::Vector3d& getPos() const { return pos_; }
114
116 mindecay_ = std::numeric_limits<double>::max();
117 for (auto& gaussian : gaussians_) {
118 mindecay_ = std::min(mindecay_, gaussian.getDecay());
119 }
120 }
121
122 double getMinDecay() const { return mindecay_; }
123
124 struct AOValues {
125
127 values = Eigen::VectorXd::Zero(size);
128 derivatives = Eigen::MatrixX3d::Zero(size, 3);
129 }
130 Eigen::VectorXd values;
131 Eigen::MatrixX3d derivatives;
132 };
133
134 AOValues EvalAOspace(const Eigen::Vector3d& grid_pos) const;
135
136 // iterator over pairs (decay constant; contraction coefficient)
137 using GaussianIterator = std::vector<AOGaussianPrimitive>::const_iterator;
138 GaussianIterator begin() const { return gaussians_.begin(); }
139 GaussianIterator end() const { return gaussians_.end(); }
140
141 // adds a Gaussian
142 void addGaussian(const GaussianPrimitive& gaussian) {
143 gaussians_.push_back(AOGaussianPrimitive(gaussian));
144 return;
145 }
146
148
149 friend std::ostream& operator<<(std::ostream& out, const AOShell& shell);
150
151 private:
153 // scaling factor
154 // number of functions in shell
155 double mindecay_;
157 Eigen::Vector3d pos_;
159
160 // vector of pairs of decay constants and contraction coefficients
161 std::vector<AOGaussianPrimitive> gaussians_;
162};
163} // namespace xtp
164} // namespace votca
165
166#endif // VOTCA_XTP_AOSHELL_H
static double CalcPowFactor(double decay)
Definition aoshell.h:77
double getPowfactor() const
Definition aoshell.h:72
double getContraction() const
Definition aoshell.h:74
AOGaussianPrimitive(const GaussianPrimitive &gaussian)
Definition aoshell.cc:29
void WriteData(data &d, const AOShell &s) const
Definition aoshell.cc:46
static void SetupCptTable(CptTable &table)
Definition aoshell.cc:34
AOGaussianPrimitive(const AOGaussianPrimitive::data &d)
Definition aoshell.h:62
Index getCartesianNumFunc() const
Definition aoshell.h:104
std::vector< AOGaussianPrimitive >::const_iterator GaussianIterator
Definition aoshell.h:137
void normalizeContraction()
Definition aoshell.cc:81
const Eigen::Vector3d & getPos() const
Definition aoshell.h:113
friend std::ostream & operator<<(std::ostream &out, const AOShell &shell)
Definition aoshell.cc:306
libint2::Shell LibintShell() const
Definition aoshell.cc:65
Index getSize() const
Definition aoshell.h:109
Index getAtomIndex() const
Definition aoshell.h:108
Index getOffset() const
Definition aoshell.h:106
AOValues EvalAOspace(const Eigen::Vector3d &grid_pos) const
Definition aoshell.cc:91
AOShell(const AOGaussianPrimitive::data &d)
Definition aoshell.h:94
GaussianIterator begin() const
Definition aoshell.h:138
Index getStartIndex() const
Definition aoshell.h:105
Index getCartesianOffset() const
Definition aoshell.h:107
void addGaussian(const GaussianPrimitive &gaussian)
Definition aoshell.h:142
GaussianIterator end() const
Definition aoshell.h:139
double getMinDecay() const
Definition aoshell.h:122
Index getNumFunc() const
Definition aoshell.h:103
std::vector< AOGaussianPrimitive > gaussians_
Definition aoshell.h:161
AOShell(const Shell &shell, const QMAtom &atom, Index startIndex)
Definition aoshell.cc:57
Eigen::Vector3d pos_
Definition aoshell.h:157
container for QM atoms
Definition qmatom.h:37
Index NumFuncShell(L l)
Definition basisset.cc:100
Index OffsetFuncShell(L l)
Definition basisset.cc:80
Index NumFuncShell_cartesian(L l)
Definition basisset.cc:102
Index OffsetFuncShell_cartesian(L l)
Definition basisset.cc:107
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
Eigen::MatrixX3d derivatives
Definition aoshell.h:131