Content uploaded by Jadran Vrabec

Author content

All content in this area was uploaded by Jadran Vrabec on Oct 21, 2017

Content may be subject to copyright.

ms2: A molecular simulation tool for thermodynamic properties, new version

release

Colin W. Glassa, Steffen Reiserb, G´abor Rutkaic, Stephan Deubleinb, Andreas K¨osterc, Gabriela

Guevara-Carrionc, Amer Wafaia, Martin Horschb, Martin Bernreuthera, Thorsten Windmannc, Hans Hasseb,

Jadran Vrabec c,∗

aH¨ochstleistungsrechenzentrum Universit¨at Stuttgart (HLRS), 70550 Stuttgart, Germany

bLehrstuhl f¨ur Thermodynamik, Universit¨at Kaiserslautern, 67653 Kaiserslautern, Germany

cLehrstuhl f¨ur Thermodynamik und Energietechnik, Universit¨at Paderborn, 33098 Paderborn, Germany

Abstract

A new version release (2.0) of the molecular simulation tool ms2 [S. Deublein et al., Comput. Phys. Commun.

182 (2011) 2350] is presented. Version 2.0 of ms2 features a hybrid parallelization based on MPI and OpenMP

for molecular dynamics simulation to achieve higher scalability. Furthermore, the formalism by Lustig [R.

Lustig, Mol. Phys. 110 (2012) 3041] is implemented, allowing for a systematic sampling of Massieu potential

derivatives in a single simulation run. Moreover, the Green-Kubo formalism is extended for the sampling of the

electric conductivity and the residence time. To remove the restriction of the preceding version to electro-neutral

molecules, Ewald summation is implemented to consider ionic long range interactions. Finally, the sampling of

the radial distribution function is added.

Keywords: Molecular simulation, molecular dynamics, Monte Carlo, vapor-liquid equilibrium, transport

properties, Massieu potential derivatives

1. Program summary

Manuscript: ms2: A molecular simulation tool for thermodynamic properties

Authors:

Colin W. Glass, Steffen Reiser, G´abor Rutkai, Stephan Deublein, Bernhard Eckl, J¨urgen Stoll, Sergey V.

Lishchuk, Andreas K¨oster, Gabriela Guevara-Carrion, Amer Wafai, Martin Horsch, Thorsten Merker, Martin

Bernreuther, Thorsten Windmann, Hans Hasse, Jadran Vrabec (jadran.vrabec@upb.de)

Title of program: ms2

Operating system: Unix/Linux

Computer: The simulation program ms2is usable on a wide variety of platforms, from single processor machines

to modern supercomputers.

∗Corresponding author: Jadran Vrabec, Warburger Str. 100, 33098 Paderborn, Germany, Tel.: +49-5251/60-2421, Fax: +49-5251/60-

3522, Email: jadran.vrabec@upb.de

Preprint submitted to Elsevier July 23, 2017

Memory: ms2runs on single cores with 512 MB RAM. The memory demand rises with increasing number of

cores used per node and increasing number of molecules.

Distribution format: tar.gz

Keywords: Molecular simulation, molecular dynamics, Monte Carlo, vapor-liquid equilibrium, transport proper-

ties, Massieu potential derivatives

Programming language: Fortran90

External: Message passing interface (MPI)

Classiﬁcation: 7.7, 7.9, 12

Has the code been vectorized or parallelized: Yes: Message Passing Interface (MPI) protocol and OpenMP

Scalability is up to 2000 cores.

Nature of problem: Calculation of application oriented thermodynamic properties for ﬂuids consisting of rigid

molecules: vapor-liquid equilibria of pure ﬂuids and multi-component mixtures, thermal and caloric data as well

as transport properties.

Method of solution: Molecular dynamics, Monte Carlo, various classical ensembles, grand equilibrium method,

Green-Kubo formalism, Lustig formalism.

Restrictions: None. The system size is user-deﬁned. Typical problems addressed by ms2can be solved by

simulating systems containing typically 1’000 – 4’000 molecules.

Unusual Features: Auxiliary feature tools are available for creating input ﬁles, analyzing simulation results and

visualizing molecular trajectories.

Additional comments: Sample makeﬁles for multiple operation platforms are provided.

Documentation: Documentation is provided with the installation package and is available at

http://www.ms- 2.de.

Typical running time: The running time of ms2 depends on the speciﬁed problem, the system size and the

number of processes used in the simulation. E.g. running four processes on a ”Nehalem” processor, simulations

calculating vapor-liquid equilibrium data take between two and 12 hours, calculating transport properties between

six and 24 hours. Note that the examples given above stand for the total running time as there is no post-

processing of any kind involved in property calculations.

Catalogue identiﬁer of previous version: AEJF v1 0

Journal Reference of previous version: Comput. Phys. Commun. 182 (2011) 2350

2

Reasons for new version: The source code was extended to introduce new features.

Summary of Revisions: The new features of Version 2.0 include: hybrid parallelization based on MPI and

OpenMP for molecular dynamics simulation; Ewald summation for long range interactions; sampling of Massieu

potential derivatives;extended Green-Kubo formalism for the sampling of the electric conductivity and the resi-

dence time; radial distribution function.

Does the new version supersede the previous version: Version 2.0 brings new features, but does not necessarily

supersede the previous one.

2. Introduction

Molecular modeling and simulation is a technology central to many areas of research in academia and in-

dustry. With the advance of computing power, the scope of application scenarios for molecular simulation is

widening, both in terms of complexity of a given simulation and in terms of high throughput. Nowadays, e.g.

the predictive simulation of entire phase equilibrium diagrams has become feasible. However, in order to rely on

simulation results, the methodology needs to be sound and the implementation must be thoroughly veriﬁed. In

its ﬁrst release [1], we have introduced the molecular simulation tool ms2. Results from ms2 have been veriﬁed

and the implementation was found to be robust and efﬁcient.

