mirror of https://github.com/QMCPACK/qmcpack.git
Avoid RNG copy and initialization in QMCDriverNew.
This commit is contained in:
parent
612b5b1643
commit
ef832e5b5c
|
@ -89,7 +89,11 @@ int QMCDriverNew::addObservable(const std::string& aname)
|
|||
QMCDriverNew::RealType QMCDriverNew::getObservable(int i) { return estimator_manager_->getObservable(i); }
|
||||
|
||||
|
||||
QMCDriverNew::~QMCDriverNew() {}
|
||||
QMCDriverNew::~QMCDriverNew()
|
||||
{
|
||||
for(int i = 0; i < Rng.size(); ++i)
|
||||
RandomNumberControl::Children[i] = Rng[i].release();
|
||||
}
|
||||
|
||||
void QMCDriverNew::add_H_and_Psi(QMCHamiltonian* h, TrialWaveFunction* psi)
|
||||
{
|
||||
|
@ -114,16 +118,6 @@ void QMCDriverNew::add_H_and_Psi(QMCHamiltonian* h, TrialWaveFunction* psi)
|
|||
*/
|
||||
void QMCDriverNew::process(xmlNodePtr cur)
|
||||
{
|
||||
// if (qmcdriver_input_.get_reset_random() || RandomNumberControl)
|
||||
// {
|
||||
|
||||
// if seeds are not made then neither are the children. So when MoveContexts are created a segfault occurs.
|
||||
// For now it is unclear whether get_reset_random should always be true on the first run or what.
|
||||
app_log() << " Regenerate random seeds." << std::endl;
|
||||
RandomNumberControl::make_seeds();
|
||||
// }
|
||||
|
||||
|
||||
setupWalkers();
|
||||
|
||||
// If you really want to persist the MCPopulation it is not the business of QMCDriver to reset it.
|
||||
|
@ -370,9 +364,11 @@ void QMCDriverNew::createRngsStepContexts()
|
|||
|
||||
for(int i = 0; i < num_crowds_; ++i)
|
||||
{
|
||||
Rng[i].reset(new RandomGenerator_t(*(RandomNumberControl::Children[i])));
|
||||
step_contexts_[i].reset(new ContextForSteps(crowds_[i]->size(), population_.get_num_particles(),
|
||||
population_.get_particle_group_indexes(), *(Rng[i])));
|
||||
Rng[i].reset(RandomNumberControl::Children[i]);
|
||||
// Ye: RandomNumberControl::Children needs to be replaced with unique_ptr and use Rng[i].swap()
|
||||
RandomNumberControl::Children[i] = nullptr;
|
||||
step_contexts_[i] = std::make_unique<ContextForSteps>(crowds_[i]->size(), population_.get_num_particles(),
|
||||
population_.get_particle_group_indexes(), *(Rng[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue