Skip to content

phys-gw-from-bareH: Segmentation fault in dipole_io for hf_and_locXC with covariant dipoles #187

Open

Description

@thge123

Description

Segmentation fault occurs in hf_and_locXC part when using BareHfromScratch with covariant dipoles (screenshot 1).

"yambo_sc" received signal SIGSEGV, Segmentation fault.

Possible cause

Related to a call to DIPOLE_IO from Bare_Hamiltonian_from_Scratch. DIPOLE_IO tries accessing the unallocated variable PAR_K_scheme%IND_bz%element_1D(ik) (line 202 in DIPOLE_IO.F) (screenshot 2).

PAR_K_scheme%ind_bz%element_1D should be allocated by the following line inside PARALLEL_SETUP_K_scheme (line 88 in PARALLEL_SETUP_K_scheme.F)

call PAR_INDEX_copy(PAR_IND_Xk_bz, PAR_K_scheme%IND_bz )

but PAR_IND_Xk_bz%element_1D seems to be unallocated to begin with (screenshot 3).

Is there a missing allocation step for PAR_IND_Xk_bz%element_1D somewhere before?

Steps to reproduce

HF_and_locXC calculation with yambo_sc on Silicon with 12x12x12 k-mesh from Quantum Espresso.
Files for reproduction: https://drive.google.com/file/d/1_NuduVHULqlLnFidAjdwHeW_mBoGFTYa/view?usp=sharing
Happens in both serial and parallel mode.

Yambo input file:

dipoles
HF_and_locXC                     # [R] Hartree-Fock
BareHfromScratch                                                
BareHScaleFermi                                                 
WriteVxc                                                        
dipoles                                                         
% DipBands                                                      
   1 |  10 |                     # [DIP] Bands range for dipoles
%                                                               
DipBandsALL                       # [DIP] Compute all bands range, not only valence and conduction
DipApproach='Covariant'
DipComputed= "R P V P2"                 # [DIP] [default R P V; extra P2 Spin Orb]
#FFTGvecs=  7239            RL
#EXXRLvcs=  47183           RL    # [XX] Exchange    RL components
#VXCRLvcs=  47183           RL    # [XC] XCpotential RL components
FFTGvecs=  200           RL
EXXRLvcs=  200           RL    # [XX] Exchange    RL components
VXCRLvcs=  200           RL    # [XC] XCpotential RL components
%QPkrange                        # [GW] QP generalized Kpoint/Band indices
1|1|1|10|
%

Version used

Yambo(sc) - MPI+SLK+SLEPC+HDF5_MPI_IO - Ver. 5.3.0
Phys-gw-from-bareH branch with commit: 77ccae0
Compiler: GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
MPI: mpirun (Open MPI) 4.1.2

Image
2.
Image
3.
Image

Activity

  1. sangallidavide commented on Feb 17, 2025

    @sangallidavide
    Member

    Fixed a number of problems related to the code:

    Parallelization (the one you mention). Now Bare_Hamiltonian_from_Scratch uses DIP_par_scheme="HAM" in "not l_sc_run". Possibly the same could be used in l_sc_run. (see change in PARALLEL_global_Self_Energy here 9bbc538 )

    There were few other issues (use of errore function from QE, impose maximum cutoff, cutoff on G-hartree not defined). Also p2y was broken.

    It runs in serial.

  2. sangallidavide commented on Feb 17, 2025

    @sangallidavide
    Member

    Addendum. After this commit e3ff8db it seems to also runs in parallel, although without memory distribution. Everything to be checked.

  3. thge123 commented on Feb 18, 2025

    @thge123
    Author

    Hi Davide. Thanks for your quick response. One question - did the HF_and_locXC part work for you? I tried the commit from your last comment. I didn't get the segmentation fault but got the following error with the same input as above (both serial and parallel):

    At line 58 of file V_Hartree.f90
    Fortran runtime error: Index '7240' of dimension 1 of array 'fft_g_table' above upper bound of 7239
    

    If it worked for you, could you share the input you used? I might be missing something.

  4. sangallidavide commented on Feb 18, 2025

    @sangallidavide
    Member
  5. mrf1g12 commented on Oct 25, 2026

    @mrf1g12

    Hi, following up on this issue: using the same phys-gw-from-bareH workflow I encountered a second reproducible segmentation fault, this time in V_Hartree.F.

    I am using Yambo 5.3.0, revision 23979, commit 9bbc5386b7, with:

    • BareHfromScratch
    • BareHScaleFermi
    • HF_and_locXC
    • DipApproach="Covariant"

    The calculation was crashing at:

    vhg(ig)=((4._DP*pi/DL_vol)*(rhog(fft_g_table(ig,1))))/bare_qpg(1,ig)**2

    inside V_Hartree.F.

    The FFT grid prepared before entering V_Hartree was not large enough for the Hartree G-space. In Bare_Hamiltonian_from_Scratch.F, WF_load is called as

    call WF_load(WF,QP_ng_Vxc,WF_Go_indx,(/1,WFbands(2)/), &
                 (/1,k%nibz/),title='-vloc')

    while V_Hartree subsequently loops up to QP_ng_SH.

    In my case,

    QP_ng_Vxc = 24959
    QP_ng_SH  = 78599
    

    and fft_g_table contained indices outside the current fft_size, leading to the out-of-bounds access and segmentation fault.

    I changed the call in Bare_Hamiltonian_from_Scratch.F to

    call WF_load(WF,max(QP_ng_Vxc,QP_ng_SH),WF_Go_indx, &
                 (/1,WFbands(2)/),(/1,k%nibz/),title='-vloc')

    and this fixes the problem.

    I then restored the original input cutoffs, i.e. I did not increase VXCRLvcs/EXXRLvcs to the Hartree cutoff, and the calculation now passes the Hartree step correctly and proceeds to the G0W0 calculation.

    It therefore seems that, in this workflow, the FFT grid prepared by WF_load before V_Hartree needs to account for both QP_ng_Vxc and QP_ng_SH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions