votca 2024-dev
Loading...
Searching...
No Matches
basisset.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_BASISSET_H
22#define VOTCA_XTP_BASISSET_H
23
24// Standard includes
25#include <iostream>
26#include <map>
27#include <memory>
28#include <string>
29#include <vector>
30
31// VOTCA includes
32#include <votca/tools/types.h>
33
34namespace votca {
35namespace xtp {
36
37enum class L { S = 0, P = 1, D = 2, F = 3, G = 4, H = 5, I = 6 };
38
39std::string EnumToString(L l);
40
41L StringToEnum(const std::string& type);
42L StringToEnum(char type);
43
44// shell type (S, P, D))
45
46bool CheckShellType(const std::string& shelltype);
47
49
52
54
55// Gaussian function: contraction*exp(-decay*r^2)
57 public:
60 double contraction() const { return contraction_; }
61
62 double decay() const { return decay_; }
63
64 private:
65 double decay_;
67};
68
69class Shell {
70
71 public:
72 Shell(L l, double scale) : l_(l), scale_(scale) { ; }
73
74 L getL() const { return l_; }
75
76 Index getnumofFunc() const { return NumFuncShell(l_); };
77
78 Index getOffset() const { return OffsetFuncShell(l_); }
79
80 double getScale() const { return scale_; }
81
82 Index getSize() const { return gaussians_.size(); }
83
84 std::vector<GaussianPrimitive>::const_iterator begin() const {
85 return gaussians_.begin();
86 }
87 std::vector<GaussianPrimitive>::const_iterator end() const {
88 return gaussians_.end();
89 }
90
91 // adds a Gaussian
92 GaussianPrimitive& addGaussian(double decay, double contraction);
93 friend std::ostream& operator<<(std::ostream& out, const Shell& shell);
94
95 private:
97 // scaling factor
98 double scale_;
99
100 // vector of pairs of decay constants and contraction coefficients
101 std::vector<GaussianPrimitive> gaussians_;
102};
103
104/*
105 * A collection of shells associated with a specific element
106 */
107class Element {
108
109 public:
110 Element(std::string type) : type_(type) { ; }
111 using ShellIterator = std::vector<Shell>::const_iterator;
112 ShellIterator begin() const { return shells_.begin(); }
113 ShellIterator end() const { return shells_.end(); }
114
115 const std::string& getType() const { return type_; }
116
117 Shell& addShell(L l, double shellScale) {
118 shells_.push_back(Shell(l, shellScale));
119 return shells_.back();
120 }
121
122 Index NumOfShells() const { return shells_.size(); }
123
124 friend std::ostream& operator<<(std::ostream& out, const Element& element);
125
126 private:
127 std::string type_;
128 std::vector<Shell> shells_;
129};
130
131/*
132 * A collection of elements and shells forms the basis set
133 */
134class BasisSet {
135 public:
136 void Load(const std::string& name);
137
138 const Element& getElement(std::string element_type) const;
139
140 std::map<std::string, Element>::iterator begin() { return elements_.begin(); }
141 std::map<std::string, Element>::iterator end() { return elements_.end(); }
142
143 std::map<std::string, Element>::const_iterator begin() const {
144 return elements_.begin();
145 }
146 std::map<std::string, Element>::const_iterator end() const {
147 return elements_.end();
148 }
149
150 friend std::ostream& operator<<(std::ostream& out, const BasisSet& basis);
151
152 const std::string& Name() const { return name_; }
153
154 private:
155 Element& addElement(std::string elementType);
156 std::string name_;
157 std::map<std::string, Element> elements_;
158};
159
160} // namespace xtp
161} // namespace votca
162
163#endif // VOTCA_XTP_BASISSET_H
const Element & getElement(std::string element_type) const
Definition basisset.cc:212
void Load(const std::string &name)
Definition basisset.cc:149
const std::string & Name() const
Definition basisset.h:152
std::string name_
Definition basisset.h:156
std::map< std::string, Element >::const_iterator begin() const
Definition basisset.h:143
std::map< std::string, Element > elements_
Definition basisset.h:157
std::map< std::string, Element >::const_iterator end() const
Definition basisset.h:146
std::map< std::string, Element >::iterator end()
Definition basisset.h:141
std::map< std::string, Element >::iterator begin()
Definition basisset.h:140
friend std::ostream & operator<<(std::ostream &out, const BasisSet &basis)
Definition basisset.cc:242
Element & addElement(std::string elementType)
Definition basisset.cc:204
friend std::ostream & operator<<(std::ostream &out, const Element &element)
Definition basisset.cc:234
Index NumOfShells() const
Definition basisset.h:122
ShellIterator begin() const
Definition basisset.h:112
std::string type_
Definition basisset.h:127
Element(std::string type)
Definition basisset.h:110
std::vector< Shell >::const_iterator ShellIterator
Definition basisset.h:111
std::vector< Shell > shells_
Definition basisset.h:128
Shell & addShell(L l, double shellScale)
Definition basisset.h:117
const std::string & getType() const
Definition basisset.h:115
ShellIterator end() const
Definition basisset.h:113
double contraction() const
Definition basisset.h:60
GaussianPrimitive(double decay, double contraction)
Definition basisset.h:58
std::vector< GaussianPrimitive >::const_iterator end() const
Definition basisset.h:87
GaussianPrimitive & addGaussian(double decay, double contraction)
Definition basisset.cc:251
double getScale() const
Definition basisset.h:80
L getL() const
Definition basisset.h:74
Index getSize() const
Definition basisset.h:82
std::vector< GaussianPrimitive >::const_iterator begin() const
Definition basisset.h:84
Shell(L l, double scale)
Definition basisset.h:72
std::vector< GaussianPrimitive > gaussians_
Definition basisset.h:101
Index getnumofFunc() const
Definition basisset.h:76
Index getOffset() const
Definition basisset.h:78
friend std::ostream & operator<<(std::ostream &out, const Shell &shell)
Definition basisset.cc:222
Index NumFuncShell(L l)
Definition basisset.cc:100
std::string EnumToString(L l)
Definition basisset.cc:60
bool CheckShellType(const std::string &shelltype)
Definition basisset.cc:127
Index OffsetFuncShell(L l)
Definition basisset.cc:80
Index NumFuncShell_cartesian(L l)
Definition basisset.cc:102
L StringToEnum(const std::string &type)
Definition basisset.cc:30
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