votca 2024.1-dev
Loading...
Searching...
No Matches
qmnblist.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 */
21
22#pragma once
23#ifndef VOTCA_XTP_QMNBLIST_H
24#define VOTCA_XTP_QMNBLIST_H
25
26// VOTCA includes
27#include <votca/csg/pairlist.h>
28
29// Local VOTCA includes
30#include "qmpair.h"
31
32namespace votca {
33namespace xtp {
34
35class QMNBList : public csg::PairList<const Segment*, QMPair> {
36 public:
37 QMNBList() = default;
39
40 QMPair& Add(const Segment& seg1, const Segment& seg2,
41 const Eigen::Vector3d& r);
42
43 template <class Compare>
44 void sortAndReindex(Compare comp);
45
46 const QMPair* operator[](Index index) const { return pairs_[index]; }
47 QMPair* operator[](Index index) { return pairs_[index]; }
48
49 void WriteToCpt(CheckpointWriter& w) const;
50
51 void ReadFromCpt(CheckpointReader& r, const std::vector<Segment>& segments);
52
53 protected:
54};
55
56template <class Compare>
57inline void QMNBList::sortAndReindex(Compare comp) {
58 std::sort(pairs_.begin(), pairs_.end(), comp);
59
60 for (Index i = 0; i < Index(pairs_.size()); i++) {
61 pairs_[i]->setId(i);
62 }
63}
64
65} // namespace xtp
66} // namespace votca
67
68#endif // VOTCA_XTP_QMNBLIST_H
void ReadFromCpt(CheckpointReader &r, const std::vector< Segment > &segments)
Definition qmnblist.cc:55
void WriteToCpt(CheckpointWriter &w) const
Definition qmnblist.cc:37
void sortAndReindex(Compare comp)
Definition qmnblist.h:57
QMPair * operator[](Index index)
Definition qmnblist.h:47
const QMPair * operator[](Index index) const
Definition qmnblist.h:46
QMPair & Add(const Segment &seg1, const Segment &seg2, const Eigen::Vector3d &r)
Definition qmnblist.cc:27
~QMNBList() override
Definition qmnblist.h:38
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26