Path Integral Quantum Monte Carlo
Public Member Functions | Data Fields | Protected Member Functions
PotentialBase Class Reference

The base class from which all specific potentials are derived from. More...

#include <potential.h>

+ Inheritance diagram for PotentialBase:

Public Member Functions

 PotentialBase ()
 Constructor.
 
virtual ~PotentialBase ()
 Destructor.
 
virtual double V (const dVec &)
 The potential.
 
virtual double V (const dVec &, const dVec &)
 The effective potential for the pair product approximation.
 
virtual dVec gradV (const dVec &)
 The gradient of the potential.
 
virtual double grad2V (const dVec &)
 Grad^2 of the potential.
 
virtual double dVdlambda (const dVec &, const dVec &)
 The derivative of the effective potential with respect to lambda and tau.
 
virtual double dVdtau (const dVec &, const dVec &)
 
virtual Array< dVec, 1 > initialConfig (const Container *, MTRand &, const int)
 Default Initial configuration of particles. More...
 
void output (const double)
 A debug method that output's the potential to a supplied separation. More...
 
virtual Array< double, 1 > getExcLen ()
 Array to hold data elements. More...
 

Data Fields

double tailV
 Tail correction factor.
 

Protected Member Functions

double deltaSeparation (double sep1, double sep2) const
 Return the minimum image difference for 1D separations.
 

Detailed Description

The base class from which all specific potentials are derived from.

This class contains methods which return the actual value of the potential, an effective potential related to the pair product approximation, one which returns the gradient of the potential and a final one which generates a sensible initial particle configuration. We require knowledge of both the interaction as well as external potential to run the simulation.

Definition at line 32 of file potential.h.

Member Function Documentation

◆ getExcLen()

Array< double, 1 > PotentialBase::getExcLen ( )
virtual

Array to hold data elements.

Initialize getExcLen method.


This is only used for Gasparini potential, could probably be better.

Reimplemented in Gasparini_1_Potential.

Definition at line 135 of file potential.cpp.

135  {
136  /* The particle configuration */
137  Array<double,1> excLens(0);
138  return excLens;
139 }

◆ initialConfig()

Array< dVec, 1 > PotentialBase::initialConfig ( const Container boxPtr,
MTRand &  random,
const int  numParticles 
)
virtual

Default Initial configuration of particles.

Return an initial particle configuration.

The default version creates a list of particle positions in an equally spaced grid.

Reimplemented in GrapheneLUT3DPotential, GrapheneLUTPotential, GraphenePotential, Gasparini_1_Potential, FixedAzizPotential, LJHourGlassPotential, LJCylinderPotential, PlatedLJCylinderPotential, and HarmonicPotential.

Definition at line 41 of file potential.cpp.

42  {
43 
44  /* The particle configuration */
45  Array<dVec,1> initialPos(numParticles);
46  initialPos = 0.0;
47 
48  /* Get the linear size per particle, and the number of particles */
49  double initSide = pow((1.0*numParticles/boxPtr->volume),-1.0/(1.0*NDIM));
50 
51  /* We determine the number of initial grid boxes there are in
52  * in each dimension and compute their size */
53  int totNumGridBoxes = 1;
54  iVec numNNGrid;
55  dVec sizeNNGrid;
56 
57  for (int i = 0; i < NDIM; i++) {
58  numNNGrid[i] = static_cast<int>(ceil((boxPtr->side[i] / initSide) - EPS));
59 
60  /* Make sure we have at least one grid box */
61  if (numNNGrid[i] < 1)
62  numNNGrid[i] = 1;
63 
64  /* Compute the actual size of the grid */
65  sizeNNGrid[i] = boxPtr->side[i] / (1.0 * numNNGrid[i]);
66 
67  /* Determine the total number of grid boxes */
68  totNumGridBoxes *= numNNGrid[i];
69  }
70 
71  /* Now, we place the particles at the middle of each box */
72  PIMC_ASSERT(totNumGridBoxes>=numParticles);
73  dVec pos;
74  for (int n = 0; n < totNumGridBoxes; n++) {
75 
76  iVec gridIndex;
77  for (int i = 0; i < NDIM; i++) {
78  int scale = 1;
79  for (int j = i+1; j < NDIM; j++)
80  scale *= numNNGrid[j];
81  gridIndex[i] = (n/scale) % numNNGrid[i];
82  }
83 
84  for (int i = 0; i < NDIM; i++)
85  pos[i] = (gridIndex[i]+0.5)*sizeNNGrid[i] - 0.5*boxPtr->side[i];
86 
87  boxPtr->putInside(pos);
88 
89  if (n < numParticles)
90  initialPos(n) = pos;
91  else
92  break;
93  }
94 
95  return initialPos;
96 }
double volume
The volume of the container in A^3.
Definition: container.h:35
virtual void putInside(dVec &) const =0
Place a vector inside the simulation cell.
dVec side
The linear dimensions of the box.
Definition: container.h:31
#define NDIM
Number of spatial dimnsions.
Definition: common.h:71
#define EPS
A small number.
Definition: common.h:94
TinyVector< double, NDIM > dVec
A NDIM-vector of type double.
Definition: common.h:111
#define PIMC_ASSERT(X)
Rename assert method.
Definition: common.h:64
TinyVector< int, NDIM > iVec
A NDIM-vector of type integer.
Definition: common.h:114
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ output()

void PotentialBase::output ( const double  maxSep)

A debug method that output's the potential to a supplied separation.

Ouptut the potential.

For use during comparison and debugging, we output the potential out to a supplied separation.

Parameters
maxSepthe maximum separation

Definition at line 106 of file potential.cpp.

106  {
107  dVec sep;
108  sep = 0.0;
109  for (double d = 0; d < maxSep; d+= (maxSep/1.0E6)) {
110  sep[0] = d;
111  communicate()->file("debug")->stream()
112  << format("%16.12E\t%16.12E\n") % d % V(sep);
113  }
114 }
File * file(string type)
Get method returning file object.
Definition: communicator.h:85
virtual double V(const dVec &)
The potential.
Definition: potential.h:39
Communicator * communicate()
Global public access to the communcator singleton.
Definition: communicator.h:121
+ Here is the call graph for this function:

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