Path Integral Quantum Monte Carlo
Public Member Functions | Protected Member Functions
NonLocalAction Class Reference

A base class to be inherited by actions that are non-local in imaginary time. More...

#include <action.h>

+ Inheritance diagram for NonLocalAction:
+ Collaboration diagram for NonLocalAction:

Public Member Functions

 NonLocalAction (const Path &, LookupTable &, PotentialBase *, PotentialBase *, WaveFunctionBase *, bool _local=false, string _name="Non-local")
 Setup the path data members for non-local actions.
 
virtual ~NonLocalAction ()
 Empty constructor.
 
double potentialAction ()
 Return the potential action for all time slices and all particles. More...
 
double potentialAction (const beadLocator &)
 Return the potential action for a single bead indexed with beadIndex. More...
 
double derivPotentialActionTau (int)
 The derivative of the potential action wrt tau on all links starting on slice. More...
 
double derivPotentialActionLambda (int)
 The derivative of the potential action wrt lambda on all links starting on slice. More...
 
virtual TinyVector< double, 2 > potential (int slice)
 
- Public Member Functions inherited from ActionBase
 ActionBase (const Path &, LookupTable &, PotentialBase *, PotentialBase *, WaveFunctionBase *, bool _local=true, string _name="Base", double _endFactor=1.0, int _period=1)
 Setup the path data members and canonical re-weighting factors.
 
virtual ~ActionBase ()
 Empty base constructor.
 
string getActionName ()
 Returns the action name.
 
double kineticAction ()
 The full kinetic Action
More...
 
double kineticAction (const beadLocator &)
 The kinetic Action at a single slice
More...
 
double kineticAction (const beadLocator &, int wlLength)
 The kinetic Action for wlLength slices. More...
 
virtual double potentialAction (const beadLocator &, const beadLocator &)
 Return the potential action for a path. More...
 
virtual double barePotentialAction (const beadLocator &)
 
virtual double potentialActionCorrection (const beadLocator &)
 
virtual double potentialActionCorrection (const beadLocator &, const beadLocator &)
 
virtual double secondderivPotentialActionTau (int)
 
virtual double derivPotentialActionTau (int, double)
 
virtual double derivPotentialActionLambda (int, double)
 
virtual dVec gradPotentialAction (int)
 
virtual double rDOTgradUterm1 (int)
 
virtual double rDOTgradUterm2 (int)
 
virtual double deltaDOTgradUterm1 (int)
 
virtual double deltaDOTgradUterm2 (int)
 
virtual double virKinCorr (int)
 
virtual double potential (int, double)
 
void setShift (int _shift)
 The public method that sets the tau scaling factor.
 
int getShift ()
 Get the tau scaling factor.
 
double rho0 (const dVec &, const dVec &, int)
 The free-particle density matrix. More...
 
double rho0 (const beadLocator &, const beadLocator &, int)
 The free-particle density matrix for two beadLocators with imaginary time separation M.
 
double rho0 (const dVec &, const int)
 The free-particle density matrix for a given spatial and temporal separation. More...
 
double ensembleWeight (const int)
 The ensemble particle number weighting factor. More...
 

Protected Member Functions

TinyVector< double, 2 > U (int)
 Return the potential action for all time slices and all particles. More...
 
- Protected Member Functions inherited from ActionBase
double tau ()
 The local shifted value of tau.
 
void updateSepHist (const dVec &)
 Update the separation histogram. More...
 

Additional Inherited Members

- Data Fields inherited from ActionBase
const bool local
 Is the action local in imaginary time?
 
const int period
 
PotentialBaseexternalPtr
 The external potential.
 
PotentialBaseinteractionPtr
 The interaction potential.
 
Array< int, 1 > sepHist
 A histogram of separations.
 
Array< int, 1 > cylSepHist
 A histogram of separations for a cylinder.
 
- Protected Attributes inherited from ActionBase
string name
 The name of the action.
 
LookupTablelookup
 We need a non-constant reference for updates.
 
const Pathpath
 A reference to the paths.
 
