Page 3 of 5

Re: BSE spectra considering momentum

Posted: Fri Apr 30, 2021 10:26 am
by Davide Sangalli
Dear Pangrt,
I think the issue is then that the

Code: Select all

ndb.BS_diago
was produced with a version of yambo < 5.0.
Am I right?
What do you get if you do:

Code: Select all

ncdump -v HEAD_VERSION ndb.BS_diago_Q3
?
The variable PARS had size=5 with previous versions of yambo, while yambo 5.0 expects a variable of size 6

As a workaround you can open the file src/io/io_BSS_diago.F
and replace these lines

Code: Select all

   call io_elemental(ID,VAR="PARS",VAR_SZ=6,MENU=0)
   !
   call io_elemental(ID,VAR="[BSS] Eigenstates included",L0=BSS_write_eig_2_db,CHECK=.true.,OP=(/"=="/))
   if(iq==1) then
     call io_elemental(ID,VAR="[BSS] Field direction",R1=BSS_q0,CHECK=.true.,OP=(/"==","==","=="/))
     if (allocated(BSqpts)) BSqpts(:,iq)=BSS_q0
   endif
   call io_elemental(ID,VAR="[BSS] Eigenstates computed     ",I0=BSS_n_eig,CHECK=.true.,OP=(/"=="/))
   call io_elemental(ID,VAR="[BSS] Number of BSE matricies  ",I0=BS_mat_res_ares_dim,CHECK=.true.,OP=(/"=="/))
   call io_elemental(ID,VAR="",VAR_SZ=0,MENU=1)
with

Code: Select all

   call io_elemental(ID,VAR="PARS",VAR_SZ=5,MENU=0)
   !
   call io_elemental(ID,VAR="[BSS] Eigenstates included",L0=BSS_write_eig_2_db,CHECK=.true.,OP=(/"=="/))
   if(iq==1) then
     call io_elemental(ID,VAR="[BSS] Field direction",R1=BSS_q0,CHECK=.true.,OP=(/"==","==","=="/))
     if (allocated(BSqpts)) BSqpts(:,iq)=BSS_q0
   endif
   call io_elemental(ID,VAR="[BSS] Eigenstates computed     ",I0=BSS_n_eig,CHECK=.true.,OP=(/"=="/))
   !call io_elemental(ID,VAR="[BSS] Number of BSE matricies  ",I0=BS_mat_res_ares_dim,CHECK=.true.,OP=(/"=="/))
   call io_elemental(ID,VAR="",VAR_SZ=0,MENU=1)
and then recompile ypp. You can rename the newly compiled ypp

Code: Select all

mv ypp ypp_back_compatible
and then restore the file in ints original version.

In the future, we'll probably release a patch for automatic detection of the database version and back-compatibility.

Best,
D.

Re: BSE spectra considering momentum

Posted: Thu May 20, 2021 5:32 pm
by Fadil
Dear all,

As mentioned earlier in this post, dipole matrix elements are calculated only for q = 0.
Is it possible to extract \rho_nmk values for finite-q?

Best

Re: BSE spectra considering momentum

Posted: Thu May 20, 2021 6:12 pm
by Daniele Varsano
Dear Fadıl,
this elements are not stored. You should extract them from the code, e.g. in
./src/bse/K_IP.F

here you can find the indexes:

Code: Select all

216        BSE_scatt%is=(/ic,ik,isymm,i_sp_pol_c/)
217        BSE_scatt%os=(/iv,ok,osymm,i_sp_pol_v/)
218        BSE_scatt%qs=(/iGo,iq,1/)
and here they are computed:

Code: Select all

257          if(trim(global_gauge)=="length")   call scatter_Bamp(BSE_scatt)
The subroutine that calculate them is in:
src/wf_and_fft/scatter_Bamp.F

Best,
Daniele

Re: BSE spectra considering momentum

Posted: Thu May 20, 2021 9:46 pm
by Fadil
Dear Daniele,
Thank you for your quick reply.
So, basically, I need to print out 'BSE_scatt%is', 'BSE_scatt%os' and 'BSE_scatt%qs' values from the ./src/bse/K_IP.F file, right?
Can you briefly explain what are these indexes? Are they similar to the 'BS_mat(neh,i_l)' indexes calculated for q = 0?

Best

Re: BSE spectra considering momentum

Posted: Fri May 21, 2021 8:33 am
by Daniele Varsano
Dear Fadil,
if I have well understood you are seeking these matrix elements <vk-q|e^iqr|ck>

Here:
BSE_scatt%is --> ic,ik
BSE_scatt%os-->iv, ok where ok is the index for ik-iq
BSE_scatt%qs. --> iq

the matrix elements are in:
BSE_scatt%rhotw(1)


Best,
Daniele

Re: BSE spectra considering momentum

Posted: Tue May 25, 2021 5:47 pm
by Fadil
Thank you Daniele!
This is exactly what I'm looking for.
For RPA calculations (without BSE), how can I obtain the same matrix elements ?
i.e. from which folder, which matrix elements?

Best

Re: BSE spectra considering momentum

Posted: Wed May 26, 2021 9:16 am
by Daniele Varsano
Dear Fadil,

you can find them in:
./src/pol_function/X_irredux_residuals.F
with similar notation:

Code: Select all

  Xo_scatt%is=(/ic,ik,is,i_spin/)
  Xo_scatt%os=(/iv,ikp,isp,i_spin/)
  Xo_scatt%qs=(/qindx_X(iq,ikbz,2),iq,1/)
matrix elements in:

Code: Select all

Xo_scatt%rhotw

Best,

Daniele

Re: BSE spectra considering momentum

Posted: Tue Jun 01, 2021 3:27 pm
by Fadil
Dear Daniele,

Thank you in advance!
One last question, how can I obtain wave function coefficients (C_{nk}) and G vectors as in the following link;
http://www.yambo-code.org/wiki/index.ph ... sformation

Best

Re: BSE spectra considering momentum

Posted: Tue Jun 01, 2021 4:31 pm
by Daniele Varsano
Dear Fadil,

the G_nk(G) are stored in the ns.wf_fragments_* files in the SAVE directory, a single file for each k point.
The easiest way to read them is via a python script reading the netcdf format:

The dimensions are:
WF_COMPONENTS_@_SP_POL1_K1_BAND_GRP_1(D_0000000100, D_0000000001, D_0000001016, D_0000000002) ;

from left Re/Im, gvector, spin, nband

The gvectors g_vec(ig,3) are 2p*n_i/Li
can be found e.g. here:
./setup/G_shells_finder.F
search for
g_vec(ig_1,:).

Best,
Daniele

Re: BSE spectra considering momentum

Posted: Tue Jun 01, 2021 5:06 pm
by Fadil
Are there any yambopy script created to read the 'ns.wf_fragments_*' files ?

Best