QMCPACK
Reptile Class Reference
+ Inheritance diagram for Reptile:
+ Collaboration diagram for Reptile:

Public Types

using WP = WalkerProperties::Indexes
 
using Walker_t = MCWalkerConfiguration::Walker_t
 
using WalkerIter_t = MCWalkerConfiguration::iterator
 
using ReptileConfig_t = std::vector< Walker_t::ParticlePos >
 
- Public Types inherited from QMCTraits
enum  { DIM = OHMMS_DIM, DIM_VGL = OHMMS_DIM + 2 }
 
using QTBase = QMCTypes< OHMMS_PRECISION, DIM >
 
using QTFull = QMCTypes< OHMMS_PRECISION_FULL, DIM >
 
using RealType = QTBase::RealType
 
using ComplexType = QTBase::ComplexType
 
using ValueType = QTBase::ValueType
 
using PosType = QTBase::PosType
 
using GradType = QTBase::GradType
 
using TensorType = QTBase::TensorType
 
using IndexType = OHMMS_INDEXTYPE
 define other types More...
 
using FullPrecRealType = QTFull::RealType
 
using FullPrecValueType = QTFull::ValueType
 
using PropertySetType = RecordNamedProperty< FullPrecRealType >
 define PropertyList_t More...
 
using PtclGrpIndexes = std::vector< std::pair< int, int > >
 

Public Member Functions

 Reptile (MCWalkerConfiguration &W, WalkerIter_t start, WalkerIter_t end)
 
 ~Reptile ()
 
IndexType size ()
 
Walker_toperator[] (IndexType i)
 
IndexType wrapIndex (IndexType repindex)
 
Walker_tgetWalker (IndexType i)
 
IndexType getBeadIndex (IndexType i)
 
Walker_tgetBead (IndexType i)
 
Walker_tgetHead ()
 
Walker_tgetTail ()
 
Walker_tgetNext ()
 
Walker_tgetCenter ()
 
void flip ()
 
void setDirection (IndexType dir)
 
void setBead (Walker_t &walker, IndexType i)
 
void setHead (Walker_t &overwrite)
 
Walker_tgetNewHead ()
 
void saveAction (Walker_t &walker, IndexType d, RealType val, IndexType nPsi=0)
 
RealType getDirectionalAction (Walker_t &walker, IndexType d, IndexType nPsi=0)
 
RealType getLinkAction (Walker_t &new_walker, Walker_t &old_walker, IndexType d, IndexType nPsi=0)
 
void saveTransProb (Walker_t &walker, IndexType d, RealType val, IndexType nPsi=0)
 
void saveTransProb (ParticleSet &W, IndexType d, RealType val, IndexType nPsi=0)
 
RealType getTransProb (Walker_t &walker, IndexType d, RealType nPsi=0)
 
RealType getTransProb (ParticleSet &W, IndexType d, RealType nPsi=0)
 
void printState ()
 
RealType getTau ()
 
void setTau (RealType t)
 
Walker_t::ParticlePos linearInterp (RealType t)
 
ReptileConfig_t getReptileSlicePositions (RealType tau, RealType beta)
 
void setReptileSlicePositions (ReptileConfig_t &rept)
 
void setReptileSlicePositions (Walker_t::ParticlePos R)
 

Public Attributes

std::vector< IndexTypeAction
 
std::vector< IndexTypeTransProb
 
RealType forwardprob
 
RealType backwardprob
 
RealType forwardaction
 
RealType backwardaction
 
RealType tau
 
MCWalkerConfigurationw
 
WalkerIter_t repstart
 
WalkerIter_t repend
 
IndexType direction
 
IndexType headindex
 
IndexType nbeads
 
Walker_tprophead
 

Detailed Description

Definition at line 37 of file Reptile.h.

Member Typedef Documentation

◆ ReptileConfig_t

using ReptileConfig_t = std::vector<Walker_t::ParticlePos>

Definition at line 45 of file Reptile.h.

◆ Walker_t

Definition at line 41 of file Reptile.h.

◆ WalkerIter_t

Definition at line 44 of file Reptile.h.

◆ WP

Definition at line 40 of file Reptile.h.

Constructor & Destructor Documentation

◆ Reptile()

Reptile ( MCWalkerConfiguration W,
WalkerIter_t  start,
WalkerIter_t  end 
)
inline

Definition at line 62 of file Reptile.h.

References Reptile::Action, ParticleSet::addProperty(), Reptile::nbeads, Reptile::repend, Reptile::repstart, Reptile::TransProb, and Reptile::w.

63  : w(W),
64  repstart(start),
65  repend(end),
66  direction(1),
67  headindex(0),
68  prophead(0) //, r2prop(0.0), r2accept(0.0),tau(0.0)
69  {
70  Action.resize(3);
71  Action[0] = w.addProperty("ActionBackward");
72  Action[1] = w.addProperty("ActionForward");
73  Action[2] = w.addProperty("ActionLocal");
74  TransProb.resize(2);
75  TransProb[0] = w.addProperty("TransProbBackward");
76  TransProb[1] = w.addProperty("TransProbForward");
77 
79  }
int addProperty(const std::string &pname)
Definition: ParticleSet.h:411
std::vector< IndexType > TransProb
Definition: Reptile.h:48
std::vector< IndexType > Action
Definition: Reptile.h:47
MCWalkerConfiguration & w
Definition: Reptile.h:57
Walker_t * prophead
Definition: Reptile.h:60
IndexType headindex
Definition: Reptile.h:59
WalkerIter_t repend
Definition: Reptile.h:58
WalkerIter_t repstart
Definition: Reptile.h:58
IndexType nbeads
Definition: Reptile.h:59
IndexType direction
Definition: Reptile.h:59

◆ ~Reptile()

~Reptile ( )
inline

Definition at line 81 of file Reptile.h.

81 {}

Member Function Documentation

◆ flip()

void flip ( )
inline

Definition at line 103 of file Reptile.h.

References Reptile::direction, Reptile::headindex, and Reptile::wrapIndex().

Referenced by RMCUpdatePbyPWithDrift::advanceWalkersRMC(), and RMCUpdateAllWithDrift::advanceWalkersRMC().

104  {
105  // direction*=-1;
106  // headindex = getBeadIndex(nbeads-1);
108  direction *= -1;
109  }
IndexType wrapIndex(IndexType repindex)
Definition: Reptile.h:87
IndexType headindex
Definition: Reptile.h:59
IndexType direction
Definition: Reptile.h:59

◆ getBead()

Walker_t& getBead ( IndexType  i)
inline

Definition at line 96 of file Reptile.h.

References Reptile::getBeadIndex(), and Reptile::getWalker().

Referenced by Reptile::linearInterp(), Reptile::printState(), Reptile::setHead(), and Reptile::setReptileSlicePositions().

96 { return getWalker(getBeadIndex(i)); }
IndexType getBeadIndex(IndexType i)
Definition: Reptile.h:95
Walker_t & getWalker(IndexType i)
Definition: Reptile.h:89

◆ getBeadIndex()

◆ getCenter()

◆ getDirectionalAction()

RealType getDirectionalAction ( Walker_t walker,
IndexType  d,
IndexType  nPsi = 0 
)
inline

Definition at line 144 of file Reptile.h.

References Reptile::Action, Reptile::direction, and qmcplusplus::walker.

Referenced by Reptile::getLinkAction().

145  {
146  //IndexType repdirection=circbuffer.get_direction();
147  IndexType actionindex = 2;
148  if (d != 0)
149  actionindex = (1 - direction * d) / 2;
150 
151  return walker.Properties(nPsi, Action[actionindex]);
152  }
std::vector< IndexType > Action
Definition: Reptile.h:47
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
IndexType direction
Definition: Reptile.h:59

◆ getHead()

◆ getLinkAction()

RealType getLinkAction ( Walker_t new_walker,
Walker_t old_walker,
IndexType  d,
IndexType  nPsi = 0 
)
inline

Definition at line 154 of file Reptile.h.

References Reptile::getDirectionalAction().

