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

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

#include <action.h>

+ Inheritance diagram for LocalAction:
+ Collaboration diagram for LocalAction:

Public Member Functions

 LocalAction (const Path &, LookupTable &, PotentialBase *, PotentialBase *, WaveFunctionBase *, const TinyVector< double, 2 > &, const TinyVector< double, 2 > &, bool _local=true, string _name="Local", double _endFactor=1.0, int _period=1)
 Setup the path data members and local action factors.
 
virtual ~LocalAction ()
 Empty base 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 barePotentialAction (const beadLocator &)
 Return the bare potential action for a single bead indexed with beadIndex. More...
 
double potentialActionCorrection (const beadLocator &)
 Return the potential action correction for a single bead. More...
 
double potentialActionCorrection (const beadLocator &, const beadLocator &)
 Return the potential action correction for a path. 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 for all links starting on slice. More...
 
double secondderivPotentialActionTau (int)
 The second derivative of the potential action wrt tau on all links starting on slice. More...
 
double derivPotentialActionTau (int, double)
 The derivative of the potential action wrt tau on all links starting on slice within a cutoff radius. More...
 
double derivPotentialActionLambda (int, double)
 The derivative of the potential action wrt lambda for all links starting on slice within a cutoff radius. More...
 
virtual dVec gradPotentialAction (int slice)
 
double rDOTgradUterm1 (int)
 Return the sum over particles at a given time slice of the gradient of the action potential for a single bead dotted into the bead's position. More...
 
double rDOTgradUterm2 (int)
 Return the sum over particles at a given time slice of the gradient of the action potential for a single bead dotted into the bead's position. More...
 
virtual double deltaDOTgradUterm1 (int slice)
 
virtual double deltaDOTgradUterm2 (int slice)
 
virtual double virKinCorr (int slice)
 
virtual TinyVector< double, 2 > potential (int slice)
 
virtual double potential (int slice, double maxR)
 
- 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...
 
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

double V (const beadLocator &)
 Returns the total value of the potential energy, including both the external potential, and that due to interactions for a single bead.
 
double V (const int, const double)
 Returns the total value of the potential energy, including both the external potential, and that due to interactions for all particles in a single time slice within a certain cuttoff radius of the center of a cylinder. More...
 
TinyVector< double, 2 > V (const int)
 Returns the external and interaction potential energy, for all particles on a single time slice. More...
 
double gradVSquared (const beadLocator &)
 Return the gradient of the full potential squared for a single bead. More...
 
double gradVSquared (const int)
 Return the gradient of the full potential squared for all beads at a single time slice. More...
 
double gradVSquared (const int, const double)
 Return the gradient of the full potential squared for all beads at a single time slice restricted inside some cut-off radius. More...
 
double Vnn (const beadLocator &)
 Returns the total value of the potential energy, including both the external potential, and that due to interactions for a single bead with all interactions confined to a single time slice using a nearest neighbor grid lookup table.
 
double Vnn (const int)
 Returns the total value of the potential energy, including both the external potential, and that due to interactions for all particles in a single time slice using a lookup table which only considers particles within a sphere of some cutoff radius.
 
double bareUnn (const beadLocator &, const beadLocator &)
 
double gradVnnSquared (const beadLocator &)
 Return the gradient of the full potential squared for a single bead. More...
 
dVec gradientV (const int)
 Return the gradient of the full potential for all beads at a single time slice. More...
 
dMat tMatrix (const int)
 Returns the T-matrix needed to compute gradU. More...
 
double RdotgradUterm1 (const int)
 
double RdotgradUterm2 (const int)
 
double deltadotgradUterm1 (const int)
 Return the sum over particles at a given time slice of the gradient of the action potential for a single bead dotted into the bead's position minus the center of mass of the WL that it belongs to. More...
 
double deltadotgradUterm2 (const int)
 Return the sum over particles at a given time slice of the gradient of the action potential for a single bead dotted into the bead's position minus the center of mass of the WL that it belongs to. More...
 
double virialKinCorrection (const int)
 Returns the value of the virial kinetic energy correction term. More...
 
dVec gradU (const int)
 Returns the value of the gradient of the potential action for all beads at a given time slice. More...
 
- Protected Member Functions inherited from ActionBase
double tau ()
 The local shifted value of tau.
 
void updateSepHist (const dVec &)
 Update the separation histogram. More...
 

Protected Attributes

int eo
 Is a slice even or odd?
 
TinyVector< double, 2 > VFactor
 The even/odd slice potential factor.
 
TinyVector< double, 2 > gradVFactor
 The even/odd slice correction factor.
 
- 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
 

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.
 

Detailed Description

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

Definition at line 150 of file action.h.

Member Function Documentation

◆ barePotentialAction()

double LocalAction::barePotentialAction ( const beadLocator beadIndex)
virtual

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


This action corresponds to the primitive approximation and may be used when attempting updates that use single slice rejection.

Reimplemented from ActionBase.

Definition at line 352 of file action.cpp.

352  {
353 
354  double bareU = VFactor[beadIndex[0]%2]*tau()*Vnn(beadIndex);
355 
356 #if PIGS
357  /* We tack on a trial wave function and boundary piece if necessary */
358  if ( (beadIndex[0] == 0) || (beadIndex[0]== (constants()->numTimeSlices()-1)) ) {
359  bareU *= 0.5*endFactor;
360  bareU -= log(waveFunctionPtr->PsiTrial(beadIndex[0]));
361  }
362 #endif
363 
364  return bareU;
365 }
WaveFunctionBase * waveFunctionPtr
A pointer to a trial wave function object.
Definition: action.h:119
double endFactor
Mutiplictive factor of the potential action on ends.
Definition: action.h:120
double tau()
The local shifted value of tau.
Definition: action.h:133
TinyVector< double, 2 > VFactor
The even/odd slice potential factor.
Definition: action.h:196
double Vnn(const beadLocator &)
Returns the total value of the potential energy, including both the external potential,...
Definition: action.cpp:680
virtual double PsiTrial(const int)
The Constant Trial Wave Function.
Definition: wavefunction.h:36
ConstantParameters * constants()
Global public access to the constants.
Definition: constants.h:201
+ Here is the call graph for this function:

