votca 2024.1-dev
Loading...
Searching...
No Matches
topology.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_TOPOLOGY_H
22#define VOTCA_XTP_TOPOLOGY_H
23
24// VOTCA includes
26#include <votca/csg/openbox.h>
29
30// Local VOTCA includes
31#include "qmnblist.h"
32
33namespace votca {
34namespace xtp {
35
36class Segment;
41class Topology {
42 public:
43 Topology() = default;
44
45 Topology(const Topology &top);
46
47 Topology &operator=(const Topology &top);
48
49 // I do not have to manually make a move constructor or move assignment
50 // operator or destructor because I only have to reassign pointers in qmnblist
51 // object
52
53 Segment &AddSegment(std::string segment_name);
54
55 Segment &getSegment(Index id) { return segments_[id]; }
56 const Segment &getSegment(Index id) const { return segments_[id]; }
57
58 std::vector<Segment> &Segments() { return segments_; }
59 const std::vector<Segment> &Segments() const { return segments_; }
60
61 // Periodic boundary: Can be 'open', 'orthorhombic', 'triclinic'
62 Eigen::Vector3d PbShortestConnect(const Eigen::Vector3d &r1,
63 const Eigen::Vector3d &r2) const;
64 const Eigen::Matrix3d &getBox() const { return bc_->getBox(); }
65 double BoxVolume() const { return bc_->BoxVolume(); }
66 void setBox(const Eigen::Matrix3d &box,
69
70 QMNBList &NBList() { return nblist_; }
71 const QMNBList &NBList() const { return nblist_; }
72
73 // Trajectory meta data: step number, time, frame (= Db ID)
74
75 Index getStep() const { return step_; }
76 void setStep(Index step) { step_ = step; }
77 double getTime() const { return time_; }
78 void setTime(double time) { time_ = time; }
79
80 void WriteToCpt(CheckpointWriter &w) const;
81
82 void WriteToPdb(std::string filename) const;
83
85
86 double GetShortestDist(const Segment &seg1, const Segment &seg2) const;
87
88 std::vector<const Segment *> FindAllSegmentsOnMolecule(
89 const Segment &seg1, const Segment &seg2) const;
90
91 private:
92 std::vector<Segment> segments_;
93
94 std::unique_ptr<csg::BoundaryCondition> bc_ = nullptr;
96
97 double time_;
99
101 const Eigen::Matrix3d &box);
102
103 static constexpr int topology_version() { return 1; }
104};
105
106} // namespace xtp
107} // namespace votca
108
109#endif // VOTCA_XTP_TOPOLOGY_H
Container for segments and box and atoms.
Definition topology.h:41
double getTime() const
Definition topology.h:77
const Segment & getSegment(Index id) const
Definition topology.h:56
void WriteToCpt(CheckpointWriter &w) const
Definition topology.cc:183
Index getStep() const
Definition topology.h:75
std::unique_ptr< csg::BoundaryCondition > bc_
Definition topology.h:94
Segment & AddSegment(std::string segment_name)
Definition topology.cc:65
std::vector< Segment > segments_
Definition topology.h:92
Eigen::Vector3d PbShortestConnect(const Eigen::Vector3d &r1, const Eigen::Vector3d &r2) const
Definition topology.cc:129
void setTime(double time)
Definition topology.h:78
void setBox(const Eigen::Matrix3d &box, csg::BoundaryCondition::eBoxtype boxtype=csg::BoundaryCondition::typeAuto)
Definition topology.cc:74
std::vector< Segment > & Segments()
Definition topology.h:58
std::vector< const Segment * > FindAllSegmentsOnMolecule(const Segment &seg1, const Segment &seg2) const
Definition topology.cc:149
csg::BoundaryCondition::eBoxtype AutoDetectBoxType(const Eigen::Matrix3d &box)
Definition topology.cc:103
const Eigen::Matrix3d & getBox() const
Definition topology.h:64
void ReadFromCpt(CheckpointReader &r)
Definition topology.cc:198
void WriteToPdb(std::string filename) const
Definition topology.cc:171
QMNBList & NBList()
Definition topology.h:70
const QMNBList & NBList() const
Definition topology.h:71
Topology & operator=(const Topology &top)
Definition topology.cc:49
const std::vector< Segment > & Segments() const
Definition topology.h:59
double BoxVolume() const
Definition topology.h:65
double GetShortestDist(const Segment &seg1, const Segment &seg2) const
Definition topology.cc:134
void setStep(Index step)
Definition topology.h:76
Segment & getSegment(Index id)
Definition topology.h:55
static constexpr int topology_version()
Definition topology.h:103
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26