votca 2026-dev
Loading...
Searching...
No Matches
ipodcoupling.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2026 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_IPODCOUPLING_H
22#define VOTCA_XTP_IPODCOUPLING_H
23
24// VOTCA includes
26
27// Local VOTCA includes
28#include "votca/xtp/atom.h"
29#include "votca/xtp/orbitals.h"
31
32namespace votca {
33namespace xtp {
34
58class IPodCoupling final : public ParallelXJobCalc<std::vector<Job> > {
59 public:
60 std::string Identify() const { return "ipodcoupling"; }
61 Job::JobResult EvalJob(const Topology& top, Job& job, QMThread& opThread);
62 void WriteJobFile(const Topology& top);
63 void ReadJobFile(Topology& top);
64
65 protected:
66 void ParseSpecificOptions(const tools::Property& user_options);
67
68 private:
69 void SetJobToFailed(Job::JobResult& jres, Logger& pLog,
70 const std::string& errormessage);
71 void WriteLoggerToFile(const std::string& logfile, Logger& logger);
72
73 // Finds, within podprop (the same "podcoupling" node EvalJob writes
74 // via podcoupling_summary), the <coupling> element with the given,
75 // exact levelA/levelB, and returns its own "j" value converted back
76 // to Hartree (podprop's own "j" is written in eV -- see EvalJob's
77 // own comment for exactly why) -- NaN if no such element exists at
78 // all (e.g. this specific pair was never actually within the
79 // requested numberofstatesA_/B_ range at the time the job was
80 // originally run). Same, established pattern as IQM::
81 // GetDFTCouplingFromProp (iqm.cc), confirmed directly by reading it
82 // before writing this.
83 double GetPODCouplingFromProp(const tools::Property& podprop, Index levelA,
84 Index levelB) const;
85
86 // Finds, within seg, the specific atom whose own external bond
87 // points toward target_segment_id -- genuinely different from just
88 // "any atom with hasExternalBond()", since a segment can, in
89 // principle, have external bonds toward more than one other
90 // segment at all (only the one specifically bonded toward
91 // target_segment_id is wanted here). Throws directly (per direct
92 // agreement with the user) if no such atom exists at all -- this
93 // would mean seg and the segment target_segment_id refers to are
94 // NOT actually, directly bonded, despite FindLinkingSegments()
95 // itself already having reported a real bond path between them; a
96 // silent skip/fallback here would produce a geometrically wrong
97 // supermolecule with no warning at all, worse than failing loudly.
99 Index target_segment_id) const;
100
101 // Returns PBC-correctly-positioned COPIES of every segment in
102 // linkers (never the originals stored in Topology, matching
103 // QMPair::Seg2PbCopy()'s own, established "return a fresh copy"
104 // convention exactly) -- walks the real, actual covalent chain
105 // seg1_positioned -> linkers[0] -> linkers[1] -> ... ->
106 // seg2_positioned one bond at a time (see this method's own .cc
107 // implementation for exactly why one bond at a time, not any
108 // single, whole-chain shift, is needed), using
109 // Topology::PbShortestConnect() at each hop, anchored on each
110 // hop's own, specific FindBoundaryAtomTowardSegment result -- not
111 // any segment's own, whole-molecule center of mass, unlike
112 // QMPair::Seg2PbCopy() itself, since a large segment's own center
113 // can be genuinely far from its own, specific bonded atom.
114 //
115 // seg1_positioned/seg2_positioned are assumed to already be
116 // correctly positioned themselves (this walk's own two, fixed
117 // anchors) -- typically seg1 itself (unmoved, the pair's own,
118 // established anchor) and pair->Seg2PbCopy() (already
119 // PBC-corrected, via the existing, established pair-level
120 // mechanism) respectively. The very last hop
121 // (linkers.back() -> seg2_positioned) is validated the exact same
122 // way as every other hop -- if FindLinkingSegments() reported a
123 // real chain but the very last linker turns out not to be actually
124 // bonded to seg2 at all, this throws too, for the exact same
125 // reason.
126 std::vector<Segment> PositionLinkersAlongChain(
127 const Topology& top, const Segment& seg1_positioned,
128 const std::vector<const Segment*>& linkers,
129 const Segment& seg2_positioned) const;
130
133
134 // PODCoupling::CalculateCouplings's own numberofstatesA/B --
135 // matches podcoupling.xml's own, established "levA"/"levB" option
136 // names exactly (already used by the standalone podcoupling tool,
137 // podcouplingtool.cc), for user familiarity -- unlike that tool,
138 // fragment_A/fragment_B themselves are never parsed as options at
139 // all here; they are computed directly from the segment mapping
140 // itself (IPodCoupling::EvalJob), not user-supplied.
143
144 // Whether to look for, and include, linking segments at all (via
145 // Topology::FindLinkingSegments) -- deliberately a simple,
146 // real toggle, per direct agreement with the user (default off,
147 // matching IQM's own default-off linker behavior). Unlike IQM's
148 // own linker_names (a segment-TYPE whitelist), this graph-based
149 // design needs no such whitelist at all -- inclusion is already,
150 // entirely determined by real bond connectivity alone (is there an
151 // actual, real covalent path between seg_A and seg_B at all).
152 // Deliberately no cap on the number of linker segments included at
153 // all either, per direct agreement with the user.
154 bool include_linkers_ = false;
155
156 // What to do -- same, established "tasks" pattern as IQM's own
157 // do_dft_input_/do_dft_run_/do_dft_parse_ (matching option names,
158 // deliberately, for user familiarity), plus a new task specific to
159 // this calculator's own, additional purpose.
160 bool do_dft_input_ = false;
161 bool do_dft_run_ = false;
162 bool do_dft_parse_ = false;
163 bool do_podcoupling_ = false;
164
165 bool store_dft_ = false;
166};
167
168} // namespace xtp
169} // namespace votca
170#endif // VOTCA_XTP_IPODCOUPLING_H
class to manage program options with xml serialization functionality
Definition property.h:55
H-saturated, DFT + POD2-based electronic coupling calculator.
void WriteJobFile(const Topology &top)
std::string Identify() const
Calculator name.
void ParseSpecificOptions(const tools::Property &user_options)
std::vector< Segment > PositionLinkersAlongChain(const Topology &top, const Segment &seg1_positioned, const std::vector< const Segment * > &linkers, const Segment &seg2_positioned) const
void ReadJobFile(Topology &top)
tools::Property podcoupling_options_
Job::JobResult EvalJob(const Topology &top, Job &job, QMThread &opThread)
const Atom & FindBoundaryAtomTowardSegment(const Segment &seg, Index target_segment_id) const
tools::Property dftpackage_options_
void WriteLoggerToFile(const std::string &logfile, Logger &logger)
void SetJobToFailed(Job::JobResult &jres, Logger &pLog, const std::string &errormessage)
double GetPODCouplingFromProp(const tools::Property &podprop, Index levelA, Index levelB) const
Logger is used for thread-safe output of messages.
Definition logger.h:164
Container for segments and box and atoms.
Definition topology.h:41
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26