WaveFunctionBasewaveFunctionPtr
 A pointer to a trial wave function object.
 
double endFactor
 Mutiplictive factor of the potential action on ends.
 
int shift
 The scaling factor for tau.
 
bool canonical
 Are we in the canonical ensemble?
 
int numBeads0
 The target number of beads.
 
bool window
 
int windowWidth
 
bool gaussianEnsemble
 
double gaussianEnsembleSD
 
beadLocator bead2
 
beadLocator bead3
 
dVec sep
 
dVec sep2
 
double dSep
 

Detailed Description

A base class to be inherited by actions that are non-local in imaginary time.

See also
Section IV.F in D. M. Ceperley, Rev. Mod. Phys. 67, 279–355 (1995).

Definition at line 257 of file action.h.

Member Function Documentation

◆ derivPotentialActionLambda()

double NonLocalAction::derivPotentialActionLambda ( int  slice)
virtual

The derivative of the potential action wrt lambda on all links starting on slice.

It is essential to have these slice overloaded values as we need to be careful of the factor of 1/2 or i<j in the full potential action.

Parameters
slicethe imaginary timeslice of the first link

Reimplemented from ActionBase.

Definition at line 1709 of file action.cpp.

1709  {
1710 
1711  double totU = 0.0;
1712 
1713  beadLocator bead1;
1714  bead1[0] = bead2[0] = slice;
1715 
1716  beadLocator nextBead1,nextBead2;
1717 
1718  int numParticles = path.numBeadsAtSlice(slice);
1719 
1720  /* Calculate the total potential, including external and interaction
1721  * effects*/
1722  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
1723 
1724  /* Get the advanced neightbor of bead1 */
1725  nextBead1 = path.next(bead1);
1726 
1727  for (bead2[1] = bead1[1]+1; bead2[1] < numParticles; bead2[1]++) {
1728  sep = path.getSeparation(bead1,bead2);
1729 
1730  /* Get the advanced neighbor of the second bead */
1731  nextBead2 = path.next(bead2);
1732 
1733  sep2 = path.getSeparation(nextBead1,nextBead2);
1734  totU += interactionPtr->dVdlambda(sep,sep2);
1735  } // bead2
1736 
1737  } // bead1
1738  return ( totU );
1739 }
PotentialBase * interactionPtr
The interaction potential.
Definition: action.h:109
const Path & path
A reference to the paths.
Definition: action.h:118
dVec getSeparation(const beadLocator &, const beadLocator &) const
Return the separation vector between two particles in the same timeslice.
Definition: path.h:173
Array< int, 1 > numBeadsAtSlice
The number of active beads at a given time slice.
Definition: path.h:48
beadLocator & next(int slice, int ptcl)
Move one link forward in imaginary time.
Definition: path.h:86
virtual double dVdlambda(const dVec &, const dVec &)
The derivative of the effective potential with respect to lambda and tau.
Definition: potential.h:52
TinyVector< int, 2 > beadLocator
time-slice,bead-number world line index
Definition: common.h:117
+ Here is the call graph for this function:

◆ derivPotentialActionTau()

double NonLocalAction::derivPotentialActionTau ( int  slice)
virtual

The derivative of the potential action wrt tau on all links starting on slice.

It is essential to have these slice overloaded values as we need to be careful of the factor of 1/2 or i<j in the full potential action.

Parameters
slicethe imaginary timeslice of the first link

Reimplemented from ActionBase.

Definition at line 1664 of file action.cpp.

