37 filter->Initialize(filterop);
43 <<
"Initial state: " <<
statehist_[0].ToString() << flush;
46 <<
"Last state: " <<
statehist_.back().ToString() << flush;
52 for (
const auto& filter :
filters_) {
59 std::vector<Index>& vec1, std::vector<Index>& vec2)
const {
60 std::vector<Index> result(std::min(vec1, vec2));
61 std::sort(vec1.begin(), vec1.end());
62 std::sort(vec2.begin(), vec2.end());
63 std::vector<Index>::iterator it = std::set_intersection(
64 vec1.begin(), vec1.end(), vec2.begin(), vec2.end(), result.begin());
65 result.resize(it - result.begin());
70 std::vector<std::vector<Index>>& results)
const {
71 if (results.empty()) {
72 return std::vector<Index>(0);
74 std::vector<Index> result = results[0];
75 for (
Index i = 1; i <
Index(results.size()); i++) {
88 std::vector<std::vector<Index>> results;
89 for (
const auto& filter :
filters_) {
90 if (
statehist_.size() < 2 && filter->NeedsInitialState()) {
92 <<
"Filter " << filter->Identify()
93 <<
" not used in first iteration as it needs a reference state"
97 results.push_back(filter->CalcIndeces(orbitals,
statehist_[0].Type()));
102 if (result.size() < 1) {
105 <<
"No State found by tracker using last state: " << state.
ToString()
110 <<
"Next State is: " << state.
ToString() << flush;
119 filter->UpdateHist(orbitals, result);
125 std::vector<std::string> statehiststring;
128 statehiststring.push_back(s.ToString());
130 w(statehiststring,
"statehist");
132 for (
const auto& filter :
filters_) {
134 filter->WriteToCpt(ww);
139 std::vector<std::string> statehiststring;
140 r(statehiststring,
"statehist");
143 for (
const std::string& s : statehiststring) {
std::vector< std::string > getChildGroupNames() const
CheckpointReader openChild(const std::string &childName) const
CheckpointWriter openChild(const std::string &childName) const
container for molecular orbitals
Identifier for QMstates. Strings like S1 are converted into enum +zero indexed int.
std::string ToString() const
void Initialize(const tools::Property &options)
std::vector< std::unique_ptr< StateFilter_base > > filters_
QMState CalcStateAndUpdate(const Orbitals &orbitals)
void ReadFromCpt(CheckpointReader &r)
void WriteToCpt(CheckpointWriter &w) const
QMState CalcState(const Orbitals &orbitals) const
std::vector< Index > ComparePairofVectors(std::vector< Index > &vec1, std::vector< Index > &vec2) const
std::vector< QMState > statehist_
std::vector< Index > CollapseResults(std::vector< std::vector< Index > > &results) const
#define XTP_LOG(level, log)
base class for all analysis tools