# [Pw_forum] D3 code (from the PHonon package) output

Lorenzo Paulatto lorenzo.paulatto at impmc.upmc.fr
Mon Jul 21 10:45:52 CEST 2014

```Dear Éric,
what you are looking for does not necessarily exists: the potential is
composed of local and nonlocal parts. The non-local parts only make
sense when applied to a wavefunction. In other words, you can compute
<psi|V^3|psi> but not necessarily V^3(r). Also keep in mind that there
is one derivative for each phonon, i.e. (3*nat)^3 derivatives.

That said, if you know what you are doing, the third derivative of the
local part of the external potential  is computed in G-space in the
first few lines of PHonon/D3/d3vrho.f90. It is also immediately
multiplied by rho and integrated, but it's easy to skip that part, and
even easier to FFT it to real space at the end.

This code should make what you want, no guarantee especially on +, - and
"i" factors:

USE vlocal,               ONLY : vloc
! vloc must be initialized, this happens in init_vloc, called by hinit0
and plenty other places
...
allocate  (d3vloc( dfftp%nnr))
do na_i = npert_i, npert_f
na = (na_i - 1) / 3 + 1
icart = na_i - 3 * (na - 1)
do jcart = 1, 3
na_j = 3 * (na - 1) + jcart
do kcart = 1, 3
na_k = 3 * (na - 1) + kcart
do ng = 1, ngm
gtau = tpi * (g (1, ng) * tau (1, na) + g (2, ng) * tau (2,
na) + g (3, ng) * tau (3, na) )
fac = vloc (igtongl (ng), ityp (na) ) * tpiba**3 * omega
*exp ((0.d0,1.d0)*gtau)
d3vloc (nl(ng),na_i, na_j, na_k) = fac * g (icart, ng) * g
(jcart, ng) * g (kcart, ng)
enddo
enddo
enddo
enddo
CALL fwfft ('Dense', d3vloc, dfftp)

On 07/21/2014 08:58 AM, Éric Germaneau wrote:
> Dear all,
>
> The D3 code computes the 3rd derivatives of the potential in
> reciprocal space as well as complex calculations.
> What I need is just the 3rd derivatives of the potential in real space.
> From the manual the code must compute them.
> I'm wondering whether this intermediate calculation is printed out.
> I actually, did not find any information about the output format/content.
> Has anyone enough experiences with D3 to shed some light on this matter?
> Thank you,
>
>            Éric.
>
> --
> Éric Germaneau (???), Specialist
> Center for High Performance Computing
> Shanghai Jiao Tong University
> Room 205 Network Center, 800 Dongchuan Road, Shanghai 200240 China
> M:germaneau at sjtu.edu.cn P:+86-136-4161-6480 W:http://hpc.sjtu.edu.cn
>
>
> _______________________________________________
> Pw_forum mailing list
> Pw_forum at pwscf.org
> http://pwscf.org/mailman/listinfo/pw_forum

--
Dr. Lorenzo Paulatto
IdR @ IMPMC -- CNRS & Université Paris 6
+33 (0)1 44 275 084 / skype: paulatz
http://www.impmc.upmc.fr/~paulatto/
23-24/4é16 Boîte courrier 115, 4 place Jussieu 75252 Paris Cédex 05

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20140721/434c71e2/attachment.html>
```