Commit 0d1d5e8b by Michael LaCount

Added tau_up/dn implementation

parent 551dfd5f
......@@ -124,7 +124,6 @@ void ChargeDensity::update_density(void)
{
assert(rhor.size() == wf_.nspin());
const double omega = vbasis_->cell().volume();
for ( int ispin = 0; ispin < wf_.nspin(); ispin++ )
{
assert(rhor[ispin].size() == vft_->np012loc() );
......@@ -231,6 +230,31 @@ void ChargeDensity::update_taur(double* taur) const
}
////////////////////////////////////////////////////////////////////////////////
void ChargeDensity::update_taur(double* taur_up, double* taur_dn) const
{
//!! Work in progress
memset( (void*)taur_up, 0, vft_->np012loc()*sizeof(double) );
memset( (void*)taur_dn, 0, vft_->np012loc()*sizeof(double) );
tmap["update_taur"].start();
for ( int ikp = 0; ikp < wf_.nkp(); ikp++ )
{
wf_.sd(0,ikp)->compute_tau(*ft_[ikp], wf_.weight(ikp), taur_up);
}
for ( int ikp = 0; ikp < wf_.nkp(); ikp++ )
{
wf_.sd(1,ikp)->compute_tau(*ft_[ikp], wf_.weight(ikp), taur_dn);
}
// sum along columns of spincontext
wf_.kpcontext()->dsum('r',vft_->np012loc(),1,&taur_up[0],vft_->np012loc());
wf_.kpcontext()->dsum('r',vft_->np012loc(),1,&taur_dn[0],vft_->np012loc());
tmap["update_taur"].stop();
if ( rhocore_r )
assert(false);
}
////////////////////////////////////////////////////////////////////////////////
double ChargeDensity::total_charge(void) const
{
assert((wf_.nspin()==1)||(wf_.nspin()==2));
......
......@@ -57,6 +57,7 @@ class ChargeDensity
void update_density(void);
void update_rhor(void);
void update_taur(double* taur) const;
void update_taur(double* taur_up, double* taur_dn) const;
const Context& context(void) const { return ctxt_; }
MPI_Comm vcomm(void) const { return vcomm_; }
......
......@@ -28,9 +28,9 @@ class SCANFunctional : public XCFunctional
std::vector<double> exc_, exc_up_, exc_dn_;
std::vector<double> vxc1_, vxc1_up_, vxc1_dn_,
vxc2_, vxc2_upup_, vxc2_updn_, vxc2_dnup_, vxc2_dndn_,
vxc3_;
vxc3_,vxc3_up_,vxc3_dn_;
std::vector<double> grad_rho_[3], grad_rho_up_[3], grad_rho_dn_[3];
std::vector<double> tau_;
std::vector<double> tau_, tau_up_, tau_dn_;
void gPW92(double alpha, double beta0, double beta1, double beta2,
double beta3, double beta4, double rtrs, double *gg, double *dgdrs);
......@@ -39,9 +39,9 @@ class SCANFunctional : public XCFunctional
double *vxc1, double *vxc2, double *vxc3);
void excSCAN_sp(double rho_up, double rho_dn, double grad_up, double grad_dn,
double grad, double tau, double *exc_up, double *exc_dn, double *vxc1_up,
double *vxc1_dn, double *vxc2_upup, double *vxc2_dndn, double *vxc2_updn,
double *vxc2_dnup, double *vxc3);
double grad, double tau_up, double tau_dn, double *exc_up, double *exc_dn,
double *vxc1_up, double *vxc1_dn, double *vxc2_upup, double *vxc2_dndn,
double *vxc2_updn, double *vxc2_dnup, double *vxc3_up, double *vxc3_dn);
public:
......
......@@ -65,11 +65,11 @@ class XCFunctional
const double *rho, *rho_up, *rho_dn;
double *grad_rho[3], *grad_rho_up[3], *grad_rho_dn[3];
double *tau;
double *tau, *tau_up, *tau_dn;
double *exc, *exc_up, *exc_dn;
double *vxc1, *vxc1_up, *vxc1_dn;
double *vxc2, *vxc2_upup, *vxc2_dndn, *vxc2_updn, *vxc2_dnup;
double *vxc3;
double *vxc3,*vxc3_up,*vxc3_dn;
virtual bool isGGA(void) const = 0;
virtual bool isMeta(void) const = 0;
......@@ -83,7 +83,7 @@ class XCFunctional
grad_rho[0] = grad_rho[1] = grad_rho[2] = 0;
grad_rho_up[0] = grad_rho_up[1] = grad_rho_up[2] = 0;
grad_rho_dn[0] = grad_rho_dn[1] = grad_rho_dn[2] = 0;
tau = 0;
tau = tau_up = tau_dn = 0;
exc = exc_up = exc_dn = 0;
vxc1 = vxc1_up = vxc1_dn = 0;
vxc2 = vxc2_upup = vxc2_dndn = vxc2_updn = vxc2_dnup = 0;
......
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