votca 2026-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 table.addCol<bool>("has_external_bond", HOFFSET(data, has_external_bond));
49 table.addCol<double>("ext_bond_dir.x", HOFFSET(data, ext_bond_dir_x));
50 table.addCol<double>("ext_bond_dir.y", HOFFSET(data, ext_bond_dir_y));
51 table.addCol<double>("ext_bond_dir.z", HOFFSET(data, ext_bond_dir_z));
52 table.addCol<Index>("ext_bond_partner_segment_id",
53 HOFFSET(data, ext_bond_partner_segment_id));
54 // Same reasoning as Atom::SetupCptTable's own, identical block:
55 // CptTable::addCol<U>() only supports fundamental types (no array
56 // support), so each slot needs its own column; HOFFSET(data,
57 // bonded_partner_ids) + i*sizeof(Index) is used rather than
58 // HOFFSET(data, bonded_partner_ids[i]) directly, to avoid a known
59 // "gray area" (offsetof into a specific array element) under this
60 // project's own -Wall -Wextra build flags.
61 for (Index i = 0; i < kMaxBondedPartners; i++) {
62 table.addCol<Index>(
63 "bonded_partner_id." + std::to_string(i),
64 HOFFSET(data, bonded_partner_ids) + size_t(i) * sizeof(Index));
65 }
66}
67
85
104} // namespace xtp
105} // 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:198
Index external_bond_partner_segment_id_
Definition qmatom.h:204
Eigen::Vector3d external_bond_direction_
Definition qmatom.h:203
Eigen::Vector3d pos_
Definition qmatom.h:199
void WriteData(data &d) const
Definition qmatom.cc:68
void Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d &refPos)
Definition qmatom.cc:34
static void SetupCptTable(CptTable &table)
Definition qmatom.cc:40
Index bonded_partner_ids_[kMaxBondedPartners]
Definition qmatom.h:205
void ReadData(const data &d)
Definition qmatom.cc:86
QMAtom(Index index, std::string element, Eigen::Vector3d pos)
Definition qmatom.cc:26
static constexpr Index kMaxBondedPartners
Definition qmatom.h:43
bool has_external_bond_
Definition qmatom.h:202
Charge transport classes.
Definition ERIs.h:28
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
Index ext_bond_partner_segment_id
Definition qmatom.h:57
Index bonded_partner_ids[kMaxBondedPartners]
Definition qmatom.h:58