As described in Section 3, in Version 2.0 of the simulation tool ms2 the existing molecular dynamics (MD)

MPI parallelization was hybridized with OpenMP, leading to an improved performance on multi-core processors.

Furthermore, the new release offers a wider scope of accessible properties. In particular, ms2 was extended to

calculate Massieu potential derivatives in a systematic manner, cf. section 4. This augments the range of sampled

properties signiﬁcantly and, as was demonstrated in [2], it allows to straightforwardly develop competitive

fundamental equations of state from a combination of experimental VLE data and molecular simulation results.

Lastly, besides being now capable of simulating ionic substances, the time and memory demand for calculating

transport properties was reduced signiﬁcantly (section 5).

ms2 is freely available as an open source code for academic users at www.ms-2.de.

3. Hybrid MPI & OpenMP Parallelization

The molecular simulation tool ms2 focuses on thermodynamic properties of homogeneous ﬂuids. Therefore,

systems investigated with ms2 typically contain on the order of 103molecules. While for Monte Carlo simula-

tions a perfect scaling behavior up to large numbers of cores can be trivially achieved, MD domain decomposition

– the de facto standard for highly scalable MD – is not feasible for such system sizes, because the cut-off radius

is in the same range as half the edge length of the simulation volume. This excludes domain decomposition and

limits the scalability of the MPI parallelization. The present release of ms2 features an OpenMP parallelization,

which was hybridized with MPI. At the point where MPI communication becomes a bottleneck, a single process

still has enough load to distribute to multiple threads, improving scalability.

3

Three parts of ms2 were parallelized with OpenMP: the interaction partner search, the energy and the force

calculations. All OpenMP parallel regions rely on loop parallelism, as the compute intensive parts of the al-

gorithm all feature a loop over the molecules. In the force calculation, race conditions need to be considered,

because every calculated force is written to both interacting molecules. Introducing atomic updates or critical

sections leads to massive overheads. Instead, it is more efﬁcient to assign forces from individual interactions to

the elements of a list (or an array) which is subsequently summed up. The same holds true for torques.

In Figure 1 the speed-up of hybrid MPI/OpenMP vs. pure MPI is plotted for 2’048 cores, varying the number

of threads per MPI process and the number of molecules in the simulation volume. As can be seen, using 2

to 4 threads per MPI process delivers a speed-up of around 20% for 2’048 cores. The evaluation of the hybrid

parallelization algorithm was performed on a CRAY XE6 Supercomputer at the High Performance Computing

Center in Stuttgart, which has an overall peak performance of one PFLOPS. It consists of 3552 nodes, each

equipped with two AMD Opteron 6276 (Interlagos) processors. Each processor has 16 cores, sharing eight FPUs

(Floating Point Units). Nodes are equipped with 32 GB RAM and are interconnected by a high-speed CRAY

Gemini network. Additional runtime performance comparisons with the simulation tool gromacs [3] are listed in

Table 1.

Figure 1: Speed-up of hybrid MPI/OpenMP vs. pure MPI for 2048 cores, varying number of threads per MPI process and 8192 molecules

(solid circles), 4096 molecules (empty circles), 2048 molecules (solid triangles), 1024 molecules (empty triangles)

4

Table 1: Runtime performance results with ms2 release 2.0 and gromacs v4.6.5 [3] for MD simulations with pure water at 298.15 K and

55.345 mol ·dm−3. The number of time steps were 100 000 for every simulation, the cutoff radius was identical for simulations with the

same number of particles. All simulations were performed on the same computer cluster.

cores threads Ngromacs / s ms2(RF) / s ms2(EW) / s

8 8 MPI 500 164 416 785

8 8 MPI 1000 299 874 1607

8 8 MPI 2000 1284 4461 6777

16 16 MPI 500 95 233 415

16 16 MPI 1000 166 477 848

16 16 MPI 2000 678 2298 3506

32 32 MPI 500 62 152 245

32 32 MPI 1000 106 296 487

32 32 MPI 2000 361 1286 1898

64 64 MPI 500 40 119 166

64 64 MPI 1000 65 228 324

64 64 MPI 2000 220 814 1261

128 128 MPI 500 38 105 131

128 128 MPI 1000 51 197 247

128 128 MPI 2000 147 557 727

8 1 MPI, 8 OMP/MPI 500 167 483

8 1 MPI, 8 OMP / MPI 1000 323 975

8 1 MPI, 8 OMP / MPI 2000 1416 4831

16 2 MPI, 8 OMP / MPI 500 105 253

16 2 MPI, 8 OMP / MPI 1000 186 517

16 2 MPI, 8 OMP / MPI 2000 763 2514

32 4 MPI, 8 OMP / MPI 500 75 167

32 4 MPI, 8 OMP / MPI 1000 121 316

32 4 MPI, 8 OMP / MPI 2000 418 1362

64 8 MPI, 8 OMP / MPI 500 60 119

64 8 MPI, 8 OMP / MPI 1000 92 217

64 8 MPI, 8 OMP / MPI 2000 261 785

128 16 MPI, 8 OMP / MPI 500 49 101

128 16 MPI, 8 OMP / MPI 1000 74 172

128 16 MPI, 8 OMP / MPI 2000 170 496

(N) Number of water molecules

(RF) simulations with reaction ﬁeld correction.

(EW) simulations with Ewald summation.

4. Massieu potential derivatives

ms2 version 2.0 features evaluating free energy derivatives in a systematic manner, thus greatly extending

the thermodynamic property types that can be sampled in single simulation runs. The approach is based on the

fact that the fundamental equation of state contains the complete thermodynamic information about a system,

which can be expressed in terms of various thermodynamic potentials [4], e.g. internal energy E(N , V, S), en-

thalpy H(N, p, S ), Helmholtz free energy F(N, V, T )or Gibbs free energy G(N, p, T ), with number of particles

N, volume V, pressure p, temperature Tand entropy S. These representations are equivalent in the sense that

