Statistical Thermostats

Embed Size (px)

Citation preview

  • 7/27/2019 Statistical Thermostats

    1/36

    MitgliedderHelmholtz-Gemeinschaft

    Efficient CommunicationSchemes for Stochastic

    Thermostats in parallelMD Simulations

    September 25, 2012 Felix Uhl

  • 7/27/2019 Statistical Thermostats

    2/36

    MitgliedderHelmholtz-Gemeinschaft

    Parallel Stochastic ThermostatsOutline

    A Short Introduction to Molecular Dynamics

    Thermostats

    Why Thermostats?The Andersen ThermostatThe Lowe-Andersen Thermostat

    Implementation of the Lowe-Andersen Thermostat

    The IBIsCO code

    The Current Lowe-Andersen ImplementationThe New Implementation of the Lowe-Andersen ThermostatMore Ways to Parallelize the Lowe-Andersen Thermostat

    September 25, 2012 Felix Uhl Slide 2

  • 7/27/2019 Statistical Thermostats

    3/36

    MitgliedderHelmholtz-Gemeinschaft

    Parallel StochasticThermostatsPart I: A Short Introduction to MolecularDynamics

    September 25, 2012 Felix Uhl

  • 7/27/2019 Statistical Thermostats

    4/36

    MitgliedderHelmholtz-Gemeinschaft

    A Short Introduction to Molecular DynamicsBasic Theory

    System of point like particles

    Coordinates: {r(t)}, momenta:p(t)

    Newtons equations of motion:

    md2ridt2

    = i

    iV(r)

    Etot = Ekin + V, Ekin,i =p2i

    2mi=

    1

    2miv

    2i , V = V(r)

    September 25, 2012 Felix Uhl Slide 4

  • 7/27/2019 Statistical Thermostats

    5/36

    MitgliedderHelmholtz-Gemeinschaft

    A Short Introduction to Molecular DynamicsNumerical Solution of Hamiltons Equations of Motion

    Solving equations of motion numerically via discretization

    Starting positions and velocities are given at time t= 0

    1 r(t+ t) = r(t) + v(t)t+ 12mF(t)t2

    2 F(t+ t) = V(r(t+ t))

    3 v(t+ t) = v(t) + 12m [F(t) + F(t+ t)] t

    4 If t< tmax then repeat

    September 25, 2012 Felix Uhl Slide 5

  • 7/27/2019 Statistical Thermostats

    6/36

    MitgliedderHelmholtz-Gemeinschaft

    Parallel StochasticThermostatsPart II: Thermostats

    September 25, 2012 Felix Uhl

  • 7/27/2019 Statistical Thermostats

    7/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsWhy Thermostats?

    TD: Ekin =3

    2KBT

    CM:Ekin =

    1

    N

    N

    i=1

    1

    2miv2

    i

    3

    2KBT =

    1

    N

    N

    i=

    1

    1

    2miv

    2i

    Boltzmann Distribution

    A Boltzmann distribution

    corresponds to a specific

    temperature 05e-05

    0.0001

    0.00015

    0.0002

    0.00025

    0 300 600 900 1200 1500 1800

    Probability

    de

    nsity

    Speed / (m/s)

    Boltzmann distributionHe at 298.15 K

    September 25, 2012 Felix Uhl Slide 7

  • 7/27/2019 Statistical Thermostats

    8/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsWhy Thermostats? NVE-Simulation

    Give particles velocities according to Boltzmann

    distribution

    Guess starting positions

    September 25, 2012 Felix Uhl Slide 8

  • 7/27/2019 Statistical Thermostats

    9/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsWhy Thermostats? NVE-Simulation

    Give particles velocities according to Boltzmann

    distribution

    Guess starting positions

    2

    4

    6

    0 100 200 300 400

    Temperature

    Timesteps

    Evolution of Temperature

    September 25, 2012 Felix Uhl Slide 8

  • 7/27/2019 Statistical Thermostats

    10/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsWhy Thermostats? NVE-Simulation

    Give particles velocities according to Boltzmann

    distribution

    Guess starting positions

    2

    4

    6

    0 100 200 300 400

    Temperature

    Timesteps

    Evolution of Temperature

    1 Optimize geometry with respect to the energy

    2 Add/subtract kinetic energy from the system

    September 25, 2012 Felix Uhl Slide 8

  • 7/27/2019 Statistical Thermostats

    11/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsThe Andersen Thermostat

    0

    y

    0 x

    Simulation Cell with a Real and a Bath System Real system (grey)

    Bath system(red)

    Bath has fixed temperature

    Collisions between realparticles and bath particles

    adjust temperature in real

    system

    Implementation

    Randomly select particles up to a certain frequency. The

    velocity is replaced by a random velocity according to the

    Boltzmann distribution.

    September 25, 2012 Felix Uhl Slide 9

  • 7/27/2019 Statistical Thermostats

    12/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsThe Lowe-Andersen Thermostat

    1 2

    v1

    v2

    September 25, 2012 Felix Uhl Slide 10

  • 7/27/2019 Statistical Thermostats

    13/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsThe Lowe-Andersen Thermostat

    1 2

    v1

    v2

    v12,proj

    1 Project v1 v2 on theconnecting unit vector

    September 25, 2012 Felix Uhl Slide 10

  • 7/27/2019 Statistical Thermostats

    14/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsThe Lowe-Andersen Thermostat

    1 2

    v1

    v2

    v12,proj

    vnew

    1 Project v1 v2 on theconnecting unit vector

    2 Pick random new velocity

    from Boltzmann

    distribution

    September 25, 2012 Felix Uhl Slide 10

  • 7/27/2019 Statistical Thermostats

    15/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsThe Lowe-Andersen Thermostat

    1 2

    v1

    v2

    v12,proj

    vnew

    v12,proj

    vnew v12,proj

    v1,new

    v2,new

    1 Project v1 v2 on theconnecting unit vector

    2 Pick random new velocity

    from Boltzmann

    distribution3 Add/subtract difference of

    projected and chosen

    velocity to obtain new

    velocities

    September 25, 2012 Felix Uhl Slide 10

  • 7/27/2019 Statistical Thermostats

    16/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsThe Lowe-Andersen Thermostat

    1 2

    v1

    v2

    v12,proj

    vnew

    v12,proj

    vnew v12,proj

    v1,new

    v2,new

    1 Project v1 v2 on theconnecting unit vector

    2 Pick random new velocity

    from Boltzmann

    distribution3 Add/subtract difference of

    projected and chosen

    velocity to obtain new

    velocities

    Advantage

    Conserves linear and angular momentum due to pairwise

    correction

    September 25, 2012 Felix Uhl Slide 10

  • 7/27/2019 Statistical Thermostats

    17/36

    MitgliedderHelmholtz-Gemeinschaft

    ThermostatsHow to Correct the Velocities?

    Usually one particle has more than one neighbour

    Lowe-Andersen-1

    Take already correctedvelocity

    Lowe-Andersen-2

    Take original velocityand add up changes

    2

    4

    6

    8

    10

    5000 6000 7000 8000

    Temperature

    Timesteps

    Evolution of Temperature using LA1

    Freq = 0.1Freq = 5.0

    Freq = 50.0Freq = 100.0

    2

    4

    6

    8

    10

    5000 6000 7000 8000

    Temperature

    Timesteps

    Evolution of Temperature using LA2

    Freq = 0.1Freq = 5.0

    Freq = 50.0Freq = 100.0

    September 25, 2012 Felix Uhl Slide 11

  • 7/27/2019 Statistical Thermostats

    18/36

    MitgliedderHelmholtz-Gemeinschaft

    Parallel StochasticThermostatsPart III: Implementation of the

    Lowe-Andersen Thermostat

    September 25, 2012 Felix Uhl

  • 7/27/2019 Statistical Thermostats

    19/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe IBIsCO-Code

    It is Boltzmann Inversion Software for COarse Graining Simulations

    IBIsCO

    Code for coarse grainingsimulations

    Time propagation with

    Leap-Frog-Algorithm

    (Verlet-Family)

    Boltzmann inversion is

    used to calculate the

    forces

    September 25, 2012 Felix Uhl Slide 13

  • 7/27/2019 Statistical Thermostats

    20/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe Current Lowe-Andersen Implementation

    1 Prepare data for

    sending(velocities,

    coordinates,

    neighbourlist)

    September 25, 2012 Felix Uhl Slide 14

  • 7/27/2019 Statistical Thermostats

    21/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe Current Lowe-Andersen Implementation

    1 Prepare data for

    sending(velocities,

    coordinates,

    neighbourlist)

    2 Send data to master

    processor

    September 25, 2012 Felix Uhl Slide 14

  • 7/27/2019 Statistical Thermostats

    22/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe Current Lowe-Andersen Implementation

    1 Prepare data for

    sending(velocities,

    coordinates,

    neighbourlist)

    2 Send data to master

    processor

    3 Correct velocities on

    master processor

    September 25, 2012 Felix Uhl Slide 14

  • 7/27/2019 Statistical Thermostats

    23/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe Current Lowe-Andersen Implementation

    1 Prepare data for

    sending(velocities,

    coordinates,

    neighbourlist)

    2 Send data to master

    processor

    3 Correct velocities on

    master processor4 Send back velocities

    September 25, 2012 Felix Uhl Slide 14

  • 7/27/2019 Statistical Thermostats

    24/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe Current Lowe-Andersen Implementation

    1 Prepare data for

    sending(velocities,

    coordinates,

    neighbourlist)

    2 Send data to master

    processor

    3 Correct velocities on

    master processor

    4 Send back velocities

    440

    450

    460

    470

    480

    490

    500

    0 250 500 750 1000

    Temperature

    /K

    Timesteps

    Evolution of Temperatureusing the old Implementation

    September 25, 2012 Felix Uhl Slide 14

  • 7/27/2019 Statistical Thermostats

    25/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe New Implementation of the Lowe-Andersen Thermostat

    September 25, 2012 Felix Uhl Slide 15

  • 7/27/2019 Statistical Thermostats

    26/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe New Implementation of the Lowe-Andersen Thermostat

    1 Correct velocity of pairs

    resident on processor

    September 25, 2012 Felix Uhl Slide 15

  • 7/27/2019 Statistical Thermostats

    27/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe New Implementation of the Lowe-Andersen Thermostat

    1 Correct velocity of pairs

    resident on processor

    2 Send remaining pairs to

    master processor

    September 25, 2012 Felix Uhl Slide 15

  • 7/27/2019 Statistical Thermostats

    28/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe New Implementation of the Lowe-Andersen Thermostat

    1 Correct velocity of pairs

    resident on processor

    2 Send remaining pairs to

    master processor

    3 Correct velocities over

    boundaries on master

    processor

    September 25, 2012 Felix Uhl Slide 15

  • 7/27/2019 Statistical Thermostats

    29/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe New Implementation of the Lowe-Andersen Thermostat

    1 Correct velocity of pairs

    resident on processor

    2 Send remaining pairs to

    master processor

    3 Correct velocities over

    boundaries on master

    processor

    4 Send back velocities

    September 25, 2012 Felix Uhl Slide 15

  • 7/27/2019 Statistical Thermostats

    30/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatThe New Implementation of the Lowe-Andersen Thermostat

    1 Correct velocity of pairs

    resident on processor

    2 Send remaining pairs tomaster processor

    3 Correct velocities over

    boundaries on master

    processor

    4 Send back velocities

    440

    450

    460

    470

    480

    490

    500

    0 250 500 750 1000

    Temperature/K

    Timesteps

    Evolution of Temperatureusing the new Implementation(red)

    September 25, 2012 Felix Uhl Slide 15

  • 7/27/2019 Statistical Thermostats

    31/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatScaling of the two methods

    160000 particles, 1000 timesteps

    1500

    1550

    1600

    1650

    8 27 64

    Time

    /s

    # Processors

    Scaling of the old Lowe-Andersen Implementation

    100

    150

    200

    250

    8 27 64

    Time

    /s

    # Processors

    Scaling of the new Lowe-Andersen Implementation

    #proc.time(old)

    /stime(new)

    /s8 1588.771 263.700

    27 1572.881 115.830

    64 1550.005 108.446

    September 25, 2012 Felix Uhl Slide 16

  • 7/27/2019 Statistical Thermostats

    32/36

  • 7/27/2019 Statistical Thermostats

    33/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatMore Ways to Implement the Lowe-Andersen Thermostat Efficiently

    1 One processor has 26

    neighbours

    2 Send data to 13

    neighbour cells3 Receive data from other

    13 neighbour cells

    September 25, 2012 Felix Uhl Slide 17

  • 7/27/2019 Statistical Thermostats

    34/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatMore Ways to Implement the Lowe-Andersen Thermostat Efficiently

    1 One processor has 26

    neighbours

    2 Send data to 13

    neighbour cells3 Receive data from other

    13 neighbour cells

    4 Partially LA2 method

    September 25, 2012 Felix Uhl Slide 17

  • 7/27/2019 Statistical Thermostats

    35/36

    MitgliedderHelmholtz-Gemeinschaft

    Implementation of the Lowe-Andersen ThermostatMore Ways to Implement the Lowe-Andersen Thermostat Efficiently

    1 One processor has 26

    neighbours

    2 Send data to 13

    neighbour cells3 Receive data from other

    13 neighbour cells

    4 Partially LA2 method

    5

    Equivalent to LA1, ifsending and receiving to

    the 13 neighbours is

    performed step by step

    September 25, 2012 Felix Uhl Slide 17

  • 7/27/2019 Statistical Thermostats

    36/36

    MitgliedderHelmholtz-Gemeinschaf

    t

    Thank you for your attention.

    September 25, 2012 Felix Uhl Slide 18