[Pw_forum] nband for band structure calculations

Maxim Arsentev arsentev at isc.nw.ru
Fri Sep 1 10:43:39 CEST 2017


Dear users and developers,

I successfully obtained the band structure of TaS3, but for such 
calculations, I did not spedify the nband variable. How to set it (maybe 
look in output or smth else).

Bests,
Maxim Arsent'ev, Ph.D. (Chemistry)
Laboratory of research of nanostructures
Institute of Silicate Chemistry of RAS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20170901/b4b7999a/attachment.html>
-------------- next part --------------
#!/bin/sh

# run from directory where this script is
cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
EXAMPLE_DIR=`pwd`

# check whether echo has the -e option
if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi

$ECHO
$ECHO "$EXAMPLE_DIR : starting"
$ECHO
$ECHO "This example shows how to use pw.x and postprocessing codes to make a"
$ECHO "contour plot in the [110] plane of the charge density for TaS2_2H, and to"
$ECHO "plot the band structure of TaS2_2H."

PREFIX=`cd /usr/share/doc/quantum-espresso ; pwd`
BIN_DIR=/home/mxm2/espresso-5.4.0/bin
PSEUDO_DIR=/home/mxm2/Documents/example01_TaS2
# Beware: everything in $TMP_DIR will be destroyed !
TMP_DIR=/home/mxm2/Documents/example01_TaS2/temp

# required executables and pseudopotentials
BIN_LIST="pw.x generate_vdW_kernel_table.x pp.x plotrho.x bands.x plotband.x"
PSEUDO_LIST="Ta.pbe-spn-rrkjus_psl.0.2.UPF S.pbe-n-rrkjus_psl.0.1.UPF"
VDW_TABLE="vdW_kernel_table"

$ECHO
$ECHO "  executables directory: $BIN_DIR"
$ECHO "  pseudo directory:      $PSEUDO_DIR"
$ECHO "  temporary directory:   $TMP_DIR"
$ECHO "  checking that needed directories and files exist...\c"

# check for gnuplot
GP_COMMAND=`which gnuplot 2>/dev/null`
if [ "$GP_COMMAND" = "" ]; then
        $ECHO
        $ECHO "gnuplot not in PATH"
        $ECHO "Results will not be plotted"
fi

# check for directories
for DIR in "$BIN_DIR" "$PSEUDO_DIR" ; do
    if test ! -d $DIR ; then
        $ECHO
        $ECHO "ERROR: $DIR not existent or not a directory"
        $ECHO "Aborting"
        exit 1
    fi
done
for DIR in "$TMP_DIR" "$EXAMPLE_DIR/results" ; do
    if test ! -d $DIR ; then
        mkdir $DIR
    fi
done
cd $EXAMPLE_DIR/results

# check for executables
for FILE in $BIN_LIST ; do
    if test ! -x $BIN_DIR/$FILE ; then
        $ECHO
        $ECHO "ERROR: $BIN_DIR/$FILE not existent or not executable"
        $ECHO "Aborting"
        exit 1
    fi
done

# check for pseudopotentials
for FILE in $PSEUDO_LIST ; do
    if test ! -r $PSEUDO_DIR/$FILE ; then
       $ECHO
       $ECHO "Downloading $FILE to $PSEUDO_DIR...\c"
            $WGET $PSEUDO_DIR/$FILE $NETWORK_PSEUDO/$FILE 2> /dev/null
    fi
    if test $? != 0; then
        $ECHO
        $ECHO "ERROR: $PSEUDO_DIR/$FILE not existent or not readable"
        $ECHO "Aborting"
        exit 1
    fi
done
$ECHO " done"

# how to run executables
PW_COMMAND="$PARA_PREFIX $BIN_DIR/pw.x $PARA_POSTFIX"
GEN_COMMAND="$PARA_PREFIX $BIN_DIR/generate_vdW_kernel_table.x $PARA_POSTFIX"
PP_COMMAND="$PARA_PREFIX $BIN_DIR/pp.x $PARA_POSTFIX"
PLOTRHO_COMMAND="$BIN_DIR/plotrho.x"
BANDS_COMMAND="$PARA_PREFIX $BIN_DIR/bands.x $PARA_POSTFIX"
PLOTBAND_COMMAND="$BIN_DIR/plotband.x"
$ECHO
$ECHO "  running pw.x as:       $PW_COMMAND"
$ECHO "  running generate_vdW_kernel_table.x as:       $GEN_COMMAND"
$ECHO "  running pp.x as:       $PP_COMMAND"
$ECHO "  running plotrho.x as:  $PLOTRHO_COMMAND"
$ECHO "  running bands.x as:    $BANDS_COMMAND"
$ECHO "  running plotband.x as: $PLOTBAND_COMMAND"
$ECHO

