MD Bringa Comahue 2012 2 Basics

Embed Size (px)

Citation preview

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    1/33

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    2/33

    Outline

    • Introduction:

    a) Why do we need classical atomistic simulations?

    b) Where does molecular dynamics (MD) fit in the simulation map?

    •Atomistic Simulations:

    a) What is MD?

    b) What can MD do for you? What can you do to make it faster?

    c) Caveats?d) Future perspective

    • MD code

    • Auxiliary code: Viz and data analysis.• Summary and conclusions

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    3/33

    Herramientas de simulación: nano a macro

    Dzwinel W, Alda W, Kitowski J, Yuen DA,Molecular Simulation, 20/6, 361-384 (2000)

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    4/33

    "everything that living things docan be understood in terms of the jiggling and wiggling of atoms."

    Six Easy Pieces (1963, Addison–Wesley, Reading,MA)

    http://www.its.caltech.edu/~feynman/plenty.html

    "Plenty of Room at the Bottom“ (1959)

    Richard Feynman and the nanoscale

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    5/33

    Ejemplo: Nanocrystales (nc) tienen propiedades macro interesantes,

    incluyendo extrema dureza, debido a escala nano

    Extensibilidad

    superplastica

    ncCu (28 nm) Lu et al, Science (2000)

    ~100 nm grainsdε /dt=5 10-6 /s

    Mas fuerte y ~ elastoplasticidad

    perfecta Champion et al, Science (2003)

    Ingrediente crucial en

    comportamiento de nc:

    la fraction de bordes de grano es

    (GB) muy alta

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    6/33

    Outline

    • Introduction:

    a) Why do we need classical atomistic simulations?

    b) Where does molecular dynamics (MD) fit in the simulation map?

    • Classical Atomistic Simulations:

    a) What is MD?

    b) What can MD do for you? What can you do to make it faster?

    c) Caveats?d) Future perspective

    • MD code

    • Auxiliary code: Viz and data analysis.• Summary and conclusions

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    7/33

    Una herramienta muy útil para estudiar materiales:

    Dinámica Molecular clásica =Molecular Dynamics=MD

    i

     j

    k

    F ji

    F jk 

    Fij

    FkjFki

    Fik 

    • N partículas clásicas. Partícula i con posición ri, tiene velocidad viy aceleración ai.

    • Partículas interactúan a través de un potencial empírico,V ( r1 ,.., ri ,.., r N ), que generalmente incluye interacciones de muchos

    cuerpos.

    • Partículas obedecen las ecuaciones de movimiento de Newton.Partícula i, masa mi:  Fi = -∇iV ( r1 ,.., ri ,.., r N )= mi ai = mi (d 

    2 ri /dt 2)

    • Volumen

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    8/33

    •M. P. Allen, D. J. Tildesley (1989) Computer simulation of liquids. Oxford UniversityPress. ISBN 0-19-855645-4.

    •William Graham Hoover (1991) Computational Statistical Mechanics, Elsevier, ISBN 0-

    444-88192-1.

    •D. C. Rapaport (1996) The Art of Molecular Dynamics Simulation. ISBN 0-521-44561-2.

    •J. M. Haile (2001) Molecular Dynamics Simulation: Elementary Methods. ISBN 0-471-

    18439-X

    •Andrew Leach (2001) Molecular Modelling: Principles and Applications. (2nd Edition)Prentice Hall. ISBN 978-0582382107.

    •Tamar Schlick (2002) Molecular Modeling and Simulation. Springer. ISBN 0-387-95404-X.

    •Frenkel, Daan; Smit, Berend (2002) [2001]. Understanding Molecular Simulation : fromalgorithms to applications . San Diego, California: Academic Press. ISBN 0-12-267351-4.

    • Many more ….

    General references(http://en.wikipedia.org/wiki/Molecular_dynamics)

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    9/33

    Need to be extremely careful about applicability of classical MD

    • Generally assumes Born-Oppenheimer approximation works.

    •The corresponding de Broglie wavelength, proportional to(Mass Temperature)-1 has to be much smaller than the mean atomicseparation, i.e. try to avoid light elements and low temperatures ☺

    •One should avoid phase transitions driven by electronic effects, likemetal-insulator transitions, magnetic transitions, etc.

    •One should avoid regions where electronic excitations could arise andplay an important role in the evolution of the system.

    Pushing the limits of validity one can sometimes obtain resultsresembling experiments, but possibly for the wrong reasons ☺

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    10/33

    • Microcanonical: NVE

    • Canonical: NVT. Many different schemes not necessarily giving the correctthermodynamic behavior: Nosé, Nosé-Hoover, Andersen, Berendsen,

    Langevin, etc.• Constant pressure: NP vary box size to adjust system pressure. Can beanisotropic.

    • Combinations: NPT, NPH, etc. could also have grand-canonical.

    • Generalized ensembles: Replica-exchange, etc.

    • Choosing the wrong ensemble can mask the true nature of the problemand give artificial results.

    • REMEMBER: electronic heat conduction is not included, unless I usesomething like a Two-Temperature model (TTM) coupled to MD. ☺

    Need parameters to ensure proper integration,

    i.e. critical damping of box volume oscillations,“viscosity” in Langevin scheme, etc.

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    11/33

    Time averages over a trajectory

    are equivalent to ensemble averagescan use MD to study statistical mechanics of a system.

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    12/33

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    13/33

    Time Evolution: Energy Drift

    • Energy conserved if integrating within the NVE ensemble. However …

    • Possible causes for energy drift: integrator + computational errors.

    • (a) Integrator with finite ∆t leads to “perturbed” Hamiltonian. Deviationcan be modeled by diffusive drift and depend on the size of the timestep. Need to test to make sure that I am using a time step smallenough to obtain deviations smaller than ~0.5% in the total energy

    along the entire simulation time.

    • Simulations far from equilibrium: collisions, waves, etc., have to usevariable time step schemes, based on velocity and force evaluations toensure energy conservation.

    • (b) Numerical errors: (i) errors in the evaluation of the energyfunctional + (ii) round-off could lead to still more deviations. (i) Becareful with potential radius cut-off. (ii) Need to use double precision.

    For smaller errors have to use special variables with higher precision.

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    14/33

    How do we simulate a large number of atoms?

    • Integrating the two body problem is one thing …. But integrating themotion of N particles, with N=(several million-billions) is a wholedifferent ball game.

    • Short-range potentials (not 1/r): use an appropriate cut-off and dospatial decomposition of the domain. This will ensure nearly perfectparallel scaling [O(N)]. Sometimes a VERY long cut-off is used for (1/r)

    potentials, with varying results.• Long-range potentials (1/r): old method uses Ewald summation.New methods (PME,PPPM=P3M, etc.) are typically O(NlogN). Evennewer methods (variations of multipole expansion) can be O(N), at the

    price of a large computational overhead. This is the same as theproblem of N-body simulations used in astrophysics.

    • Have to be careful with boundary conditions (free, periodic,expanding, damping, etc.) and check for system size effects.

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    15/33

    Alejandro Strachan, http://nanohub.org/resources/5838#series

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    16/33

    Alejandro Strachan, http://nanohub.org/resources/5838#series

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    17/33

    Potentials (Physics) or Force Fields (Chemistry/Biology)

    • Empirical functionals that represent the energy of thesystem as a function of atomic positions, angles, etc.

    • Functional form sometimes based on theoreticalconsiderations: ab-initio, tight binding, etc..

    • Complexity limited by computational cost.

    • Fit to theoretical results, experiments, or a mixture of both.

    • Validity depends strongly on type of fit, which canemphasize a certain property, temperature/pressure range,

    structure, etc.• They are often non-transferable

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    18/33

    Interatomic potentials (Physics’ viewpoint)

    Adapted from D. Brenner’s web sitehttp://www.mse.ncsu.edu/CompMatSci/Tutorial/listing.html

    Lennard-Jones

    coulomb

    Tersoff

    Embedded-Atom

    http://lammps.sandia.gov/doc/pair_style.html

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    19/33

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    20/33

    A typical FF

    http://en.wikipedia.org/wiki/Force_field_chemistry

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    21/33

    Compile mdtot.c with desired options

    to obtain executable

    Execute

    (interactive/not interactive)

    Final-2:

    calculate different

    quantities: sputtering yield

    for this particular run, save

    final configuration ifneeded, etc.

    Setup-1:

    Initialize arrays. Convert different units to MD

    units. Open input/output files.

    Iterations = 0

    iterations+1

    Setup-2:

    Initial positions velocities of atoms, etc.

    Time=0

    Final-1:

    Average different

    calculated quantities, like

    sputtering yield, etc. Save

    important data. Close files.

    YES

    NO

    MD-Step:

    Calculate DeltaT

    Time=time+DeltaT

    Input file:Total number ofiterations=

    Max-itera

    Total time/iteration=

    time-End

    iterations

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    22/33

    With MD you can obtain….

    “Real” time evolution of your

    system.Thermodynamic properties,

    including T(r,t) temperature

    profiles that can be used in

    rate equations.Mechanical properties,

    including elastic and plastic

    behavior.

    Surface/bulk/cluster growth

    and modification.

    X-ray and “IR” spectra

    Etcetera …

    •Can simulate only small samples

    (L

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    23/33

    The cost of running atomistic simulations

    L

    fcc lattice, L~30 monolayers⇒ 105 atoms

    Speed of typical MD code (short range

    force field) is ~5 10-6 s/(atom*time step)

    Time step~ 10-15 s⇒ 10-11 s= 104 steps

    1 iteration:

    50 10-6 *105*104 = 5 104 s ~ 14 hours

    20 iterations:

    Need statistics ….

    Total time ~ 12 days (in single core)

    But MD is very

    costly …

    Models, MD orMC simulations

    Limited

    Experimental Data

    Extrapolate to regions

    of interest

    New Models and

    predictions

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    24/33

    How much does classical MD cost?(very rough estimate for short range potentials)

    Nsteps=number of time steps; N=total number of atoms.Rcut=potential cut-off; Ncut=number of atoms within Rcut. Can influence timing.F=cost of evaluating forces for a given atompotential dependent: if FLJ=1 FEAM~3, FAIREBO~50, FREAXFF~300

    COST ∝∝∝∝ F Nsteps f(N)  ∝∝∝∝ F Nsteps f(N)

    Serial codes:No neighbor list f(N) ∝∝∝∝ N2 (Only practical for N

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    25/33

    Algunas aéreas de simulación donde se necesitan

    urgentes contribuciones matemáticas• Técnicas multi-escala temporales: dinámica ficticia, “rare events”, etc.

    • Técnicas multi-escala espaciales: problemas de frontera y acoplamiento

    entre escalas, incluyendo problemas “estáticos” y dinámicos.

    • Inestabilidades y fragmentación: RT, RM, Euler, parámetros de orden, etc.

    • Medios desordenados: estructura, plasticidad y viscosidad en vidrios y

    medios porosos.

    • Propagación de ondas en medios no homogéneos, con propiedades no-

    lineales y posibles cambios de fase.

    • Métodos de minimización (energía, funciones potencial, intercambio decarga, etc.) y para hallar “caminos de reacción”

    • Data mining en archivos de TBs: como encontrar la aguja en el pajar.

    • Como graficar en paralelo y con interfaces “amigables”.

    • Nuevos algoritmos eficientes en paralelos para problemas mucho mascomplejos que los que se resuelven muy bien en sistemas pequeños en serie:

    Monte Carlo, métodos de minimización, interacciones de largo alcance, FFT,

    códigos CFD, etc.

    Algún voluntario?

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    26/33

    Future of MD• Sample size: in 10 years, ~tens of µµµµm, but most simulations still sub-µµµµm.

    •More/better hybrid codes to extend time and length scales: MD+MC, MD+kMC,

    MD+DD, MD+continuum, MD+BCA, MD+TB, MD+CPMD, …

    •Time scale problem: new algorithms to extend time scale and simulate thermal

    evolution.

    • Better description of electronic effects by:

    I) Physics + Chemistry + Biology “reactive” potentials that are accurate and

    efficient for full periodic table.

    II) coupling to CPMD, tight-binding, etc. (TDDFT?)III) TTM, Ehrenfest dynamics, inclusion of magnetic effects, etc.

    Major roadblocks:

    • Computers are becoming faster and larger, but algorithms for long range potentials

    (biology & oxides), ab-initio and continuum simulations typically do not scale wellbeyond couple thousand CPUs expect better results within the next 10 years.

    • No set recipes to build better potentials, specially if chemistry (reactive potentials) or

    electronic effects (potentials for excited states, etc.) are involved.

    • Nobody knows yet what to do to solve the time scale problem beyond some simple

    model problems.

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    27/33

    Coupling TIME and length scales ….

    • Choose set of parameters from MD, save those

    parameters and “pass” them to a “higher” level code.

    Example: calculate defect concentrations as the initialconfiguration for a kinetic Monte Carlo code.

    • Use some accelerated technique, which boost the time

    step, for instance “TAD” by A. Voter (LANL). Very

    expensive computationally, practical only for “2D”

    simulations or small 3D simulations.

    • Several people are currently working on improving this

    situation … Keep tuned!

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    28/33

    Outline

    • Introduction:

    a) Why do we need classical atomistic simulations?

    b) Where does molecular dynamics (MD) fit in the simulation map?

    • Classical Atomistic Simulations:a) What is MD?

    b) What can MD do for you? What can you do to make it faster?

    c) Caveats?d) Future perspective

    • MD code

    • Auxiliary code: Viz and data analysis.

    • Summary and conclusions

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    29/33

    Many MD codes are availableOften used as black-boxes without understanding limitations

    AMBER ( Assisted Model Building with Energy Refinement ): http://ambermd.org/gpus/ 

    Ross Walker (keynote). MPI for several GPUs/cores. TIP3P, PME, ~106 atoms max Tesla C2070)

    LAMMPS ( Large-scale Atomic/Molecular Massively Parallel Simulator ):

    http://lammps.sandia.gov/  . MPI for several GPUs/cores (LJ: 1.2 ~107 atoms max Tesla C2070)

    DL_POLY:

    http://www.cse.scitech.ac.uk/ccg/software/DL_POLY/  F90+MPI, CUDA+OpenMP port.

    GROMACS : http://www.gromacs.org/Downloads/Installation_Instructions/Gromacs_on_GPUs

    Uses OpenMM libs (https://simtk.org/home/openmm). No paralelization. ~106 atoms max.

    NAMD(“ Not another” MD): http://www.ks.uiuc.edu/Research/namd/ GPU/CPU clusters.

    VMD (Visual MD): http://www.ks.uiuc.edu/Research/vmd/ 

    1,000,000+ atom Satellite Tobacco Mosaic Virus

    Freddolino et al ., Structure , 14:437-449, 2006.Many more!!!!

    http://en.wikipedia.org/wiki/Molecular_dynamics

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    30/33

    Many MD codes can now use GPU acceleration

    AMBER ( Assisted Model Building with Energy Refinement ): http://ambermd.org/gpus/ 

    Ross Walker (keynote). MPI for several GPUs/cores. TIP3P, PME, ~106 atoms max Tesla C2070)

    HOOMD-Blue ( Highly Optimized Object-oriented Many-particle Dynamics):

    http://codeblue.umich.edu/hoomd-blue/index.html OMP for several GPUs in single board.

    LAMMPS ( Large-scale Atomic/Molecular Massively Parallel Simulator ):

    http://lammps.sandia.gov/  . MPI ofr several GPUs/cores (LJ: 1.2 ~107 atoms max Tesla C2070)

    GPULAMMPS: http://code.google.com/p/gpulammps/  CUDA + OpenCL

    DL_POLY:

    http://www.cse.scitech.ac.uk/ccg/software/DL_POLY/  F90+MPI, CUDA+OpenMP port.

    GROMACS : http://www.gromacs.org/Downloads/Installation_Instructions/Gromacs_on_GPUs

    Uses OpenMM libs (https://simtk.org/home/openmm). No paralelization. ~106 atoms max.

    NAMD (“ Not another” MD): http://www.ks.uiuc.edu/Research/namd/ 

    GPU/CPU clusters.

    VMD (Visual MD): http://www.ks.uiuc.edu/Research/vmd/ 

    GTC 2010 Archive: videos and pdf’s: http://www.nvidia.com/object/gtc2010-presentation-archive.html#md

    1,000,000+ atom Satellite Tobacco Mosaic Virus

    Freddolino et al ., Structure , 14:437-449, 2006.Many more!!!!

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    31/33

    LAMMPS (http://lammps.sandia.gov/ )

    Some of my personal reasons to use LAMMPS:

    1) Free, open source (GNU license).

    2) Easy to learn and use:

    (a) extensive docs :http://lammps.sandia.gov/doc/Section_commands.html#3_5

    (b) mailing list in sourceforge.

    (c) responsive developers and user community.

    3) It runs efficiently in my laptop (2 cores) and in BlueGeneL (100 K cores),including parallel I/O, with the same input script. Also efficient for GPUs.

    4) Very efficient parallel energy minimization, including cg & FIRE.

    5) Includes many-body, bond order, & reactive potentials. Can simulate

    inorganic & bio systems, granular and CG systems.

    6) Can do extras like DSMC, TAD, NEB, TTM, semi-classical methods, etc.

    7) Extensive set of analysis routines: coordination, centro, cna, etc.

    8) Easy to write analysis inside input, using something similar to pseudo-code.

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    32/33

    Visualization tools (que uso yo)

    • PovRay (http://www.povray.com ): up

    to few million atoms, very fancy, not

    interactive

    • Rasmol

    http://www.umass.edu/microbio/rasmol

    up to few tens of millions of atoms, very

    fast, not fancy but interactive

    • LibGen, by M. Duchaineau (LLNL),

    http://www.cognigraph.com/LibGen

    viz + analysis tools, including parallelexecution, interactive tools, etc.

    • VMD, TecPlot, GnuPlot, Origin, etc.

  • 8/16/2019 MD Bringa Comahue 2012 2 Basics

    33/33

    Resumen y perspectivas futuras

    • Termodinámica y mecánica estadísticaequilibrio muy “robusta”, incluyendo

    situaciones con pocos átomos y no

    estacionarias.• Nuevos diagnósticos ultra-rápidos

    permitirán explorar nuevas regiones del

    espacio de las fases, con simulaciones a

    escala similar.

    • Nuevas computadoras, junto a nuevos

    programas y modelos, permitirán una

    comparación directa entre simulacionesatomísticas y experimentos. Utilización de

    GPUs en cálculos de clusters o sistemas

    relativamente pequeños.