chapter 9: molecular-dynamics integrate equations of motion-- classical! discrete form of newton’s...

13
Chapter 9: Molecular-dynamics • Integrate equations of motion-- classical! • Discrete form of Newton’s second law • Forces from interaction potential • For a simple pair potential, we get r F i =− r i U r r 1 , r r 2 ,..., r r N ( ) U r r 1 ,..., r r N ( ) = 1 2 u ( ij r ij )

Upload: julius-miller

Post on 17-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

Chapter 9: Molecular-dynamics

• Integrate equations of motion-- classical!

• Discrete form of Newton’s second law

• Forces from interaction potential

• For a simple pair potential, we get

rF i = −

r ∇ iU

r r 1,

r r 2,...,

r r N( )

Ur r 1,...,

r r N( ) =

1

2u(

ij∑ rij )

Page 2: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

Integrating equations of motion

Fi,x = mi

dv i,x

dt

Fi,y = mi

dv i,y

dt

Fi,z = mi

dv i,z

dt

dv i,x

dt=

d2x i

dt 2≈

x i(n +1) − 2x i(n) + x i(n −1)

Δt 2

x i(n +1) = 2x i(n) − x i(n −1) +Fi,x

mi

Δt 2

This works out to give the Verlet algorithm,

Page 3: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

Lennard-Jones potential for noble gas

V r( ) = 4εσ

r

⎝ ⎜

⎠ ⎟

12

−σ

r

⎝ ⎜

⎠ ⎟6 ⎡

⎣ ⎢

⎦ ⎥

QuickTime™ and aTIFF (LZW) decompressor

are needed to see this picture.

Page 4: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

Placing atoms on fcc lattice… non-primitive basis

! start with non-primitive fcc basis r1(1)=0.0d0 r2(1)=0.0d0 r3(1)=0.0d0

r1(2)=0.5d0 r2(2)=0.5d0 r3(2)=0.0d0

r1(3)=0.5d0 r2(3)=0.0d0 r3(3)=0.5d0 r1(4)=0.0d0 r2(4)=0.5d0 r3(4)=0.5d0

Page 5: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

Some parameters for lattice…

INTEGER, PARAMETER :: nn=10 INTEGER, PARAMETER :: Prec14=SELECTED_REAL_KIND(14) INTEGER, PARAMETER :: natoms=4*nn**3 INTEGER, PARAMETER :: nx=nn,ny=nn,nz=nn REAL(KIND=Prec14), PARAMETER :: sigma=1.0d0,epsilon=1.0d0 REAL(KIND=Prec14), PARAMETER :: L=sigma*2.0d0**(2.0d0/3.0d0)*nn

Page 6: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

Generate the full lattice

n=0 do ix=1,nx do iy=1,ny do iz=1,nz do i=1,4 n=n+1 rx(n)=(r1(i)+dble(ix-1))*sigma ry(n)=(r2(i)+dble(iy-1))*sigma rz(n)=(r3(i)+dble(iz-1))*sigma enddo enddo enddo enddo! scale lengths by box size rx=rx/nx ry=ry/ny rz=rz/nz

Page 7: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

! Compute potential and force at cutoff

sovr=sigma/rcut vcut=4.0d0*epsilon*(sovr**12-sovr**6) fcut=(24.0d0*epsilon/rcut)*(2.0d0*sovr**12-sovr**6)

Some preliminaries…

Page 8: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

! Initialize velocities by picking last position call RANDOM_SEED do n=1,natoms call RANDOM_NUMBER(ranx) call RANDOM_NUMBER(rany) call RANDOM_NUMBER(ranz) rxl(n)=rx(n)+v0*(0.5d0-ranx) ryl(n)=ry(n)+v0*(0.5d0-rany) rzl(n)=rz(n)+v0*(0.5d0-ranz) enddo

Initialize velocities using random-number generator

Must adjust everything to give zero net momentum…

Page 9: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

do i=1,natoms-1 do j=i+1,natoms sxij=rx(i)-rx(j) syij=ry(i)-ry(j) szij=rz(i)-rz(j) sxij=sxij-dble(anint(sxij)) syij=syij-dble(anint(syij)) szij=szij-dble(anint(szij)) rij=L*dsqrt(sxij**2+syij**2+szij**2) if(rij.lt.rcut) then sovr=sigma/rij epot=epot+4.0d0*epsilon*(sovr**12-sovr**6)-vcut+fcut*(rij-rcut) fij=-(24.0d0*epsilon/rij)*(2.0d0*sovr**12-sovr**6)+fcut

get x,y,z components of force, use Newton’s 3rd law…

Implementing periodic boundary conditions:Computing forces and potential energy…

Page 10: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

! Verlet algorithm to move atoms, compute kinetic energy do i=1,natoms rxx=2.0d0*rx(i)-rxl(i)+fx(i)*dt**2/(amass*L) ryy=2.0d0*ry(i)-ryl(i)+fy(i)*dt**2/(amass*L) rzz=2.0d0*rz(i)-rzl(i)+fz(i)*dt**2/(amass*L) vx=(rxx-rxl(i))*L/(2.0d0*dt) vy=(ryy-ryl(i))*L/(2.0d0*dt) vz=(rzz-rzl(i))*L/(2.0d0*dt) vsq=vx**2+vy**2+vz**2 ekin=ekin+0.5d0*amass*vsq rxl(i)=rx(i) ryl(i)=ry(i) rzl(i)=rz(i) rx(i)=rxx ry(i)=ryy rz(i)=rzz enddo

Advance atoms, compute kinetic energy….

Page 11: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

ekin=ekin/natoms; epot= epot/natoms; etot=epot+ekin time=time+tunit*dt temp=(2.0d0/3.0d0)*eps*ekin write(6,100) n,time,ekin,epot,etot,temp enddo

100 format(i8,f12.2,4f18.6)

Output including time and temperature

eps=120 for Argon potential…. energy scale

Ekin,epot, temp will fluctuate… etot should be fairlyStable if small enough time step used…

Page 12: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

Heat capacity

C =H 2 − H

2

kBT 2

• Angle brackets thermal average• In MD, thermal averages done by time average• Heat capacity given by fluctuations in total energy

The computed epot and temperature can be used to determineheat capacity (output in units of kB)

Page 13: Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple

Radial distribution function

g(r) =1

ρNδ r − rij( )

i≠ j

• is the density N/ Dirac-delta defined numerically (not infinitely sharp)• In an ideal gas, g(r) =1• In a liquid, g(r) =1 at long ranges, short range structure• In a crystal, g( r) has sharp peaks, long-range order