# [Pw_forum] Wave function to charge density

Stefano de Gironcoli degironc at sissa.it
Wed Dec 12 14:52:11 CET 2007

the charge density is calculated in PW/sum_band.f90
the meaning of igk, nls, nl (that is the way they should be used in
order to go from the indexing of evc to the fft grid)
is exemplified there.
hope this helps,
stefano

Dmitry Korotin wrote:
> Dear ESPRESSO developers,
> Could you explain me meaning and usage on nls(), nl() and igk()
> I have some Wannier-function stored in array wf(1:npwx). The order of
> plane waves in the array index is the same that used for evc() array.
> Now I want to generate charge density of my Wannier-function in
> G-space and add it to the total charge density in the cell (I can do
> it in the routine electrons() before charge densities mixing).
>
> It is clear that rho_{g,g'} = \sum_k wk*wf(g)*wf^{*}(g')
> But how to convert this square array to linear array rhognew(ngm) form
> used in the code (file electrons.f90)?
>
> I know that my question is strongly technical, and, I think, not
> interesting for other community members, but I have no other place to
>
> Dmitry Korotin
> PhD student,
> Institute of Metal Physics,
> Ural branch of RAS,
> Russia
> _______________________________________________
> Pw_forum mailing list
> Pw_forum at pwscf.org
> http://www.democritos.it/mailman/listinfo/pw_forum
>