Merge branch 'develop' of https://github.com/QMCPACK/qmcpack into dev

This commit is contained in:
Jaron Krogel 2017-01-20 11:26:04 -05:00
commit 3967fcd3ee
19 changed files with 77 additions and 69 deletions

View File

@ -151,11 +151,7 @@ INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
CHECK_FUNCTION_EXISTS(sincos HAVE_SINCOS)
CHECK_FUNCTION_EXISTS(round HAVE_STD_ROUND)
CHECK_FUNCTION_EXISTS(floor HAVE_FLOOR)
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
CHECK_FUNCTION_EXISTS(pow HAVE_POW)
CHECK_FUNCTION_EXISTS(sqrt HAVE_SQRT)
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)

View File

@ -2,7 +2,7 @@
IF(NOT QMC_CUDA AND NOT QMC_COMPLEX)
LIST(APPEND H2O_SCALARS "totenergy" "-17.25078 .006") # total energy
LIST(APPEND H2O_SCALARS "totenergy" "-17.26138 .006") # total energy
QMC_RUN_AND_CHECK(example_H2O
"${CMAKE_SOURCE_DIR}/examples/molecules/H2O"

View File

@ -20,6 +20,8 @@
#ifndef QMCPLUSPLUS_GRIDBC_HANDLER_H
#define QMCPLUSPLUS_GRIDBC_HANDLER_H
#include <config/stdlib/math.h>
namespace qmcplusplus
{
@ -84,15 +86,8 @@ struct GridBCond
{
if(periodic)
{
#if defined(HAVE_STD_ROUND)
T x1=x*OneOverL;
x=L*(x1-round(x1));
#else
//T x1=std::fmod(x*OneOverL,1.0);
T dmy;
T x1=std::modf(x*OneOverL,&dmy);
x=L*(x1-static_cast<int>(2.0*x1));
#endif
}
}

View File

@ -4,7 +4,6 @@
// Put tests for src/config/stdlib functions here
// Ensure that the backup "round" function is always defined
#undef HAVE_STD_ROUND
#include <config/stdlib/math.h>

View File

@ -329,7 +329,7 @@ void QMCUpdateBase::recomputePsi(WalkerIter_t it, WalkerIter_t it_end)
Walker_t& thisWalker(**it);
Walker_t::Buffer_t& w_buffer(thisWalker.DataSet);
// recomputing the determinants does not require distance tables. Thus choose false.
W.loadWalker(thisWalker,false);
W.loadWalker(thisWalker,Psi.needs_distance_table_for_recompute());
Psi.copyFromBuffer(W,w_buffer);
Psi.recompute(W);
//RealType logpsi=Psi.updateBuffer(W,w_buffer,false);

View File

@ -269,8 +269,13 @@ void VMCSingleOMP::resetRun()
if(movers_created)
{
size_t before=qmc_common.memory_allocated;
app_log() << " Anonymous Buffer size per walker " << W[0]->DataSet.size() << std::endl;
qmc_common.memory_allocated+=W.getActiveWalkers()*W[0]->DataSet.size()*sizeof(OHMMS_PRECISION);
app_log() << " Anonymous Buffer size per walker : "
<< W[0]->DataSet.size() << " in base precision, "
#ifdef MIXED_PRECISION
<< W[0]->DataSet.size_DP() << " in full precision, "
#endif
<< "in total " << W[0]->DataSet.byteSize() << " bytes." << std::endl;
qmc_common.memory_allocated+=W.getActiveWalkers()*W[0]->DataSet.byteSize();
qmc_common.print_memory_change("VMCSingleOMP::resetRun",before);
}
// //JNKIM: THIS IS BAD AND WRONG

View File

@ -123,7 +123,7 @@ struct CoulombPotential: public QMCHamiltonianBase
{
T q=Z[iat];
for(int nn=M[iat]; nn<M[iat+1]; ++nn)
res+=static_cast<RealType>(q*Z[J[nn]]*d->rinv(nn));
res+=q*Z[J[nn]]*d->rinv(nn);
}
}
return res;
@ -145,7 +145,7 @@ struct CoulombPotential: public QMCHamiltonianBase
{
T q=Za[iat];
for(int nn=M[iat]; nn<M[iat+1]; ++nn)
res+=static_cast<RealType>(q*Zb[J[nn]]*d->rinv(nn));
res+=q*Zb[J[nn]]*d->rinv(nn);
}
}
return res;
@ -159,7 +159,7 @@ struct CoulombPotential: public QMCHamiltonianBase
const int* restrict M=d->M.data();
const int* restrict J=d->J.data();
T res=0.0;
RealType pairpot;
T pairpot;
Array<RealType,1>& Va_samp = *Va_sample;
Va_samp = 0.0;
for(int iat=0; iat<nCenters; ++iat)
@ -167,7 +167,7 @@ struct CoulombPotential: public QMCHamiltonianBase
T q=Z[iat];
for(int nn=M[iat],it=0; nn<M[iat+1]; ++nn,it++)
{
pairpot = static_cast<RealType>(.5*q*Z[J[nn]]*d->rinv(nn));
pairpot = .5*q*Z[J[nn]]*d->rinv(nn);
Va_samp(iat)+=pairpot;
Va_samp(it) +=pairpot;
res += 2.0*pairpot;
@ -201,7 +201,7 @@ struct CoulombPotential: public QMCHamiltonianBase
const int* restrict M=d->M.data();
const int* restrict J=d->J.data();
T res=0.0;
RealType pairpot;
T pairpot;
Array<RealType,1>& Va_samp = *Va_sample;
Array<RealType,1>& Vb_samp = *Vb_sample;
Va_samp = 0.0;
@ -211,18 +211,18 @@ struct CoulombPotential: public QMCHamiltonianBase
T q=Za[iat];
for(int nn=M[iat],it=0; nn<M[iat+1]; ++nn,it++)
{
pairpot = static_cast<RealType>(.5*q*Zb[J[nn]]*d->rinv(nn));
pairpot = .5*q*Zb[J[nn]]*d->rinv(nn);
Va_samp(iat)+=pairpot;
Vb_samp(it) +=pairpot;
res += 2.0*pairpot;
}
}
#if defined(TRACE_CHECK)
RealType Vnow = res;
RealType Vasum = Va_samp.sum();
RealType Vbsum = Vb_samp.sum();
RealType Vsum = Vasum+Vbsum;
RealType Vorig = evaluateAB_orig(d,Za,Zb);
T Vnow = res;
T Vasum = Va_samp.sum();
T Vbsum = Vb_samp.sum();
T Vsum = Vasum+Vbsum;
T Vorig = evaluateAB_orig(d,Za,Zb);
if(std::abs(Vsum-Vnow)>TraceManager::trace_tol)
{
app_log()<<"accumtest: CoulombPotential::evaluateAB()"<< std::endl;
@ -261,7 +261,7 @@ struct CoulombPotential: public QMCHamiltonianBase
{
T q=Z[iat];
for(int nn=M[iat]; nn<M[iat+1]; ++nn)
res+=static_cast<RealType>(q*Z[J[nn]]*d->rinv(nn));
res+=q*Z[J[nn]]*d->rinv(nn);
}
return res;
}
@ -276,7 +276,7 @@ struct CoulombPotential: public QMCHamiltonianBase
{
T q=Za[iat];
for(int nn=M[iat]; nn<M[iat+1]; ++nn)
res+=static_cast<RealType>(q*Zb[J[nn]]*d->rinv(nn));
res+=q*Zb[J[nn]]*d->rinv(nn);
}
return res;
}

View File

@ -101,7 +101,7 @@ HamiltonianFactory::addVHXCPotential(xmlNodePtr cur)
void
HamiltonianFactory::addCoulombPotential(xmlNodePtr cur)
{
typedef QMCTraits::RealType RealType;
typedef QMCHamiltonian::Return_t Return_t;
std::string targetInp(targetPtcl->getName());
std::string sourceInp(targetPtcl->getName());
std::string title("ElecElec"),pbc("yes");
@ -148,14 +148,14 @@ HamiltonianFactory::addCoulombPotential(xmlNodePtr cur)
if(quantum)
targetH->addOperator(new CoulombPotentialAA_CUDA(ptclA,true), title, physical);
else
targetH->addOperator(new CoulombPotential<RealType>(ptclA,0,quantum), title, physical);
targetH->addOperator(new CoulombPotential<Return_t>(ptclA,0,quantum), title, physical);
}
#else
if(applyPBC)
targetH->addOperator(new CoulombPBCAA(*ptclA,quantum,doForces),title,physical);
else
{
targetH->addOperator(new CoulombPotential<RealType>(ptclA,0,quantum), title, physical);
targetH->addOperator(new CoulombPotential<Return_t>(ptclA,0,quantum), title, physical);
}
#endif
}
@ -170,7 +170,7 @@ HamiltonianFactory::addCoulombPotential(xmlNodePtr cur)
if(applyPBC)
targetH->addOperator(new CoulombPBCAB(*ptclA,*targetPtcl),title);
else
targetH->addOperator(new CoulombPotential<RealType>(ptclA,targetPtcl,true),title);
targetH->addOperator(new CoulombPotential<Return_t>(ptclA,targetPtcl,true),title);
#endif
}
}
@ -426,7 +426,7 @@ HamiltonianFactory::addCorePolPotential(xmlNodePtr cur)
//#endif
// } else {
// if(ion->getTotalNum()>1)
// targetH->addOperator(new CoulombPotential<RealType>(ion),hname);
// targetH->addOperator(new CoulombPotential<Return_t>(ion),hname);
// //targetH->addOperator(new IonIonPotential(*ion),hname);
// }
// }

View File

@ -221,6 +221,12 @@ bool SlaterDetBuilder::put(xmlNodePtr cur)
APP_ABORT_TRACE(__FILE__,__LINE__," No sposet is found to build slaterdeterminant or multideterminant");
}
// check if any of the SPO set requires distance tables
bool SPOSetNeedsDistanceTable = false;
for (std::map<std::string,SPOSetBasePtr>::iterator iter=spomap.begin(); iter!=spomap.end(); iter++)
if (iter->second->NeedsDistanceTable) SPOSetNeedsDistanceTable = true;
if (SPOSetNeedsDistanceTable) app_log() << " At least one SPO Set requires precomputed distance tables." << std::endl;
cur = curRoot->children;
while (cur != NULL)//check the basis set
{
@ -251,6 +257,7 @@ bool SlaterDetBuilder::put(xmlNodePtr cur)
{
slaterdet_0->add(iter->second,iter->first);
}
if (slaterdet_0) slaterdet_0->RecomputeNeedsDistanceTable = SPOSetNeedsDistanceTable;
int spin_group = 0;
xmlNodePtr tcur = cur->children;
while (tcur != NULL)
@ -325,6 +332,7 @@ bool SlaterDetBuilder::put(xmlNodePtr cur)
//
// multislaterdetfast_0->msd = new MultiSlaterDeterminant(targetPtcl,spo_up,spo_dn);
// success = createMSD(multislaterdetfast_0->msd,cur);
if (multislaterdetfast_0) multislaterdetfast_0->RecomputeNeedsDistanceTable = SPOSetNeedsDistanceTable;
}
else
{
@ -345,6 +353,7 @@ bool SlaterDetBuilder::put(xmlNodePtr cur)
multislaterdet_0 = new MultiSlaterDeterminant(targetPtcl,spo_up,spo_dn);
success = createMSD(multislaterdet_0,cur);
}
if (multislaterdet_0) multislaterdet_0->RecomputeNeedsDistanceTable = SPOSetNeedsDistanceTable;
}
}
cur = cur->next;

View File

@ -190,7 +190,18 @@ struct PolynomialFunctor3D: public OptimizableFunctorBase
IndepVar[col] = true;
}
while (max_abs < 1.0e-6);
#if ( ( __INTEL_COMPILER == 1700 ) && ( __INTEL_COMPILER_UPDATE == 1 ) && ( __cplusplus < 201103L ) )
// the swap_rows is sick with Intel compiler 17 update 1, c++11 off
// manually swap the rows
for(int ind_col=0; ind_col<ConstraintMatrix.size2(); ind_col++)
{
real_type temp = ConstraintMatrix(row,ind_col);
ConstraintMatrix(row,ind_col) = ConstraintMatrix(max_loc,ind_col);
ConstraintMatrix(max_loc,ind_col) = temp;
}
#else
ConstraintMatrix.swap_rows(row,max_loc);
#endif
real_type lead_inv = 1.0/ConstraintMatrix(row,col);
for (int c=0; c<NumGamma; c++)
ConstraintMatrix(row,c) *= lead_inv;