◆ deltadotgradUterm1()

double LocalAction::deltadotgradUterm1 ( const int  slice)
protected

Return the sum over particles at a given time slice of the gradient of the action potential for a single bead dotted into the bead's position minus the center of mass of the WL that it belongs to.

NOTE: This is the first term. These were split up because it is beneficial to be able to return them separately when computing the specific heat via the centroid virial estimator.

This includes both the external and interaction potentials.

Definition at line 1228 of file action.cpp.

1228  {
1229 
1230  eo = slice % 2;
1231  int numParticles = path.numBeadsAtSlice(slice);
1232  int virialWindow = constants()->virialWindow();
1233 
1234  /* The two interacting particles */
1235  beadLocator bead1, beadNext, beadPrev, beadNextOld, beadPrevOld;
1236  bead1[0] = bead2[0] = slice;
1237 
1238  dVec gVi, gVe, gV, delta;
1239  double rDotgV = 0.0;
1240 
1241  /* We loop over the first bead */
1242  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
1243  gVi = 0.0;
1244  gVe = 0.0;
1245  gV = 0.0;
1246  delta = 0.0;
1247  /* Sum potential of bead1 interacting with all other beads at
1248  * a given time slice.*/
1249  for (bead2[1] = 0; bead2[1] < numParticles; bead2[1]++) {
1250 
1251  /* Avoid self interactions */
1252  if (!all(bead1==bead2)) {
1253 
1254  /* The interaction component of the force */
1255  gVi += interactionPtr->gradV(path.getSeparation(bead1,bead2));
1256  }
1257  } // end bead2
1258 
1259  /* Now add the external component */
1260  gVe += externalPtr->gradV(path(bead1));
1261 
1262  /* Compute deviation of bead from COM of worldline,
1263  * WITHOUT mirror image conv. */
1264  dVec runTotMore = 0.0;
1265  dVec runTotLess = 0.0;
1266  dVec COM = 0.0;
1267  dVec pos1 = path(bead1);
1268  beadNextOld = bead1;
1269  beadPrevOld = bead1;
1270  for (int gamma = 0; gamma < virialWindow; gamma++) {
1271  // move along worldline to next (previous) bead
1272  beadNext = path.next(bead1, gamma);
1273  beadPrev = path.prev(bead1, gamma);
1274  // keep running total of distance from first bead
1275  // to the current beads of interest
1276  runTotMore += path.getSeparation(beadNext, beadNextOld);
1277  runTotLess += path.getSeparation(beadPrev, beadPrevOld);
1278  // update center of mass of WL
1279  COM += (pos1 + runTotMore) + (pos1 + runTotLess);
1280  // store current bead locations
1281  beadNextOld = beadNext;
1282  beadPrevOld = beadPrev;
1283  }
1284  COM /= (2.0*virialWindow);
1285 
1286  delta = pos1 - COM; // end delta computation.
1287  path.boxPtr->putInBC(delta);
1288 
1289  gV += (gVe + gVi);
1290 
1291  rDotgV += dot(gV, delta);
1292 
1293  } // end bead1
1294 
1295  return (VFactor[eo]*constants()->tau()*rDotgV);
1296 }
PotentialBase * interactionPtr
The interaction potential.
Definition: action.h:109
PotentialBase * externalPtr
The external potential.
Definition: action.h:108
const Path & path
A reference to the paths.
Definition: action.h:118
int virialWindow() const
Get centroid virial window size.
Definition: constants.h:55
void putInBC(dVec &r) const
Place a vector in boundary conditions.
Definition: container.h:50
int eo
Is a slice even or odd?
Definition: action.h:194
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
const Container * boxPtr
A constant reference to the container class.
Definition: path.h:43
beadLocator & prev(int slice, int ptcl)
Move one link backward in imaginary time.
Definition: path.h:95
virtual dVec gradV(const dVec &)
The gradient of the potential.
Definition: potential.h:45
TinyVector< int, 2 > beadLocator
time-slice,bead-number world line index
Definition: common.h:117
TinyVector< double, NDIM > dVec
A NDIM-vector of type double.
Definition: common.h:111
+ Here is the call graph for this function:

◆ deltadotgradUterm2()

double LocalAction::deltadotgradUterm2 ( const int  slice)
protected

Return the sum over particles at a given time slice of the gradient of the action potential for a single bead dotted into the bead's position minus the center of mass of the WL that it belongs to.

NOTE: This is the second term

This includes both the external and interaction potentials.

Definition at line 1307 of file action.cpp.

1307  {
1308 
1309  eo = slice % 2;
1310  int numParticles = path.numBeadsAtSlice(slice);
1311  int virialWindow = constants()->virialWindow();
1312 
1313  /* The two interacting particles */
1314  beadLocator bead1, beadNext, beadPrev, beadNextOld, beadPrevOld;
1315  bead1[0] = bead2[0] = slice;
1316 
1317  dVec gVi, gVe, gV, g2V, delta;
1318 
1319  double term2 = 0.0;
1320  if (gradVFactor[eo] > EPS){
1321 
1322  /* constants for tMatrix */
1323  dVec rDiff = 0.0;
1324  double rmag = 0.0;
1325  double d2V = 0.0;
1326  double dV = 0.0;
1327  double dVe = 0.0;
1328  double dVi = 0.0;
1329  double g2Vi = 0.0;
1330  double g2Ve = 0.0;
1331 
1332  /* We loop over the first bead */
1333  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
1334  gV = 0.0;
1335  g2V = 0.0;
1336  delta = 0.0;
1337  dMat tMat = 0.0; // tMat(row, col)
1338  dVec gVdotT = 0.0;
1339 
1340  /* compute external potential derivatives */
1341  gVe = externalPtr->gradV(path(bead1));
1342  dVe = sqrt(dot(gVe,gVe));
1343  g2Ve = externalPtr->grad2V(path(bead1));
1344 
1345  gV += gVe; // update full slice gradient at bead1
1346 
1347  /* Sum potential of bead1 interacting with all other beads at
1348  * a given time slice.*/
1349  for (bead2[1] = 0; bead2[1] < numParticles; bead2[1]++) {
1350 
1351  /* separation vector */
1352  rDiff = path.getSeparation(bead1, bead2);
1353  rmag = sqrt(dot(rDiff,rDiff));
1354 
1355  /* Avoid self interactions */
1356  if (!all(bead1==bead2)) {
1357 
1358  /* Compute interaction potential derivatives */
1359  gVi = interactionPtr->gradV(rDiff);
1360  dVi = sqrt(dot(gVi,gVi));
1361  g2Vi = interactionPtr->grad2V(rDiff);
1362 
1363  /* total derivatives between bead1 and bead2 at bead1 */
1364  dV = dVi + dVe;
1365  d2V = g2Vi + g2Ve;
1366 
1367  /* compute the T-matrix for bead1 interacting with bead2 */
1368  for (int a=0; a<NDIM; a++){
1369  for (int b=0; b<NDIM; b++){
1370  tMat(a,b) += rDiff(a)*rDiff(b)*d2V/(rmag*rmag)
1371  - rDiff(a)*rDiff(b)*dV/pow(rmag,3);
1372  if (a == b)
1373  tMat(a,b) += dV/rmag;
1374  }
1375  } // end T-matrix
1376 
1377  gV += gVi; // update full slice gradient at bead1
1378 
1379  }
1380  } // end bead2
1381 
1382  /* blitz++ product function seems broken in my current
1383  * version, so this performs matrix-vector mult.
1384  * Checked --MTG */
1385  for(int j=0; j<NDIM; j++){
1386  for(int i=0; i<NDIM; i++){
1387  gVdotT(j) += gV(i)*tMat(j,i);
1388  }
1389  }
1390 
1391  /* Compute deviation of bead from COM of worldline,
1392  * WITHOUT mirror image conv.*/
1393  dVec runTotMore = 0.0;
1394  dVec runTotLess = 0.0;
1395  dVec COM = 0.0;
1396  dVec pos1 = path(bead1);
1397  beadNextOld = bead1;
1398  beadPrevOld = bead1;
1399  for (int gamma = 0; gamma < virialWindow; gamma++) {
1400  // move along worldline to next (previous) bead
1401  beadNext = path.next(bead1, gamma);
1402  beadPrev = path.prev(bead1, gamma);
1403  // keep running total of distance from first bead
1404  // to the current beads of interest
1405  runTotMore += path.getSeparation(beadNext, beadNextOld);
1406  runTotLess += path.getSeparation(beadPrev, beadPrevOld);
1407  // update center of mass of WL
1408  COM += (pos1 + runTotMore) + (pos1 + runTotLess);
1409  // store current bead locations
1410  beadNextOld = beadNext;
1411  beadPrevOld = beadPrev;
1412  }
1413  COM /= (2.0*virialWindow);
1414  delta = pos1 - COM; // end delta computation.
1415 
1416  path.boxPtr->putInBC(delta);
1417 
1418  term2 += dot(gVdotT, delta);
1419 
1420  } // end bead1
1421 
1422  term2 *= (2.0 * gradVFactor[eo] * pow(tau(),3) * constants()->lambda());
1423  }
1424 
1425  return (term2);
1426 }
double lambda() const
Get lambda = hbar^2/(2mk_B)
Definition: constants.h:46
TinyVector< double, 2 > gradVFactor
The even/odd slice correction factor.
Definition: action.h:197
virtual double grad2V(const dVec &)
Grad^2 of the potential.
Definition: potential.h:48
#define NDIM
Number of spatial dimnsions.
Definition: common.h:71
TinyMatrix< double, NDIM, NDIM > dMat
A NDIM x NDIM matrix of type double.
Definition: common.h:108
#define EPS
A small number.
Definition: common.h:94
+ Here is the call graph for this function:

◆ derivPotentialActionLambda() [1/2]

double LocalAction::derivPotentialActionLambda ( int  slice)
virtual

The derivative of the potential action wrt lambda for 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 469 of file action.cpp.

469  {
470  eo = (slice % 2);
471 
472  /* As long as thers is a finite correction, we include it */
473  if ( gradVFactor[eo] > EPS )
474  return gradVFactor[eo] * tau() * tau() * tau() * gradVSquared(slice);
475  else
476  return 0.0;
477 }
double gradVSquared(const beadLocator &)
Return the gradient of the full potential squared for a single bead.
Definition: action.cpp:762
+ Here is the call graph for this function:

◆ derivPotentialActionLambda() [2/2]

double LocalAction::derivPotentialActionLambda ( int  slice,
double  maxR 
)
virtual

The derivative of the potential action wrt lambda for all links starting on slice within a cutoff radius.

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
maxRthe cutoff radius

Reimplemented from ActionBase.

Definition at line 515 of file action.cpp.

515  {
516  eo = (slice % 2);
517 
518  /* As long as there is a finite correction, we include it */
519  if ( gradVFactor[eo] > EPS )
520  return gradVFactor[eo] * tau() * tau() * tau() * gradVSquared(slice,maxR);
521  else
522  return 0.0;
523 }
+ Here is the call graph for this function:

◆ derivPotentialActionTau() [1/2]

double LocalAction::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 422 of file action.cpp.

422  {
423 
424  double dU = 0.0;
425  eo = (slice % 2);
426 
427  /* We first compute the base potential action piece */
428  dU = VFactor[eo]*sum(V(slice));
429 
430  /* As long as there is a finite correction, we include it */
431  if ( gradVFactor[eo] > EPS )
432  dU += 3.0 * gradVFactor[eo] * tau() * tau() * constants()->lambda()
433  * gradVSquared(slice);
434  return (dU);
435 
436 }
double V(const beadLocator &)
Returns the total value of the potential energy, including both the external potential,...
Definition: action.cpp:529
+ Here is the call graph for this function:

