QMCPACK
RMCUpdateAll.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
8 // Raymond Clay III, j.k.rofling@gmail.com, Lawrence Livermore National Laboratory
9 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
10 //
11 // File created by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
12 //////////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #include "RMCUpdateAll.h"
18 #include "Concurrency/OpenMP.h"
19 #include "Configuration.h"
20 #include "Particle/Reptile.h"
21 #include <cmath>
22 #include "OhmmsData/ParameterSet.h"
23 
24 //////////////////////////////////////////////////////////////////////////
25 //
26 // This driver proposes all-electron moves like in DMCUpdateAll.cpp.
27 //
28 // For H4 and H2 systems, it appears as though the Umrigar pbyp scaled drift has similar instabilities
29 // as in the RQMCMultiple.cpp driver. Hence, the bare propagator with filtered local energies is used.
30 //
31 // The symmetric link action (Ceperley and Pierleoni) is hardcoded into this driver.
32 //
33 //////////////////////////////////////////////////////////////////////////////
34 
35 namespace qmcplusplus
36 {
38 
39 /// Constructor.
41  TrialWaveFunction& psi,
42  QMCHamiltonian& h,
44  std::vector<int> act,
45  std::vector<int> tp)
46  : QMCUpdateBase(w, psi, h, rg), Action(act), TransProb(tp)
47 {
48  scaleDrift = false;
50  vmcToDoSteps = 0;
51  equilToDoSteps = 0;
52  vmcSteps = 0;
53  equilSteps = 0;
54 }
55 
57 
58 bool RMCUpdateAllWithDrift::put(xmlNodePtr cur)
59 {
60  QMCUpdateBase::put(cur);
61  ParameterSet m_param;
62  // bool usedrift=false;
63  std::string action = "SLA";
64  std::string usedrift = "no";
65  m_param.add(usedrift, "useScaledDrift");
66  m_param.add(action, "Action");
67  m_param.add(equilSteps, "equilsteps");
68  m_param.add(equilSteps, "equilSteps");
69 
70  // m_param.add(scaleDrift,"scaleDrift");
71  m_param.put(cur);
72 
73  bool driftoption = (usedrift == "yes" || usedrift == "Yes" || usedrift == "True" || usedrift == "true");
74 
75  if (driftoption)
76  {
77  scaleDrift = true;
78  if (omp_get_thread_num() == 0)
79  app_log() << " Using Umrigar scaled drift\n";
80  // H.rejectedMove(W,thisWalker);
81  }
82  else
83  {
84  if (omp_get_thread_num() == 0)
85  app_log() << " Using non-scaled drift\n";
86  }
87 
88  if (action == "DMC")
89  {
91  if (omp_get_thread_num() == 0)
92  app_log() << " Using DMC link-action\n";
93  }
94  else
95  {
96  if (omp_get_thread_num() == 0)
97  app_log() << " Using Symmetrized Link-Action\n";
98  }
99 
100  return true;
101 }
102 //This performs an all electron VMC step in the current direction of the reptile.
103 //Performs all evaluations to update the action
105 {
106  IndexType direction = W.reptile->direction;
107  IndexType forward = (1 - direction) / 2;
108  IndexType backward = (1 + direction) / 2;
109  Walker_t& curhead = W.reptile->getHead();
110  W.loadWalker(curhead, false);
111  if (scaleDrift == true)
113  else
114  assignDrift(m_tauovermass, curhead.G, drift);
115  //app_log()<<"Sign head = "<<curhead.Properties(SIGN)<< std::endl;
116  //app_log()<<"Old phase = "<<Psi.getPhase()<< std::endl;
118  RealType r2proposed = Dot(deltaR, deltaR);
119  // W.reptile->r2prop += r2proposed;
120  // W.reptile->r2samp++;
122  {
123  ++nReject;
124  H.rejectedMove(W, curhead);
125  // curhead.Age+=1;
126  //W.reptile->flip();
127  return;
128  }
129 
130  RealType logpsi(Psi.evaluateLog(W));
131  RealType logGf = -0.5 * Dot(deltaR, deltaR);
132  RealType Action_forward = -0.5 * logGf;
133  curhead.Properties(W.reptile->TransProb[forward]) = -0.5 * Dot(deltaR, deltaR);
134  curhead.Properties(W.reptile->Action[forward]) = 0.5 * 0.5 * Dot(deltaR, deltaR);
135 
136  W.reptile->saveTransProb(curhead, +1, logGf);
137  W.reptile->saveAction(curhead, +1, Action_forward);
138 
139  Walker_t::ParticlePos fromdeltaR(deltaR);
140 
141 
142  if (scaleDrift == true)
144  else
146  fromdeltaR = curhead.R - W.R - drift;
147  FullPrecRealType* restrict new_headProp(W.getPropertyBase());
148 
149  RealType logGb = -m_oneover2tau * Dot(fromdeltaR, fromdeltaR);
150 
151  W.reptile->saveTransProb(W, -1, logGb);
152  //W.reptile->saveAction(W,-1,Action_backward);
153 
154  W.Properties(W.reptile->TransProb[backward]) = -m_oneover2tau * Dot(fromdeltaR, fromdeltaR);
155  W.Properties(W.reptile->Action[backward]) = 0.5 * m_oneover2tau * Dot(fromdeltaR, fromdeltaR);
156 
157  Walker_t &lastbead(W.reptile->getTail()), nextlastbead(W.reptile->getNext());
158  //Implementing the fixed-node approximation. If phase difference is not a multiple of 2pi, bounce away from node.
159  RealType newphase = Psi.getPhase();
160  RealType phasediff = newphase - curhead.Properties(WP::SIGN);
161  //Reject & bounce if node crossed.
163  {
164  ++nReject;
165  H.rejectedMove(W, curhead);
166  // curhead.Age+=1;
167  // W.reptile->flip();
168  //app_log()<<"hit a node. Bouncing...\n";
169  return;
170  }
171  RealType eloc = H.evaluate(W);
172  new_headProp[Action[2]] = 0.5 * Tau * eloc;
173 
174  ////////////////////////////////////////////////////////////////////////
175  /// Like DMC, this filters the local energy to ignore divergences near pathological points in phase space.
176  ////////////////////////////////////////////////////////////////////////
177  // RealType eest = W.reptile->eest;
178 
179  // RealType fbet = std::max(eest - curhead.Properties(WP::LOCALENERGY), eest - eloc);
180  // app_log()<<"eval = "<<eest<<" estdev="<<stddev<< std::endl;
181  // RealType rawcutoff=100*std::sqrt(W.reptile->evar);
182  // RealType cutoffmax = 1.5*rawcutoff;
183  // RealType cutoff=1;
184  // if (fbet > rawcutoff)
185  // cutoff = 1-(fbet - rawcutoff)/(rawcutoff*0.5);
186  // if( fbet > cutoffmax )
187  // cutoff=0;
188  //////////////////////////////////////////////////////////////////////////
189  // RealType tauscale = W.reptile->tauscale;
190  // W.Properties(W.reptile->Action[2])= 0.5*Tau*eloc*cutoff*tauscale;
191  RealType acceptProb = 1;
192  if (actionType == SYM_ACTION)
193  {
194  RealType oldhead_logpsi = curhead.Properties(WP::LOGPSI);
195  RealType oldtail_logpsi = lastbead.Properties(WP::LOGPSI);
196  RealType newtail_logpsi = nextlastbead.Properties(WP::LOGPSI);
197 
198  RealType oldhead_e = curhead.Properties(WP::LOCALENERGY);
199  RealType oldtail_e = lastbead.Properties(WP::LOCALENERGY);
200  RealType newhead_e = W.Properties(WP::LOCALENERGY);
201  RealType newtail_e = nextlastbead.Properties(WP::LOCALENERGY);
202 
203  RealType head_forward = W.reptile->getTransProb(curhead, +1);
204  RealType head_backward = W.reptile->getTransProb(W, -1);
205  RealType tail_forward = W.reptile->getTransProb(lastbead, +1);
206  RealType tail_backward = W.reptile->getTransProb(nextlastbead, -1);
207 
208  RealType dS_head = branchEngine->symLinkAction(head_forward, head_backward, newhead_e, oldhead_e);
209  RealType dS_tail = branchEngine->symLinkAction(tail_forward, tail_backward, newtail_e, oldtail_e);
210 
211  // dS=dS_head-dS_tail;
212 
213  // RealType dS_old = +(curhead.Properties(LOGPSI) + lastbead.Properties(LOGPSI) - logpsi - nextlastbead.Properties(LOGPSI))
214  // + curhead.Properties(W.reptile->Action[2]) + W.Properties(W.reptile->Action[2])
215  // + curhead.Properties(W.reptile->Action[forward]) + W.Properties(W.reptile->Action[backward])
216  // - (lastbead.Properties(W.reptile->Action[2]) + nextlastbead.Properties(W.reptile->Action[2]))
217  // - (lastbead.Properties(W.reptile->Action[forward]) + nextlastbead.Properties(W.reptile->Action[backward]));
218  // acceptProb=std::exp(-dS_old + (nextlastbead.Properties(W.reptile->TransProb[backward]) - curhead.Properties(W.reptile->TransProb[forward])));
219  // acceptProb=std::min(1.0,std::exp(-dS + -(curhead.Properties(LOGPSI) + lastbead.Properties(LOGPSI) - logpsi - nextlastbead.Properties(LOGPSI)) + tail_backward - head_forward));
220  }
221  else
222  {
223  // dS = curhead.Properties(W.reptile->Action[2]) + W.Properties(W.reptile->Action[2])
224  //- (lastbead.Properties(W.reptile->Action[2]) + nextlastbead.Properties(W.reptile->Action[2]));
225  RealType dS_head = branchEngine->DMCLinkAction(eloc, curhead.Properties(WP::LOCALENERGY));
226  RealType dS_tail =
227  branchEngine->DMCLinkAction(lastbead.Properties(WP::LOCALENERGY), nextlastbead.Properties(WP::LOCALENERGY));
228  //dS=branchEngine->DMCLinkAction(eloc,curhead.Properties(LOCALENERGY)) - branchEngine->DMCLinkAction(lastbead.Properties(LOCALENERGY),nextlastbead.Properties(LOCALENERGY));
229  // dS=dS_head - dS_tail;
230  // acceptProb=std::min(1.0,std::exp(-dS ));
231  }
232  acceptProb = std::exp(logGb - logGf + 2.0 * (logpsi - curhead.Properties(WP::LOGPSI)));
233 
234 
235  /* RealType dS = curhead.Properties(W.reptile->Action[2]) + W.Properties(W.reptile->Action[2])
236  - (lastbead.Properties(W.reptile->Action[2]) + nextlastbead.Properties(W.reptile->Action[2]));
237  RealType acceptProb=std::min(1.0,std::exp(-dS )); */
238  if (RandomGen() < acceptProb)
239  {
240  //Assuming the VMC step is fine, we are forcing the move.
242 
243  W.saveWalker(overwriteWalker);
244  overwriteWalker.Properties(WP::LOCALENERGY) = eloc;
245  overwriteWalker.Properties(W.reptile->Action[forward]) = 0;
246  overwriteWalker.Properties(W.reptile->Action[backward]) = W.Properties(W.reptile->Action[backward]);
247  overwriteWalker.Properties(W.reptile->Action[2]) = W.Properties(W.reptile->Action[2]);
248  overwriteWalker.Properties(W.reptile->TransProb[forward]) = W.Properties(W.reptile->TransProb[forward]);
249  overwriteWalker.Properties(W.reptile->TransProb[backward]) = W.Properties(W.reptile->TransProb[backward]);
250  overwriteWalker.resetProperty(logpsi, Psi.getPhase(), eloc);
251  H.auxHevaluate(W, overwriteWalker, true, false); //properties but not collectables.
252  H.saveProperty(overwriteWalker.getPropertyBase());
253  overwriteWalker.Age = 0;
254  ++nAccept;
255  }
256  else
257  {
258  ++nReject;
259  H.rejectedMove(W, curhead);
260  // curhead.Age+=1;
261  // W.reptile->flip();
262  return;
263  }
264 }
265 
266 
268 {
269  IndexType initsteps = W.reptile->nbeads * 2;
270  vmcSteps = W.reptile->nbeads + 1;
271 
272  for (; it != it_end; ++it)
273  {
274  W.R = (*it)->R;
275  W.update();
276  RealType logpsi(Psi.evaluateLog(W));
277  (*it)->G = W.G;
278  (*it)->L = W.L;
280  RealType ene = H.evaluate(W);
281  H.auxHevaluate(W);
282  (*it)->resetProperty(logpsi, Psi.getPhase(), ene, 0.0, 0.0, nodecorr);
283  (*it)->Weight = 1;
284  H.saveProperty((*it)->getPropertyBase());
285  }
286 
287 
288  for (int n = 0; n < initsteps; n++)
290 }
291 
292 void RMCUpdateAllWithDrift::advanceWalker(Walker_t& thisWalker, bool recompute) {}
293 
295 {
296  if (vmcToDoSteps > 0)
297  {
299  vmcToDoSteps--;
300  }
301  else if (vmcToDoSteps == 0 && equilToDoSteps > 0)
302  {
304  equilToDoSteps--;
305  }
306  else
307  {
309  }
310 }
311 
313 {
314  IndexType direction = W.reptile->direction;
315  IndexType forward = (1 - direction) / 2;
316  IndexType backward = (1 + direction) / 2;
317  Walker_t& curhead = W.reptile->getHead();
318  Walker_t& centerbead = W.reptile->getCenter();
319 
320  // if(centerbead.Age>=MaxAge)
321  // {
322  // vmcToDoSteps=vmcSteps;
323  // equilToDoSteps=equilSteps;
324  // app_log()<<"MaxAge for center bead exceeded. Reequilibrating. "<<vmcSteps<<" "<<equilSteps<< std::endl;
325  // }
326 
327  //We are going to monitor the center bead's age to determine whether we force
328  //moves. This is because the ends are less likely to get pinned.
329 
330  // centerbead.Age+=1;
331 
332  W.loadWalker(curhead, false);
333  //RealType nodecorr=1;
334  if (scaleDrift == true)
335  setScaledDrift(m_tauovermass, curhead.G, drift);
336  else
337  assignDrift(m_tauovermass, curhead.G, drift);
338  //app_log()<<"Sign head = "<<curhead.Properties(SIGN)<< std::endl;
339  //app_log()<<"Old phase = "<<Psi.getPhase()<< std::endl;
341  RealType r2proposed = Dot(deltaR, deltaR);
342  RealType r2accept = 0.0;
343  // W.reptile->r2prop += r2proposed;
344  // W.reptile->r2samp++;
346  {
347  ++nReject;
348  H.rejectedMove(W, curhead);
349  curhead.Age += 1;
350  W.reptile->flip();
351  return;
352  }
353  RealType logpsi(Psi.evaluateLog(W));
354  // app_log()<<"Sign newhead = "<<W.Properties(SIGN)<< std::endl;
355  //RealType* restrict old_headProp ((*it)->getPropertyBase());
356  //old_headProp[TransProb[forward]]= 0.5*Dot(deltaR,deltaR);
357 
358  curhead.Properties(W.reptile->TransProb[forward]) = -0.5 * Dot(deltaR, deltaR);
359  curhead.Properties(W.reptile->Action[forward]) = 0.5 * 0.5 * Dot(deltaR, deltaR);
360 
361  RealType logGf = -0.5 * Dot(deltaR, deltaR);
362  //W.reptile->saveTransProb(curhead,+1,logGf);
363 
364  Walker_t::ParticlePos fromdeltaR(deltaR);
365 
366 
367  if (scaleDrift == true)
369  else
371  fromdeltaR = curhead.R - W.R - drift;
372  FullPrecRealType* restrict new_headProp(W.getPropertyBase());
373  W.Properties(W.reptile->TransProb[backward]) = -m_oneover2tau * Dot(fromdeltaR, fromdeltaR);
374  W.Properties(W.reptile->Action[backward]) = 0.5 * m_oneover2tau * Dot(fromdeltaR, fromdeltaR);
375 
376  RealType logGb = -m_oneover2tau * Dot(fromdeltaR, fromdeltaR);
377 
378  // W.reptile->saveTransProb(W,-1, logGb);
379 
380  Walker_t &lastbead(W.reptile->getTail()), nextlastbead(W.reptile->getNext());
381  //Implementing the fixed-node approximation. If phase difference is not a multiple of 2pi, bounce away from node.
382  RealType newphase = Psi.getPhase();
383  RealType phasediff = newphase - curhead.Properties(WP::SIGN);
384  //Reject & bounce if node crossed.
386  {
387  ++nReject;
388  H.rejectedMove(W, curhead);
389  curhead.Age += 1;
390  W.reptile->flip();
391  //app_log()<<"hit a node. Bouncing...\n";
392  return;
393  }
394  RealType eloc = H.evaluate(W);
395  W.Properties(WP::LOCALENERGY) = eloc;
396  //new_headProp[Action[2]]= 0.5*Tau*eloc;
397  ////////////////////////////////////////////////////////////////////////
398  /// Like DMC, this filters the local energy to ignore divergences near pathological points in phase space.
399  ////////////////////////////////////////////////////////////////////////
400  /// RealType eest = W.reptile->eest;
401  /// RealType fbet = std::max(eest - curhead.Properties(LOCALENERGY), eest - eloc);
402 
403  /// RealType rawcutoff=100*std::sqrt(W.reptile->evar);
404  /// RealType cutoffmax = 1.5*rawcutoff;
405  /// RealType cutoff=1;
406  /// if (fbet > rawcutoff)
407  /// cutoff = 1-(fbet - rawcutoff)/(rawcutoff*0.5);
408  /// if( fbet > cutoffmax )
409  /// cutoff=0;
410  //////////////////////////////////////////////////////////////////////////
411  /// RealType tauscale = W.reptile->tauscale;
412  /// W.Properties(W.reptile->Action[2])= 0.5*Tau*eloc*cutoff*tauscale;
413  RealType dS = 0;
414  RealType acceptProb = 0;
415 
416  if (actionType == SYM_ACTION)
417  {
418  RealType oldhead_logpsi = curhead.Properties(WP::LOGPSI);
419  RealType oldtail_logpsi = lastbead.Properties(WP::LOGPSI);
420  RealType newtail_logpsi = nextlastbead.Properties(WP::LOGPSI);
421 
422  RealType oldhead_e = curhead.Properties(WP::LOCALENERGY);
423  RealType oldtail_e = lastbead.Properties(WP::LOCALENERGY);
424  RealType newhead_e = W.Properties(WP::LOCALENERGY);
425  RealType newtail_e = nextlastbead.Properties(WP::LOCALENERGY);
426 
427  RealType head_forward = W.reptile->getTransProb(curhead, +1);
428  RealType head_backward = W.reptile->getTransProb(W, -1);
429  RealType tail_forward = W.reptile->getTransProb(lastbead, +1);
430  RealType tail_backward = W.reptile->getTransProb(nextlastbead, -1);
431 
432  // RealType head_forward=curhead.Properties(W.reptile->TransProb[forward]);
433  // RealType head_backward=W.Properties(W.reptile->TransProb[backward]);
434  // RealType tail_forward=lastbead.Properties(W.reptile->TransProb[forward]);
435  // RealType tail_backward=nextlastbead.Properties(W.reptile->TransProb[backward]);
436 
437 
438  // RealType dS_head=branchEngine->symLinkActionBare(head_forward, head_backward, newhead_e, oldhead_e);
439  // RealType dS_tail=branchEngine->symLinkActionBare(tail_forward, tail_backward, newtail_e, oldtail_e);
440  RealType dS_head = branchEngine->symLinkAction(head_forward, head_backward, newhead_e, oldhead_e);
441  RealType dS_tail = branchEngine->symLinkAction(tail_forward, tail_backward, newtail_e, oldtail_e);
442 
443 
444  RealType dS_0 = dS_head - dS_tail +
445  (curhead.Properties(WP::LOGPSI) + lastbead.Properties(WP::LOGPSI) - logpsi -
446  nextlastbead.Properties(WP::LOGPSI));
447 
448  /// RealType dS_old = +(curhead.Properties(LOGPSI) + lastbead.Properties(LOGPSI) - logpsi - nextlastbead.Properties(LOGPSI))
449  /// + curhead.Properties(W.reptile->Action[2]) + W.Properties(W.reptile->Action[2])
450  /// + curhead.Properties(W.reptile->Action[forward]) + W.Properties(W.reptile->Action[backward])
451  /// - (lastbead.Properties(W.reptile->Action[2]) + nextlastbead.Properties(W.reptile->Action[2]))
452  /// - (lastbead.Properties(W.reptile->Action[forward]) + nextlastbead.Properties(W.reptile->Action[backward]));
453  ///acceptProb=std::exp(-dS_0 + (nextlastbead.Properties(W.reptile->TransProb[backward]) - curhead.Properties(W.reptile->TransProb[forward])));
454 
455  // acceptProb=std::exp(-dS_0 + tail_backward - head_forward);
456  // app_log()<<"logGf (calced) = "
457  // app_log()<<"dS_old="<<dS_old<< std::endl;
458  // app_log()<<"dS_head="<<dS_head<< std::endl;
459  // app_log()<<"dS_tail="<<dS_tail<< std::endl;
460  // app_log()<<"dS' = "<<dS_0<< std::endl;
461  // app_log()<<"W.Properties(WP::LOCALENERGY)="<<W.Properties(WP::LOCALENERGY)<< std::endl;
462 
463  // app_log()<<"---------------\n";
464  acceptProb = std::exp(-dS_0 +
465  (nextlastbead.Properties(W.reptile->TransProb[backward]) -
466  curhead.Properties(W.reptile->TransProb[forward]))); //tail_backward - head_forward);
467  // acceptProb=std::min(1.0,std::exp(-dS + -(curhead.Properties(LOGPSI) + lastbead.Properties(LOGPSI) - logpsi - nextlastbead.Properties(LOGPSI)) + tail_backward - head_forward));
468  }
469  else
470  {
471  // dS = curhead.Properties(W.reptile->Action[2]) + W.Properties(W.reptile->Action[2])
472  //- (lastbead.Properties(W.reptile->Action[2]) + nextlastbead.Properties(W.reptile->Action[2]));
473  RealType dS_head = branchEngine->DMCLinkAction(eloc, curhead.Properties(WP::LOCALENERGY));
474  RealType dS_tail =
475  branchEngine->DMCLinkAction(lastbead.Properties(WP::LOCALENERGY), nextlastbead.Properties(WP::LOCALENERGY));
476  //dS=branchEngine->DMCLinkAction(eloc,curhead.Properties(WP::LOCALENERGY)) - branchEngine->DMCLinkAction(lastbead.Properties(WP::LOCALENERGY),nextlastbead.Properties(WP::LOCALENERGY));
477  dS = dS_head - dS_tail;
478  acceptProb = std::min((RealType)1.0, std::exp(-dS));
479  }
480 
481  //app_log()<<acceptProb<< std::endl;
482  // app_log()<<"r2proposed.... = "<<r2proposed<< std::endl;
483  if ((RandomGen() < acceptProb) || curhead.Age >= MaxAge)
484  {
485  r2accept = r2proposed;
486  // W.reptile->r2accept+=r2accept;
488  if (curhead.Age >= MaxAge)
489  {
490  app_log() << "\tForce Acceptance...\n";
492  }
493  W.saveWalker(overwriteWalker);
494  overwriteWalker.Properties(WP::LOCALENERGY) = eloc;
495  overwriteWalker.Properties(W.reptile->Action[forward]) = 0;
496  overwriteWalker.Properties(W.reptile->Action[backward]) = W.Properties(W.reptile->Action[backward]);
497  overwriteWalker.Properties(W.reptile->Action[2]) = W.Properties(W.reptile->Action[2]);
498  //overwriteWalker.Properties(W.reptile->TransProb[forward])=W.Properties(W.reptile->TransProb[forward]);
499  W.reptile->saveTransProb(overwriteWalker, +1, 0);
500  W.reptile->saveTransProb(overwriteWalker, -1, logGb);
501  // overwriteWalker.Properties(W.reptile->TransProb[backward])=W.Properties(W.reptile->TransProb[backward]);
502  overwriteWalker.resetProperty(logpsi, Psi.getPhase(), eloc);
503  overwriteWalker.Properties(WP::R2ACCEPTED) = r2accept;
504  overwriteWalker.Properties(WP::R2PROPOSED) = r2proposed;
505 
506  // lastbead.Properties(R2PROPOSED)=lastbead.Properties(R2ACCEPTED)=nextlastbead.Properties(R2PROPOSED);
507  H.auxHevaluate(W, overwriteWalker, true, false); //evaluate properties but not collectables.
508  H.saveProperty(overwriteWalker.getPropertyBase());
509  overwriteWalker.Age = 0;
510 
511  ++nAccept;
512  }
513  else
514  {
515  // app_log()<<"Reject\n";
516  curhead.Properties(WP::R2ACCEPTED) = 0;
517  curhead.Properties(WP::R2PROPOSED) = r2proposed;
518  lastbead.Properties(WP::R2ACCEPTED) = 0;
519  //lastbead.Properties(R2PROPOSED)=nextlastbead.Properties(R2PROPOSED);
520  //curhead.Properties(R2
521  ++nReject;
522  H.rejectedMove(W, curhead);
523  curhead.Age += 1;
524  W.reptile->flip();
525  // app_log()<<"Reject\n";
526  return;
527  }
528  W.loadWalker(centerbead, true);
529  W.update(false); //skip S(k) evaluation? False
530  H.auxHevaluate(W, centerbead, false, true); //collectables, but not properties
531 }
532 
534 {
535  if (vmcToDoSteps == 0 && equilToDoSteps == 0)
536  Estimators->accumulate(W, it, it_end);
537  else
538  ;
539 }
540 
541 
542 } // namespace qmcplusplus
RealType evaluateLog(ParticleSet &P)
evalaute the log (internally gradients and laplacian) of the trial wavefunction.
const BranchEngineType * branchEngine
branch engine, stateless reference to the one in QMCDriver
ParticleSet::ParticlePos drift
temporary storage for drift
RealType m_tauovermass
tau/mass
PropertyContainer_t Properties
scalar properties of a walker
Definition: Walker.h:125
Base class for update methods for each step.
Definition: QMCUpdateBase.h:41
A set of walkers that are to be advanced by Metropolis Monte Carlo.
MCWalkerConfiguration::iterator WalkerIter_t
Definition: QMCUpdateBase.h:45
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
void accumulate(MCWalkerConfiguration &W)
accumulate the measurements
PropertyContainer_t Properties
properties of the current walker
Definition: ParticleSet.h:119
Walker_t & getTail()
Definition: Reptile.h:98
QTBase::RealType RealType
Definition: Configuration.h:58
TrialWaveFunction & Psi
trial function
typename p_traits::ParticlePos ParticlePos
array of particles
Definition: Walker.h:64
std::ostream & app_log()
Definition: OutputManager.h:65
void saveProperty(IT first)
save the values of Hamiltonian elements to the Properties
bool phaseChanged(RealType psi0) const
virtual bool put(xmlNodePtr cur)
process options
RealType DMCLinkAction(RealType enew, RealType eold) const
Collection of Local Energy Operators.
Walker_t & getNewHead()
Definition: Reptile.h:128
void assignDrift(T s, const ParticleAttrib< TinyVector< TG, D >> &ga, ParticleAttrib< TinyVector< T, D >> &da)
void accumulate(WalkerIter_t it, WalkerIter_t it_end)
RealType m_sqrttau
Time-step factor .
void update(bool skipSK=false)
update the internal data
RealType symLinkAction(RealType logGf, RealType logGb, RealType enew, RealType eold) const
Walker_t & getCenter()
Definition: Reptile.h:100
ParticleSet::ParticlePos deltaR
temporary storage for random displacement
ParticleLaplacian L
laplacians of the particles
Definition: ParticleSet.h:85
int Age
Age of this walker age is incremented when a walker is not moved after a sweep.
Definition: Walker.h:100
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
T min(T a, T b)
bool put(std::istream &is) override
read from std::istream
Definition: ParameterSet.h:42
std::vector< IndexType > TransProb
Definition: Reptile.h:48
RMCUpdateAllWithDrift(MCWalkerConfiguration &w, TrialWaveFunction &psi, QMCHamiltonian &h, RandomBase< FullPrecRealType > &rg, std::vector< int > act, std::vector< int > tp)
Constructor.
omp_int_t omp_get_thread_num()
Definition: OpenMP.h:25
class to handle a set of parameters
Definition: ParameterSet.h:27
T setScaledDriftPbyPandNodeCorr(T tau, const ParticleAttrib< TinyVector< T1, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
scale drift
std::vector< IndexType > Action
Definition: Reptile.h:47
WalkerProperties::Indexes WP
Definition: ParticleSet.cpp:34
EstimatorManagerBase * Estimators
estimator
ParticleGradient G
gradients of the particles
Definition: ParticleSet.h:83
void saveWalker(Walker_t &awalker)
save this to awalker
RealType Tau
timestep
Definition: QMCUpdateBase.h:73
ParticlePos R
Position.
Definition: ParticleSet.h:79
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
Walker_t & getNext()
Definition: Reptile.h:99
MCWalkerConfiguration & W
walker ensemble
std::vector< RealType > MassInvP
1/Mass per particle
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
void advanceWalker(Walker_t &thisWalker, bool recompute) override
move a walker
void loadWalker(Walker_t &awalker, bool pbyp)
load a Walker_t to the current ParticleSet
void auxHevaluate(ParticleSet &P)
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
IndexType MaxAge
MaxAge>0 indicates branch is done.
Definition: QMCUpdateBase.h:61
void rejectedMove(ParticleSet &P, Walker_t &ThisWalker)
Looks like a hack see DMCBatched.cpp and DMC.cpp weight is used like temporary flag from DMC...
Class to represent a many-body trial wave function.
RandomBase< FullPrecRealType > & RandomGen
random number generator
Indexes
an enum denoting index of physical properties
Declaraton of ParticleAttrib<T>
FullPrecRealType evaluate(ParticleSet &P)
evaluate Local Energy
void initWalkers(WalkerIter_t it, WalkerIter_t it_end) override
initialize Walker for walker update
Walker_t & getHead()
Definition: Reptile.h:97
bool makeMoveAllParticlesWithDrift(const Walker_t &awalker, const ParticlePos &drift, const ParticlePos &deltaR, RealType dt)
move all the particles including the drift
QTFull::RealType FullPrecRealType
Definition: Configuration.h:66
void saveAction(Walker_t &walker, IndexType d, RealType val, IndexType nPsi=0)
Definition: Reptile.h:135
IndexType nAccept
counter for number of moves accepted
Definition: QMCUpdateBase.h:63
bool put(xmlNodePtr cur) override
process options
RealType m_oneover2tau
Time-step factor .
IndexType nReject
counter for number of moves rejected
Definition: QMCUpdateBase.h:65
void saveTransProb(Walker_t &walker, IndexType d, RealType val, IndexType nPsi=0)
Definition: Reptile.h:162
FullPrecRealType *restrict getPropertyBase()
return the address of the values of Hamiltonian terms
Definition: ParticleSet.h:470
IndexType nbeads
Definition: Reptile.h:59
A container class to represent a walker.
Definition: Walker.h:49
QMCHamiltonian & H
Hamiltonian.
void setScaledDrift(T tau, const ParticleAttrib< TinyVector< TG, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
da = scaled(tau)*ga
void advanceWalkers(WalkerIter_t it, WalkerIter_t it_end, bool measure) override
advance walkers executed at each step
ParticlePos R
The configuration vector (3N-dimensional vector to store the positions of all the particles for a sin...
Definition: Walker.h:114
RealType getTransProb(Walker_t &walker, IndexType d, RealType nPsi=0)
Definition: Reptile.h:175
IndexType direction
Definition: Reptile.h:59
void makeGaussRandomWithEngine(ParticleAttrib< TinyVector< T, D >> &a, RG &rng)