any other thermodynamic property is essentially a combination of derivatives of the chosen form with respect

to its independent variables. The form F /T (N, V, 1/T ), known as the Massieu potential, is preferred in molec-

ular simulations due to practical reasons [5, 6]. The statistical mechanical formalism of Lustig allows for the

simultaneous sampling of any Ar

mn in a single N V T ensemble simulation for a given state point [5, 6, 7, 8]

∂m+n(F/(RT ))

∂βm∂ρnβmρn≡Amn =Ai

mn +Ar

mn , (1)

where Ris the gas constant, β≡1/T and ρ≡N/V .Amn can be separated into an ideal part Ai

mn and a residual

part Ar

mn [9]. The calculation of the residual part is the target of molecular simulation and the derivatives Ar

10,

Ar

01,Ar

20,Ar

11,Ar

02,Ar

30,Ar

21 and Ar

12 were implemented in ms2 for NV T ensemble simulations. The ideal

part can be obtained by independent methods, e.g. from spectroscopic data or ab initio calculations. However, it

can be shown that for any Amn =Ai

mn +Ar

mn, where n > 0, the ideal part is either zero or depends exclusively

on the density, thus it is known by default [6]. Note that the calculation of Ar

00 still requires additional concepts

5

such as thermodynamic integration or particle insertion methods. From the ﬁrst ﬁve derivatives A10,A01 ,A20,

A11,A02 every measurable thermodynamic property can be expressed (see the supplementary material for a list

of properties) with the exception of phase equilibria. A detailed description of the implementation is in the sup-

plementary material, here, only an overview is provided.

The calculation of the derivatives up to the order of n= 2 requires the explicit mathematical expression of

∂U /∂V and ∂2U/∂V 2with respect to the applied molecular interaction pair potential and has to be determined

analytically beforehand [5, 6]. The general formula for ∂nU/∂ V ncan be found in Ref. [8]. For common

molecular interaction pair potentials, like the Lennard-Jones potential [10, 11], describing repulsive and disper-

sive interactions, or Coulomb’s law, describing electrostatic interactions between point charges, the analytical

formulas for ∂U /∂ V and ∂2U /∂V 2can be obtained straightforwardly.

As molecular simulation is currently limited to operate with considerably fewer particles than real systems, the

effect of the small system size thus has to be counter-balanced with a contribution to Uand ∂nU /∂V ncalled

long range correction (LRC) [10, 11]. The mathematical form of the LRC depends on the molecular interac-

tion potential and the cut-off method (site-site or center-of-mass cut-off mode) applied. For the Lennard-Jones

potential, the LRC scheme was well described in the literature for both the site-site [5, 12] and the center of

mass cut-off mode [8, 13]. The reaction ﬁeld method [14] was the default choice in the preceding version of

ms2 for the LRC of electrostatic interactions modelled by considering charge distributions on molecules. The

usual implementation of the reaction ﬁeld method combines the explicit and the LRC part in a single pair poten-

tial [14, 15] from which ∂nU /∂V n(including the LRC contribution) is directly obtainable. However, practical

applications show that the electrostatic LRC of ∂U/∂V and ∂2U /∂V 2can be neglected in case of systems for

which the reaction ﬁeld method is an appropriate choice. E.g., the contribution of the electrostatic LRC for a

liquid system (T= 298 K and ρ= 45.86 mol/l) consisting of only 200 water and 50 methanol molecules with

a very short cut-off radius of 20% of the edge length of the simulation volume is still << 1% for both ∂U /∂V

and ∂2U/∂V 2. The supplementary material contains detailed elaborations on the LRC for the Lennard-Jones

potential.

5. Algorithmic Developments

Transport property calculations. In ms2, transport properties are determined via equilibrium MD simulations

by means of the Green-Kubo formalism [16]. This formalism offers a direct relationship between transport coef-

ﬁcients and the time integral of the autocorrelation function of the corresponding ﬂuxes. An extended time step

was deﬁned for the calculation of the ﬂuxes, the autocorrelation functions and their integrals. The extended time

step is ntimes longer than the speciﬁed MD time step, where nis a user deﬁned variable. The autocorrelation

functions are hence evaluated in every n-th MD time step. As a consequence, the memory demand for the au-

tocorrelation functions was reduced and the restart ﬁles, which contain the current state of the autocorrelation

functions and time integrals, become accordingly smaller. In addition, the overall computing time of the MD

simulation was reduced signiﬁcantly.

6

Ewald summation. Ewald summation [10, 11] was implemented for the calculation of electrostatic interactions

between point charges. It extends the applicability of ms2 to thermodynamic properties of e.g. ions in solutions.

In Ewald summation, the electrostatic interactions according to Coulomb’s law are divided into two contributions:

short-range and long-range. The short-range term includes all charge-charge interactions at distances smaller

than the cut-off radius. The remaining contribution is calculated in Fourier space and only the ﬁnal value is

transformed back into real space. This allows for an efﬁcient calculation of the long-range interactions between

the charges. The algorithm is well described in literature. Currently, some of the new features, the calculation

of Massieu potential derivatives and Hybrid MPI & OpenMP Parallelization for MD, are not available together

with Ewald summation.

6. Property Calculations

Radial distribution function. The radial distribution function (RDF) g(r)is a measure for the microscopic struc-

ture of matter. It is deﬁned by the local number density around a given position within a molecule ρL(r)in

relation to the overall number density ρ=N/V

g(r) = ρL(r)

ρ=1

ρ

dN(r)

dV=1

4πr2ρ

dN(r)

dr.(2)

Therein, dN(r)is the differential number of molecules in a spherical shell volume element dV, which has the

width drand is located at the distance rfrom the regarded position. g(r)can be evaluated for every molecule of

a given species.

In the present release of ms2, the RDF can be calculated during MD simulation runs for pure components and

mixtures on the ﬂy. The RDF is sampled between all LJ sites. In order to evaluate RDFs for arbitrary positions,

