[Pw_forum] Electrons kinetic energy

Pietro Bonfa' pietro.bonfa at fis.unipr.it
Wed Oct 16 17:04:19 CEST 2013

Dear All,

following the recipes given in this thread:


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

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
    11	     !
    12	     CALL sym_rho ( 1, aux2 )
    13	     !
    14	     aux(:) = (0.0_dp, 0.0_dp)
    15	     aux(nl(:)) = aux2(:)
    16	     DEALLOCATE (aux2)
    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
CALL fwfft ('Smooth', aux, dfftp)
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)?


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://lists.quantum-espresso.org/pipermail/users/attachments/20131016/9c7d5c2a/attachment.bin>

More information about the users mailing list