Path Integral Quantum Monte Carlo
Public Member Functions | Static Public Attributes
RecedeTailMove Class Reference

A derived class which performs a recede move on the tail, causing a worm tail to propagate backwards in imaginary time by adding beads and links. More...

#include <move.h>

+ Inheritance diagram for RecedeTailMove:
+ Collaboration diagram for RecedeTailMove:

Public Member Functions

 RecedeTailMove (Path &, ActionBase *, MTRand &, ensemble _operateOnConfig=OFFDIAGONAL, bool _varLength=true)
 Constructor.
 
 ~RecedeTailMove ()
 Destructor.
 
bool attemptMove ()
 Perform a recede tail move. More...
 
string getName ()
 return the move name
 
- Public Member Functions inherited from MoveBase
 MoveBase (Path &, ActionBase *, MTRand &, ensemble _operateOnConfig=ANY, bool _varLength=false)
 Move naming conventions: More...
 
virtual ~MoveBase ()
 Destructor.
 
double getAcceptanceRatio ()
 Get the acceptance ratio.
 
double getTotAcceptanceRatio ()
 Get the total acceptance ratio.
 
double getAcceptanceRatioLevel (int n)
 Get the acceptance ratio by level.
 
int getNumAttempted ()
 Get the number of moves attempted.
 
int getNumAccepted ()
 Get the number of moves accepted.
 
int getNumAttemptedLevel (int n)
 Get the number of moves attempted by level.
 
int getNumAcceptedLevel (int n)
 Get the number of moves accepted by level.
 
void resetTotAccept ()
 Reset the total accepted counter.
 
void resetAccept ()
 Reset the number accepted counter.
 

Static Public Attributes

static const string name
 

Additional Inherited Members

- Data Fields inherited from MoveBase
ensemble operateOnConfig
 What configurations do we operate on?
 
bool variableLength
 Does the move have a variable length?
 
string name1
 
- Protected Member Functions inherited from MoveBase
dVec newStagingPosition (const beadLocator &, const beadLocator &, const int, const int)
 Returns a new staging position which will exactly sample the kinetic action. More...
 
dVec newStagingPosition (const beadLocator &, const beadLocator &, const int, const int, iVec &)
 Returns a new staging position which will exactly sample the kinetic action in different winding sectors. More...
 
iVec sampleWindingSector (const beadLocator &, const beadLocator &, const int, double &)
 Obtain a winding sector for a stage-like move. More...
 
iVec getWindingNumber (const beadLocator &, const beadLocator &)
 Find the winding number for a path between two beads. More...
 
dVec newFreeParticlePosition (const beadLocator &)
 Generates a new position, which exactly samples the free particle density matrix. More...
 
dVec newBisectionPosition (const beadLocator &, const int)
 Returns a new bisection position which will exactly sample the kinetic action. More...
 
void printMoveState (string)
 
void checkMove (int, double)
 
- Protected Attributes inherited from MoveBase
Pathpath
 A reference to the paths.
 
ActionBaseactionPtr
 A base pointer to the action.
 
MTRand & random
 A reference to the RNG.
 
bool success
 Did we sucessfully perform a move?
 
uint32 numAccepted
 The number of accepted moves.
 
uint32 numAttempted
 The number of attempted moves.
 
int numToMove
 The number of particles moved.
 
int numLevels
 
Array< uint32, 1 > numAcceptedLevel
 The number of moves accepted at each level.
 
Array< uint32, 1 > numAttemptedLevel
 The number of moves attempted at each level.
 
Array< dVec, 1 > originalPos
 The original particle positions.
 
Array< dVec, 1 > newPos
 New particle positions.
 
vector< iVecwinding
 The winding vectors

 
vector< int > windingSector
 Used to index different winding sectors.
 
vector< double > cumrho0
 Used for tower-sampling winding sectors.
 
int maxWind
 The largest winding number.
 
int numWind
 The total number of winding vectors.
 
double oldAction
 The original potential action.
 
double newAction
 The new potential action.
 
double deltaAction
 The action difference.
 
double sqrt2LambdaTau
 sqrt(2 * Lambda * tau)
 
double sqrtLambdaTau
 sqrt(Lambda * tau)
 
beadLocator nBeadIndex
 Neighbor bead index.
 
dVec neighborPos
 Staging neighbor position.
 
dVec newRanPos
 Staing random position.
 
double newK
 
double oldK
 The old and new kinetic action.
 
double newV
 
double oldV
 The old and new potential action.
 
- Static Protected Attributes inherited from MoveBase
static uint32 totAccepted = 0
 The total number of moves accepted.
 
static uint32 totAttempted = 0
 The total number of moves attempted.
 

Detailed Description

A derived class which performs a recede move on the tail, causing a worm tail to propagate backwards in imaginary time by adding beads and links.

Definition at line 527 of file move.h.

Member Function Documentation

◆ attemptMove()

bool RecedeTailMove::attemptMove ( )
virtual

Perform a recede tail move.

Attempt to propagate a worm tail backwards in imaginary time by randomly selecting a number of links then attempting to generate new positions which exactly sample the free particle density matrix.

Implements MoveBase.

Definition at line 2947 of file move.cpp.