say point charge sites, superimposed dummy LJ sites with the parameters σ=ǫ= 0 have to be introduced in the

potential model ﬁle by the user.

Electric conductivity. The evaluation of the electric conductivity σwas implemented in ms2 version 2.0, being

a measure for the ﬂow of ions in solution. The Green-Kubo formalism [16] offers a direct relationship between

σand the time-autocorrelation function of the electric current ﬂux je(t)[17]

σ=1

3V kBTZ∞

0je(t)·je(0)dt, (3)

where kBis Boltzmanns constant. The electric current ﬂux is deﬁned by the charge qkof ion kand its velocity

vector vkaccording to

je(t) =

Nj

X

k=1

qk·vk(t), (4)

where Njis the number of molecules of component jin solution. Note that only the ions in the solution have to

be considered, not the electro-neutral molecules. For better statistics, σis sampled over all independent spatial

elements of je(t).

7

Thermal conductivity of mixtures. In the previous version of ms2the determination of the thermal conductivity

by means of the Green-Kubo formalism was implemented for pure substances only. In the present release, the

calculation of the thermal conductivity was extended to multi-component mixtures. The thermal conductivity λ

is given by the autocorrelation function of the elements of the microscopic heat ﬂow Jx

q

λ=1

V kBT2Z∞

0

dt Jx

q(t)·Jx

q(0).(5)

In mixtures, energy transport and diffusion occur in a coupled manner, thus, the heat ﬂow for a mixture of n

components is given by [18]

Jq=1

2

n

X

i=1

Ni

X

k=1

mk

ivk

i2+wk

iIk

iwk

i+

n

X

j=1

Nj

X

l6=k

urkl

ij

·vk

i

−1

2

n

X

i=1

n

X

j=1

Ni

X

k=1

Nj

X

l6=k

rkl

ij ·vk

i·

∂u rkl

ij

∂rkl

ij

+wk

iΓkl

ij −

n

X

i=1

hi

Ni

X

k=1

vk

i, (6)

where wk

iis the angular velocity vector of molecule kof component iand Ik

iits matrix of angular momentum

of inertia. urkl

ij is the intermolecular potential energy and Γkl

ij is the torque due to the interaction of molecules

kand l. The indices iand jdenote the components of the mixture. hiis the partial molar enthalpy. It has to be

speciﬁed as an input in the ms2parameter ﬁle and can be calculated from N pT simulations.

Residence time. The residence time τjdeﬁnes the average time span that a molecule of component jremains

within a given distance rij around a speciﬁc molecule i. It is given by the autocorrelation function

τj=Z∞

t=0 *1

nij (0)

nij (0)

X

k=1

Θk(t)Θk(0)+dt, (7)

where tis the time, nij (0) the solvation number around molecule iat t= 0 and Θis the Heaviside function,

which yields unity, if the two molecules are within the given distance, and zero otherwise. Following the proposal

of Impey et al. [19], the residence time explicitly allows for short time periods during which the distance between

the two molecules exceeds rij . Also, the solvation number nij can be evaluated on the ﬂy

nij = 4πρjZrmin

0

r2gij (r)dr, (8)

where ρjis the number density of component jand rmin is the distance up to which the solvation number is

calculated.

Acknowledgments

The authors gratefully acknowledge ﬁnancial support by the BMBF ”01IH13005A SkaSim: Skalierbare

HPC-Software f¨ur molekulare Simulationen in der chemischen Industrie” and computational support by the

High Performance Computing Center Stuttgart (HLRS) under the grant MMHBF2. The present research was

conducted under the auspices of the Boltzmann-Zuse Society of Computational Molecular Engineering (BZS).

8

[1] S. Deublein, B. Eckl, J. Stoll, S. V. Lishchuk, G. Guevara-Carrion,C. W. Glass, T. Merker,M. Bernreuther,

H. Hasse, J. Vrabec, Comp. Phys. Comm. 182 (2011) 2350–2367.

[2] G. Rutkai, M. Thol, R. Lustig, R. Span, J. Vrabec, J. Chem. Phys. 139 (2013) 041102.

[3] Gromacs molecular dynamics simulation package, http://www.gromacs.org.

[4] A. M¨unster, Classical Thermodynamics, Wiley and Sons, Bristol, 1970.

[5] R. Lustig, Mol. Sim. 37 (2011) 457–465.

[6] R. Lustig, Mol. Phys. 110 (2012) 3041–3052.

[7] R. Lustig, J. Chem. Phys. 100 (1994) 3048–3059.

[8] R. Lustig, J. Chem. Phys. 100 (1994) 3060–3067.

[9] J. S. Rowlinson, F. L. Swinton, Liquids and Liquid Mixtures, 3rd ed., Butterworths, London, 1982.

[10] M. Allen, D. Tildesley, Computer Simulation of Liquids, Clarendon Press, Oxford, 1987.

[11] D. Frenkel, B. Smith, Understanding Molecular Simulation, Academic Press, San Diego, 1993.

[12] K. Meier, S. Kabelac, J. Chem. Phys. 124 (2006) 064104.

[13] R. Lustig, Mol. Phys. 65 (1998) 175–179.

[14] J. A. Barker, R. O. Watts, Mol. Phys. 26 (1973) 789–792.

[15] I. P. Omelyan, Phys. Lett. A 223 (1996) 295–302.

[16] K. Gubbins, Statistical Mechanics, Burlington House, London, 1972.

[17] J. P. Hansen, I. R. McDonald, Theory of Simple Liquids, Academic, New York, 1986.

[18] D. J. Evans, W. B. Streett, Mol. Phys. 36 (1978) 161–176.

[19] R. Impey, M. Madden, I. McDonald, J. Phys. Chem. 87 (1983) 5071.

9

1

Supplementary material to “ms2: A molecular simulation tool for thermodynamic properties, new version release”

Colin W. Glassa, Steffen Reiserb, Gábor Rutkaic, Stephan Deubleinb, Andreas Kösterc, Gabriela Guevara-Carrionc, Amer Wafaia, Martin Horschb,

Martin Bernreuthera, Thorsten Windmannc, Hans Hasseb, Jadran Vrabecc

a Höchstleistungsrechenzentrum Universität Stuttgart (HLRS), 70550 Stuttgart, Germany

b Lehrstuhl für Thermodynamik, Universität Kaiserslautern, 67653 Kaiserslautern, Germany

c Lehrstuhl für Thermodynamik und Energietechnik, Universität Paderborn, 33098 Paderborn, Germany

This document summarizes the set of expressions required for the calculation of the Massieu potential derivatives implemented in ms2.

Description of the most important symbols and notations appearing in the text

kB Boltzmann constant

T temperature

V volume of the system

K number of components

N number of molecules

M number of sites of a molecule

β 1/T

ρ N/V

v 1/ ρ

F Helmholtz free energy

E internal energy

U potential energy

H enthalpy

Cv isochoric heat capacity

Cp isobaric heat capacity

m molar mass

p pressure

Amn Massieu potential derivative

w speed of sound

η Joule-Thomson coefficient

i index of molecule i

j index of molecule j

a index of site a of molecule i

b index of site b of molecule j

uiajb pair potential between site a of molecule i and site b of molecule j

ia

r

vector pointing to site a of molecule i

i

r

vector pointing to the COM of molecule i

iajb jb ia

= −r rr

ij j i

= −rrr

ij ij

r=r

distance between the COM of molecule i and COM of molecule j

iajb iajb

r=r

distance between the site a of molecule i and site b of molecule j

COM center of mass

ε0 permittivity of the vaccum

2

Massieu potential derivatives

The statistical mechanical formalism proposed by Lustig allows for the simultaneous sampling of any Armn in a single NVT ensemble simulation for

a given state point1,2. Amn can be separated into an ideal part Aimn and a residual part Armn3.

()

B

/

mn mn i r

mn mn mn

mn

F Nk T AAA

βρ

βρ

+

∂≡=+

∂∂

(1)

Note that Amn is dimensionless: F is extensive and has the unit of Joule, T is in Kelvin, and kB is in Joule divided by Kelvin. Conceptual details were

described by Lustig1,2. The individual derivatives for the NVT ensemble can be obtained through fluctuation formulas.

10

res

U

AN

β

=

(2)

01

1U

Av

V

β

∂

= − ∂

and

01

1

i

A= −

(3)

222

20

res

A UU

N

β

= −

(4)

22

11 UU U

A v v U vU

VV V

ββ β

∂∂ ∂

=−+ −

∂∂ ∂

(5)

22

2

2 22 22

02 2

21

U U UU

A vN vN vN v

V V VV

β β ββ

∂ ∂ ∂∂

= − + +−

∂ ∂ ∂∂

and

02

1

i

A= −

(6)

1 R. Lustig, Mol. Sim. 37, 457-465 (2011)

2 R. Lustig, Mol. Phys. 110, 3041-3052 (2012)

3 J. S. Rowlinson and F. L. Swinton, Liquids and Liquid mixtures, 3rd ed. (Butterworths, London, 1982)

3

33

32

30 32

res

A U UU U

N

β

=−+

(7)

2

2 2 32 3 2 3 3

21 22 2 2

U U UU U U

A vU vU vU vU vUU vU

V V VV V V

ββ β β β β

∂ ∂ ∂∂ ∂ ∂

= − + −+ −

∂ ∂ ∂∂ ∂ ∂

(8)

2

22

23 23 23 23

12

22

22

22 22 22 22

22

2

22

22

22

22

22

2

U U U UU

A vN U vN U vN U vN U

V V V VV

U UU U

vN vN U vN vN U

V VV V

U

vN V

UU

vU vU

VV

v

βββ β

ββ β β

β

ββ

∂ ∂ ∂ ∂∂

=+ −−

∂ ∂ ∂ ∂∂

∂ ∂∂ ∂

++ − −

∂ ∂∂ ∂

∂

+∂

∂∂

+−

∂∂

+U

V

β

∂

∂

(9)

Here, the brackets denote ensemble averages. For any Amn = Aimn + Armn, the ideal part is either zero (if m > 0 and n > 0) or depends exclusively

on the density (if m = 0 and n > 0), thus it is known beforehand 1,2.

4

Conversion of Amn into other thermodynamic properties1,2

01

B

1

r

pA

Nk T

ρ

= +

(10)

( )

B 01 02

12

rr

T

pNk T A A

ρ

∂= ++

∂

(11)

( )

B 01 11

1

rr

pNk A A

T

ρ

ρ

∂

= +−

∂

(12)

10 10

B

ir

EAA

Nk T = +

(13)

10 10 01

B

1

irr

HAAA

Nk T =+++

(14)

20 20

B

ir

v

CAA

Nk =−−

(15)

20

BB

1

i

ipi

v

C

CA

Nk Nk

= −=−

(16)

( )

2

01 11

20 20

B 01 02

1

12

rr

pir rr

AA

CAA

Nk A A

+−

=−− +

++

(17)

( )

2

201 11

01 02

B 20 20

1

12 rr

rr ir

AA

mw AA

Nk T A A

+−

=+ +− +

(18)

( )

( ) ( )( )

01 02 11

B2

01 11 20 20 01 02

1 12

rrr

rr i r rr

AAA

Nk AA AA AA

ρη

− ++

⋅= +− − + + +

(19)

The calculation of the derivatives Armn up to the second order with respect to the density (n = 2) requires the explicit mathematical formula for4

( )

() ( )

1

2

1 11 1

1

3

Mi M j

NN iajb ij

iajb

iajb

i ji a b iajb iajb

u

Ur

VV r r

−

==+= =

∂

∂=

∂∂

∑∑∑∑ rr

(20)

and

( )

( ) ( ) ( )

22

22

2() ( )

12

22 2 2 4 4 2

1 11 1

12

9

Mi M j

NN iajb ij iajb ij iajb ij

iajb iajb iajb ij

iajb iajb iajb

i ji a b iajb iajb iajb iajb iajb iajb iajb

u u ur

Urr r

VV rr r r r r r

−

==+= =

∂∂ ∂

∂

= − + − −=

∂ ∂∂ ∂

∑∑∑∑ rr rr rr

4 R. Lustig, J. Chem. Phys. 100, 3060-3067 (1994)

5

( ) ( )

22

22

() ( )

12

2 24 4 2

1 11 1

21

39

Mi M j

NN iajb ij iajb ij

iajb iajb ij

iajb iajb

i ji a b iajb iajb iajb iajb iajb

u ur

Urr

VV V r r r r r

−

==+= =

∂∂

∂

=−+ − −

∂ ∂∂

∑∑∑∑

rr rr

(21)

that has to be determined analytically beforehand for the applied molecular interaction pair potential

iajb

u

.

Explicit form of ∂U/∂V and ∂2U/∂V2

Lennard-Jones Potential5

The explicit forms are

( )

12 6

1

LJ 2

11

14 12 6

3

NN iajb ij

i ji iajb iajb iajb

U

VV r rr

σσ

ε

−

= = +

∂

=−−

∂

∑∑ rr

(22)

and

( ) ( )

22

12 6 12 6 2

2() ( )

1

LJ

2 2 4 42

1 11 1

21 4 156 42 4 12 6

39

Mi M j

NN iajb ij iajb ij ij

i ji a b iajb iajb iajb iajb iajb iajb iajb

r

UU

V VV V r r r r r r r

σ σ σσ

εε

−

==+= =

∂∂

=−+ − + − −

∂∂

∑∑∑∑

rr rr

(23)

where σ and ε are the length and energy parameters, respectively.

5 M. P. Allen and D. J. Tildesley, Computer Simulation of Liquids, (Clarendon Press, Oxford, 1987)

6

Various electrostatic interactions implemented in ms26,7

Charge-Charge:

( )

12

1

4o

qq

ur r

πε

=

(24)

Dipole-Charge8:

( )

12

2

1

, cos

4o

Dq

ur r

αα

πε

=

(25)

Quadrupole-Charge9:

( )

( )

2

12

3

1

, 3cos 1

42

o

Qq

ur r

αα

πε

= −

(26)

Dipole-Dipole:

( ) ( )

12

3

1

, , , cos 3cos cos

4o

DD

ur r

αβδ δ α β

πε

= −

(27)

Quadrupole-Dipole10:

( )

( )

( )

2

12

4

3

, , , cos 1 5cos 2cos cos

42

o

QD

ur r

αβδ β α α δ

πε

= −+

(28)

Quadrupole-Quadrupole:

( )

( )

2 2 22 2

12

5

3

, , , 1 5cos 5cos 35cos cos 20cos cos cos 2cos

44

o

QQ

ur r

αβδ α β α β α β δ δ

πε

= −−+ − +

(29)

For the definition of the angles α, β and δ see figure 1 below. Note that eqs. (25-29) describe point dipoles and quadrupoles as superpositions of

individual point charges. They were obtained by approximating the interaction energy between the corresponding point charge sets using the first k

terms of binomial series expansions, where k is a finite number6. In other words, some subset of the total Coulomb interaction energy of the system

UC is substituted with one or more of the expressions above. E.g., substituting the interaction energy between a point charge qi1 and a point dipole

consisting of qj2 and qj3 yields

() ( )

112 13

11 21

C1 11 1 1121 1 2 1 3

approximation, eq. (25)

... ...

Mi M j

NN ia jb i j i j

i ji a b iajb i j i j

qq qq qq

qq

Ur r rr

−

==+= =

= = ++ − +

∑∑∑∑

(30)

6 C.G. Gray and K.E. Gubbins, Theory of molecular fluids, (Oxford University Press, New York, 1984)

7 S.L. Price and A.J. Stone, M. Alderton, Mol. Phys., 52, 987-1001 (1984)

8 The expression for the charge-dipole interaction can be obtained by multiplying eq. (25) with minus one.

9 The expression for the charge-quadrupole interaction is the same as eq. (26).

10 The expression for the quadrupole-dipole interaction can be obtained by multiplying eq. (28) with minus one and interchanging the angles α and β.

7

Obtaining a new approximation for ∂UC/∂V, or for the higher order derivatives, following the same route as before is difficult due to the appearing

()

2

/

iajb ij iajb

r

rr

factor.

()

()

()

( ) ( )

() ( )

112 13

12 13

1121 12

11 21

2 2 22

1 11 1 1121 1121 1 2 1 2 1 3 1 3

approximation

3 ...

Mi M j

NN iajb ij i j ij i j ij

iajb i j i j

Ciajb

i ji a b iajb iajb i j i j i j i j

u qq qq

Uqq

Vr

V rr r r r r r r

−

==+= =

∂

∂− = = − + +− −−

∂∂

∑∑∑∑

rr rr rr

rr

...+

(31)

Practice shows, however, that substituting eqs. (25-29) directly into eqs. (20-21) yields a satisfactory accuracy, although positioning the interacting

charges, dipoles and quadrupoles of eqs. (25-29) as close as possible to the COM is still advised in order to lessen the influence of the factors

()

2

/

iajb ij iajb

rrr

and

22

/

ij iajb

rr

11.

Figure 1: Point dipole D and point quadrupole Q described by a set of individual point charges q.

The point charges -2q1, q1 and -q2, +q2 are separated by distances a1 and a2, respectively. Vector

d

corresponds to

iajb

r

.

11

( )

2

/

iajb ij iajb

rrr

and

22

/

ij iajb

rr

are equal to 1 if sites a and b are at the COM position of molecules i and j, respectively.

8

/

iajb iajb

ur∂∂

and

22

/

iajb iajb

ur∂∂

