Skip to content

Commit 1fe748f

Browse files
committed
update the broadening function in lr_spectrum
1 parent 68735ed commit 1fe748f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

source/module_lr/esolver_lrtd_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ void LR::ESolver_LR<T, TR>::after_all_runners(UnitCell& ucell)
568568
{
569569
spectrum.optical_absorption_method1(freq, input.abs_broadening);
570570
// =============================================== for test ====================================================
571-
// spectrum.optical_absorption_method2(freq, input.abs_broadening, spin_types[is]);
571+
// spectrum.optical_absorption_method2(freq, input.abs_broadening);
572572
// spectrum.test_transition_dipoles_velocity_ks(eig_ks.c);
573573
// spectrum.write_transition_dipole(PARAM.globalv.global_out_dir + "dipole_velocity_ks.dat");
574574
// =============================================== for test ====================================================

source/module_lr/lr_spectrum_velocity.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)