









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










The nearly universal choice for an integrator is the Verlet (leapfrog) algorithm
r(t+h) = r(t) + v(t) h + 1/2 a(t) h^2 + b(t) h^3 + O(h^4 ) Taylor expand
r(t-h) = r(t) - v(t) h + 1/2 a(t) h^2 - b(t) h^3 + O(h^4 ) Reverse time
r(t+h) = 2 r(t) - r(t-h) + a(t) h^2 + O(h^4 ) Add
v(t) = (r(t+h) - r(t-h))/(2h) + O(h^2 ) estimate velocities
Time reversal invariance is built in the energy does not drift.
r (t+h) = r (t) +h [ v (t) +(h/2) a (t)] v (t+h/2) = v (t)+(h/2) a (t) v (t+h)= v (t+h/2) + (h/2) a (t+h)
Important because spatial scales are limited. What can we choose?
Is the system periodic or just an infinite array of images?
How do you calculate distances in a periodic system?
Complexity of Force Calculations
! Loop over all pairs of atoms. do i=2,natoms do j=1,i- !Compute distance between i and j. r2 = 0 do k=1,ndim dx(k) = r(k,i) - r(k,j) !Periodic boundary conditions. if(dx(k).gt. ell2(k)) dx(k) = dx(k)- ell(k) if(dx(k).lt.-ell2(k)) dx(k) = dx(k)+ell(k) r2 = r2 + dx(k)*dx(k) enddo
!Only compute for pairs inside radial cutoff. if(r2.lt.rcut2) then r2i=sigma2/r r6i=r2ir2ir2i !Shifted Lennard-Jones potential. pot = pot+eps4ri6(ri6-1)- potcut !Radial force. rforce = eps24r6ir2i(2r6i-1) do k = 1 , ndim force(k,i)=force(k,i) + rforcedx(k) force(k,j)=force(k,j) - rforcedx(k) enddo endif enddo enddo
d i j dr i j