28
6.189 IAP 2007 MIT 6.189 IAP 2007 Student Project Presentation Molecular Dynamics Pintilie

Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

6.189 IAP 2007 MIT

6.189 IAP 2007

Student Project Presentation

Molecular Dynamics

Pintilie

Page 2: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics on the Playstation 3

Greg Pintilie

Page 3: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Overview

• Molecular Dynamics• Algorithm• Parallelization Approaches

Page 4: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

( ) bondednonbondedp EExE −+=v

Page 5: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

( ) bondednonbondedp EExE −+=v

impdihanglesbondsbonded EEEE ,++=

Page 6: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

( )∑ −=bonds

bbonds llkE 20

( ) bondednonbondedp EExE −+=v

impdihanglesbondsbonded EEEE ,++=

Page 7: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

( )20∑ −=

anglesangles kE θθθ

( ) bondednonbondedp EExE −+=v

impdihanglesbondsbonded EEEE ,++=

Page 8: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

( )( ) ( ) ( )∑∑ −+−+−=impropersdihedrals

impdih kknkF 00, cos1 ωωθθφ ωθφ

( ) bondednonbondedp EExE −+=v

impdihanglesbondsbonded EEEE ,++=

Page 9: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

( )∑ −=bonds

bbonds bbkE 20

( )20∑ −=

anglesangles kE θθθ

( ) bondednonbondedp EExE −+=v

( )( ) ( ) ( )∑∑ −+−+−=impropersdihedrals

impdih kknkF 00, cos1 ωωθθφ ωθφ

impdihanglesbondsbonded EEEE ,++=

Page 10: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

ticelectrostaWaalsdervanbondednon EEE += −−−

( ) bondednonbondedp EExE −+=v

Page 11: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

ticelectrostaWaalsdervanbondednon EEE += −−−

∑ ⎟⎟⎠

⎞⎜⎜⎝

⎛−=−−

kiatoms ik

ik

ik

ikWaalsdervan r

CrA

E,_

612

( ) bondednonbondedp EExE −+=v

Page 12: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Molecular Dynamics• Potential Energy:

ticelectrostaWaalsdervanbondednon EEE += −−−

∑ ⎟⎟⎠

⎞⎜⎜⎝

⎛−=−−

kiatoms ik

ik

ik

ikWaalsdervan r

CrA

E,_

612

∑=kiatoms ik

kiticelectrosta Dr

qqE

,_

( ) bondednonbondedp EExE −+=v

Page 13: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

• Compute forces :

• Integrate to obtain velocity, position:

Molecular Dynamics

( )mtftttvttv

vv Δ+⎟

⎠⎞

⎜⎝⎛ Δ−=⎟

⎠⎞

⎜⎝⎛ Δ+

21

21

( ) ( ) ⎟⎠⎞

⎜⎝⎛ Δ+⋅Δ+=Δ+ ttvttxttx

21vvv

( ) ( ) ( )xEx

taMtf pv

vvv

∂∂

−==

Page 14: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

• Kinetic Energy/Temperature:– from classical equipartition theory, each degree

of freedom has, at thermal equilibrium, this much energy:

Kinetic Energy

TkB21

TkNvmE BF

N

iiik 2

121 3

1

2 == ∑=

Page 15: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Langevin Dynamics

( ) )(tRMvxEaMF p +−−∇== γvv

0)( =tR )'(2)'(),( ttTMktRtR BT −= δγ

• Account for collisions with imaginary molecules (heat bath)

• e.g. in solvent such as water

Page 16: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Solvation in Dielectric Material• Molecules that are polar/ionic ‘shield’

electrostatic forces• Water:

– distance-dependent dielectric:

∑=kiatoms ik

kiticelectrosta Dr

qqE

,_

rD =

∑=kiatoms ik

kiticelectrosta r

qqE

,_2

Page 17: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Non-bonded Cut-offs

• Cut-off ~12A∑

⎪⎭

⎪⎬⎫

⎪⎩

⎪⎨⎧

+⎟⎟⎠

⎞⎜⎜⎝

⎛−=−

kiatoms ik

ki

ik

ik

ik

ikbondednon Dr

qqrC

rA

E,_

612

Page 18: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Non-bonded Cut-offs

• Cut-off ~12A∑

⎪⎭

⎪⎬⎫

⎪⎩

⎪⎨⎧

+⎟⎟⎠

⎞⎜⎜⎝

⎛−=−

kiatoms ik

ki

ik

ik

ik

ikbondednon Dr

qqrC

rA

E,_

612

Page 19: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Basic MD Algorithm

Integrate

Compute ‘non-bonded’ forcesatom pairs

Compute ‘bonded’ forcesbonds, angles, dihedrals, impropers

if i % ap_freq == 0find atom pairs

For i=0 to numsteps

Page 20: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Data Structures

AtomVector pos, vel, forcedouble Massdouble Chargedouble Rmindouble Eps

Vectordouble x, y, z

BondAtom *a1, *a2double k, b0

AngleAtom *a1, *a2, *a3double k, t0

ImproperAtom *a1, *a2, *a3, *a4double k, t0

DihedralAtom *a1, *a2, *a3, *a4list DihedralValue vals

DihedralValuedouble k, phaseint n

Atom PairAtom *a1, *a2double eij

Moleculelist Atom atomslist Bond bondslist Angle angleslist Improper improperslist Dihedrals dihedralslist AtomPair atompairs

Bonded Forces Non-Bonded Forces

Page 21: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

• A8m– ‘Bonded’ - total 41,652

• 146 atoms x 104 bytes = 15,184• 147 bonds x 24 bytes= 3,528• 275 angles x 28 bytes = 7,700• 393 dihedrals x 16 bytes +

414 dihedral values x 20 bytes = 14,568• 21 impropers 32 bytes = 672

– ‘Non-bonded’ – total 176,000• 11,000 Atom Pairs x 16 bytes

– (1-3 bonded atoms excluded)

• 10 x A8m– ‘Bonded’ – total 416,520– ‘Non-bonded’ – total 16,976,000

• 20 x A8m– ‘Bonded’ – total 833,040– ‘Non-bonded’ – total 68,064,000

Page 22: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Sequential Algorithm

10ms10msintegrate

150ms116,434 pairs

1,480ms1,060,850 pairs

‘non-bonded’ forcesatom pairs

50ms50ms‘bonded’ forcesbonds, angles, dihedrals, impropers

Bf / Kd6,090 / 880 ms24,440 / 1,750 ms

0 msif i%ap_freq==0find atom pairs

With cutoffNo cutoffFor i=0 to numsteps

Page 23: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Parallelization Approaches

• Force Decomposition

……

……

A3A1

A2A1

• force operation includes both atom positions, returns the force on both atoms

• scales well with system size and #processorsAn

A2

A1

Page 24: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Parallelization Approaches

• Force Decomposition

……

……

A3A1

A2A1

for j=0 to #SPUs•send control block to SPU-j

for step i=0 to num steps•compute bonded forces•compute non-bonded forces

• while non-bonded operations remaining• for j=0 to #SPUs

• create block with force-operations (200)• send control block with #ops to SPU-j• tell SPU-j to start processing

• for j=0 to #SPUs• if SPU-j finished, add forces to atoms

• break if all SPUs finished• integrate forces

PPUiter 0

iter 1

iter 2

Page 25: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Parallelization Approaches

• Force Decomposition - performance

260270280310390630310

6SPUs5SPUs4SPUs3SPUs2SPUs1SPUPPU

Non-bonded Forces Computation Time

0

100

200

300

400

500

600

700

PPU 1SPU 2SPUs 3SPUs 4SPUs 5SPUs 6SPUs

ms

Page 26: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Parallelization Approaches

• Atomic Decomposition

……

……

A3A1

A2A1

An

A2

A1 • atoms and forces stored independently

• doesn’t scale as easily with system size

Page 27: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

Parallelization Approaches

• Spatial Decomposition• not load-balanced

• atom positions must be communicated between processors

• periodically re-assign atoms

Page 28: Student Project Presentation Molecular Dynamicsgroups.csail.mit.edu/cag/ps3/projects/6.189-molecular-dynamics.pdf · Student Project Presentation Molecular Dynamics Pintilie. Molecular

State of the Art - NAMD

• force-spatial decomposition