Path Integral Quantum Monte Carlo
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
MoveBase Class Referenceabstract

The base class that all moves will be derived from. More...

#include <move.h>

+ Inheritance diagram for MoveBase:

Public Member Functions

 MoveBase (Path &, ActionBase *, MTRand &, ensemble _operateOnConfig=ANY, bool _varLength=false)
 Move naming conventions: More...
 
virtual ~MoveBase ()
 Destructor.
 
virtual string getName ()
 return the move name
 
double getAcceptanceRatio ()
 Get the acceptance ratio. More...
 
double getTotAcceptanceRatio ()
 Get the total acceptance ratio. More...
 
double getAcceptanceRatioLevel (int n)
 Get the acceptance ratio by level. More...
 
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.
 
virtual bool attemptMove ()=0
 Attempt the move (will be overloaded). More...
 
void resetTotAccept ()
 Reset the total accepted counter.
 
void resetAccept ()
 Reset the number accepted counter.
 

Public Attributes

ensemble operateOnConfig
 What configurations do we operate on?
 
bool variableLength
 Does the move have a variable length?
 
string name1
 

Protected Member Functions

virtual void keepMove ()
 Keep the move. More...
 
virtual void undoMove ()=0
 undo the move
 
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

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

static uint32 totAccepted = 0
 The total number of moves accepted.
 
static uint32 totAttempted = 0
 The total number of moves attempted.
 

Friends

class PathIntegralMonteCarlo
 

Detailed Description

The base class that all moves will be derived from.

There will be a bunch of different types of moves, those which move individual particles, the center of mass of an entire worldine loop etc. They will all share the basic functionality defined here.

Definition at line 30 of file move.h.

Constructor & Destructor Documentation

◆ MoveBase()

MoveBase::MoveBase ( Path _path,
ActionBase _actionPtr,
MTRand &  _random,
ensemble  _operateOnConfig = ANY,
bool  _varLength = false 
)

Move naming conventions:

1) be as descriptive as possible 2) spaces are fine Constructor.

Definition at line 66 of file move.cpp.

Member Function Documentation

◆ attemptMove()

virtual bool MoveBase::attemptMove ( )
pure virtual

◆ getAcceptanceRatio()

double MoveBase::getAcceptanceRatio ( )
inline

Get the acceptance ratio.

Definition at line 45 of file move.h.

◆ getAcceptanceRatioLevel()

double MoveBase::getAcceptanceRatioLevel ( int  n)
inline

Get the acceptance ratio by level.

Definition at line 55 of file move.h.

◆ getTotAcceptanceRatio()

double MoveBase::getTotAcceptanceRatio ( )
inline

Get the total acceptance ratio.

Definition at line 50 of file move.h.

◆ getWindingNumber()

iVec MoveBase::getWindingNumber ( const beadLocator startBead,
const beadLocator endBead 
)
protected

Find the winding number for a path between two beads.

Find the winding number for a given path between two beads.

By following a trajectory between two beads, accumulate the winding number by tracking when periodic boundary conditions are invoked.

Parameters
startBeadThe index of the start of the stage
endBeadThe index of the final bead in the stage
Returns
A integer NDIM-vector which holds the winding vector of the path.

Definition at line 418 of file move.cpp.

◆ keepMove()

DEBUG void MoveBase::keepMove ( )
protectedvirtual

Keep the move.

For all move types, if the move is accepted, we simply increment our accept counters.

Definition at line 251 of file move.cpp.

◆ newBisectionPosition()

dVec MoveBase::newBisectionPosition ( const beadLocator beadIndex,
const int  lshift 
)
protected

Returns a new bisection position which will exactly sample the kinetic action.

Parameters
beadIndexThe bead that we want a new position for
lshiftThe number of time slices between beads moved at this level
Returns
A NDIM-vector which holds a new random position.

Definition at line 478 of file move.cpp.

◆ newFreeParticlePosition()

dVec MoveBase::newFreeParticlePosition ( const beadLocator neighborIndex)
protected

Generates a new position, which exactly samples the free particle density matrix.

Compute a position which is selected from a guassian distribution with a mean at a neighboring position, and variance equal to 2 * lambda * tau.

Parameters
neighborIndexthe beadLocator for a neighboring bead
Returns
A randomly generated position which exactly samples 1/2 the kinetic action.

Definition at line 457 of file move.cpp.

◆ newStagingPosition() [1/2]

dVec MoveBase::newStagingPosition ( const beadLocator neighborIndex,
const beadLocator endIndex,
const int  stageLength,
const int  k 
)
protected

Returns a new staging position which will exactly sample the kinetic action.

Parameters
neighborIndexThe index of the bead to be updated's neighbor
endIndexThe index of the final bead in the stage
stageLengthThe length of the stage
kThe position along the stage
Returns
A NDIM-vector which holds a new random position.

Definition at line 271 of file move.cpp.

◆ newStagingPosition() [2/2]

dVec MoveBase::newStagingPosition ( const beadLocator neighborIndex,
const beadLocator endIndex,
const int  stageLength,
const int  k,
iVec wind 
)
protected

Returns a new staging position which will exactly sample the kinetic action in different winding sectors.

Parameters
neighborIndexThe index of the bead to be updated's neighbor
endIndexThe index of the final bead in the stage
stageLengthThe length of the stage
kThe position along the stage
Returns
A NDIM-vector which holds a new random position.

Definition at line 308 of file move.cpp.

◆ sampleWindingSector()

iVec MoveBase::sampleWindingSector ( const beadLocator startBead,
const beadLocator endBead,
const int  stageLength,
double &  totalrho0 
)
protected

Obtain a winding sector for a stage-like move.

Determine the winding sector to sample for a stage like move.

Perform tower sampling to select a winding sector from the free particle kinetic density matrix.

Parameters
startBeadThe index of the start of the stage
endBeadThe index of the final bead in the stage
stageLengthThe length of the stage
Returns
A integer NDIM-vector which holds the winding vector to be sampled.

Definition at line 360 of file move.cpp.


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