in eqs. (24-29) can be obtained straightforwardly

iajb

iajb iajb

iajb

u

r Yu

r

∂= −

∂

and

2

22

iajb

iajb iajb

iajb

u

r Xu

r

∂=

∂

(32)

with

cos / cos / cos / 0

iajb iajb iajb

rrr

αβδ

∂ ∂=∂ ∂=∂ ∂=

, i.e. the orientation of the point dipoles and quadrupoles does not change with

iajb

r

. The

respective values of the constants Y and X are given in table 1. Substituting eq. (32) into eqs. (20-21) yields

( )

( )

() ( )

1

2

1 11 1

1

3

Mi M j

NN iajb ij

Ciajb

i ji a b iajb

UYu

VV r

−

==+= =

∂= −

∂∑∑∑∑ rr

(33)

and

( )

( )

22

2() ( )

1

CC

2 2 42

1 11 1

21

39

Mi M j

NN iajb ij ij

iajb

i ji a b iajb iajb

r

UU u XY Y

V VV V r r

−

==+= =

∂∂

=−+ + −

∂∂

∑∑∑∑ rr

(34)

Table 1: Coefficients X and Y for the various electrostatic interactions, cf. eq. (32).

UI Interaction

X+Y

Y

X

Charge-Charge

3

1

(-1)(-2) = 2

Dipole-Charge

Charge-Dipole

8

2

(-2)(-3) = 6

Charge-Quadrupole

Quadrupole-Charge

Dipole-Dipole

15

3

(-3)(-4) = 12

Dipole-Quadrupole

Quadrupole-Dipole

24

4

(-4)(-5) = 20

Quadrupole-Quadrupole

35

5

(-5)(-6) = 30

9

Long Range Corrections for the Lennard-Jones Potential for COM-COM cutoff mode

The long range correction (LRC) for the potential energy is5

()( )

2

LRC () ()

12

22

c cc

Vr Vr r

N

U N u r g r dV u dV N r udr

ρ ρ πρ

∞ ∞∞

= = =

∫ ∫∫

(35)

where

2

4dV r dr

π

=

and rc is the cutoff radius. For systems containing many components, the pair potential can be written as

12

11

KK

A B AB

AB

u xx u

ωω

= =

=∑∑

(36)

where K is the number of components and x is the molar ratio. The term in the brackets

12

ωω

stands for the integral12

( )

12

1 12

12 2 1

1 10

11 cos cos

24

f f dd d

π

ωω

θθϕ ϕ θ θ

π

−−

=

∫ ∫∫

(37)

f can be considered as the unweighted average of a power of the angle dependent distance s (see figure 2) for site-site molecular models. ω1 and ω2

are polar angles of the vectors

1

τ

and

2

τ

.

For site-site molecular models

() ()

11

MA MB

AB AaBb

ab

uu

= =

=∑∑

(38)

12 R. Lustig, Mol. Phys. 65, 175-179 (1988)

10

Figure 2: Geometrical representation of the orientation of two site-site molecular models.

Since

12

ωω

stands for an integral

12 12

12

() () () ()

11 11

MA MB MA MB

AB AaBb AaBb

ab ab

uu u

ωω ωω

ωω

= = = =

= =

∑∑ ∑∑

(39)

For the Lennard-Jones potential this leads to

12 12 12

12

12 6 12 12 6 6

44

AB

u ss

rr

ωω ωω ωω

ωω

σσ

ε εσ σ

−−

=−= −

(40)

The LRC for the potential energy using eqs. (35), (36), (38), (39) and (40) leads to

12 12

() () 2 12 12 2 6 6

LRC 111 1

24

cc

nA nB

KK

AB

AB a b rr

U N x x r s dr r s dr

ωω ωω

πρ ε σ σ

∞∞

−−

= = = =

= −

∑∑∑∑ ∫∫

(41)

11

The LRC of ∂U/∂V is

3

LRC () ()

11

2

2 23 3

cc c

Vr Vr r

U Nu N u u

dV r dV N r dr

V V Vr V r

ρ ρ πρ

∞∞ ∞

∂∂ ∂ ∂

= = =

∂∂ ∂ ∂

∫∫ ∫

(42)

Substituting eq. (40) into (42) yields

12 12

12 6

() () 3 12 3 6

111 1

LRC

124

3

cc

nA nB

KK

AB

AB a b rr

ss

UN x x r dr r dr

VV r r

ωω ωω

πρ ε σ σ

−−

∞∞

= = = =

∂∂

∂

= −

∂ ∂∂

∑∑∑∑ ∫∫

(43)

The long range correction for ∂2U/∂V2 is

22 2 2

2 34

2 2 22 2 2

() ()

LRC

11

2 22

2 29 9

cc c

Vr Vr r

UNu N uu uu

dV r r dV N r r dr

V V V rr V rr

ρ ρ πρ

∞∞ ∞

∂ ∂ ∂∂ ∂∂

= = −+ = − +

∂ ∂ ∂∂ ∂∂

∫∫ ∫

(44)

Substituting eq. (40) into (44) yields

12 12

212 26

2() () 4 12 4 6

2 2 22

111 1

LRC

LRC

21

24

39

cc

nA nB

KK

AB

AB a b rr

ss

UU

N x x r dr r dr

V VV V r r

ωω ωω

πρ ε σ σ

−−

∞∞

= = = =

∂∂

∂∂

=−+ −

∂∂ ∂ ∂

∑∑∑∑ ∫∫

(45)

12

The solution of eq. (37) depends on the position of the interacting sites within the molecule12. The solution differentiates three scenarios.

Center-Center (each site is at the COM position,

1,2 0=τ

)

22nn

sr=

(46)

Center-Site (only one site is at the COM position,

0 and 0

ij

= ≠

ττ

)

( ) ( )

( )

22 22

2

41

nn

n

rr

srn

ω

ττ

τ

++

+ −−

=+

(47)

Site-Site (none of the sites is at the COM position,

1,2

0≠τ

)

