Problem during wannierization

Question on input files/tags, interpreting output, etc.

Please check whether the answer to your question is given in the VASP online manual or has been discussed in this forum previously!

Moderators: Global Moderator, Moderator

Message
Author
farhan_tanzim
Newbie
Newbie
Posts: 9
Joined: Fri Apr 28, 2023 12:06 pm

Problem doing wannierization after GW calculation

#1 Post by farhan_tanzim » Sat May 27, 2023 11:14 am

Hi,

I am trying to calculate wannier interpolated bands after a GW (G_0W_0) calculation. But for some reason when I run the VASP-WANNIER90 interface my process gets terminated and the wannier.chk file does not get generated (all the other ones for example wannier.amn and wannier.mmn gets generated), so afterwards when I want to calculate wannier interpolated band structure and run wannier90.x I get the error: ``Error: restart requested but wannier90.chk file not found``. I am currently following this tutorial for this: wiki/index.php/Bandstructure_of_Si_in_G ... WANNIER90)

However, when I do a wannierization without GW calculations it works without an error. For this I followed this tutorial: wiki/index.php/Si_bandstructure

I don't understand the problem or if I am doing anything wrong, so any help would be much appreciated.

Regards,
Farhan

farhan_tanzim
Newbie
Newbie
Posts: 9
Joined: Fri Apr 28, 2023 12:06 pm

Problem during wannierization

#2 Post by farhan_tanzim » Sun May 28, 2023 7:29 pm

Hi,

I was trying to do wannier related calculations using this example case: wiki/index.php/Si_bandstructure#Procedu ... .2C_PBE.29
I could manage to run it in the log in node, however, whenever I run it by submitting a job the process gets terminated and all of the necessary files does not get produce. What I mean by that is:
In order to do wannierization calculation one first needs to run vasp-wannier interface, which is run by setting LWANNIER90=.TRUE. in the INCAR (input file) and run vasp_ncl. This run should produce necessary files for further calculation using wannier90 software. However, all of the necessary files get produced instead of wannier.chk for which I cannot proceed further with the calculation. But as I have said earlier if I use the login node I do not run into this problem.
Here is the slurm output
```
srun: Job step aborted: Waiting up to 32 seconds for job step to finish.
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
slurmstepd: error: *** STEP 11832568.0 ON r27n19 CANCELLED AT 2023-05-27T20:29:54 ***
srun: error: r27n19: task 0: Exited with exit code 1
srun: error: r27n19: tasks 1-15: Killed
```
The job script is as follows:

#!/bin/bash
#SBATCH -N 1
#SBATCH -t 00:05:00
#SBATCH --tasks-per-node 16
#module load 2022
#module load VASP6/6.2.1-foss-2022a-CUDA-11.7.0
cp -r . "$TMPDIR"
#srun vasp_std
module load 2022
module load VASP6/6.3.2-foss-2022a-VASPsol-VTST
srun vasp_ncl > vasp.out
#srun wannier90.x wannier90.win > wann.out


Please let me know if something can be done.
Regards,
Farhan

martin.schlipf
Global Moderator
Global Moderator
Posts: 458
Joined: Fri Nov 08, 2019 7:18 am

Re: Problem doing wannierization after GW calculation

#3 Post by martin.schlipf » Tue May 30, 2023 8:03 am

Can you tell me which version of VASP you are using and which version of Wannier90? Did you make any changes to the input of the tutorial?

martin.schlipf
Global Moderator
Global Moderator
Posts: 458
Joined: Fri Nov 08, 2019 7:18 am

Re: Problem during wannierization

#4 Post by martin.schlipf » Tue May 30, 2023 8:11 am

Btw. I merged your two posts as they seem to be related to the same issue.

farhan_tanzim
Newbie
Newbie
Posts: 9
Joined: Fri Apr 28, 2023 12:06 pm

Re: Problem during wannierization

#5 Post by farhan_tanzim » Tue May 30, 2023 9:58 am

Hi,

Thanks for your response. Yes I also think the issues are somewhat same. The VASP version is ''vasp.6.3.2'' and the wannier version is ''3.1.0''.

farhan_tanzim
Newbie
Newbie
Posts: 9
Joined: Fri Apr 28, 2023 12:06 pm

Re: Problem during wannierization

#6 Post by farhan_tanzim » Tue May 30, 2023 10:05 am

No I just used the input files as they were. I basically have two separate directories, in one of the directories I ran the whole thing (without Hybrid functional part) in log in node to see if it works or not and it did work, and in the other one I did the same thing but now by just submitting the job.

