Page 1 of 2

Printing/plotting g coefficients (and: restarting a calc)

Posted: Thu May 19, 2016 5:47 pm
by gio.piz
Dear all,
We have started to use the new version of EPW. In particular, in our case, we are working on a 2D semiconductor, and we are interested (eventually) to estimate the mobility for electrons and holes.

At this stage, however, we are mainly interested in figuring out the relative importance (i.e., scattering time) of ZA phonons w.r.t. LA,TA and optical phonons to see if one contribution is dominant, as well as to understand how anisotropic the scattering is for our material. So, probably, it would be enough for the time being to produce some plots similar to e.g. Fig. 8 of this paper http://dx.doi.org/10.1063/1.4887538 (or, more generally, how to output on a file -- or read from a file already written by EPW -- the matrix elements g for a given band/k vector and phonon branch, as a function of q) - in your tutorial http://epw.org.uk/Documentation/GaN you say that it is easy to print these quantities by modifying the code, but if you could give us some 'pointers' to which arrays to look, and which indices indentify the different physical indices (k,q,n,...) it would be extremely helpful for us. (or maybe there is already a flag to output what we need?)

Also, when running your example http://epw.org.uk/Documentation/GaN, a big file gan.epmatwp1 is generated, that (we think) contains the quantities we need. It would therefore be useful to just 'restart' the code and have it print the quantities we want, instead of re-running epw.

We tried changing the flags kmaps, epbread, epwread from False to True, and epbwrite, epwwrite, and wannierize from True to False. Is this enough? When running after these changes, the code "stops" after printing "Reading Hamiltonian, Dynamical matrix and EP vertex in Wann rep from file" (meaning that it runs for a long time > 1h, but it fills all the machine memory so the machine basically hangs - note we are running with 8 pools). Is this the correct way to restart EPW? Is there a way to reduce memory consumption?

Thanks in advance,
Giovanni Pizzi and Marco Gibertini
(EPFL, Switzerland)

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Thu May 19, 2016 6:09 pm
by sponce
Hello Giovanni and Marco,

I will try to reply to your two questions:
1) It seems that plotting the g^2 seems to be a demanded feature. I will implement something with an input variable in the near future.
In the meantime, if you want to print the electron-phonon matrix elements, you will need to hack the code.
What you need to print is the epmatf variable from the ephwann_shuffle.f90 file.
Note that you need to print g times its complex conjugate as the electron-phonon matrix elements has a phase.
Moreover, there is an arbitrary gauge in case of degenerate states. Only the average of g^2 is physically meaningful. You therefore need to average on bands that have degenerate eigenenergies as well as degenerate phonon modes.
Finally I must mention that the epmatf variables does not contain the phonon frequency. You will therefore need to do something like

Code: Select all

abs(epmatf (jbnd, ibnd, imode))**two / (two * wq)

in order to have the quantity you want.

2) If you have memory issues, I recommend to use

Code: Select all

etf_mem     = .false.

To restart a calculation after the si.epmatwp1 file has been correctly written to file, you need to do

Code: Select all

  wannierize  = .false.
  epbwrite    = .false.
  epbread     = .false.
  epwwrite    = .false.
  epwread     = .true.


I hope this answers your questions?

Best,

Samuel

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Mon May 30, 2016 6:33 am
by gio.piz
Thanks a lot!

An additional question: in that module, is it possible to get also the energies of the electronic bands at k and at k+q? Are they already in a stored array, or can I get them in some way?

Moreover, is there already a routine in EPW to calculate the electron relaxation times tau_{n,k} due to el-ph scattering?

Thanks,
Giovanni

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Mon May 30, 2016 1:41 pm
by carla.verdi
Hi Giovanni,

The electron energies at k and k+q are in the arrays etf(:,:) where the first index is the wannier band. To access the energies at k you need etf(:,ikk) and for the energies at k+q etf(:,ikq).

Currently you can find ImS for each k, band in the output and in the file 'linewidth.elself'; you then need to calculate tau_nk yourself by extracting ImS_nk.

Cheers
Carla

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Mon May 30, 2016 5:06 pm
by sponce
Hi Giovanni,

Thank you again for reporting the outdir bug.