◆ derivPotentialActionTau() [2/2]

double LocalAction::derivPotentialActionTau ( int  slice,
double  maxR 
)
virtual

The derivative of the potential action wrt tau on all links starting on slice within a cutoff radius.

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
maxRthe cutoff radius

Reimplemented from ActionBase.

Definition at line 489 of file action.cpp.

489  {
490 
491  double dU = 0.0;
492  eo = (slice % 2);
493 
494  /* We first compute the base potential action piece */
495  dU = VFactor[eo]*V(slice,maxR);
496 
497  /* As long as there is a finite correction, we include it */
498  if ( gradVFactor[eo] > EPS )
499  dU += 3.0 * gradVFactor[eo] * tau() * tau() * constants()->lambda()
500  * gradVSquared(slice,maxR);
501  return (dU);
502 
503 }
+ Here is the call graph for this function:

◆ gradientV()

dVec LocalAction::gradientV ( const int  slice)
protected

Return the gradient of the full potential for all beads at a single time slice.

This includes both the external and interaction potentials.

Definition at line 978 of file action.cpp.

978  {
979 
980  int numParticles = path.numBeadsAtSlice(slice);
981 
982  /* The two interacting particles */
983  beadLocator bead1;
984  bead1[0] = bead2[0] = slice;
985 
986  dVec gV; // The 'force'
987 
988  /* We loop over the first bead */
989  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
990  gV = 0.0;
991  /* Sum up potential for all other active beads in the system */
992  for (bead2[1] = 0; bead2[1] < numParticles; bead2[1]++) {
993 
994  /* Avoid self interactions */
995  if (!all(bead1==bead2)) {
996 
997  /* The interaction component of the force */
998  gV += interactionPtr->gradV(path.getSeparation(bead1,bead2));
999  }
1000  } // end bead2
1001 
1002  /* Now add the external component */
1003  gV += externalPtr->gradV(path(bead1));
1004  } // end bead1
1005 
1006  return gV;
1007 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gradU()

dVec LocalAction::gradU ( const int  slice)
protected

Returns the value of the gradient of the potential action for all beads at a given time slice.

This should be used for the pressure.

Definition at line 1458 of file action.cpp.

1458  {
1459 
1460  dVec gU2 = 0.0;
1461  dMat tM = tMatrix(slice);
1462  dVec gV = gradientV(slice);
1463 
1464  /* Combine the potential and a possible correction */
1465  eo = (slice % 2);
1466  dVec gU1 = VFactor[eo]*tau()*gradientV(slice);
1467 
1468  /* We only add the correction if it is finite */
1469  if ( gradVFactor[eo] > EPS ) {
1470  /* blitz++ product function seems broken in my current
1471  * version, so this performs matrix-vector mult. */
1472  for(int j=0; j<NDIM; j++){
1473  for(int i=0; i<NDIM; i++){
1474  gU2(i) += gV(j)*tM(i,j);
1475  }
1476  }
1477  /* now scale by constants */
1478  gU2 *= 2.0 * gradVFactor[eo] * pow(tau(),3) * constants()->lambda();
1479  }
1480 
1481  return ( gU1+gU2 );
1482 }
dMat tMatrix(const int)
Returns the T-matrix needed to compute gradU.
Definition: action.cpp:1015
dVec gradientV(const int)
Return the gradient of the full potential for all beads at a single time slice.
Definition: action.cpp:978
+ Here is the call graph for this function:

◆ gradVnnSquared()

double LocalAction::gradVnnSquared ( const beadLocator bead1)
protected

Return the gradient of the full potential squared for a single bead.


This includes both the external and interaction potentials using the nearest neighbor lookup table.

Definition at line 915 of file action.cpp.

915  {
916 
917  /* This should always be called after Vnn, such that the lookup table
918  * interaction list has been updated!!! */
919 
920  double totF2 = 0.0; // The total force squared
921 
922  if (path.worm.beadOn(bead1)) {
923 
924  /* The 'forces' and particle separation */
925  dVec Fext1,Fext2;
926  dVec Fint1,Fint2,Fint3;
927 
928  /* Get the gradient squared part for the external potential*/
929  Fext1 = externalPtr->gradV(path(bead1));
930 
931  /* We first loop over bead2's interacting with bead1 via the nn lookup table */
932  Fint1 = 0.0;
933  for (int n = 0; n < lookup.numBeads; n++) {
934  bead2 = lookup.beadList(n);
935 
936  /* Eliminate self and null interactions */
937  if ( !all(bead1 == bead2) ) {
938 
939  /* Get the separation between beads 1 and 2 and compute the terms in the
940  * gradient squared */
941  sep = lookup.beadSep(n);
942  Fint2 = interactionPtr->gradV(sep);
943  Fint1 -= Fint2;
944  Fext2 = externalPtr->gradV(path(bead2));
945 
946  /* We now loop over bead3, this is the time-intensive part of the calculation */
947  Fint3 = 0.0;
948  for (int m = 0; m < lookup.numBeads; m++) {
949  bead3 = lookup.beadList(m);
950 
951  /* Eliminate self-interactions */
952  if ( !all(bead3==bead2) && !all(bead3==bead1) ) {
953  sep = path.getSeparation(bead2,bead3);
954  Fint3 += interactionPtr->gradV(sep);
955  }
956 
957  } // end bead3
958 
959  totF2 += dot(Fint2,Fint2) + 2.0*dot(Fext2,Fint2) + 2.0*dot(Fint2,Fint3);
960 
961  } // bead2 != bead1
962 
963  } // end bead2
964 
965  totF2 += dot(Fext1,Fext1) + 2.0 * dot(Fext1,Fint1) + dot(Fint1,Fint1);
966 
967  } // bead1 on
968 
969  return totF2;
970 }
LookupTable & lookup
We need a non-constant reference for updates.
Definition: action.h:117
Array< beadLocator, 1 > beadList
The cutoff dynamic list of interacting beads.
Definition: lookuptable.h:40
Array< dVec, 1 > beadSep
The separation between beads.
Definition: lookuptable.h:42
int numBeads
The cutoff number of active beads in beadList;.
Definition: lookuptable.h:43
Worm worm
Details on the worm.
Definition: path.h:44
int beadOn(int, int) const
Safely get a bead (int indexed)
Definition: worm.h:148
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gradVSquared() [1/3]

double LocalAction::gradVSquared ( const beadLocator bead1)
protected

Return the gradient of the full potential squared for a single bead.

This includes both the external and interaction potentials.

Definition at line 762 of file action.cpp.

762  {
763 
764  double totF2 = 0.0; // The total force squared
765 
766  if (path.worm.beadOn(bead1)) {
767 
768  /* All interacting beads are on the same slice. */
769  bead2[0] = bead3[0] = bead1[0];
770 
771  /* The 'forces' and particle separation */
772  dVec Fext1,Fext2;
773  dVec Fint1,Fint2,Fint3;
774 
775  int numParticles = path.numBeadsAtSlice(bead1[0]);
776 
777  /* Get the gradient squared part for the external potential*/
778  Fext1 = externalPtr->gradV(path(bead1));
779 
780  /* We loop through all beads and compute the forces between beads
781  * 1 and 2 */
782  Fint1 = 0.0;
783  for (bead2[1] = 0; bead2[1] < numParticles; bead2[1]++) {
784 
785  if (!all(bead1==bead2)) {
786 
787  sep = path.getSeparation(bead2,bead1);
788  Fint2 = interactionPtr->gradV(sep);
789  Fint1 -= Fint2;
790  Fext2 = externalPtr->gradV(path(bead2));
791 
792  /* There is a single term that depends on this additional interaction
793  * between beads 2 and 3. This is where all the time is taken */
794  Fint3 = 0.0;
795  for (bead3[1] = 0; bead3[1] < numParticles; bead3[1]++) {
796  if ( !all(bead3==bead2) && !all(bead3==bead1) ) {
797  sep = path.getSeparation(bead2,bead3);
798  Fint3 += interactionPtr->gradV(sep);
799  }
800  } // for bead3
801 
802  totF2 += dot(Fint2,Fint2) + 2.0*dot(Fext2,Fint2) + 2.0*dot(Fint2,Fint3);
803 
804  } //bead1 != bead2
805 
806  } // for bead2
807 
808  totF2 += dot(Fext1,Fext1) + 2.0 * dot(Fext1,Fint1) + dot(Fint1,Fint1);
809 
810  } // bead1 On
811 
812  return totF2;
813 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gradVSquared() [2/3]

double LocalAction::gradVSquared ( const int  slice)
protected

Return the gradient of the full potential squared for all beads at a single time slice.

This includes both the external and interaction potentials.

Definition at line 821 of file action.cpp.

821  {
822 
823  double totF2 = 0.0;
824 
825  int numParticles = path.numBeadsAtSlice(slice);
826 
827  /* The two interacting particles */
828  beadLocator bead1;
829  bead1[0] = bead2[0] = slice;
830 
831  dVec F; // The 'force'
832 
833  /* We loop over the first bead */
834  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
835 
836  F = 0.0;
837  /* Sum up potential for all other active beads in the system */
838  for (bead2[1] = 0; bead2[1] < numParticles; bead2[1]++) {
839 
840  /* Avoid self interactions */
841  if (!all(bead1==bead2)) {
842 
843  /* The interaction component of the force */
844  F += interactionPtr->gradV(path.getSeparation(bead1,bead2));
845  }
846 
847  } // end bead2
848 
849  /* Now add the external component */
850  F += externalPtr->gradV(path(bead1));
851 
852  totF2 += dot(F,F);
853  } // end bead1
854 
855  return totF2;
856 }
+ Here is the call graph for this function:

◆ gradVSquared() [3/3]

double LocalAction::gradVSquared ( const int  slice,
const double  maxR 
)
protected

Return the gradient of the full potential squared for all beads at a single time slice restricted inside some cut-off radius.

This includes both the external and interaction potentials.

Definition at line 864 of file action.cpp.

864  {
865 
866  double totF2 = 0.0;
867 
868  int numParticles = path.numBeadsAtSlice(slice);
869 
870  /* The two interacting particles */
871  beadLocator bead1;
872  bead1[0] = bead2[0] = slice;
873  dVec r1;
874  double r1sq;
875 
876  dVec F; // The 'force'
877 
878  /* We loop over the first bead */
879  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
880 
881  r1 = path(bead1);
882  r1sq = 0.0;
883  for (int i = 0; i < NDIM-1; i++)
884  r1sq += r1[i]*r1[i];
885 
886  if (r1sq < maxR*maxR) {
887 
888  F = 0.0;
889  /* Sum up potential for all other active beads in the system */
890  for (bead2[1] = 0; bead2[1] < numParticles; bead2[1]++) {
891  /* Avoid self interactions */
892  if (!all(bead1==bead2)) {
893 
894  /* The interaction component of the force */
895  F += interactionPtr->gradV(path.getSeparation(bead1,bead2));
896  }
897  } // end bead2
898 
899  /* Now add the external component */
900  F += externalPtr->gradV(path(bead1));
901 
902  totF2 += dot(F,F);
903  } // maxR
904  } // end bead1
905 
906  return totF2;
907 }
+ Here is the call graph for this function:

◆ potentialAction() [1/2]

double LocalAction::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.

!!NB!! It is important to use V and gradVSquared here, as this is used for debugging purposes with check move and must match up with the single bead calculation.

Reimplemented from ActionBase.

Definition at line 289 of file action.cpp.

