Particle Simulations
Particle Simulations
Raffaele Pastore
Dept. of Chemical, Materials and Production Engineering
University of Naples Federico II
email: [email protected]
web-page: http://rpastore.altervista.org/
Two fundamental tools in the contemporary Physical Chemistry
• One of the main purpose of Physical Chemistry consists in understanding the behaviour of material systems on a
microscopic ground, e.g. in term of their microscopic constituents (e.g., atoms, molecules, etc…) and of the laws of
classical or quantum mechanics.
• Such a purpose implies the necessity to get information on the equations of motion of all microscopic constituents
of a material system (at least ~1023 particles for macroscopic systems).
• Thus, Physical Chemistry exploits two alternative tools (in addition to direct experimental measure, if available):
Ø The probabilistic approach of Statistical Mechanics, which provides a theoretical framework to predict a
probability distribution for all microscopic events and evaluate average quantities and the fluctuations around
such averages.
Ø The numerical approach of particle (or atomistic) simulations, which exploits computers to numerically
solve, under some approximation, the equation of motion for relatively large systems (up to milions of
particles).
Two complementary approaches
• Statistical Mechanics provides a definition of key concepts that are crucial for particle simuations, e.g.,
fluctuations, size dependence, Definitions of various ensembles, connection between time averages and ensemble
averages, Equilibrium versus non-equilibrium.
• In addition, Statistical Mechanics provide fundamental relations to compute thermodynamic quantities using the
microscopic data (i.e., the single particle trajectories) produced by particle simulations, e.g.:
"
! "# (! +" , + "
𝑇= ∑%&' 𝐶* =
"#$ !) $- "
• Particle simulations allows to sample probability in phase space for all those system, in which these information
cannot be obtained analytically. This includes systems of interacting particles, where the presence of coupled
terms in the Hamiltonian prevent a direct calculation of Z in the canonical ensemble.
• Particle simulations provide an easy access to the system dynamics, i.e. the time dependence of several
characteristic quantities (e.g., the mean square displacement), which complements the equilibrium (time-
independent) properties provided by basic Statistical Mechanics.
Numerical simulations: an overview
• -Different time- and length-scales à different simulation methods
• Complementarity of different
simulations methods: results from lower
scale simulations can be used as an input
for larger scale simulations.
particle=vesicle
d ≃1e-7 - 1e-6 m
σ
Pastore et al., Soft Matter 2014;
JSTAT 2016
particle=grain
particle=molecules d ≃1e-3 - 1e-2 m
d ≃1e-10 – 1e-8 m
• Particle simulations are an essential tool for systems of small particles (atoms, molecules), whose trajectories cannot
be directly monitored (tracked) in experiments.
• For larger particles (e.g. colloids, macromolecules) that can be experimentally tracked, particle simulations still
represent a powerful complement to experiments for several reasons:
Ø Experiments may be much more difficult to perform, expensive, time consuming…and even dangerous in
some cases.
Ø Experiments are often characterized by a relatively poor control of the system and by many parameters.
Ø Simulations can provoke experiments, and/or can contribute to a deeper understanding of experiments,
allowing for more detailed analysis (e.g. large temporal resolution).
Warning: Simulations must not be considered as an ultimate substitute of experiments. Remember that
experiments are «the real world», whereas simulations draw on models built by the users. Experimental
validation is always needed at same stage of the scientific process!!!
Classical Molecular Dynamics (MD)
• Classic MD consists in numerically solving (under some approximation) the equations of motion for all particles
in a “classical” system (i.e. whose dynamics obey to the Newton laws).
• Consider, for instance, a classical system made by N interacting particles that move following the Newton
equations:
𝑭𝒊 𝑚% 𝒂𝒊
Net force acting on the particle i Mass x accelleration of particle i
𝒅𝟐 𝒓𝒊
& 𝒇𝒊𝒋 (𝒓𝒊 , 𝒓𝒋 , … ) = 𝑚% 𝟐
𝒅 𝒕
%./
• System of 3N coupled differential equations: Hard to be analytically solved already for N>3 à Necessity to make
use of numerical integration
• In order to go on with calculations, a model for the different force laws is needed, so as to explicitly obtain the
pair-interaction forces 𝒇𝒊𝒋 .
Classical Molecular Dynamics II
• Introduce a small temporal increment (timestep) 𝑑𝑡 and estimate the positions 𝒓𝒊 (𝑑𝑡) and velocities 𝒗𝒊 (𝑑𝑡).
• The “full” trajectory of each particle are then approximated as a discrete sequence of point in phase space
[𝒓𝒊 0 , 𝒗𝒊 (0)]; [𝒓𝒊 (𝛿𝑡) , 𝒗𝒊 (𝛿𝑡 )]; …. [𝒓𝒊 (𝑛𝛿𝑡) , 𝒗𝒊 (𝑛𝛿𝑡) ].
• Accordingly, the microscopic state of the system is univocally defined (within the adopted numerical
approximations) with the ensuing possibility of computing any quantity of interest (both microscopic and
macroscopic).
MD Workflow
Initialization 𝒓𝒊 0 , 𝒗𝒊 (0)
Increase time,
𝑡 → 𝑡 + 𝑑𝑡
if t<tmax
Hard sphere
Lennard-Jones Harmonic repulsion (aka soft sphere)
𝜎 !" 𝜎 #
𝑈 𝑟 = 4𝜀 − 𝑈=∞ 𝑈=0
𝑟 𝑟 1
𝑈= 𝑘 𝑟−𝜎 ! 𝑈=0
2 (
1 !
𝑈= 𝑘5 𝑟 − 𝑟6
2
Numerical solution of the equations of motion: Verlet algorithm
• Many approaches, with different level of efficiency and approximations, have been developed to numerically solve
differential equations. In the context of MD simulations, a very popular approach is the Verlet algorithm.
𝑑! 𝑥 𝑡
= 𝑓[{𝒙 𝑡 }]
𝑑𝑡 !
Computing the Taylor series expansion up to fourth order around time t, for the position at time (t+dt) :
Taking into account eq. (3.8), eq. (3.11) can be written as follows
𝑥 𝑡 + 𝑑𝑡 = 2𝑥 𝑡 − 𝑥 𝑡 − 𝑑𝑡 + 𝑓 𝒙 𝑡 𝑑𝑡 ! + 𝑂(𝑑𝑡 7 )
Pastore, MSC Thesis
Numerical solution of the equations of motion: Verlet algorithm (II)
𝑥 𝑡 + 𝑑𝑡 = 2𝑥 𝑡 − 𝑥 𝑡 − 𝑑𝑡 + 𝑓 𝒙 𝑡 𝑑𝑡 ! + 𝑂(𝑑𝑡 " )
• Eq. (3.12) provides an estimation of x(t+dt) with an accuracy of fourth order O(dt4) in the timestep dt.
• Notice that the Verlet algoritm requires as inputs the positions at two previous steps in time x(t) e x(t-dt) and,
therefore, cannot be used at the first integration step (t=0àt=dt).
• Indeed, x(0) and x(-dt) (a negative time!) would be necessary to compute x(dt), whereas at t=0 only the initial
conditions x(0) and v(0) are known.
• For the first integration step, therefore, it is necessary to use a different algorithm, which is able to compute x(dt),
starting from the initial conditions. For this purpose, the most used approach is the Eulero algorithm.
'
𝑥 𝑑𝑡 = 𝑥 0 + 𝑥 8 0 𝑑𝑡 + 𝑥 88 0 𝑑𝑡 ! + 𝑂 𝑑𝑡 " (3.13)
!
'
𝑥 𝑑𝑡 = 𝑥 0 + 𝑣 0 𝑑𝑡 + 𝑓({𝒙 0 })𝑑𝑡 ! + 𝑂 𝑑𝑡 " (3.14)
!
• The Eulero algorithm provides x(dt) with an accuracy of O(dt3), being therefore less accurate than the Verlet one.
However, being the Eulero algorithm used for the first integration step only, the introduced uncertainty is fully
negligible, overall.
• It is worth noticing that the accuracy of those algorithms generally depends on the integration step dt. On decreasing
dt, a simulations becomes more accurate, but also computationally less efficient (slower). It is therefore crucial to
identify an effective compromise.
• This is a fundamental challenge in the development of MD simulations, and there is no general rule. Different criteria
can be relevant depending on the specific features of the system under consideration. In many cases, an appropriate
choice is dt<<tint , where tint is the typical interval between two interactions of a particle with the others.
• MD assumes that particles are enclosed within a box, which can be merely “virtual” or representative of physical
constraints (e.g., real walls).
• In order to simulate the a material sample immersed in a ”sea” of material of the same type (“bulk”), the so-called
“Periodic Boundary Conditions” (PBC) are employed.
• Alternatively, fixed boundary conditions are used to simulate material sample that are microscopically confined or
close to a wall.
• With PBC, the box is virtual and periodic copies of the box along x,y,z are
considered
• Hence, as a particle moves out of the box, it re-enter from the the opposite
side of the box.
• The copies of the box are also used to properly estimate the pair-interaction
forces
• The colloidal bead interacts with the molecules of the fluid, and the molecules of the fluid interact among them.
MD picture
𝒅𝟐 𝒓𝑪
𝑚: 𝟐 = & 𝒇𝑪𝒋
d ≃1e-6m 𝒅 𝒕
/ ∈ <%=>%?
𝒇𝑪𝒋
𝒅𝟐 𝒓𝒊
𝑚% 𝟐 = 𝑓%: + & 𝒇𝒊𝒋
𝒅 𝒕
/.% ∈ <%=>%?
𝒇𝒋𝑪 = −𝒇𝑪𝒋
d ≃10e-10m
𝒇𝒋𝒊
𝒇𝒊𝒋 = −𝒇𝒋𝒊
• The large difference between colloidal and molecular size implies a huge number of molecules and of interactions to
be taken into account, which makes MD simulations hardly feasible in this context.
https://www.youtube.com/watch?v=4m5JnJBq2AU
https://www.youtube.com/watch?v=6VdMp46ZIL8
Langevin Dynamics
• Langevin Dynamics (LD) provide a simplified model to deal with these situations. In the LD model, the colloidal
bead “feels” the fluid only through two effective interactions: i) a drag force due to the fluid viscosity, and ii) a random
force due to the chaotic collisions with fluid molecules. The inner dynamics of the fluids molecules are fully
disregarded (non equations to be solved for the fluid).
In the drag force 𝐹 % , 𝜂 is the fluid viscosity and d the bead diameter.
In the random force 𝐹 & , 𝑹 𝒕 is a vector varying randomly in time and with zero mean
• Because of the random term, the LD equation belongs to the class stochastic differential equations (SDE). The solution
of SDE draws on specific approaches (which fall out of our present scopes).
• The previous LD equation can be extended to the case of several large particles interacting among them and with the
fluid: e.g., a colloidal suspension
𝒅𝟐 𝒓𝑪,𝒊
𝑚#,) 𝟐 = 𝑭𝑫 𝑹 𝒊𝒏𝒕 𝑭𝒊𝒏𝒕 = ∑%./ 𝒇𝒊𝒋 (|𝒓𝑪𝒊 − 𝒓𝑪𝒋 |)
𝒊 + 𝑭𝒊 + 𝑭𝒊 𝒊
𝒅 𝒕
Molecular VS Langevin Dynamics
MD picture LD picture
𝒇𝑪𝒋 𝑭𝑹 (t)
𝑭𝑫 𝒗𝑪
𝜂
𝒇𝒋𝑪 = −𝒇𝑪𝒋
𝜂
𝒇𝒋𝒊
𝒇𝒊𝒋 = −𝒇𝒋𝒊
𝒅𝟐 𝒓𝑪 𝒅𝟐 𝒓𝑪
𝑚: 𝟐 = & 𝒇𝑪𝒋 𝑚# 𝟐 = 𝑭𝑫 + 𝑭𝑹
𝒅 𝒕
/ ∈ <%=>%? 𝒅 𝒕
𝟐
𝒅 𝒓𝒊
𝑚% 𝟐 = 𝑓%: + & 𝒇𝒊𝒋
𝒅 𝒕
/.% ∈ <%=>%?
Brownian Dynamics
• Brownian Dynamics (BD) is a simplified version of LD, corresponding to the limit 𝑚: 𝑎F =0 (i.e. zero resulting force),
which is known as inertial or overdamped limit.
• Brownian Dynamics (BD) simulations consist in the numerical solutions of those equations.
• Apart from the different equations of motion to be solved (Newtonian vs Langevin), all considerations (force laws,
boundary conditions, etc…) made for MD simulations do apply to BD simulations.
• Brownian dynamics fully reproduce the phenomenology observed by Robert Brown, and can be exploited in many
other situations (e.g. dense suspesions)
Monitoring of particle simulations
• At variance with most experiments and other numerical techniques, a particle simulation gives direct access
to all particle trajectories. This corresponds, in principle at least, to a complete knowledge of the system
under consideration over the whole simulated time-window.
• By using targeted softwares, actual «movies» of the system of interest can be obatined.
BD of Vesicle suspensione
(the base of fabric softners )
Monitoring of particle simulations II
• Those quantities can be computed and printed during the simulation («on the flight»), or at at a later stage (
«post-processing»)
• The quantities of interest can be classified in three categories: Termodynamics (Pressure, Temperature,
Energy, etc…), Dynamical (mean square displacement, diffusion coefficient, velocity of a given particle, etc…)
and Structural ones (pair correlation function g(r), structure factor, etc…).
• A further distinction can be made among Global quantities (computed on the whole system) or Local
quantities (computed over a particle or restricted group of particles).
• Thermodynamic quantities are always global, while dynamic and strcutural quantities can be either global or
local
From trajectories to Thermodynamics
• For equilibrium systems, the following relations generally holds in the thermodynamic limit
-
Ø Kinetic Energy: 𝐾 = ∑/ !
).- 𝑚) 𝑣)
!
!
Ø Temperature: 𝑇 = 𝐾
01' /
Ø Potential energy: 𝑈2 = ∑/
).- ∑34) 𝑈(𝑟)3 )
/15 - /
Ø Pressure: 𝑃 = − ∑ ∑ 𝒓 : 𝒇𝒊𝒋
6 06 ).- 34) 𝒊𝒋
Example of dynamic quantities: Van Hove and MSD
• Consider to take a record of the displacement Δ𝑥 of each particle over a given time interval 𝑡 = 𝑡6 and 𝑡 = 𝑡6 + Δ𝑡.
• At equilibrium, the results does not depend on 𝑡6 . For isotropic systems, the results does not depends on the
considered direction (e.g., x, y, z). Thus, one can repeat the same record for different 𝑡6 and along three
orthogonal directions, so as to improve the statistics (i.e. to get a larger collection of displacement).
• From this collection of displacements, we can can compute the displacement distribution p 𝛥𝑥, 𝛥𝑡 , also known
as Van Hove function, i.e. the probability density function that a particle has moved of 𝛥𝑥 during the interval 𝛥𝑡.
G
Usually, the Van Hove function is normalized so that: ∫,G 𝑝 Δ𝑥, Δ𝑡 𝑑𝑥=1
• The Mean Square displacement (MSD) is the average square distance traveled by a particle during the time
interval Δ𝑡 :
#
1
Δ𝑥 ! (Δ𝑡) = & 𝑥𝒊 𝑡6 + Δ𝑡 − 𝑥% 𝑡6 !
𝑁
%&'
• The MSD is directly related to the Van-Hove function, i.e. it is the second moment of the Van Hove function.
G
Δ𝑥 (Δ𝑡) = \ Δ𝑥 ! 𝑝 Δ𝑥, Δ𝑡 𝑑𝑥
!
,G
Example of dynamic quantities: Van Hove and MSD II
• For standard gases and liquids and for larger particles suspended in them at dilute conditions (Brownian motion)
Δ𝑥 ! (Δ𝑡) = 2𝐷𝛥𝑡
generally holds for sufficiently large Δ𝑡. The constant D is known as diffusion coefficient or diffusivity and depends on the
system under consideration and on the control parameter (temperature, pressure, density, particle size and shape, etc.)
Thus, D can be obtained by measuring 𝑟 ! (Δ𝑡) and performing a linear fit.
• The corresponding Van Hove function is a Gaussian distribution with mean 𝜇 = Δ𝑥 = 0 and standard deviation
𝜎 = Δ𝑥 ! (Δ𝑡 = 2𝐷Δ𝑡 :
' I4 " ' I4 "
𝑝 Δ𝑥, Δ𝑡 = exp[− ]= exp[− ]
H! I4 "(IK ! I4 "(IK H7LK 7LIK
𝑝 Δ𝑥, Δ𝑡
Δ𝑥
Example of dynamic quantities: temporal correlation functions
In the context of fluids and amorphous solids, a variety of temporal correlation function, are used to describe the
average dynamics at given probe-length λ.
• The persistence is the average fraction of particle, that after a time Δ𝑡, moved less than λ.
• A characteristic time, known as relaxation time 𝜏(𝜆) is commonly measured from the relation 𝑄 𝜆, 𝜏 = 𝑒 ,'
• The ISSF can be measured in scattering experiments. Its behaviour and interpretation is similar to that of the
persistence (the same consideration holds for other correlation functions). The ISSF is the Fourier transform of
the Van Hove function.
• For standard gases and liquids and for larger particles suspended in them at dilute conditions (Brownian
motion), the decay is purely exponential, with decay-time 𝜏 𝜆 :
*
9 :-
𝐹8 𝜆, 𝛥𝑡 = 𝑒 +, , with 𝜏 ∝
;
Setup of a generic particle simulation
1) Inizialization 2) Equilibration
• Define the simulation box • Preliminary steps to pass from the initial condition
• Fix the termodynamic parameter: e.g. NVT (typically unrealistic) to an equilibrium condition.
• Define the particles: shape, mass, charge, etc… • Monitoring of thermodynamic quantities to determine
when equilibrium is attained (at equilibrium will
• Create particles with given intial conditions
fluctuate around constant values)
• Fix the pair-interaction potential
• Fix the timestep
3) Production
• Run the simumaltions for an arbitrary time
• Record of the trajectories and of other quantities
4) Post-processing
• Once the simulation ends, any other quantity of
interest can be computed or smoothened.
Simulation software