I have commit the debug to the trunk of QE.

One just need to add

Code: Select all

  USE io_files,      ONLY : prefix, tmp_dir

as well as

Code: Select all

    filint = trim(tmp_dir)//trim(prefix)//'.epmatwp1'

in ephwan2blochp.f90

Best,

Samuel

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Wed Jun 22, 2016 7:41 pm
by Vahid
Dear EPW Users,

Following the above post on extracting etf(:;ikk) and etf(:;ikq), I have added the following lines (marked ADDED TO THE CODE) to the selfen_elec.f90 at line 290 shortly after where poolgather2 collects all the etf values from the pools:

Code: Select all

#ifdef __PARA
     !
     ! note that poolgather2 works with the doubled grid (k and k+q)
     !
     CALL poolgather2 ( 3,       nkqtotf, nkqf, xkf,    xkf_all  )
     CALL poolgather2 ( nbndsub, nkqtotf, nkqf, etf,    etf_all  )
     CALL mp_sum( sigmar_all, inter_pool_comm )
     CALL mp_sum( sigmai_all, inter_pool_comm )
     IF (iverbosity == 3) CALL mp_sum( sigmai_mode, inter_pool_comm )
     CALL mp_sum( zi_all, inter_pool_comm )
     CALL mp_sum(fermicount, inter_pool_comm)
     CALL mp_barrier(inter_pool_comm)
     !
#else
     !
     xkf_all = xkf
     etf_all = etf
     !
#endif
     !
     ! Output electron SE here after looping over all q-points (with their contributions
     ! summed in sigmar_all, etc.)

!************************************** ADDED TO THE CODE*************************
     OPEN(unit=996,file='etf_ikk.dat')
     OPEN(unit=998,file='etf_ikq.dat')
        DO ik = 1, nkf

        IF (lgamma) THEN
           ikk = ik
           ikq = ik
        ELSE
           ikk = 2 * ik - 1
           ikq = ikk + 1
        ENDIF

        write(996,*) etf_all(:,ikk)
        write(998,*) etf_all(:,ikq)

     ENDDO
     CLOSE(996)
     CLOSE(998)
!**********************************************************************************


I ran the B-doped diamond example with 10x10x10 fine q-grid (to speed up the calculations) and no fsthick. When I ran the code serially, I get 201 lines (the line segment has 201 k-points) in the elf_ikk.dat and etf_ikq.dat with each line having 4 energies corresponding to the 4 wannier bands. I believe this is correct. But when I ran the same input on 8 cpus and 8 pools, the two data files only had 26 lines. I was expecting the poolgather2 to put all the etf values in the etf_total but I only get the etf from one of the pools.

Does anyone have any suggestions as to how to get the etf(;ikk) and etf(:;ikq) from all the pools in case of a parallel run?

Thank you,

Vahid

Vahid Askarpour
Department of Physics and Atmospheric Science
Dalhousie University,
Halifax, NS, Canada

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Wed Jun 22, 2016 7:52 pm
by roxana
Dear Vahid,

The loop over ik should be "DO ik = 1, nksqtotf" same as when Sigma is written to file.

Best,
Roxana

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Wed Jun 22, 2016 10:03 pm
by Vahid
Dear Roxana,

Thank you. That change resulted in correct etf values.

Best wishes,

Vahid

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Fri Jul 22, 2016 9:08 am
by huebener
Dear All,

I have a question on the index ordering of epmatf (jbnd, ibnd, imode) that are, if I understood correctly, the matrix elements given in Eq. 2 in Noffsinger et al. Comp. Phys. Comm. 181 (2010) 2140 (http://dx.doi.org/10.1016/j.cpc.2010.08.027) : Which of the electronic band indices is carrying the k and which the k+q?

Is is: < jbnd,k | dV_q,imode | ibnd,k+q > or < ibnd,k | dV_q,imode | jbnd,k+q > ?

Thank you very much for your help.

Cheers,
Hannes

Re: Printing/plotting g coefficients (and: restarting a calc

Posted: Fri Jul 22, 2016 9:31 am
by carla.verdi
Dear Hannes

It is < jbnd,k+q | dV_q,imode | ibnd,k >

Cheers
Carla