12.07.2015 Views

Ab initio molecular dynamics: Theory and Implementation

Ab initio molecular dynamics: Theory and Implementation

Ab initio molecular dynamics: Theory and Implementation

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

with system size.eigr(N D ,N at ) structure factorsfnl(N p ,N b ) overlap of projectors <strong>and</strong> b<strong>and</strong>sdfnl(N p ,N b ,3) derivative of fnlsmat(N b ,N b ) overlap matrices between b<strong>and</strong>scr(N PW ,N b ) b<strong>and</strong>s in Fourier spacecv(N PW ,N b ) velocity of b<strong>and</strong>s in Fourier spacecf(N PW ,N b ) forces of b<strong>and</strong>s in Fourier spaceIn order to save memory it is possible to store the structure factors only for theG vectors of the wave function basis or even not to store them at all. However,this requires that the missing structure factors are recomputed whenever needed.The structure factors eigr <strong>and</strong> the wavefunction related quantities cr, cv, cf arecomplex numbers. Other quantities, like the local pseudopotential vps, the corecharges rpc, <strong>and</strong> the projectors pro can be stored as real numbers if the factor(−i) l is excluded.3.8.2 CPMD Program: Computational KernelsMost of the calculations in a plane wave code are done in only a few kernel routines.These routines are given in this section using a pseudo code language. Wherepossible an implementation using basic linear algebra (blas) routines is given. Thefirst kernel is the calculation of the structure factors. The exponential function ofthe structure factor separates in three parts along the directions s x , s y , s z .MODULE StructureFactorFOR i=1:N ats(1:3) = 2 * PI * MATMUL[htm1(1:3,1:3),r(1:3,i)]dp(1:3) = CMPLX[COS[s(1:3)],SIN[s(1:3)]]dm(1:3) = CONJG[dp(1:3)]e(0,1:3,i) = 1FOR k=1:g maxe(k,1:3,i) = e(k-1,1:3,i) * dpe(-k,1:3,i) = e(-k+1,1:3,i) * dmENDFOR j=0:N Deigr(j,i) = e(g(1,j),1,i) * e(g(2,j),2,i) * e(g(3,j),3,i)ENDENDIn the module above htm1 is the matrix (h t ) −1 . One of the most important calculationis the inner product of two vectors in Fourier space. This kernel appears forexample in the calculation of energiese = ∑ GA ⋆ (G)B(G) . (262)Making use of the fact that both functions are real the sum can be restricted to half78

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!