Commit 0e1b782c by Francois Gygi

kpoints modifs


git-svn-id: http://qboxcode.org/svn/qb/trunk@521 cba15fb0-1239-40c8-b417-11db7ca47a34
parent d75be547
......@@ -3,7 +3,7 @@
// Basis.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Basis.C,v 1.14 2007-10-19 16:24:04 fgygi Exp $
// $Id: Basis.C,v 1.15 2007-10-19 17:10:58 fgygi Exp $
#include "Basis.h"
#include "Context.h"
......@@ -45,14 +45,16 @@ struct BasisImpl
vector<double> g_; // norm of g vectors g[localsize]
vector<double> kpg_; // norm of g vectors g[localsize]
vector<double> gi_; // inverse norm of g vectors gi[localsize]
vector<double> kpgi_; // inverse norm of k+g vectors kpgi[localsize]
vector<double> g2_; // 2-norm of g vectors g2[localsize]
vector<double> kpg2_; // 2-norm of g vectors g2[localsize]
vector<double> g2i_; // inverse square norm of g vectors g2i[localsize]
vector<double> kpg2i_; // inverse square norm of k+g vectors kpg2i[localsize]
int np_[3]; // cache for the function np
vector<double> gx_; // g vectors components gx[j*localsize+i], j=0,1,2
vector<double> gx2_; // g vectors components^2 gx2[j*localsize+i], j=0,1,2
vector<double> kpgx_; // k+g vectors components kpgx[j*localsize+i], j=0,1,2
vector<int> isort_loc; // index array to access locally sorted vectors
// g2_[isort_loc[i]] < g2_[isort_loc[j]] if i < j
// kpg2_[isort_loc[i]] < kpg2_[isort_loc[j]] if i < j
bool real_; // true if k=0
bool resize(const UnitCell& cell, const UnitCell& refcell, double ecut);
......@@ -122,24 +124,28 @@ int Basis::idx(int i) const { return pimpl_->idx_[i]; }
double Basis::g(int i) const { return pimpl_->g_[i]; }
double Basis::kpg(int i) const { return pimpl_->kpg_[i]; }
double Basis::gi(int i) const { return pimpl_->gi_[i]; }
double Basis::kpgi(int i) const { return pimpl_->kpgi_[i]; }
double Basis::g2(int i) const { return pimpl_->g2_[i]; }
double Basis::kpg2(int i) const { return pimpl_->kpg2_[i]; }
double Basis::g2i(int i) const { return pimpl_->g2i_[i]; }
double Basis::kpg2i(int i) const { return pimpl_->kpg2i_[i]; }
double Basis::gx(int i) const { return pimpl_->gx_[i]; }
double Basis::gx2(int i) const { return pimpl_->gx2_[i]; }
double Basis::kpgx(int i) const { return pimpl_->kpgx_[i]; }
int Basis::isort(int i) const { return pimpl_->isort_loc[i]; }
const int* Basis::idx_ptr(void) const { return &(pimpl_->idx_[0]); }
const double* Basis::g_ptr(void) const { return &(pimpl_->g_[0]); }
const double* Basis::kpg_ptr(void) const { return &(pimpl_->kpg_[0]); }
const double* Basis::gi_ptr(void) const { return &(pimpl_->gi_[0]); }
const double* Basis::kpgi_ptr(void) const { return &(pimpl_->kpgi_[0]); }
const double* Basis::g2_ptr(void) const { return &(pimpl_->g2_[0]); }
const double* Basis::kpg2_ptr(void) const { return &(pimpl_->kpg2_[0]); }
const double* Basis::g2i_ptr(void) const { return &(pimpl_->g2i_[0]); }
const double* Basis::kpg2i_ptr(void) const { return &(pimpl_->kpg2i_[0]); }
const double* Basis::gx_ptr(int j) const
{ return &(pimpl_->gx_[j*pimpl_->localsize_[pimpl_->myrow_]]); }
const double* Basis::gx2_ptr(int j) const
{ return &(pimpl_->gx2_[j*pimpl_->localsize_[pimpl_->myrow_]]); }
const double* Basis::kpgx_ptr(int j) const
{ return &(pimpl_->kpgx_[j*pimpl_->localsize_[pimpl_->myrow_]]); }
////////////////////////////////////////////////////////////////////////////////
inline bool factorizable(int n)
......@@ -345,11 +351,13 @@ bool BasisImpl::resize(const UnitCell& cell, const UnitCell& refcell,
g_.resize(localsize_[myrow_]);
kpg_.resize(localsize_[myrow_]);
gi_.resize(localsize_[myrow_]);
kpgi_.resize(localsize_[myrow_]);
g2_.resize(localsize_[myrow_]);
kpg2_.resize(localsize_[myrow_]);
g2i_.resize(localsize_[myrow_]);
kpg2i_.resize(localsize_[myrow_]);
gx_.resize(3*localsize_[myrow_]);
gx2_.resize(3*localsize_[myrow_]);
kpgx_.resize(3*localsize_[myrow_]);
isort_loc.resize(localsize_[myrow_]);
return true;
}
......@@ -654,7 +662,7 @@ bool BasisImpl::resize(const UnitCell& cell, const UnitCell& refcell,
}
}
// local arrays idx, g, gi, g2i, g2, gx, gx2
// local arrays idx, g, gi, g2i, g2, gx
idx_.resize(3*localsize_[myrow_]);
int i = 0;
for ( int irod = 0; irod < nrod_loc_[myrow_]; irod++ )
......@@ -672,11 +680,13 @@ bool BasisImpl::resize(const UnitCell& cell, const UnitCell& refcell,
g_.resize(localsize_[myrow_]);
kpg_.resize(localsize_[myrow_]);
gi_.resize(localsize_[myrow_]);
kpgi_.resize(localsize_[myrow_]);
g2_.resize(localsize_[myrow_]);
kpg2_.resize(localsize_[myrow_]);
g2i_.resize(localsize_[myrow_]);
kpg2i_.resize(localsize_[myrow_]);
gx_.resize(3*localsize_[myrow_]);
gx2_.resize(3*localsize_[myrow_]);
kpgx_.resize(3*localsize_[myrow_]);
isort_loc.resize(localsize_[myrow_]);
update_g();
......@@ -689,7 +699,7 @@ bool BasisImpl::resize(const UnitCell& cell, const UnitCell& refcell,
////////////////////////////////////////////////////////////////////////////////
void BasisImpl::update_g(void)
{
// compute the values of g, kpg, gi, g2i, g2, kpg2, gx, gx2
// compute the values of g, kpg, gi, g2i, g2, kpg2, gx
// N.B. use the values of cell (not defcell)
const int locsize = localsize_[myrow_];
......@@ -706,6 +716,9 @@ void BasisImpl::update_g(void)
gx_[i] = gt.x;
gx_[locsize+i] = gt.y;
gx_[locsize+locsize+i] = gt.z;
kpgx_[i] = kpgt.x;
kpgx_[locsize+i] = kpgt.y;
kpgx_[locsize+locsize+i] = kpgt.z;
g2_[i] = norm(gt);
g_[i] = sqrt( g2_[i] );
......@@ -714,7 +727,9 @@ void BasisImpl::update_g(void)
kpg_[i] = sqrt( kpg2_[i] );
gi_[i] = g_[i] > 0.0 ? 1.0 / g_[i] : 0.0;
kpgi_[i] = kpg_[i] > 0.0 ? 1.0 / kpg_[i] : 0.0;
g2i_[i] = gi_[i] * gi_[i];
kpg2i_[i] = kpgi_[i] * kpgi_[i];
isort_loc[i] = i;
}
......
......@@ -3,7 +3,7 @@
// Basis.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Basis.h,v 1.7 2007-10-19 16:24:04 fgygi Exp $
// $Id: Basis.h,v 1.8 2007-10-19 17:10:58 fgygi Exp $
#ifndef BASIS_H
#define BASIS_H
......@@ -63,11 +63,13 @@ class Basis
double g(int i) const; // norm of g vectors g[i]
double kpg(int i) const; // norm of k+g vectors kpg[i]
double gi(int i) const; // inverse norm of g vectors gi[i]
double kpgi(int i) const; // inverse norm of k+g vectors kpgi[i]
double g2(int i) const; // 2-norm of g vectors g2[i]
double kpg2(int i) const; // 2-norm of k+g vectors kpg[i]
double g2i(int i) const; // inverse square norm of g g2i[i]
double kpg2i(int i) const; // inverse square norm of k+g kpg2i[i]
double gx(int i) const; // g vectors gx[i+localsize*j],j=0,1,2
double gx2(int i) const; // g vectors components^2 gx2[i+localsize*j]
double kpgx(int i) const; // k+g vectors kpgx[i+localsize*j],j=0,1,2
int isort(int i) const; // index of vectors locally sorted by norm
......@@ -75,11 +77,13 @@ class Basis
const double* g_ptr(void) const;
const double* kpg_ptr(void) const;
const double* gi_ptr(void) const;
const double* kpgi_ptr(void) const;
const double* g2_ptr(void) const;
const double* kpg2_ptr(void) const;
const double* g2i_ptr(void) const;
const double* kpg2i_ptr(void) const;
const double* gx_ptr(int j) const;
const double* gx2_ptr(int j) const;
const double* kpgx_ptr(int j) const;
double memsize(void) const;
double localmemsize(void) const;
......
......@@ -3,7 +3,7 @@
// ChargeDensity.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: ChargeDensity.C,v 1.12 2007-10-19 16:24:04 fgygi Exp $
// $Id: ChargeDensity.C,v 1.13 2007-10-19 17:10:58 fgygi Exp $
#include "ChargeDensity.h"
#include "Basis.h"
......@@ -44,11 +44,18 @@ wf_(wf), vcontext_(wf.sd(0,0)->basis().context())
{
for ( int ikp = 0; ikp < wf.nkp(); ikp++ )
{
if ( wf.sd(ispin,ikp) != 0 )
ft_[ikp] =
new FourierTransform(wf.sd(ispin,ikp)->basis(),np0v,np1v,np2v);
else
ft_[ikp] = 0;
// check that twice the wf basis fits into np0v,np1v,np2v at each kpoint
const Basis& b = wf.sd(ispin,ikp)->basis();
#if DEBUG
cout << " ChargeDensity: ikp=" << ikp << " basis: " << endl;
cout << " idxmin: " << b.idxmin(0) << "/" << b.idxmin(1)
<< "/" << b.idxmin(2) << endl;
cout << " idxmax: " << b.idxmax(0) << "/" << b.idxmax(1)
<< "/" << b.idxmax(2) << endl;
cout << " ftgrid: " << np0v << "/" << np1v
<< "/" << np2v << endl;
#endif
ft_[ikp] = new FourierTransform(b,np0v,np1v,np2v);
}
}
}
......@@ -85,36 +92,31 @@ void ChargeDensity::update_density(void)
for ( int ispin = 0; ispin < wf_.nspin(); ispin++ )
{
if ( wf_.spincontext(ispin)->active())
{
assert(rhor[ispin].size() == vft_->np012loc() );
assert(rhotmp.size() == vft_->np012loc() );
const int rhor_size = rhor[ispin].size();
tmap["charge_compute"].start();
double *p = &rhor[ispin][0];
for ( int i = 0; i < rhor_size; i++ )
p[i] = 0.0;
for ( int ikp = 0; ikp < wf_.nkp(); ikp++ )
{
if ( wf_.sd(ispin,ikp) != 0 && wf_.sdcontext(ispin,ikp)->active() )
{
wf_.sd(ispin,ikp)->compute_density(*ft_[ikp],
wf_.weight(ikp), &rhor[ispin][0]);
}
}
tmap["charge_compute"].stop();
// sum across rows of spincontext[ispin] context
// sum over kpoints: sum along rows of kpcontext
tmap["charge_rowsum"].start();
wf_.spincontext(ispin)->dsum('r',vft_->np012loc(),1,
wf_.kpcontext()->dsum('r',vft_->np012loc(),1,
&rhor[ispin][0],vft_->np012loc());
tmap["charge_rowsum"].stop();
// check integral of charge density
// compute Fourier coefficients of the charge density
double sum = 0.0;
const int rhor_size = rhor[ispin].size();
const double *const prhor = &rhor[ispin][0];
tmap["charge_integral"].start();
#pragma ivdep
for ( int i = 0; i < rhor_size; i++ )
{
const double prh = prhor[i];
......@@ -123,7 +125,8 @@ void ChargeDensity::update_density(void)
}
sum *= omega / vft_->np012();
wf_.spincontext(ispin)->dsum('c',1,1,&sum,1);
// sum on all indices except spin: sum along columns of spincontext
wf_.spincontext()->dsum('c',1,1,&sum,1);
tmap["charge_integral"].stop();
if ( ctxt_.onpe0() )
{
......@@ -137,7 +140,6 @@ void ChargeDensity::update_density(void)
vft_->forward(&rhotmp[0],&rhog[ispin][0]);
tmap["charge_vft"].stop();
}
}
}
////////////////////////////////////////////////////////////////////////////////
void ChargeDensity::update_rhor(void)
......@@ -150,8 +152,6 @@ void ChargeDensity::update_rhor(void)
for ( int ispin = 0; ispin < wf_.nspin(); ispin++ )
{
if ( wf_.spincontext(ispin)->active())
{
assert(rhor[ispin].size() == vft_->np012loc() );
assert(rhotmp.size() == vft_->np012loc() );
......@@ -159,13 +159,11 @@ void ChargeDensity::update_rhor(void)
const int rhor_size = rhor[ispin].size();
double *const prhor = &rhor[ispin][0];
#pragma ivdep
for ( int i = 0; i < rhor_size; i++ )
{
prhor[i] = rhotmp[i].real() * omega_inv;
}
}
}
}
......@@ -3,7 +3,7 @@
// EnergyFunctional.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: EnergyFunctional.C,v 1.25 2007-10-19 16:24:04 fgygi Exp $
// $Id: EnergyFunctional.C,v 1.26 2007-10-19 17:10:58 fgygi Exp $
#include "EnergyFunctional.h"
#include "Sample.h"
......@@ -90,7 +90,11 @@ EnergyFunctional::EnergyFunctional(const Sample& s, const ChargeDensity& cd)
}
xcp = new XCPotential(cd_,s_.ctrl.xc);
nlp = new NonLocalPotential(s_.atoms, *wf.sd(0,0));
nlp.resize(wf.nkp());
for ( int ikp = 0; ikp < wf.nkp(); ikp++ )
{
nlp[ikp] = new NonLocalPotential(s_.atoms, *wf.sd(0,ikp));
}
vion_local_g.resize(ngloc);
dvion_local_g.resize(ngloc);
......@@ -133,18 +137,12 @@ EnergyFunctional::EnergyFunctional(const Sample& s, const ChargeDensity& cd)
for ( int ikp = 0; ikp < wf.nkp(); ikp++ )
{
cfp[ikp] = 0;
bool create_cfp = false;
for ( int ispin = 0; ispin < wf.nspin(); ispin++ )
create_cfp |= wf.sd(ispin,ikp) != 0 && wf.sdcontext(ispin,ikp)->active();
if ( create_cfp )
{
const double facs = 2.0;
const double sigmas = 0.5;
cfp[ikp] =
new ConfinementPotential(s_.ctrl.ecuts,facs,sigmas,
wf.sd(0,ikp)->basis());
}
}
sf.init(tau0,*vbasis_);
......@@ -158,7 +156,11 @@ EnergyFunctional::EnergyFunctional(const Sample& s, const ChargeDensity& cd)
EnergyFunctional::~EnergyFunctional(void)
{
delete xcp;
delete nlp;
for ( int ikp = 0; ikp < s_.wf.nkp(); ikp++ )
{
delete cfp[ikp];
delete nlp[ikp];
}
for ( TimerMap::iterator i = tmap.begin(); i != tmap.end(); i++ )
{
......@@ -327,17 +329,11 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
for ( int ikp = 0; ikp < wf.nkp(); ikp++ )
{
const double weight = wf.weight(ikp);
if ( wf.sd(ispin,ikp) != 0 && wf.sdcontext(ispin,ikp)->active() )
{
const SlaterDet& sd = *(wf.sd(ispin,ikp));
const Basis& wfbasis = wf.sd(ispin,ikp)->basis();
const Basis& wfbasis = sd.basis();
const D3vector kp = wfbasis.kpoint();
// factor fac in next lines: 2.0 for G and -G (if basis is real) and
// 0.5 from 1/(2m)
// note: if basis is real, the factor of 2.0 for G=0 need not be
// corrected since G^2 = 0
// Note: the calculation of fac in next line is valid only for nkp=1
// If k!=0, kpg2(0) !=0 and the ig=0 coefficient must be dealt with
// separately
const double fac = wfbasis.real() ? 1.0 : 0.5;
const ComplexMatrix& c = sd.c();
const Context& sdctxt = sd.context();
......@@ -363,11 +359,10 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
}
// accumulate contributions to ekin,econf,sigma_ekin,sigma_econf in tsum
// Note: next lines to be changed to kpg_ptr for nkp>1
const double *const g2 = wfbasis.g2_ptr();
const double *const g_x = wfbasis.gx_ptr(0);
const double *const g_y = wfbasis.gx_ptr(1);
const double *const g_z = wfbasis.gx_ptr(2);
const double *const kpg2 = wfbasis.kpg2_ptr();
const double *const kpg_x = wfbasis.kpgx_ptr(0);
const double *const kpg_y = wfbasis.kpgx_ptr(1);
const double *const kpg_z = wfbasis.kpgx_ptr(2);
tsum = 0.0;
for ( int ig = 0; ig < ngwloc; ig++ )
......@@ -375,22 +370,22 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
const double psi2s = psi2sum[ig];
// tsum[0]: ekin partial sum
tsum[0] += psi2s * g2[ig];
tsum[0] += psi2s * kpg2[ig];
if ( compute_stress )
{
const double tgx = g_x[ig];
const double tgy = g_y[ig];
const double tgz = g_z[ig];
const double tkpgx = kpg_x[ig];
const double tkpgy = kpg_y[ig];
const double tkpgz = kpg_z[ig];
const double fac_ekin = 2.0 * psi2s;
tsum[1] += fac_ekin * tgx * tgx;
tsum[2] += fac_ekin * tgy * tgy;
tsum[3] += fac_ekin * tgz * tgz;
tsum[4] += fac_ekin * tgx * tgy;
tsum[5] += fac_ekin * tgy * tgz;
tsum[6] += fac_ekin * tgx * tgz;
tsum[1] += fac_ekin * tkpgx * tkpgx;
tsum[2] += fac_ekin * tkpgy * tkpgy;
tsum[3] += fac_ekin * tkpgz * tkpgz;
tsum[4] += fac_ekin * tkpgx * tkpgy;
tsum[5] += fac_ekin * tkpgy * tkpgz;
tsum[6] += fac_ekin * tkpgx * tkpgz;
}
// tsum[0-6] contains the contributions to
......@@ -409,17 +404,17 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
if ( compute_stress )
{
const double tgx = g_x[ig];
const double tgy = g_y[ig];
const double tgz = g_z[ig];
const double tkpgx = kpg_x[ig];
const double tkpgy = kpg_y[ig];
const double tkpgz = kpg_z[ig];
const double fac_econf = psi2s * dfstress[ig];
tsum[8] += fac_econf * tgx * tgx;
tsum[9] += fac_econf * tgy * tgy;
tsum[10] += fac_econf * tgz * tgz;
tsum[11] += fac_econf * tgx * tgy;
tsum[12] += fac_econf * tgy * tgz;
tsum[13] += fac_econf * tgx * tgz;
tsum[8] += fac_econf * tkpgx * tkpgx;
tsum[9] += fac_econf * tkpgy * tkpgy;
tsum[10] += fac_econf * tkpgz * tkpgz;
tsum[11] += fac_econf * tkpgx * tkpgy;
tsum[12] += fac_econf * tkpgy * tkpgz;
tsum[13] += fac_econf * tkpgx * tkpgz;
}
// tsum[7-13] contains the contributions to
// econf,sigma_econf from vector ig
......@@ -427,7 +422,6 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
}
sum += weight * tsum;
}
} // ikp
} // ispin
......@@ -563,10 +557,13 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
}
// Non local energy
// Note: next line for nspin==0, nkp==0 only
tmap["nonlocal"].start();
enl_ = nlp->energy(compute_hpsi,*dwf.sd(0,0),
// modify next loop to span only local ikp
enl_ = 0.0;
for ( int ikp = 0; ikp < wf.nkp(); ikp++ )
enl_ += wf.weight(ikp) * nlp[ikp]->energy(compute_hpsi,*dwf.sd(0,ikp),
compute_forces, fion, compute_stress, sigma_enl);
// add here sum of enl across rows of kpcontext
tmap["nonlocal"].stop();
ecoul_ = ehart_ + esr_ - eself_;
......@@ -587,8 +584,6 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
{
for ( int ikp = 0; ikp < wf.nkp(); ikp++ )
{
if ( wf.sd(ispin,ikp) != 0 )
{
const SlaterDet& sd = *(wf.sd(ispin,ikp));
SlaterDet& sdp = *(dwf.sd(ispin,ikp));
const ComplexMatrix& c = sd.c();
......@@ -603,7 +598,6 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
{
for ( int n = 0; n < sd.nstloc(); n++ )
{
assert(cfp[ikp]!=0); // cfp must be non-zero if this ikp active
const valarray<double>& fstress = cfp[ikp]->fstress();
for ( int ig = 0; ig < ngwloc; ig++ )
{
......@@ -623,7 +617,6 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
}
}
sd.rs_mul_add(*ft[ikp], &v_r[ispin][0], sdp);
} // if sd(ispin,ikp) != 0
}
}
tmap["hpsi"].stop();
......@@ -711,6 +704,7 @@ double EnergyFunctional::energy(bool compute_hpsi, Wavefunction& dwf,
sigma_ehart + sigma_exc + sigma_esr;
if ( debug_stress && s_.ctxt_.onpe0() )
{
const double gpa = 29421.5;
cout.setf(ios::fixed,ios::floatfield);
cout.setf(ios::right,ios::adjustfield);
cout << setprecision(8);
......@@ -893,17 +887,12 @@ void EnergyFunctional::cell_moved(void)
}
}
// Update confinement potentials
// Update confinement potentials and non-local potentials
for ( int ikp = 0; ikp < wf.nkp(); ikp++ )
{
if ( cfp[ikp] != 0 )
{
cfp[ikp]->update();
nlp[ikp]->update_twnl();
}
}
// update non-local potential
nlp->update_twnl();
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -3,7 +3,7 @@
// EnergyFunctional.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: EnergyFunctional.h,v 1.16 2007-10-19 16:24:04 fgygi Exp $
// $Id: EnergyFunctional.h,v 1.17 2007-10-19 17:10:58 fgygi Exp $
#ifndef ENERGYFUNCTIONAL_H
#define ENERGYFUNCTIONAL_H
......@@ -40,7 +40,7 @@ class EnergyFunctional
std::vector<FourierTransform*> ft;
StructureFactor sf;
XCPotential* xcp;
NonLocalPotential* nlp;
std::vector<NonLocalPotential*> nlp; // nlp[ikp]
std::vector<ConfinementPotential*> cfp; // cfp[ikp]
std::vector<std::vector<double> > vps, dvps, rhops;
......
......@@ -3,7 +3,7 @@
// MDWavefunctionStepper.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: MDWavefunctionStepper.C,v 1.8 2007-10-19 16:24:04 fgygi Exp $
// $Id: MDWavefunctionStepper.C,v 1.9 2007-10-19 17:12:02 fgygi Exp $
#include "MDWavefunctionStepper.h"
#include "Wavefunction.h"
......@@ -28,10 +28,6 @@ void MDWavefunctionStepper::update(Wavefunction& dwf)
{
for ( int ikp = 0; ikp < wf_.nkp(); ikp++ )
{
if ( wf_.sd(ispin,ikp) != 0 )
{
if ( wf_.sdcontext(ispin,ikp)->active() )
{
tmap_["md_update_wf"].start();
// Verlet update of wf
// cp = c + (c - cm) - dt2/m * hpsi
......@@ -76,8 +72,6 @@ void MDWavefunctionStepper::update(Wavefunction& dwf)
tmap_["riccati"].stop();
}
}
}
}
ekin_em_ = ekin_ep_;
ekin_ep_ = ekin_eh();
}
......@@ -96,10 +90,6 @@ void MDWavefunctionStepper::compute_wfm(Wavefunction& dwf)
{
for ( int ikp = 0; ikp < wf_.nkp(); ikp++ )
{
if ( wf_.sd(ispin,ikp) != 0 )
{
if ( wf_.sdcontext(ispin,ikp)->active() )
{
SlaterDet* sd = wf_.sd(ispin,ikp);
double* cptr = (double*) sd->c().valptr();
......@@ -135,8 +125,6 @@ void MDWavefunctionStepper::compute_wfm(Wavefunction& dwf)
tmap_["riccati"].stop();
}
}
}
}
ekin_em_ = 0.0;
ekin_ep_ = ekin_eh();
// Note: ekin_ep is a first-order approximation of ekin_e using wf and wfm
......@@ -154,10 +142,6 @@ void MDWavefunctionStepper::compute_wfv(Wavefunction& dwf)
{
for ( int ikp = 0; ikp < wf_.nkp(); ikp++ )
{
if ( wf_.sd(ispin,ikp) != 0 )
{
if ( wf_.sdcontext(ispin,ikp)->active() )
{
// compute final velocity wfv
// v = ( c - cm ) / dt - 0.5 * dt/m * hpsi
......@@ -221,8 +205,6 @@ void MDWavefunctionStepper::compute_wfv(Wavefunction& dwf)
// Note: *wfv_ now contains the wavefunction velocity
}
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
......@@ -236,10 +218,6 @@ double MDWavefunctionStepper::ekin_eh(void)
{
for ( int ikp = 0; ikp < wf_.nkp(); ikp++ )
{
if ( wf_.sd(ispin,ikp) != 0 )
{
if ( wf_.sdcontext(ispin,ikp)->active() )
{
SlaterDet* sd = wf_.sd(ispin,ikp);
double* cptr = (double*) sd->c().valptr();
double* cptrm = (double*) wfv_->sd(ispin,ikp)->c().valptr();
......@@ -279,8 +257,6 @@ double MDWavefunctionStepper::ekin_eh(void)
}
}
}
}
}
wf_.context().dsum(1,1,&ekin_e,1);
tmap_["ekin_e"].stop();
return ekin_e;
......
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