155  {
156  RealType af = getDirectionalAction(old_walker, +1, nPsi);
157  RealType ab = getDirectionalAction(new_walker, -1, nPsi);
158  RealType a0 = getDirectionalAction(old_walker, 0, nPsi) + getDirectionalAction(new_walker, 0, nPsi);
159  return af + ab + a0;
160  }
RealType getDirectionalAction(Walker_t &walker, IndexType d, IndexType nPsi=0)
Definition: Reptile.h:144
QMCTraits::RealType RealType

◆ getNewHead()

Walker_t& getNewHead ( )
inline

Definition at line 128 of file Reptile.h.

References Reptile::getBeadIndex(), Reptile::getWalker(), Reptile::headindex, and Reptile::nbeads.

Referenced by RMCUpdatePbyPWithDrift::advanceWalkersRMC(), RMCUpdateAllWithDrift::advanceWalkersRMC(), RMCUpdatePbyPWithDrift::advanceWalkersVMC(), and RMCUpdateAllWithDrift::advanceWalkersVMC().

129  {
130  //overwrite last element.
131  headindex = getBeadIndex(nbeads - 1); //sets to position of tail.
132  return getWalker(headindex);
133  }
IndexType getBeadIndex(IndexType i)
Definition: Reptile.h:95
IndexType headindex
Definition: Reptile.h:59
Walker_t & getWalker(IndexType i)
Definition: Reptile.h:89
IndexType nbeads
Definition: Reptile.h:59

◆ getNext()

Walker_t& getNext ( )
inline

◆ getReptileSlicePositions()

ReptileConfig_t getReptileSlicePositions ( RealType  tau,
RealType  beta 
)
inline

Definition at line 249 of file Reptile.h.

References Reptile::linearInterp(), and Reptile::tau.

250  {
251  IndexType nbeads_new = IndexType(beta / tau);
252  ReptileConfig_t new_reptile_coords(0);
253 
254  for (IndexType i = 0; i < nbeads_new; i++)
255  new_reptile_coords.push_back(linearInterp(tau * i));
256 
257  return new_reptile_coords;
258  }
Walker_t::ParticlePos linearInterp(RealType t)
Definition: Reptile.h:224
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
std::vector< Walker_t::ParticlePos > ReptileConfig_t
Definition: Reptile.h:45

◆ getTail()

◆ getTau()

RealType getTau ( )
inline

Definition at line 218 of file Reptile.h.

References Reptile::tau.

218 { return tau; }

◆ getTransProb() [1/2]

RealType getTransProb ( Walker_t walker,
IndexType  d,
RealType  nPsi = 0 
)
inline

Definition at line 175 of file Reptile.h.

References Reptile::direction, Reptile::TransProb, and qmcplusplus::walker.

Referenced by RMCUpdateAllWithDrift::advanceWalkersRMC(), and RMCUpdateAllWithDrift::advanceWalkersVMC().

176  {
177  //IndexType repdirection=circbuffer.get_direction();
178  IndexType transindex = (1 - d * direction) / 2;
179  return walker.Properties(nPsi, TransProb[transindex]);
180  }
std::vector< IndexType > TransProb
Definition: Reptile.h:48
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
IndexType direction
Definition: Reptile.h:59

◆ getTransProb() [2/2]

RealType getTransProb ( ParticleSet W,
IndexType  d,
RealType  nPsi = 0 
)
inline

Definition at line 181 of file Reptile.h.

References Reptile::direction, ParticleSet::Properties, and Reptile::TransProb.

182  {
183  //IndexType repdirection=circbuffer.get_direction();
184  IndexType transindex = (1 - d * direction) / 2;
185  return W.Properties(nPsi, TransProb[transindex]);
186  }
std::vector< IndexType > TransProb
Definition: Reptile.h:48
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
IndexType direction
Definition: Reptile.h:59

◆ getWalker()

Walker_t& getWalker ( IndexType  i)
inline

Definition at line 89 of file Reptile.h.

References Reptile::repstart, and Reptile::wrapIndex().

Referenced by Reptile::getBead(), Reptile::getCenter(), Reptile::getHead(), Reptile::getNewHead(), Reptile::getNext(), Reptile::getTail(), Reptile::operator[](), and Reptile::setBead().

