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.

of the G vectors, <strong>and</strong> only real operations have to be performed. Approximately afactor of three in operations can be save this way. Special care has to be taken forthe zero G vector. It is assumed that this plane wave component is stored in thefirst position of the arrays.MODULE DotProducte = A(1) * B(1)FOR i=2:N Dar = REAL(A(i))ai = IMAG(A(i))br = REAL(B(i))bi = IMAG(B(i))e = e + 2 * (ar * br + ai * bi)ENDThis loop structure is available in the blas library, optimized on most computerarchitectures. To use the blas routines for real variables, complex numbers haveto be stored as two real numbers in contiguous memory locations.e = A(1) * B(1) + 2 * sdot(2 * N D - 2,A(2),1,B(2),1)The calculation of overlap matrices between sets of vectors in real space is a importanttask in the orthogonalization stepS ij = ∑ GA ⋆ i (G)B j (G) . (263)It can be executed by using matrix multiply routines from the blas library. Thespecial case of the zero G vector is h<strong>and</strong>led by a routine that performs a rank 1update of the final matrix.MODULE OverlapCALL SGEMM(’T’,’N’,N b ,N b ,2*N PW ,2,&& ca(1,1),2*N PW ,cb(1,1),2*N PW ,0,smat,N b )CALL SDER(N b ,N b ,-1,ca(1,1),2*N PW ,cb(1,1),2*N PW ,smat,N b )For a symmetric overlap additional time can be saved by using the symmetricmatrix multiply routine. The overlap routines scale like N 2 b N PW. It is thereforevery important to have an implementation of these parts that performs close topeek performance.MODULE SymmetricOverlapCALL SSYRK(’U’,’T’,N b ,2*N PW ,2,ca(1,1),2*N PW ,0,smat,N b )CALL SDER(N b ,N b ,-1,ca(1,1),2*N PW ,cb(1,1),2*N PW ,smat,N b )Another operation that scales as the overlap matrix calculations is the rotation of79

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

Saved successfully!

Ooh no, something went wrong!