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_STATETRACKER_H 22 #define VOTCA_XTP_STATETRACKER_H 23 24 // Standard includes 25 #include <memory> 26 27 // Local VOTCA includes 28 #include "logger.h" 29 #include "orbitals.h" 30 #include "qmstate.h" 31 #include "statefilter_base.h" 32 33 namespace votca { 34 namespace xtp { 35 /** 36 * \brief Tracks from a spectrum of states the state, which fullfills certain 37 * criteria 38 * 39 * 40 */ 41 42 class StateTracker { 43 44 public: 45 void Initialize(const tools::Property& options); setLogger(Logger * log)46 void setLogger(Logger* log) { log_ = log; } setInitialState(const QMState & state)47 void setInitialState(const QMState& state) { statehist_.push_back(state); } 48 void PrintInfo() const; InitialState()49 QMState InitialState() const { return statehist_[0]; } 50 QMState CalcStateAndUpdate(const Orbitals& orbitals); 51 QMState CalcState(const Orbitals& orbitals) const; 52 53 void WriteToCpt(CheckpointWriter& w) const; 54 55 void ReadFromCpt(CheckpointReader& r); 56 57 private: 58 void UpdateLastCoeff(const Orbitals& orbitals); 59 std::vector<Index> CollapseResults( 60 std::vector<std::vector<Index> >& results) const; 61 std::vector<Index> ComparePairofVectors(std::vector<Index>& vec1, 62 std::vector<Index>& vec2) const; 63 64 Logger* log_; 65 66 std::vector<QMState> statehist_; 67 std::vector<std::unique_ptr<StateFilter_base> > filters_; 68 }; 69 } // namespace xtp 70 } // namespace votca 71 72 #endif // VOTCA_XTP_STATETRACKER_H 73