[Pw_forum] wavefunction coefficients

O. Baris Malcioglu baris.malcioglu at gmail.com
Mon Jan 26 18:22:52 CET 2009


Dear Karoly,

If you are willing to write an extension (including post processing
codes) to PWSCF, I would really recommend you to use already present
subroutines. For example in your case, you may have a look at
'davcio'. It depends on a number of preset constants. An example on
how to use it might be like this (I am omitting initialization which,
I am afraid, you will have to tailor according to your needs)  :

---------------------------------------------------------------------------------------------------------------------------
  use klist,                only : nks, xk
  use gvect,                only : ngm, g, ecutwfc
  use io_files,             only : nwordwfc, iunwfc, prefix
  use wvfct,                only : npw, igk, nbnd, g2kin, npwx
  use wavefunctions_module, only : evc


.....(whatever initialization necessary, have a look at
PW/read_file.f90 for reading already computed ones)...

nwordwfc = 2 * nbnd * npwx !The 'size' of the each wavefunction
segment written in file

  !
  call diropn ( iunwfc, 'wfc', nwordwfc, exst) ! This opens the .wfc
files in a machine dependent way. You have to set 'prefix' first.
  !
  if (.not.exst) call errore('lr_read_wfc', TRIM( prefix )//'.wfc'//'
not found',1) !Everyone here had its nice experiences with "errore"
right? The error reporting mechanism of PWSCF
  !
  do ik=1,nks ! k-point loop for this pool
     !
     !CALL gk_sort( xk(1,ik), ngm, g, ( ecutwfc / tpiba2 ), npw, igk,
g2kin ) !sorts the g vectors for identification purposes, this assures
that each processor has the same correspondence list (probably you
need this for your purposes )
      !
     call davcio(evc(1,1,ik),nwordwfc,iunwfc,ik,-1) !Reads the wfc.
Parameters: The variable where the wavefunction is stored, the block
size, the unit of the file, the k point you are interested in, and an
integer <0 reads >0 writes
     !
  enddo
  !
  CLOSE( UNIT = iunwfc) ! And we are done with the wfc files
!Note The wafefunctions are stored as :
evc(plane_wave_index,band_index,k_point_index)
---------------------------------------------------------------------------------------------------------------------------

For finding the number of plane waves (for each k point) you may
either investigate a pw.x screen output where they are (were?)
reported in the beginning, or use "PW/n_plane_waves.f90"

Hope this helps,

O. Baris Malcioglu
SISSA CM Sector.

On Thu, Jan 22, 2009 at 7:33 PM, Karoly Nemeth <nemeth at anl.gov> wrote:
>
> Thank you Gabriele! Since most of the time the *.wfc* are split among a
> few files, a utility that uses as input only the number of processors,
> nspin, and perhaps the number of basis functions could be useful. If the
> wfc files would be in hdf5 format it would be probably easier to figure
> out all their structure, but since this is not the case, a utility program
> could be quite useful for this purpose.
>
> Karoly
>
> ***********************************************************************
> Karoly Nemeth, Ph.D.
> Argonne National Laboratory
> 9700 S. Cass Ave. Argonne, IL 60439.
> Advanced Photon Source
> Accelerator Physics and Operations Group
> Building 401, Room B2200
> Tel. 630-252-5813
> Fax: 630-252-4732
> ***********************************************************************
>
>
>
>> Message: 3
>> Date: Thu, 22 Jan 2009 09:54:17 +0100
>> From: Gabriele Sclauzero <sclauzer at sissa.it>
>> Subject: Re: [Pw_forum] wavefunction coefficients
>> To: PWSCF Forum <pw_forum at pwscf.org>
>> Message-ID: <49783439.40104 at sissa.it>
>> Content-Type: text/plain; charset=us-ascii; format=flowed
>>
>> Hi,
>>
>>    of course Paolo and Axel could help you much more than me on this issue, but inthe
>> meanwhile:
>>
>> Karoly Nemeth wrote:
>>> Hi,
>>>
>>> I would like to obtain the wavefunction coefficients u(i,k,G), where "i"
>>> is the band-index, "k" is the k-space vector used in the discretization of
>>> the Brillouin-zone in a PW calculation and "G" is the plane-wave basis
>>> function's wave-vector (assuming a complex form as exp[i(k+G)r] ).
>>
>> I think that the quantities you are interested in are store in the variable "evc" of the
>> pw program (but only in certains parts of the program and only for one k-point at a time;
>>  the wavefunctions for all the k-points are stored on the .wfc files).
>>
>>>
>>> Is there any utility program that is independent from the rest of PWSCF
>>> and would provide some sort of tabulation on u(i,k,G) as a function
>>> of i,k and G , for a parallel calculation? Perhaps a quick quide to the
>>> format of this information in the *.wfc* files written by a parallel run?
>>
>> Be careful that in parallel runs the G vectors (i.e. plane waves) are split across
>> processor, so that each processor may be working only with a slab of the full grid.
>> The option wfc_collect=.TRUE. collects all wavefunctions on a single file after the
>> parallel run (maybe it can help you understand how to gather all the coefficients).
>>
>> GS
>>
>> PS: The forum community would be grateful if you specify your affiliation... thanks.
>>
>>>
>>> I would appreciate any hint that could save me some time from going
>>> through the source code for this info.
>>> Thanks a lot in advance:
>>>
>>> Karoly
>>>
> _______________________________________________
> Pw_forum mailing list
> Pw_forum at pwscf.org
> http://www.democritos.it/mailman/listinfo/pw_forum
>



More information about the users mailing list