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

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

#include <move.h>

+ Inheritance diagram for AdvanceHeadMove:
+ Collaboration diagram for AdvanceHeadMove:

Public Member Functions

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

Definition at line 438 of file move.h.

Member Function Documentation

◆ attemptMove()

bool AdvanceHeadMove::attemptMove ( )
virtual

Perform an advance head move.

Attempt to advance a worm head in imaginary time by a random number of slices. We generate the new bead positions from the free particle density matrix. It is only possible if we already have an off-diagonal configuration.

Implements MoveBase.

Definition at line 2430 of file move.cpp.

2430  {
2431 
2432  success = false;
2433 
2434  /* Only perform a move if we have beads */
2435  if (path.worm.getNumBeadsOn() == 0)
2436  return success;
2437 
2438  /* Get the length of the proposed advancement by computing
2439  * a random number of levels to be used in the bisection algorithm. */
2440  advanceLength = 2*(1 + random.randInt(constants()->Mbar()/2-1));
2441  numLevels = int (ceil(log(1.0*advanceLength) / log(2.0)-EPS));
2442 
2443  checkMove(0,0.0);
2444 
2445  /* Increment the number of advance moves and the total number of moves */
2446  numAttempted++;
2447  numAttemptedLevel(numLevels)++;
2448  totAttempted++;
2449 
2450  double muShift = advanceLength*constants()->tau()*constants()->mu();
2451  double norm = constants()->attemptProb("recede head") /
2452  constants()->attemptProb("advance head");
2453 
2454  /* Weight for ensemble */
2455  norm *= actionPtr->ensembleWeight(advanceLength);
2456 
2457  /* Make the old head a special bead, and undefine the head */
2459  path.worm.head = XXX;
2460 
2461  /* If we have a local action, perform a single slice rejection move */
2462  if (actionPtr->local) {
2463 
2464  double actionShift = (log(norm) + muShift)/advanceLength;
2465 
2466  /* Generate the new path, and compute its action, assigning the new head */
2467  beadLocator beadIndex;
2468  beadIndex = path.worm.special1;
2469  deltaAction = actionPtr->barePotentialAction(beadIndex) - 0.5*actionShift;
2470 
2471  if ( random.rand() >= exp(-deltaAction) ) {
2472  undoMove();
2473  return success;
2474  }
2475 
2476  for (int k = 0; k < (advanceLength-1); k++) {
2477  beadIndex = path.addNextBead(beadIndex,newFreeParticlePosition(beadIndex));
2478  deltaAction = actionPtr->barePotentialAction(beadIndex) - actionShift;
2479 
2480  /* We perform a metropolis test on the single bead */
2481  if ( random.rand() >= exp(-deltaAction) ) {
2482  undoMove();
2483  return success;
2484  }
2485  }
2486  headBead = path.addNextBead(beadIndex,newFreeParticlePosition(beadIndex));
2487 
2488  /* Assign the new head and compute its action */
2489  path.worm.head = headBead;
2490  deltaAction = actionPtr->potentialAction(headBead) - 0.5*actionShift;
2491  deltaAction += actionPtr->potentialActionCorrection(path.worm.special1,path.worm.head);
2492 
2493  /* Perform the metropolis test */
2494  if ( random.rand() < (exp(-deltaAction))) {
2495  keepMove();
2496  checkMove(1,deltaAction + advanceLength*actionShift);
2497  }
2498  else {
2499  undoMove();
2500  checkMove(2,0.0);
2501  }
2502  }
2503  /* Otherwise, perform a full trajctory update */
2504  else {
2505 
2506  /* Generate the new path, assigning the new head */
2507  beadLocator beadIndex;
2508  beadIndex = path.worm.special1;
2509  for (int k = 0; k < advanceLength; k++)
2510  beadIndex = path.addNextBead(beadIndex,newFreeParticlePosition(beadIndex));
2511  headBead = beadIndex;
2512  path.worm.head = headBead;
2513 
2514  /* Compute the action for the updated path */
2516 
2517  /* Perform the metropolis test */
2518  if ( random.rand() < norm*exp(-newAction + muShift) ) {
2519  keepMove();
2520  checkMove(1,newAction);
2521  }
2522  else {
2523  undoMove();
2524  checkMove(2,0.0);
2525  }
2526  }
2527 
2528  return success;
2529 }
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
Worm worm
Details on the worm.
Definition: path.h:44
beadLocator addNextBead(const beadLocator &, const dVec &)
Add a bead at the next time slice.
Definition: path.cpp:194
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
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: