Getshell: BUG - The calculated weights do not solve the linear system for all k-points

I am trying to calculate the non-linear optical constants for a defect in diamond. I generated the input file based upon the tutorial (nonlinear - abinit) based upon the PEAD method. Unfortunately after running for five days, the job failed due to what the code reports as a bug. I have pasted the input file below as well as the last part of the log file reporting the error. Does anyone have any idea as to what an appropriate action would be to get the code to work?

...
 
  kpt:                                      |  kpt:
     0.1250000   0.1250000   0.1250000      |     0.1250000   0.1250000   0.1250000
     0.3750000   0.1250000   0.1250000      |     0.3750000   0.1250000   0.1250000
    -0.3750000   0.1250000   0.1250000      |    -0.3750000   0.1250000   0.1250000
    -0.1250000   0.1250000   0.1250000      |    -0.1250000   0.1250000   0.1250000
     0.1250000   0.3750000   0.1250000      |     0.1250000   0.3750000   0.1250000
  wtk:                                      |  wtk:
    0.016  0.016  0.016  0.016  0.016       |    0.016  0.016  0.016  0.016  0.016
  occ:                                      |  occ:
   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0      |   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0      |   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0      |   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0      |   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0      |   2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
  tnons:                                    |  tnons:
     0.0000000   0.0000000   0.0000000      |     0.0000000   0.0000000   0.0000000
     0.2500000   0.2500000   0.0000000      |     0.2500000   0.2500000   0.0000000
     0.2500000   0.2500000   0.0000000      |     0.2500000   0.2500000   0.0000000
     0.0000000   0.2500000  -0.2500000      |     0.0000000   0.2500000  -0.2500000
     0.0000000   0.2500000  -0.2500000      |     0.0000000   0.2500000  -0.2500000
     0.0000000   0.0000000   0.0000000      |     0.0000000   0.0000000   0.0000000
   znucl:                                   |   znucl:
    6.00  7.00                              |        6.00  7.00
  pseudopotential atom type  1:             |  pseudopotential atom type  1:
  pspso   0 pspxc  11                       |  pspso   0 pspxc  11
  pspdat   150711 pspcod    8 zion   4.0    |  pspdat   150711 pspcod    8 zion   4.0
  pseudopotential atom type  2:             |  pseudopotential atom type  2:
  pspso   0 pspxc  11                       |  pspso   0 pspxc  11
  pspdat   150713 pspcod    8 zion   5.0    |  pspdat   150713 pspcod    8 zion   5.0
  xred:                                     |  xred:
    -0.0000817   0.9991255   1.0000817      |    -0.0000817   0.9991255   1.0000817
    -0.0000184   0.0005250   0.5001061      |    -0.0000184   0.0005250   0.5001061
     0.0016379   0.4991954   0.9983621      |     0.0016379   0.4991954   0.9983621
     0.9978087   0.5008869   0.4973330      |     0.9978087   0.5008869   0.4973330
     0.4998939   0.0005250   1.0000184      |     0.4998939   0.0005250   1.0000184
     0.4998172   0.0007132   0.5001828      |     0.4998172   0.0007132   0.5001828
     0.5026670   0.5008869   0.0021913      |     0.5026670   0.5008869   0.0021913
     0.4900396   0.4951613   0.5099604      |     0.4900396   0.4951613   0.5099604
     0.3777663   0.3785896   0.3750992      |     0.3777663   0.3785896   0.3750992
     0.3761215   0.3754361   0.8759010      |     0.3761215   0.3754361   0.8759010
     0.3752321   0.8747679   0.3755614      |     0.3752321   0.8747679   0.3755614
     0.3749929   0.8750071   0.8755931      |     0.3749929   0.8750071   0.8755931
     0.8749416   0.3750584   0.3687393      |     0.8749416   0.3750584   0.3687393
     0.8753011   0.3746989   0.8735954      |     0.8753011   0.3746989   0.8735954
     0.8714104   0.8722337   0.3750992      |     0.8714104   0.8722337   0.3750992
     0.8745639   0.8738785   0.8759010      |     0.8745639   0.8738785   0.8759010
     0.3761215   0.1259010   0.1254361      |     0.3761215   0.1259010   0.1254361
     0.3749929   0.1255931   0.6250071      |     0.3749929   0.1255931   0.6250071
     0.3777663   0.6250992   0.1285896      |     0.3777663   0.6250992   0.1285896
     0.3752321   0.6255614   0.6247679      |     0.3752321   0.6255614   0.6247679
     0.8753011   0.1235954   0.1246989      |     0.8753011   0.1235954   0.1246989
     0.8745639   0.1259010   0.6238785      |     0.8745639   0.1259010   0.6238785
     0.8749416   0.6187393   0.1250584      |     0.8749416   0.6187393   0.1250584
     0.8714104   0.6250992   0.6222337      |     0.8714104   0.6250992   0.6222337
     0.1264046   0.3746989   0.1246989      |     0.1264046   0.3746989   0.1246989
     0.1240990   0.3754361   0.6238785      |     0.1240990   0.3754361   0.6238785
     0.1240990   0.8738785   0.1254361      |     0.1240990   0.8738785   0.1254361
     0.1244069   0.8750071   0.6250071      |     0.1244069   0.8750071   0.6250071
     0.6312607   0.3750584   0.1250584      |     0.6312607   0.3750584   0.1250584
     0.6249008   0.3785896   0.6222337      |     0.6249008   0.3785896   0.6222337
     0.6249008   0.8722337   0.1285896      |     0.6249008   0.8722337   0.1285896
     0.6244386   0.8747679   0.6247679      |     0.6244386   0.8747679   0.6247679
     0.1250995   0.1249005   0.3746492      |     0.1250995   0.1249005   0.3746492
     0.1251493   0.1248507   0.8748507      |     0.1251493   0.1248507   0.8748507
     0.1247303   0.6250694   0.3750694      |     0.1247303   0.6250694   0.3750694
     0.1250995   0.6246492   0.8749005      |     0.1250995   0.6246492   0.8749005
     0.6249306   0.1252697   0.3750694      |     0.6249306   0.1252697   0.3750694
     0.6253508   0.1249005   0.8749005      |     0.6253508   0.1249005   0.8749005
     0.6249306   0.6250694   0.8752697      |     0.6249306   0.6250694   0.8752697
     0.0016379   0.2483621   0.2491954      |     0.0016379   0.2483621   0.2491954
     0.9999183   0.2500817   0.7491255      |     0.9999183   0.2500817   0.7491255
     0.9978087   0.7473330   0.2508869      |     0.9978087   0.7473330   0.2508869
     0.9999816   0.7501061   0.7505250      |     0.9999816   0.7501061   0.7505250
     0.5026670   0.2521913   0.2508869      |     0.5026670   0.2521913   0.2508869
     0.4998939   0.2500184   0.7505250      |     0.4998939   0.2500184   0.7505250
     0.4900396   0.7599604   0.2451613      |     0.4900396   0.7599604   0.2451613
     0.4998172   0.7501828   0.7507132      |     0.4998172   0.7501828   0.7507132
     0.2508745   0.2500817   0.0000817      |     0.2508745   0.2500817   0.0000817
     0.2494750   0.2500184   0.5001061      |     0.2494750   0.2500184   0.5001061
     0.2494750   0.7501061   0.0000184      |     0.2494750   0.7501061   0.0000184
     0.2492868   0.7501828   0.5001828      |     0.2492868   0.7501828   0.5001828
     0.7508046   0.2483621   0.9983621      |     0.7508046   0.2483621   0.9983621
     0.7491131   0.2521913   0.4973330      |     0.7491131   0.2521913   0.4973330
     0.7491131   0.7473330   0.0021913      |     0.7491131   0.7473330   0.0021913
     0.7548387   0.7599604   0.5099604      |     0.7548387   0.7599604   0.5099604
     0.2489344   0.0010656   0.2503311      |     0.2489344   0.0010656   0.2503311
     0.2498738   1.0001262   0.7501262      |     0.2498738   1.0001262   0.7501262
     0.2506585   0.5004523   0.2504523      |     0.2506585   0.5004523   0.2504523
     0.2489344   0.5003311   0.7510656      |     0.2489344   0.5003311   0.7510656
     0.7495477  -0.0006585   0.2504523      |     0.7495477  -0.0006585   0.2504523
     0.7496689   0.0010656   0.7510656      |     0.7496689   0.0010656   0.7510656
     0.7495477   0.5004523   0.7493415      |     0.7495477   0.5004523   0.7493415
     0.7608648   0.4891352   0.2391352      |     0.7608648   0.4891352   0.2391352
 hdr_check:  Wavefunction file is OK for direct restart of calculation
================================================================================
-inwffil : will read wavefunctions from disk file outdata/outnc_DS2_WFK
 initwf: disk file gives npw= 40636 nband= 127 for kpt number= 1
 initwf: 127 bands have been initialized from disk
 
 respfn : eigen0 array
 mkrho: echo density (plane-wave part only)
 Total charge density [el/Bohr^3]
      Maximum=    6.7836E-01  at reduced coord.    0.7333    0.5111    0.2667
      Minimum=    1.0852E-02  at reduced coord.    0.7333    0.7222    0.2667
   Integrated=    2.5300E+02
 max_dist  9.944610103386904E-002
 Neighbors(1:ishell,1)            6
 Weights (1:ishell)    1448.02057097201     
   1448.02057097201        1448.02057097201        1448.02057097201     
   1448.02057097201        1448.02057097201        1448.02057097201     
 
 getshell: BUG -
 The calculated weights do not solve the linear system for all k-points.
 max_err:   1.99970065E-05 > tolerance:   5.00000000E-06
 
 getshell: BUG -
 The calculated weights do not solve the linear system for all k-points.
 max_err:   1.99970065E-05 > tolerance:   5.00000000E-06
  Action: contact ABINIT group (please attach the output of `abinit -b`)
 
  Action: contact ABINIT group (please attach the output of `abinit -b`)
 
 
