Commit c59340b5 by Francois Gygi

Add rhocore_r and rhocore_g to ChargeDensity

parent d010476d
......@@ -92,8 +92,6 @@ wf_(wf), vcomm_(wf.sd(0,0)->basis().comm())
ft_[ikp] = new FourierTransform(wb,np0v,np1v,np2v);
}
}
// initialize core density ptr to null ptr
rhocore_r = 0;
}
////////////////////////////////////////////////////////////////////////////////
......@@ -171,11 +169,6 @@ void ChargeDensity::update_density(void)
vft_->forward(&rhotmp[0],&rhog[ispin][0]);
tmap["charge_vft"].stop();
// add core correction charge
if ( rhocore_r )
for ( int i = 0; i < rhor_size; i++ )
rhor[ispin][i] += rhocore_r[i];
}
}
......@@ -197,18 +190,9 @@ void ChargeDensity::update_rhor(void)
const int rhor_size = rhor[ispin].size();
double *const prhor = &rhor[ispin][0];
if ( rhocore_r )
{
#pragma omp parallel for
for ( int i = 0; i < rhor_size; i++ )
prhor[i] = ( rhotmp[i].real() + rhocore_r[i] ) * omega_inv;
}
else
{
#pragma omp parallel for
for ( int i = 0; i < rhor_size; i++ )
prhor[i] = rhotmp[i].real() * omega_inv;
}
#pragma omp parallel for
for ( int i = 0; i < rhor_size; i++ )
prhor[i] = rhotmp[i].real() * omega_inv;
// integral of the charge density
tmap["charge_integral"].start();
......@@ -264,18 +248,9 @@ void ChargeDensity::update_rhog(void)
{
const int rhor_size = rhor[ispin].size();
double *const prhor = &rhor[ispin][0];
if ( rhocore_r )
{
#pragma omp parallel for
for ( int i = 0; i < rhor_size; i++ )
rhotmp[i] = complex<double> ( omega * (prhor[i] - rhocore_r[i]), 0);
}
else
{
#pragma omp parallel for
for ( int i = 0; i < rhor_size; i++ )
rhotmp[i] = complex<double> ( omega * prhor[i], 0);
}
#pragma omp parallel for
for ( int i = 0; i < rhor_size; i++ )
rhotmp[i] = complex<double> ( omega * prhor[i], 0);
assert(rhotmp.size() == vft_->np012loc() );
......
......@@ -51,10 +51,12 @@ class ChargeDensity
mutable TimerMap tmap;
// rhor, rhog: valence density
std::vector<std::vector<double> > rhor; // rhor[ispin][i]
std::vector<std::vector<std::complex<double> > > rhog; // rhog[ispin][ig]
// core density ptr. If non-zero, contains the real-space core density
double* rhocore_r;
// rhocore_r, rhocore_g: core density. Non-zero size only if nlcc used
std::vector<double> rhocore_r;
std::vector<std::complex<double> > rhocore_g;
void update_density(void);
void update_rhor(void);
void update_rhog(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment