Está en la página 1de 36

Mitglied der Helmholtz-Gemeinschaft

Efcient Communication Schemes for Stochastic Thermostats in parallel MD Simulations


September 25, 2012 Felix Uhl

Parallel Stochastic Thermostats


Outline

A Short Introduction to Molecular Dynamics Thermostats


Why Thermostats? The Andersen Thermostat The Lowe-Andersen Thermostat

Implementation of the Lowe-Andersen Thermostat


The IBIsCO code The Current Lowe-Andersen Implementation The New Implementation of the Lowe-Andersen Thermostat More Ways to Parallelize the Lowe-Andersen Thermostat

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 2

Parallel Stochastic Thermostats


Mitglied der Helmholtz-Gemeinschaft

Part I: A Short Introduction to Molecular Dynamics


September 25, 2012 Felix Uhl

A Short Introduction to Molecular Dynamics


Basic Theory

System of point like particles Coordinates: {r (t )}, momenta: p(t ) Newtons equations of motion: m d 2r i = dt 2 Ekin,i = i V (r )
i

Mitglied der Helmholtz-Gemeinschaft

Etot = Ekin + V ,

pi2 1 = mi vi2 , 2mi 2

V = V (r )

September 25, 2012

Felix Uhl

Slide 4

A Short Introduction to Molecular Dynamics


Numerical Solution of Hamiltons Equations of Motion

Solving equations of motion numerically via discretization Starting positions and velocities are given at time t = 0
1 2 3
Mitglied der Helmholtz-Gemeinschaft

r (t + t ) = r (t ) + v (t )t + v (t + t ) = v (t ) +
1 2m

1 2 2m F (t )t

F (t + t ) = V (r (t + t )) [F (t ) + F (t + t )] t If t < tmax then repeat

September 25, 2012

Felix Uhl

Slide 5

Parallel Stochastic Thermostats


Part II: Thermostats
Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Thermostats
Why Thermostats?

TD: Ekin = CM: Ekin =

3 KB T 2 1 N
N i =1

1 mi v 2 i 2

3 1 KB T = 2 N

N i =1

1 mi v 2 i 2

Boltzmann distribution He at 298.15 K 0.00025 Probability density

Boltzmann Distribution
Mitglied der Helmholtz-Gemeinschaft

0.0002 0.00015 0.0001 5e-05 0 0 300 600 900 1200 1500 1800 Speed / (m/s)

A Boltzmann distribution corresponds to a specic temperature


September 25, 2012

Felix Uhl

Slide 7

Thermostats
Why Thermostats? NVE-Simulation

Give particles velocities according to Boltzmann distribution Guess starting positions

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 8

Thermostats
Why Thermostats? NVE-Simulation

Give particles velocities according to Boltzmann distribution Guess starting positions


Evolution of Temperature

6 Temperature

2
Mitglied der Helmholtz-Gemeinschaft

100

200 Timesteps

300

400

September 25, 2012

Felix Uhl

Slide 8

Thermostats
Why Thermostats? NVE-Simulation

Give particles velocities according to Boltzmann distribution Guess starting positions


Evolution of Temperature

6 Temperature

2
Mitglied der Helmholtz-Gemeinschaft

100

200 Timesteps

300

400

1 2

Optimize geometry with respect to the energy Add/subtract kinetic energy from the system
Felix Uhl Slide 8

September 25, 2012

Thermostats
The Andersen Thermostat
Simulation Cell with a Real and a Bath System y

Real system (grey) Bath system(red) Bath has xed temperature Collisions between real particles and bath particles adjust temperature in real system

0 0 x

Mitglied der Helmholtz-Gemeinschaft

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

Thermostats
The Lowe-Andersen Thermostat

v1 v2 1 2

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 10

Thermostats
The Lowe-Andersen Thermostat

v1 v2 1 v12,proj 2

Project v 1 v 2 on the connecting unit vector

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 10

Thermostats
The Lowe-Andersen Thermostat

v1 v2 1 v12,proj vnew 2

Project v 1 v 2 on the connecting unit vector Pick random new velocity from Boltzmann distribution

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 10

Thermostats
The Lowe-Andersen Thermostat

v1,new 1 v12,proj vnew v12,proj vnew v12,proj


Mitglied der Helmholtz-Gemeinschaft

v1 v2 2 v2,new

Project v 1 v 2 on the connecting unit vector Pick random new velocity from Boltzmann distribution Add/subtract difference of projected and chosen velocity to obtain new velocities

September 25, 2012

Felix Uhl

Slide 10

Thermostats
The Lowe-Andersen Thermostat

v1,new 1 v12,proj vnew v12,proj vnew v12,proj


Mitglied der Helmholtz-Gemeinschaft

v1 v2 2 v2,new

Project v 1 v 2 on the connecting unit vector Pick random new velocity from Boltzmann distribution 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

Thermostats
How to Correct the Velocities?

Usually one particle has more than one neighbour

Lowe-Andersen-1
Take already corrected velocity
Evolution of Temperature using LA1 10 8 Temperature
Mitglied der Helmholtz-Gemeinschaft

Lowe-Andersen-2
Take original velocity and add up changes
Evolution of Temperature using LA2 10 Temperature Freq = 0.1 Freq = 5.0 Freq = 50.0 Freq = 100.0

6 4 2 5000

Freq = 0.1 Freq = 5.0 Freq = 50.0 Freq = 100.0

8 6 4 2

6000 7000 Timesteps

8000

5000

6000 7000 Timesteps

8000

September 25, 2012

Felix Uhl

Slide 11

Parallel Stochastic Thermostats


Mitglied der Helmholtz-Gemeinschaft

Part III: Implementation of the Lowe-Andersen Thermostat


September 25, 2012 Felix Uhl

Implementation of the Lowe-Andersen Thermostat


The IBIsCO-Code It is Boltzmann Inversion Software for COarse Graining Simulations

IBIsCO
Code for coarse graining simulations Time propagation with Leap-Frog-Algorithm (Verlet-Family)
Mitglied der Helmholtz-Gemeinschaft

Boltzmann inversion is used to calculate the forces


September 25, 2012 Felix Uhl Slide 13

Implementation of the Lowe-Andersen Thermostat


The Current Lowe-Andersen Implementation

Prepare data for sending(velocities, coordinates, neighbourlist)

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 14

Implementation of the Lowe-Andersen Thermostat


The Current Lowe-Andersen Implementation

Prepare data for sending(velocities, coordinates, neighbourlist) Send data to master processor

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 14

Implementation of the Lowe-Andersen Thermostat


The Current Lowe-Andersen Implementation

Prepare data for sending(velocities, coordinates, neighbourlist) Send data to master processor Correct velocities on master processor

3
Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 14

Implementation of the Lowe-Andersen Thermostat


The Current Lowe-Andersen Implementation

Prepare data for sending(velocities, coordinates, neighbourlist) Send data to master processor Correct velocities on master processor Send back velocities

3
Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 14

Implementation of the Lowe-Andersen Thermostat


The Current Lowe-Andersen Implementation

Temperature / K

Prepare data for sending(velocities, coordinates, neighbourlist) Send data to master processor Correct velocities on master processor Send back velocities

Evolution of Temperature using the old Implementation 500 490 480 470 460 450 440 0 250 500 Timesteps 750 1000

3
Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 14

Implementation of the Lowe-Andersen Thermostat


The New Implementation of the Lowe-Andersen Thermostat

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 15

Implementation of the Lowe-Andersen Thermostat


The New Implementation of the Lowe-Andersen Thermostat

Correct velocity of pairs resident on processor

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 15

Implementation of the Lowe-Andersen Thermostat


The New Implementation of the Lowe-Andersen Thermostat

Correct velocity of pairs resident on processor Send remaining pairs to master processor

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 15

Implementation of the Lowe-Andersen Thermostat


The New Implementation of the Lowe-Andersen Thermostat

Correct velocity of pairs resident on processor Send remaining pairs to master processor Correct velocities over boundaries on master processor

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 15

Implementation of the Lowe-Andersen Thermostat


The New Implementation of the Lowe-Andersen Thermostat

Correct velocity of pairs resident on processor Send remaining pairs to master processor Correct velocities over boundaries on master processor Send back velocities

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 15

Implementation of the Lowe-Andersen Thermostat


The New Implementation of the Lowe-Andersen Thermostat

Correct velocity of pairs resident on processor Send remaining pairs to master processor Correct velocities over boundaries on master processor Send back velocities
Temperature / K

Evolution of Temperature using the new Implementation(red) 500 490 480 470 460 450 440 0 250 500 Timesteps 750 1000

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 15

Implementation of the Lowe-Andersen Thermostat


Scaling of the two methods

160000 particles, 1000 timesteps


Scaling of the old Lowe-Andersen Implementation 1650 Time / s Time / s 8 27 # Processors 64 Scaling of the new Lowe-Andersen Implementation 250

1600

200

1550

150

1500

100 8 27 # Processors 64

Mitglied der Helmholtz-Gemeinschaft

#proc . 8 27 64
September 25, 2012

time(old)/s

time(new)/s

1588.771 1572.881 1550.005


Felix Uhl

263.700 115.830 108.446


Slide 16

Implementation of the Lowe-Andersen Thermostat


More Ways to Implement the Lowe-Andersen Thermostat Efciently

One processor has 26 neighbours

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 17

Implementation of the Lowe-Andersen Thermostat


More Ways to Implement the Lowe-Andersen Thermostat Efciently

One processor has 26 neighbours Send data to 13 neighbour cells Receive data from other 13 neighbour cells

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 17

Implementation of the Lowe-Andersen Thermostat


More Ways to Implement the Lowe-Andersen Thermostat Efciently

One processor has 26 neighbours Send data to 13 neighbour cells Receive data from other 13 neighbour cells Partially LA2 method

4
Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 17

Implementation of the Lowe-Andersen Thermostat


More Ways to Implement the Lowe-Andersen Thermostat Efciently

One processor has 26 neighbours Send data to 13 neighbour cells Receive data from other 13 neighbour cells Partially LA2 method Equivalent to LA1, if sending and receiving to the 13 neighbours is performed step by step
Felix Uhl Slide 17

4
Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Thank you for your attention.

Mitglied der Helmholtz-Gemeinschaft

September 25, 2012

Felix Uhl

Slide 18

También podría gustarte