votca 2026-dev
Loading...
Searching...
No Matches
classicalsegment.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_CLASSICALSEGMENT_H
22#define VOTCA_XTP_CLASSICALSEGMENT_H
23
24// Local VOTCA includes
25#include "atomcontainer.h"
26#include "chargeresponse.h"
27#include "polarsite.h"
28#include "staticsite.h"
29
30namespace votca {
31namespace xtp {
32template <class T>
34 public:
35 ClassicalSegment(std::string name, Index id) : AtomContainer<T>(name, id) {};
36
40
41 void LoadFromFile(std::string filename);
42
43 void WriteMPS(std::string filename, std::string header) const;
44
45 double CalcTotalQ() const;
46
47 std::string identify() const;
48
49 Eigen::Vector3d CalcDipole() const;
50
51 friend std::ostream& operator<<(std::ostream& out,
52 const ClassicalSegment<T>& container) {
53 out << container.getId() << " " << container.identify() << " "
54 << container.getType() << "\n";
55 for (const T& atom : container) {
56 out << atom;
57 }
58 out << std::endl;
59 return out;
60 }
61
62 // Charge-response model (polar segments only): induced atomic charges
63 // dq = -Pi phi next to the induced dipoles of the sites. Without it the
64 // segment is an ordinary Thole segment.
65 bool hasChargeResponse() const { return !chargeresponse_.empty(); }
67 // Pi must be in the atom order of this segment (checked by element)
69
70 void WriteToCpt(CheckpointWriter& w) const override;
71 void ReadFromCpt(CheckpointReader& r) override;
72
73 // additional access functions and tools for Ewald compatibility
74 bool IsCharged() const;
75 bool IsPolarizable() const;
76 Eigen::Vector3d CalcStaticDipole() const;
77
78 private:
81};
82
85
86} // namespace xtp
87} // namespace votca
88
89#endif // VOTCA_XTP_CLASSICALSEGMENT_H
const std::string & getType() const
AtomContainer(std::string type, Index id)
Charge-response matrix Pi of one molecule type.
Eigen::Vector3d CalcStaticDipole() const
void ReadFromCpt(CheckpointReader &r) override
void ReadChargeResponseFromCpt(CheckpointReader &r)
ClassicalSegment(CheckpointReader &r)
ClassicalSegment(std::string name, Index id)
void WriteToCpt(CheckpointWriter &w) const override
friend std::ostream & operator<<(std::ostream &out, const ClassicalSegment< T > &container)
void LoadFromFile(std::string filename)
const ChargeResponse & getChargeResponse() const
Eigen::Vector3d CalcDipole() const
void WriteMPS(std::string filename, std::string header) const
void setChargeResponse(const ChargeResponse &cr)
ClassicalSegment< PolarSite > PolarSegment
ClassicalSegment< StaticSite > StaticSegment
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26