Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions source/source_estate/module_dm/density_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ void DensityMatrix_Tools::cal_DMR(
for(int ik = 0; ik < dm._nk; ++ik)
{
if(ik_in >= 0 && ik_in != ik) { continue; }
// cal k_phase
// if TK==std::complex<double>, kphase is e^{ikR}
// Inverse Fourier transform: D(R) = (1/Nk) * sum_k D(k) * exp(-i*k*R)
// See Sec. 3 of nao_lcao_force_stress_derivation.md
const ModuleBase::Vector3<double> dR(R_index[0], R_index[1], R_index[2]);
const double arg = (dm._kvec_d[ik] * dR) * ModuleBase::TWO_PI;
double sinp, cosp;
ModuleBase::libm::sincos(arg, &sinp, &cosp);
kphase_vec[ik][iR] = TK(cosp, sinp);
kphase_vec[ik][iR] = TK(cosp, -sinp);
}
}

Expand Down Expand Up @@ -265,13 +265,13 @@ void DensityMatrix_Tools::cal_DMR_td(
for(int ik = 0; ik < dm._nk; ++ik)
{
if(ik_in >= 0 && ik_in != ik) { continue; }
// cal k_phase
// if TK==std::complex<double>, kphase is e^{ikR}
// Inverse Fourier transform: D(R) = (1/Nk) * sum_k D(k) * exp(-i*k*R)
// See Sec. 3 of nao_lcao_force_stress_derivation.md
const ModuleBase::Vector3<double> dR(R_index[0], R_index[1], R_index[2]);
const double arg = (dm._kvec_d[ik] * dR) * ModuleBase::TWO_PI;
double sinp, cosp;
ModuleBase::libm::sincos(arg, &sinp, &cosp);
kphase_vec[ik][iR] = TK(cosp, sinp);
kphase_vec[ik][iR] = TK(cosp, -sinp);
if(PARAM.inp.td_stype==2)
{
//phase for hybrid gauge tddft
Expand Down Expand Up @@ -422,13 +422,13 @@ void DensityMatrix_Tools::cal_DMR_full(
for(int ik = 0; ik < dm._nk; ++ik)
{
if(ik_in >= 0 && ik_in != ik) { continue; }
// cal k_phase
// if TK==std::complex<double>, kphase is e^{ikR}
const ModuleBase::Vector3<double> dR(R_index[0], R_index[1], R_index[2]);
// Inverse Fourier transform: D(R) = (1/Nk) * sum_k D(k) * exp(-i*k*R)
// See Sec. 3 of nao_lcao_force_stress_derivation.md
const ModuleBase::Vector3<double> dR(R_index.x, R_index.y, R_index.z);
const double arg = (dm._kvec_d[ik] * dR) * ModuleBase::TWO_PI;
double sinp, cosp;
ModuleBase::libm::sincos(arg, &sinp, &cosp);
kphase_vec[ik][iR] = TK(cosp, sinp);
kphase_vec[ik][iR] = TK(cosp, -sinp);
}
}

Expand Down
6 changes: 3 additions & 3 deletions source/source_lcao/module_lr/dm_trans/dmr_complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ namespace elecstate
for (int ik = 0; ik < this->_nk; ++ik)
{
if (ik_in >= 0 && ik_in != ik) continue;
// cal k_phase
// if TK==std::complex<double>, kphase is e^{ikR}
// Inverse Fourier transform: D(R) = (1/Nk) * sum_k D(k) * exp(-i*k*R)
// See Sec. 3 of nao_lcao_force_stress_derivation.md
const ModuleBase::Vector3<double> dR(r_index[0], r_index[1], r_index[2]);
const double arg = (this->_kvec_d[ik] * dR) * ModuleBase::TWO_PI;
double sinp = 0.0, cosp = 0.0;
ModuleBase::libm::sincos(arg, &sinp, &cosp);
const std::complex<double> kphase = std::complex<double>(cosp, sinp);
const std::complex<double> kphase = std::complex<double>(cosp, -sinp);
// set DMR element
std::complex<double>* tmp_DMR_pointer = tmp_matrix->get_pointer();
const std::complex<double>* tmp_DMK_pointer
Expand Down
Loading