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

A derived class which performs an advance tail move, causing the tail of a worm in a off-diagonal configuration to advance in imaginary time, resulting in a shorter worm. More...

#include <move.h>

+ Inheritance diagram for AdvanceTailMove:
+ Collaboration diagram for AdvanceTailMove:

Public Member Functions

 AdvanceTailMove (Path &, ActionBase *, MTRand &, ensemble _operateOnConfig=OFFDIAGONAL, bool _varLength=true)
 Constructor.
 
 ~AdvanceTailMove ()
 Destructor.
 
bool attemptMove ()
 Perform an advance 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 an advance tail move, causing the tail of a worm in a off-diagonal configuration to advance in imaginary time, resulting in a shorter worm.

Definition at line 472 of file move.h.

Member Function Documentation

◆ attemptMove()

bool AdvanceTailMove::attemptMove ( )
virtual

Perform an advance tail move.

Here we attempt to advance the tail of a worm in imaginary time by a random number of slices. This is accomplished by removing beads and the result is a shorter worm. It is only possible if we already have an off-diagonal configuration.

Implements MoveBase.

Definition at line 2609 of file move.cpp.

2609  {
2610 
2611  success = false;
2612 
2613  /* Only perform a move if we have beads */
2614  if (path.worm.getNumBeadsOn() == 0)
2615  return success;
2616 
2617  /* Get the number of time slices we will try to shrink the worm by */
2618  advanceLength = 2*(1 + random.randInt(constants()->Mbar()/2-1));
2619  numLevels = int (ceil(log(1.0*advanceLength) / log(2.0)-EPS));
2620 
2621  /* We now make sure that this is shorter than the length of the worm,
2622  * otherewise we reject the move immediatly */
2623  if (advanceLength < path.worm.length) {
2624 
2625  /* The proposed new tail */
2626  tailBead = path.next(path.worm.tail,advanceLength);
2627 
2628  /* The action shift due to the chemical potential */
2629  double muShift = advanceLength*constants()->tau()*constants()->mu();
2630 
2631  double norm = constants()->attemptProb("recede tail") /
2632  constants()->attemptProb("advance tail");
2633 
2634  /* Weight for ensemble */
2635  norm *= actionPtr->ensembleWeight(-advanceLength);
2636 
2637  checkMove(0,0.0);
2638 
2639  /* Increment the number of recede moves and the total number of moves */
2640  numAttempted++;
2641  numAttemptedLevel(numLevels)++;
2642  totAttempted++;
2643 
2644  /* Mark the proposed tail as special */
2645  path.worm.special1 = tailBead;
2646 
2647  /* If we have a local action, perform a single slice rejection move */
2648  if (actionPtr->local) {
2649 
2650  double actionShift = (-log(norm) + muShift)/advanceLength;
2651 
2652  deltaAction = 0.0;
2653  double factor = 0.5;
2654 
2655  beadLocator beadIndex;
2656  beadIndex = path.worm.tail;
2657  do {
2658  deltaAction = -(actionPtr->barePotentialAction(beadIndex) - factor*actionShift);
2659 
2660  /* We do a single slice Metropolis test and exit the move if we
2661  * wouldn't remove the single bead */
2662  if ( random.rand() >= exp(-deltaAction) ) {
2663  undoMove();
2664  return success;
2665  }
2666 
2667  factor = 1.0;
2668  beadIndex = path.next(beadIndex);
2669  } while (!all(beadIndex==tailBead));
2670 
2671  /* Add the part from the tail */
2672  deltaAction = -(actionPtr->barePotentialAction(beadIndex) - 0.5*actionShift);
2673  deltaAction -= actionPtr->potentialActionCorrection(path.worm.tail,tailBead);
2674 
2675  /* Perform final metropolis test */
2676  if ( random.rand() < (exp(-deltaAction)) ) {
2677  keepMove();
2678  checkMove(1,deltaAction - advanceLength*actionShift);
2679  }
2680  else {
2681  undoMove();
2682  checkMove(2,0.0);
2683  }
2684  }
2685  /* Otherwise, perform a full trajectory update */
2686  else {
2687  /* Compute the old action for the path to be removed */
2689 
2690  /* Perform the metropolis test */
2691  if ( random.rand() < norm*exp(oldAction - muShift) ) {
2692  keepMove();
2693  checkMove(1,-oldAction);
2694  }
2695  else {
2696  undoMove();
2697  checkMove(2,0.0);
2698  }
2699  }
2700 
2701  } // advanceLength
2702 
2703  return success;
2704 }
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
beadLocator & next(int slice, int ptcl)
Move one link forward in imaginary time.
Definition: path.h:86
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
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: