moldyn

download moldyn

of 62

Transcript of moldyn

  • 7/29/2019 moldyn

    1/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 1 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1) Molecular Dynamics Simulation

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 2of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.1. Introduction

    Remember what Scientific Computing deals with:From phenomena to predictions!

    phenomenon, process etc.

    mathematical modelc

    modelling

    numerical algorithmc

    numerical treatment

    simulation codec

    implementation

    results to interpretc

    visualization

    %

    rrrrj embedding

    statement tool

    E

    E

    E

    va

    li

    da

    t

    ion

  • 7/29/2019 moldyn

    2/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 3of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Overview

    modelling aspects of molecular dynamics simulations:

    why to leave the classical continuum mechanics point of view?

    where appropriate?

    which models, i.e. which equations?

    numerical aspects of molecular dynamics simulations?

    how to discretize the resulting modelling equations?

    efficient algorithms?

    implementation aspects of molecular dynamics simulations?

    suitable data structures?

    parallelisation?

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 4of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Hierarchy of Models

    Different points of view for simulating human beings:

    issue level of resolution model basis (e.g.!)global increasein population

    countries, regions population dynamics

    local increase in

    population

    villages, individuals population dynamics

    man circulations, organs system simulatorblood circulation pump/channels/valves network simulatorheart blood cells continuum mechanicscell macro molecules continuum mechanicsmacromolecules

    atoms molecular dynamics

    atoms electrons or finer quantum mechanics

  • 7/29/2019 moldyn

    3/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 5of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Scales an Important Issue

    length scales in simulations:

    from 109m (atoms)

    to 1023m (galaxy clusters)

    time scales in simulations: from 1015s

    to 1017s

    mass scales in simulations:

    from 1024g (atoms)

    to 1043g (galaxies)

    obviously impossible to take all scales into acount in an explicit

    and simultaneous way first molecular dynamics simulations reported in 1957

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 6of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Applications for Micro and Nano Simulations

    Lab-on-a-chip, used in brewing technology (Siemens)

  • 7/29/2019 moldyn

    4/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 7of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Applications for Micro and Nano Simulations

    Flow through a nanotube (where the assumptions of continuummechanics are no longer valid)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 8of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Applications for Micro and Nano Simulations

    Protein simulation: actin, important component of muscles (overlayof macromolecular model with electron density obtained by X-ray

    crystallography (brown) and simulation (blue))

  • 7/29/2019 moldyn

    5/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 9of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Applications for Micro and Nano Simulations

    Protein simulation: human haemoglobin (light blue and purple:alpha chains; red and green: beta chains; yellow, black, and darkblue: docked stabilizers or potential docking positions for oxygen)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 10of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Applications for Micro and Nano Simulations

    Material science: hexagonal crystal grid of Bornitrid

  • 7/29/2019 moldyn

    6/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 11 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    A Prominent Recent Example:

    Gordon-Bell-Prize 2005 (most important annual supercomput-ing award)

    phenomenon studied: solidification processes in Tantalum andUranium

    method: 3D molecular dynamics, up to 524,000,000 atoms sim-ulated

    machine: IBM Blue Gene/L, 131,072 processors (worlds #1 inNovember 2005)

    performance: more than 101 TeraFlops (almost 30% of thepeak performance)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 12of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.2. Essentials from Continuum Mechanics

    Fluids

    fluid: notion covering liquids and gases

    liquids: hardly compressible

    gases: volume depends on pressure

    small resistance to changes of form continuum:

    space, continuously filled with mass

    homogeneous

    subdivision into small fluid voxels with constant physicalproperties is possible

    idea valid on micro scale upward (where we consider con-tinuous masses and not discrete particles)

  • 7/29/2019 moldyn

    7/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 13of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Lagrange and Euler Formulation

    Lagrange formulation:

    considers the change of position of material particles

    example: velocities of material particles

    typical for structural dynamics

    Euler formulation:

    considers a fixed point in space

    example: velocity field, describing the velocities of virtualparticles at fixed positions

    typical for fluid mechanics

    Arbitrary Lagrangean Eulerian (ALE) formulation:

    refers to an arbitrary configuration

    example: a particle, moving with its own system of refer-ence through a fluid, having a fixed system of reference

    widely used in fluid-structure interactions

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 14of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Description of State

    consideration of a control volume V0 (Eulerian perspective)

    description of the fluids state via

    the velocity field v(x, t) and two thermodynamical quanti-ties, typically

    the pressure p(x, t) and

    the density (x, t)

    for incompressible fluids, the density is constant (if there areno chemical reactions)

  • 7/29/2019 moldyn

    8/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 15of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Hard Sphere Model

    first, atoms are described in a simplified way

    as suspended round disks in 2D space, or

    as suspended round balls in 3D space

    this is called the hard sphere model the fixed (and rather dense) arrangement in a crystal leads to a

    solid

    for gases, the average distances between particles are verylarge

    atoms and molecules of liquids do not have a fixed arrange-ment, but the density compared with gases is higher

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 16of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Solids in 2D

    D

    3D

    D

    the maximum density in 2D comes with a triangu-lar packing

    an ideal crystal without thermal motion provides aperfect 2D grid

    the elementary cell for disks of diameter D forms

    a rhombus of areaAE = 2 12 D

    123D = 1

    23D2 0.866D2

    in an elementary cell, there are parts that can becombined to a complete disk:AP =

    4 D

    2 0.785D2

    density Cm = APAE =4D2

    12

    3D2

    = 6

    3 0.9069

  • 7/29/2019 moldyn

    9/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 17of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Solids in 3D

    D2D

    2D

    fill a box with balls of diameter D

    periodic arrangement is neither formed automati-cally nor unique

    face-centered cubic (fcc) lattice with basis vectorscycl2

    2D 2

    2D 0

    elementary cell: brick,

    VE =

    2D3

    = 2

    2D3 2.828D3 VP =

    6 1

    2+ 8 1

    8

    6

    D3 = 23

    D3 2.094D3

    Cm =VPVE

    =23D3

    2

    2D3=

    6

    2 0.7405

    VE = volume of elementary cell

    VP = volume of atoms

    Cm = maximum density ratio

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 18of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Fluids

    intermediate states for the transition solid-liquid:

    plasticity: irreversible deformation of the crystal lattice alonggliding planes

    thixotropy: liquid state after destruction of frame-like ag-glomerations of molecules

    for C0 0.8 the disks can escape from their positions 2Dliquid without a periodic crystal lattice; average distance of twoparticles: O(D)

    gases: smaller densities (C C0) with an average distance ofO( D

    C)

    C = density ratio of material to reference cell volume

  • 7/29/2019 moldyn

    10/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 19of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Scope of Application

    number of molecules to be taken into account:

    Loschmidt number 2, 687 1019cm3: number of moleculesin 1 cm3 of an ideal gas

    Avogadro constant 6.02214151023mol1: number of carbon-

    12 atoms in 12g of carbon-12, or number of molecules in 1mol (1 mol, under normal conditions, taking a volume of22.4 litres)

    Avogadro number: notion being used in different ways forboth of the above constants, which depend on each other(2, 687 1019cm3 22.413996 103cm3mol1 = 6.0221415 1023mol1)

    time steps for numerical simulations are typically in the or-der of femtoseconds (1f s := 1015s)

    hence: scope of application is limited to nanoscale simulations(at least for the near future)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 20of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.3. Molecular Dynamics the Physical Model

    Quantum Mechanics a Tour de Force

    particle dynamics described by the Schrdinger equation

    its solution (state or wave function ) only provides probabilitydistributions for the particles (i.e. nuclei and electrons) positionand momentum

    Heisenbergs uncertainty principle: position and momentum cannot be measured with arbitrary accuracy simultaneously

    there are discrete values/units (for the energy of bonded elec-trons, e.g.)

    in general, no analytical solution available

    high dimensional problems: dimensionality corresponds to num-ber of nuclei and electrons

    = (R1, . . . , RN, r1, . . . , rK, t) - wave functionR - position of nucleusr - position of electront - time

  • 7/29/2019 moldyn

    11/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 21 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    hence, numerical solution is possible for rather small systemsonly

    therefore, various (simplifying and approximating) approachessuch as density functional method or Hartree-Fock approach(ab-initio Molecular Dynamics, see next slide)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 22of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Classical Molecular Dynamics

    Quantum mechanicsapproximation classical Molecular Dynamics

    classical Molecular Dynamics is based on Newtons equationsof motion

    molecules are modelled as particles; simplest case: point masses

    there are interactions between molecules multibody potential functions describe the potential energy of

    the system; the velocities of the molecules (kinetic energy) area composition of

    the Brownian motion (high velocities, no macroscopic movement),

    flow velocity (for fluids)

    ab-initio Molecular Dynamics uses quantum mechanical cal-culations to determine the potential hypersurface, apart from

    semi-empirical potential functions (cf. Car Parrinello MolecularDynamics (CPMD) methods)

    total energy is constant energy conservation

  • 7/29/2019 moldyn

    12/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 23of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Fundamental Interactions

    Classification of the fundamental in-teractions:

    strong nuclear force

    electromagnetic force weak nuclear force

    gravity

    O

    rk

    ri

    rj

    interaction potential energy the total potential of N particles is the sum of multibody poten-

    tials:

    U := 0

  • 7/29/2019 moldyn

    13/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 25of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Well-Known Potentials

    i j

    rij

    some potentials from mechanics:

    harmonic potential (Hookes law): Uharm (rij) = 12 k (rij r0)2;potential energy of a spring with length r0, stretched/clinchedto a length rij

    gravitational potential: Ugrav (rij) = g mimjrij ;potential energy caused by a mass attraction of two bodies(planets, e.g.)

    the resulting force isFij = gradU(rij) =

    U

    rijintegration of the force over the displacement results in the energy or a potential

    difference

    Newtons 3rd law (actio=reactio):Fij = Fji

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 26of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Intermolecular Two-Body Potentials

    2

    1.5

    1

    0.5

    0

    0.5

    1

    1.5

    2

    0 0.5 1 1.5 2 2.5 3

    potentialU

    distance r

    hard sphere potentials

    hard sphereSquarewell

    Sutherland

    2

    1.5

    1

    0.5

    0

    0.5

    1

    1.5

    2

    0 0.5 1 1.5 2 2.5 3

    potentialU

    distance r

    soft sphere potentials

    soft sphereLennardJonesvan der Waals

  • 7/29/2019 moldyn

    14/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 27of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Intermolecular Two-Body Potentials

    hard sphere potential: UHS(rij) =

    rij d0 rij > d

    Force: Dirac Funktion

    soft sphere potential: USS (rij) = rijn

    Square-well potential: USW (rij) =

    rij d1 d1 < rij < d20 rij d2

    Sutherland potential: USu (rij) =

    rij dr6ij

    rij > d Lennard Jones potential

    van der Waals potential UW (rij) = 46

    1rij6

    Coulomb potential: UC (rij) = 140qiqjrij

    = energy parameter

    = length parameter (corresponds to atom diameter, cmp. van der Waals

    radius)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 28of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Lennard Jones Potential

    e s

    e,s

    O

    ri

    rj

    rij

    Lennard Jones potential: ULJ (rij) =

    rij

    n

    rij

    mwith n > m and = 1

    n

    m n

    n

    mm

    1

    nm

    continuous and differentiable (C), since rij > 0

    LJ 12-6 potential

    ULJ (rij) = 4

    rij

    12

    rij

    6 m = 6: van der Waals attraction (van der Waals potential) n = 12: Pauli repulsion (softsphere potential): heuristic application: simulation of inert gases (e.g. Argon)

    force between 2 molecules:Fij = U(rij)rij = 24rij

    2

    rij

    12 rij

    6 very fast fade away short range (m = 6 > 3 = d dimen-

    sion)

  • 7/29/2019 moldyn

    15/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 29of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    LJ Atom-Interaction Parameters

    e s

    atom [1.38066 1023J]1 [101nm]2

    H 8.6 2.81He 10.2 2.28C 51.2 3.35N 37.3 3.31O 61.6 2.95F 52.8 2.83

    Ne 47.0 2.72S 183.0 3.52Cl 173.5 3.35Ar 119.8 3.41Br 257.2 3.54Kr 164.0 3.83

    = energy parameter = length parameter (cmp. van der Waals radius)

    parameter fitting to real world experiments

    1 Boltzmann-constant: kB := 1.38066 1023 JK2 101nm = 1010m = 1 (ngstrm)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 30of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Dimensionsless Formulation

    using reference values such as , , reduced forms of the equationscan be derived and implemented transformation of the problem

    position, distancer :=

    1

    r (1a)

    timet

    :=

    1

    mt

    (1b)

    velocityv :=

    t

    v (1c)

    potential (atom-interaction parameters are eliminated!): U := U

    U

    LJ (rij) :=ULJ (rij)

    = 4

    r

    ij26

    r

    ij23

    (1d)

    U

    kin :=Ukin

    =1

    mv2

    2

    =v

    2

    2t2

    (1e)

    forceF

    ij :=Fij

    = 24

    2r

    ij26

    r

    ij23

    rij

    rij2

    (1f)

  • 7/29/2019 moldyn

    16/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 31 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Multi-Centered Molecules

    CA1 CA2

    CA

    CB1

    CB2

    CB

    FA1B1FA1B2

    FA2B1FA2B2

    FB1A1FB1A2

    FB2A1

    FB2A2

    FAB

    FBA

    molecules can be composed with multipleLJ-centers rigid bodies without internal degrees offreedom

    additionally: orientation (quarternions), an-gular velocity

    additionally: moment of inertia (principalaxes transformation)

    calculation of the interactions betweeneach center of one molecule to each centerof the other

    resulting force (sum) acts at the center ofgravity, additional calculation of torque

    MBS (Multi Body System) point of view: instead of moving multi-centered molecules, there is a holonomically constrained mo-tion of atoms (for a constraint to be holonomic it can be expressible as a function f(r,v,t) = 0)

    advantage: better approximation of unsymmetric molecules

    there is not necessarily one LJ center for each atom

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 32of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Mixtures of Fluids

    simulation of various components (molecule types)

    modified Lorentz-Berthelot rules for interaction of molecules ofdifferent types

    AB :=A + B

    2(2a)

    AB := aB (2b)with 1e.g. N2 + O2 = 1.007, O2 + CO2 = 0.979 . . .

    A A

    B B

    e ,sA A

    e ,sA A

    e ,sAB AB

  • 7/29/2019 moldyn

    17/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 33of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    NVT-Ensemble, Thermostat

    statistical (thermodynamics) ensemble: set of possible states a sys-tem might be in

    for the simulation of a (canonical) NVT-ensemble, the followingvalues have to be kept constant:

    N: number of molecules V: volume

    T: temperature

    a thermostat regulates and controls the temperature (the kineticenergy), which is fluctuating in a simulation

    the kinetic energy is specified by the velocity of the molecules:Ekin =

    12

    i miv

    2i

    the temperatur is defined by T = 23NkB

    Ekin(N: number of molecules, kB : Boltzmann-constant)

    simple method: the isokinetic (velocity) scaling:

    vcorr := vact mit =

    TrefTact

    further methods e.g. Berendsen-, NosHoover-thermostat

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 34of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Domain

    aa

    b

    b

    Periodic Boundary Conditions (PBC):

    modelling an infinite space, built from identical cells domain with torus topology

  • 7/29/2019 moldyn

    18/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 35of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Domain

    Minimum Image Convention (MIC):

    with PBC, each molecule and the associated interactionsexist several times

    with MIC, only interactions between the closest represen-tants of a molecule are taken into consideration

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 36of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.4. Molecular Dynamics the Mathematical Model

    System of ODE

    resulting force acting on a molecule: Fi =

    j=i Fij

    acceleration of a molecule (Newtons 2nd law):

    ir =Fimi

    =

    j=iFij

    mi= j=i

    U(ri,rj)

    |rij |mi

    (3)

    system of dN coupled ordinary differential equations of 2nd or-der transferable (as compared to Hamilton formalism) to 2dNcoupled ordinary differential equations of 1st order (N: number ofmolecules, d: dimension), e.g. independent variables q := r and pwith

    pi := miri (4a)

    pi = Fi (4b)

  • 7/29/2019 moldyn

    19/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 37of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Boundary Conditions

    Initial Value Problem:position of the molecules and velocities have to be given;initial configuration e.g.:

    molecules in crystal lattice (body-/face-centered cell) initial velocity

    * random direction

    * absolute value dependent of the temperature

    (normal distribution or uniform), e.g.32

    N kBT =12

    Ni=1 mv

    2i with vi := v0

    v0 :=

    3kBTm

    resp. v0 :=

    3Tt

    time discretisation: t := t0 + i t time integration procedure

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 38of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.5. MD Approximations and Discretization

    Euler Method

    Taylor series expansion of the positions in time:

    r(t + t) = r(t) + tr(t) +1

    2t2r(t) +

    ti

    i!r(i)(t) + . . . (5)

    (r, r, r(i)

    : derivatives)

    approximation of (5), neglecting terms of higher order of t, aswell as an analogous formulation of v(t) := r(t) with a(t) :=v(t) = r(t) =

    F(t)m

    leads to the explicit Euler method:

    v(t + t).

    = v(t) + t a(t) (6a)

    r(t + t).

    = r(t) + t v(t) (6b)

    implicit Euler method derivatives at the time step end:v(t + t) .= v(t) + t a(t + t) (7a)

    r(t + t).

    = r(t) + t v(t + t) (7b)

    (6a) in (7b) r(t + t) .= r(t) + tv(t) + t2a(t)

  • 7/29/2019 moldyn

    20/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 39of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Strmer Verlet Method

    the Taylor series expansion in (5) can also be performed fort: (Richardson extrapolation for = 1)

    r(t t) = r(t) tr(t) + 12

    t2r(t) +(t)i

    i!r(i)(t) + . . . (8)

    from (5) and (8) the classical Verlet algorithm can be derived:

    r(t + t) = 2r(t) r(t t) + t2r(t) + O(t4) 2r(t) r(t t) + t2a(t) (9)

    direct calculation of r(t + t) from r(t) and F(t)

    the velocity can be estimated with

    v(t) = r(t).

    =r(t + t)

    r(t

    t)

    2t (10)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 40of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Crank Nicolson Method

    explicit approximation (11a) for half step [t, t + t2

    ] inserted intoimplicit approximation (11b) for half step [t + t2 , t + t] gives forv (11c):

    v(t +t

    2) = v(t) +

    t

    2a(t) (11a)

    v(t + t) = v(t +t

    2 ) +t

    2 a(t + t) (11b)

    v(t + t) = v(t) +t

    2(a(t) + a(t + t)) (11c)

    alternative conversion to integral equation

    v(t + t) v(t) =t+tt

    a() d

    numerical integration with trapezoidal rule (11c) generalization with further subdivisions in subintervals leads to

    Runge Kutta methods. More force-evaluations necessary!

  • 7/29/2019 moldyn

    21/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 41 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Velocity Strmer Verlet Method

    The velocity Strmer Verlet method is a composition of a

    Taylor series expansion of 2nd order for the positions (5), and a

    Crank Nicolson method for the velocities (11c)

    r(t + t) = r(t) + tv(t) +t2

    2 a(t) (12a)

    v(t + t) = v(t) +t

    2(a(t) + a(t + t)) (12b)

    tt-Dt t+Dt tt-Dt t+Dt tt-Dt t+Dt

    r

    v

    F

    tt-Dt t+Dt

    Forward Euler r Force calculation Crank-Nicolson v

    memory requirements: (3 + 1) 3N(calculation of v(t + t) requires not only v(t), r(t + t) and F(t + t), but also F(t) and

    therefore 3 + 1 vector fields)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 42of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Dimensionless Velocity Strmer Verlet Method

    insertion of the equations (1) leads to:(r := r, v :=

    v, t2 := 2 m

    t2, r = 1

    mF := 1

    m

    F)

    r(t + t) = r(t) + v(t) +t2

    2F(t) (13a)

    v(t + t) = v(t) +t2

    2

    F(t) +t2

    2

    F(t + t) (13b)

    procedure:

    tt-Dt t+Dt tt-Dt t+Dt tt-Dt t+Dt

    r

    v

    F

    tt-Dt t+Dttt-Dt t+Dt

    Forward Euler r Forward Euler v Force calculation Backward Euler v

    1. calculate new positions (13a),partial velocity update: +t

    2

    2F(t) in (13b)

    2. calculate new forces, accelerations (computationally intensive!)3. calculate new velocities: +t22 F(t + t) in (13b)

    memory requirements: 3 3N

  • 7/29/2019 moldyn

    22/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 43of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Leapfrog Method

    for the Leapfrog method, the velocity calculations are shifted fora half time step with respect to the position calculations:

    v(t +t

    2

    ) = v(t

    t

    2

    ) + t a(t) (14a)

    r(t + t) = r(t) + t v(t +t

    2) (14b)

    tt-Dt t+Dt tt-Dt t+Dt tt-Dt t+Dt

    r

    v

    F

    t-Dt/2 t+Dt/2t-Dt/2 t+Dt/2 t-Dt/2 t+Dt/2 t-Dt/2 t+Dt/2

    tt-Dt t+Dt

    exact arithmetic: Strmer Verlet, Velocity Strmer Verlet and

    Leapfrog schemes are equivalent the latter two are more robust with respect to roundoff errors

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 44of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Leapfrog Method Thermostat

    for the Leapfrog method, the velocity calculations are shifted fora half time step with respect to the position calculations:

    v(t +t

    2) = v(t t

    2) + t a(t)

    r(t + t) = r(t) + t v(t +t

    2

    )

    t-Dt t+Dt t+Dt t-Dt t+Dt

    r

    v

    F

    tt-Dt t+Dt tt-Dt t+Dt tt-Dt t+Dt tt-Dt t+Dt tt-Dt t+Dt

    Thermostat

    an intermediate step may be introduced for the thermostat v(t) :=v(t+t2 )+v(tt2 )

    2to synchronize the velocity:

    vact(t) = v(t t

    2 ) +t

    2 a(t) (16a)

    v(t +t

    2) = (2 1)vact(t) + t

    2a(t) (16b)

  • 7/29/2019 moldyn

    23/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 45of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Multistep, Predictor Corrector Methods

    Multistep methods:

    results are stored for several time steps, which define a(polynomial) interpolant

    use the interpolant (extrapolation) for the integration

    initialization with single-step-methods

    increased memory requirements caused by storage of dataof previous steps data!

    Predictor Corrector methods:

    1. use explicit method to determine predictor values for t + t

    2. implicit method uses predictor values instead of the un-known ones for t + t

    3. increased computational effort!4. quality of the predictor step caused by the complex chaotic

    behaviour is often not very good

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 46of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Multi-Centered Molecules

    for multi-centered molecules, besides position r and velocitiesv, orientations qand angular velocities w have to be also calcu-lated

    candidate: explicit or implicit version of the Fincham Leapfrogrotational algorithm

    r,v,F using classical Leapfrog method additional orientation q, angular velocity w as well as angu-

    lar momentum j

    t-Dt/2 t+Dt/2t+Dt/2 t-Dt/2 t+Dt/2

    r

    v

    F,a

    tt-Dt t+Dttt-Dt t+Dt tt-Dt t+Dt tt-Dt t+Dt

    q

    t-Dt/2 t+Dt/2t+Dt/2 t-Dt/2 t+Dt/2j,w

    t

    t+Dt/2

  • 7/29/2019 moldyn

    24/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 47of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Evaluation of Time Integration Methods

    accuracy (not of great importance)

    stability

    conservation

    of phase space density (symplectic) of energy

    of momentum (especially with PBC (Periodic Boundary Conditions))

    reversibility of time

    use of resources:

    computational effort (number of force evaluations)

    maximum time step size

    memory usage

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 48of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Reversibility of Time

    time reversal for a closed system means

    a turnaround of the velocities and also momentums; posi-tions at the inversion point stay constant

    traverse of a trajectory back in the direction of the origin

    demand for symmetry for time integration methods

    + e.g. Verlet method

    - e.g. Euler method, Predictor Corrector methods

    contradiction with

    the H-theorem (increase of entropy, irreversible processes)?(Loschmidt objection)

    the second theorem of thermodynamics?

    reversibility in theory only for a very short time

    Lyapunov instability Kolmogorov entropy

  • 7/29/2019 moldyn

    25/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 49of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Lyapunov Instability

    Example of a simple system:

    stable case:jumping ball on a plane with slightly disturbed initial hori-zontal velocity

    linear increase of the disturbance

    instable case:jumping ball on a sphere with slightly disturbed initial hor-izontal velocity exponential increase of the disturbance(Lyapunov exponent)

    for the instable case, small disturbances result in large changes:chaotic behaviour (butterfly hurricane?)

    non-linear differential equations are often dynamically instable

    calculation of the trajectories: badly conditioned problem;

    a small change of the initial position of a molecule may result ina distance to the comparable original position, after some time,in the magnitude of the whole domain!

    there are also conserved quantities for whichnumerical simulations make sense!

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 50of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Lyapunov Instability: A Numerical Experiment

    setup of 4000 fcc atoms

    for a second setup, the position of a singleatom was changed with a displacement of0.001

    tracing the movement of the atom for bothsetups, the distance increases for eachstep

    colours indicate velocity

    2.53

    3.54

    4.55

    5.57.1

    7.2

    7.3

    7.4

    7.5

    7.6

    7.7

    3.5

    3.6

    3.7

    3.8

    3.9

    4

    tracing a Molecule (with initial displacement)

    Molecule 25, run1

    Molecule 25, run2

    4.1

    0

    0.05

    0.1

    0.15

    0.2

    0.25

    0.3

    0.35

    0.4

    0.45

    0.5

    2.5 3 3.5 4 4.5 5 5.5

    Molecule deviation (with initial displacement)

  • 7/29/2019 moldyn

    26/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 51 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Short-Range Potential

    choosing m = 6 (negative exponent in the LJ-potential) fast decay of po-tential and force

    for each molecule, an influence volume (closed sphere) withcut-off radius rc (Euclidian metrics) can be assumed where ev-

    ery molecule outside this influence volume is neglected

    ULJ,rc

    rij

    =

    4

    rij26 rij23 for rij rc

    0 for rij > rc(17a)

    Fij,rc

    rij

    =

    24

    2

    rij26 rij23 rijrij2 for rij rc

    0 for rij > rc(17b)

    consider only a subgraph of the interaction-graph the anti-symmetric force matrix, related to this graph, is sparse

    the complexity of the calculation can be reducedfrom O (N2) to O(N).

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 52of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Short-Range Interactions

    1

    0.8

    0.6

    0.4

    0.2

    0

    0.2

    0.4

    0 1 2 3 4 5

    U*

    r*

    dim. red. LennardJones 126 Potential

    2.5

    2

    1.5

    1

    0.5

    0

    0.5

    0 1 2 3 4 5

    F*

    r*

    dim. red. LennardJones 126 Force

    1

    2

    3

    4

    5

    Fij Force matrix/Interaction-graph- F12 F13 F14 F15

    F12 - F23 F24 F25F13 F23 - F34 F35F14 F24 F34 - F45F15 F25 F35 F45 -

    fast decay of force contributions with increasing distance

    dense force matrix with O(n2

    ), mostly very small, entries

  • 7/29/2019 moldyn

    27/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 53of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Short-Range Interactions

    1

    0.8

    0.6

    0.4

    0.2

    0

    0.2

    0.4

    0 1 2 3 4 5

    U*

    r*

    dim. red. finites LennardJones 126 Potential (rc=2)

    2.5

    2

    1.5

    1

    0.5

    0

    0.5

    0 1 2 3 4 5

    F*

    r*

    dim. red. finite LennardJones 126 Force (rc=2)

    1

    2

    3

    4

    5

    Fij Force matrix/Interaction-graph- F12 F13 F14 0

    F12 - 0 F24 F25F13 0 - F34 0F14 F24 F34 - F45

    0 F25 0 F45 -

    cut-off radius leads to a reduction of the computational effortsparse force matrix with O(n) entries

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 54of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Shifted Potentials

    1

    0.8

    0.6

    0.4

    0.2

    0

    0.2

    0.4

    0 1 2 3 4 5

    U*

    r*

    shifted dim. red. finites LennardJones 126 Potential (rc=2)

    2.5

    2

    1.5

    1

    0.5

    0

    0.5

    0 1 2 3 4 5

    F*

    r*

    dim. red. finite LennardJones 126 Force (rc=2)

    ULJ,rc,shifted

    rij

    =

    ULJ

    rij ULJ (rc ) for rij rc

    0 for rij > rc

    Fij,rc

    rij

    =

    Fij

    rij

    for rij rc0 for rij > r

    c

    additionally, constant additive term for the potential continuous potentialreduced error for the overall potential

  • 7/29/2019 moldyn

    28/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 55of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Shifted Potentials

    1

    0.8

    0.6

    0.4

    0.2

    0

    0.2

    0.4

    0 1 2 3 4 5

    U*

    r*

    shifted dim. red. finites LennardJones 126 Potential (rc=2)

    2.5

    2

    1.5

    1

    0.5

    0

    0.5

    0 1 2 3 4 5

    F*

    r*

    shifted dim. red. finite LennardJones 126 Force (rc=2)

    ULJ,rc,shifted

    rij

    =

    ULJ

    rij ULJ (rc) FLJ (rc) rij rc for rij rc

    0 for rij > rc

    Fij,rc,shifted

    rij

    =

    Fij

    rij FLJ (rc) for rij rc

    0 for rij > rc

    additionally, constant additive term for the potential

    continuous potential additionally, linear additive term for the potential

    continuous force

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 56of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Cut-Off Corrections

    due to the cut-off radius, the calculation of

    the potential energy

    the pressure

    neglects some addends with small absolute values

    (small) errors

    cut-off correction tries to correct this error

    constant density and a homogeneus distribution are a prerequi-site

    physical values in the calculated volume can be approximatelyextrapolated

  • 7/29/2019 moldyn

    29/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 57of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.6. MD Implementational Aspects

    Verlet Neighbour Lists

    rc

    rmax

    every molecule stores its neigh-bours for a distance rmax > rc

    every nupd time steps (dep. on rmax),the lists are updated

    the "buffer" has to be larger than thecovered distance of a molecule forthat time:

    rmax rc > nupd t vm

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 58of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Classical Linked-Cell Algorithm

    molecules are ranged in a lattice of cu-bic cells of side length rc

    hash table with"geometrically motivated" hashfunction

    "Binning" resp. "Bucketing"-techniques from "ComputationalGeometry"

    direct volume representation(voxel) of the influence region

    runtime: O(n) only half (point symetry) of the neigh-

    bour cells are explicitly traversed (New-tons 3rd law)

    erase and generate the data structurein each time step

  • 7/29/2019 moldyn

    30/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 59of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Variable Linked-Cell Algorithm

    lattice might be built up from cellsof side length rc

    twith t R+

    preferable integer numbers are usedfor the divisor t

    N

    for t , the examinatedinfluence volume will converge tothe (optimal) sphere

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    1 2 3 4 5 6 7 8 9 1 0

    rc/cellwidth

    searchvolume/hemispherevolume

    t = 1 t = 2 t = 4 t = 3

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 60of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Linked-Cell Algorithm Data Structure I

    0 1 2 3 4 5 6 7 8 9 10 11

    12 23

    24 35

    108 119

    inner zoneboundary zoneHalo

    rc

    molecule 1

    data

    nextincell

    molecule 2

    data

    nextincell

    molecule 3

    data

    nextincell

    molecule 4

    data

    nextincell

    molecule 5

    data

    nextincell

    molecule x

    data

    nextincell

    molecule N

    data

    nextincell

    cellseq. 1 cellseq. 2cellseq. x cellseq. i

    cells are stored as a one-dimensional array (vector)

    intrusive list for the cell molecules

    list to determine the processing sequence

  • 7/29/2019 moldyn

    31/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 61 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Linked-Cell Algorithm Data Structure II

    -50 -49 -48 -47 -46

    -39 -38 -37 -36 -35 -34 -33

    -28 -27 -26 -25 -24 -23 -22 -21 -20

    -16 -15 -14 -13 -12 -11 -10 -9 -8

    -4 -3 -2 -1

    rc

    -25 -24 -23

    -19 -18 -17 -16

    -14 -13 -12 -11 -10

    -8 -7 -6 -5 -4

    -2 -1

    rc

    -20

    offset mask to determine the neighbours

    cache efficiency is influenced by the processing order(temporal locality)

    1

    2

    3

    4

    5

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 62of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.7. MD Parallelisation

    Profiling

    !"#$%

    &

    '&%

    ()&!*

    +,

    ,-%

    ,-%

    ,--%

    ,--%

    +,

    '&%

    /0

    force calculation is dominating

  • 7/29/2019 moldyn

    32/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 63of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Shared Memory Parallelisation

    each process calculates one part (Np

    ) of the molecules (cells)

    availability of all relevant data (position) because of commonmemory

    Shared Memory algorithm: Velocity Strmer Verlet method1. parallel explicit Euler method r,v (half step) for N

    pmolecules

    2. parallel force calculations for Np

    molecules or the respectivecells(force summation critical, respecting Newtons 3rd law: reduction; same with

    linked-cell algorithm)

    3. parallel implicit Euler method v (half step) for Np

    molecules

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 64of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Replicated Data I

    "Atom Decomposition" Shared Memory parallelisation every node has to store all position data

    collective communication for thesynchronization of redundant data

    "Atom Decomposition" algorithm: Velocity Strmer Verlet method

    1. explicit Euler method r,v (half step) for Np

    molecules

    2. distribute (gather-to-all) the Np

    position data for each PEto all other PEs

    3. force calculation for Np

    molecules

    4. possible distribution of partial forces to the appropriate PEs

    5. implicit Euler method for v (half step) for Np

    molecules

  • 7/29/2019 moldyn

    33/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 65of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Replicated Data II

    F1

    F2

    F3

    F4

    F5

    F6

    F7

    F8

    F9

    F10

    F11

    F12

    F13

    F14

    F15

    F16

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

    S

    Force matrix is only virtual and not allocated/set up

    costs

    calculation: Np

    communication partners per PE: p 1 memory requirements: N positions and N

    p

    forces

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 66of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Replicated Data II

    F1

    F2

    F3

    F4

    F5

    F6

    F7

    F8

    F9

    F10

    F11

    F12

    F13

    F14

    F15

    F16

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

    S

    Force matrix is only virtual and not allocated/set up

    F1

    F2

    F3

    F4

    F5

    F6

    F7

    F8

    F9

    F10

    F11

    F12

    F13

    F14

    F15

    F16

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

    S

    Force matrix is only virtual and not allocated/set up

    costs

    calculation: N2p communication partners per PE: p 1 memory requirements: taking advantage of Newtons 3rd

    law needs a vector for N (partial) forces and additional com-

    munication

  • 7/29/2019 moldyn

    34/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 67of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Force Decomposition I

    each process calculates a part of the molecules and the forcematrix

    on each node: position data of 2 Np

    molecules

    communication: distribution of positions and calculated forces "Force Decomposition" algorithm: Velocity Strmer Verlet method

    1. explicit Euler method for r,v (half step) for Np

    molecules

    2. distribution of Np

    position data per PE to 2

    Np

    1

    PEs

    3. force calculation of a

    p Np

    sub-matrix

    4. distribution of partial forces to

    p 1 PEs5. implicit Euler method for v (half step) for N

    p

    molecules

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 68of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Force Decomposition II

    1 2 3 4

    5 6 8

    9 10 11 1213141516

    7

    F1

    F2

    F3

    F4

    F5

    F6

    F7

    F8

    F9

    F10

    F11

    F12

    F13

    F14

    F15

    F16

    S

    1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16

    Force matrix is only virtual and not allocated/set up

    costs

    calculation: Np

    communication partners per PE: 2

    p 1

  • 7/29/2019 moldyn

    35/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 69of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Spatial Decomposition

    domain is decomposed into subdomains

    each processor handles one subdomain

    amount of molecules per processor is variable(molecules are moving!)

    overlapping buffer regions (halo, rc) have to be synchronized

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 70of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Spatial Decomposition

    domain is decomposed into subdomains

    each processor handles one subdomain

    amount of molecules per processor is variable(molecules are moving!)

    overlapping buffer regions (halo, rc) have to be synchronized

    point-to-point communication, dependent of decomposition molecule movement (flow velocity) communication method: "x-y-z" vs. "direct"

  • 7/29/2019 moldyn

    36/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 71 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Domain Decomposition: Cubes Slices (1)

    assumption:

    homogeneous molecule distribution

    subdomains with Np

    molecules and volume Ld

    p: N Ld

    communication size proportional to halo volume full halo

    slices:

    2 neighbour PEs

    halo volume: Ld12 rc = 2Ld rcL bad scaling properties

    relatively easy to implement

    special case of a cartesian topol-ogy ( cube)

    communication

    amount: 2p comm./PE: 2 rc

    LN

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 72of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Domain Decomposition: Cubes Slices (2) assumption:

    homogeneous molecule distribution

    subdomains with Np

    molecules and volume Ld

    p: N Ld

    communication size proportional to halo volume "complete" halo

    cubes: 3d 1 neighbour PEs side length: l = d

    Ld

    p= Ldp

    halo volume (l + 2rc)d ld =di=1

    d

    i

    ldi(2rc)i

    d1ld12rc = 2 d ld rcl =2 d Ldp

    1d1 rc

    L

    communication

    amount:

    3d 1p (direct) or 2d p (x-y-z) comm./PE: 2d rc

    LN p

    1d1

  • 7/29/2019 moldyn

    37/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 73of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.8. Molecular Dynamics Examples of Nanofluidic

    Simulations

    1.8.1. Simulating Diffusion

    Fluid

    a fluid is a continuum (a space continuously filled with mass)without a rigid crystal structure:

    liquids: hardly compressible

    gases: volume depends on pressure

    (looking at isothermal processes)

    small resistance to changes of form

    length scales of a system have to be large compared to themean free path of the molecules Knudsen number

    Kn < 0.01: ideal fluid

    0.01 < Kn < 0.1: viscous fluid (Navier Stokes equation)

    0.005 < Kn: kinetic (Boltzmann theory)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 74of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    the transport of properties in a fluid is caused by

    diffusion

    advection

  • 7/29/2019 moldyn

    38/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 75of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Diffusion

    diffusion and thermal conduction are triggered due to the Brow-nian motion

    stochastic models of a microscopic model lead to macroscopicmodels

    the process is driven for instance through a concentration or atemperature gradient, (i.e. a spatial difference)

    00

    x

    Concentration profiles

    Dt=0.1Dt=0.5

    Dt=1Dt=2

    Dt=10

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 76of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    MD Diffusion Simulation

    t = 1 t = 5 t = 10 t = 15 t = 20

    0

    0.05

    0.1

    0.15

    0.2

    0.25

    0 5 10 15 20 25 30 35 40 45 50

    Diffusion

    t=1t=1t=5

    t=10t=15t=20

  • 7/29/2019 moldyn

    39/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 77of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Gradient Diffusion

    the Ficks equation provides the power density of the materialdiffusion (D: molecular diffusion coefficient [m2s1]):

    M = Dgrad (18)

    the thermal flow of a thermal conduction equation (k: thermalconductivity [k g m s3 K1]):

    W = k gradT (19)

    Gradient: multiplication of the Nabla operator with a scalar function(vector):

    grad f = f =

    x

    y

    z

    T f =

    fx

    fy

    fz

    T

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 78of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Diffusion Equation

    change in the state variable in the control volume denotes thesum or the integral of all flows over the surface

    m

    t=

    t

    d =

    D grad dn (20)

    applying Gaussian integration leads to

    t d =

    div (D grad)dand to the diffusion equation (parabolic differential equation):

    t= D (21)

    divergence: multiplication of the Nabla operator with a vector (scalarvalue):

    div v = v =

    x

    y

    z

    T v = vxx

    +vyy

    +vzz

    Laplace operator: = 2, z.B. f = div gradf = 2fx2

    + 2f

    y2+

    2fz2

    Gaussian integration:

    div v d =

    v dn

  • 7/29/2019 moldyn

    40/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 79of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.8.2. Nucleation

    Nucleation process of supersaturated Argon

    t = 10000 t = 125000 t = 230000 t = 360000

    nucleation process for an oversaturated Argon vapour at 0.97 Mol/land 80k

    the simulation program automatically detects clusters (droplets)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 80of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    0

    2

    4

    6

    8

    10

    12

    35030025020015010050

    numberofclusters

    timeste s 103

    Clusters in a supersaturated Argon vapor, 80 K, 0.97 Mol/l

    f1(x) = 0.00731 x -2.36f2(x) = 0.00774 x -4.09f3(x) = 0.00749 x -4.698

    cluster size > 20cluster size > 30cluster size > 40

    f1(x)f2(x)f3(x)

    counting and grouping clusters of certain size ranges, a statisticcan be generated

    the growth of the clusters (slope) is known as nucleation rateand important for macroscopic simulations

  • 7/29/2019 moldyn

    41/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 81 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.9. Numerical Methods for Long-Range Potentials

    1.9.1. Introduction

    so far: focus on short-range potentials such as Lennard-Jones,e.g.

    resulting mutual interactions are restricted to particles insome local neighbourhood

    facilitates numerical treatment and algorithmic organization:no quadratic complexity induced by an "each-with-each"behaviour

    now: tackle long-range potentials, too

    examples: Coulomb or gravitation potential

    interactions between remote particles must not be neglected

    simple cut-off not possible nevertheless need for approaches that avoid quadratic com-

    plexity

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 82of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    what is long-range?

    intuitively: potential function U(r) does not decrease rapidlywith increasing r

    formally (one possibility): for d > 2, potentials not decreas-ing faster than rd for increasing r (criterion: integrabilityover IRd)

    typical potentials in applications have both a short-range part

    (to be dealt with according to the previous sections) and a long-range part, represented as two additive components:

    U(r) := Ushort + Ulong

  • 7/29/2019 moldyn

    42/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 83of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Two Main Classes

    grid-based methods:

    decompose Ulong itself into a smooth but long-range and asingular but short-range part

    for the latter, use the linked-cell approach again

    for the first, there exist special so-called grid-based meth-ods:

    * P3M (Particle-ParticleParticle-Mesh) method

    * PME (Particle-Mesh-Ewald) method

    * SPME (Smooth-Particle-Mesh-Ewald) method)

    starting point: PDE-representation of the potential

    (x) = 10

    (x)

    * potential as solution of a potential (Poisson) equation

    * efficient solution with standard discretisation techniquessuch as Finite Differences or Finite Elements in case ofsmooth solutions

    * hence, feasible for the smooth long-range part and forhomogeneous particle distributions

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 84of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    hierarchical or tree-based methods:

    starting point: integral representation of the potential

    (x) =1

    40

    (y)

    1

    y xdy

    advantageous especially for heterogeneous particle distri-butions (frequent in astrophysics, relevant also for molecu-lar dynamics)

    examples:

    * panel clustering

    * Barnes-Hut method

    * (fast) multipole methods

  • 7/29/2019 moldyn

    43/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 85of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    1.9.2. Tree-Based Methods

    based on integral representation of the potential

    hierarchical decompositions of the domain of simulation

    adaptive approximation of the particle distribution

    widespread scheme: octrees

    allow for separation of near-field and far-field influences

    log-linear or even linear complexity can be obtained

    high flexibility with respect to more general potentials (as neededfor special applications, such as biomolecular problems)

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 86of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Series Expansion of the Potential

    general (integral) representation of the potential:

    (x) =

    G(x, y)(y)dy

    (general kernel G, particle density (y), and domain )

    Taylor expansion of the kernel G (if sufficiently smooth apart

    from the singularity in x = y) in y around y0:G(x, y) =

    j1p

    1

    j!G0,j(x, y0)(y y0)j + Rp(x, y)

    (multi-index j = (j1, j2, j3), j! = j1!j2!j3!, Gk,j(x, y) mixed (k, j)-th derivative (k-th w.r.t. x, j-th w.r.t. y), remainder Rp(x, y))

    leads to expansion (and approximation) of the potential:

    (x) j1p1

    j!Mj(, y0)G0,j(x, y0)

    with the so-called moments

    Mj(, y0) :=

    (y)(y y0)jdy

  • 7/29/2019 moldyn

    44/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 87of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Subdivision of the Domain

    separation of near-field and far-field for given x:

    = near far , near far =

    decomposition of the far-field into disjoint, convex subdomains:

    far =i

    fari

    note: this decomposition depends on x, i.e. it is done for eachparticle position x (efficient derivation possible from one hierar-chical tree structure)

    each fari has an associated point yi0

    how to choose the subdivision?

    diam

    x yi0:=

    supyfari

    y yi0x yi0

    for some suitable constant 0 < < 1

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 88of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    resulting approximation for (x):

    (x) =

    (y)G(x, y)dy

    =

    near

    (y)G(x, y)dy +

    far

    (y)G(x, y)dy

    = near

    (y)G(x, y)dy + i

    far

    i

    (y)G(x, y)dy

    near(y)G(x, y)dy +

    i

    j1p

    1

    j!Mj(

    fari , y

    i0)G0,j(x, y

    i0)

  • 7/29/2019 moldyn

    45/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 89of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Error Estimates

    error characteristics for one fix particle position x : local relative approximation error for one fari can be shown

    to be of order O(p+1)

    global relative approximation error (summation over wholefar-field) can be shown to be of order O(p+1)

    this clarifies the role of :

    allows to control the global approximation error in x

    geometric requirement to the far-field subdivision: the closerfari is located to x, the smaller it has to be to fulfil the -condition

    hence: a typical "level of detail"

    the closer, the higher resolved cf. terrain representation in flight simulators

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 90of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Tree Structures

    central question: how can we construct all these necessaryseparations of near-fields and far-fields and subdivisions of far-fields in an efficient way?

    idea: recursive decomposition of (a square in 2D, a cube in3D without loss of generality) in cells of different size, termi-nating the subdivision process if a cell is either empty or con-tains just one particle

    concepts:

    kd-tree: alternate subdivision in coordinate direction (x, y,and z), such that the separation produces two subdomainsthat roughly contain the same number of particles each

    quadtree (2D) or octree (3D): subdivision into four congruentsubsquares or eight congruent subcubes, respectively

    the following algorithms (Barnes-Hut etc.) use the octree ap-proach

  • 7/29/2019 moldyn

    46/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 91 of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    kd-Trees Example

    3

    4

    5

    7

    6

    11

    9

    8

    10

    12

    13

    1 2 3 4 5

    6

    7

    9

    8 10 1312

    11

    2

    1

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 92of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Quadtrees and Octrees Examples

  • 7/29/2019 moldyn

    47/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 93of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Recursive Computation of the Far-Field Subdivision

    starting point: create the octree corresponding to the set of par-ticles

    each node of the octree represents a subdomain of orone cell

    for each cell i, define some yi0 (the centre point or the centre

    of gravity of all particles contained, e.g.) for doing the Taylorexpansion for each cell i, let the parameter diam just denote the diam-

    eter of the smallest surrounding sphere, e.g.

    objective: for each particle position x, use as few cells as pos-sible (i.e. as big cells as possible) for fulfilling the diam- rule

    hence: start from root node, checkdiam

    x

    yi0

    ,

    stop if fulfilled (no need for further subdivision) and proceed ifnot yet fulfilled

    note that for each x, we typically get a different subdivision

    but note also that all these subdivisions are just subtrees of ourconstructed octree

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 94of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Recursive Computation of the Moments

    now: use this subdivision for the efficient calculation of the localmoments Mj(fari , y

    i0)

    direct (numerical) integration or direct summation are not effi-cient

    therefore: use hierarchical tree structure to calculate all mo-

    ments for all cells in one run and store them crucial property for that:

    Mj(1 2, y0) = Mj(1, y0) + Mj(2, y0) ,if the point of expansion y0 is the same

    in the (standard) case of different y10 and y20, there are simple

    conversion formulas:

    Mj(1, y0) =kjj

    k

    (y0 y0)j

    k

    Mk(1, y0)

    (k j component-wise, multiplicative binomial coefficients)

  • 7/29/2019 moldyn

    48/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 95of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    this allows for a bottom-up calculation of the moments from theleaves to the root

    in the leaves:

    if no particle present: zero

    if one particle of mass m there in x: m(x yi0)j

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 96of124

    Algorithmen des WissenschaftlichenRechnens II

    1. Molecular DynamicsSimulation

    Hans-Joachim Bungartz

    Using these Building Blocks

    still to be done for a numerical routine:

    how to construct the tree, starting from a given set of particles?

    how to store the tree?

    how to choose cells and expansion points?

    how to determine far-field and near-field?

    several algorithmic variants to be discussed in the following

  • 7/29/2019 moldyn

    49/62

    Introduction

    Examples

    Essentials from. . .

    Molecular Dynamics . . .

    Molecular Dynamics . . .

    MD Approximations. . .

    MD Implement...

    MD Parallelisation

    Molecular Dynamics . . .

    Numerical Methods for. . .

    Page 97o