90  {
91  WalkerIter_t bead = repstart + wrapIndex(i);
92  return **bead;
93  }
IndexType wrapIndex(IndexType repindex)
Definition: Reptile.h:87
MCWalkerConfiguration::iterator WalkerIter_t
Definition: Reptile.h:44
WalkerIter_t repstart
Definition: Reptile.h:58

◆ linearInterp()

Walker_t::ParticlePos linearInterp ( RealType  t)
inline

Definition at line 224 of file Reptile.h.

References Reptile::getBead(), Reptile::getHead(), Reptile::getTail(), Reptile::nbeads, Walker< t_traits, p_traits >::R, and Reptile::tau.

Referenced by Reptile::getReptileSlicePositions().

225  {
226  IndexType nbead =
227  IndexType(t / tau); //Calculate the lower bound on the timeslice. t is between binnum*Tau and (binnum+1)Tau
228  RealType beadfrac = t / tau - nbead; //the fractional coordinate between n and n+1 bead
229  if (nbead <= 0)
230  {
232  return result;
233  }
234  else if (nbead >= nbeads - 1)
235  {
237  return result;
238  }
239 
240  else
241  {
242  Walker_t::ParticlePos dR(getBead(nbead + 1).R), interpR(getBead(nbead).R);
243  dR = dR - getBead(nbead).R;
244 
245  interpR = getBead(nbead).R + beadfrac * dR;
246  return interpR;
247  }
248  }
Walker_t & getTail()
Definition: Reptile.h:98
typename p_traits::ParticlePos ParticlePos
array of particles
Definition: Walker.h:64
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
Walker_t & getBead(IndexType i)
Definition: Reptile.h:96
QMCTraits::RealType RealType
ParticleAttrib< SingleParticlePos > ParticlePos
Definition: Configuration.h:92
Walker_t & getHead()
Definition: Reptile.h:97
IndexType nbeads
Definition: Reptile.h:59
ParticlePos R
The configuration vector (3N-dimensional vector to store the positions of all the particles for a sin...
Definition: Walker.h:114

◆ operator[]()

Walker_t& operator[] ( IndexType  i)
inline

Definition at line 85 of file Reptile.h.

References Reptile::getBeadIndex(), and Reptile::getWalker().

85 { return getWalker(getBeadIndex(i)); }
IndexType getBeadIndex(IndexType i)
Definition: Reptile.h:95
Walker_t & getWalker(IndexType i)
Definition: Reptile.h:89

◆ printState()

void printState ( )
inline

Definition at line 188 of file Reptile.h.

References Reptile::Action, qmcplusplus::app_log(), Reptile::direction, Reptile::getBead(), Reptile::getBeadIndex(), Reptile::headindex, Reptile::nbeads, Walker< t_traits, p_traits >::Properties, Walker< t_traits, p_traits >::R, and Reptile::tau.

189  {
190  app_log() << "********PRINT REPTILE STATE*********\n";
191  app_log() << "Direction=" << direction << " Headindex=" << headindex << " tail=" << getBeadIndex(nbeads - 1)
192  << "\n next=" << getBeadIndex(nbeads - 2) << " nbeads=" << nbeads << std::endl;
193  app_log() << "BeadIndex\tWrapIndex\tEnergy\tAction[0]\tAction[1]\tAction[2]\t\n";
194  for (int i = 0; i < nbeads; i++)
195  {
196  app_log() << i << "\t" << getBeadIndex(i) << "\t" << getBead(i).Properties(WP::LOCALENERGY) << "\t"
197  << getBead(i).Properties(Action[0]) << "\t" << getBead(i).Properties(Action[1]) << "\t"
198  << getBead(i).Properties(Action[2]) << "\n";
199  }
200  app_log() << "POSITIONS===============:\n";
201  for (int i = 0; i < nbeads; i++)
202  {
203  // app_log()<<i<<"\t1"<<1<<"\t"<<getBead(i).R[0]<<"\n";
204  // app_log()<<i<<"\t2"<<2<<"\t"<<getBead(i).R[1]<<"\n";
205  app_log() << "BEAD #" << i << " tau = " << tau * i << std::endl;
206  app_log() << getBead(i).R << std::endl;
207  }
208  app_log() << "GVECS===============:\n";
209  for (int i = 0; i < nbeads; i++)
210  {
211  // app_log()<<i<<"\t1"<<1<<"\t"<<getBead(i).G[0]<<"\n";
212  // app_log()<<i<<"\t2"<<2<<"\t"<<getBead(i).G[1]<<"\n";
213  app_log() << "BEAD #" << i << " tau = " << tau * i << std::endl;
214  app_log() << getBead(i).G << std::endl;
215  }
216  app_log() << "************************************\n";
217  }
PropertyContainer_t Properties
scalar properties of a walker
Definition: Walker.h:125
std::ostream & app_log()
Definition: OutputManager.h:65
std::vector< IndexType > Action
Definition: Reptile.h:47
IndexType getBeadIndex(IndexType i)
Definition: Reptile.h:95
Walker_t & getBead(IndexType i)
Definition: Reptile.h:96
IndexType headindex
Definition: Reptile.h:59
IndexType nbeads
Definition: Reptile.h:59
ParticlePos R
The configuration vector (3N-dimensional vector to store the positions of all the particles for a sin...
Definition: Walker.h:114
IndexType direction
Definition: Reptile.h:59

◆ saveAction()

void saveAction ( Walker_t walker,
IndexType  d,
RealType  val,
IndexType  nPsi = 0 
)
inline

Definition at line 135 of file Reptile.h.

References Reptile::Action, Reptile::direction, and qmcplusplus::walker.

Referenced by RMCUpdateAllWithDrift::advanceWalkersVMC().

136  {
137  //IndexType repdirection=circbuffer.get_direction();
138  IndexType actionindex = 2;
139  if (direction != 0)
140  actionindex = (1 - d * direction) / 2;
141  walker.Properties(nPsi, Action[actionindex]) = val;
142  }
std::vector< IndexType > Action
Definition: Reptile.h:47
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
IndexType direction
Definition: Reptile.h:59

◆ saveTransProb() [1/2]

void saveTransProb ( Walker_t walker,
IndexType  d,
RealType  val,
IndexType  nPsi = 0 
)
inline

Definition at line 162 of file Reptile.h.

References Reptile::direction, Reptile::TransProb, and qmcplusplus::walker.

Referenced by RMCUpdateAllWithDrift::advanceWalkersRMC(), and RMCUpdateAllWithDrift::advanceWalkersVMC().

163  {
164  //IndexType repdirection=circbuffer.get_direction();
165  IndexType transindex = (1 - d * direction) / 2;
166  walker.Properties(nPsi, TransProb[transindex]) = val;
167  }
std::vector< IndexType > TransProb
Definition: Reptile.h:48
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
IndexType direction
Definition: Reptile.h:59

◆ saveTransProb() [2/2]

void saveTransProb ( ParticleSet W,
IndexType  d,
RealType  val,
IndexType  nPsi = 0 
)
inline

Definition at line 169 of file Reptile.h.

References Reptile::direction, ParticleSet::Properties, and Reptile::TransProb.

170  {
171  //IndexType repdirection=circbuffer.get_direction();
172  IndexType transindex = (1 - d * direction) / 2;
173  W.Properties(nPsi, TransProb[transindex]) = val;
174  }
std::vector< IndexType > TransProb
Definition: Reptile.h:48
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
IndexType direction
Definition: Reptile.h:59

◆ setBead()

void setBead ( Walker_t walker,
IndexType  i 
)
inline

Definition at line 113 of file Reptile.h.

References Reptile::getBeadIndex(), Reptile::getWalker(), and qmcplusplus::walker.

114  {
115  IndexType index = getBeadIndex(i);
116  Walker_t& newbead(getWalker(index));
117  newbead = walker; //This should be a hard copy
118  }
IndexType getBeadIndex(IndexType i)
Definition: Reptile.h:95
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
Walker_t & getWalker(IndexType i)
Definition: Reptile.h:89
MCWalkerConfiguration::Walker_t Walker_t
Definition: Reptile.h:41

◆ setDirection()

void setDirection ( IndexType  dir)
inline

Definition at line 111 of file Reptile.h.

References Reptile::direction.

111 { direction = dir; }
IndexType direction
Definition: Reptile.h:59

◆ setHead()

void setHead ( Walker_t overwrite)
inline

Definition at line 120 of file Reptile.h.

References Reptile::getBead(), Reptile::getBeadIndex(), Reptile::headindex, and Reptile::nbeads.

121  {
122  //overwrite last element.
123  headindex = getBeadIndex(nbeads - 1); //sets to position of tail.
124  Walker_t& newhead(getBead(0));
125  newhead = overwrite;
126  }
IndexType getBeadIndex(IndexType i)
Definition: Reptile.h:95
Walker_t & getBead(IndexType i)
Definition: Reptile.h:96
IndexType headindex
Definition: Reptile.h:59
MCWalkerConfiguration::Walker_t Walker_t
Definition: Reptile.h:41
IndexType nbeads
Definition: Reptile.h:59

◆ setReptileSlicePositions() [1/2]

void setReptileSlicePositions ( ReptileConfig_t rept)
inline

Definition at line 260 of file Reptile.h.

References Reptile::getBead(), Reptile::nbeads, and Walker< t_traits, p_traits >::R.

261  {
262  if (rept.size() == nbeads)
263  {
264  for (int i = 0; i < nbeads; i++)
265  getBead(i).R = rept[i];
266  }
267  else
268  ;
269  }
Walker_t & getBead(IndexType i)
Definition: Reptile.h:96
IndexType nbeads
Definition: Reptile.h:59
ParticlePos R
The configuration vector (3N-dimensional vector to store the positions of all the particles for a sin...
Definition: Walker.h:114

◆ setReptileSlicePositions() [2/2]

void setReptileSlicePositions ( Walker_t::ParticlePos  R)
inline

Definition at line 271 of file Reptile.h.

References Reptile::getBead(), Reptile::nbeads, and Walker< t_traits, p_traits >::R.

272  {
273  for (int i = 0; i < nbeads; i++)
274  getBead(i).R = R;
275  }
Walker_t & getBead(IndexType i)
Definition: Reptile.h:96
IndexType nbeads
Definition: Reptile.h:59
ParticlePos R
The configuration vector (3N-dimensional vector to store the positions of all the particles for a sin...
Definition: Walker.h:114

◆ setTau()

void setTau ( RealType  t)
inline

Definition at line 219 of file Reptile.h.

References Reptile::tau.

219 { tau = t; }

◆ size()

IndexType size ( void  )
inline

Definition at line 83 of file Reptile.h.

References Reptile::nbeads.

83 { return nbeads; }
IndexType nbeads
Definition: Reptile.h:59

◆ wrapIndex()

IndexType wrapIndex ( IndexType  repindex)
inline

Definition at line 87 of file Reptile.h.

References Reptile::nbeads.

Referenced by Reptile::flip(), Reptile::getBeadIndex(), and Reptile::getWalker().

87 { return (repindex % nbeads + nbeads) % nbeads; }
IndexType nbeads
Definition: Reptile.h:59

Member Data Documentation

◆ Action

◆ backwardaction

RealType backwardaction

Definition at line 53 of file Reptile.h.

◆ backwardprob

RealType backwardprob

Definition at line 51 of file Reptile.h.

◆ direction

◆ forwardaction

RealType forwardaction

Definition at line 52 of file Reptile.h.

◆ forwardprob

RealType forwardprob

Definition at line 50 of file Reptile.h.

◆ headindex

◆ nbeads

◆ prophead

Walker_t* prophead

Definition at line 60 of file Reptile.h.

◆ repend

WalkerIter_t repend

Definition at line 58 of file Reptile.h.

Referenced by Reptile::Reptile().

◆ repstart

WalkerIter_t repstart

Definition at line 58 of file Reptile.h.

Referenced by Reptile::getWalker(), and Reptile::Reptile().

◆ tau

◆ TransProb

◆ w

Definition at line 57 of file Reptile.h.

Referenced by Reptile::Reptile().


The documentation for this class was generated from the following file: