Dear All, following the recipes given in this thread:
http://qe-forge.org/pipermail/pw_forum/2009-May/087347.html I added two routines to the pp.x code to calculate the average electronic kinetic energy. I started from both the elf.f90 subroutine in PP code and from the pw2casino implementation. It's almost only a matter of copy/paste but there is a thing I cannot understand. Let "kkin" be the variable with the kinetic energy density, following the elf.f90 code I have: 0 ! symmetrize the local kinetic energy if needed 1 IF ( .not. gamma_only) THEN 2 ! 3 CALL sym_rho_init ( gamma_only ) 4 ! 5 aux(:) = cmplx ( kkin (:), 0.0_dp, kind=dp) 6 CALL fwfft ('Dense', aux, dfftp) 7 ALLOCATE (aux2(ngm)) 8 aux2(:) = aux(nl(:)) 9 ! 10 ! aux2 contains the local kinetic energy in G-space to be symmetrized 11 ! 12 CALL sym_rho ( 1, aux2 ) 13 ! 14 aux(:) = (0.0_dp, 0.0_dp) 15 aux(nl(:)) = aux2(:) 16 DEALLOCATE (aux2) 17 18 CALL invfft ('Dense', aux, dfftp) 19 kkin (:) = dble(aux(:)) 20 ! 21 ENDIF 22 T = sum( kkin(:) )*omega / ( dfftp%nr1*dfftp%nr2*dfftp%nr3 ) To get the correct kinetic energy (T), with respect to elf.f90, I had to change CALL fwfft ('Smooth', aux, dfftp) to CALL fwfft ('Dense', aux, dfftp) on line 6 because otherwise I couldn't perform the sum correctly (even if using dffts%nr1 nr2 nr3). With this trick the elf-derived and the pw2casino-derived routines give similar results in all the cases I used for testing. Nonetheless, I'm completely unfamiliar with the QE implementation, and probably there is no need to change Smooth to Dense. Moreover, I don't really know if performing sym_rho on the Dense grid is fine or not. Can someone please help me figure out my mistake(s)? Thanks, Pietro ps: the subroutines are attached. -- Pietro Bonfa' - PhD student Dipartimento di Fisica e Scienze della Terra "Macedonio Melloni" Viale delle Scienze 7A 43124 Parma - Italy -------------- next part -------------- A non-text attachment was scrubbed... Name: kinetic.f90 Type: text/x-fortran Size: 10670 bytes Desc: not available Url : http://pwscf.org/pipermail/pw_forum/attachments/20131016/9c7d5c2a/attachment.bin
