ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
td_orbital_ops.h
Go to the documentation of this file.
1#ifndef HSOLVER_TD_ORBITAL_OPS_H
2#define HSOLVER_TD_ORBITAL_OPS_H
7#include "source_psi/psi.h"
8
9#include <iosfwd>
10
11namespace hsolver
12{
15{
16 double before = 0.0;
17 double after = 0.0;
18};
19
20template <typename T, typename Device>
22{
23 private:
25 const int npol_;
27 const bool out_stat_;
28 const std::vector<int> global_k_;
34 std::vector<std::vector<double>> orth_norms_;
35 std::ostream& log_;
36 unsigned int warned_events_ = 0;
38 void prepare_buffers(int nbands, int nbasis);
39 void correct_orbitals(T* current, int ld, int dim, int bands, int ik, int istep, int iter, bool detailed_output);
40 void record_orth(const OrthResult& result, int ik, int istep, int iter);
41 void report_orth_warning(const OrthResult& result, int ik, int istep, int iter);
42
43 public:
45 TDOrbOps(int npol,
46 OrthMethod orth_method,
47 bool out_stat,
48 const std::vector<int>& global_k,
49 const diag_comm_info& comm,
50 std::ostream& log);
52 void correct(psi::Psi<T, Device>* current, int step, int iter, bool detailed_output);
54 void reset_orth_stats();
56 void set_orth_stats(const TDOrthStats& stats)
57 {
58 orth_stats_ = stats;
59 }
60
61 void zero_padding(psi::Psi<T, Device>* current);
63 bool orth_initial(psi::Psi<T, Device>* current, int iter);
65 void check_initial(const psi::Psi<T, Device>& current, int iter);
67 double wave_electrons(const ModuleBase::matrix& occupations) const;
68 const TDOrthStats& orth_stats() const
69 {
70 return orth_stats_;
71 }
72
75
77 std::vector<std::complex<double>> cal_eij(HSOperator<T, Device>& op, const psi::Psi<T, Device>& current, const int ik);
78};
79} // namespace hsolver
80#endif
Definition matrix.h:15
A multi-dimensional array of elements of a single data type.
Definition tensor.h:32
What an iterative eigensolver needs from the generalized eigenproblem H x = e S x: the ability to app...
Definition hs_operator.h:24
Collective block algebra; only small coefficients cross the device boundary.
Definition linear_algebra.h:53
Reusable device arrays and collective block algebra for linear solvers.
Definition linear_workspace.h:34
Pool-local orthonormalization with FP64 products and native-precision updates.
Definition orthonormal.h:78
const int npol_
Definition td_orbital_ops.h:25
const std::vector< int > global_k_
Definition td_orbital_ops.h:28
void correct(psi::Psi< T, Device > *current, int step, int iter, bool detailed_output)
Apply common postprocessing to a completed predictor or corrector.
Definition td_orbital_ops.cpp:36
Orthonormal< T, Device > orthonormal_
Definition td_orbital_ops.h:32
ct::Tensor clean_
Definition td_orbital_ops.h:29
void check_initial(const psi::Psi< T, Device > &current, int iter)
Check the converged initial state once; finite orthogonality errors are diagnostic only.
Definition td_orbital_ops.cpp:278
void correct_orbitals(T *current, int ld, int dim, int bands, int ik, int istep, int iter, bool detailed_output)
Definition td_orbital_ops.cpp:120
void cal_band_energy(HSOperator< T, Device > &op, const psi::Psi< T, Device > &current, ModuleBase::matrix *energies)
Evaluate band expectations after the caller restores the endpoint Hamiltonian.
Definition td_orbital_ops.cpp:55
TDOrthStats orth_stats_
Definition td_orbital_ops.h:33
void record_orth(const OrthResult &result, int ik, int istep, int iter)
Definition td_orbital_ops.cpp:138
double wave_electrons(const ModuleBase::matrix &occupations) const
Occupation-weighted electron count for the local k-point pool.
Definition td_orbital_ops.cpp:303
const TDOrthStats & orth_stats() const
Definition td_orbital_ops.h:68
std::ostream & log_
Definition td_orbital_ops.h:35
const diag_comm_info comm_
Definition td_orbital_ops.h:24
const OrthMethod orth_method_
Definition td_orbital_ops.h:26
const bool out_stat_
Definition td_orbital_ops.h:27
TDOrbOps(int npol, OrthMethod orth_method, bool out_stat, const std::vector< int > &global_k, const diag_comm_info &comm, std::ostream &log)
Configure common orbital processing independently of a propagator.
Definition td_orbital_ops.cpp:15
void report_orth_warning(const OrthResult &result, int ik, int istep, int iter)
Definition td_orbital_ops.cpp:179
bool orth_initial(psi::Psi< T, Device > *current, int iter)
Orthogonalize initial orbitals with clean padding; return whether this pool changed any physical orbi...
Definition td_orbital_ops.cpp:251
LinearWorkspace< T, Device > band_products_
Definition td_orbital_ops.h:37
unsigned int warned_events_
Definition td_orbital_ops.h:36
void reset_orth_stats()
Reset diagnostics without invalidating preconditioner history.
Definition td_orbital_ops.cpp:110
ct::Tensor hpsi_
Definition td_orbital_ops.h:30
void zero_padding(psi::Psi< T, Device > *current)
Clear spinor padding without changing physical coefficients or the k-point cursor; no communication.
Definition td_orbital_ops.cpp:228
LinearAlgebra< T, Device > algebra_
Definition td_orbital_ops.h:31
std::vector< std::complex< double > > cal_eij(HSOperator< T, Device > &op, const psi::Psi< T, Device > &current, const int ik)
Return the pool-reduced, column-major Psi-adjoint H Psi for one local k point.
Definition td_orbital_ops.cpp:86
std::vector< std::vector< double > > orth_norms_
Definition td_orbital_ops.h:34
void set_orth_stats(const TDOrthStats &stats)
Publish diagnostics accumulated over accepted trial intervals only.
Definition td_orbital_ops.h:56
void prepare_buffers(int nbands, int nbasis)
Definition td_orbital_ops.cpp:28
Definition psi.h:37
#define T
Definition exp.cpp:237
Definition dense_eigensolver.cpp:23
OrthMethod
Definition orthonormal.h:13
Collective outcome; failed states must not be used to construct a density.
Definition orthonormal.h:53
Independent orthogonality maxima over accepted trial iterations and local k points.
Definition td_orbital_ops.h:15
double before
Definition td_orbital_ops.h:16
double after
Definition td_orbital_ops.h:17
Definition diag_comm_info.h:12