@@ -23,9 +23,14 @@ namespace LR
2323 return vR;
2424 }
2525
26- inline double lorentz_delta (const double freq_diff , const double eta )
26+ inline double lorentz_delta (const double dfreq_au , const double eta_au )
2727 {
28- return eta / (freq_diff * freq_diff + eta * eta) / M_PI;
28+ return eta_au / (dfreq_au * dfreq_au + eta_au * eta_au) / M_PI;
29+ }
30+ inline double gauss_delta (const double dfreq_au, const double eta_au)
31+ {
32+ const double c = eta_au / std::sqrt (2 . * std::log (2 .));
33+ return std::exp (-dfreq_au * dfreq_au / (2 * c * c)) / (std::sqrt (2 * M_PI) * c);
2934 }
3035
3136 template <typename T> inline ModuleBase::Vector3<T> convert_vector_to_vector3 (const std::vector<std::complex <double >>& vec);
@@ -109,13 +114,13 @@ namespace LR
109114 // 4*pi^2/V * mean_squared_dipole *delta(w-Omega_S)
110115 std::ofstream ofs (PARAM.globalv .global_out_dir + " absorption.dat" );
111116 if (GlobalV::MY_RANK == 0 ) { ofs << " Frequency (eV) | wave length(nm) | Absorption (a.u.)" << std::endl; }
112- const double fac = 4 * M_PI * M_PI / ucell.omega * ModuleBase:: e2 / this ->nk ; // e2: Ry to Hartree in the denominator
117+ const double fac = 4 * M_PI * M_PI / ucell.omega / this ->nk ;
113118 for (int f = 0 ;f < freq.size ();++f)
114119 {
115120 double abs_value = 0.0 ;
116121 for (int i = 0 ;i < nstate;++i)
117122 {
118- abs_value += this ->mean_squared_transition_dipole_ [i] * lorentz_delta ((freq[f] - eig[i]), eta);
123+ abs_value += this ->mean_squared_transition_dipole_ [i] * lorentz_delta ((freq[f] - eig[i]) / ModuleBase:: e2 , eta / ModuleBase:: e2 ); // e2: Ry to Hartree
119124 }
120125 abs_value *= fac;
121126 if (GlobalV::MY_RANK == 0 ) { ofs << freq[f] * ModuleBase::Ry_to_eV << " \t " << 91.126664 / freq[f] << " \t " << abs_value << std::endl; }
0 commit comments