votca 2024.2-dev
Loading...
Searching...
No Matches
DeltaQ_filter.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
22
23// Local private VOTCA includes
24#include "DeltaQ_filter.h"
25
26namespace votca {
27namespace xtp {
28
30 std::string indices = options.get("fragment").as<std::string>();
31 fragment_ = QMFragment<double>(0, indices);
32 fragment_.value() = options.get("threshold").as<double>();
33}
34
35void DeltaQ_filter::Info(Logger& log) const {
36 XTP_LOG(Log::error, log) << "Using Delta Q tracker for fragment " << fragment_
37 << std::flush;
38}
39
41
42std::vector<Index> DeltaQ_filter::CalcIndeces(const Orbitals& orb,
43 QMStateType type) const {
44
45 if (!type.isExciton()) {
46 throw std::runtime_error("ChargeTransfer filter only works for excitons.");
47 }
48 std::vector<Index> indexes;
49 Lowdin low;
51
53 std::vector<QMFragment<BSE_Population> > loc = {frag};
54 low.CalcChargeperFragment(loc, orb, type);
55 Eigen::VectorXd dq = (loc[0].value().H + loc[0].value().E).cwiseAbs();
56 for (Index i = 0; i < dq.size(); i++) {
57 if (dq[i] > fragment_.value()) {
58 indexes.push_back(i);
59 }
60 }
61 return indexes;
62}
63
65
69
70} // namespace xtp
71} // namespace votca
class to manage program options with xml serialization functionality
Definition property.h:55
Property & get(const std::string &key)
get existing property
Definition property.cc:79
T as() const
return value as type
Definition property.h:283
void WriteToCpt(CheckpointWriter &w) final
void Info(Logger &log) const final
void ReadFromCpt(CheckpointReader &r) final
QMFragment< double > fragment_
void Initialize(const tools::Property &options) final
void UpdateHist(const Orbitals &orb, QMState state) final
std::vector< Index > CalcIndeces(const Orbitals &orb, QMStateType type) const final
Logger is used for thread-safe output of messages.
Definition logger.h:164
container for molecular orbitals
Definition orbitals.h:46
void CalcChargeperFragment(std::vector< QMFragment< BSE_Population > > &frags, const Orbitals &orbitals, QMStateType type) const
void ReadFromCpt(CheckpointReader &r)
Definition qmfragment.h:99
void WriteToCpt(CheckpointWriter &w) const
Definition qmfragment.h:93
void copy_withoutvalue(const QMFragment< T2 > &frag)
Definition qmfragment.h:50
const T & value() const
Definition qmfragment.h:59
bool isExciton() const
Definition qmstate.h:71
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
Definition qmstate.h:132
#define XTP_LOG(level, log)
Definition logger.h:40
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26