1664  {
1665 
1666  double totU = 0.0;
1667 
1668  beadLocator bead1;
1669  bead1[0] = bead2[0] = slice;
1670 
1671  beadLocator nextBead1,nextBead2;
1672 
1673  int numParticles = path.numBeadsAtSlice(slice);
1674 
1675  /* Initialize the separation histogram */
1676  sepHist = 0;
1677 
1678  /* Calculate the total potential, including external and interaction
1679  * effects*/
1680  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
1681 
1682  /* Get the advanced neightbor of bead1 */
1683  nextBead1 = path.next(bead1);
1684 
1685  for (bead2[1] = bead1[1]+1; bead2[1] < numParticles; bead2[1]++) {
1686  sep = path.getSeparation(bead1,bead2);
1687  updateSepHist(sep);
1688 
1689  /* Get the advanced neighbor of the second bead */
1690  nextBead2 = path.next(bead2);
1691 
1692  sep2 = path.getSeparation(nextBead1,nextBead2);
1693  totU += interactionPtr->dVdtau(sep,sep2);
1694  } // bead2
1695 
1696  } // bead1
1697  return ( totU );
1698 }
Array< int, 1 > sepHist
A histogram of separations.
Definition: action.h:111
void updateSepHist(const dVec &)
Update the separation histogram.
Definition: action.cpp:71
+ Here is the call graph for this function:

◆ potentialAction() [1/2]

double NonLocalAction::potentialAction ( )
virtual

Return the potential action for all time slices and all particles.

Computes the total potential energy by summing over all particles and time slices. We must be very careful with the factor of 1/2 or the fact that the sum is over i<j for particles to avoid double counting.

Reimplemented from ActionBase.

Definition at line 1514 of file action.cpp.

1514  {
1515 
1516  double totU = 0.0;
1517  for (int slice = 0; slice < path.numTimeSlices; slice++)
1518  totU += sum(U(slice));
1519 
1520  return ( totU );
1521 }
TinyVector< double, 2 > U(int)
Return the potential action for all time slices and all particles.
Definition: action.cpp:1619
const int numTimeSlices
A local constant copy of the number of time slices.
Definition: path.h:37
+ Here is the call graph for this function:

◆ potentialAction() [2/2]

double NonLocalAction::potentialAction ( const beadLocator bead1)
virtual

Return the potential action for a single bead indexed with beadIndex.


Parameters
beadIndexthe bead to compute the advanced link action for.

Reimplemented from ActionBase.

Definition at line 1528 of file action.cpp.