2947  {
2948 
2949  success = false;
2950 
2951  /* Only perform a move if we have beads */
2952  if (path.worm.getNumBeadsOn() == 0)
2953  return success;
2954 
2955  /* Get the length of the proposed advancement by computing
2956  * a random number of levels to be used in the bisection algorithm. */
2957  recedeLength = 2*(1 + random.randInt(constants()->Mbar()/2-1));
2958  numLevels = int (ceil(log(1.0*recedeLength) / log(2.0)-EPS));
2959 
2960  checkMove(0,0.0);
2961 
2962  /* Increment the number of advance moves and the total number of moves */
2963  numAttempted++;
2964  numAttemptedLevel(numLevels)++;
2965  totAttempted++;
2966 
2967  double muShift = recedeLength*constants()->tau()*constants()->mu();
2968  double norm = constants()->attemptProb("advance tail") /
2969  constants()->attemptProb("recede tail");
2970 
2971  /* Weight for ensemble */
2972  norm *= actionPtr->ensembleWeight(recedeLength);
2973 
2974  /* Make the current tail special, and undefine the tail */
2976  path.worm.tail = XXX;
2977 
2978  /* If we have a local action, perform a single slice rejection move */
2979  if (actionPtr->local) {
2980 
2981  double actionShift = (log(norm) + muShift)/recedeLength;
2982 
2983  /* Compute the action for the proposed path, and assign the new tail */
2984  beadLocator beadIndex;
2985  beadIndex = path.worm.special1;
2986 
2987  deltaAction = actionPtr->barePotentialAction(beadIndex) - 0.5*actionShift;
2988 
2989  /* We perform a metropolis test on the tail bead */
2990  if ( random.rand() >= exp(-deltaAction) ) {
2991  undoMove();
2992  return success;
2993  }
2994 
2995  for (int k = 0; k < (recedeLength-1); k++) {
2996  beadIndex = path.addPrevBead(beadIndex,newFreeParticlePosition(beadIndex));
2997  deltaAction = actionPtr->barePotentialAction(beadIndex) - actionShift;
2998 
2999  /* We perform a metropolis test on the single bead */
3000  if ( random.rand() >= exp(-deltaAction) ) {
3001  undoMove();
3002  return success;
3003  }
3004  }
3005  tailBead = path.addPrevBead(beadIndex,newFreeParticlePosition(beadIndex));
3006 
3007  /* Assign the new tail bead and compute its action */
3008  path.worm.tail = tailBead;
3009  deltaAction = actionPtr->barePotentialAction(tailBead) - 0.5*actionShift;
3010  deltaAction += actionPtr->potentialActionCorrection(tailBead,path.worm.special1);
3011 
3012  /* Perform the metropolis test */
3013  if ( random.rand() < (exp(-deltaAction))) {
3014  keepMove();
3015  checkMove(1,deltaAction + recedeLength*actionShift);
3016  }
3017  else {
3018  undoMove();
3019  checkMove(2,0.0);
3020  }
3021  }
3022  /* Otherwise, we perform a full trajectory updates */
3023  else {
3024  /* Generate the new path, assigning the new tail */
3025  beadLocator beadIndex;
3026  beadIndex = path.worm.special1;
3027  for (int k = 0; k < recedeLength; k++)
3028  beadIndex = path.addPrevBead(beadIndex,newFreeParticlePosition(beadIndex));
3029  tailBead = beadIndex;
3030  path.worm.tail = tailBead;
3031 
3032  /* Get the action for the proposed path */
3034 
3035  /* Perform the metropolis test */
3036  if ( random.rand() < norm*exp(-newAction + muShift)) {
3037  keepMove();
3038  checkMove(1,newAction);
3039  }
3040  else {
3041  undoMove();
3042  checkMove(2,0.0);
3043  }
3044  }
3045 
3046  return success;
3047 }
const bool local
Is the action local in imaginary time?
Definition: action.h:103
virtual double potentialAction()
The effective potential inter-ACTION for various pass conditions.
Definition: action.h:48
double ensembleWeight(const int)
The ensemble particle number weighting factor.
Definition: action.cpp:122
double mu() const
Get chemical potential.
Definition: constants.h:43
double tau() const
Get imaginary time step.
Definition: constants.h:44
uint32 numAttempted
The number of attempted moves.
Definition: move.h:87
Path & path
A reference to the paths.
Definition: move.h:80
dVec newFreeParticlePosition(const beadLocator &)
Generates a new position, which exactly samples the free particle density matrix.
Definition: move.cpp:448
MTRand & random
A reference to the RNG.
Definition: move.h:82
double deltaAction
The action difference.
Definition: move.h:109
ActionBase * actionPtr
A base pointer to the action.
Definition: move.h:81
double newAction
The new potential action.
Definition: move.h:108
Array< uint32, 1 > numAttemptedLevel
The number of moves attempted at each level.
Definition: move.h:95
bool success
Did we sucessfully perform a move?
Definition: move.h:84
static uint32 totAttempted
The total number of moves attempted.
Definition: move.h:92
beadLocator addPrevBead(const beadLocator &, const dVec &)
Add a bead at the previous time slice.
Definition: path.cpp:221
Worm worm
Details on the worm.
Definition: path.h:44
beadLocator tail
The coordinates of the worm tail.
Definition: worm.h:32
int getNumBeadsOn() const
Return the number of active beads.
Definition: worm.h:88
beadLocator special1
Special bead, used in move updates.
Definition: worm.h:33
TinyVector< int, 2 > beadLocator
time-slice,bead-number world line index
Definition: common.h:117
#define EPS
A small number.
Definition: common.h:94
#define XXX
Used to refer to a nonsense beadIndex.
Definition: common.h:98
ConstantParameters * constants()
Global public access to the constants.
Definition: constants.h:201
+ Here is the call graph for this function:

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