View File

@ -46,8 +46,9 @@ public:
* @param bs pointer to the BasisSet
* @param id identifier of this LCOrbitalSet
*/
LCOrbitalSet(BS* bs=0,int rl=0): myBasisSet(0),ReportLevel(rl)
LCOrbitalSet(BS* bs=0,int rl=0): myBasisSet(0), ReportLevel(rl)
{
NeedsDistanceTable=true;
if(bs)
setBasisSet(bs);
}
@ -193,8 +194,9 @@ public:
* @param bs pointer to the BasisSet
* @param id identifier of this LCOrbitalSet
*/
LCOrbitalSet(BS* bs=0,int rl=0, std::string algorithm=""): myBasisSet(0),ReportLevel(rl)
LCOrbitalSet(BS* bs=0,int rl=0, std::string algorithm=""): myBasisSet(0), ReportLevel(rl)
{
NeedsDistanceTable=true;
if(algorithm=="legacy_gemv")
{
Algo=0;

View File

@ -22,7 +22,8 @@
namespace qmcplusplus
{
OrbitalBase::OrbitalBase():
IsOptimizing(false),Optimizable(true), UpdateMode(ORB_WALKER), //UseBuffer(true), //Counter(0),
IsOptimizing(false), Optimizable(true), UpdateMode(ORB_WALKER), //UseBuffer(true), //Counter(0),
RecomputeNeedsDistanceTable(false),
LogValue(1.0),PhaseValue(0.0),OrbitalName("OrbitalBase"), derivsDone(false), parameterType(0)
#if !defined(ENABLE_SMARTPOINTER)
,dPsi(0), ionDerivs(false)

View File

@ -113,6 +113,8 @@ struct OrbitalBase: public QMCTraits
bool derivsDone;
/** true, if evaluateRatios using virtual particle is implemented */
bool HaveRatiosForVP;
/** true, if recompute needs precomputed distance tables */
bool RecomputeNeedsDistanceTable;
/** define the level of storage in derivative buffer **/
int DerivStorageType;

View File

@ -57,8 +57,10 @@ public:
int builder_index;
///true if C is an identity matrix
bool Identity;
///true if C is an identity matrix
///true if SPO is optimizable
bool Optimizable;
///true if precomputed distance tables are needed
bool NeedsDistanceTable;
///flag to calculate ionic derivatives
bool ionDerivs;
///total number of orbitals
@ -89,6 +91,7 @@ public:
*/
SPOSetBase()
:Identity(false),TotalOrbitalSize(0),OrbitalSetSize(0),BasisSetSize(0),
NeedsDistanceTable(false),
ActivePtcl(-1),Optimizable(false),ionDerivs(false),builder_index(-1)
{
className="invalid";

View File

@ -31,7 +31,7 @@ typedef enum { V_TIMER, VGL_TIMER, ACCEPT_TIMER, NL_TIMER,
TrialWaveFunction::TrialWaveFunction(Communicate* c)
: MPIObjectBase(c)
, Ordered(true), NumPtcls(0), TotalDim(0), BufferCursor(0), BufferCursor_DP(0)
, Ordered(true), RecomputeNeedsDistanceTable(false), NumPtcls(0), TotalDim(0), BufferCursor(0), BufferCursor_DP(0)
, PhaseValue(0.0),LogValue(0.0),OneOverM(1.0), PhaseDiff(0.0), FermionWF(0)
{
ClassName="TrialWaveFunction";
@ -41,7 +41,7 @@ TrialWaveFunction::TrialWaveFunction(Communicate* c)
///private and cannot be used
TrialWaveFunction::TrialWaveFunction()
: MPIObjectBase(0)
, Ordered(true), NumPtcls(0), TotalDim(0), BufferCursor(0), BufferCursor_DP(0)
, Ordered(true), RecomputeNeedsDistanceTable(false), NumPtcls(0), TotalDim(0), BufferCursor(0), BufferCursor_DP(0)
, PhaseValue(0.0),LogValue(0.0) ,OneOverM(1.0), PhaseDiff(0.0)
{
ClassName="TrialWaveFunction";
@ -98,6 +98,8 @@ TrialWaveFunction::addOrbital(OrbitalBase* aterm, const std::string& aname, bool
FermionWF=dynamic_cast<FermionBase*>(aterm);
}
if (aterm->RecomputeNeedsDistanceTable) RecomputeNeedsDistanceTable = true;
//#if defined(QMC_CUDA)
char name1[64],name2[64],name3[64],name4[64], name5[64], name6[64];
sprintf(name1,"WaveFunction::%s_V",aname.c_str());

View File

@ -356,10 +356,16 @@ public:
return FermionWF;
}
inline bool needs_distance_table_for_recompute() { return RecomputeNeedsDistanceTable; }
private:
///control how ratio is calculated
bool Ordered;
///true, if recompute needs precomputed distance tables
bool RecomputeNeedsDistanceTable;
///the size of ParticleSet
int NumPtcls;

View File

@ -34,12 +34,13 @@ template<class T>
struct PooledData
{
typedef T value_type;
typedef OHMMS_PRECISION_FULL fp_value_type;
typedef typename std::vector<T>::size_type size_type;
size_type Current, Current_DP;
std::vector<T> myData;
/// only active when T!=double
std::vector<double> myData_DP;
/// only active when T!=fp_value_type
std::vector<fp_value_type> myData_DP;
///default constructor
inline PooledData(): Current(0), Current_DP(0) { }
@ -48,13 +49,13 @@ struct PooledData
inline PooledData(size_type n, size_type n1=0): Current(0), Current_DP(0)
{
myData.resize(n,T());
myData_DP.resize(n1,double());
myData_DP.resize(n1,fp_value_type());
}
///return the size of the data
inline size_type byteSize() const
{
return sizeof(T)*myData.size() + sizeof(double)*myData_DP.size();
return sizeof(T)*myData.size() + sizeof(fp_value_type)*myData_DP.size();
}
///return the size of the data
@ -310,7 +311,7 @@ struct PooledData
}
/** return the address of the first DP element **/
inline double* data_DP()
inline fp_value_type* data_DP()
{
return &(myData_DP[0]);
}

View File

@ -98,12 +98,6 @@
/* Define if sincos function exists */
#cmakedefine HAVE_SINCOS @HAVE_SINCOS@
/* Define if std::round function exists */
#cmakedefine HAVE_STD_ROUND @HAVE_STD_ROUND@
/* Define if floor function exists */
#cmakedefine HAVE_FLOOR @HAVE_FLOOR@
/* Define if einspline lib exists */
#cmakedefine HAVE_EINSPLINE @HAVE_EINSPLINE@
@ -115,12 +109,6 @@
/* Define if posix_memalign function exists */
#cmakedefine HAVE_POSIX_MEMALIGN @HAVE_POSIX_MEMALIGN@
/* Define if pow function exists */
#cmakedefine HAVE_POW @HAVE_POW@
/* Define if sqrt function exists */
#cmakedefine HAVE_SQRT @HAVE_SQRT@
/* Define if dlfcn.h exists */
#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@

View File

@ -19,21 +19,9 @@
/* Define if sincos function exists */
#cmakedefine HAVE_SINCOS @HAVE_SINCOS@
/* Define if std::round function exists */
#cmakedefine HAVE_STD_ROUND @HAVE_STD_ROUND@
/* Define if floor function exists */
#cmakedefine HAVE_FLOOR @HAVE_FLOOR@
/* Define if posix_memalign function exists */
#cmakedefine HAVE_POSIX_MEMALIGN @HAVE_POSIX_MEMALIGN@
/* Define if pow function exists */
#cmakedefine HAVE_POW @HAVE_POW@
/* Define if sqrt function exists */
#cmakedefine HAVE_SQRT @HAVE_SQRT@
/* Define if dlfcn.h exists */
#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@