--- !BUG
src_file: m_getshell.F90
src_line: 673
mpi_rank: 0
message: |
    There is a problem with the finite difference expression of the ddk 
     If you are very close to a symmetric structure, you might be confusing the algorithm with
     sets of k-points which are not quite part of the same shell. Try rectifying angles and acell.
...
 
Abort(13) on node 37 (rank 37 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 13) - process 37

 ndtset 5
#### Global Variables.
############################################################################################
 ngkpt 4 4 4
 nshiftk 1
 shiftk    0.5    0.5    0.5
 ecut 45
 occopt 1
 nstep 200
 optdriver 0
 nsppol 1
 dilatmx 1.05
 ecutsm 0.5
 nband 127
 nbdbuf 0
# suppress printing of density, wavefunctions, etc except what is
# # explicitly requested above in the ndtset section
 prtwf 0
 prtden 0
 prteig 0
 indata_prefix "indata/in"
 tmpdata_prefix "tmpdata/tmp"
 outdata_prefix "outdata/outnc"
 pp_dirpath "/data/abinit/pseudos"
 pseudos 
    "C_LDA.psp8,
     N_LDA.psp8"
############################################################################################
####                                         STRUCTURE                                         
############################################################################################
 natom 63
 ntypat 2
 typat
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 1
 1 1 2
 znucl 6 7
 xred
  -8.1727793557d-05    0.9991255085    1.0000817278
  -1.8435613594d-05   5.2501921200d-04    0.5001060909
    0.0016378679    0.4991954111    0.9983621321
    0.9978086865    0.5008868602    0.4973330238
    0.4998939091   5.2501921200d-04    1.0000184356
    0.4998171893   7.1321590155d-04    0.5001828107
    0.5026669762    0.5008868602    0.0021913135
    0.4900396379    0.4951612619    0.5099603621
    0.3777663362    0.3785896418    0.3750992211
    0.3761215446    0.3754360679    0.8759010340
    0.3752321248    0.8747678752    0.3755613916
    0.3749928802    0.8750071198    0.8755930508
    0.8749416146    0.3750583854    0.3687393417
    0.8753010584    0.3746989416    0.8735954097
    0.8714103582    0.8722336638    0.3750992211
    0.8745639321    0.8738784554    0.8759010340
    0.3761215446    0.1259010340    0.1254360679
    0.3749928802    0.1255930508    0.6250071198
    0.3777663362    0.6250992211    0.1285896418
    0.3752321248    0.6255613916    0.6247678752
    0.8753010584    0.1235954097    0.1246989416
    0.8745639321    0.1259010340    0.6238784554
    0.8749416146    0.6187393417    0.1250583854
    0.8714103582    0.6250992211    0.6222336638
    0.1264045903    0.3746989416    0.1246989416
    0.1240989660    0.3754360679    0.6238784554
    0.1240989660    0.8738784554    0.1254360679
    0.1244069492    0.8750071198    0.6250071198
    0.6312606583    0.3750583854    0.1250583854
    0.6249007789    0.3785896418    0.6222336638
    0.6249007789    0.8722336638    0.1285896418
    0.6244386084    0.8747678752    0.6247678752
    0.1250994533    0.1249005467    0.3746491815
    0.1251492983    0.1248507017    0.8748507017
    0.1247303250    0.6250693536    0.3750693536
    0.1250994533    0.6246491815    0.8749005467
    0.6249306464    0.1252696750    0.3750693536
    0.6253508185    0.1249005467    0.8749005467
    0.6249306464    0.6250693536    0.8752696750
    0.0016378679    0.2483621321    0.2491954111
    0.9999182722    0.2500817278    0.7491255085
    0.9978086865    0.7473330238    0.2508868602
    0.9999815644    0.7501060909    0.7505250192
    0.5026669762    0.2521913135    0.2508868602
    0.4998939091    0.2500184356    0.7505250192
    0.4900396379    0.7599603621    0.2451612619
    0.4998171893    0.7501828107    0.7507132159
    0.2508744915    0.2500817278   8.1727793557d-05
    0.2494749808    0.2500184356    0.5001060909
    0.2494749808    0.7501060909   1.8435613594d-05
    0.2492867841    0.7501828107    0.5001828107
    0.7508045889    0.2483621321    0.9983621321
    0.7491131398    0.2521913135    0.4973330238
    0.7491131398    0.7473330238    0.0021913135
    0.7548387381    0.7599603621    0.5099603621
    0.2489344108    0.0010655892    0.2503311004
    0.2498738311    1.0001261689    0.7501261689
    0.2506584627    0.5004522646    0.2504522646
    0.2489344108    0.5003311004    0.7510655892
    0.7495477354  -6.5846272032d-04    0.2504522646
    0.7496688996    0.0010655892    0.7510655892
    0.7495477354    0.5004522646    0.7493415373
    0.7608648352    0.4891351648    0.2391351648
 acell    1.0    1.0    1.0
 rprim
   13.4537196110   2.4577523146d-06  -8.7490491474d-07
  -9.7139789812d-07   13.4537196110  -1.2410041145d-05
   2.3612581455d-06   1.0923686090d-05   13.4537196110

