votca 2024.2-dev
Loading...
Searching...
No Matches
staticsite.h
Go to the documentation of this file.
1
2/*
3 * Copyright 2009-2020 The VOTCA Development Team
4 * (http://www.votca.org)
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License")
7 *
8 * You may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16nn * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
21#pragma once
22#ifndef VOTCA_XTP_STATICSITE_H
23#define VOTCA_XTP_STATICSITE_H
24
25// Local VOTCA includes
26#include "eigen.h"
27#include "qmatom.h"
28
29namespace votca {
30namespace xtp {
31
38
39 public:
40 struct data {
42 char* element;
43 double posX;
44 double posY;
45 double posZ;
46
48
49 double Q00;
50 double Q11c;
51 double Q11s;
52 double Q10;
53 double Q20;
54 double Q21c;
55 double Q21s;
56 double Q22c;
57 double Q22s;
58 };
59 StaticSite(Index id, std::string element, Eigen::Vector3d pos)
60 : id_(id), element_(element), pos_(pos) {};
61
62 StaticSite(Index id, std::string element)
63 : StaticSite(id, element, Eigen::Vector3d::Zero()) {};
64
65 StaticSite(const data& d) { ReadData(d); }
66
67 StaticSite(const QMAtom& atom, double charge)
68 : StaticSite(atom.getId(), atom.getElement(), atom.getPos()) {
69 setCharge(charge);
70 }
71 virtual ~StaticSite() = default;
72
73 protected:
74 StaticSite() = default;
75
76 public:
77 Index getId() const { return id_; }
78 Index getRank() const { return rank_; }
79 const std::string& getElement() const { return element_; }
80 const Eigen::Vector3d& getPos() const { return pos_; }
81
82 void setMultipole(const Vector9d& multipole, Index rank) {
83 Q_ = multipole;
84 rank_ = rank;
85 }
86 // sets rank to 0 as well
87 void setCharge(double q) {
88 Q_(0) = q;
89 rank_ = 0;
90 }
91
92 void setPos(const Eigen::Vector3d& position) { pos_ = position; }
93
94 // COORDINATES TRANSFORMATION
95 void Translate(const Eigen::VectorXd& shift);
96 virtual void Rotate(const Eigen::Matrix3d& R, const Eigen::Vector3d& refPos);
97
98 // MULTIPOLES DEFINITION
99 double getCharge() const { return Q_(0); }
100 const Vector9d& Q() const {
101 return Q_;
102 } // Q00,Q11c,Q11s,Q10,Q20, Q21c, Q21s, Q22c, Q22s,...[NOT following Stone
103 // order for dipoles]
104
105 virtual Eigen::Vector3d getDipole() const { return Q_.segment<3>(1); }
106
107 Eigen::Matrix3d CalculateCartesianMultipole() const;
108
109 static Eigen::VectorXd CalculateSphericalMultipole(
110 const Eigen::Matrix3d& quad_cart);
111
112 std::string WriteMpsLine(std::string unit = "bohr") const;
113
114 static void SetupCptTable(CptTable& table);
115
116 void WriteData(data& d) const;
117 void ReadData(const data& d);
118 virtual void setpolarization(const Eigen::Matrix3d&) { return; }
119
120 virtual std::string identify() const { return "staticsite"; }
121
122 friend std::ostream& operator<<(std::ostream& out, const StaticSite& site) {
123 out << site.getId() << " " << site.getElement() << " " << site.getRank();
124 out << " " << site.getPos().transpose() << "\n";
125 return out;
126 }
127
128 protected:
129 virtual std::string writepolarization() const;
130
131 Index id_ = -1;
132 std::string element_ = "";
133 Eigen::Vector3d pos_ = Eigen::Vector3d::Zero();
135
136 Vector9d Q_ = Vector9d::Zero(); // Q00,Q11c,Q11s,Q10,Q20,Q21c,Q21s,Q22c,Q22s
137};
138} // namespace xtp
139} // namespace votca
140
141#endif // VOTCA_XTP_STATICSITE_H
container for QM atoms
Definition qmatom.h:37
Class to represent Atom/Site in electrostatic.
Definition staticsite.h:37
void setMultipole(const Vector9d &multipole, Index rank)
Definition staticsite.h:82
static Eigen::VectorXd CalculateSphericalMultipole(const Eigen::Matrix3d &quad_cart)
Definition staticsite.cc:54
Eigen::Matrix3d CalculateCartesianMultipole() const
Definition staticsite.cc:37
static void SetupCptTable(CptTable &table)
virtual Eigen::Vector3d getDipole() const
Definition staticsite.h:105
const std::string & getElement() const
Definition staticsite.h:79
std::string WriteMpsLine(std::string unit="bohr") const
virtual void setpolarization(const Eigen::Matrix3d &)
Definition staticsite.h:118
StaticSite(Index id, std::string element)
Definition staticsite.h:62
Index getId() const
Definition staticsite.h:77
const Eigen::Vector3d & getPos() const
Definition staticsite.h:80
void setPos(const Eigen::Vector3d &position)
Definition staticsite.h:92
StaticSite(Index id, std::string element, Eigen::Vector3d pos)
Definition staticsite.h:59
double getCharge() const
Definition staticsite.h:99
StaticSite(const QMAtom &atom, double charge)
Definition staticsite.h:67
virtual ~StaticSite()=default
virtual std::string identify() const
Definition staticsite.h:120
StaticSite(const data &d)
Definition staticsite.h:65
void WriteData(data &d) const
virtual std::string writepolarization() const
Definition staticsite.cc:88
friend std::ostream & operator<<(std::ostream &out, const StaticSite &site)
Definition staticsite.h:122
void ReadData(const data &d)
void setCharge(double q)
Definition staticsite.h:87
void Translate(const Eigen::VectorXd &shift)
Definition staticsite.cc:83
Index getRank() const
Definition staticsite.h:78
const Vector9d & Q() const
Definition staticsite.h:100
virtual void Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d &refPos)
Definition staticsite.cc:66
Eigen::Vector3d pos_
Definition staticsite.h:133
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
Eigen::Matrix< double, 9, 1 > Vector9d
Definition eigen.h:34