diff --git a/docs/methods.rst b/docs/methods.rst
index 25c5c49650..0067175873 100644
--- a/docs/methods.rst
+++ b/docs/methods.rst
@@ -1904,4 +1904,251 @@ declaration to ensure correct sampling:
a new all-electron configuration, at which point the action is
computed and the move is either accepted or rejected.
+
+
+.. _walker_logging
+
+Walker Data Logging
+===================
+
+Detailed per-walker information can be written to HDF5 files for VMC or DMC by
+including the XML element. This includes the LocalEnergy and
+its components for each walker from each MC step. By default, more detailed
+particle-level information (e.g. electron coordinates) is also written for the
+lowest, highest, and median energy walkers at each MC step (modest disk usage).
+Optionally, particle-level information can also be written for all walkers,
+potentially requiring a huge amount of disk space.
+
+**Input specification**
+
+The default walker data logging functionality is enabled by including the
+ XML element (once) just before the QMC driver sections,
+for example:
+
+::
+
+
+
+ 256
+ 100
+ 200
+ 10
+ 3
+ 0.3
+ yes
+
+
+ 256
+ 40
+ 800
+ 20
+ 0.01
+
+
+
+
+Optional XML attributes enable finer control over the behavior:
+
+.. table::
+
+ +------------------+--------------+--------------+-------------+----------------------------------------------------+
+ | **Name** | **Datatype** | **Values** | **Default** | **Description** |
+ +==================+==============+==============+=============+====================================================+
+ | ``step_period`` | integer | :math:`> 0` | 1 | Collect walker data every step_period MC steps |
+ +------------------+--------------+--------------+-------------+----------------------------------------------------+
+ | ``particle`` | text | yes,no | no | Write particle data for all walkers |
+ +------------------+--------------+--------------+-------------+----------------------------------------------------+
+ | ``quantiles`` | text | yes,no | yes | Write full data for min/max/median energy walkers |
+ +------------------+--------------+--------------+-------------+----------------------------------------------------+
+ | ``min`` | text | yes,no | yes | Enable/disable write for min energy walker data |
+ +------------------+--------------+--------------+-------------+----------------------------------------------------+
+ | ``max`` | text | yes,no | yes | Enable/disable write for max energy walker data |
+ +------------------+--------------+--------------+-------------+----------------------------------------------------+
+ | ``median`` | text | yes,no | yes | Enable/disable write for median energy walker data |
+ +------------------+--------------+--------------+-------------+----------------------------------------------------+
+ | ``verbose`` | text | yes,no | no | Write more log file information |
+ +------------------+--------------+--------------+-------------+----------------------------------------------------+
+
+
+Additional information:
+
+- ``step_period``: By default, data for each walker is collected every MC
+ step, corresponding to step_period=1. A sub-sampling of the walker
+ data may be obtained instead by setting step_period>1. For example,
+ with step_period=5, walker data is collected every 5th MC step.
+
+- ``particle``: This controls whether per-particle data is written to
+ the walker log HDF files along with scalar walker properties. These data
+ comprise: electron coordinates, spin coordinates (spinor runs only),
+ per-particle wavefunction gradients, and per-particle wavefunction
+ laplacian values.
+
+- ``quantiles``: Write out full (scalar and per-particle) data for walkers
+ at specific quantiles of the local energy distribution. Currently,
+ these quantiles are the minimum, maximum, and median.
+
+- ``min``: Selectively disable writing data for the minimum energy
+ walkers. Active only if qtiles=yes.
+
+- ``max``: Selectively disable writing data for the maximum energy
+ walkers. Active only if qtiles=yes.
+
+- ``median``: Selectively disable writing data for the median energy
+ walkers. Active only if qtiles=yes.
+
+- ``verbose``: If "yes", write function-call information related to
+ the walker logging functionality. This option is mainly intended
+ for developers, as it is of little use in practical runs.
+
+
+**Output files**
+
+The HDF5 files created by the walker logging functionality have the extension \*.wlogs.h5.
+For each VMC or DMC section, one of these files is written for every MPI rank in the run.
+
+For the example XML inputs shown above, QMCPACK run on 6 MPI ranks would produce (at least)
+the following output data files:
+
+::
+
+ qmc.s000.scalar.dat
+ qmc.s000.stat.h5
+ qmc.s000.p000.wlogs.h5
+ qmc.s000.p001.wlogs.h5
+ qmc.s000.p002.wlogs.h5
+ qmc.s000.p003.wlogs.h5
+ qmc.s000.p004.wlogs.h5
+ qmc.s000.p005.wlogs.h5
+
+ qmc.s001.scalar.dat
+ qmc.s001.dmc.dat
+ qmc.s001.stat.h5
+ qmc.s001.p000.wlogs.h5
+ qmc.s001.p001.wlogs.h5
+ qmc.s001.p002.wlogs.h5
+ qmc.s001.p003.wlogs.h5
+ qmc.s001.p004.wlogs.h5
+ qmc.s001.p005.wlogs.h5
+
+
+A single wlogs.h5 file has several walker data buffers (names with underscores below):
+
+::
+
+ # scalar (int/real) data for all walkers
+ walker_property_int walker_property_real
+
+ # scalar and per-particle data for min energy walkers
+ wmin_property_int wmin_property_real wmin_particle_real
+
+ # scalar and per-particle data for max energy walkers
+ wmax_property_int wmax_property_real wmax_particle_real
+
+ # scalar and per-particle data for median energy walkers
+ wmed_property_int wmed_property_real wmed_particle_real
+
+
+Each data buffer contains packed walker data in the form of a large 2D array ("data" below):
+
+::
+
+ >h5ls qmc.s000.p000.wlogs.h5/walker_property_int
+ data Dataset {512000/Inf, 4}
+ data_layout Group
+
+ >h5ls qmc.s000.p000.wlogs.h5/walker_property_real
+ data Dataset {512000/Inf, 15}
+ data_layout Group
+
+
+Each row in the 2D data array/buffer contains data for a single walker at a single MC step.
+In this case, 256 walkers were advanced through 200\*10=2000 steps for 512000 row entries total.
+
+The location of each particular walker quantity in each row is listed in "data_layout":
+
+::
+
+ >h5ls qmc.s000.p000.wlogs.h5/walker_property_int/data_layout
+ id Group # unique walker id
+ parent_id Group # id of parent (DMC branching)
+ step Group # MC step number
+ age Group # walker "age"
+
+ >h5ls qmc.s000.p000.wlogs.h5/walker_property_real/data_layout
+ weight Group # statistical weight of the walker
+ LocalEnergy Group # the local (total) energy
+ Kinetic Group # kinetic energy
+ LocalPotential Group # full potential energy (all terms)
+ ElecElec Group # electron-electron energy
+ LocalECP Group # energy for local channel of ECP
+ NonLocalECP Group # energy for non-local channels of ECP
+ logpsi Group # log of wavefunction modulus
+ phase Group # wavefunction phase
+ dlogpsi2 Group # squared gradient of wavefunction log-modulus
+ dphase2 Group # squared gradient of wavefunction phase
+ dr_node_min Group # estimate of min distance to wfn node along any dimension
+ multiplicity Group # branching multiplicity (DMC only)
+ R2Accepted Group # average diffusion of accepted MC moves
+ R2Proposed Group # average diffusion of proposed MC moves
+
+From this we can see, e.g., that the value for the MC "step" is stored at column
+index 0 in walker_property_int/data and the LocalEnergy is stored at column index 6
+in walker_property_real/data:
+
+::
+
+ >h5ls -d qmc.s000.p000.wlogs.h5/walker_property_int/data_layout/step/index_start
+ index_start Dataset {SCALAR}
+ Data:
+ (0) 0
+
+ >h5ls -d qmc.s000.p000.wlogs.h5/walker_property_real/data_layout/LocalEnergy/index_start
+ index_start Dataset {SCALAR}
+ Data:
+ (0) 6
+
+
+The per-particle data is arranged similarly:
+
+::
+
+ >h5ls -d qmc_log_dmc_legacy.s000.p000.wlogs.h5/wmin_particle_real/data_layout
+ R Group # electron coordinates
+ G Group # wavefunction gradient
+ L Group # wavefunction laplacian (per-particle)
+
+
+However, more information is required in the data_layout to fully specify the location and
+shape of the particle-level array data (simplified view for a run with 8 electrons and a
+real-valued wavefunction):
+
+::
+
+ >h5ls -d qmc.s000.p000.wlogs.h5/wmin_particle_real/data_layout/R
+ index_start 0 # data starts at column index 0
+ index_end 24 # data ends at column index 24
+ dimension 2 # array is 2-dimensional
+ size 24 # array has 24 elements total
+ shape 8, 3, 0, 0 # array has shape 8x3
+ unit_size 1 # each unit of data stored as 1 real value
+
+ >h5ls -d qmc.s000.p000.wlogs.h5/wmin_particle_real/data_layout/G
+ index_start 24 # data starts at column index 24
+ index_end 48 # data ends at column index 48
+ dimension 2 # array is 2-dimensional
+ size 24 # array has 24 elements total
+ shape 8, 3, 0, 0 # array has shape 8x3
+ unit_size 1 # data stored as single real values (2 if complex)
+
+ >h5ls -d qmc.s000.p000.wlogs.h5/wmin_particle_real/data_layout/L
+ index_start 48 # data starts at column index 48
+ index_end 56 # data ends at column index 56
+ dimension 1 # array is 1-dimensional
+ size 8 # array has 8 elements total
+ shape 8, 0, 0, 0 # array has linear shape, length 8
+ unit_size 1 # data stored as single real values (2 if complex)
+
+
+
+
.. bibliography:: /bibs/methods.bib
diff --git a/src/Estimators/tests/test_trace_manager.cpp b/src/Estimators/tests/test_trace_manager.cpp
index aef62d4bcf..9e54a33a3c 100644
--- a/src/Estimators/tests/test_trace_manager.cpp
+++ b/src/Estimators/tests/test_trace_manager.cpp
@@ -4,7 +4,7 @@
//
// Copyright (c) 2018 Jeongnim Kim and QMCPACK developers.
//
-// File developed by: Mark Dewing, mdewin@anl.gov, Argonne National Laboratory
+// File developed by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
//
// File created by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
//////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/QMCApp/QMCMain.cpp b/src/QMCApp/QMCMain.cpp
index 85c085c0d4..96927cb22e 100644
--- a/src/QMCApp/QMCMain.cpp
+++ b/src/QMCApp/QMCMain.cpp
@@ -62,7 +62,8 @@ QMCMain::QMCMain(Communicate* c)
psi_pool_(std::make_unique(my_project_.getRuntimeOptions(), *particle_set_pool_, myComm)),
ham_pool_(std::make_unique(*particle_set_pool_, *psi_pool_, myComm)),
qmc_system_(nullptr),
- first_qmc_(true)
+ first_qmc_(true),
+ walker_logs_xml_(NULL)
#if !defined(REMOVE_TRACEMANAGER)
,
traces_xml_(NULL)
@@ -479,6 +480,10 @@ bool QMCMain::validateXML()
traces_xml_ = cur;
}
#endif
+ else if (cname == "walkerlogs")
+ {
+ walker_logs_xml_ = cur;
+ }
else
{
//everything else goes to m_qmcaction
@@ -624,6 +629,7 @@ bool QMCMain::runQMC(xmlNodePtr cur, bool reuse)
#if !defined(REMOVE_TRACEMANAGER)
qmc_driver->putTraces(traces_xml_);
#endif
+ qmc_driver->putWalkerLogs(walker_logs_xml_);
{
ScopedTimer qmc_run_timer(createGlobalTimer(qmc_driver->getEngineName(), timer_level_coarse));
Timer process_and_run;
diff --git a/src/QMCApp/QMCMain.h b/src/QMCApp/QMCMain.h
index 85be18eb16..ed6282d322 100644
--- a/src/QMCApp/QMCMain.h
+++ b/src/QMCApp/QMCMain.h
@@ -75,6 +75,9 @@ class QMCMain : public MPIObjectBase, public QMCAppBase
///xml mcwalkerset read-in elements
std::vector walker_set_in_;
+ ///walkerlogs xml
+ xmlNodePtr walker_logs_xml_;
+
///traces xml
xmlNodePtr traces_xml_;
diff --git a/src/QMCDrivers/CloneManager.cpp b/src/QMCDrivers/CloneManager.cpp
index 9f5e283638..02e01f1659 100644
--- a/src/QMCDrivers/CloneManager.cpp
+++ b/src/QMCDrivers/CloneManager.cpp
@@ -27,6 +27,7 @@
#else
using TraceManager = int;
#endif
+#include "WalkerLogManager.h"
//comment this out to use only method to clone
#define ENABLE_CLONE_PSI_AND_H
@@ -86,6 +87,7 @@ CloneManager::~CloneManager()
#if !defined(REMOVE_TRACEMANAGER)
delete_iter(traceClones.begin(), traceClones.end());
#endif
+ delete_iter(wlog_collectors.begin(), wlog_collectors.end());
}
void CloneManager::makeClones(MCWalkerConfiguration& w, TrialWaveFunction& psi, QMCHamiltonian& ham)
diff --git a/src/QMCDrivers/CloneManager.h b/src/QMCDrivers/CloneManager.h
index 0d3c86d15a..d8f41b962a 100644
--- a/src/QMCDrivers/CloneManager.h
+++ b/src/QMCDrivers/CloneManager.h
@@ -75,6 +75,8 @@ class CloneManager : public QMCTraits
std::vector estimatorClones;
///trace managers
std::vector traceClones;
+ ///trace collectors
+ std::vector wlog_collectors;
//for correlated sampling.
static std::vector> WPoolClones_uptr;
diff --git a/src/QMCDrivers/Crowd.cpp b/src/QMCDrivers/Crowd.cpp
index 2bb3aa7bc8..a00a458fa4 100644
--- a/src/QMCDrivers/Crowd.cpp
+++ b/src/QMCDrivers/Crowd.cpp
@@ -10,6 +10,7 @@
#include "Crowd.h"
#include "QMCHamiltonians/QMCHamiltonian.h"
+
namespace qmcplusplus
{
Crowd::Crowd(EstimatorManagerNew& emb,
@@ -81,8 +82,16 @@ void Crowd::startBlock(int num_steps)
// VMCBatched does no nonlocal moves
n_nonlocal_accept_ = 0;
estimator_manager_crowd_.startBlock(num_steps);
+ wlog_collector_.startBlock();
}
void Crowd::stopBlock() { estimator_manager_crowd_.stopBlock(); }
+void Crowd::collectStepWalkerLog(int current_step)
+{
+ for (int iw = 0; iw < size(); ++iw)
+ wlog_collector_.collect(mcp_walkers_[iw], walker_elecs_[iw], walker_twfs_[iw], walker_hamiltonians_[iw], current_step);
+}
+
+
} // namespace qmcplusplus
diff --git a/src/QMCDrivers/Crowd.h b/src/QMCDrivers/Crowd.h
index 6de8b91195..ee468ce2b0 100644
--- a/src/QMCDrivers/Crowd.h
+++ b/src/QMCDrivers/Crowd.h
@@ -16,12 +16,14 @@
#include "MultiWalkerDispatchers.h"
#include "DriverWalkerTypes.h"
#include "Estimators/EstimatorManagerCrowd.h"
+#include "WalkerLogManager.h"
namespace qmcplusplus
{
// forward declaration
class ResourceCollection;
class EstimatorManagerNew;
+class WalkerLogCollector;
/** Driver synchronized step context
*
@@ -83,6 +85,9 @@ class Crowd
estimator_manager_crowd_.accumulate(mcp_walkers_, walker_elecs_, walker_twfs_, walker_hamiltonians_, rng);
}
+ /// Collect walker log data
+ void collectStepWalkerLog(int current_step);
+
void setRNGForHamiltonian(RandomBase& rng);
auto beginWalkers() { return mcp_walkers_.begin(); }
@@ -98,6 +103,7 @@ class Crowd
const RefVector& get_walker_hamiltonians() const { return walker_hamiltonians_; }
const EstimatorManagerCrowd& get_estimator_manager_crowd() const { return estimator_manager_crowd_; }
+ WalkerLogCollector& getWalkerLogCollector() { return wlog_collector_; }
DriverWalkerResourceCollection& getSharedResource() { return driverwalker_resource_collection_; }
@@ -129,6 +135,8 @@ class Crowd
DriverWalkerResourceCollection driverwalker_resource_collection_;
/// per crowd estimator manager
EstimatorManagerCrowd estimator_manager_crowd_;
+ // collector for walker logs
+ WalkerLogCollector wlog_collector_;
/** @name Step State
*
diff --git a/src/QMCDrivers/DMC/DMC.cpp b/src/QMCDrivers/DMC/DMC.cpp
index 8592e073a6..46e705550e 100644
--- a/src/QMCDrivers/DMC/DMC.cpp
+++ b/src/QMCDrivers/DMC/DMC.cpp
@@ -36,6 +36,7 @@
#else
using TraceManager = int;
#endif
+#include "WalkerLogManager.h"
namespace qmcplusplus
{
@@ -93,6 +94,7 @@ void DMC::resetUpdateEngines()
Rng.resize(NumThreads);
estimatorClones.resize(NumThreads, nullptr);
traceClones.resize(NumThreads, nullptr);
+ wlog_collectors.resize(NumThreads, nullptr);
FairDivideLow(W.getActiveWalkers(), NumThreads, wPerRank);
{
@@ -130,6 +132,7 @@ void DMC::resetUpdateEngines()
#if !defined(REMOVE_TRACEMANAGER)
traceClones[ip] = Traces->makeClone();
#endif
+ wlog_collectors[ip] = wlog_manager_->makeCollector();
Rng[ip] = rngs_[ip]->makeClone();
hClones[ip]->setRandomGenerator(Rng[ip].get());
if (W.isSpinor())
@@ -140,7 +143,8 @@ void DMC::resetUpdateEngines()
Movers[ip] = new SODMCUpdatePbyPWithRejectionFast(*wClones[ip], *psiClones[ip], *hClones[ip], *Rng[ip]);
Movers[ip]->setSpinMass(SpinMass);
Movers[ip]->put(qmcNode);
- Movers[ip]->resetRun(branchEngine.get(), estimatorClones[ip], traceClones[ip], DriftModifier);
+ //Movers[ip]->resetRun(branchEngine.get(), estimatorClones[ip], traceClones[ip], DriftModifier);
+ Movers[ip]->resetRun2(branchEngine.get(), estimatorClones[ip], traceClones[ip], wlog_collectors[ip], DriftModifier);
Movers[ip]->initWalkersForPbyP(W.begin() + wPerRank[ip], W.begin() + wPerRank[ip + 1]);
}
else
@@ -158,7 +162,8 @@ void DMC::resetUpdateEngines()
Movers[ip] = new DMCUpdatePbyPWithRejectionFast(*wClones[ip], *psiClones[ip], *hClones[ip], *Rng[ip]);
Movers[ip]->put(qmcNode);
- Movers[ip]->resetRun(branchEngine.get(), estimatorClones[ip], traceClones[ip], DriftModifier);
+ //Movers[ip]->resetRun(branchEngine.get(), estimatorClones[ip], traceClones[ip], DriftModifier);
+ Movers[ip]->resetRun2(branchEngine.get(), estimatorClones[ip], traceClones[ip], wlog_collectors[ip], DriftModifier);
Movers[ip]->initWalkersForPbyP(W.begin() + wPerRank[ip], W.begin() + wPerRank[ip + 1]);
}
else
@@ -168,7 +173,8 @@ void DMC::resetUpdateEngines()
else
Movers[ip] = new DMCUpdateAllWithRejection(*wClones[ip], *psiClones[ip], *hClones[ip], *Rng[ip]);
Movers[ip]->put(qmcNode);
- Movers[ip]->resetRun(branchEngine.get(), estimatorClones[ip], traceClones[ip], DriftModifier);
+ //Movers[ip]->resetRun(branchEngine.get(), estimatorClones[ip], traceClones[ip], DriftModifier);
+ Movers[ip]->resetRun2(branchEngine.get(), estimatorClones[ip], traceClones[ip], wlog_collectors[ip], DriftModifier);
Movers[ip]->initWalkers(W.begin() + wPerRank[ip], W.begin() + wPerRank[ip + 1]);
}
}
@@ -179,12 +185,9 @@ void DMC::resetUpdateEngines()
{
#pragma omp parallel for
for (int ip = 0; ip < NumThreads; ++ip)
- {
traceClones[ip]->transfer_state_from(*Traces);
- }
}
#endif
-
if (spinor)
app_log() << " Spins treated as dynamic variable with SpinMass: " << SpinMass << std::endl;
@@ -236,6 +239,7 @@ bool DMC::run()
#if !defined(REMOVE_TRACEMANAGER)
Traces->startRun(nBlocks, traceClones);
#endif
+ wlog_manager_->startRun(wlog_collectors);
IndexType block = 0;
IndexType updatePeriod = (qmc_driver_mode[QMC_UPDATE_MODE]) ? Period4CheckProperties : (nBlocks + 1) * nSteps;
int sample = 0;
@@ -293,6 +297,7 @@ bool DMC::run()
#if !defined(REMOVE_TRACEMANAGER)
Traces->write_buffers(traceClones, block);
#endif
+ wlog_manager_->writeBuffers(wlog_collectors);
block++;
if (DumpConfig && block % Period4CheckPoint == 0)
{
@@ -326,6 +331,7 @@ bool DMC::run()
#if !defined(REMOVE_TRACEMANAGER)
Traces->stopRun();
#endif
+ wlog_manager_->stopRun();
return finalize(nBlocks);
}
diff --git a/src/QMCDrivers/DMC/DMCBatched.cpp b/src/QMCDrivers/DMC/DMCBatched.cpp
index c59ca331ba..4a8d97da6b 100644
--- a/src/QMCDrivers/DMC/DMCBatched.cpp
+++ b/src/QMCDrivers/DMC/DMCBatched.cpp
@@ -288,6 +288,9 @@ void DMCBatched::advanceWalkers(const StateForThread& sft,
crowd.accumulate(step_context.get_random_gen());
}
+ // collect walker logs
+ crowd.collectStepWalkerLog(sft.global_step);
+
{ // T-moves
ScopedTimer tmove_timer(dmc_timers.tmove_timer);
@@ -429,6 +432,14 @@ bool DMCBatched::run()
IndexType num_blocks = qmcdriver_input_.get_max_blocks();
estimator_manager_->startDriverRun();
+
+ //start walker log manager
+ wlog_manager_ = std::make_unique(walker_logs_input, allow_walker_logs, get_root_name(), myComm);
+ std::vector wlog_collectors;
+ for (auto& c: crowds_)
+ wlog_collectors.push_back(&c->getWalkerLogCollector());
+ wlog_manager_->startRun(wlog_collectors);
+
StateForThread dmc_state(qmcdriver_input_, *drift_modifier_, *branch_engine_, population_, steps_per_block_);
LoopTimer<> dmc_loop;
@@ -457,6 +468,7 @@ bool DMCBatched::run()
ScopedTimer local_timer(timers_.production_timer);
ParallelExecutor<> crowd_task;
+ int global_step = 0;
for (int block = 0; block < num_blocks; ++block)
{
{
@@ -473,7 +485,7 @@ bool DMCBatched::run()
for (UPtr& crowd : crowds_)
crowd->startBlock(steps_per_block_);
- for (int step = 0; step < steps_per_block_; ++step)
+ for (int step = 0; step < steps_per_block_; ++step, ++global_step)
{
ScopedTimer local_timer(timers_.run_steps_timer);
@@ -483,6 +495,7 @@ bool DMCBatched::run()
setNonLocalMoveHandler(*ham);
dmc_state.step = step;
+ dmc_state.global_step = global_step;
crowd_task(crowds_.size(), runDMCStep, dmc_state, timers_, dmc_timers_, std::ref(step_contexts_),
std::ref(crowds_));
@@ -500,6 +513,7 @@ bool DMCBatched::run()
if (qmcdriver_input_.get_measure_imbalance())
measureImbalance("Block " + std::to_string(block));
endBlock();
+ wlog_manager_->writeBuffers(wlog_collectors);
recordBlock(block);
}
@@ -523,6 +537,7 @@ bool DMCBatched::run()
print_mem("DMCBatched ends", app_log());
estimator_manager_->stopDriverRun();
+ wlog_manager_->stopRun();
return finalize(num_blocks, true);
}
diff --git a/src/QMCDrivers/DMC/DMCBatched.h b/src/QMCDrivers/DMC/DMCBatched.h
index d95ae0c8b6..fbb318ca7d 100644
--- a/src/QMCDrivers/DMC/DMCBatched.h
+++ b/src/QMCDrivers/DMC/DMCBatched.h
@@ -53,6 +53,7 @@ class DMCBatched : public QMCDriverNew
IndexType recalculate_properties_period;
const size_t steps_per_block;
IndexType step = -1;
+ IndexType global_step = -1;
bool is_recomputing_block = false;
StateForThread(const QMCDriverInput& qmci,
diff --git a/src/QMCDrivers/DMC/DMCUpdatePbyPFast.cpp b/src/QMCDrivers/DMC/DMCUpdatePbyPFast.cpp
index 5fb7d657a1..e28f017980 100644
--- a/src/QMCDrivers/DMC/DMCUpdatePbyPFast.cpp
+++ b/src/QMCDrivers/DMC/DMCUpdatePbyPFast.cpp
@@ -24,6 +24,7 @@
#else
using TraceManager = int;
#endif
+#include "WalkerLogManager.h"
//#define TEST_INNERBRANCH
@@ -170,6 +171,8 @@ void DMCUpdatePbyPWithRejectionFast::advanceWalker(Walker_t& thisWalker, bool re
#if !defined(REMOVE_TRACEMANAGER)
Traces->buffer_sample(W.current_step);
#endif
+ if(wlog_collector)
+ wlog_collector->collect(thisWalker,W,Psi,H);
{
ScopedTimer local_timer(myTimers[DMC_tmoves]);
const int NonLocalMoveAcceptedTemp = H.makeNonLocalMoves(W);
diff --git a/src/QMCDrivers/QMCDriver.cpp b/src/QMCDrivers/QMCDriver.cpp
index b60bc2d063..004fa45f27 100644
--- a/src/QMCDrivers/QMCDriver.cpp
+++ b/src/QMCDrivers/QMCDriver.cpp
@@ -36,6 +36,8 @@
#else
using TraceManager = int;
#endif
+#include "WalkerLogInput.h"
+#include "WalkerLogManager.h"
namespace qmcplusplus
{
@@ -62,6 +64,8 @@ QMCDriver::QMCDriver(const ProjectData& project_data,
DumpConfig = false;
IsQMCDriver = true;
allow_traces = false;
+ allow_walker_logs = false;
+ walker_logs_xml = NULL;
MyCounter = 0;
// value
//accept multiple names for the same value
@@ -198,11 +202,15 @@ void QMCDriver::process(xmlNodePtr cur)
#if !defined(REMOVE_TRACEMANAGER)
//create and initialize traces
if (!Traces)
- {
Traces = std::make_unique(myComm);
- }
Traces->put(traces_xml, allow_traces, RootName);
#endif
+ //create and initialize traces
+ if (!wlog_manager_)
+ {
+ WalkerLogInput walker_logs_input(walker_logs_xml);
+ wlog_manager_ = std::make_unique(walker_logs_input, allow_walker_logs, RootName, myComm);
+ }
branchEngine->put(cur);
Estimators->put(H, cur);
if (!wOut)
diff --git a/src/QMCDrivers/QMCDriver.h b/src/QMCDrivers/QMCDriver.h
index 571fa3d858..0b62c24f29 100644
--- a/src/QMCDrivers/QMCDriver.h
+++ b/src/QMCDrivers/QMCDriver.h
@@ -31,6 +31,7 @@
#include "QMCWaveFunctions/WaveFunctionPool.h"
#include "QMCHamiltonians/QMCHamiltonian.h"
#include "Estimators/EstimatorManagerBase.h"
+#include "WalkerLogManager.h"
#include "QMCDrivers/DriverTraits.h"
#include "QMCDrivers/QMCDriverInterface.h"
#include "QMCDrivers/GreenFunctionModifiers/DriftModifierBase.h"
@@ -62,6 +63,7 @@ namespace qmcplusplus
class MCWalkerConfiguration;
class HDFWalkerOutput;
class TraceManager;
+class WalkerLogManager;
/** @ingroup QMCDrivers
* @{
@@ -96,6 +98,11 @@ class QMCDriver : public QMCDriverInterface, public QMCTraits, public MPIObjectB
/// traces xml
xmlNodePtr traces_xml;
+ /// whether to allow traces
+ bool allow_walker_logs;
+ /// traces xml
+ xmlNodePtr walker_logs_xml;
+
/// Constructor.
QMCDriver(const ProjectData& project_data,
MCWalkerConfiguration& w,
@@ -149,6 +156,10 @@ class QMCDriver : public QMCDriverInterface, public QMCTraits, public MPIObjectB
inline void requestTraces(bool traces) override { allow_traces = traces; }
+ inline void putWalkerLogs(xmlNodePtr wlxml) override { walker_logs_xml = wlxml; }
+
+ inline void requestWalkerLogs(bool allow_walker_logs_) override { allow_walker_logs = allow_walker_logs_; }
+
std::string getEngineName() override { return QMCType; }
template
@@ -184,6 +195,9 @@ class QMCDriver : public QMCDriverInterface, public QMCTraits, public MPIObjectB
///Traces manager
std::unique_ptr Traces;
+ ///Traces manager
+ std::unique_ptr wlog_manager_;
+
///return the random generators
inline RefVector> getRngRefs() const
{
diff --git a/src/QMCDrivers/QMCDriverFactory.cpp b/src/QMCDrivers/QMCDriverFactory.cpp
index 00d3abd629..64ddf0bf5d 100644
--- a/src/QMCDrivers/QMCDriverFactory.cpp
+++ b/src/QMCDrivers/QMCDriverFactory.cpp
@@ -76,6 +76,7 @@ QMCDriverFactory::DriverAssemblyState QMCDriverFactory::readSection(xmlNodePtr c
aAttrib.add(append_tag, "append");
aAttrib.add(profiling_tag, "profiling");
aAttrib.add(das.traces_tag, "trace");
+ aAttrib.add(das.walkerlogs_tag, "walkerlog");
aAttrib.put(cur);
das.append_run = (append_tag == "yes");
das.enable_profiling = (profiling_tag == "yes");
@@ -294,6 +295,11 @@ std::unique_ptr QMCDriverFactory::createQMCDriver(xmlNodePtr
(das.traces_tag == "none" && (das.new_run_type == QMCRunType::VMC || das.new_run_type == QMCRunType::DMC));
new_driver->requestTraces(allow_traces);
+ //add trace information
+ bool allow_walker_logs = das.walkerlogs_tag == "yes" ||
+ (das.walkerlogs_tag == "none" && (das.new_run_type == QMCRunType::VMC || das.new_run_type == QMCRunType::DMC || das.new_run_type == QMCRunType::VMC_BATCH || das.new_run_type == QMCRunType::DMC_BATCH));
+ new_driver->requestWalkerLogs(allow_walker_logs);
+
return new_driver;
}
} // namespace qmcplusplus
diff --git a/src/QMCDrivers/QMCDriverFactory.h b/src/QMCDrivers/QMCDriverFactory.h
index c1dd191b8f..e3397da8ea 100644
--- a/src/QMCDrivers/QMCDriverFactory.h
+++ b/src/QMCDrivers/QMCDriverFactory.h
@@ -47,6 +47,7 @@ class QMCDriverFactory
bool append_run = false;
bool enable_profiling = false;
std::string traces_tag = "none";
+ std::string walkerlogs_tag = "none";
QMCRunType new_run_type = QMCRunType::DUMMY;
};
diff --git a/src/QMCDrivers/QMCDriverInterface.h b/src/QMCDrivers/QMCDriverInterface.h
index 7e20915583..6209ec31fe 100644
--- a/src/QMCDrivers/QMCDriverInterface.h
+++ b/src/QMCDrivers/QMCDriverInterface.h
@@ -49,6 +49,8 @@ class QMCDriverInterface
virtual void putWalkers(std::vector& wset) = 0;
virtual void putTraces(xmlNodePtr txml) = 0;
virtual void requestTraces(bool allow_traces) = 0;
+ virtual void putWalkerLogs(xmlNodePtr wlxml) = 0;
+ virtual void requestWalkerLogs(bool allow_walker_logs_) = 0;
virtual void process(xmlNodePtr cur) = 0;
virtual QMCRunType getRunType() = 0;
virtual std::string getEngineName() = 0;
diff --git a/src/QMCDrivers/QMCDriverNew.cpp b/src/QMCDrivers/QMCDriverNew.cpp
index 1ea7106080..ab37238376 100644
--- a/src/QMCDrivers/QMCDriverNew.cpp
+++ b/src/QMCDrivers/QMCDriverNew.cpp
@@ -33,6 +33,8 @@
#include "Utilities/Timer.h"
#include "Message/UniformCommunicateError.h"
#include "EstimatorInputDelegates.h"
+#include "WalkerLogInput.h"
+#include "WalkerLogManager.h"
namespace qmcplusplus
@@ -205,6 +207,7 @@ void QMCDriverNew::setStatus(const std::string& aname, const std::string& h5name
h5_file_root_ = h5name;
}
+
/** Read walker configurations from *.config.h5 files
* @param wset list of xml elements containing mcwalkerset
*
@@ -376,6 +379,18 @@ void QMCDriverNew::initialLogEvaluation(int crowd_id,
doesDoinTheseLastMatter(walkers[iw]);
}
+
+void QMCDriverNew::putWalkerLogs(xmlNodePtr wlxml)
+{
+ walker_logs_input.present = false;
+ if(wlxml)
+ {
+ walker_logs_input.readXML(wlxml);
+ walker_logs_input.present = true;
+ }
+}
+
+
std::ostream& operator<<(std::ostream& o_stream, const QMCDriverNew& qmcd)
{
o_stream << " time step = " << qmcd.qmcdriver_input_.get_tau() << '\n';
diff --git a/src/QMCDrivers/QMCDriverNew.h b/src/QMCDrivers/QMCDriverNew.h
index 079850cf3a..68f5e0e67c 100644
--- a/src/QMCDrivers/QMCDriverNew.h
+++ b/src/QMCDrivers/QMCDriverNew.h
@@ -43,6 +43,7 @@
#include "DriverWalkerTypes.h"
#include "TauParams.hpp"
#include "Particle/MCCoords.hpp"
+#include "WalkerLogInput.h"
#include
class Communicate;
@@ -51,6 +52,7 @@ namespace qmcplusplus
{
//forward declarations: Do not include headers if not needed
class TraceManager;
+class WalkerLogManager;
class EstimatorManagerNew;
class TrialWaveFunction;
class QMCHamiltonian;
@@ -101,6 +103,12 @@ class QMCDriverNew : public QMCDriverInterface, public MPIObjectBase
*/
std::bitset qmc_driver_mode_;
+ /// whether to allow walker logs
+ bool allow_walker_logs;
+ /// walker logs input
+ WalkerLogInput walker_logs_input;
+ //xmlNodePtr walker_logs_xml;
+
protected:
/** This is a data structure strictly for QMCDriver and its derived classes
*
@@ -241,6 +249,10 @@ class QMCDriverNew : public QMCDriverInterface, public MPIObjectBase
void putTraces(xmlNodePtr txml) override {}
void requestTraces(bool allow_traces) override {}
+ void putWalkerLogs(xmlNodePtr wlxml) override;
+
+ void requestWalkerLogs(bool allow_walker_logs_) override { allow_walker_logs = allow_walker_logs_; }
+
// scales a MCCoords by sqrtTau. Chooses appropriate taus by CT
template
static void scaleBySqrtTau(const TauParams