Skip to content

Commit

Permalink
Merge pull request #3447 from jtkrogel/ecp_ms_nofk2
Browse files Browse the repository at this point in the history
Port momentum distribution to batched drivers
  • Loading branch information
ye-luo authored Sep 24, 2021
2 parents f5dbe4b + d38cec0 commit 6d8fe7b
Show file tree
Hide file tree
Showing 7 changed files with 509 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/Estimators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ set(QMCEST_SRC
EstimatorManagerCrowd.cpp
CollectablesEstimator.cpp
OperatorEstBase.cpp
SpinDensityNew.cpp)
SpinDensityNew.cpp
MomentumDistribution.cpp
)

####################################
# create libqmcestimators
Expand Down
31 changes: 29 additions & 2 deletions src/Estimators/EstimatorManagerNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "EstimatorManagerNew.h"
#include "SpinDensityNew.h"
#include "MomentumDistribution.h"
#include "QMCHamiltonians/QMCHamiltonian.h"
#include "Message/Communicate.h"
#include "Message/CommOperators.h"
Expand Down Expand Up @@ -329,16 +330,19 @@ EstimatorManagerNew::EstimatorType* EstimatorManagerNew::getEstimator(const std:

bool EstimatorManagerNew::put(QMCHamiltonian& H, const ParticleSet& pset, xmlNodePtr cur)
{
std::vector<std::string> extra;
std::vector<std::string> extra_types;
std::vector<std::string> extra_names;
cur = cur->children;
while (cur != NULL)
{
std::string cname((const char*)(cur->name));
if (cname == "estimator")
{
std::string est_type("none");
std::string est_name(MainEstimatorName);
std::string use_hdf5("yes");
OhmmsAttributeSet hAttrib;
hAttrib.add(est_type, "type");
hAttrib.add(est_name, "name");
hAttrib.add(use_hdf5, "hdf5");
hAttrib.put(cur);
Expand Down Expand Up @@ -378,8 +382,20 @@ bool EstimatorManagerNew::put(QMCHamiltonian& H, const ParticleSet& pset, xmlNod
operator_ests_.emplace_back(
std::make_unique<SpinDensityNew>(std::move(spdi), pset.Lattice, pset.mySpecies, dl));
}
else if (est_type == "MomentumDistribution")
{
MomentumDistributionInput mdi;
mdi.readXML(cur);
DataLocality dl = DataLocality::crowd;
operator_ests_.emplace_back(
std::make_unique<MomentumDistribution>(std::move(mdi),
pset.getTotalNum(), pset.getTwist(), pset.Lattice, dl));
}
else
extra.push_back(est_name);
{
extra_types.push_back(est_type);
extra_names.push_back(est_name);
}
}
cur = cur->next;
}
Expand All @@ -395,6 +411,17 @@ bool EstimatorManagerNew::put(QMCHamiltonian& H, const ParticleSet& pset, xmlNod
app_log() << " Using CollectablesEstimator for collectables, e.g. sk, gofr, density " << std::endl;
Collectables = new CollectablesEstimator(H);
}
// Unrecognized estimators are not allowed
if (!extra_types.empty())
{
app_log() << "\nUnrecognized estimators in input:" << std::endl;
for (int i=0; i<extra_types.size(); i++)
{
app_log() << " type: "<<extra_types[i]<<" name: "<<extra_names[i]<<std::endl;
}
app_log() << std::endl;
throw UniformCommunicateError("Unrecognized estimators encountered in input. See log message for more details.");
}
return true;
}

Expand Down
Loading

0 comments on commit 6d8fe7b

Please sign in to comment.