ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
spectrum_weights.h
Go to the documentation of this file.
1#ifndef ABACUS_LR_SPECTRUM_WEIGHTS_H
2#define ABACUS_LR_SPECTRUM_WEIGHTS_H
3
4#include <vector>
5#include <complex>
6
7namespace LR_Util
8{
11inline double spatial_k_weight(const double ks_weight, const int nspin_global)
12{
13 return nspin_global == 1 ? 0.5 * ks_weight : ks_weight;
14}
15
18inline std::vector<double> spatial_k_weights(const std::vector<double>& ks_weights, const int nspin_global)
19{
20 std::vector<double> weights(ks_weights);
21 for (double& weight : weights)
22 {
23 weight = spatial_k_weight(weight, nspin_global);
24 }
25 return weights;
26}
27
30template <typename T>
31inline std::complex<double> weighted_velocity_transition(
32 const std::complex<double>& velocity, const T& x, const T& y,
33 const double gap, const bool use_ks_gap, const std::vector<double>& weights,
34 const int spin, const int ik, const int nk)
35{
36 const double weight = weights[spin * nk + ik] * nk;
37 const std::complex<double> excitation = velocity * x;
38 const std::complex<double> deexcitation = std::conj(velocity) * y;
39 if (use_ks_gap)
40 {
41 return (excitation - deexcitation) * (weight / gap);
42 }
43 return (excitation + deexcitation) * weight;
44}
45
46}
47
48#endif
#define T
Definition exp.cpp:237
Definition exciton_plotter.cpp:368
std::complex< double > weighted_velocity_transition(const std::complex< double > &velocity, const T &x, const T &y, const double gap, const bool use_ks_gap, const std::vector< double > &weights, const int spin, const int ik, const int nk)
Definition spectrum_weights.h:31
double spatial_k_weight(const double ks_weight, const int nspin_global)
Definition spectrum_weights.h:11
std::vector< double > spatial_k_weights(const std::vector< double > &ks_weights, const int nspin_global)
Definition spectrum_weights.h:18