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

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

#include <move.h>

+ Inheritance diagram for RecedeHeadMove:
+ Collaboration diagram for RecedeHeadMove:

Public Member Functions

 RecedeHeadMove (Path &, ActionBase *, MTRand &, ensemble _operateOnConfig=OFFDIAGONAL, bool _varLength=true)
 Constructor.
 
 ~RecedeHeadMove ()
 Destructor.
 
bool attemptMove ()
 Perform a recede head 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 head, causing a worm head to propagate backwards in imaginary time by removing beads and links.

Definition at line 500 of file move.h.

Member Function Documentation

◆ attemptMove()

bool RecedeHeadMove::attemptMove ( )
virtual

Perform a recede head move.

Attempt to propagate a worm backwards in imaginary time by randomly selecting a number of links then attempting to remove them. The number of true particles doesn't change here.

Implements MoveBase.

Definition at line 2780 of file move.cpp.

2780  {
2781 
2782  success = false;
2783 
2784  /* Only perform a move if we have beads */
2785  if (path.worm.getNumBeadsOn() == 0)
2786  return success;
2787 
2788  /* Get the number of time slices we will try to shrink the worm by */
2789  recedeLength = 2*(1 + random.randInt(constants()->Mbar()/2-1));
2790  numLevels = int (ceil(log(1.0*recedeLength) / log(2.0)-EPS));
2791 
2792  /* We now make sure that this is shorter than the length of the worm,
2793  * otherewise we reject the move immediatly */
2794  if (recedeLength < path.worm.length) {
2795 
2796  /* The proposed new head */
2797  headBead = path.prev(path.worm.head,recedeLength);
2798 
2799  /* The action shift due to the chemical potential */
2800  double muShift = recedeLength*constants()->tau()*constants()->mu();
2801 
2802  double norm = constants()->attemptProb("advance head") /
2803  constants()->attemptProb("recede head");
2804 
2805  /* Weight for ensemble */
2806  norm *= actionPtr->ensembleWeight(-recedeLength);
2807 
2808  checkMove(0,0.0);
2809 
2810  /* Increment the number of recede moves and the total number of moves */
2811  numAttempted++;
2812  numAttemptedLevel(numLevels)++;
2813  totAttempted++;
2814 
2815  /* Set the proposed head as special */
2816  path.worm.special1 = headBead;
2817 
2818  /* If we have a local action, perform a single slice rejection move */
2819  if (actionPtr->local) {
2820 
2821  double actionShift = (-log(norm) + muShift)/recedeLength;
2822 
2823  deltaAction = 0.0;
2824  double factor = 0.5;
2825 
2826  beadLocator beadIndex;
2827  beadIndex = path.worm.head;
2828  do {
2829  deltaAction = -(actionPtr->barePotentialAction(beadIndex) - factor*actionShift);
2830  if ( random.rand() >= exp(-deltaAction) ) {
2831  undoMove();
2832  return success;
2833  }
2834 
2835  factor = 1.0;
2836  beadIndex = path.prev(beadIndex);
2837  } while (!all(beadIndex==headBead));
2838 
2839  deltaAction = -(actionPtr->barePotentialAction(headBead) - 0.5*actionShift);
2840  deltaAction -= actionPtr->potentialActionCorrection(path.worm.special1,path.worm.head);
2841 
2842  /* Perform final metropolis test */
2843  if ( random.rand() < (exp(-deltaAction)) ) {
2844  keepMove();
2845  checkMove(1,deltaAction - recedeLength*actionShift);
2846  }
2847  else {
2848  undoMove();
2849  checkMove(2,0.0);
2850  }
2851  }
2852  /* Otherwise, perform a full trajectory update */
2853  else {
2854  /* Get the original action for the path */
2856 
2857  /* Perform the metropolis test */
2858  if ( random.rand() < norm*exp(oldAction - muShift) ) {
2859  keepMove();
2860  checkMove(1,-oldAction);
2861  }
2862  else {
2863  undoMove();
2864  checkMove(2,0.0);
2865  }
2866  }
2867 
2868  } // recedeLength
2869 
2870  return success;
2871 }
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
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
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
double oldAction
The original potential action.
Definition: move.h:107
static uint32 totAttempted
The total number of moves attempted.
Definition: move.h:92
Worm worm
Details on the worm.
Definition: path.h:44
beadLocator & prev(int slice, int ptcl)
Move one link backward in imaginary time.
Definition: path.h:95
beadLocator head
The coordinates of the worm head.
Definition: worm.h:31
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
int length
The length of the worm.
Definition: worm.h:37
TinyVector< int, 2 > beadLocator
time-slice,bead-number world line index
Definition: common.h:117
#define EPS
A small number.
Definition: common.h:94
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: