diff --git a/src/QMCHamiltonians/tests/test_RotatedSPOs_NLPP.cpp b/src/QMCHamiltonians/tests/test_RotatedSPOs_NLPP.cpp index cfed3d9471..84d55b9c32 100644 --- a/src/QMCHamiltonians/tests/test_RotatedSPOs_NLPP.cpp +++ b/src/QMCHamiltonians/tests/test_RotatedSPOs_NLPP.cpp @@ -20,7 +20,7 @@ #include "Particle/ParticleSetPool.h" #include "QMCWaveFunctions/WaveFunctionPool.h" #include "QMCWaveFunctions/WaveFunctionComponent.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" #include "QMCHamiltonians/HamiltonianFactory.h" #include "Utilities/ProjectData.h" diff --git a/src/QMCWaveFunctions/BsplineFactory/BsplineReaderBase.cpp b/src/QMCWaveFunctions/BsplineFactory/BsplineReaderBase.cpp index a387eab57f..0c5cf0d2c9 100644 --- a/src/QMCWaveFunctions/BsplineFactory/BsplineReaderBase.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/BsplineReaderBase.cpp @@ -17,7 +17,7 @@ * * Implement super function */ -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "EinsplineSetBuilder.h" #include "BsplineReaderBase.h" #include "OhmmsData/AttributeSet.h" #include "Message/CommOperators.h" diff --git a/src/QMCWaveFunctions/EinsplineSetBuilder.h b/src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilder.h similarity index 100% rename from src/QMCWaveFunctions/EinsplineSetBuilder.h rename to src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilder.h diff --git a/src/QMCWaveFunctions/EinsplineSetBuilderCommon.cpp b/src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilderCommon.cpp similarity index 99% rename from src/QMCWaveFunctions/EinsplineSetBuilderCommon.cpp rename to src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilderCommon.cpp index 04f2492455..3f5f19230a 100644 --- a/src/QMCWaveFunctions/EinsplineSetBuilderCommon.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilderCommon.cpp @@ -21,7 +21,7 @@ * - EinsplineSetBuilder * - */ -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "EinsplineSetBuilder.h" #include "OhmmsData/AttributeSet.h" #include "Message/CommOperators.h" #include diff --git a/src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp b/src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilderESHDF.fft.cpp similarity index 75% rename from src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp rename to src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilderESHDF.fft.cpp index 82c4507df6..0ee88cb77c 100644 --- a/src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilderESHDF.fft.cpp @@ -13,7 +13,7 @@ ////////////////////////////////////////////////////////////////////////////////////// -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "EinsplineSetBuilder.h" #include "DistanceTable.h" #include "OhmmsData/AttributeSet.h" #include "Utilities/Timer.h" @@ -40,6 +40,35 @@ bool sortByIndex(BandInfo leftB, BandInfo rightB) return (leftB.BandIndex < rightB.BandIndex); }; +bool EinsplineSetBuilder::ReadOrbitalInfo(bool skipChecks) +{ + if (!H5File.open(H5FileName, H5F_ACC_RDONLY)) + { + app_error() << "Could not open HDF5 file \"" << H5FileName << "\" in EinsplineSetBuilder::ReadOrbitalInfo.\n"; + return false; + } + + try + { + // Read format + std::string format; + H5File.read(format, "/format"); + if (format.find("ES") == std::string::npos) + throw std::runtime_error("Format string input \"" + format + "\" doesn't contain \"ES\" keyword."); + Format = ESHDF; + H5File.read(Version, "/version"); + app_log() << " HDF5 orbital file version " << Version[0] << "." << Version[1] << "." << Version[2] << std::endl; + } + catch (const std::exception& e) + { + app_error() << e.what() << std::endl + << "EinsplineSetBuilder::ReadOrbitalInfo h5 file format is too old or it is not a bspline orbital file!" + << std::endl; + return false; + } + + return ReadOrbitalInfo_ESHDF(skipChecks); +} bool EinsplineSetBuilder::ReadOrbitalInfo_ESHDF(bool skipChecks) { @@ -339,6 +368,127 @@ bool EinsplineSetBuilder::ReadOrbitalInfo_ESHDF(bool skipChecks) return true; } +bool EinsplineSetBuilder::ReadGvectors_ESHDF() +{ + bool root = myComm->rank() == 0; + //this is always ugly + MeshSize = 0; + int hasPsig = 1; + if (root) + { + H5File.readEntry(MeshSize, "/electrons/psi_r_mesh"); + H5File.readEntry(MeshSize, "/electrons/mesh"); + } + myComm->bcast(MeshSize); + hasPsig = (MeshSize[0] == 0); + if (hasPsig) + { + int nallowed = 257; + int allowed[] = {72, 75, 80, 81, 90, 96, 100, 108, 120, 125, 128, 135, 144, 150, + 160, 162, 180, 192, 200, 216, 225, 240, 243, 250, 256, 270, 288, 300, + 320, 324, 360, 375, 384, 400, 405, 432, 450, 480, 486, 500, 512, 540, + 576, 600, 625, 640, 648, 675, 720, 729, 750, 768, 800, 810, 864, 900, + 960, 972, 1000, 1024, 1080, 1125, 1152, 1200, 1215, 1250, 1280, 1296, 1350, 1440, + 1458, 1500, 1536, 1600, 1620, 1728, 1800, 1875, 1920, 1944, 2000, 2025, 2048, 2160, + 2187, 2250, 2304, 2400, 2430, 2500, 2560, 2592, 2700, 2880, 2916, 3000, 3072, 3125, + 3200, 3240, 3375, 3456, 3600, 3645, 3750, 3840, 3888, 4000, 4050, 4096, 4320, 4374, + 4500, 4608, 4800, 4860, 5000, 5120, 5184, 5400, 5625, 5760, 5832, 6000, 6075, 6144, + 6250, 6400, 6480, 6561, 6750, 6912, 7200, 7290, 7500, 7680, 7776, 8000, 8100, 8192, + 8640, 8748, 9000, 9216, 9375, 9600, 9720, 10000, 10125, 10240, 10368, 10800, 10935, 11250, + 11520, 11664, 12000, 12150, 12288, 12500, 12800, 12960, 13122, 13500, 13824, 14400, 14580, 15000, + 15360, 15552, 15625, 16000, 16200, 16384, 16875, 17280, 17496, 18000, 18225, 18432, 18750, 19200, + 19440, 19683, 20000, 20250, 20480, 20736, 21600, 21870, 22500, 23040, 23328, 24000, 24300, 24576, + 25000, 25600, 25920, 26244, 27000, 27648, 28125, 28800, 29160, 30000, 30375, 30720, 31104, 31250, + 32000, 32400, 32768, 32805, 33750, 34560, 34992, 36000, 36450, 36864, 37500, 38400, 38880, 39366, + 40000, 40500, 40960, 41472, 43200, 43740, 45000, 46080, 46656, 46875, 48000, 48600, 49152, 50000, + 50625, 51200, 51840, 52488, 54000, 54675, 55296, 56250, 57600, 58320, 59049, 60000, 60750, 61440, + 62208, 62500, 64000, 64800, 65536}; + MaxNumGvecs = 0; + // std::set > Gset; + // Read k-points for all G-vectors and take the union + TinyVector maxIndex(0, 0, 0); + Gvecs.resize(NumTwists); + { + int numg = 0; + if (root) + { + std::ostringstream Gpath; + Gpath << "/electrons/kpoint_0/gvectors"; + H5File.read(Gvecs[0], Gpath.str()); + numg = Gvecs[0].size(); + } + myComm->bcast(numg); + if (!root) + Gvecs[0].resize(numg); + myComm->bcast(Gvecs[0]); + MaxNumGvecs = Gvecs[0].size(); + for (int ig = 0; ig < Gvecs[0].size(); ig++) + { + maxIndex[0] = std::max(maxIndex[0], std::abs(Gvecs[0][ig][0])); + maxIndex[1] = std::max(maxIndex[1], std::abs(Gvecs[0][ig][1])); + maxIndex[2] = std::max(maxIndex[2], std::abs(Gvecs[0][ig][2])); + } + // for (int ig=0; ig=2 up to 65536 + int* ix = std::lower_bound(allowed, allowed + nallowed, MeshSize[0]); + int* iy = std::lower_bound(allowed, allowed + nallowed, MeshSize[1]); + int* iz = std::lower_bound(allowed, allowed + nallowed, MeshSize[2]); + MeshSize[0] = (MeshSize[0] > 128) ? *ix : (MeshSize[0] + MeshSize[0] % 2); + MeshSize[1] = (MeshSize[1] > 128) ? *iy : (MeshSize[1] + MeshSize[1] % 2); + MeshSize[2] = (MeshSize[2] > 128) ? *iz : (MeshSize[2] + MeshSize[2] % 2); + if (Version[0] < 2) + { + //get the map for each twist, but use the MeshSize from kpoint_0 + app_log() << " ESHDF::Version " << Version << std::endl; + app_log() << " Assumes distinct Gvecs set for different twists. Regenerate orbital files using updated QE." + << std::endl; + for (int k = 0; k < DistinctTwists.size(); ++k) + { + int ik = DistinctTwists[k]; + if (ik == 0) + continue; //already done + int numg = 0; + if (root) + { + std::ostringstream Gpath; + Gpath << "/electrons/kpoint_" << ik << "/gvectors"; + H5File.read(Gvecs[ik], Gpath.str()); + numg = Gvecs[ik].size(); + } + myComm->bcast(numg); + if (numg == 0) + { + //copy kpoint_0, default + Gvecs[ik] = Gvecs[0]; + } + else + { + if (numg != MaxNumGvecs) + { + std::ostringstream o; + o << "Twist " << ik << ": The number of Gvecs is different from kpoint_0." + << " This is not supported anymore. Rerun pw2qmcpack.x or equivalent"; + APP_ABORT(o.str()); + } + if (!root) + Gvecs[ik].resize(numg); + myComm->bcast(Gvecs[ik]); + } + } + } + } + app_log() << "B-spline mesh factor is " << MeshFactor << std::endl; + app_log() << "B-spline mesh size is (" << MeshSize[0] << ", " << MeshSize[1] << ", " << MeshSize[2] << ")\n"; + app_log() << "Maxmimum number of Gvecs " << MaxNumGvecs << std::endl; + app_log().flush(); + return hasPsig; +} void EinsplineSetBuilder::OccupyBands_ESHDF(int spin, int sortBands, int numOrbs) { diff --git a/src/QMCWaveFunctions/EinsplineSetBuilder_createSPOs.cpp b/src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilder_createSPOs.cpp similarity index 97% rename from src/QMCWaveFunctions/EinsplineSetBuilder_createSPOs.cpp rename to src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilder_createSPOs.cpp index ab852a139f..8aba6bf396 100644 --- a/src/QMCWaveFunctions/EinsplineSetBuilder_createSPOs.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/EinsplineSetBuilder_createSPOs.cpp @@ -17,7 +17,7 @@ ////////////////////////////////////////////////////////////////////////////////////// -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "EinsplineSetBuilder.h" #include #include "CPU/e2iphi.h" #include "CPU/SIMD/vmath.hpp" @@ -28,10 +28,10 @@ #include "Particle/DistanceTable.h" #include #include "Utilities/ProgressReportEngine.h" -#include "QMCWaveFunctions/einspline_helper.hpp" -#include "QMCWaveFunctions/BsplineFactory/BsplineReaderBase.h" -#include "QMCWaveFunctions/BsplineFactory/BsplineSet.h" -#include "QMCWaveFunctions/BsplineFactory/createBsplineReader.h" +#include "einspline_helper.hpp" +#include "BsplineReaderBase.h" +#include "BsplineSet.h" +#include "createBsplineReader.h" #include #include diff --git a/src/QMCWaveFunctions/EinsplineSpinorSetBuilder.cpp b/src/QMCWaveFunctions/BsplineFactory/EinsplineSpinorSetBuilder.cpp similarity index 97% rename from src/QMCWaveFunctions/EinsplineSpinorSetBuilder.cpp rename to src/QMCWaveFunctions/BsplineFactory/EinsplineSpinorSetBuilder.cpp index a1a1b1b046..e0cde5fa49 100644 --- a/src/QMCWaveFunctions/EinsplineSpinorSetBuilder.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/EinsplineSpinorSetBuilder.cpp @@ -22,9 +22,9 @@ #include "OhmmsData/AttributeSet.h" #include "Message/CommOperators.h" #include "Utilities/Timer.h" -#include "QMCWaveFunctions/einspline_helper.hpp" -#include "QMCWaveFunctions/BsplineFactory/BsplineReaderBase.h" -#include "QMCWaveFunctions/BsplineFactory/createBsplineReader.h" +#include "einspline_helper.hpp" +#include "BsplineReaderBase.h" +#include "createBsplineReader.h" namespace qmcplusplus { diff --git a/src/QMCWaveFunctions/EinsplineSpinorSetBuilder.h b/src/QMCWaveFunctions/BsplineFactory/EinsplineSpinorSetBuilder.h similarity index 96% rename from src/QMCWaveFunctions/EinsplineSpinorSetBuilder.h rename to src/QMCWaveFunctions/BsplineFactory/EinsplineSpinorSetBuilder.h index 33d356397f..73b7f885c8 100644 --- a/src/QMCWaveFunctions/EinsplineSpinorSetBuilder.h +++ b/src/QMCWaveFunctions/BsplineFactory/EinsplineSpinorSetBuilder.h @@ -20,7 +20,7 @@ #define QMCPLUSPLUS_EINSPLINE_SPINORSET_BUILDER_H #include "QMCWaveFunctions/SPOSetBuilder.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" class Communicate; namespace qmcplusplus diff --git a/src/QMCWaveFunctions/BsplineFactory/createComplexDouble.cpp b/src/QMCWaveFunctions/BsplineFactory/createComplexDouble.cpp index ad1eb9d270..202c79f469 100644 --- a/src/QMCWaveFunctions/BsplineFactory/createComplexDouble.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/createComplexDouble.cpp @@ -15,18 +15,18 @@ #include "CPU/e2iphi.h" #include "CPU/SIMD/vmath.hpp" #include "Utilities/ProgressReportEngine.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "QMCWaveFunctions/BsplineFactory/BsplineSet.h" -#include "QMCWaveFunctions/BsplineFactory/SplineC2R.h" -#include "QMCWaveFunctions/BsplineFactory/SplineC2C.h" -#include "QMCWaveFunctions/BsplineFactory/SplineC2ROMPTarget.h" -#include "QMCWaveFunctions/BsplineFactory/SplineC2COMPTarget.h" -#include "QMCWaveFunctions/BsplineFactory/HybridRepCplx.h" +#include "EinsplineSetBuilder.h" +#include "BsplineSet.h" +#include "SplineC2R.h" +#include "SplineC2C.h" +#include "SplineC2ROMPTarget.h" +#include "SplineC2COMPTarget.h" +#include "HybridRepCplx.h" #include -#include "QMCWaveFunctions/einspline_helper.hpp" -#include "QMCWaveFunctions/BsplineFactory/BsplineReaderBase.h" -#include "QMCWaveFunctions/BsplineFactory/SplineSetReader.h" -#include "QMCWaveFunctions/BsplineFactory/HybridRepSetReader.h" +#include "einspline_helper.hpp" +#include "BsplineReaderBase.h" +#include "SplineSetReader.h" +#include "HybridRepSetReader.h" namespace qmcplusplus { diff --git a/src/QMCWaveFunctions/BsplineFactory/createComplexSingle.cpp b/src/QMCWaveFunctions/BsplineFactory/createComplexSingle.cpp index c15ec89029..9711a404fe 100644 --- a/src/QMCWaveFunctions/BsplineFactory/createComplexSingle.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/createComplexSingle.cpp @@ -15,18 +15,18 @@ #include "CPU/e2iphi.h" #include "CPU/SIMD/vmath.hpp" #include "Utilities/ProgressReportEngine.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "QMCWaveFunctions/BsplineFactory/BsplineSet.h" -#include "QMCWaveFunctions/BsplineFactory/SplineC2R.h" -#include "QMCWaveFunctions/BsplineFactory/SplineC2C.h" -#include "QMCWaveFunctions/BsplineFactory/SplineC2ROMPTarget.h" -#include "QMCWaveFunctions/BsplineFactory/SplineC2COMPTarget.h" -#include "QMCWaveFunctions/BsplineFactory/HybridRepCplx.h" +#include "EinsplineSetBuilder.h" +#include "BsplineSet.h" +#include "SplineC2R.h" +#include "SplineC2C.h" +#include "SplineC2ROMPTarget.h" +#include "SplineC2COMPTarget.h" +#include "HybridRepCplx.h" #include -#include "QMCWaveFunctions/einspline_helper.hpp" -#include "QMCWaveFunctions/BsplineFactory/BsplineReaderBase.h" -#include "QMCWaveFunctions/BsplineFactory/SplineSetReader.h" -#include "QMCWaveFunctions/BsplineFactory/HybridRepSetReader.h" +#include "einspline_helper.hpp" +#include "BsplineReaderBase.h" +#include "SplineSetReader.h" +#include "HybridRepSetReader.h" namespace qmcplusplus { diff --git a/src/QMCWaveFunctions/BsplineFactory/createRealDouble.cpp b/src/QMCWaveFunctions/BsplineFactory/createRealDouble.cpp index c541bd5fb1..1dfd43d5f2 100644 --- a/src/QMCWaveFunctions/BsplineFactory/createRealDouble.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/createRealDouble.cpp @@ -13,15 +13,15 @@ #include "QMCWaveFunctions/BsplineFactory/createBsplineReader.h" #include #include "Utilities/ProgressReportEngine.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "QMCWaveFunctions/BsplineFactory/BsplineSet.h" -#include "QMCWaveFunctions/BsplineFactory/SplineR2R.h" -#include "QMCWaveFunctions/BsplineFactory/HybridRepReal.h" +#include "EinsplineSetBuilder.h" +#include "BsplineSet.h" +#include "SplineR2R.h" +#include "HybridRepReal.h" #include -#include "QMCWaveFunctions/einspline_helper.hpp" -#include "QMCWaveFunctions/BsplineFactory/BsplineReaderBase.h" -#include "QMCWaveFunctions/BsplineFactory/SplineSetReader.h" -#include "QMCWaveFunctions/BsplineFactory/HybridRepSetReader.h" +#include "einspline_helper.hpp" +#include "BsplineReaderBase.h" +#include "SplineSetReader.h" +#include "HybridRepSetReader.h" namespace qmcplusplus { diff --git a/src/QMCWaveFunctions/BsplineFactory/createRealSingle.cpp b/src/QMCWaveFunctions/BsplineFactory/createRealSingle.cpp index 9f9887fbf7..5b5a3a2924 100644 --- a/src/QMCWaveFunctions/BsplineFactory/createRealSingle.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/createRealSingle.cpp @@ -13,15 +13,15 @@ #include "QMCWaveFunctions/BsplineFactory/createBsplineReader.h" #include #include "Utilities/ProgressReportEngine.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "QMCWaveFunctions/BsplineFactory/BsplineSet.h" -#include "QMCWaveFunctions/BsplineFactory/SplineR2R.h" -#include "QMCWaveFunctions/BsplineFactory/HybridRepReal.h" +#include "EinsplineSetBuilder.h" +#include "BsplineSet.h" +#include "SplineR2R.h" +#include "HybridRepReal.h" #include -#include "QMCWaveFunctions/einspline_helper.hpp" -#include "QMCWaveFunctions/BsplineFactory/BsplineReaderBase.h" -#include "QMCWaveFunctions/BsplineFactory/SplineSetReader.h" -#include "QMCWaveFunctions/BsplineFactory/HybridRepSetReader.h" +#include "einspline_helper.hpp" +#include "BsplineReaderBase.h" +#include "SplineSetReader.h" +#include "HybridRepSetReader.h" namespace qmcplusplus { diff --git a/src/QMCWaveFunctions/einspline_helper.hpp b/src/QMCWaveFunctions/BsplineFactory/einspline_helper.hpp similarity index 100% rename from src/QMCWaveFunctions/einspline_helper.hpp rename to src/QMCWaveFunctions/BsplineFactory/einspline_helper.hpp diff --git a/src/QMCWaveFunctions/CMakeLists.txt b/src/QMCWaveFunctions/CMakeLists.txt index fe26571d8f..886663216c 100644 --- a/src/QMCWaveFunctions/CMakeLists.txt +++ b/src/QMCWaveFunctions/CMakeLists.txt @@ -82,11 +82,9 @@ if(OHMMS_DIM MATCHES 3) if(HAVE_EINSPLINE) set(FERMION_SRCS ${FERMION_SRCS} - EinsplineSetBuilderCommon.cpp - EinsplineSetBuilderOld.cpp - EinsplineSetBuilderReadBands_ESHDF.cpp - EinsplineSetBuilderESHDF.fft.cpp - EinsplineSetBuilder_createSPOs.cpp + BsplineFactory/EinsplineSetBuilderCommon.cpp + BsplineFactory/EinsplineSetBuilderESHDF.fft.cpp + BsplineFactory/EinsplineSetBuilder_createSPOs.cpp BsplineFactory/createComplexDouble.cpp BsplineFactory/createComplexSingle.cpp BsplineFactory/HybridRepCenterOrbitals.cpp @@ -94,7 +92,7 @@ if(OHMMS_DIM MATCHES 3) BsplineFactory/BsplineReaderBase.cpp) set(FERMION_OMPTARGET_SRCS Fermion/DiracDeterminantBatched.cpp Fermion/MultiDiracDeterminant.2.cpp) if(QMC_COMPLEX) - set(FERMION_SRCS ${FERMION_SRCS} EinsplineSpinorSetBuilder.cpp BsplineFactory/SplineC2C.cpp) + set(FERMION_SRCS ${FERMION_SRCS} BsplineFactory/EinsplineSpinorSetBuilder.cpp BsplineFactory/SplineC2C.cpp) set(FERMION_OMPTARGET_SRCS ${FERMION_OMPTARGET_SRCS} BsplineFactory/SplineC2COMPTarget.cpp) else(QMC_COMPLEX) set(FERMION_SRCS ${FERMION_SRCS} BsplineFactory/createRealSingle.cpp BsplineFactory/createRealDouble.cpp diff --git a/src/QMCWaveFunctions/EinsplineSetBuilderOld.cpp b/src/QMCWaveFunctions/EinsplineSetBuilderOld.cpp deleted file mode 100644 index 64f395baea..0000000000 --- a/src/QMCWaveFunctions/EinsplineSetBuilderOld.cpp +++ /dev/null @@ -1,51 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////// -// This file is distributed under the University of Illinois/NCSA Open Source License. -// See LICENSE file in top directory for details. -// -// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. -// -// File developed by: Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign -// Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign -// Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign -// Ye Luo, yeluo@anl.gov, Argonne National Laboratory -// Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory -// -// File created by: Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign -////////////////////////////////////////////////////////////////////////////////////// - - -#include "QMCWaveFunctions/EinsplineSetBuilder.h" - -namespace qmcplusplus -{ -bool EinsplineSetBuilder::ReadOrbitalInfo(bool skipChecks) -{ - if (!H5File.open(H5FileName, H5F_ACC_RDONLY)) - { - app_error() << "Could not open HDF5 file \"" << H5FileName << "\" in EinsplineSetBuilder::ReadOrbitalInfo.\n"; - return false; - } - - try - { - // Read format - std::string format; - H5File.read(format, "/format"); - if (format.find("ES") == std::string::npos) - throw std::runtime_error("Format string input \"" + format + "\" doesn't contain \"ES\" keyword."); - Format = ESHDF; - H5File.read(Version, "/version"); - app_log() << " HDF5 orbital file version " << Version[0] << "." << Version[1] << "." << Version[2] << std::endl; - } - catch (const std::exception& e) - { - app_error() << e.what() << std::endl - << "EinsplineSetBuilder::ReadOrbitalInfo h5 file format is too old or it is not a bspline orbital file!" - << std::endl; - return false; - } - - return ReadOrbitalInfo_ESHDF(skipChecks); -} - -} // namespace qmcplusplus diff --git a/src/QMCWaveFunctions/EinsplineSetBuilderReadBands_ESHDF.cpp b/src/QMCWaveFunctions/EinsplineSetBuilderReadBands_ESHDF.cpp deleted file mode 100644 index a53dcdf9cf..0000000000 --- a/src/QMCWaveFunctions/EinsplineSetBuilderReadBands_ESHDF.cpp +++ /dev/null @@ -1,148 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////// -// This file is distributed under the University of Illinois/NCSA Open Source License. -// See LICENSE file in top directory for details. -// -// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. -// -// File developed by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign -// Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign -// Ye Luo, yeluo@anl.gov, Argonne National Laboratory -// Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory -// -// File created by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign -////////////////////////////////////////////////////////////////////////////////////// - - -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "Utilities/ProgressReportEngine.h" -#include "Message/CommOperators.h" -#include -#include "QMCWaveFunctions/einspline_helper.hpp" - -namespace qmcplusplus -{ - -bool EinsplineSetBuilder::ReadGvectors_ESHDF() -{ - bool root = myComm->rank() == 0; - //this is always ugly - MeshSize = 0; - int hasPsig = 1; - if (root) - { - H5File.readEntry(MeshSize, "/electrons/psi_r_mesh"); - H5File.readEntry(MeshSize, "/electrons/mesh"); - } - myComm->bcast(MeshSize); - hasPsig = (MeshSize[0] == 0); - if (hasPsig) - { - int nallowed = 257; - int allowed[] = {72, 75, 80, 81, 90, 96, 100, 108, 120, 125, 128, 135, 144, 150, - 160, 162, 180, 192, 200, 216, 225, 240, 243, 250, 256, 270, 288, 300, - 320, 324, 360, 375, 384, 400, 405, 432, 450, 480, 486, 500, 512, 540, - 576, 600, 625, 640, 648, 675, 720, 729, 750, 768, 800, 810, 864, 900, - 960, 972, 1000, 1024, 1080, 1125, 1152, 1200, 1215, 1250, 1280, 1296, 1350, 1440, - 1458, 1500, 1536, 1600, 1620, 1728, 1800, 1875, 1920, 1944, 2000, 2025, 2048, 2160, - 2187, 2250, 2304, 2400, 2430, 2500, 2560, 2592, 2700, 2880, 2916, 3000, 3072, 3125, - 3200, 3240, 3375, 3456, 3600, 3645, 3750, 3840, 3888, 4000, 4050, 4096, 4320, 4374, - 4500, 4608, 4800, 4860, 5000, 5120, 5184, 5400, 5625, 5760, 5832, 6000, 6075, 6144, - 6250, 6400, 6480, 6561, 6750, 6912, 7200, 7290, 7500, 7680, 7776, 8000, 8100, 8192, - 8640, 8748, 9000, 9216, 9375, 9600, 9720, 10000, 10125, 10240, 10368, 10800, 10935, 11250, - 11520, 11664, 12000, 12150, 12288, 12500, 12800, 12960, 13122, 13500, 13824, 14400, 14580, 15000, - 15360, 15552, 15625, 16000, 16200, 16384, 16875, 17280, 17496, 18000, 18225, 18432, 18750, 19200, - 19440, 19683, 20000, 20250, 20480, 20736, 21600, 21870, 22500, 23040, 23328, 24000, 24300, 24576, - 25000, 25600, 25920, 26244, 27000, 27648, 28125, 28800, 29160, 30000, 30375, 30720, 31104, 31250, - 32000, 32400, 32768, 32805, 33750, 34560, 34992, 36000, 36450, 36864, 37500, 38400, 38880, 39366, - 40000, 40500, 40960, 41472, 43200, 43740, 45000, 46080, 46656, 46875, 48000, 48600, 49152, 50000, - 50625, 51200, 51840, 52488, 54000, 54675, 55296, 56250, 57600, 58320, 59049, 60000, 60750, 61440, - 62208, 62500, 64000, 64800, 65536}; - MaxNumGvecs = 0; - // std::set > Gset; - // Read k-points for all G-vectors and take the union - TinyVector maxIndex(0, 0, 0); - Gvecs.resize(NumTwists); - { - int numg = 0; - if (root) - { - std::ostringstream Gpath; - Gpath << "/electrons/kpoint_0/gvectors"; - H5File.read(Gvecs[0], Gpath.str()); - numg = Gvecs[0].size(); - } - myComm->bcast(numg); - if (!root) - Gvecs[0].resize(numg); - myComm->bcast(Gvecs[0]); - MaxNumGvecs = Gvecs[0].size(); - for (int ig = 0; ig < Gvecs[0].size(); ig++) - { - maxIndex[0] = std::max(maxIndex[0], std::abs(Gvecs[0][ig][0])); - maxIndex[1] = std::max(maxIndex[1], std::abs(Gvecs[0][ig][1])); - maxIndex[2] = std::max(maxIndex[2], std::abs(Gvecs[0][ig][2])); - } - // for (int ig=0; ig=2 up to 65536 - int* ix = std::lower_bound(allowed, allowed + nallowed, MeshSize[0]); - int* iy = std::lower_bound(allowed, allowed + nallowed, MeshSize[1]); - int* iz = std::lower_bound(allowed, allowed + nallowed, MeshSize[2]); - MeshSize[0] = (MeshSize[0] > 128) ? *ix : (MeshSize[0] + MeshSize[0] % 2); - MeshSize[1] = (MeshSize[1] > 128) ? *iy : (MeshSize[1] + MeshSize[1] % 2); - MeshSize[2] = (MeshSize[2] > 128) ? *iz : (MeshSize[2] + MeshSize[2] % 2); - if (Version[0] < 2) - { - //get the map for each twist, but use the MeshSize from kpoint_0 - app_log() << " ESHDF::Version " << Version << std::endl; - app_log() << " Assumes distinct Gvecs set for different twists. Regenerate orbital files using updated QE." - << std::endl; - for (int k = 0; k < DistinctTwists.size(); ++k) - { - int ik = DistinctTwists[k]; - if (ik == 0) - continue; //already done - int numg = 0; - if (root) - { - std::ostringstream Gpath; - Gpath << "/electrons/kpoint_" << ik << "/gvectors"; - H5File.read(Gvecs[ik], Gpath.str()); - numg = Gvecs[ik].size(); - } - myComm->bcast(numg); - if (numg == 0) - { - //copy kpoint_0, default - Gvecs[ik] = Gvecs[0]; - } - else - { - if (numg != MaxNumGvecs) - { - std::ostringstream o; - o << "Twist " << ik << ": The number of Gvecs is different from kpoint_0." - << " This is not supported anymore. Rerun pw2qmcpack.x or equivalent"; - APP_ABORT(o.str()); - } - if (!root) - Gvecs[ik].resize(numg); - myComm->bcast(Gvecs[ik]); - } - } - } - } - app_log() << "B-spline mesh factor is " << MeshFactor << std::endl; - app_log() << "B-spline mesh size is (" << MeshSize[0] << ", " << MeshSize[1] << ", " << MeshSize[2] << ")\n"; - app_log() << "Maxmimum number of Gvecs " << MaxNumGvecs << std::endl; - app_log().flush(); - return hasPsig; -} - - -} // namespace qmcplusplus diff --git a/src/QMCWaveFunctions/SPOSetBuilderFactory.cpp b/src/QMCWaveFunctions/SPOSetBuilderFactory.cpp index 6abce2b7e5..c878d5120e 100644 --- a/src/QMCWaveFunctions/SPOSetBuilderFactory.cpp +++ b/src/QMCWaveFunctions/SPOSetBuilderFactory.cpp @@ -25,12 +25,12 @@ #include "QMCWaveFunctions/LCAO/LCAOrbitalBuilder.h" #if defined(QMC_COMPLEX) -#include "QMCWaveFunctions/EinsplineSpinorSetBuilder.h" +#include "BsplineFactory/EinsplineSpinorSetBuilder.h" #include "QMCWaveFunctions/LCAO/LCAOSpinorBuilder.h" #endif #if defined(HAVE_EINSPLINE) -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" #endif #endif #include "QMCWaveFunctions/CompositeSPOSet.h" diff --git a/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp b/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp index 39e35c9c70..af6f5b9cf0 100644 --- a/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp +++ b/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp @@ -18,7 +18,7 @@ #include "Particle/ParticleSet.h" #include "Particle/ParticleSetPool.h" #include "QMCWaveFunctions/WaveFunctionComponent.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" #include "QMCWaveFunctions/RotatedSPOs.h" #include "checkMatrix.hpp" #include "FakeSPO.h" diff --git a/src/QMCWaveFunctions/tests/test_TrialWaveFunction.cpp b/src/QMCWaveFunctions/tests/test_TrialWaveFunction.cpp index ced96cd440..091af35768 100644 --- a/src/QMCWaveFunctions/tests/test_TrialWaveFunction.cpp +++ b/src/QMCWaveFunctions/tests/test_TrialWaveFunction.cpp @@ -17,7 +17,7 @@ #include "Particle/ParticleSet.h" #include "Particle/ParticleSetPool.h" #include "QMCWaveFunctions/TrialWaveFunction.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" #include "QMCWaveFunctions/Fermion/DiracDeterminant.h" #include "QMCWaveFunctions/Fermion/SlaterDet.h" #include "QMCWaveFunctions/Jastrow/RadialJastrowBuilder.h" diff --git a/src/QMCWaveFunctions/tests/test_TrialWaveFunction_He.cpp b/src/QMCWaveFunctions/tests/test_TrialWaveFunction_He.cpp index ec1bd7ff24..ed969b392c 100644 --- a/src/QMCWaveFunctions/tests/test_TrialWaveFunction_He.cpp +++ b/src/QMCWaveFunctions/tests/test_TrialWaveFunction_He.cpp @@ -17,7 +17,7 @@ #include "Particle/ParticleSet.h" #include "Particle/ParticleSetPool.h" #include "QMCWaveFunctions/TrialWaveFunction.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" #include "QMCWaveFunctions/Fermion/DiracDeterminant.h" #include "QMCWaveFunctions/Fermion/SlaterDet.h" #include "QMCWaveFunctions/Jastrow/RadialJastrowBuilder.h" diff --git a/src/QMCWaveFunctions/tests/test_TrialWaveFunction_diamondC_2x1x1.cpp b/src/QMCWaveFunctions/tests/test_TrialWaveFunction_diamondC_2x1x1.cpp index d24570574e..e36e2f59c2 100644 --- a/src/QMCWaveFunctions/tests/test_TrialWaveFunction_diamondC_2x1x1.cpp +++ b/src/QMCWaveFunctions/tests/test_TrialWaveFunction_diamondC_2x1x1.cpp @@ -18,7 +18,7 @@ #include "ParticleSetPool.h" #include "DistanceTable.h" #include "QMCWaveFunctions/TrialWaveFunction.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" #include "QMCWaveFunctions/Fermion/DiracDeterminantBatched.h" #include "QMCWaveFunctions/Fermion/DiracDeterminant.h" #include "QMCWaveFunctions/Fermion/SlaterDet.h" diff --git a/src/QMCWaveFunctions/tests/test_einset.cpp b/src/QMCWaveFunctions/tests/test_einset.cpp index ca6cb4b8d6..8dd00c2621 100644 --- a/src/QMCWaveFunctions/tests/test_einset.cpp +++ b/src/QMCWaveFunctions/tests/test_einset.cpp @@ -17,8 +17,8 @@ #include "Particle/ParticleSet.h" #include "Particle/ParticleSetPool.h" #include "QMCWaveFunctions/WaveFunctionComponent.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "QMCWaveFunctions/EinsplineSpinorSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSpinorSetBuilder.h" #include #include diff --git a/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp b/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp index 1758a13d33..6642f86761 100644 --- a/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp +++ b/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp @@ -17,8 +17,8 @@ #include "Particle/ParticleSet.h" #include "Particle/ParticleSetPool.h" #include "QMCWaveFunctions/WaveFunctionComponent.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "QMCWaveFunctions/EinsplineSpinorSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSpinorSetBuilder.h" #include #include diff --git a/src/QMCWaveFunctions/tests/test_hybridrep.cpp b/src/QMCWaveFunctions/tests/test_hybridrep.cpp index b56b37d096..e0c3d8eec2 100644 --- a/src/QMCWaveFunctions/tests/test_hybridrep.cpp +++ b/src/QMCWaveFunctions/tests/test_hybridrep.cpp @@ -22,8 +22,8 @@ #include "Particle/ParticleSet.h" #include "Particle/ParticleSetPool.h" #include "QMCWaveFunctions/WaveFunctionComponent.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "QMCWaveFunctions/EinsplineSpinorSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSpinorSetBuilder.h" #include using std::string; diff --git a/src/QMCWaveFunctions/tests/test_spline_applyrotation.cpp b/src/QMCWaveFunctions/tests/test_spline_applyrotation.cpp index 05cca909d4..b0741c2074 100644 --- a/src/QMCWaveFunctions/tests/test_spline_applyrotation.cpp +++ b/src/QMCWaveFunctions/tests/test_spline_applyrotation.cpp @@ -16,8 +16,8 @@ #include "Particle/ParticleSet.h" #include "Particle/ParticleSetPool.h" #include "QMCWaveFunctions/WaveFunctionComponent.h" -#include "QMCWaveFunctions/EinsplineSetBuilder.h" -#include "QMCWaveFunctions/EinsplineSpinorSetBuilder.h" +#include "BsplineFactory/EinsplineSetBuilder.h" +#include "BsplineFactory/EinsplineSpinorSetBuilder.h" #include "QMCWaveFunctions/BsplineFactory/SplineC2C.h" #include "Utilities/for_testing/checkMatrix.hpp"