2. Boundary and Ensemble Finite-Size Effects
Statistical mechanics establishes the connection between macroscopic thermodynamic properties and the microscopic components and interactions of a physical system. An interesting example of this relation is provided by the compressibility equation that identifies the density fluctuations of a system in the grand canonical ensemble with the bulk isothermal compressibility
[
27]. In the thermodynamic limit (TL), the isothermal compressibility of a homogeneous system is related to the fluctuations of the number of particles via the expression [
1]:
with
the average number of particles contained in a volume
V of the fluid. The reduced isothermal compressibility
is the ratio between the bulk isothermal compressibility of the system,
, and the isothermal compressibility of the ideal gas
with
.
Various finite-size effects can be included in the block analysis aiming at extrapolating interesting thermodynamic quantities. In practice, let us consider a system of
particles where the simulation box of volume
is divided into subdomains of volume
, as illustrated in
Figure 1. By evaluating the fluctuations of the number of particles in these subdomains, it is possible to obtain the distribution
of the number of particles, with
k-moments given by [
25]:
The second moment of the distribution is related to the reduced isothermal compressibility of the finite system
[
14,
16,
17,
25]:
The finite-size reduced isothermal compressibility,
, can be extrapolated to the reduced isothermal compressibility in the TL,
, taking the limits
. Originally [
17,
25], by applying periodic boundary conditions (PBCs) to the total linear size
and taking into account volumes such that
with
the correlation length of the system, it has been proposed that the difference between
and
is related to boundary effects associated with the finite-size of the subdomains. This difference takes the form [
16,
17]:
with
c a constant. Recently, Equation (
4) has been obtained [
28] using arguments based on the thermodynamics of small systems [
29,
30], underpinning the consistency of the result.
To investigate this expression, we consider a liquid system whose potential energy is described by a 12–6Lennard–Jones potential truncated, with cutoff radius
, and shifted. The parameters
,
and
m, define the units of energy, length and mass, respectively. All the results are expressed in LJ units with time
, temperature
and pressure
. Various system sizes, namely
and
, are considered, and the density is fixed at
, thus defining the linear size of the simulation box
. The systems are equilibrated at
, enforced with a Langevin thermostat with damping coefficient
, for
molecular dynamics (MD) steps using a time step of
. Production runs span
MD steps. All the simulations have been performed with the ESPResSo++ [
32] simulation package.
To use the block analysis method, we compute the fluctuations of the number of particles. In particular, we choose domains of size to scan continuously the fluctuations as a function of domain size. To increase the amount of statistics, we use 100 randomly-positioned subdomains per simulation frame.
In
Figure 2, we report
as a function of
. The linear behavior predicted in Equation (
4) is apparent for
. There are evident deviations from the linear behavior, which are not included in Equation (
4), since this equation has been obtained for a system in the grand canonical ensemble. As a matter of fact, the deviations from linearity are mainly related to the fixed size of the system because when
,
, that is, the fluctuations of the number of particles for a closed system are equal to zero. In principle, the isothermal compressibility in the TL can be extracted by extrapolating a line to the
y-axis, i.e.,
, and determining the
y-intercept. This procedure, however, might lead to ambiguous and strongly-size-dependent results as suggested by the same plot.
From the previous discussion, Equation (
4) satisfactorily describes the boundary size effects present in a system described in the grand canonical ensemble. However, ensemble size effects, i.e., the fact that we are computing quantities defined in the grand canonical ensemble using information obtained from a system in a canonical ensemble, are important even in cases where the size of the system might appear to be enormous (
for
where
).
It is thus clear that the isothermal compressibility of a finite-size system in the TL, i.e.,
with
, should equate to the bulk isothermal compressibility
. An elegant analysis using probabilistic arguments for the ideal gas case [
26,
33] shows that the finite-size reduced isothermal compressibility can be written as:
In spite of the simplicity of the system chosen in this study, it cannot be identified with the ideal gas. However, at very low densities and temperature
, the system behaves more like a real gas, and a meaningful trend could be identified. Therefore, to investigate Equation (
5), we consider the density range
for systems of size
particles. Results are presented in
Figure 3 for the cases
and 0.3. The three datasets follow the theoretical prediction in Equation (
5) with deviations from this behavior for
, thus indicating the signature of boundary finite-size effects. As expected, the data presented also suggest that upon increasing density, the deviations from the ideal gas behavior become more evident, as can be seen in the case
.
This is also seen in
Figure 4, where for a system with density
, the deviations from the ideal gas case are much more evident. As a matter of fact, even for the largest size considered (
=
), it is not possible to convincingly reproduce the ideal gas behavior.
Nonetheless, one intuitively could imagine that the following expression:
captures the two finite-size effects, ensemble and boundary [
25]. By neglecting the
terms, defining
and multiplying everything by
, we obtain:
Equation (
7) is more convenient to analyze because in the limit
, provided that
,
is negligible, and this expression can be approximated to a linear function in
with slope
and
y-intercept equal to
. In particular, we use a simple linear regression in the interval
, with the fluctuations data for
, to find
and
. Results of the scaled fluctuations
minus
are presented in
Figure 5, where the intensive character of the constant
c becomes clear. By replacing the calculated values
and
c in Equation (
7), we obtain the black curve that superimposes on the simulation data in the full range
.
In addition to the explicit finite-size effects discussed above, there is another type of effect related to the periodicity of the simulation box. This is the case of implicit finite-size effects that appear due to anisotropies in the pair correlation function of the system, generated by the use of PBCs [
34,
35]. These effects, extremely important for small simulation setups, appear as oscillations in
for
caused by short range interactions between the system and its nearest neighbor images. However, given the large sizes of the systems considered here, implicit finite-size effects can be safely ignored in the present discussion.
With the trajectories of the system with
particles in the density interval
, we compute the scaled fluctuations
and determine, as before, the ratio
as a function of the density, with
the isothermal compressibility of the ideal gas (see
Figure 6). As expected for this system at
, a monotonically-decreasing behavior is observed since the system becomes less compressible as the density increases.
The isothermal compressibility as a function of the density allows one to investigate more interesting thermodynamic properties, as has been recently demonstrated [
6,
7]. For example, the isothermal compressibility can be written as:
which can be rearranged, in terms of the chemical potential
, as:
with
and
the chemical potential of the system at the reference density
. In practice, one usually is interested in the excess chemical potential (In this context, the word excess should be replaced with residual. The residual chemical potential is the difference between the chemical potential of the target system and that of an ideal gas at the same density, temperature and composition. We misuse the expression excess chemical potential to match the modern literature.):
obtained by subtracting from
the density-dependent part of the chemical potential of the ideal gas.
To validate the results obtained using Equation (
10), it is necessary to use a different computational method to evaluate
. For that purpose, any computational method aiming at calculating chemical potentials could be used. In particular, we use the spatially-resolved thermodynamic integration (SPARTIAN) method [
36], recently implemented by us. In SPARTIAN, the target system, described with atomistic resolution, is embedded in a reservoir of ideal gas particles. An interface between the two subdomains is defined such that molecules are free to diffuse, adapting their resolution on the fly. A uniform density across the simulation box is guaranteed by applying a single-molecule external potential that is identified with the difference in chemical potential between the two resolutions, i.e., the excess chemical potential of the target system. This method has been validated by calculating excess chemical potentials for Lennard–Jones liquids, mixtures, as well as for simple point-charge (SPC) and extended simple point-charge (SPC/E) water models and aqueous sodium chloride solutions, all in good agreement with state-of-the-art computational methods.
For the comparison, we consider the same system at the same temperature with densities
= 0.2, 0.4, 0.6, 0.8 and 1.0. Results for the excess chemical potential as a function of the density are presented in
Figure 7 where the value of
has been used as the reference value. Once
is rescaled, it becomes clear that the agreement between the two methods is remarkable. This result suggests that the simple calculation of the fluctuations of the number of particles, used in combination with Equation (
7), provides us with an efficient and accurate method to compute the chemical potential of simple liquids, which can be extended to more complex fluids [
6].
In this section, Equation (
7) has been introduced in a rather intuitive manner. However, the presented results suggest that it encompasses the relevant finite-size effects of the system and allows one to compute bulk thermodynamic quantities. In the following section, we derive Equation (
7) more rigorously and explore, using a different example, its range of validity.
3. Finite-Size Ornstein–Zernike Integral Equation
Fluctuations of the number of particles are related to the local structure of a liquid. Let us consider a molecular liquid of average density
at temperature
T in equilibrium with a reservoir of particles, i.e., an open system. The fluctuations of the number of molecules are related to the local structure of the liquid via the Ornstein–Zernike integral equation [
1,
37]:
where
are the fluctuations of the number of particles,
and
is the pair correlation function of the open system and
the position vectors of a pair of fluid particles. To solve the integral in Equation (
11), one assumes that the fluid is homogeneous, isotropic and that the system is in the thermodynamic limit (TL), i.e.,
,
with
constant. An infinite, homogeneous and isotropic system is translationally invariant; therefore, we rewrite Equation (
11) as [
1]:
with
,
being the isothermal compressibility of the bulk system. We have replaced
with
the radial distribution function (RDF) of the open system, with
.
An alternative version of the OZ integral equation for finite systems has been introduced [
25]. For a finite system with total volume
with PBCs we have:
where
,
, is the pair correlation function of the closed system with total number of particles
, and
. The fluctuations of the number of particles thus depend on both subdomain and simulation box volumes.
For a single component fluid of density
at temperature
T with fixed number of particles
and volume
, its RDF can be written in terms of an expansion around
as [
23,
24,
25,
26,
33]:
As a matter of fact, the expansion includes terms that depend on the partial derivative of
with respect to the density. However, we anticipate here that for the present analysis, their contribution is negligible [
6]. By replacing
in the integral on the r.h.s of Equation (
13), we obtain:
where:
and we use that
.
Next, we include explicitly the second finite-size effect, i.e., the fact that the volume
V is finite and embedded into a finite volume
with PBCs. For this, we rewrite
as [
17]:
with:
As pointed out by Rovere, Heermann and Binder [
17], the two integrals
and
are equal when
and
are both within the volume
V. When
, the integrand
, and it does not contribute to the integrals. Close to the boundary of the subdomain
V, for
, and in particular when
lies inside and
outside the volume
V, there are contributions missing in
, which are present in
. Therefore, the difference between the two integrals
must be proportional to the surface volume ratio of the subdomain
V [
17], i.e.,
with
,
proportionality constants with units of length that, at this point, we assume to be intensive.
To compute
, we require that
. Since we assume PBCs, the system is translationally invariant. Hence, upon applying the transformation
, the expression:
is obtained, where we assume that
, thus ignoring fluctuations of the RDF beyond the volume
V. By combining these two results, we obtain:
and by including this result in Equation (
15), we arrive at the following expression:
Finally, this expression becomes:
and by defining
, we write:
Equations (
7) and (
22) differ in the
term that appears from considering the boundary finite-size effects. One possible scenario in which this difference might play a role is in the case of simulations near critical conditions where the correlation length of the system tends to infinity.
To test this expression, we perform simulations of systems with potential energy described by the truncated, at
, and shifted 12–6 Lennard–Jones potential. We consider systems with
particles, with densities spanning the range
. Two temperatures were considered,
and
. The critical point of this system has been reported at
and
[
38].
We report the reduced fluctuations
as a function of
for
in
Figure 8. In the case
, the effect of the
term in Equation (
22) is negligible, and a linear approximation in the region
seems to be well justified. However, for the case close to the critical point, i.e.,
, the effect of this term is evident and should be included in the extrapolation to
.
Finally, upon extrapolating to
, an interesting behavior is observed for the bulk isothermal compressibility
as a function of density (
Figure 9). In the case
, as expected, a monotonically-decreasing behavior with increasing density is observed. More interestingly, in the case
, the monotonically-decreasing behavior is interrupted by a singularity in the isothermal compressibility in the vicinity of the critical density. This cusp in the curve is expected since the isothermal compressibility of a fluid at the critical point is infinite.
The use of finite-size integral equations is general enough to admit generalizations of other systems of interest. In the next section, we describe one of such possible extensions: the study of binary mixtures.
4. Mixtures
Kirkwood–Buff (KB) theory [
39] is arguably the most successful framework to investigate the properties of liquid mixtures that relates the local structure of a system to density fluctuations in the grand canonical ensemble. These quantities are in turn related to equilibrium thermodynamic quantities such as the compressibility, the partial molar volumes and the derivatives of the chemical potentials [
2]. Formulated more than sixty years ago, KB enjoys renewed interest in the computational soft-matter and statistical physics communities [
6,
7,
9,
10,
11,
12,
13]. Recent works have shown promising applications related to solvation of biomolecules [
40] and potential uses to compute multicomponent diffusion in liquids [
41] and to study complex phenomena such as self-assembly of proteins [
42] and polymer conformation in complex mixtures [
4,
43].
For a multicomponent fluid of species
in equilibrium at temperature
T, the Kirkwood–Buff integral (KBI) is defined as:
with
the Kronecker delta. The superscript (o) indicates that this definition holds for an open system, i.e., a system in the grand canonical ensemble. In practice, we compute fluctuations of the number of particles in a subdomain of volume
V embedded in a reservoir whose size goes to infinity. Thus,
is the average number of
i-particles inside
V, or
.
is the multicomponent radial distribution function (RDF) of the infinite system, with
.
Let us recall that in computer simulations one considers systems with total fixed number of particles
and volume
with PBCs. In this case, we have [
35]:
The finite-size KBI
is evaluated by computing fluctuations of the number of particles in finite subdomains of volume
V inside a simulation box of volume
. The average number of
i-particles
depends on both subdomain and simulation box volumes. Moreover, the integral on the r.h.s. of Equation (
24) should be evaluated for the RDF of the finite system
with volume
by using a finite integration domain
V.
As has been done for the single component case, we include in this example both, ensemble and boundary, finite-size effects. For the former, the following correction has been suggested [
44]:
based on the asymptotic limit
discussed in [
2]. As expected, when the total volume
, we recover
. By including Equation (
25) in the integral on the r.h.s. of Equation (
24) and evaluating the finite-size integral as for the single component case, we finally obtain:
with
and
an intensive parameter with units of length. In the limit
, the following expression is obtained:
that describes the finite-size effects on the KBIs for a system in the grand canonical ensemble. Consistent with this limiting case in Equation (
26), Equation (
27) has been obtained from the thermodynamics of small systems [
45,
46].
For the investigation of Equation (
26), we perform simulations for binary mixtures
of Lennard–Jones (LJ) fluids. We use a purely repulsive 12-6 LJ potential truncated and shifted with cutoff radius
. The potential parameters are chosen as
, and
,
with
. All the results are expressed in LJ units with energy
, length
, mass
, time
, temperature
and pressure
. As before, simulations are carried out using ESPResSo++ [
32] with a time step of
. Constant temperature
is enforced through a Langevin thermostat with damping coefficient
. The size of the system is
in the range of mole fractions of
A-molecules
. The pressure is fixed at
by adjusting the number density of the system at values around
(or
). We perform equilibration runs of
MD steps and production runs of
MD steps. To compute
, we select 800 frames per trajectory and for each frame identify 1000 randomly-positioned subdomains with linear sizes ranging from
.
In
Figure 10, results for finite-size KBIs are presented for four mole fractions, namely (a)
; (b)
; (c)
and (d)
. Plots of
(green circles) tend to zero when
, as indicated by the horizontal green lines. By contrast,
(indicated by horizontal red lines) when
. The region
, indicated by vertical black lines, is where simple linear regression is used to find
and
. By replacing such values in Equation (
26), we obtained the black curves that, in all cases, superimpose on the simulation data for the full interval
.
The bulk KBIs are related to various thermodynamic quantities. For example, the isothermal compressibility is given by [
39]:
with
the number density of the corresponding species.
Results for the isothermal compressibility obtained from the
values are presented in
Figure 11. Single component cases corresponding to systems composed by only type-
A and type-
B particles are indicated by the horizontal black lines. As expected, the system composed by strongly interacting particles, i.e., the type-
A, has a lower compressibility. The behavior of the isothermal compressibility is nearly ideal since it follows closely the relation
, with
and
, as indicated by the solid black line.
Finally, the extrapolated KBIs have been used to compute the derivative of the chemical potential of type-
A particles with respect to the number density
using the expression [
39]:
that, as has been done for the single component case, can be integrated to obtain [
6]:
This is the chemical potential shifted by a reference chemical potential computed at density
[
4,
43]. By removing the density and concentration terms of the chemical potential of an ideal mixture, the excess chemical potential can be written as:
We compare the results obtained using Equations (
30) and (
31) with the results obtained with the SPARTIAN method [
36] and use the excess chemical potential result from
to find the reference value. We present the results in
Figure 12 where a good agreement between the two datasets is apparent. To conclude this section, it has been shown that the block analysis method constitutes a robust strategy to compute chemical potentials of liquids and mixtures in a wide range of density/concentration conditions.