289  {
290 
291  double totU = 0.0;
292 
293  /* Combine the potential and a possible correction */
294  for (int slice = 0; slice < path.numTimeSlices; slice++) {
295  eo = (slice % 2);
296  totU += VFactor[eo]*tau()*sum(V(slice));
297 
298  /* We only add the correction if it is finite */
299  if ( gradVFactor[eo] > EPS )
300  totU += gradVFactor[eo] * tau() * tau() * tau() * constants()->lambda()
301  * gradVSquared(slice);
302  }
303 
304  return ( totU );
305 }
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 LocalAction::potentialAction ( const beadLocator beadIndex)
virtual

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


We have to use the beadIndex form of gradVSquared here to ensure that bead indexed action changes are equal to total potential action changes. We use a pre-processor directive to determine whether or not to use the nearest neighbor lookup table.

!!NB!! If we are using checkMove to debug moves you MUST always include the correction term.

Parameters
beadIndexthe bead that we are computing the potential action for

Reimplemented from ActionBase.

Definition at line 320 of file action.cpp.

320  {
321 
322  double bareU = 0.0;
323  double corU = 0.0;
324  eo = (beadIndex[0] % 2);
325 
326  /* We first compute the base potential action piece */
327  bareU = VFactor[eo]*tau()*Vnn(beadIndex);
328 
329  /* If we have a finite correction and are not at the base level
330  * of bisection (shift=1) we compute the full correction */
331  if ( (shift == 1) && (gradVFactor[eo] > EPS) )
332  corU = gradVFactor[eo] * tau() * tau() * tau() * constants()->lambda()
333  * gradVnnSquared(beadIndex);
334 
335 #if PIGS
336  /* We tack on a trial wave function and boundary piece if necessary */
337  if ( (beadIndex[0] == 0) || (beadIndex[0] == (constants()->numTimeSlices()-1)) ) {
338  bareU *= 0.5*endFactor;
339  bareU -= log(waveFunctionPtr->PsiTrial(beadIndex[0]));
340  }
341 #endif
342 
343  return (bareU + corU);
344 }
int shift
The scaling factor for tau.
Definition: action.h:122
double gradVnnSquared(const beadLocator &)
Return the gradient of the full potential squared for a single bead.
Definition: action.cpp:915
+ Here is the call graph for this function:

◆ potentialActionCorrection() [1/2]

double LocalAction::potentialActionCorrection ( const beadLocator beadIndex)
virtual

Return the potential action correction for a single bead.

Provided that the correction is small, we return its value.

Reimplemented from ActionBase.

Definition at line 372 of file action.cpp.

372  {
373 
374  eo = (beadIndex[0] % 2);
375  /* If we have a finite correction */
376  if (gradVFactor[eo] > EPS) {
377 
378  /* We need to update the lookup table here */
379  lookup.updateInteractionList(path,beadIndex);
380 
381  /* Compute the correction */
382  return (gradVFactor[eo] * tau() * tau() * tau() * constants()->lambda()
383  * gradVnnSquared(beadIndex));
384  }
385  else
386  return 0.0;
387 
388 }
void updateInteractionList(const Path &, const beadLocator &)
Update the NN lookup table and the array of beadLocators containing all beads which 'interact' with t...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ potentialActionCorrection() [2/2]

double LocalAction::potentialActionCorrection ( const beadLocator startBead,
const beadLocator endBead 
)
virtual

Return the potential action correction for a path.

Given a starting and ending bead, compute the potential action correction for the path.

Parameters
startBeadthe starting bead
endBeadthe end bead on the path

Reimplemented from ActionBase.

Definition at line 399 of file action.cpp.

400  {
401 
402  double corU = 0.0;
403  beadLocator beadIndex;
404  beadIndex = startBead;
405  do {
406  corU += potentialActionCorrection(beadIndex);
407  beadIndex = path.next(beadIndex);
408  } while (!all(beadIndex==path.next(endBead)));
409 
410  return corU;
411 }
double potentialActionCorrection(const beadLocator &)
Return the potential action correction for a single bead.
Definition: action.cpp:372
+ Here is the call graph for this function:

◆ rDOTgradUterm1()

double LocalAction::rDOTgradUterm1 ( int  slice)
virtual

Return the sum over particles at a given time slice of the gradient of the action potential for a single bead dotted into the bead's position.

Used for regular virial energy and thermodynamic pressure.

NOTE: This is the first term. These were split up because it is beneficial to be able to return them separately when computing the specific heat via the centroid virial estimator.

This includes both the external and interaction potentials.

Reimplemented from ActionBase.

Definition at line 1079 of file action.cpp.

1079  {
1080 
1081  eo = slice % 2;
1082  int numParticles = path.numBeadsAtSlice(slice);
1083 
1084  /* The two interacting particles */
1085  beadLocator bead1;
1086  bead1[0] = bead2[0] = slice;
1087 
1088  dVec gVi, gV;
1089  double rDotgV = 0.0;
1090 
1091  /* We loop over the first bead */
1092  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
1093  gVi = 0.0;
1094  /* Sum potential of bead1 interacting with all other beads at
1095  * a given time slice.*/
1096  for (bead2[1] = 0; bead2[1] < numParticles; bead2[1]++) {
1097 
1098  /* Avoid self interactions */
1099  if (!all(bead1==bead2)) {
1100 
1101  /* The interaction component of the force */
1102  gVi += interactionPtr->gradV(path.getSeparation(bead1,bead2));
1103  }
1104  } // end bead2
1105 
1106  /* Now add the external component */
1107  gV = (externalPtr->gradV(path(bead1)) + gVi);
1108 
1109  rDotgV += dot(gV, path(bead1));
1110 
1111  } // end bead1
1112 
1113  return (VFactor[eo]*constants()->tau()*rDotgV);
1114 }
+ Here is the call graph for this function:

◆ rDOTgradUterm2()

double LocalAction::rDOTgradUterm2 ( int  slice)
virtual