martin.schlipf
Global Moderator
Global Moderator
Posts: 458
Joined: Fri Nov 08, 2019 7:18 am

Re: Problem during wannierization

#7 Post by martin.schlipf » Fri Jun 02, 2023 8:11 am

I could reproduce the issue by accident. Did you forget to provide the wannier90.win file for step 3 of the example? Even though this is the input for wannier90, when you specify LWANNIER90 = T in the INCAR file, this file will be read when using Wannier90 in library mode. When I accidentally swapped the creation of this file with the execution of VASP, I got also the wannier90.chk-missing error.
Note that with your version of VASP you can also give the Wannier input file in the INCAR file (WANNIER90_WIN) to make it harder to run into this problem.

martin.schlipf
Global Moderator
Global Moderator
Posts: 458
Joined: Fri Nov 08, 2019 7:18 am

Re: Problem during wannierization

#8 Post by martin.schlipf » Fri Jun 02, 2023 8:26 am

Btw, in my case VASP complained and told me how to fix it.

Code: Select all

 -----------------------------------------------------------------------------
|                                                                             |
|           W    W    AA    RRRRR   N    N  II  N    N   GGGG   !!!           |
|           W    W   A  A   R    R  NN   N  II  NN   N  G    G  !!!           |
|           W    W  A    A  R    R  N N  N  II  N N  N  G       !!!           |
|           W WW W  AAAAAA  RRRRR   N  N N  II  N  N N  G  GGG   !            |
|           WW  WW  A    A  R   R   N   NN  II  N   NN  G    G                |
|           W    W  A    A  R    R  N    N  II  N    N   GGGG   !!!           |
|                                                                             |
|     No projection mode was specified. You can specify projections using     |
|     wannier90 (NUM_WANN and WANNIER90_WIN tags), LOCPROJ (LOCPROJ tag)      |
|     or the SCDM method (NUM_WANN and LSCDM tags).                           |
|                                                                             |
 -----------------------------------------------------------------------------
Note that you can also set just a subset of the Wannier90 input file and VASP will add the other parts for you. For example, you could specify the projections with

Code: Select all

WANNIER90_WIN = "
Begin Projections
  Si:sp3
End Projections
"

farhan_tanzim
Newbie
Newbie
Posts: 9
Joined: Fri Apr 28, 2023 12:06 pm

Re: Problem during wannierization

#9 Post by farhan_tanzim » Fri Jun 02, 2023 11:01 am

Sorry I don't understand, the wannier90.win file is already in the example directory from the beginning (from step 1), and also the projections are included in the file. Can you please break down what steps I can take to avoid the error and so that the .chk file gets generated.

martin.schlipf
Global Moderator
Global Moderator
Posts: 458
Joined: Fri Nov 08, 2019 7:18 am

Re: Problem during wannierization

#10 Post by martin.schlipf » Fri Jun 02, 2023 2:22 pm

Well, if the wannier90.win file is already in the directory it does not explain the issue. I just produced the same error accidentally by creating the wannier90.win file only at the end of step 3 instead of at the beginning of it. With wannier90.win present, I do not get any error. For the record here is a script that runs the example. The only file you need in addition to that script is the POTCAR file.

Code: Select all

#!/bin/bash

export vasp=/path/to/vasp/executable
export wannier=/path/to/wannier/executable

#
# setup
#
cat << EOF > KPOINTS
4x4x4
 0
G
 4 4 4
 0 0 0
EOF

cat << EOF > POSCAR
system Si
5.430
0.5 0.5 0.0
0.0 0.5 0.5
0.5 0.0 0.5
2
cart
0.00 0.00 0.00
0.25 0.25 0.25
EOF

#
# step 1
#
cat << EOF > INCAR
ISMEAR =  0
SIGMA  =  0.05
GGA    = PE
EOF

$vasp

#
# step 2
#
cat << EOF > INCAR
ALGO = Exact
NBANDS  = 64
LOPTICS = .TRUE.
NEDOS = 2000

ISMEAR =  0
SIGMA  =  0.05
GGA    = PE
EOF

$vasp

#
# step 3
#
cat << EOF > INCAR
## Frequency dependent dielectric tensor including
## local field effects within the RPA (default) or
## including changes in the DFT xc-potential (LRPA=.FALSE.).
## N.B.: beware one first has to have done a
## calculation with ALGO=Exact and LOPTICS=.TRUE.
## and a reasonable number of virtual states (see above)
ALGO = GW0 ; LSPECTRAL = .TRUE. ; NOMEGA = 50
#LRPA = .FALSE.
## be sure to take the same number of bands as for
## the LOPTICS=.TRUE. calculation, otherwise the
## WAVEDER file is not read correctly
NBANDS = 64
##VASP2WANNIER90
LWANNIER90=.TRUE.
EOF

cat << EOF > wannier90.win
num_wann=8
num_bands=8

exclude_bands 9-64

Begin Projections
Si:sp3
End Projections

dis_froz_max=9
dis_num_iter=1000

guiding_centres=true

begin unit_cell_cart
     2.7150000     2.7150000     0.0000000
     0.0000000     2.7150000     2.7150000
     2.7150000     0.0000000     2.7150000
 end unit_cell_cart

begin atoms_cart
Si       0.0000000     0.0000000     0.0000000
Si       1.3575000     1.3575000     1.3575000
end atoms_cart

mp_grid =     4     4     4

begin kpoints
     0.0000000     0.0000000     0.0000000
     0.2500000     0.0000000     0.0000000
     0.5000000     0.0000000     0.0000000
     0.2500000     0.2500000     0.0000000
     0.5000000     0.2500000     0.0000000
    -0.2500000     0.2500000     0.0000000
     0.5000000     0.5000000     0.0000000
    -0.2500000     0.5000000     0.2500000
     0.0000000     0.2500000     0.0000000
     0.0000000     0.0000000     0.2500000
    -0.2500000    -0.2500000    -0.2500000
    -0.2500000     0.0000000     0.0000000
     0.0000000    -0.2500000     0.0000000
     0.0000000     0.0000000    -0.2500000
     0.2500000     0.2500000     0.2500000
     0.0000000     0.5000000     0.0000000
     0.0000000     0.0000000     0.5000000
    -0.5000000    -0.5000000    -0.5000000
     0.0000000     0.2500000     0.2500000
     0.2500000     0.0000000     0.2500000
    -0.2500000    -0.2500000     0.0000000
    -0.2500000     0.0000000    -0.2500000
     0.0000000    -0.2500000    -0.2500000
     0.0000000     0.5000000     0.2500000
     0.2500000     0.0000000     0.5000000
    -0.2500000    -0.2500000     0.2500000
    -0.5000000    -0.2500000    -0.5000000
     0.2500000     0.5000000     0.0000000
     0.2500000    -0.2500000    -0.2500000
    -0.5000000    -0.5000000    -0.2500000
     0.0000000     0.2500000     0.5000000
    -0.2500000     0.2500000    -0.2500000
    -0.2500000    -0.5000000    -0.5000000
     0.5000000     0.0000000     0.2500000
    -0.5000000    -0.2500000     0.0000000
     0.0000000    -0.5000000    -0.2500000
    -0.2500000     0.0000000    -0.5000000
     0.2500000     0.2500000    -0.2500000
     0.5000000     0.2500000     0.5000000
    -0.2500000    -0.5000000     0.0000000
    -0.2500000     0.2500000     0.2500000
     0.5000000     0.5000000     0.2500000
     0.0000000    -0.2500000    -0.5000000
     0.2500000    -0.2500000     0.2500000
     0.2500000     0.5000000     0.5000000
    -0.5000000     0.0000000    -0.2500000
     0.0000000    -0.2500000     0.2500000
     0.2500000     0.0000000    -0.2500000
    -0.2500000    -0.2500000    -0.5000000
     0.2500000     0.5000000     0.2500000
     0.2500000    -0.2500000     0.0000000
    -0.5000000    -0.2500000    -0.2500000
     0.2500000     0.2500000     0.5000000
     0.0000000     0.2500000    -0.2500000
    -0.2500000    -0.5000000    -0.2500000
     0.5000000     0.2500000     0.2500000
    -0.2500000     0.0000000     0.2500000
     0.0000000     0.5000000     0.5000000
     0.5000000     0.0000000     0.5000000
     0.2500000    -0.2500000     0.5000000
     0.5000000     0.2500000    -0.2500000
    -0.5000000    -0.2500000    -0.7500000
     0.2500000    -0.5000000    -0.2500000
    -0.2500000     0.2500000    -0.5000000
end kpoints
EOF

$vasp

#
# step 4
#
$wannier wannier90

cat << EOF >> wannier90.win

# Bandstructure plot
restart         =  plot
bands_plot      =  true
begin kpoint_path
L 0.50000  0.50000 0.5000 G 0.00000  0.00000 0.0000
G 0.00000  0.00000 0.0000 X 0.50000  0.00000 0.5000
X 0.50000  0.00000 0.5000 K 0.37500 -0.37500 0.0000
K 0.37500 -0.37500 0.0000 G 0.00000  0.00000 0.0000
end kpoint_path
bands_num_points 40
bands_plot_format gnuplot xmgrace
EOF

$wannier wannier90

farhan_tanzim
Newbie
Newbie
Posts: 9
Joined: Fri Apr 28, 2023 12:06 pm

Re: Problem during wannierization

#11 Post by farhan_tanzim » Fri Jun 02, 2023 4:39 pm

Image[/img]Hi,

Thanks for the script, I tired it out. I have ran into this segmentation fault that I don't understand. I have copied the job script I have used (altered version of the jobscript provided by you) and the slurm of the calculation. Please have a look, perhaps I am repeatedly doing something wrong.


Here is the job-script:

Code: Select all

#!/bin/bash
#SBATCH -N 1
#SBATCH -t 00:20:00
#SBATCH --tasks-per-node 16
#module load 2022
#module load VASP6/6.2.1-foss-2022a-CUDA-11.7.0
cp -r . "$TMPDIR"
#srun vasp_std
module load 2022
module load VASP6/6.3.2-foss-2022a-VASPsol-VTST
#srun vasp_ncl > vasp.out
#srun wannier90.x wannier90.win > wann.out


#export vasp=/path/to/vasp/executable
#export wannier=/path/to/wannier/executable

#
# setup
#
cat << EOF > KPOINTS
4x4x4
 0
G
 4 4 4
 0 0 0
EOF

cat << EOF > POSCAR
system Si
5.430
0.5 0.5 0.0
0.0 0.5 0.5
0.5 0.0 0.5
2
cart
0.00 0.00 0.00
0.25 0.25 0.25
EOF

#
# step 1
#
cat << EOF > INCAR
ISMEAR =  0
SIGMA  =  0.05
GGA    = PE
EOF

#$vasp
srun vasp_ncl
#
# step 2
#
cat << EOF > INCAR
ALGO = Exact
NBANDS  = 64
LOPTICS = .TRUE.
NEDOS = 2000

ISMEAR =  0
SIGMA  =  0.05
GGA    = PE
EOF

#$vasp
srun vasp_ncl

#
# step 3
#
cat << EOF > INCAR
## Frequency dependent dielectric tensor including
## local field effects within the RPA (default) or
## including changes in the DFT xc-potential (LRPA=.FALSE.).
## N.B.: beware one first has to have done a
## calculation with ALGO=Exact and LOPTICS=.TRUE.
## and a reasonable number of virtual states (see above)
ALGO = GW0 ; LSPECTRAL = .TRUE. ; NOMEGA = 50
#LRPA = .FALSE.
## be sure to take the same number of bands as for
## the LOPTICS=.TRUE. calculation, otherwise the
## WAVEDER file is not read correctly
NBANDS = 64
##VASP2WANNIER90
LWANNIER90=.TRUE.
EOF

farhan_tanzim
Newbie
Newbie
Posts: 9
Joined: Fri Apr 28, 2023 12:06 pm

Re: Problem during wannierization

#12 Post by farhan_tanzim » Fri Jun 02, 2023 4:43 pm

Sorry I couldn't copy the slurm file as it was too large!

martin.schlipf
Global Moderator
Global Moderator
Posts: 458
Joined: Fri Nov 08, 2019 7:18 am

Re: Problem during wannierization

#13 Post by martin.schlipf » Mon Jun 05, 2023 5:52 am

I could reproduce a segmentation fault with 6.3.2. Apparently, the origin of the problem are the excluded bands and this has been fixed in 6.4. I post the changes below, in case you don't have access to that code.

Code: Select all

@@ -3782,41 +3793,54 @@ MODULE mlwf
    USE mathtools,       ONLY: SV_DECOMPOSER
    IMPLICIT none

-   GDEF, ALLOCATABLE,   INTENT(OUT) :: T(:, :, :, :)
+   GDEF, ALLOCATABLE,   INTENT(INOUT) :: T(:, :, :, :)
    TYPE(wavespin),      INTENT(IN)  :: W
    TYPE(MLWF_type),     INTENT(IN)  :: MLWF

    LOGICAL              :: DO_CUTOFF
-   INTEGER              :: IK, ISP
+   INTEGER              :: IK, ISP, IB
    INTEGER              :: IKIBZ
    INTEGER              :: WAN_IDX
    TYPE(SV_DECOMPOSER)  :: SVD
    INTEGER              :: INFO
    REAL(q), ALLOCATABLE :: CUTOFF_FACTOR(:)