( ) ( ) ( ) ( )

( )( )

12

23 23 23 23

2

12

8 12 3

nnnn

n

rrrr

srn n

ωω

ττττ

ττ

++++

+−−+

+ −+ −− +−

=++

(48)

12

τ ττ

+

= +

and

12

τ ττ

−

= −

.

13

The long range corrections can be summarized as follows

( ) ( )

( ) ( )

( ) ( )

( ) ( )

( )

()()

LRC 111 1

()()

111 1

LRC

TICC 6 TICC 3

2 4 TICS 6 TICS 3

TISS 6 TISS 3

TICC / 6 TICC / 3

24 TICS / 6 TICS

3

nAnB

KK

AB

AB a b

nAnB

KK

AB

AB a b

UU

U N xx U U

UU

UV UV

UN xx U V

VV

πρ ε

πρ ε

= = = =

= = = =

−− −

= −− −

−− −

∂ ∂−− ∂ ∂−

∂

= ∂ ∂ −−

∂

∑∑∑∑

∑∑∑∑

( )

( ) ( )

( ) ( )

( ) ( )

( )

2

22 22

2()() 22 22

22

111 1

LRC

LRC 22

/3

TISS / 6 TISS / 3

TICC / 6 TICC / 3

22 4 TICS / 6 TICS / 3

39 TISS / 6

nAnB

KK

AB

AB a b

UV

UV UV

UV UV

U UN xx UV UV

V VV V UV

πρ ε

= = = =

∂ ∂−

∂ ∂−− ∂ ∂−

∂∂−− ∂∂−

∂∂

=− + ∂∂−− ∂∂−

∂∂

∂∂−

∑∑∑∑

( )

22

TISS / 3UV

− ∂∂−

(49)

The functions TICC, TICS and TISS stand for the center-center, center-site and site-site scheme, respectively. Note that the mathematical form of

eqs. (47) and (48) has the following properties

22 1 11

12 22

()

,()

nn

fr f f

ss f r f Cr

ω ωω

= = =

and

22

/f Cfr

′= =

(50)

where C is a constant and

1

1

f

fr

∂

′=∂

,

2

2

f

fr

∂

′=∂

.

14

The explicit solution for the center-center cutoff scheme can be obtained straightforwardly form eqs. (46) and (49).

Center-Center

( )

(2 3)

2 22 2

TICC 23

c

n

nn n

c

r

r

U n r r dr n

σσ

∞+

−−

= = − +

∫

(51)

()

( )

( )

2(2 3)

32 2 2

TICC / 2 TICC

23

c

nn

nn

c

r

rrn

U V n r dr n U n

rn

σσ

∞+

−−

∂

∂∂ = =− =⋅

∂+

∫

(52)

( )

( )

()( ) ( )

22 (2 3)

2 2 42 2

2

22 1

TICC / 2 2 1 TICC

23

c

nn

c

nn

r

rr nn

U V n r dr n n U n

rn

σσ

+

∞

−−

∂−

∂∂ = =− = −

∂+

∫

(53)

Center-Site and Site-Site

For the center-site and site-site schemes the expression for

/

kk

UV∂∂

also contains

11

/

kk

UV

−−

∂∂

explicitly and only the analytical solution for

1

/

c

kk k

r

r f r dr

∞

+

∂∂

∫

is required, where k=1 or 2.

( )

221

2

TIXS

c

n

r

f

U n r dr

f

σ

∞

−

=∫

(54)

( ) ( )

1

2

23 23 23 22

12 12 1 1 1

2

2 22

TIXS / TIXS

cc c c

nn n n

rr r r

f

fff ff f f f

U V n r dr r dr r dr r dr U n

r f f rf C

σσ σ σ

∞∞ ∞ ∞

−− − −

∂

′′ ′ ′

−

∂∂ = = = − = −

∂

∫∫ ∫ ∫

(55)

15

( )

21 12 12

2

22

2 2 42 42

2

TIXS /

cc

nn

rr

f ff ff

ff

U V n r dr r dr

rr

σσ

∞∞

−−

′′

−

∂∂

∂∂ = = =

∂∂

∫∫

1 1 11 2

22 2

42 42 42 1 11 1

22 24

2

cc c

nn n

rr r

fCr fC f f f Cr f C f Cr f Cr

C r Cr Cr

r r dr r dr

r r Cr Cr

σσ σ

∞∞ ∞

−− −

′′

−

∂ ∂−

′′ ′ ′

−−

= = = −=

∂∂

∫∫ ∫

2

42 42 42

1 11 1 1 11 1 1 1 1

23 2 2

22 2

2 2 22

ccc

nnn

rrr

f r f fr f f r f fr f f r fr f

r dr r dr r dr

Cr Cr fr fr fr

σσσ

∞∞∞

−−−

′′ ′ ′ ′′ ′ ′ ′′ ′

−− −− −+

= −= −= =

∫∫∫

2

22 22 22

1 11

22

22

c cc

n nn

r rr

fr f f

r dr r dr r dr

f Cf

σ σσ

∞ ∞∞

− −−

′′ ′

= − +=

∫ ∫∫

( ) ( ) ( )

2

221

2

2 TIXS / TIXS 2TIXS

c

n

r

fr

r dr U Vn Un Un

f

σ

∞

−′′

= − ∂∂ + + =

∫

( )

2

221

2

2TIXS /

c

n

r

fr

r dr U V n

f

σ

∞

−′′

= − ∂∂ =

∫

( )

321

2TIXS /

c

n

r

f

r dr U V n

C

σ

∞

−

′′

= − ∂∂

∫

(56)

Here, TIXS stands for either TICS or TISS. The final expression for the functions TICS and TISS can be found in the source code of ms2 under the

same name.

Long range corrections for the Lennard-Jones potential for site-site cutoff mode

The LRC corresponds to eqs. (51), (52) and (53) if the site-site cutoff mode is chosen.