Skip to content

Commit

Permalink
Merge pull request #120 from ye-luo/one-WaveFunction
Browse files Browse the repository at this point in the history
One WaveFunction
  • Loading branch information
markdewing authored May 14, 2018
2 parents a9aafcb + c86195d commit cd12e4b
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 348 deletions.
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ ENDIF()
Particle/ParticleSet.BC.cpp
Particle/DistanceTableAA.cpp
Particle/DistanceTableAB.cpp
Particle/DistanceTable.cpp
)

ADD_LIBRARY(qmcbase ${PARTICLE} ${PARTICLEIO})
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FOREACH(p ${ESTEST})
TARGET_LINK_LIBRARIES(${p} qmcbase qmcutil ${QMC_UTIL_LIBS} ${MPI_LIBRARY})
ENDFOREACH(p ${ESTEST})

ADD_LIBRARY(miniwfs ../QMCWaveFunctions/WaveFunctionRef.cpp ../QMCWaveFunctions/WaveFunction.cpp)
ADD_LIBRARY(miniwfs ../QMCWaveFunctions/WaveFunction.cpp)

ADD_EXECUTABLE(miniqmc miniqmc.cpp)
TARGET_LINK_LIBRARIES(miniqmc miniwfs qmcbase qmcutil ${QMC_UTIL_LIBS} ${MPI_LIBRARY})
Expand Down
14 changes: 7 additions & 7 deletions src/Drivers/check_wfc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ int main(int argc, char **argv)
els_ref.RSoA = els_ref.R;

// create tables
DistanceTable::add(els, DT_SOA);
DistanceTable::add(els_ref, DT_SOA);
DistanceTableData *d_ie = DistanceTable::add(ions, els_ref, DT_SOA);
d_ie->setRmax(Rmax);
els.addTable(els, DT_SOA);
els_ref.addTable(els_ref, DT_SOA);
const int ei_TableID = els_ref.addTable(ions, DT_SOA);
els_ref.DistTables[ei_TableID]->setRmax(Rmax);

ParticlePos_t delta(nels);

Expand Down Expand Up @@ -381,12 +381,12 @@ int main(int argc, char **argv)
int nsphere = 0;
for (int iat = 0; iat < nions; ++iat)
{
for (int nj = 0, jmax = d_ie->nadj(iat); nj < jmax; ++nj)
for (int nj = 0, jmax = els_ref.DistTables[ei_TableID]->nadj(iat); nj < jmax; ++nj)
{
const RealType r = d_ie->distance(iat, nj);
const RealType r = els_ref.DistTables[ei_TableID]->distance(iat, nj);
if (r < Rmax)
{
const int iel = d_ie->iadj(iat, nj);
const int iel = els_ref.DistTables[ei_TableID]->iadj(iat, nj);
nsphere++;
random_th.generate_uniform(&delta[0][0], nknots * 3);
for (int k = 0; k < nknots; ++k)
Expand Down
21 changes: 10 additions & 11 deletions src/Drivers/miniqmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ void print_help()
app_summary() << " miniqmc [-hjvV] [-g \"n0 n1 n2\"] [-m meshfactor]" << '\n';
app_summary() << " [-n steps] [-N substeps] [-r rmax] [-s seed]" << '\n';
app_summary() << "options:" << '\n';
app_summary() << " -b use reference implementations default: off" << '\n';
app_summary() << " -g set the 3D tiling. default: 1 1 1" << '\n';
app_summary() << " -h print help and exit" << '\n';
app_summary() << " -j enable three body Jastrow default: off" << '\n';
Expand Down Expand Up @@ -210,11 +211,14 @@ int main(int argc, char **argv)
int opt;
while(optind < argc)
{
if ((opt = getopt(argc, argv, "hjvVa:c:g:m:n:N:r:s:")) != -1)
if ((opt = getopt(argc, argv, "bhjvVa:c:g:m:n:N:r:s:")) != -1)
{
switch (opt)
{
case 'a': tileSize = atoi(optarg); break;
case 'b':
useRef = true;
break;
case 'c': // number of members per team
team_size = atoi(optarg);
break;
Expand Down Expand Up @@ -370,20 +374,15 @@ int main(int argc, char **argv)
els.RSoA = els.R;
}

WaveFunctionBase *wavefunction;
WaveFunction *wavefunction = new WaveFunction();

if (useRef)
{
wavefunction =
new miniqmcreference::WaveFunctionRef(ions, els, random_th, enableJ3);
}
build_WaveFunction(true, *wavefunction, ions, els, random_th, enableJ3);
else
{
wavefunction = new WaveFunction(ions, els, random_th, enableJ3);
}
build_WaveFunction(false, *wavefunction, ions, els, random_th, enableJ3);

// set Rmax for ion-el distance table for PP
wavefunction->setRmax(Rmax);
els.DistTables[wavefunction->get_ei_TableID()]->setRmax(Rmax);

// create pseudopp
NonLocalPP<OHMMS_PRECISION> ecp(random_th);
Expand Down Expand Up @@ -484,7 +483,7 @@ int main(int argc, char **argv)
// Compute NLPP energy using integral over spherical points

ecp.randomize(rOnSphere); // pick random sphere
const DistanceTableData *d_ie = wavefunction->d_ie;
const DistanceTableData *d_ie = els.DistTables[wavefunction->get_ei_TableID()];

Timers[Timer_ECP]->start();
for (int iat = 0; iat < nions; ++iat)
Expand Down
52 changes: 0 additions & 52 deletions src/Particle/DistanceTable.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions src/Particle/DistanceTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ namespace qmcplusplus
*DistanceTable
* to generically control the crystalline structure.
*/
// struct DistanceTable
namespace DistanceTable
{
/// add a named DistanceTableData_t of Symmectric type
DistanceTableData *add(ParticleSet &s,
int dt_type); //, const char* aname = NULL);

/// add a named DistanceTableData_t of Asymmectric type
DistanceTableData *add(const ParticleSet &s, ParticleSet &t,
int dt_type); //, const char* aname = NULL);
}

/// free function to create a distable table of s-s
DistanceTableData *createDistanceTable(ParticleSet &s, int dt_type);
Expand Down
2 changes: 1 addition & 1 deletion src/QMCWaveFunctions/Determinant.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void checkDiff(const MT1 &a, const MT2 &b, const std::string &tag)

struct DiracDeterminant : public WaveFunctionComponentBase
{
DiracDeterminant(int nels, RandomGenerator<RealType> &RNG, int First=0)
DiracDeterminant(int nels, const RandomGenerator<RealType> &RNG, int First=0)
: FirstIndex(First), myRandom(RNG)
{
psiMinv.resize(nels, nels);
Expand Down
2 changes: 1 addition & 1 deletion src/QMCWaveFunctions/DeterminantRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ struct DiracDeterminantRef : public qmcplusplus::WaveFunctionComponentBase
{
using ParticleSet = qmcplusplus::ParticleSet;

DiracDeterminantRef(int nels, qmcplusplus::RandomGenerator<RealType> &RNG, int First=0)
DiracDeterminantRef(int nels, const qmcplusplus::RandomGenerator<RealType> &RNG, int First=0)
: FirstIndex(First), myRandom(RNG)
{
psiMinv.resize(nels, nels);
Expand Down
Loading

0 comments on commit cd12e4b

Please sign in to comment.