[Pw_forum] charge density and pot file

Paolo Giannozzi giannozz at nest.sns.it
Tue Oct 11 17:07:15 CEST 2005


On Monday 10 October 2005 13:50, Lilia Boeri wrote:

> I would be interested in obtaining the potential/density 
> file in G-space instead of r-space. Has anybody faced/solved
> the same problem before? 

it is not really a new problem: converting from G- to r-space is
done all the time in the code. You need to know how data is 
stored and organized, though, or else you may adopt the "monkey 
technique": find a piece of code that does what you need and
copy it. A good place to look at and to modify could be routine 
PP/chdens.f90, where you do not need to consider the k=0
and the parallel case. Basically you need to copy the (real) 
charge density in real space to a complex array, make the fft, 
then re-order the array:

  psic(:) = DCMPLX (rhor(:), 0.d0)
  call cft3 (psic, nr1, nr2, nr3, nrx1, nrx2, nrx3, - 1)
  allocate (rhog( ngm))
  rhog (:) = psic (nl (:) )

rhog(i), i=1, ngm, should contain the Fourier component for 
G = g(:,i) (2pi/a units) whose norm is gg(i) ( (2pi/a)^2 units)

Paolo

-- 
Paolo Giannozzi             e-mail:  giannozz at nest.sns.it
Scuola Normale Superiore    Phone:   +39/050-509876, Fax:-563513 
Piazza dei Cavalieri 7      I-56126 Pisa, Italy



More information about the Pw_forum mailing list