#####################
##### DATASET 1 #####
#####################
##############################################
####                SECTION: basic               
##############################################
 kptopt1 3
 toldfe1 1e-12
##############################################
####                SECTION: files               
##############################################
 prtden1 1
 prtwf1 1
##############################################
####                SECTION: paral               
##############################################
 autoparal1 1


#####################
##### DATASET 2 #####
#####################
##############################################
####                SECTION: basic               
##############################################
 kptopt2 3
 iscf2 -2
 tolwfr2 1e-22
##############################################
####                SECTION: files               
##############################################
 getden2 1
 getwfk2 1
 prtwf2 1
##############################################
####                SECTION: paral               
##############################################
 autoparal2 1


#####################
##### DATASET 3 #####
#####################
##############################################
####                SECTION: basic               
##############################################
 kptopt3 3
 tolwfr3 1e-22
##############################################
####                SECTION: dfpt                
##############################################
 optdriver3 1
 rfelfd3 2
##############################################
####                SECTION: files               
##############################################
 getwfk3 2
 prtwf3 1


#####################
##### DATASET 4 #####
#####################
##############################################
####                SECTION: basic               
##############################################
 kptopt4 3
 tolvrs4 1e-12
##############################################
####                SECTION: dfpt                
##############################################
 optdriver4 1
 rfphon4 1
 rfelfd4 3
 rfstrs4 3
 prepanl4 1