# check for vdw kernel table
if test ! -r $PSEUDO_DIR/$VDW_TABLE ; then
	$ECHO " "
        $ECHO " "
	$ECHO "  WARNING: $PSEUDO_DIR/$VDW_TABLE not existent or not readable"
	$ECHO "  WARNING: a new table will be generated, this process will"
	$ECHO "  WARNING: probably take about 20 mins (depending on your cpu"
	$ECHO "  WARNING: power and configuration)."
	$ECHO
	$ECHO "  Generating $VDW_TABLE...\c"
	if $GEN_COMMAND ; then
		if test ! -r $VDW_TABLE ; then
			$ECHO "  ERROR: cannot generate vdW_kernel_table !!"
			exit 1
		fi
		$ECHO "done ! Table moved to $PSEUDO_DIR"	
		mv $VDW_TABLE $PSEUDO_DIR
	fi
fi 
$ECHO " done"

# self-consistent calculation
cat > TaS2_2H.scf.in << EOF
 &control
    prefix='TaS2_2H',
    calculation = 'scf',
    restart_mode = 'from_scratch'
    pseudo_dir='$PSEUDO_DIR',
    outdir = '$TMP_DIR',
    etot_conv_thr = 1.0d-5 ,
 /
 &system    
    ibrav=  0, nat=  6, ntyp= 2,
    celldm(1)=1.889726,
    ecutwfc = 39.0, ecutrho = 300,
    occupations ='smearing', smearing ='gaussian',
    degauss=0.02,
    input_dft = 'vdW-DF2',
 /
 &electrons
    conv_thr = 1e-8,
    mixing_beta=0.3,
    electron_maxstep=500
 /
ATOMIC_SPECIES
  Ta  180.9479  Ta.pbe-spn-rrkjus_psl.0.2.UPF
   S  32.0660   S.pbe-n-rrkjus_psl.0.1.UPF
ATOMIC_POSITIONS crystal
Ta      -0.000001090  -0.000000545   0.250000000
S        0.333331532   0.666673022   0.125134683
S        0.666668468   0.333326978   0.874865317
S        0.333331532   0.666658510   0.374865317
S        0.666668468   0.333341490   0.625134683
Ta       0.000001090   0.000000545   0.750000000
CELL_PARAMETERS (alat) 
   3.429091335   0.000001341  -0.000011413
  -1.714544506   2.969678197   0.000022825
  -0.000042362   0.000073374  12.618226335
K_POINTS {automatic}
 10 10 4 0 0 0
EOF
$ECHO "  running the scf calculation...\c"
$PW_COMMAND < TaS2_2H.scf.in > TaS2_2H.scf.out
check_failure $?
$ECHO " done"

# post-processing for charge density
cat > TaS2_2H.pp_rho.in << EOF
 &inputpp
    prefix  = 'TaS2_2H'
    outdir = '$TMP_DIR/'
    filplot = 'TaS2_2Hcharge'
    plot_num= 0
 /
 &plot
    nfile = 1
    filepp(1) = 'TaS2_2Hcharge'
    weight(1) = 1.0
    iflag = 3
    output_format = 5
    fileout = 'TaS2_2H.xsf'
 /
EOF
$ECHO "  running pp.x to do a 2-d plot of the charge density...\c"
$PP_COMMAND < TaS2_2H.pp_rho.in > TaS2_2H.pp_rho.out
check_failure $?
$ECHO " done"

# band structure calculation along high-symmetry lines
cat > TaS2_2H.band.in << EOF
 &control
    prefix='TaS2_2H',
    calculation = 'bands',
    pseudo_dir='$PSEUDO_DIR',
    outdir = '$TMP_DIR',
 /
 &system    
    ibrav=  0, nat=  6, ntyp= 2,
    celldm(1)=1.889726,
    ecutwfc = 39.0, ecutrho = 300,
    occupations ='smearing', smearing ='gaussian',
    degauss=0.02,
    input_dft = 'vdW-DF2',
 /
 &electrons
    conv_thr = 1e-8,
    mixing_beta=0.3,
    electron_maxstep=500
 /