Return the sum over particles at a given time slice of the gradient of the action potential for a single bead dotted into the bead's position.

Used for regular virial energy and thermodynamic pressure.

NOTE: This is the second term

This includes both the external and interaction potentials.

Reimplemented from ActionBase.

Definition at line 1126 of file action.cpp.

1126  {
1127 
1128  eo = slice % 2;
1129  int numParticles = path.numBeadsAtSlice(slice);
1130 
1131  /* The two interacting particles */
1132  beadLocator bead1;
1133  bead1[0] = bead2[0] = slice;
1134 
1135  dVec gVi, gVe, gV, g2V;
1136 
1137  double term2 = 0.0;
1138  if (gradVFactor[eo] > EPS){
1139 
1140  /* constants for tMatrix */
1141  dVec rDiff = 0.0;
1142  double rmag = 0.0;
1143  double d2V = 0.0;
1144  double dV = 0.0;
1145  double dVe = 0.0;
1146  double dVi = 0.0;
1147  double g2Vi = 0.0;
1148  double g2Ve = 0.0;
1149 
1150  /* We loop over the first bead */
1151  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
1152  gV = 0.0;
1153  g2V = 0.0;
1154  dMat tMat = 0.0; // tMat(row, col)
1155  dVec gVdotT = 0.0;
1156 
1157  /* compute external potential derivatives */
1158  gVe = externalPtr->gradV(path(bead1));
1159  dVe = sqrt(dot(gVe,gVe));
1160  g2Ve = externalPtr->grad2V(path(bead1));
1161 
1162  gV += gVe; // update full slice gradient at bead1
1163 
1164  /* Sum potential of bead1 interacting with all other beads at
1165  * a given time slice.*/
1166  for (bead2[1] = 0; bead2[1] < numParticles; bead2[1]++) {
1167 
1168  /* separation vector */
1169  rDiff = path.getSeparation(bead1, bead2);
1170  rmag = sqrt(dot(rDiff,rDiff));
1171 
1172  /* Avoid self interactions */
1173  if (!all(bead1==bead2)) {
1174 
1175  /* Compute interaction potential derivatives */
1176  gVi = interactionPtr->gradV(rDiff);
1177  dVi = sqrt(dot(gVi,gVi));
1178  g2Vi = interactionPtr->grad2V(rDiff);
1179 
1180  /* total derivatives between bead1 and bead2 at bead1 */
1181  dV = dVi + dVe;
1182  d2V = g2Vi + g2Ve;
1183 
1184  /* compute the T-matrix for bead1 interacting with bead2 */
1185  for (int a=0; a<NDIM; a++){
1186  for (int b=0; b<NDIM; b++){
1187  tMat(a,b) += rDiff(a)*rDiff(b)*d2V/(rmag*rmag)
1188  - rDiff(a)*rDiff(b)*dV/pow(rmag,3);
1189  if (a == b)
1190  tMat(a,b) += dV/rmag;
1191  }
1192  } // end T-matrix
1193 
1194  gV += gVi; // update full slice gradient at bead1
1195 
1196  }
1197  } // end bead2
1198 
1199  /* blitz++ product function seems broken in my current
1200  * version, so this performs matrix-vector mult.
1201  * Checked --MTG */
1202  for(int j=0; j<NDIM; j++){
1203  for(int i=0; i<NDIM; i++){
1204  gVdotT(j) += gV(i)*tMat(j,i);
1205  }
1206  }
1207  term2 += dot(gVdotT, path(bead1));
1208 
1209  } // end bead1
1210 
1211  term2 *= (2.0 * gradVFactor[eo] * pow(tau(),3) * constants()->lambda());
1212  }
1213 
1214  return (term2);
1215 }
+ Here is the call graph for this function:

◆ secondderivPotentialActionTau()

double LocalAction::secondderivPotentialActionTau ( int  slice)
virtual

The second 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 447 of file action.cpp.

447  {
448 
449  double d2U = 0.0;
450  eo = (slice % 2);
451 
452  /* As long as there is a finite correction, we include it */
453  if ( gradVFactor[eo] > EPS )
454  d2U += 6.0 * gradVFactor[eo] * tau() * constants()->lambda()
455  * gradVSquared(slice);
456  return (d2U);
457 
458 }
+ Here is the call graph for this function:

◆ tMatrix()

dMat LocalAction::tMatrix ( const int  slice)
protected

Returns the T-matrix needed to compute gradU.

This is used for the virial energy estimator in the TI or GSF action. CURRENTLY ONLY RETURNS VALUES FOR INTERACTIONS, NOT EXTERNAL.

Definition at line 1015 of file action.cpp.