##############################################
####                SECTION: files               
##############################################
 getwfk4 2
 getddk4 3
 prtwf4 1
 prtden4 1


#####################
##### DATASET 5 #####
#####################
##############################################
####                SECTION: basic               
##############################################
 kptopt5 3
##############################################
####                SECTION: dfpt                
##############################################
 optdriver5 5
 d3e_pert1_elfd5    1     # activate electric field for 1st perturbation...
 d3e_pert1_phon5    1     # ...and also atomic displacements...
 d3e_pert1_atpol5   1 63  # ...for all atoms 
 d3e_pert2_elfd5    1     # activate electric field for 2nd perturbation...
 d3e_pert3_elfd5    1     # activate electric field for 3rd perturbation...

##############################################
####                SECTION: files               
##############################################
 getwfk5 2
 get1den5 4
 get1wf5 4
 DATA TYPE INFORMATION: 
 REAL:      Data type name: REAL(DP) 
            Kind value:      8
            Precision:      15
            Smallest nonnegligible quantity relative to 1: 0.22204460E-015
            Smallest positive number:                      0.22250739E-307
            Largest representable number:                  0.17976931E+309
 INTEGER:   Data type name: INTEGER(default) 
            Kind value: 4
            Bit size:   32
            Largest representable number: 2147483647
 LOGICAL:   Data type name: LOGICAL 
            Kind value: 4
 CHARACTER: Data type name: CHARACTER             Kind value: 1
  ==== Using MPI-2 specifications ==== 
  MPI-IO support is ON
  xmpi_tag_ub ................      1048575
  xmpi_bsize_ch ..............            1
  xmpi_bsize_int .............            4
  xmpi_bsize_sp ..............            4
  xmpi_bsize_dp ..............            8
  xmpi_bsize_spc .............            8
  xmpi_bsize_dpc .............           16
  xmpio_bsize_frm ............            4
  xmpi_address_kind ..........            8
  xmpi_offset_kind ...........            8
  MPI_WTICK ..................   4.358080898341752E-010

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 CPP options activated during the build:

                  CC_INTEL                   CXX_GNU                  FC_INTEL
 
                 HAVE_DFTI HAVE_FC_ALLOCATABLE_DT...             HAVE_FC_ASYNC
 
  HAVE_FC_COMMAND_ARGUMENT      HAVE_FC_COMMAND_LINE        HAVE_FC_CONTIGUOUS
 
           HAVE_FC_CPUTIME             HAVE_FC_ETIME              HAVE_FC_EXIT
 
             HAVE_FC_FLUSH             HAVE_FC_GAMMA            HAVE_FC_GETENV
 
            HAVE_FC_GETPID   HAVE_FC_IEEE_ARITHMETIC   HAVE_FC_IEEE_EXCEPTIONS
 
             HAVE_FC_IOMSG     HAVE_FC_ISO_C_BINDING  HAVE_FC_ISO_FORTRAN_2008
 
        HAVE_FC_LONG_LINES        HAVE_FC_MOVE_ALLOC  HAVE_FC_ON_THE_FLY_SHAPE
 
           HAVE_FC_PRIVATE         HAVE_FC_PROTECTED           HAVE_FC_SHIFTLR
 
         HAVE_FC_STREAM_IO            HAVE_FC_SYSTEM               HAVE_GW_DPC
 
                 HAVE_HDF5             HAVE_HDF5_MPI        HAVE_LIBPAW_ABINIT
 
      HAVE_LIBTETRA_ABINIT                HAVE_LIBXC         HAVE_LINALG_AXPBY
 
        HAVE_LINALG_GEMM3M         HAVE_LINALG_GEMMT  HAVE_LINALG_MKL_IMATCOPY
 
   HAVE_LINALG_MKL_OMATADD  HAVE_LINALG_MKL_OMATCOPY   HAVE_LINALG_MKL_THREADS
 
     HAVE_LINALG_SCALAPACK                  HAVE_MPI                 HAVE_MPI2
 
       HAVE_MPI_IALLGATHER       HAVE_MPI_IALLREDUCE        HAVE_MPI_IALLTOALL
 
       HAVE_MPI_IALLTOALLV           HAVE_MPI_IBCAST         HAVE_MPI_IGATHERV
 
        HAVE_MPI_INTEGER16               HAVE_MPI_IO HAVE_MPI_TYPE_CREATE_S...
 
               HAVE_NETCDF       HAVE_NETCDF_FORTRAN   HAVE_NETCDF_FORTRAN_MPI
 
           HAVE_NETCDF_MPI                HAVE_NUMPY         HAVE_OMP_COLLAPSE
 
               HAVE_OPENMP             HAVE_OS_LINUX         HAVE_TIMER_ABINIT
 
            HAVE_WANNIER90                                                      
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 === Build Information === 
  Version       : 9.6.2
  Build target  : x86_64_linux_intel2021.6
  Build date    : 20230712
 
 === Compiler Suite === 
  C compiler       : intel2021.6
  C++ compiler     : gnu2021.6
  Fortran compiler : intel2021.6
  CFLAGS           : -O2 -xHost -ftz -fp-speculation=safe -fp-model source -fopenmp -fPIC -mt_mpi
  CXXFLAGS         : -O2 -xHost -ftz -fp-speculation=safe -fp-model source -fopenmp -fPIC -mt_mpi
  FCFLAGS          : -O2 -xHost -ftz -fp-speculation=safe -fp-model source -fopenmp -fPI ...
  FC_LDFLAGS       :   -static-intel -static-libgcc
 
 === Optimizations === 
  Debug level        : basic
  Optimization level : standard
  Architecture       : intel_xeon
 
 === Multicore === 
  Parallel build : yes
  Parallel I/O   : 
  openMP support : yes
  GPU support    : 
 
 === Connectors / Fallbacks === 
  LINALG flavor  : mkl
  FFT flavor     : dfti
  HDF5           : yes
  NetCDF         : yes
  NetCDF Fortran : yes
  LibXC          : yes
  Wannier90      : yes
 
 === Experimental features === 
  Exports             : 
  GW double-precision : yes
 
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Default optimizations:
   --- None ---


Hi Paul,

a vicious unit cell probably. The finite diff expression with Berry phase needs to find the neighbors in k space, and has a cutoff for which shells to include or exclude (the sth 1.e-5) while you have canted your unit cell by 1.e-6 or less from cubic axes (why?) - this probably shifts the neighboring k points in reciprocal space ever so slightly, and it gets confused between when finding which ones to include in the linear system. Usually this error shows up when you have only 1 plane of k, or a very anisotropic system, in which second neighbor k points are closer than first neighbor k in another direction. If it includes several k along the same direction, they are not geometrically independent and the linear system is degenerate and fails.

  1. rectify your cell (at least orthogonal if not cubic) and relax only positions, and try again
  2. you could hack the code for the Berry neighbors to make the tolerance tighter or looser (don’t tell anyone I suggested this). Not a very satisfying solution, but could get the finite diff solver to pass.

Hi Matthieu,
I see your point about the cell axes. This cell was initially cubic diamond and the distortion was induced by the relaxation process. I shall relax the cell again keeping cubic axes and see what happens.