We develop an algorithm based on the method proposed by Dickman for directly measuring pressure in lattice-gas models. The algorithm gives the possibility to access the equation of state with a single run by adding multiple ghost sites to the original system. This feature considerably improves calculations and makes the algorithm particularly efficient for systems with inhomogeneous density profiles, both in equilibrium and nonequilibrium steady states. We illustrate its broad applicability by considering some paradigmatic systems of statistical mechanics such as the lattice gas under gravity, nearest-neighbor exclusion models in finite dimension and on regular random graphs, and the boundary-driven simple symmetric exclusion process.

Pressure is a key thermodynamic parameter encoding the phase behavior of macroscopic systems in thermal equilibrium.1 As first realized by Tammann long ago,2,3 for systems with many degrees of freedom, the pressure behavior may not be as a simple as a mechanical interpretation would suggest. This is essentially due to the entropic contribution coming from the integral (or the sum) over the whole configuration space, which is at the root of several unusual and counter-intuitive phenomena, such as inverse melting.4–6 There is also a fundamental interest in extending the notion of pressure to active matter, a crucial step toward the formulation of a nonequilibrium statistical mechanics.7 It is therefore of paramount importance to rely on flexible and viable algorithms that are capable of measuring the pressure directly, with no reference to a special state as in the standard thermodynamic integration method. This is all the more true for (athermal) lattice systems where Monte Carlo algorithms are far less developed than their molecular dynamics counterpart.8,9 Previously proposed methods generally sacrifice the usual periodic boundary as they involve hard walls and volume fluctuations due to the removal or addition of a layer next to the wall.10 We consider here an elegant proposed some time ago by Dickman in the context of lattice polymers,11,12 which bears a strong resemblance with the ghost particle insertion trick suggested by Widom for computing the chemical potential.13 The Dickman method consists of three simple yet important observations. First, for a lattice gas with volume V and Helmholtz free energy F, the pressure P = −∂F/∂V is written as

P=limΔV0kBTΔVlnZ(V+ΔV)Z(V),
(1)

where Z is the canonical partition function. Then, one observes that the partition function of a system with volume V is equivalent to that of a modified system with volume V + ΔV in which one has added an infinite repulsive potential acting on the sites contained in ΔV (preventing particles from entering ΔV). Thus, if we introduce a repulsive potential of finite magnitude Uλ = −kBT ln λ acting on the sites in ΔV (in such a way that λ = 0 corresponds to U = ∞, and λ = 1 corresponds to U = 0) and denote with Zλ the partition function of this modified system, we get Z(V) ≡ Z0(V + ΔV) and Z(V + ΔV) ≡ Z1(V + ΔV), whence the partition function ratio in Eq. (1) becomes

lnZ1(V+ΔV)Z0(V+ΔV)=01dλlnZλλ.
(2)

To transform this into something useful for the design of a Monte Carlo algorithm, one finally needs to remark that the partition function Zλ for the modified system can be written as

Zλ(V+ΔV)=ΔN=0ΔVλΔNΩ(N,ΔN),
(3)

where the summation is taken over the possible configurations of ΔN particles in ΔV and Ω is the total number of configurations with ΔN particles in ΔV and N + ΔN in V + ΔV. Thus, the average number ⟨ΔN⟩ of particles in ΔV can be obtained as

ΔN=λlnZλλ.
(4)

This leads to the desired expression for the pressure

P=limΔV0kBTΔV01ΔNdλλ.
(5)

The practical implementation of Eq. (5) in a Monte Carlo algorithm obviously requires the interval of λ values be discretized and numerical simulations carried out for different finite values of the repulsive potential. In addition, the sites of ΔV on which the potential acts needs to be finite. To the best of our knowledge, this is typically chosen to be as small as 1, and the single pressure-probe site is generally embedded in a wall of codimension 1 confining the system from one side. In this form, it has been observed that the algorithm becomes problematic in the presence of a strong external bias, as in a lattice gas under gravity.14 When dealing with pressures as tiny as those generated by the Casimir effect in a nonequilibrium driven system,15 the algorithm may require excessively long execution times, which is all the more troublesome for cooperative driven dynamics. Moreover, a naive extension of the algorithm allowing probing the pressure at different locations, simultaneously, leads to unreliable results in nonequilibrium conditions.

We show in this paper that these drawbacks can be actually overcome and that an efficient formulation of the algorithm can be consistently applied to a variety of physical situations of growing complexity, from a simple sedimentation problem to fluctuation-induced forces in a driven diffusive system. First of all, one should notice that some care is required when dealing with systems in which ⟨ΔN⟩ ≈ ΔV. In these cases, there exists a limitation on the maximum value of pressure Pmax that can be measured, as Eq. (4) diverges for λ → 0, while Pmax ≈ −log λmin, (where λmin is the minimum value of the λ discretization). Evidently, to correctly quantify the pressure when ⟨ΔN⟩ ≈ ΔV, one has to choose a suitable value of λmin. Second, it is important to emphasize that the presence of a confining wall is not a necessary ingredient for computing pressure in a Monte Carlo simulation. If for some reason the spatial translational invariance of system geometry and interactions has to be preserved, one can use periodic boundary conditions (unless, of course, one is interested in the wall effects, as in wetting phenomena, for example). Third, the size of ΔV can be relatively large, ΔV ≫ 1, provided that it is sub-extensive, ΔVV. This improves data statistics and becomes particularly relevant when the system under study displays an inhomogeneous density profile. In this case, multiple pressure probes distributed uniformly over the whole system can give access to the entire pressure profile with a single simulation run. Finally, once the wall is suppressed, it is important to specify how the (ghost) sites of ΔV are added to the original system. We do so by adding an extra nearest neighboring site to a certain number, ΔV, of sites of the original system. In this way, the local geometric structure of the original system is preserved, and its intrinsic dynamics will be only weakly perturbed by the presence of these extra ghost sites (for a schematic representation, see Fig. 1). This point is particularly important as statistical mechanical models of interest generally involve static or dynamic spatially extended interactions.

FIG. 1.

Example of a portion of the auxiliary system used for measuring pressure. A two-dimensional lattice of V = 5 × 5 sites (represented as blue colored balls) is augmented by two extra ghost sites (gray colored balls, ΔV = 2), which act as local pressure probes. Every ghost site increases by one the number of nearest neighbors of the lattice site to which it is linked (by a dashed line in the figure) and is subjected to a repulsive potential Uλ = −kBT ln λ, but it does not participate to the nearest neighbor interactions of the lattice site to which it is linked. No wall is needed, and boundary conditions can be periodic in any direction.

FIG. 1.

Example of a portion of the auxiliary system used for measuring pressure. A two-dimensional lattice of V = 5 × 5 sites (represented as blue colored balls) is augmented by two extra ghost sites (gray colored balls, ΔV = 2), which act as local pressure probes. Every ghost site increases by one the number of nearest neighbors of the lattice site to which it is linked (by a dashed line in the figure) and is subjected to a repulsive potential Uλ = −kBT ln λ, but it does not participate to the nearest neighbor interactions of the lattice site to which it is linked. No wall is needed, and boundary conditions can be periodic in any direction.

Close modal

In the following, the above points are implemented and carefully examined in systems for which the pressure has a purely entropic content, i.e., athermal systems. Comparison with theory is made whenever analytical results are partially or fully available. Monte Carlo simulations are carried out in the grand canonical ensemble, in which the system of volume V (or one of its parts) is coupled to a reservoir R at chemical potential μ = log[ρR/(1 − ρR)], where ρR is the reservoir density. Unless otherwise mentioned, the pressure-probe ghost sites are equally spaced in both the transverse and longitudinal directions of the system. At every Monte Carlo time step, a lattice bond in the coupled system (ΔV + V + R) is randomly selected, and depending on the pair of sites involved, one of the three possibilities is considered: hole-particle exchange within the volume V, hole-particle exchange between V and the reservoir R, and hole-particle exchange between V and the ghost volume ΔV. It is important to emphasize that the dynamics of the particle reservoir R is not explicitly simulated. Rather, every time the randomly selected bond involves a site of R, its occupation state is randomly established by extracting a number with probability ρR. The results we present were obtained by using the cutoff λmin = 0.001 and discretizing λ ∈ [0, 1] into 24 values equally spaced over three contiguous subintervals [0.01, 0.04], [0.04, 0.2], and [0.2, 1], with steps Δλ = 0.01, 0.02, and 0.1, respectively. Compared to a simple uniform discretization of [0, 1], this makes the numerical evaluation of Eq. (5) more effective because the contribution of smaller values of λ, which give a large contribution to the integral, is better weighted.

To begin with, we discuss what is perhaps the simplest equilibrium system with a non-trivial inhomogeneous density profile, the hard-core lattice gas under gravity. This provides a natural test bed for the algorithm as the system thermodynamics is simple enough to allow for a detailed comparison with the exactly known results. For a system of height htop enclosed on the bottom and with the top in contact with a reservoir at density ρtop, the pressure at height h is given by

P(h)=kBTlog1ρ(h),
(6)

where ρ(h) is the density profile defined as

ρ(h)=1+1ρtopρtopexpmgkBT(hhtop)1,
(7)

with mg being the gravity force. A further advantage of this problem is that the average number ⟨ΔN⟩ of particles in ΔV, Eq. (4), can be computed easily,14 

ΔN(h)=ΔVλρ(h)1ρ(h)+λρ(h),
(8)

providing a further detailed check of the algorithm. In the Monte Carlo, simulation we assume that the boundary condition in the direction transverse to the gravity force is periodic and the ghost sites are uniformly distributed along the system diagonal. The square lattice is tilted by 45°, and particle hopping is ruled by the standard Metropolis transition probability, p = min{1, exp(−βmgΔh)}, where Δh = ±1 is the height difference due to a single hop. In Fig. 2, we show the results for the density profile P(h) for two different values of the gravity force, when the system top is kept in contact with a particle reservoir at density ρtop = 0.01. As we can see, the analytic results are perfectly recovered.16 In this form, the algorithm can be applied to more complex lattice models of colloidal sedimentation and granular compaction, like those of Refs. 17 and 18.

FIG. 2.

Pressure p and particle density ρ vs height h in a tilted lattice gas under gravity. The system height is htop = 64 and base 64. The system top is in contact with a particle reservoir at density ρtop = 0.01. Periodic boundary condition is in the direction normal to the gravity force. Full lines are the expected analytic results from Eqs. (6) and (7).

FIG. 2.

Pressure p and particle density ρ vs height h in a tilted lattice gas under gravity. The system height is htop = 64 and base 64. The system top is in contact with a particle reservoir at density ρtop = 0.01. Periodic boundary condition is in the direction normal to the gravity force. Full lines are the expected analytic results from Eqs. (6) and (7).

Close modal

Next, we turn to a more interesting system of interacting particles, that is, the lattice gas with nearest neighbor exclusion, where particles are forbidden to occupy the same or neighboring sites. This model has a long tradition in the study of critical phenomena as a schematic lattice model of hard-sphere fluids and is closely related to the classical NP-hard combinatorial optimization problem of finding a minimum vertex cover on a random graph.19 Numerical and theoretical studies for various finite dimensional lattices20–27 have shown that there exists a critical density ρc (for a square lattice ρc = 0.367 74 …) at which the model exhibits a continuous phase transition to an ordered state with exponents that belong to the Ising universality class.25 Above ρc, particles tend to occupy preferentially one of the two sublattices in which the original lattice can be decomposed (in such a way that the nearest-neighbors of any sites of one sublattice belong to the other sublattice and vice-versa). The ground state, therefore, corresponds to a fully occupied sublattice, and the maximum packing density is ρmax = 1/2. In Fig. 3, we show the parametric plot of the equation of state P(ρ) obtained in a grand-canonical simulation by slowly increasing the chemical potential. In agreement with the well-established numerical and theoretical results, the equation of state displays an inflection point, corresponding to a divergent compressibility, near the critical density at which sublattice ordering occurs. The full line below the critical density is a one-parameter fit obtained from the approach in Ref. 27, while the full line at higher densities is the non-interacting entropic pressure −log(1 − ρ/ρmax) near the closest packing density ρmax = 1/2.

FIG. 3.

Parametric plot of the equation of state, pressure P = P(μ) vs particle density ρ = ρ(μ), in a square lattice gas with nearest-neighbor exclusion. Full periodic boundary condition, system size V = 322, and ghost sites ΔV = 32 located along the main diagonal of the lattice. The vertical dotted segment represents the analytic value of the critical density ρc = 0.367 74. The full line below the critical density is a one-parameter fit obtained from the approach in Ref. 27. The full line at high-density is the non-interacting entropic pressure −log(1 − ρ/ρmax) near the maximum packing density ρmax = 1/2.

FIG. 3.

Parametric plot of the equation of state, pressure P = P(μ) vs particle density ρ = ρ(μ), in a square lattice gas with nearest-neighbor exclusion. Full periodic boundary condition, system size V = 322, and ghost sites ΔV = 32 located along the main diagonal of the lattice. The vertical dotted segment represents the analytic value of the critical density ρc = 0.367 74. The full line below the critical density is a one-parameter fit obtained from the approach in Ref. 27. The full line at high-density is the non-interacting entropic pressure −log(1 − ρ/ρmax) near the maximum packing density ρmax = 1/2.

Close modal

The previously considered model can be interestingly generalized to situations in which every particle cannot have more than particles as nearest neighbors (thus, the nearest neighbor exclusion models is recovered for = 0). This class of models was introduced in the attempt of providing a microscopic finite-dimensional realization of the thermodynamic scenario for the elusive glass transition.28 Subsequent works have shown that in finite dimension, a freezing transition toward an ordered ground state occurs.30,31 However, some more sophisticated variants appear to be quite stable against crystallization and display properties of fragile glass-forming liquids.32,33 For the purpose of testing the present algorithm in a geometric structure other than the usual Euclidean lattices, we focus here on the monodisperse lattice glass model on the Bethe lattice. This is also known as the regular random graph, which is a locally tree-like geometric structure with a fixed connectivity k + 1, and with long loops of order ln N. This latter feature, an analog of generic boundary conditions, prevents unphysical surface effects and gives rise to frustration precluding crystalline orderings. The resulting glassy behavior can be studied analytically with the tools of disordered systems theory28,29 and has been extended to the quantum domain as well.34 In Fig. 4, we show a parametric plot of the equation of state obtained in a grand canonical Monte Carlo simulation for the Bethe lattice glass (with connectivity k + 1 mimicking the square and cubic lattice) for two values of . Consistent with the analytical calculation,28 no sign of crystallization is observed in the equation of state and, for large chemical potential, the pressure tends to diverge at a density very near the closest packing limit, μ → ∞, obtained with the cavity method of disordered systems theory.29 

FIG. 4.

Bethe lattice glass. Equation of state, pressure P = P(μ) vs particle density ρ = ρ(μ), in a parametric form, for a lattice gas on a regular random graph with connectivity k + 1 and geometric constraint on particle occupation (every particle cannot have more than particles as nearest neighbors). System size V = 210 and ghost volume ΔV = 25 randomly located on the graph. Data points are the results of a Monte Carlo simulation in the grand canonical ensemble in which the system is annealed by slowly increasing the chemical potential (starting from an empty system). Vertical lines correspond to the analytical values of the closest packing density obtained in Ref. 29.

FIG. 4.

Bethe lattice glass. Equation of state, pressure P = P(μ) vs particle density ρ = ρ(μ), in a parametric form, for a lattice gas on a regular random graph with connectivity k + 1 and geometric constraint on particle occupation (every particle cannot have more than particles as nearest neighbors). System size V = 210 and ghost volume ΔV = 25 randomly located on the graph. Data points are the results of a Monte Carlo simulation in the grand canonical ensemble in which the system is annealed by slowly increasing the chemical potential (starting from an empty system). Vertical lines correspond to the analytical values of the closest packing density obtained in Ref. 29.

Close modal

As a final more stringent test of the present algorithm, we now consider a two-dimensional system driven into a nonequilibrium steady state by two reservoirs at different densities, ρ0 and ρ1, located at its edges x = 0 and x = L, respectively. For such driven diffusive systems, it is known that there exists long-range correlations,35 even for purely hard-core interactions.36 A striking consequence is the appearance of Casimir-like forces in a finite geometry.15 To the leading order in ρ1ρ0 and for a simple symmetric exclusion process37 on a square lattice of size L × d, this fluctuation-induced pressure, Π(x), is given by15 

Π(x)=12Ldρ1ρ01ρ(x)2xL1xL,
(9)

where ρ(x) = ρ0 + (ρ1ρ0)x/L is the system density profile, and we set kBT = 1. For the lattice system with only infinite hard-core repulsion, the thermodynamic limit of the average density of particle, ⟨ρΔV⟩, in the ghost volume ΔV is exactly known, see Eq. (8). This means that the Casimir pressure, ΠMC(x), in a Monte Carlo simulation with a finite ΔV can be measured as

ΠMC(x)01ρΔVλρ(x)1ρ(x)+λρ(x)dλλ,
(10)

where it is understood that the integral has to be properly discretized. In Fig. 5, we compare the Monte Carlo results for ΠMC(x) at reservoirs densities ρ0 = 0.1 and ρ1 = 0.7 and different system sizes, with the theoretical result for Π(x), Eq. (9), in the rescaled form Π̃(x)=LdΠ(x). Data points of each curve were simultaneously obtained for a dynamical evolution long 109 Monte Carlo sweeps and averaged over a sample of 10–20 elements (statistical errors are not visible because of the order of symbol size). The agreement is excellent and fully confirms the efficiency and functionality of our algorithm.

FIG. 5.

Fluctuation-induced pressure profile Π̃(x)=LdΠ(x) in the simple symmetric exclusion process on a square lattice of size d × L. The system edges at x = 0 and x = L are in contact with boundary reservoirs at density ρ0 = 0.1 and ρ1 = 0.7, respectively. There is a periodic boundary condition in the direction transverse to the particle current, and the number of ghost sites is ΔV = 2d (so that ΔV/V = 2/L). Red line refers to Eq. (9).

FIG. 5.

Fluctuation-induced pressure profile Π̃(x)=LdΠ(x) in the simple symmetric exclusion process on a square lattice of size d × L. The system edges at x = 0 and x = L are in contact with boundary reservoirs at density ρ0 = 0.1 and ρ1 = 0.7, respectively. There is a periodic boundary condition in the direction transverse to the particle current, and the number of ghost sites is ΔV = 2d (so that ΔV/V = 2/L). Red line refers to Eq. (9).

Close modal

In conclusion, we have developed an algorithm based on the Dickman method which can considerably improve the accuracy of Monte Carlo calculations of pressure in lattice models, and is especially suited for systems with inhomogeneous density profiles, both in equilibrium and nonequilibrium steady states. The algorithm is quite general and holds the key to many other statistical mechanics applications.

I gratefully acknowledge Daniel Martin and José Luis Iguain for valuable suggestions in the early stage of this work. I also thank Avi Aminov, Jef Arenzon, and Yariv Kafri for kindly clarifying some aspects of their work.15,27 Numerical simulations were performed by using ICTP computer facilities.

The data that support the findings of this study are available from the corresponding author upon reasonable request.

1.
H. B.
Callen
,
Thermodynamics and an Introduction to Thermostatistics
(
J. Wiley & Sons
,
New York
,
1985
).
2.
G.
Tammann
,
Kristallisieren und Schmelzen
(
Johann Ambrosius Barth
,
Leipzig
,
1903
), pp.
26
46
.
3.
A. L.
Greer
,
Nature
404
,
134
(
2000
).
4.
S.
Rastogi
,
G. W. H.
Höhne
, and
A.
Keller
,
Macromolecules
32
,
8897
(
1999
).
5.
F. H.
Stillinger
and
P. G.
Debenedetti
,
Biophys. Chem.
105
,
211
(
2003
).
6.
N.
Schupper
and
N. M.
Shnerb
,
Phys. Rev. E
72
,
046107
(
2005
).
7.
A. P.
Solon
,
Y.
Fily
,
A.
Baskaran
,
M. E.
Cates
,
Y.
Kafri
,
M.
Kardar
, and
J.
Tailleur
,
Nat. Phys.
11
,
673
(
2015
).
8.
D.
Frenkel
and
B.
Smit
,
Understanding Molecular Simulation: From Algorithms to Applications
(
Elsevier
,
2001
).
9.
W.
Krauth
,
Statistical Mechanics: Algorithms and Computations
(
Oxford University Press
,
Oxford
,
2006
).
10.
P.
Pendzig
,
W.
Dieterich
, and
A.
Nitzan
,
J. Chem. Phys.
106
,
3703
(
1997
).
11.
R.
Dickman
,
J. Chem. Phys.
87
,
2246
(
1987
).
12.
For a review, see
R.
Dickman
, in
Numerical Methods for Polymeric Systems
, edited by
S. G.
Whittington
(
Springer
,
New York
,
1998
).
13.
B.
Widom
,
J. Chem. Phys.
39
,
2808
(
1963
).
14.
D. C.
Hong
and
K.
McGouldrick
,
Physica A
255
,
415
(
1998
).
15.
A.
Aminov
,
Y.
Kafri
, and
M.
Kardar
,
Phys. Rev. Lett.
114
,
230602
(
2015
).
16.

Notice that for values of βmg larger that those we used the bottom layers become densely occupied, ⟨ΔN⟩ ≈ ΔV, and pressure is correctly measured only if a suitable value of λmin is properly chosen.

17.
Y.
Levin
,
J. J.
Arenzon
, and
M.
Sellitto
,
Europhys. Lett.
55
,
767
773
(
2001
).
18.
J. J.
Arenzon
,
Y.
Levin
, and
M.
Sellitto
,
Physica A
325
,
371
(
2003
).
19.
M.
Hartmann
and
M.
Weigt
,
Phase Transitions in Combinatorial Optimization Problems
(
Wiley
,
New Jersey
,
2006
).
20.
D. S.
Gaunt
and
M. E.
Fisher
,
J. Chem. Phys.
43
,
2840
(
1965
).
21.
F. H.
Ree
and
D. A.
Chesnut
,
J. Chem. Phys.
45
,
3983
(
1966
).
22.
L. K.
Runnels
and
L. L.
Combs
,
J. Chem. Phys.
45
,
2482
(
1966
).
23.
D. S.
Gaunt
and
M. E.
Fisher
,
J. Chem. Phys.
46
,
3237
(
1967
).
24.
R. J.
Baxter
,
I. G.
Enting
, and
S. K.
Tsang
,
J. Stat. Phys.
22
,
465
(
1980
).
25.
W.
Guo
and
H. W. J.
Blöte
,
Phys. Rev. E
66
,
046140
(
2002
).
26.
H. C. M.
Fernandes
,
J. J.
Arenzon
, and
Y.
Levin
,
J. Chem. Phys.
126
,
114508
(
2007
).
27.
H. C. M.
Fernandes
,
Y.
Levin
, and
J. J.
Arenzon
,
Phys. Rev. E
75
,
052101
(
2007
).
28.
G.
Biroli
and
M.
Mézard
,
Phys. Rev. Lett.
88
,
025501
(
2001
).
29.
O.
Rivoire
,
G.
Biroli
,
O. C.
Martin
, and
M.
Mézard
,
Eur. Phys. J. B
37
,
55
(
2004
).
30.
K. A.
Dawson
,
S.
Franz
, and
M.
Sellitto
,
Europhys. Lett.
64
,
302
(
2003
).
31.
E.
Marinari
and
V.
Van Kerrebroeck
,
Europhys. Lett.
73
,
383
(
2005
).
32.
R. K.
Darst
,
D. R.
Reichman
, and
G.
Biroli
,
J. Chem. Phys.
132
,
044510
(
2010
).
33.
Y.
Nishikawa
and
K.
Hukushima
, arXiv:2003.02872v2 (
2020
).
34.
L.
Foini
,
G.
Semerjian
, and
F.
Zamponi
,
Phys. Rev. B
83
,
094513
(
2011
).
35.
For a review, see
J. R.
Dorfman
,
T. R.
Kirkpatrick
, and
J. V.
Sengers
,
Annu. Rev. Phys. Chem.
45
,
213
(
1994
).
36.
H.
Spohn
,
J. Phys. A
16
,
4275
(
1983
).
37.
For a review, see
B.
Derrida
,
J. Stat. Mech.
2007
,
P07023
.