+   INTEGER              :: I, I_
+   COMPLEX(q), ALLOCATABLE :: CELTOTRED(:)

    !HM: The code still works correctly in this case, so I comment it
    !IF (MLWF%NB_TOT < MLWF%NUM_WANN) CALL vtutor%error( &
    !   "CALC_WANNIER_TRAFO_PROJ: Number of Wannier functions must not be larger than number of bands.")
+   DO_CUTOFF = MLWF%NB_TOT-MLWF%NEXCLB > MLWF%NUM_WANN

-   DO_CUTOFF = MLWF%NB_TOT > MLWF%NUM_WANN
-
-   ALLOCATE(T(MLWF%NB_TOT, MLWF%NUM_WANN, MLWF%NKPTS, MLWF%ISPIN))
+   ALLOCATE(T(MLWF%NB_TOT-MLWF%NEXCLB, MLWF%NUM_WANN, MLWF%NKPTS, MLWF%ISPIN))
    T = MLWF%A_matrix

-   CALL SVD%INIT('S', 'S', MLWF%NB_TOT, MLWF%NUM_WANN, INFO)
+   CALL SVD%INIT('S', 'S', MLWF%NB_TOT-MLWF%NEXCLB, MLWF%NUM_WANN, INFO)
    IF (INFO /= 0) CALL vtutor%error( &
       "CALC_WANNIER_TRAFO_PROJ: xGESDD query returned with error code " // str(INFO))

-   IF (DO_CUTOFF) ALLOCATE(CUTOFF_FACTOR(MLWF%NB_TOT))
-
+   IF (DO_CUTOFF) THEN
+      ALLOCATE(CUTOFF_FACTOR(MLWF%NB_TOT-MLWF%NEXCLB))
+      ALLOCATE(CELTOTRED(MLWF%NB_TOT-MLWF%NEXCLB))
+   ENDIF
    ! Loop over all spin and k components.
    DO ISP = 1, MLWF%ISPIN
       DO IK = 1, MLWF%NKPTS
          IF (DO_CUTOFF) THEN
+            ! cut out irrelevant bands
             IKIBZ = KPOINTS_FULL%NEQUIV(IK)
-            CUTOFF_FACTOR = CUTOFF_DES_GET_CUTOFF(CUTOFF_DES,ISP,W%CELTOT(:, IKIBZ, ISP))
+            CELTOTRED = 0
+            I=0
+            DO I_ = 1, MLWF%NB_TOT
+               IF ( .NOT. MLWF%EXCLUDE_BAND( I_ ) ) THEN
+                  I = I + 1
+                  CELTOTRED(I) = W%CELTOT(I_,IKIBZ, ISP )
+               ENDIF
+            ENDDO
+
+            CUTOFF_FACTOR = CUTOFF_DES_GET_CUTOFF(CUTOFF_DES,ISP,CELTOTRED(:))
             DO WAN_IDX = 1, MLWF%NUM_WANN
-               T(:, WAN_IDX, IK, ISP) = T(:, WAN_IDX, IK, ISP) * CUTOFF_FACTOR
+               T(:, WAN_IDX, IK, ISP) = T(:, WAN_IDX, IK, ISP) * CUTOFF_FACTOR(:)
             ENDDO
          ENDIF

@@ -3827,6 +3851,8 @@ MODULE mlwf
          T(:, :, IK, ISP) = MATMUL(SVD%U_MAT, SVD%V_DAGGER_MAT)
       ENDDO
    ENDDO
+   IF ( ALLOCATED ( CUTOFF_FACTOR )  ) DEALLOCATE( CUTOFF_FACTOR )
+   IF ( ALLOCATED ( CELTOTRED )  ) DEALLOCATE( CELTOTRED )
  ENDSUBROUTINE CALC_WANNIER_TRAFO_PROJ

farhan_tanzim
Newbie
Newbie
Posts: 9
Joined: Fri Apr 28, 2023 12:06 pm

Re: Problem during wannierization

#14 Post by farhan_tanzim » Mon Jun 05, 2023 11:19 am

Thank you so much. How do I implement this code exactly? Do I need to change something in the source and recompile it? if so in which section or where?

martin.schlipf
Global Moderator
Global Moderator
Posts: 458
Joined: Fri Nov 08, 2019 7:18 am

Re: Problem during wannierization

#15 Post by martin.schlipf » Mon Jun 05, 2023 1:08 pm

The changes start in line 3782 of mlwf.F. You remove the lines with the - and add the lines with the +. Of course if you have access to the 6.4 code, you can just copy that routine from that file as well. After the changes you need to recompile the code.

Locked