ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
td_history_pw.h
Go to the documentation of this file.
1#ifndef TD_HISTORY_PW_H
2#define TD_HISTORY_PW_H
3
8#include "source_psi/psi.h"
9
10#include <memory>
11#include <vector>
12
13namespace pw
14{
15
23
25TDElecSnap capture_td(const elecstate::fenergy& energy, const ModuleBase::matrix& eigenvalues, const Charge& charge);
26
28void restore_td(const TDElecSnap& state, elecstate::fenergy& energy, ModuleBase::matrix& eigenvalues, Charge& charge);
29
31template <typename T, typename Device>
33{
34 public:
36 void prepare(const elecstate::Potential& potential);
37
39 const typename GetTypeReal<T>::type* left_potential() const;
40 unsigned long long generation() const
41 {
42 return generation_;
43 }
44
46 void save(const psi::Psi<T, Device>& current, elecstate::Potential& potential);
47
49 const psi::Psi<T, Device>& previous() const;
50
51 private:
52 using Real = typename GetTypeReal<T>::type;
53 std::unique_ptr<psi::Psi<T, Device>> previous_;
55 unsigned long long generation_ = 0;
56};
57
58} // namespace pw
59#endif
Definition charge.h:24
Definition matrix.h:15
A multi-dimensional array of elements of a single data type.
Definition tensor.h:32
Definition potential_new.h:58
Definition psi.h:37
Accepted endpoint wavefunctions and potential snapshots.
Definition td_history_pw.h:33
void prepare(const elecstate::Potential &potential)
Prepare storage after the potential grids have been updated.
Definition td_history_pw.cpp:66
const GetTypeReal< T >::type * left_potential() const
Borrow the immutable accepted left-endpoint potential.
Definition td_history_pw.cpp:74
std::unique_ptr< psi::Psi< T, Device > > previous_
Definition td_history_pw.h:53
typename GetTypeReal< T >::type Real
Definition td_history_pw.h:52
ct::Tensor veff_prev_
Definition td_history_pw.h:54
void save(const psi::Psi< T, Device > &current, elecstate::Potential &potential)
Save the accepted endpoint; the caller owns the convergence decision.
Definition td_history_pw.cpp:80
unsigned long long generation_
Definition td_history_pw.h:55
unsigned long long generation() const
Definition td_history_pw.h:40
const psi::Psi< T, Device > & previous() const
Access the fixed origin of every corrector solve in the next step.
Definition td_history_pw.cpp:94
This file contains all energies about first-principle calculations.
Definition deltaspin_pw.cpp:7
void restore_td(const TDElecSnap &state, elecstate::fenergy &energy, ModuleBase::matrix &eigenvalues, Charge &charge)
Restore electronic data on the unchanged density grid and refresh its mixing backup.
Definition td_history_pw.cpp:51
TDElecSnap capture_td(const elecstate::fenergy &energy, const ModuleBase::matrix &eigenvalues, const Charge &charge)
Copy energy, band expectations and density without advancing orbital history.
Definition td_history_pw.cpp:38
T type
Definition macros.h:8
Definition fp_energy.h:17
Electronic data at an accepted endpoint; orbitals and potential stay in TDHistoryPW.
Definition td_history_pw.h:18
ModuleBase::matrix eigenvalues
Definition td_history_pw.h:20
std::vector< double > density
Definition td_history_pw.h:21
elecstate::fenergy energy
Definition td_history_pw.h:19