What do you want exactly to calculate? The "average electron
kinetic energy" for norm-conserving pseudopotentials is a 
rather simple object. In atomic (Ry) units:
  \sum_k \sum_i f_{i,k} <\psi_{i,k}|\nabla^2|\psi_{i,k}> = 
  \sum_k \sum_i f_{i,k} \sum_G |\psi_i(k+G)|^2 (k+G)^2
where f_{i,k} is the occupancy of Kohn-Sham state \psi_{i,k}
whose plane-wave components are \psi_i(k+G). YOu do not need
the "local kinetic energy density": 
  \sum_k \sum_i f_{i,k} |\nabla psi_{k,i}(r)|**2
P.

On Wed, 2013-10-16 at 17:04 +0200, Pietro Bonfa' wrote:
> 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.
> 
> 
> _______________________________________________
> Pw_forum mailing list
> Pw_forum at pwscf.org
> http://pwscf.org/mailman/listinfo/pw_forum

-- 
 Paolo Giannozzi, Dept. Chemistry&Physics&Environment, 
 Univ. Udine, via delle Scienze 208, 33100 Udine, Italy
 Phone +39-0432-558216, fax +39-0432-558222 

Reply via email to