ATOMIC_SPECIES
  Ta  180.9479  Ta.pbe-spn-rrkjus_psl.0.2.UPF
   S  32.0660   S.pbe-n-rrkjus_psl.0.1.UPF
ATOMIC_POSITIONS crystal
Ta      -0.000001090  -0.000000545   0.250000000
S        0.333331532   0.666673022   0.125134683
S        0.666668468   0.333326978   0.874865317
S        0.333331532   0.666658510   0.374865317
S        0.666668468   0.333341490   0.625134683
Ta       0.000001090   0.000000545   0.750000000
CELL_PARAMETERS (alat) 
   3.429091335   0.000001341  -0.000011413
  -1.714544506   2.969678197   0.000022825
  -0.000042362   0.000073374  12.618226335
K_POINTS crystal_b
  4
   0.0 0.0 0.0 30
   0.5 0.0 0.0 30
   0.33333 0.333333 0.0 30
   0.0 0.0 0.0 1
EOF
$ECHO "  running the band-structure calculation for TaS2_2H...\c"
$PW_COMMAND < TaS2_2H.band.in > TaS2_2H.band.out
check_failure $?
$ECHO " done"

# post-processing for band structure
cat > TaS2_2H.bands.in << EOF
 &bands
    prefix  = 'TaS2_2H'
    outdir = '$TMP_DIR/'
    filband = 'TaS2_2Hbands.dat'
    lsym=.true.,
 /
EOF
$ECHO "  running the post-processing for band structure...\c"
$BANDS_COMMAND < TaS2_2H.bands.in > TaS2_2H.bands.out
check_failure $?
$ECHO " done"

# plotband.x
cat > TaS2_2H.plotband.in << EOF
TaS2_2Hbands.dat
5.7876 12.7876
TaS2_2Hbands.xmgr
TaS2_2Hbands.ps
8.2876 #put Fermi energy from output here
1.0 8.2876 #put Fermi energy from output here
EOF
$ECHO "  running plotband.x to generate TaS2_2Hbands.ps...\c"
$PLOTBAND_COMMAND < TaS2_2H.plotband.in > TaS2_2H.plotband.out
check_failure $?
$ECHO " done"


if [ "$GP_COMMAND" = "" ]; then
    break
else
cat > gnuplot1.tmp <<EOF
#!$GP_COMMAND
#
set term png font "Times-Roman,80" enh size 3543,2505 
sqrt32=sqrt(3)*0.5
unset ztics
set xtics ("{/Symbol G}" 0.0,"M" 0.1684, "K" 0.2656,"{/Symbol G}" 0.46)
set bmargin 2.5
set lmargin 7
set rmargin 7
set tmargin 2.5
set border linewidth 7
set ytics font "Times-Roman, 60"
set ytics 2
set style line 11 lc rgb 'white' lt 1 lw 7
set style line 12 lc rgb 'black' lt 1 lw 7
set grid xtics ls 11
set grid xtics ls 12
#
dim1=-2.5
dim2=4.5
dim3=0.0000
dim4=0.46
set xrange [dim3:dim4]
set yrange [dim1:dim2]
unset key
#
set out 'TaS2.bonds.png'
set ylabel "Energy (eV)" offset 2,0,0

vb_max=8.2876 #put Fermi energy from output here

plot "TaS2_2Hbands.xmgr.1.1"   u 1:(\$2-vb_max) w l lw 7  lc rgb "black",\
"TaS2_2Hbands.xmgr.2.1" u 1:(\$2-vb_max) w l lw 7  lc rgb "black",\
"TaS2_2Hbands.xmgr.3.1" u 1:(\$2-vb_max) w l lw 7  lc rgb "black"
EOF
$ECHO "  creating the postscript file TaS2_2H.bands.ps...\c"
$GP_COMMAND gnuplot1.tmp
check_failure $?
$ECHO " done"
fi
$ECHO

$ECHO "  cleaning $TMP_DIR...\c"
rm -rf $TMP_DIR/TaS2_2H.*

$ECHO
$ECHO "$EXAMPLE_DIR: done"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TaS2.bonds.png
Type: image/png
Size: 73618 bytes
Desc: not available
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20170901/b4b7999a/attachment.png>


More information about the users mailing list