votca 2024-dev
Loading...
Searching...
No Matches
qmatom.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
21#include "votca/xtp/qmatom.h"
23namespace votca {
24namespace xtp {
25
26QMAtom::QMAtom(Index index, std::string element, Eigen::Vector3d pos)
27 : index_(index), element_(element), pos_(pos) {
28 tools::Elements elements;
29 nuccharge_ = elements.getNucCrg(element_);
30}
31
32QMAtom::QMAtom(const data& d) { ReadData(d); }
33
34void QMAtom::Rotate(const Eigen::Matrix3d& R, const Eigen::Vector3d& refPos) {
35 Eigen::Vector3d dir = pos_ - refPos;
36 dir = R * dir;
37 pos_ = refPos + dir; // Rotated Position
38}
39
41 table.addCol<Index>("index", HOFFSET(data, index));
42 table.addCol<std::string>("element", HOFFSET(data, element));
43 table.addCol<double>("posX", HOFFSET(data, x));
44 table.addCol<double>("posY", HOFFSET(data, y));
45 table.addCol<double>("posZ", HOFFSET(data, z));
46 table.addCol<Index>("nuccharge", HOFFSET(data, nuccharge));
47 table.addCol<Index>("ecpcharge", HOFFSET(data, ecpcharge));
48}
49
50void QMAtom::WriteData(data& d) const {
51 d.index = index_;
52 d.element = const_cast<char*>(element_.c_str());
53 d.x = pos_[0];
54 d.y = pos_[1];
55 d.z = pos_[2];
58}
59
60void QMAtom::ReadData(const data& d) {
61 element_ = std::string(d.element);
62 free(d.element);
63 index_ = d.index;
64 pos_[0] = d.x;
65 pos_[1] = d.y;
66 pos_[2] = d.z;
69}
70} // namespace xtp
71} // namespace votca
information about an element
Definition elements.h:42
Index getNucCrg(std::string name)
Return the Nuclear charges of each atom. H - 1, He - 2, Na - 3 etc...
Definition elements.cc:36
void addCol(const std::string &name, const size_t &offset)
std::string element_
Definition qmatom.h:84
Eigen::Vector3d pos_
Definition qmatom.h:85
void WriteData(data &d) const
Definition qmatom.cc:50
void Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d &refPos)
Definition qmatom.cc:34
static void SetupCptTable(CptTable &table)
Definition qmatom.cc:40
void ReadData(const data &d)
Definition qmatom.cc:60
QMAtom(Index index, std::string element, Eigen::Vector3d pos)
Definition qmatom.cc:26
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26