1015  {
1016 
1017  int numParticles = path.numBeadsAtSlice(slice);
1018 
1019  dMat tMat = 0.0; // tMat(row, col)
1020 
1021  dVec rDiff = 0.0;
1022  double rmag = 0.0;
1023  double d2V = 0.0;
1024  double dV = 0.0;
1025 
1026  /* two interacting particles */
1027  beadLocator bead1;
1028  bead1[0] = bead2[0] = slice;
1029 
1030  for (int a=0; a<NDIM; a++){
1031  for (int b=0; b<NDIM; b++){
1032 
1033  /* loop over first bead */
1034  for (bead1[1]=0; bead1[1]<numParticles; bead1[1]++){
1035 
1036  /* loop over all other beads */
1037  for (bead2[1]=0; bead2[1]<numParticles; bead2[1]++){
1038 
1039  /* avoid self-interactions */
1040  if (!all(bead1==bead2)) {
1041 
1042  rDiff = path.getSeparation(bead1, bead2);
1043  rmag = sqrt(dot(rDiff,rDiff));
1044  d2V = interactionPtr->grad2V(rDiff);
1045  d2V += externalPtr->grad2V(path(bead1));
1046  dV = sqrt(dot(interactionPtr->gradV(rDiff)
1047  ,interactionPtr->gradV(rDiff)));
1048  dV += sqrt(dot(externalPtr->gradV(path(bead1))
1049  ,externalPtr->gradV(path(bead1))));
1050 
1051  tMat(a,b) += rDiff(a)*rDiff(b)*d2V/(rmag*rmag);
1052  if (a != b)
1053  tMat(a,b) -= (rDiff(a)*rDiff(b)/pow(rmag,3))*dV;
1054  else
1055  tMat(a,b) += (1.0/rmag - rDiff(a)*rDiff(b)/pow(rmag,3))*dV;
1056  }
1057  } // end bead2
1058  } // end bead1
1059  }
1060  }
1061 
1062  tMat /= 2.0; // don't want to double count interactions
1063 
1064  return ( tMat );
1065 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ V() [1/2]

TinyVector< double, 2 > LocalAction::V ( const int  slice)
protected

Returns the external and interaction potential energy, for all particles on a single time slice.


This is really only used for either debugging or during the calculation of the potential energy. As such, we update the separation histogram here.

Definition at line 573 of file action.cpp.

573  {
574 
575  double totVint = 0.0;
576  double totVext = 0.0;
577 
578  beadLocator bead1;
579  bead1[0] = bead2[0] = slice;
580 
581  int numParticles = path.numBeadsAtSlice(slice);
582 
583  /* Initialize the separation histogram */
584  sepHist = 0;
585 
586  /* Calculate the total potential, including external and interaction
587  * effects*/
588  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
589 
590  /* Get the state of bead 1 */
591  beadState state1 = path.worm.getState(bead1);
592 
593  /* Evaluate the external potential */
594  totVext += path.worm.factor(state1)*externalPtr->V(path(bead1));
595 
596  /* The loop over all other particles, to find the total interaction
597  * potential */
598  for (bead2[1] = bead1[1]+1; bead2[1] < numParticles; bead2[1]++) {
599  sep = path.getSeparation(bead2,bead1);
600  updateSepHist(sep);
601  totVint += path.worm.factor(state1,bead2) * interactionPtr->V(sep);
602  } // bead2
603 
604  } // bead1
605 
606  /* Separate the external and interaction parts */
607  return TinyVector<double,2>(totVext,totVint);
608 }
Array< int, 1 > sepHist
A histogram of separations.
Definition: action.h:111
void updateSepHist(const dVec &)
Update the separation histogram.
Definition: action.cpp:71
virtual double V(const dVec &)
The potential.
Definition: potential.h:39
beadState getState(const beadLocator &) const
Get the state of the supplied bead?
Definition: worm.h:110
double factor(const beadState, const beadLocator &) const
Compute the value of the potential action trajectory factor.
Definition: worm.cpp:109
beadState
Each bead can have three possible states.
Definition: common.h:129
+ Here is the call graph for this function:

◆ V() [2/2]

double LocalAction::V ( const int  slice,
const double  maxR 
)
protected

Returns the total value of the potential energy, including both the external potential, and that due to interactions for all particles in a single time slice within a certain cuttoff radius of the center of a cylinder.


This is really only used for either debugging or during the calculation of the potential energy. As such, we update the separation histogram here.

Definition at line 619 of file action.cpp.

619  {
620 
621  double totVint = 0.0;
622  double totVext = 0.0;
623  dVec r1,r2;
624 
625  double r1sq,r2sq;
626 
627  beadLocator bead1;
628  bead1[0] = bead2[0] = slice;
629 
630  int numParticles = path.numBeadsAtSlice(slice);
631 
632  /* Initialize the separation histogram */
633  cylSepHist = 0;
634 
635  /* Calculate the total potential, including external and interaction
636  * effects*/
637  for (bead1[1] = 0; bead1[1] < numParticles; bead1[1]++) {
638 
639  r1 = path(bead1);
640 
641  r1sq = 0.0;
642  for (int i = 0; i < NDIM-1; i++)
643  r1sq += r1[i]*r1[i];
644 
645  if (r1sq < maxR*maxR) {
646 
647  /* Evaluate the external potential */
648  totVext += externalPtr->V(path(bead1));
649 
650  /* The loop over all other particles, to find the total interaction
651  * potential */
652  for (bead2[1] = bead1[1]+1; bead2[1] < numParticles; bead2[1]++) {
653  r2 = path(bead2);
654 
655  r2sq = 0.0;
656  for (int i = 0; i < NDIM-1; i++)
657  r2sq += r2[i]*r2[i];
658 
659  sep = path.getSeparation(bead2,bead1);
660  if (r2sq < maxR*maxR) {
661  int nR = int(abs(sep[2])/dSep);
662  if (nR < NPCFSEP)
663  ++cylSepHist(nR);
664  }
665  totVint += interactionPtr->V(sep);
666  } // bead2
667 
668  } // maxR
669  } // bead1
670 
671  return ( totVext + totVint );
672 }
Array< int, 1 > cylSepHist
A histogram of separations for a cylinder.
Definition: action.h:112
#define NPCFSEP
Spatial separations to be used in the pair correlation function.
Definition: common.h:90
+ Here is the call graph for this function:

◆ virialKinCorrection()

double LocalAction::virialKinCorrection ( const int  slice)
protected

Returns the value of the virial kinetic energy correction term.

See also
S. Jang, S. Jang and G.A. Voth, J. Chem. Phys. 115, 7832 (2001).

Definition at line 1433 of file action.cpp.

1433  {
1434 
1435  double vKC = 0.0;
1436 
1437  /* Combine the potential and a possible correction */
1438  eo = (slice % 2);
1439 
1440  /* We only add the correction if it is finite */
1441  if ( gradVFactor[eo] > EPS ) {
1442 
1443  vKC += gradVSquared(slice);
1444 
1445  /* scale by constants */
1446  vKC *= gradVFactor[eo] * pow(tau(),3) * constants()->lambda();
1447  }
1448 
1449  return ( vKC );
1450 }
+ Here is the call graph for this function:

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