Commit 7848b4e5 by Francois Gygi

Fixed bug #27


git-svn-id: http://qboxcode.org/svn/qb/trunk@247 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 2222cb38
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// NonLocalPotential.C // NonLocalPotential.C
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Id: NonLocalPotential.C,v 1.12 2004-08-11 17:56:24 fgygi Exp $ // $Id: NonLocalPotential.C,v 1.13 2004-08-18 23:58:56 fgygi Exp $
#include "NonLocalPotential.h" #include "NonLocalPotential.h"
#include "blas.h" #include "blas.h"
...@@ -1067,7 +1067,8 @@ double NonLocalPotential::energy(bool compute_hpsi, SlaterDet& dsd, ...@@ -1067,7 +1067,8 @@ double NonLocalPotential::energy(bool compute_hpsi, SlaterDet& dsd,
const int nbs = fnl.nbs(lj); const int nbs = fnl.nbs(lj);
for ( int ii=0; ii < mbs; ii++) for ( int ii=0; ii < mbs; ii++)
{ {
const int ipr = ii / nalocmax[is]; assert(mbs%npr[is]==0);
const int ipr = ii / (mbs/npr[is]);
const double fac = wt[is][ipr] * omega_inv; const double fac = wt[is][ipr] * omega_inv;
for ( int jj=0; jj < nbs; jj++) for ( int jj=0; jj < nbs; jj++)
{ {
...@@ -1180,7 +1181,11 @@ double NonLocalPotential::energy(bool compute_hpsi, SlaterDet& dsd, ...@@ -1180,7 +1181,11 @@ double NonLocalPotential::energy(bool compute_hpsi, SlaterDet& dsd,
const int nbs = fnl.nbs(lj); const int nbs = fnl.nbs(lj);
for ( int ii=0; ii < mbs; ii++) for ( int ii=0; ii < mbs; ii++)
{ {
const int ia_local = ii % nalocmax[is]; assert(mbs%npr[is]==0);
// mbs/npr[is] is the size of the ipr block
// mbs/npr[is] = nalocmax[is] on most tasks
// but possibly less on the last process row
const int ia_local = ii % ( mbs / npr[is] );
// ia_global = ia_local + myrow * nalocmax[is] // ia_global = ia_local + myrow * nalocmax[is]
const int ia_global = ia_local + ia_first; const int ia_global = ia_local + ia_first;
for ( int jj=0; jj < nbs; jj++) for ( int jj=0; jj < nbs; jj++)
...@@ -1190,6 +1195,7 @@ double NonLocalPotential::energy(bool compute_hpsi, SlaterDet& dsd, ...@@ -1190,6 +1195,7 @@ double NonLocalPotential::energy(bool compute_hpsi, SlaterDet& dsd,
const double facn = 2.0 * occ[nglobal]; const double facn = 2.0 * occ[nglobal];
const int iii = ii+li*mb; const int iii = ii+li*mb;
const int jjj = jj+lj*nb; const int jjj = jj+lj*nb;
assert(3*ia_global+j < 3*na[is]);
tmpfion[3*ia_global+j] -= facn * tmpfion[3*ia_global+j] -= facn *
f[iii+mloc*jjj] * df[iii+mloc*jjj]; f[iii+mloc*jjj] * df[iii+mloc*jjj];
} }
...@@ -1368,7 +1374,11 @@ double NonLocalPotential::energy(bool compute_hpsi, SlaterDet& dsd, ...@@ -1368,7 +1374,11 @@ double NonLocalPotential::energy(bool compute_hpsi, SlaterDet& dsd,
const int nbs = fnl.nbs(lj); const int nbs = fnl.nbs(lj);
for ( int ii=0; ii < mbs; ii++) for ( int ii=0; ii < mbs; ii++)
{ {
const int ipr = ii / nalocmax[is]; assert(mbs%npr[is]==0);
// mbs/npr[is] is the size of the ipr block
// mbs/npr[is]==nalocmax[is] on most tasks
// but may be smaller on the last process row
const int ipr = ii / (mbs/npr[is]);
for ( int jj=0; jj < nbs; jj++) for ( int jj=0; jj < nbs; jj++)
{ {
// global index: i(li,ii), j(lj,jj) // global index: i(li,ii), j(lj,jj)
......
...@@ -7,6 +7,13 @@ preferrable to use a single-column context when nst is small to avoid ...@@ -7,6 +7,13 @@ preferrable to use a single-column context when nst is small to avoid
memory problems. memory problems.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
rel1_19_0 2004-08-18
Fixed bug #27: overrun of variable tmpfion in NonLocalPotential.C is due to
incorrect index calculation in situations where na[is] % (ntasks/nrowmax) != 0.
This is the case for (CdSe)_110 on 128 tasks, nrowmax=32, since na[is]/4 = 27.5.
Note: bug #27 does not affect calculations with a single non-local projector
(npr[is]==1).
--------------------------------------------------------------------------------
rel1_18_0 2004-08-13 rel1_18_0 2004-08-13
Corrected LDAFunctional.C: incorrect use of Perdew-Zunger caused small Corrected LDAFunctional.C: incorrect use of Perdew-Zunger caused small
differences (~1.e-3 a.u.) in total energy when compared to other codes. differences (~1.e-3 a.u.) in total energy when compared to other codes.
...@@ -15,7 +22,7 @@ was incorrect. Instead, the constants C and D must be adjusted to ensure ...@@ -15,7 +22,7 @@ was incorrect. Instead, the constants C and D must be adjusted to ensure
continuity of Ec and its derivative at rs=1. continuity of Ec and its derivative at rs=1.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
rel1_17_0 2004-08-11 rel1_17_0 2004-08-11
Fixed bug 27: buffer overrun in Context::string_bcast. Fixed buffer overrun in Context::string_bcast. (note: bug #27 is not fixed).
Fixed bug 26: inconsistent qbox xmlns namespace in species file and qbox output. Fixed bug 26: inconsistent qbox xmlns namespace in species file and qbox output.
Modified qb.C: use new qbox_xmlns() function to print qbox XML namespace. Modified qb.C: use new qbox_xmlns() function to print qbox XML namespace.
EnergyFunctional.C:909: change lda argument to 14. This was done automatically EnergyFunctional.C:909: change lda argument to 14. This was done automatically
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
// release.C // release.C
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Id: release.C,v 1.5 2004-08-14 00:19:23 fgygi Exp $ // $Id: release.C,v 1.6 2004-08-18 23:58:56 fgygi Exp $
#include "release.h" #include "release.h"
std::string release(void) std::string release(void)
{ {
return std::string("1.18.0"); return std::string("1.19.0e");
} }
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