[Pw_forum] Normalization of the Wave Functions

Giovanni La Penna glapenna at iccom.cnr.it
Fri Dec 23 17:18:58 CET 2011


I used the Kohn-Sham states output of PP analysis program
and they are normalized to one with ultrasoft pseudopotentials.
See below for gamma-point only (psi are real,
see also comments in the PP code).
Unfortunately, this implies to store all the states,
as cube-files in the example below.

PP input:

&inputpp
  prefix='relax',
  outdir='./',
  filplot='state.out',
  plot_num=7,
  lsign = .true.,
  kpoint = 1,
  kband = 1,
/

&plot
  nfile=1,
  filepp(1)='state.out',
  iflag=3,
  fileout='state_1.cube',
  output_format=6,
/


Piece of analysis C code (single precision):

/* ... */

#define _REAL float
#define l_sqrt sqrtf
#define l_copysign copysignf
#define Nabs(dumx) ((dumx) >= 0 ? (dumx) : -(dumx))

/* ... */
/* dx,dy,dz are the grid sides in a.u. (bohr)
  nr1x,nr2x,nr3x are the number of grid points in x,y,z
  input[js] is the unit of state js output from PP
(state_1.cube above) */

   dvol=dx*dy*dz;

   sum=0.;
   for(i1=1;i1<=nr1x;i1++)
   {
    for(j1=1;j1<=nr2x;j1++)
    {
     for(k1=1;k1<=nr3x;k1++)
     {
      fscanf(input[js],"%e ",&val);
/* for ADF and CPMD this is enough. For QE... */
      um=val;
      ut=l_sqrt(Nabs(um));
      val=l_copysign(ut,um);

      sum+=val*val;
      fwrite(&val,sizeof(_REAL),1,output[is]);
     }
    }
   }

   printf ("Integral of modulus of state %d = %e\n",js,sum*dvol);
/* ... */

Hoping this be useful (even though slow), my best wishes,
               Giovanni

============================================================
Giovanni La Penna - National research council (Cnr)
Institute for chemistry of organo-metallic compounds (Iccom)
via Madonna del Piano 10,
I-50019 Sesto Fiorentino, Firenze, Italy
tel.: +39 055 522-5264, fax: +39 055 522-5203
e-mail: glapenna at iccom.cnr.it - http://www.iccom.cnr.it/lapenna
skype: giovannilapenna
============================================================




More information about the users mailing list