1528  {
1529 
1530  /* We only need to calculate the potential action if the two neighboring
1531  * beads are on */
1532  if (!path.worm.beadOn(bead1))
1533  return 0.0;
1534 
1535  /* Since the non-local action lives on a link, both bead1 and nextBead1
1536  * must exist */
1537  beadLocator nextBead1,nextBead2;
1538  nextBead1 = path.next(bead1);
1539 
1540  double totU = 0.0;
1541 
1542 #if PIGS
1543  /* We tack on a trial wave function and boundary piece if necessary */
1544  if ( (bead1[0] == 0) || (bead1[0] == (constants()->numTimeSlices()-1)) )
1545  totU -= log(waveFunctionPtr->PsiTrial(bead1));
1546 #endif
1547 
1548  /* Make sure nextBead1 is a real bead and that it is active */
1549  if ( (all(nextBead1==XXX)) || (!path.worm.beadOn(nextBead1)) )
1550  return totU;
1551 
1552  /* Evaluate the external potential */
1553  double totVext = externalPtr->V(path(bead1))+externalPtr->V(path(nextBead1));
1554 
1555  /* Get the interaction list */
1557  for (int n = 0; n < lookup.numBeads; n++) {
1558  bead2 = lookup.beadList(n);
1559  if(!all(path.next(bead2)==XXX))
1560  NNbead[bead2[1]] = true;
1561  }
1562 
1563  /* Get the next interaction list */
1564  lookup.updateInteractionList(path,nextBead1);
1565  for (int n = 0; n < lookup.numBeads; n++) {
1566  bead2 = path.prev(lookup.beadList(n));
1567  if(!all(bead2==XXX))
1568  NNbead[bead2[1]] = true;
1569  }
1570 
1571  bead2[0] = bead1[0];
1572  for (bead2[1]= 0; bead2[1] < path.numBeadsAtSlice(bead1[0]); bead2[1]++) {
1573  if(NNbead[bead2[1]]){
1574  nextBead2 = path.next(bead2);
1575  sep = path.getSeparation(bead1,bead2);
1576  sep2 = path.getSeparation(nextBead1,nextBead2);
1577  totU += interactionPtr->V(sep,sep2);
1578  NNbead[bead2[1]] = false;
1579  }
1580  }
1581 
1582  double totUext = tau()*totVext/(2.0);
1583 
1584  /* bead2[0] = bead1[0]; */
1585 
1586  /* /1* Now calculate the total effective interation potential, neglecting self-interactions *1/ */
1587  /* for (bead2[1]= 0; bead2[1] < path.numBeadsAtSlice(bead1[0]); bead2[1]++) { */
1588 
1589  /* /1* Skip self interactions *1/ */
1590  /* if ( bead2[1] != bead1[1] ) { */
1591 
1592  /* /1* get the separation between the two particles at the first time */
1593  /* * slice *1/ */
1594  /* sep = path.getSeparation(bead1,bead2); */
1595 
1596  /* /1* Now we find the separation at the advanced time step *1/ */
1597  /* nextBead2 = path.next(bead2); */
1598 
1599  /* /1* If the imaginary time neighbor exists, compute the effective */
1600  /* * potential *1/ */
1601  /* if ( (!all(nextBead2==XXX)) && (path.worm.beadOn(nextBead2)) ) { */
1602  /* sep2 = path.getSeparation(nextBead1,nextBead2); */
1603  /* totU += interactionPtr->V(sep,sep2,constants()->lambda(),constants()->tau()); */
1604  /* } */
1605  /* } // bead2 != bead1 */
1606 
1607 
1608  /* } // for bead2 */
1609 
1610  return (totU + totUext);
1611 }
WaveFunctionBase * waveFunctionPtr
A pointer to a trial wave function object.
Definition: action.h:119
LookupTable & lookup
We need a non-constant reference for updates.
Definition: action.h:117
double tau()
The local shifted value of tau.
Definition: action.h:133
PotentialBase * externalPtr
The external potential.
Definition: action.h:108
Array< beadLocator, 1 > beadList
The cutoff dynamic list of interacting beads.
Definition: lookuptable.h:40
void updateInteractionList(const Path &, const beadLocator &)
Update the NN lookup table and the array of beadLocators containing all beads which 'interact' with t...
int numBeads
The cutoff number of active beads in beadList;.
Definition: lookuptable.h:43
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
virtual double V(const dVec &)
The potential.
Definition: potential.h:39
virtual double PsiTrial(const int)
The Constant Trial Wave Function.
Definition: wavefunction.h:36
int beadOn(int, int) const
Safely get a bead (int indexed)
Definition: worm.h:148
#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:

◆ U()

TinyVector< double, 2 > NonLocalAction::U ( int  slice)
protected

Return the potential action for all time slices and all particles.

Computes the total potential energy by summing over all particles and time slices.

Definition at line 1619 of file action.cpp.

1619  {
1620 
1621  double totUint = 0.0;
1622  double totUext = 0.0;
1623 
1624  beadLocator bead1;
1625  bead1[0] = bead2[0] = slice;
1626 
1627  beadLocator nextBead1,nextBead2;
1628 
1629  int numParticles = path.numBeadsAtSlice(slice);
1630 
1631  /* Initialize the separation histogram */
1632  sepHist = 0;
1633 
1634  /* Calculate the total potential, including external and interaction
1635  * effects*/
1636  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
1637 
1638  /* Get the advanced neightbor of bead1 */
1639  nextBead1 = path.next(bead1);
1640 
1641  for (bead2[1] = bead1[1]+1; bead2[1] < numParticles; bead2[1]++) {
1642  sep = path.getSeparation(bead1,bead2);
1643 
1644  /* Get the advanced neighbor of the second bead */
1645  nextBead2 = path.next(bead2);
1646 
1647  sep2 = path.getSeparation(nextBead1,nextBead2);
1648  totUint += interactionPtr->V(sep,sep2);
1649  } // bead2
1650 
1651  } // bead1
1652  return TinyVector<double,2>(totUext,totUint);
1653 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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