diff --git a/src/QMCDrivers/Crowd.cpp b/src/QMCDrivers/Crowd.cpp index d18dcd5dc2..208fe1290e 100644 --- a/src/QMCDrivers/Crowd.cpp +++ b/src/QMCDrivers/Crowd.cpp @@ -19,7 +19,7 @@ Crowd::Crowd(EstimatorManagerNew& emb, const TrialWaveFunction& twf, const QMCHamiltonian& ham, const MultiWalkerDispatchers& dispatchers) - : dispatchers_(dispatchers), driverwalker_resource_collection_(driverwalker_res), estimator_manager_crowd_(emb) + : dispatchers_(dispatchers), driverwalker_resource_collection_(driverwalker_res), estimator_manager_crowd_(emb) { if (emb.areThereListeners()) { @@ -82,27 +82,32 @@ void Crowd::startBlock(int num_steps) // VMCBatched does no nonlocal moves n_nonlocal_accept_ = 0; estimator_manager_crowd_.startBlock(num_steps); - if(wlog_collector_) + if (wlog_collector_) wlog_collector_->startBlock(); } void Crowd::stopBlock() { estimator_manager_crowd_.stopBlock(); } -void Crowd::setWalkerLogCollector(std::unique_ptr&& collector) { wlog_collector_ = std::move(collector); } +void Crowd::setWalkerLogCollector(std::unique_ptr&& collector) +{ + wlog_collector_ = std::move(collector); +} void Crowd::collectStepWalkerLog(int current_step) { - if(!wlog_collector_) return; + if (!wlog_collector_) + return; for (int iw = 0; iw < size(); ++iw) - wlog_collector_->collect(mcp_walkers_[iw], walker_elecs_[iw], walker_twfs_[iw], walker_hamiltonians_[iw], current_step); + wlog_collector_->collect(mcp_walkers_[iw], walker_elecs_[iw], walker_twfs_[iw], walker_hamiltonians_[iw], + current_step); } RefVector Crowd::getWalkerLogCollectorRefs(const UPtrVector& crowds) { RefVector refs; - for(auto& crowd : crowds) - if(crowd && crowd->wlog_collector_) + for (auto& crowd : crowds) + if (crowd && crowd->wlog_collector_) refs.push_back(*crowd->wlog_collector_); return refs; } diff --git a/src/QMCDrivers/Crowd.h b/src/QMCDrivers/Crowd.h index 47a49bf00b..821b95638a 100644 --- a/src/QMCDrivers/Crowd.h +++ b/src/QMCDrivers/Crowd.h @@ -52,9 +52,9 @@ class Crowd */ Crowd(EstimatorManagerNew& emb, const DriverWalkerResourceCollection& driverwalker_res, - const ParticleSet& pset, + const ParticleSet& pset, const TrialWaveFunction& twf, - const QMCHamiltonian& hamiltonian_temp, + const QMCHamiltonian& hamiltonian_temp, const MultiWalkerDispatchers& dispatchers); ~Crowd(); /** Because so many vectors allocate them upfront. diff --git a/src/QMCDrivers/DMC/DMCBatched.cpp b/src/QMCDrivers/DMC/DMCBatched.cpp index 55920c22c9..33d595b580 100644 --- a/src/QMCDrivers/DMC/DMCBatched.cpp +++ b/src/QMCDrivers/DMC/DMCBatched.cpp @@ -442,7 +442,7 @@ bool DMCBatched::run() //register walker log collectors into the manager if (wlog_manager_) - wlog_manager_->startRun(Crowd::getWalkerLogCollectorRefs(crowds_)); + wlog_manager_->startRun(Crowd::getWalkerLogCollectorRefs(crowds_)); StateForThread dmc_state(qmcdriver_input_, *drift_modifier_, *branch_engine_, population_, steps_per_block_); @@ -498,7 +498,7 @@ bool DMCBatched::run() for (UPtr& ham : population_.get_hamiltonians()) setNonLocalMoveHandler(*ham); - dmc_state.step = step; + 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_)); @@ -518,7 +518,7 @@ bool DMCBatched::run() measureImbalance("Block " + std::to_string(block)); endBlock(); if (wlog_manager_) - wlog_manager_->writeBuffers(); + wlog_manager_->writeBuffers(); recordBlock(block); } diff --git a/src/QMCDrivers/DMC/DMCBatched.h b/src/QMCDrivers/DMC/DMCBatched.h index fbb318ca7d..e334128de2 100644 --- a/src/QMCDrivers/DMC/DMCBatched.h +++ b/src/QMCDrivers/DMC/DMCBatched.h @@ -52,8 +52,8 @@ class DMCBatched : public QMCDriverNew SFNBranch& branch_engine; IndexType recalculate_properties_period; const size_t steps_per_block; - IndexType step = -1; - IndexType global_step = -1; + IndexType step = -1; + IndexType global_step = -1; bool is_recomputing_block = false; StateForThread(const QMCDriverInput& qmci, diff --git a/src/QMCDrivers/VMC/VMCBatched.cpp b/src/QMCDrivers/VMC/VMCBatched.cpp index 754dae81ae..c095448eee 100644 --- a/src/QMCDrivers/VMC/VMCBatched.cpp +++ b/src/QMCDrivers/VMC/VMCBatched.cpp @@ -389,7 +389,7 @@ bool VMCBatched::run() for (int step = 0; step < steps_per_block_; ++step, ++global_step) { ScopedTimer local_timer(timers_.run_steps_timer); - vmc_state.step = step; + vmc_state.step = step; vmc_state.global_step = global_step; crowd_task(crowds_.size(), runVMCStep, vmc_state, timers_, std::ref(step_contexts_), std::ref(crowds_)); @@ -407,7 +407,7 @@ bool VMCBatched::run() measureImbalance("Block " + std::to_string(block)); endBlock(); if (wlog_manager_) - wlog_manager_->writeBuffers(); + wlog_manager_->writeBuffers(); recordBlock(block); } @@ -463,7 +463,7 @@ void VMCBatched::enable_sample_collection() { assert(steps_per_block_ > 0 && "VMCBatched::enable_sample_collection steps_per_block_ must be positive!"); auto samples = compute_samples_per_rank(qmcdriver_input_.get_max_blocks(), steps_per_block_, - population_.get_num_local_walkers()); + population_.get_num_local_walkers()); samples_.setMaxSamples(samples, population_.get_num_ranks()); collect_samples_ = true; diff --git a/src/QMCDrivers/VMC/VMCBatched.h b/src/QMCDrivers/VMC/VMCBatched.h index 8c4cee5882..994b3d45c5 100644 --- a/src/QMCDrivers/VMC/VMCBatched.h +++ b/src/QMCDrivers/VMC/VMCBatched.h @@ -53,7 +53,7 @@ class VMCBatched : public QMCDriverNew IndexType recalculate_properties_period; const size_t steps_per_block; IndexType step = -1; - IndexType global_step = -1; + IndexType global_step = -1; bool is_recomputing_block = false; StateForThread(const QMCDriverInput& qmci, diff --git a/src/QMCDrivers/WalkerLogCollector.cpp b/src/QMCDrivers/WalkerLogCollector.cpp index c427c671bc..4be0e99057 100644 --- a/src/QMCDrivers/WalkerLogCollector.cpp +++ b/src/QMCDrivers/WalkerLogCollector.cpp @@ -23,17 +23,14 @@ namespace qmcplusplus using MCPWalker = Walker; -WalkerLogCollector::WalkerLogCollector(const WalkerLogState& state): state_(state) -{ - init(); -} +WalkerLogCollector::WalkerLogCollector(const WalkerLogState& state) : state_(state) { init(); } void WalkerLogCollector::init() { properties_include = {"R2Accepted", "R2Proposed", "LocalEnergy", "LocalPotential", "Kinetic", - "ElecElec", "ElecIon", "LocalECP", "NonLocalECP"}; - energy_index = -1; + "ElecElec", "ElecIon", "LocalECP", "NonLocalECP"}; + energy_index = -1; // empty walker steps and energy vectors for the MC block steps.resize(0); energies.resize(0); diff --git a/src/QMCDrivers/WalkerLogManager.cpp b/src/QMCDrivers/WalkerLogManager.cpp index 74802fe313..25fe357cec 100644 --- a/src/QMCDrivers/WalkerLogManager.cpp +++ b/src/QMCDrivers/WalkerLogManager.cpp @@ -168,8 +168,8 @@ void WalkerLogManager::writeBuffers() size_t c, r; if (write_min_data) { // cache data for minimum energy walker - c = std::get<2>(energy_order[nmin]); - r = std::get<3>(energy_order[nmin]); + c = std::get<2>(energy_order[nmin]); + r = std::get<3>(energy_order[nmin]); WalkerLogCollector& tc = collectors[c]; wmin_property_int_buffer.addRow(tc.walker_property_int_buffer, r); wmin_property_real_buffer.addRow(tc.walker_property_real_buffer, r); @@ -177,8 +177,8 @@ void WalkerLogManager::writeBuffers() } if (write_max_data) { // cache data for maximum energy walker - c = std::get<2>(energy_order[nmax]); - r = std::get<3>(energy_order[nmax]); + c = std::get<2>(energy_order[nmax]); + r = std::get<3>(energy_order[nmax]); WalkerLogCollector& tc = collectors[c]; wmax_property_int_buffer.addRow(tc.walker_property_int_buffer, r); wmax_property_real_buffer.addRow(tc.walker_property_real_buffer, r); @@ -186,8 +186,8 @@ void WalkerLogManager::writeBuffers() } if (write_med_data) { // cache data for median energy walker - c = std::get<2>(energy_order[nmed]); - r = std::get<3>(energy_order[nmed]); + c = std::get<2>(energy_order[nmed]); + r = std::get<3>(energy_order[nmed]); WalkerLogCollector& tc = collectors[c]; wmed_property_int_buffer.addRow(tc.walker_property_int_buffer, r); wmed_property_real_buffer.addRow(tc.walker_property_real_buffer, r); diff --git a/src/QMCDrivers/WalkerLogManager.h b/src/QMCDrivers/WalkerLogManager.h index 931abcaddd..be00e1b5a5 100644 --- a/src/QMCDrivers/WalkerLogManager.h +++ b/src/QMCDrivers/WalkerLogManager.h @@ -43,13 +43,12 @@ struct WalkerLogInput; */ class WalkerLogManager { -public: - WalkerLogState state; - private: /// file prefix for the current driver std::string file_root; Communicate* communicator; + /// output state + WalkerLogState state; /// access to HDF file std::unique_ptr hdf_file; /// whether walker quantity data ("data_layout") has been recorded in HDF