Lammps MD Slides
Lammps MD Slides
Introduction to Molecular
Dynamics simulations
Ali Kerrache
E-mail: [email protected]
q Computational Physicist
Ø Monte Carlo and Molecular Dynamics codes.
Ø Study of the properties of materials using MD simulation.
v Metals, Glasses: Silica, Amorphous silicon, Nuclear Glasses.
v Mass transport, solid-liquid interfaces, kinetic coefficients, melting,
crystallization, mechanical deformations, static and dynamical properties,
He diffusion in glasses, …
Ø ssh –Y [email protected]
Ø ssh –Y [email protected]
wget https://ali-kerrache.000webhostapp.com/uofm/md.tar.gz
wget https://ali-kerrache.000webhostapp.com/uofm/md-slides.pdf
Mesoscale
nanosec.
Molecular
picosec Dynamics
Quantum
femtosec. Mechanics Length
nanometer micrometer mm meter
ri (t ) ® ri (t + Dt )
Solve the equation of motion vi (t ) ® vi (t + Dt )
v Thermodynamic
Sample / Check point properties, …
v MD trajectory, …
Interactions:
Ø Lenard-Jones
Ø Electrostatic
Ø Bonds
Ø Orientation
Ø Rotational
r (t + Dt ) + r (t - Dt ) = 2r (t ) + !r!(t ) Dt 2 + O ( Dt 4 )
or :
r (t + Dt ) = 2r (t ) - r (t - Dt ) + f (t ) Dt 2 / m + O ( Dt 4 ) ( II )
Subtract (II) from (I) : {r(t+Dt), v(t+Dt)}
r (t + Dt ) - r (t - Dt ) = 2r!(t ) Dt + O ( Dt 3 )
or :
v(t) = (r (t + Dt ) - r (t - Dt ) ) / 2Dt + O ( Dt 2 ) {r(t), v(t)} ( IV )
2
• stable in long simulation
1
• most used algorithm a(t + Dt ) = F (r (t + Dt ))
m
v Leap-Frog algorithm 1
v(t + Dt / 2) = v(t )Dt + a(r )Dt
2
1
v(t + Dt ) = v(t + Dt / 2) + a(t + Dt )Dt
2
iii
a P (t + Dt ) @ a(t ) + r iii (t )Dt r : 3rd order derivatives
F ( r P
(t + Dt ))
q Corrector step: Ø get corrected acceleration: a (r) =
C
m
Ø using error in acceleration: Da(t + Dt ) @ a (t + Dt ) - a (t + Dt )
C P
Dt 2
Ø correct the positions: r(t + Dt ) @ r P (t + Dt ) + C0 Da(t + Dt )
2
Ø correct the velocities: v(t + Dt ) @ v P (t + Dt ) + C1DtDa(t + Dt )
C n: constants depending accuracy
Ø PBC:
in x, y directions
Ø Walls:
fixed boundaries
in z direction.
q Temperature control:
Ø Berendsen thermostat (velocity rescaling)
Ø Andersen thermostat
ü Choose the ensemble that best
Ø Nose-Hoover chains fits your system and the properties
you want to simulate
q Pressure control: ü start the simulation.
Ø Berendsen volume rescaling ü Check the thermodynamic
Ø Andersen piston properties as a function of time.
q Structural properties:
Ø obtained from spatial correlation functions e.g. distribution functions
(RDF, S(Q), Van-Hove, ...).
q Dynamical Properties:
ØTime dependent properties (MSD, diffusion coefficients) obtained via
temporal correlation functions e.g. velocity autocorrelation function,
atomic displacements.
1 N -1 N ! !
v Pressure PV = Nk BT - åå rij × f ij
3 i =1 j >i
3 2 2 3 Nk B
v Specific Heat d (Uc ) NVE = Nk B T (1 -
2
)
2 2Cv
Al80Ni20
¥ sin( kr )
S ( k ) = 1 + 4p r ò (g (r ) - 1) r 2 dr
0 kr
Ø Structure Factor (experiments)
Summer School, June 25-28, 2018
Dynamical properties
MSD: Mean Square Displacement (Einstein relation)
1
2 Dt = | ri (t ) - ri (0) |2
3
! !
MSD = cAl (rs, Ni (t ) - rs, Ni (0))2
! !
+ cNi (rs, Al (t ) - rs, Al (0))2
Diffusion constants
1 N
(r(t) - r(0))2
D = lim
t ®¥ N
å 6t
i=1
q Glasses:
Questions:
Ø crystal growth & accurate estimation of Tm? Ø Frenkel J., Phys. Z.
Ø solid-liquid interface velocity from interface motion? Sowjetunion, 1 (1932)
Ø kinetic coefficients and their anisotropy? 498.
Ø solid-liquid interface motion controlled by mass diffusion? Ø Wilson H.A., Philos.
Mag. , 50 (1900) 238.
Ø solid-liquid coexistence, interface structure?
Ø how to distinguish between solid-like & liquid-like particles?
Tm = ?
Ø binary alloys: glass formers.
Ø crystallization: process too slow
Ø brute force method:
q How to study crystallization? not appropriate to estimate TM
T >TM :
Melting
T =TM :
coexistence
T <TM :
crystallization
q Coexistence
Summer School, June 25-28, 2018
Crystallization of AlNi at 1400 K
Wilson-Frenkel theory:
activated process controlled by
mass diffusion in the liquid phase
Mass transport and particle density across Wilson H.A. Philos. Mag. , 50 (1900) 238.
Frenkel J., Phys. Z. Sowjetunion, 1 (1932) 498.
the solid-liquid interface A. Kerrache et al. EPL, 2008.
Crystal growth: controlled by mass transport
in the liquid phase and solid-liquid interface Experimental data?
q Glasses:
bulk particles
with a fixed shear velocity vs
Ø integrate the equation of motion of
the mobile particles.
Ø equilibration for 5 ns: fixed walls
Ø periodic boundary conditions fixed
in y direction.
q Temperature: lower wall
rescaling the velocities using the Typical starting configuration of s-Si
y and z components
300 K 600 K
Number of
crystalline
particles
900 K 1000 K
q Glasses:
Fixed layer
LAMMPS
Large-scale Atomic / Molecular Massively
Parallel Simulator
Source: some material and images were adapted from LAMMPS home page
Ø Granular Flow
Ø Material Science
Ø Chemistry
MD to LAMMPS Contribute to
Wish list Unfixed bugs Benchmarks Visualization Open source
glossary LAMMPS
q Code Layout
Ø C++ and Object-Oriented approach
Ø Parallelization via MPI and OpenMP; runs on GPU.
Ø is invoked by commands through input scripts.
Ø possibility to customized output.
Ø could be interfaced with other codes (python, …): library.
Ø possibility to contribute to LAMMPS: potential, fixes, …
Ø Distributions:
Build LAMMPS
üDownload a tarball
from source
üGit checkout and update
üSVN checkout and update
üPre-built Ubuntu executables
üPre-built binary RPMs for Fedora/RedHat/CentOS/openSUSE
üPre-built Gentoo executable
üOS X with Homebrew
üWindows installer package
üApplying patches
Old version
Current version is: 13 Mar 2018
Archive: lammps-stable.tar.gz
Alternatively, use wget from your terminal:
Ø wget http://lammps.sandia.gov/tars/lammps-stable.tar.gz
Ø wget http://lammps.sandia.gov/tars/lammps-11May18.tar.gz
q Configuration:
ü ./configure --prefix=/home/$USER/software … options
ü cmake .. --DCMAKE_INSTALL_PREFIX=/home/$USER/software
ü ./setup or other provided scripts
q Installation:
ü make install
2. cp -r lammps-16Mar18 build-lammps-16Mar18
3. cd build-lammps-16Mar18/src && make clean-all
4. source ../../get_lammps_dependencies.sh
5. make icc_openmpi
6. make clean-all
7. make yes-voro++
8. Change the Makefile: Makefile.icc_openmpi
9. Recompile: make icc_openmpi
q As an interactive job:
Ø mpirun -np 16 lmp_machine -in in.alloy
Ø mpiexec -n 4 lmp_machine < in.alloy
q As a submitted job (Torque, SLURM, …):
Ø mpiexec lmp_machine < in.alloy > my.log
Ø mpirun lmp_machine < in.alloy > my.log
Ø srun lmp_machine < in.alloy > my.log
units lj
Define units
atom_style atomic
Store the
dump id all atom 50 dump.melt
#dump_modify …. trajectory
log log.melt
Log file:
thermo_style custom step temp etotal ….
customize output
thermo 50
Run the simulation
run 250
for N steps
# End of the simulation.
Ø Parameters: set parameters that need to be defined before atoms are created:
units, dimension, newton, processors, boundary, atom_style, atom_modify.
q Example:
thermo_style custom step temp press pe ke etotal density lx ly lz
v Example:
Ø dump myDump all atom 100 dump.atom
Ø dump 2 subgroup atom 50 dump.run.bin
q Simulation: LJ Melt
q Exercise:
q Resources:
Ø Online Manual: http://lammps.sandia.gov/doc/Manual.html
Ø Search the mailing list: http://lammps.sandia.gov/mail.html
Ø Mailing List:
https://sourceforge.net/p/lammps/mailman/lammps-users/