[Wien] error in runfsm_lapw: vresp: Undefined variable.

Peter Blaha peter.blaha at tuwien.ac.at
Thu Nov 3 12:17:46 CET 2022


Thanks for the report.

This is a bug in runfsm_lapw for complex calculations (no inversion). 
The setting of tau and vresp is done only in case of inversion symmetry.

The attached file should fix it. Copy it into $WIENROOT.

Regards
Peter Blaha

Am 03.11.2022 um 08:12 schrieb Dr. KISHOR KUMAR डॉ. किशोर कुमार:
> Dear Wien2k developers,
> 
> I have encountered an error during fixed spin moment calculation in 
> WIEN2k (version 21) as mentioned below:
> [2]    Done                          ( cd $PWD; $t $exe 
> ${def}_$loop.def; rm -f .lock_$lockfile[$p] ) >> .time1_$loop
>   LAPW0 END
>   LAPW0 END
>   LAPW1 END
> [2]    Done                          ( cd $PWD; $t $exe 
> ${def}_$loop.def; rm -f .lock_$lockfile[$p] ) >> .time1_$loop
>   LAPW1 END
>   LAPW1 END
>   LAPW1 END
>   LAPW1 END
> [5]  + Done                          ( cd $PWD; $t $exe 
> ${def}_$loop.def; rm -f .lock_$lockfile[$p] ) >> .time1_$loop
> [4]  + Done                          ( cd $PWD; $t $exe 
> ${def}_$loop.def; rm -f .lock_$lockfile[$p] ) >> .time1_$loop
> [3]  + Done                          ( cd $PWD; $t $exe 
> ${def}_$loop.def; rm -f .lock_$lockfile[$p] ) >> .time1_$loop
> [1]  + Done                          ( cd $PWD; $t $exe 
> ${def}_$loop.def; rm -f .lock_$lockfile[$p] ) >> .time1_$loop
> vresp: Undefined variable.
> 
> ======
> command to run fsm calculation is given as
> 
> runfsm_lapw -m 50.4 -p -ec 0.0001 -i 100
> 
> There is no error when I run normal spin polarized calculation with 
> runsp_lapw script.
> 
> Please help me out from this error.
> 
> Regards,
> 
> Dr. KISHOR KUMAR/डॉ. किशोर कुमार
> Department of Physics/भौतिक विज्ञान विभाग
> Mohanlal Sukhadia University, Udaipur 313001
> मोहनलाल सुखाड़िया विश्वविद्यालय, उदयपुर 313001
> Rajasthan, India | Mob. No. +91-8003180325
> राजस्थान, भारत | मो. न. +91-8003180325
> 
> 
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
> SEARCH the MAILING-LIST at:  http://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/index.html

-- 
--------------------------------------------------------------------------
Peter BLAHA, Inst.f. Materials Chemistry, TU Vienna, A-1060 Vienna
Phone: +43-1-58801-165300
Email: peter.blaha at tuwien.ac.at    WIEN2k: http://www.wien2k.at
WWW:   http://www.imc.tuwien.ac.at
-------------------------------------------------------------------------
-------------- next part --------------
#!/bin/tcsh -f
hup
unalias rm

set name  = $0
set bin   = $name:h		#directory of WIEN-executables
if !(-d $bin) set bin = .
set name  = $name:t 		#name of this script-file
set logfile = :log
set tmp   = (:$name)		#temporary files

set scratch =                   # set directory for vectors and help files
set scratchstring =
if ($?SCRATCH) then              #if envronment SCRATCH is set
 set scratch=`echo $SCRATCH  | sed -e 's/\/$//'`/ #set $scratch to that value  
endif                          

#---> functions & subroutines
alias	testinput	'set errin="\!:1";if (! -e \!:1 || -z \!:1) goto \!:2'
alias	teststatus	'if ($status) goto error'
alias	testerror	'if ( -e \!:1.error && ! -z \!:1.error) goto error'
alias	teststop	'if (\!:1 == $stopafter ) goto stop'
alias   cleandayfile    'grep -v "\[" $dayfile >.tmp;'\
                        'mv .tmp $dayfile'
alias	output		'set date = `date +"(%T)"`;'\
			'printf ">   %s\t%s " "\!:*" "$date" >> $dayfile'

alias	exec		'($bin/x  \!:*) >> $dayfile;'\
			'teststatus'

alias	total_exec	'output \!:*;'\
			'exec \!:*;'\
                        'cleandayfile;'\
			'testerror \!:1;'\
			'testerror up\!:1;'\
			'testerror dn\!:1;'\
			'teststop \!:1'
alias	TOTtoFOR	'sed "s/TOT/FOR/" \!:1 > $tmp;'\
			'mv $tmp \!:1'
alias	FORtoTOT	'sed "s/FOR/TOT/" \!:1 > $tmp;'\
			'mv $tmp \!:1'

#---> default parameters
set ccut	= 0.0000 	#upper limit for charge convergence
set fcut	= 0 	 	#upper limit for force convergence
set ecut	= 0.0001	#upper limit for energy convergence
unset ec_conv
set cc_conv
set fc_conv
set ec_test
unset ec_test1
unset cc_test
unset fc_test
set iter	= 40	#maximum number of iterations
set riter	= 99	#restart after $riter iterations
set stopafter		#stop after $stopafter
set next		#set -> start cycle with $next
set qlimit = 0.05       #set -> writes E-L in new in1 when qlimit is fulfilled
set in1new = 999
set write_all = -ef     # new default: -in1ef is activated (version 10.1)
set para
set nohns
set nohns1 = 0
set it
set readHinv
unset vec2pratt
set it0
set itnum=0
set itnum1=0
set so
set orb
set orb2
set broyd
set eece1
unset eece
unset orbc
unset noorbup
unset dm
set ctest=(0 0 0)
set etest=(0 0 0)

#---> default flags
unset renorm
set   in1orig
unset force		#set -> force-calculation after self-consistency
unset f_not_conv
unset help		#set -> help output
unset complex		#set -> complex calculation
unset init		#set -> switches initially set to total energy calc.

#---> handling of input options
echo ">   ($name) options: $argv"	>> $logfile
set commandline=`echo "$name $argv " `
alias sb 'shift; breaksw'	#definition used in switch
while ($#argv)
  switch ($1)
  case -[M|m]:
    shift; set m = $1; sb
		echo $m
  case -[H|h]:
    set help; sb
  case -so:
    echo 'so not supported with FSM calculations'
    exit 3
    set so = -so; sb
  case -nohns:
    set nohns = -nohns; shift; set nohns1 = $1;sb
  case -dm:
    set dm; sb
  case -orb:
    set orb2 = -orb
    set orb = -orb; sb
  case -orbc:
    set orbc
    set orb = -orb; sb
  case -hf:
    echo '-hf not yet supported with FSM calculations'
    exit 3
  case -eece:
#    echo '-eece not yet supported with FSM calculations'
#    exit 3
    set eece
    set eece1 = -eece
    set orb = -orb; sb
  case -noorbud:
    set noorbud
    set orb = -orb; sb
  case -it:
    set itnum = 99; set it = -it; set it0 = -it; sb
  case -it1:
    set itnum = 99; set it = -it; set it0 = -it; touch .noHinv; sb
  case -it2:
    set itnum = 99; set it = -it; set it0 = -it; touch .fulldiag; sb
  case -noHinv:
    set itnum = 99; set it = -it; set it0 = -it; set readHinv = -noHinv; sb
  case -vec2pratt:
    set vec2pratt; sb
  case -p:
    set para = -p; sb
  case -I:
    set init; sb
  case -NI:
    unset broyd; sb
  case -e: 
    shift; set stopafter = $1; sb
  case -cc: 
    shift; set ccut = $1; set cc_test;unset cc_conv; sb
  case -ec: 
    shift; set ecut = $1; set ec_test1;unset ec_conv; sb
  case -fc: 
    shift; set f_not_conv; set fcut = $1; set fc_test;unset fc_conv; sb
  case -ql: 
    shift; set qlimit = $1;  sb
  case -in1ef: 
    set in1new = -1;set write_all = -ef;  sb
  case -in1new: 
    shift; set in1new = $1;set write_all;  sb
  case -in1orig:
    set in1orig = -in1orig; set in1new = 999; sb
  case -renorm: 
    set renorm; set next=scf1;  sb
  case -i:
    shift; set iter  = $1; sb
  case -r:
    shift; set riter = $1; sb
  case -s:
    shift; set next  = $1; sb
  case -scratch:
    shift;set scratch = $1
    set ncar=`echo $scratch |wc -m`
    @ ncar --
    set lcar=`echo $scratch | cut -c$ncar`
    if("$lcar" != '/' ) set scratch=`echo "${scratch}/"`
    set scratchstring="-scratch $scratch"
    setenv SCRATCH $scratch
    if ( "$scratch" == "./" ) then
        set scratch=
        set scratchstring=
    else if(! -e "$scratch" ) then
        mkdir -p $scratch
    endif
    shift; breaksw  
  default: 
    echo "ERROR: option $1 does not exist\!"; sb
  endsw
end
if ($?help) goto help

if($?cc_test) then
       unset ec_test;set ec_conv
endif
if($?fc_test) then
       unset ec_test;set ec_conv
endif
if($?ec_test1) then
       set ec_test;unset ec_conv
endif
if(! $?ec_test) then
       set ecut=0
endif
  
#---> path- and file-names
set file    = `pwd`
set file    = $file:t		#tail of file-names
set dayfile = $file.dayfile	#main output-file


#---> starting out
printf "\nCalculating $file in `pwd`\non `hostname` with PID $$\n"  > $dayfile
echo "using `cat $WIENROOT/WIEN2k_VERSION` in $WIENROOT"  >> $dayfile
printf "\n:LABEL1: Calculations in `pwd`\n:LABEL2: on `hostname` at `date`\n"  >> $file.scf
echo ":LABEL3: using `cat $WIENROOT/WIEN2k_VERSION` in $WIENROOT\n"  >> $file.scf
echo ":LABEL4: using the command: $commandline\n"  >> $file.scf

if ( "$so" == "-so" && "$orb2" == "-orb") then
   set orb2
endif

if ($next != "") goto start	#start with optional program
set next = lapw0		#default start with lstart

if !(-e $file.clmsum) then
   if (-e $file.clmsum_old) then
    cp $file.clmsum_old $file.clmsum
   else
     echo 'no' $file'.clmsum(_old) file found, which is necessary for lapw0 \!'
     echo 'no' $file'.clmsum(_old) file found, which is necessary for lapw0 \!'\
	>>$dayfile
     goto error
   endif
endif

if ($?broyd) then
   if (-e $file.broyd1) then
     echo "$file.broyd* files present \! You did not save_lapw a previous clculation." 
     echo "You have 60 seconds to kill this job ( ^C   or   kill $$ )" 
     echo "or the script will rm *.broyd* and continue (use -NI to avoid automatic rm)"
     sleep 60
     rm *.broyd*
     echo "$file.broyd* files removed \!"  >> $dayfile
   endif
endif

start:				#initalization of in2-files
testinput	$file.in2  complex_in2c
if (! -e $file.in2_fsm || -z $file.in2_fsm) cp $file.in2 $file.in2_fsm   
awk -v m=$m '/NE/{$0="      "$1"      "$2+m"     "$3" "$4"      "$5" "$6" "$7" "$8" "$9" "};//' $file.in2_fsm>$file.in2up
awk -v m=$m '/NE/{$0="      "$1"      "$2-m"     "$3" "$4"      "$5" "$6" "$7" "$8" "$9" "};//' $file.in2_fsm>$file.in2dn
goto cont_in2
complex_in2c:
if (! -e $file.in2_fsm || -z $file.in2_fsm) cp $file.in2c $file.in2_fsm   
awk -v m=$m '/NE/{$0="      "$1"      "$2+m"     "$3" "$4"      "$5" "$6" "$7" "$8" "$9" "};//' $file.in2_fsm>$file.in2cup
awk -v m=$m '/NE/{$0="      "$1"      "$2-m"     "$3" "$4"      "$5" "$6" "$7" "$8" "$9" "};//' $file.in2_fsm>$file.in2cdn
cont_in2:

if ($?init) then
  foreach i ($file.in2*)
    sed "1s/[A-Z]..../TOT  /" $i > $tmp
    mv $tmp $i
  end
endif

set icycle=1

set riter_save=$riter
printf "\n\n    start \t(%s) " "`date`"	>> $dayfile

#goto mixer only if clmval file is present
if ($next == "scf1") then
   if !(-e $file.clmvalup) then
   set next = lapw0
   endif
endif

echo  "with $next ($iter/$riter to go)"	>> $dayfile
goto $next

cycle:					#begin of sc-cycle
nohup echo in cycle $icycle "   ETEST: $etest[3]   CTEST: $ctest[3]"
hup

if ($it == '-it' ) then
 set ittest=`echo "$icycle / $itnum * $itnum "| bc`
 if ( $ittest == $icycle ) touch .fulldiag
endif

lapw0:
printf "\n    cycle $icycle \t(%s) \t(%s)\n\n" "`date`" "$iter/$riter to go" 	>> $dayfile

testinput       $file.in0_grr cont_lapw0
total_exec      lapw0 -grr $para

cont_lapw0:
testinput	$file.in0 error_input

#fix for NFS bug
touch $file.vspup $file.vspdn $file.vnsup $file.vnsdn
rm $file.vspup $file.vspdn $file.vnsup $file.vnsdn

total_exec	lapw0 $para

if ($fcut == "0") goto orb
set f_exist=`grep :FHF $file.scf0`
if ($#f_exist == 0 ) then
  set fcut=0
  set fc_conv
  echo Force-convergence not possible. Forces not present.
  echo Force-convergence not possible. Forces not present.>> $dayfile
  if($?ec_test) goto orb
  if($?cc_test) goto orb
  goto error
endif

#---> test of force-convergence for all forces
if !(-e $file.scf) goto orb
      if(! $?ec_conv) goto orb 
      if(! $?cc_conv) goto orb
set natom=`head -2 $file.struct |tail -1 |cut -c28-30`
#set natom = `grep UNITCELL $file.output0 |awk '{print $NF}'`
set iatom = 1
set ftest = (1 0)
grep :FOR $file.scf >test_forces.scf
while ($iatom <= $natom) 		#cycle over all atoms 
  set itest=$iatom
  @ itest ++
  testinput	$file.inM cont_force_test
    set atest=`head -$itest $file.inM |tail -1`
    set itest=`echo " $atest[1] + $atest[2] + $atest[3]"|bc`
    if ( $itest == '0' ) goto skipforce
  cont_force_test:
  if ($iatom <= 9) then
      set test = (`$bin/testconv -p :FOR00$iatom -c $fcut -f test_forces`)
  else if ($iatom <= 99) then
      set test = (`$bin/testconv -p :FOR0$iatom -c $fcut -f test_forces`)
   else
      set test = (`$bin/testconv -p :FOR$iatom -c $fcut -f test_forces`)
  endif
  if  !($test[1]) set ftest[1] = 0
  set ftest[2] = $test[2]
  set ftest    = ($ftest $test[3] $test[4])
skipforce:
  @ iatom ++
end
rm test_forces.scf
echo ":FORCE convergence:"  $ftest[1-]			>> $dayfile

if ($ftest[1]) then			#force convergenced
  if ($nohns == '-nohns') then			#force convergenced
      set nohns 
      echo "NOHNS deactivated by FORCE convergence"		>> $dayfile
  else
#      set iter = 1
       if(! $?ec_conv) goto orb 
       if(! $?cc_conv) goto orb
      set fc_conv
      unset f_not_conv 
      foreach i ($file.in2*)
        TOTtoFOR $i				#switch FOR-label
      end
  endif
else
      unset fc_conv
endif

orb:
foreach i (dmatup dmatdn dmatud )
  if (-e $file.$i"_old" ) rm $file.$i"_old"	
  if (-e $file.$i ) cp $file.$i $file.$i"_old"		#save this cycle for next
end

if ( -e $file.scforbup ) rm $file.scforbup 
if ( -e $file.scforbdn ) rm $file.scforbdn 
if ( -e $file.scforbud ) rm $file.scforbud 

if ( $?eece ) goto lapw1
if ( "$orb" != "-orb" ) goto lapw1
if ( $?orbc ) goto lapw1
if ( -e $file.vorbud   ) rm $file.vorbud
if (! -e $file.dmatup || -z $file.dmatup ) goto lapw1
#foreach i ( vorbup vorbdn vorbud )
#  if (-e $file.$i ) \
#  cp $file.$i $file.$i"_old"		#save last cycle
#end
testinput	$file.inorb error_input
total_exec	orb -up $para
total_exec	orb -dn $para
if ( "$so" == "-so" && ! -z $file.dmatud && -e $file.dmatud ) then
   if( $?noorbud ) then
      total_exec	orb -ud $para
# vorbud seems to be corrected, so we use it except with -noorbud switch)
   endif
endif

lapw1:
testinput	$file.in1 lapw1c
set readHinv0 = $readHinv
if (-e .noHinv) then
  echo "    case.storeHinv files removed"
  set readHinv0 = -noHinv0
  rm .noHinv
endif
if (-e .fulldiag) then
  echo "    full diagonalization forced"
  set it0
  set readHinv0 
  rm .fulldiag 
  rm -f ${scratch}$file.vector*.old
endif
if ( $it0 == "-it" ) then
  touch ${scratch}$file.vector.old
  if( ! $?vec2pratt ) then
   foreach i (${scratch}$file.vector*.old)
    rm $i 
   end
    vec2old_lapw $para -up >> $dayfile
  else
    vec2pratt_lapw $para -up >> $dayfile
  endif
endif

if ( -e dnlapw1.error  ) rm dnlapw1.error 

#generates in1-file from :EPL/EPH in case.scf2 
  if ($icycle >= $in1new ) then
    if (! -e $file.in1_orig ) cp $file.in1 $file.in1_orig
    write_in1_lapw $write_all -up -ql $qlimit >> $dayfile
    if($status == 0 ) cp $file.in1new $file.in1
  endif
if($?in1orig == '-in1orig') then
    if ( -e $file.in1_orig ) mv $file.in1_orig $file.in1
#    unset in1orig
endif
  total_exec	lapw1 $it0 -up $para $nohns $orb $readHinv0 $scratchstring
  testinput	$file.in2up error_input
###  vec2old_lapw $para -updn >> $dayfile   # not necessary
  foreach i ( $file.energyup* )
  if (! -z $i ) then
    set new = `echo $i|sed "s/energyup/energydn/"`
    set NEW = `echo $i|sed "s/energyup/energyUP/"`
    cp $i $NEW
    cp $i $new
  endif
  end

set tau
testinput       $file.inm_tau no_tau
set tau=-tau
no_tau:

set vresp
testinput       $file.inm_vresp no_vresp
set vresp=-vresp
no_vresp:

cp $file.in2up $file.in2
if ( -e dnlapw2.error  ) rm dnlapw2.error 
total_exec	lapw2 -up $para $vresp $tau $in1orig $orb2 $scratchstring

if ( -e $file.scfdmup ) rm $file.scfdmup 
####if ( "$orb2" == "-orb" ) goto lapw1dn
#if ( "$orb" == "-orb" ) then
#  if ( -e dnlapwdm.error  ) rm dnlapwdm.error 
#  testinput	$file.indm error_input
#  total_exec	lapwdm -up $para $scratchstring
#endif

lapw1dn:

testinput	$file.in1 error_input
#if (-e .fulldiag) then
#  echo "    full diagonalization forced"
#  set it0
#  rm .fulldiag
#endif
if ( $it0 == "-it" ) then
  if( ! $?vec2pratt ) then
    vec2old_lapw $para -dn >> $dayfile
  else
    vec2pratt_lapw $para -dn >> $dayfile
  endif
endif
if ($icycle >= $in1new ) then
    write_in1_lapw $write_all -dn -ql $qlimit >> $dayfile
    if($status == 0 ) cp $file.in1new $file.in1
endif
total_exec	lapw1 $it0 -dn $para $nohns $orb $readHinv0 $scratchstring
set it0 = $it
set readHinv0 = $readHinv

testinput	$file.in2dn error_input
##  vec2old_lapw $para -dnup >> $dayfile    # not necessary
  foreach i ( $file.energydn* )
  if (! -z $i ) then
    set new = `echo $i|sed "s/energydn/energyup/"`
    set NEW = `echo $i|sed "s/energydn/energyDN/"`
    cp $i $NEW
    cp $i $new
  endif
  end

cp $file.in2dn $file.in2
testinput	$file.in2 error_input
if ( -e dnlapw2.error  ) rm dnlapw2.error 
total_exec	lapw2 -dn $para $vresp $tau $in1orig $orb2 $scratchstring
cp $file.in2_fsm $file.in2

if ( -e $file.scfdmdn ) rm $file.scfdmdn
###if ( "$orb2" == "-orb" ) goto lcore
#if ( "$orb" == "-orb" ) then
#  testinput	$file.indm error_input
#  if ( -e dnlapwdm.error  ) rm dnlapwdm.error 
#  total_exec	lapwdm -dn $para $scratchstring
#endif

goto lcore

lapw1c:
testinput	$file.in1c error_input
set readHinv0 = $readHinv
if (-e .noHinv) then
  echo "    case.storeHinv files removed"
  set readHinv0 = -noHinv0
  rm .noHinv
endif
if (-e .fulldiag) then
  echo "    full diagonalization forced"
  set it0
  set readHinv0
  rm .fulldiag
endif
if ( $it0 == "-it" ) then
  touch ${scratch}$file.vector.old
  if( ! $?vec2pratt ) then
   foreach i (${scratch}$file.vector*.old)
    rm $i
   end
    vec2old_lapw $para -up >> $dayfile
  else
    vec2pratt_lapw $para -up >> $dayfile
  endif
endif

if ( -e dnlapw1.error  ) rm dnlapw1.error 
#generates in1-file from :EPL/EPH in case.scf2 
#  if ($icycle == $in1new) rm $file.broyd1 $file.broyd2 
  if ($icycle >= $in1new ) then
    if (! -e $file.in1c_orig ) cp $file.in1c $file.in1c_orig
    write_in1_lapw $write_all -up -c -ql $qlimit >> $dayfile
    if($status == 0 ) cp $file.in1cnew $file.in1c
  endif
if($?in1orig == '-in1orig') then
    if ( -e $file.in1c_orig ) mv $file.in1c_orig $file.in1c
#    unset in1orig
endif
 total_exec     lapw1 $it0 -c -up $para $nohns $orb $readHinv0 $scratchstring
  testinput	$file.in2cup error_input
###  vec2old_lapw $para -updn >> $dayfile   # not necessary
  foreach i ( $file.energyup* )
  if (! -z $i ) then
    set new = `echo $i|sed "s/energyup/energydn/"`
    set NEW = `echo $i|sed "s/energyup/energyUP/"`
    cp $i $NEW
    cp $i $new
  endif
  end

set tau
testinput       $file.inm_tau no_tau
set tau=-tau
no_tau:

set vresp
testinput       $file.inm_vresp no_vresp
set vresp=-vresp
no_vresp:

!
cp $file.in2cup $file.in2c
if ( -e dnlapw2.error  ) rm dnlapw2.error 
total_exec	lapw2 -c -up $para $vresp $tau $in1orig $orb2 $scratchstring

if ( -e $file.scfdmup ) rm $file.scfdmup 
####if ( "$orb2" == "-orb" ) goto lapw1cdn
#if ( "$orb" == "-orb" ) then
#  if ( -e dnlapwdm.error  ) rm dnlapwdm.error 
#  testinput	$file.indmc error_input
#  total_exec	lapwdm -c -up $para $scratchstring
#endif

lapw1cdn:

#if (-e .fulldiag) then
#  echo "    full diagonalization forced"
#  set it0
#  rm .fulldiag
#endif
if ( $it0 == "-it" ) then
  if( ! $?vec2pratt ) then
    vec2old_lapw $para -dn >> $dayfile
  else
    vec2pratt_lapw $para -dn >> $dayfile
  endif
endif

  if ($icycle >= $in1new ) then
    write_in1_lapw $write_all -dn -c -ql $qlimit >> $dayfile
    if($status == 0 ) cp $file.in1cnew $file.in1c
  endif
 total_exec     lapw1 $it0 -c -dn $para $nohns $orb $readHinv0 $scratchstring

set it0 = $it
set readHinv0 = $readHinv


testinput	$file.in2cdn error_input
###  vec2old_lapw $para -dnup >> $dayfile
  foreach i ( $file.energydn* )
  if (! -z $i ) then
    set new = `echo $i|sed "s/energydn/energyup/"`
    set NEW = `echo $i|sed "s/energydn/energyDN/"`
    cp $i $NEW
    cp $i $new
   endif
  end

cp $file.in2cdn $file.in2c

total_exec	lapw2 -c -dn $so $para $vresp $tau $in1orig $orb2 $scratchstring

####if ( "$orb2" == "-orb" ) goto lcore1
#if ( "$orb" == "-orb" ) then
#  testinput	$file.indmc error_input
#  total_exec	lapwdm -dn -c $para $scratchstring
#endif

lcore1:
cp $file.in2_fsm $file.in2c

lcore:
testinput	$file.inc scf
if (  ! -z $file.incup && -e $file.incup ) then
  cp $file.incup $file.inc
  echo "spinpolarized $file.incup/dn used"		>> $dayfile
endif
if ( -e dnlcore.error  ) rm dnlcore.error 
total_exec	lcore -up $vresp $tau
if (  ! -z $file.incdn && -e $file.incdn ) then
  cp $file.incdn $file.inc
endif
total_exec	lcore -dn $vresp $tau
rm -f $file.clmscup $file.clmscdn 

coresuper:
   if ( ! -e .lcore) goto scf
   total_exec      dstart -lcore -up $para
   total_exec      dstart -lcore -dn $para
   rm $file.clmcorup $file.clmcordn
   echo ":LCORE   core superposition due to .lcore file" >> $file.scfcup
   echo "         First and last fourier coefficient of PW representation:" >> $file.scfcup
   grep ' 0    0    0' $file.clmscup >> $file.scfcup
   tail -1 $file.clmscup>> $file.scfcup

scf:
foreach i ( 0 orbup orbdn orbud 1up 1dn so 2up 2dn dmup dmdn 1sup 1sdn 2sup 2sdn cup cdn )
  if (-e $file.scf$i) then
      if ("$i" != "dmdn" || "$so" != "-so") cat $file.scf$i  >> $file.scf
  endif
end

if ( $?eece ) then
   mv $file.scf2up $file.scf2up-tmp
   mv $file.scf2dn $file.scf2dn-tmp
   if( $vresp == '-vresp' ) then
     mv $file.vrespvalup $file.vrespvalup-tmp
     mv $file.vrespvaldn $file.vrespvaldn-tmp
     mv $file.vrespcorup $file.vrespcorup-tmp
     mv $file.vrespcordn $file.vrespcordn-tmp
   endif
   if( $tau == '-tau' ) then
     mv $file.tauvalup $file.tauvalup-tmp
     mv $file.tauvaldn $file.tauvaldn-tmp
     mv $file.taucorup $file.taucorup-tmp
     mv $file.taucordn $file.taucordn-tmp
   endif
   foreach i ( vorbup vorbdn vorbud )
     if (-e $file.$i"_old" ) rm $file.$i"_old"	
     if (-e $file.$i )   cp $file.$i $file.$i"_old"	#save last cycle
   end
   runeece_lapw  $so $para $vresp $tau $in1orig -fsm
   teststatus
   foreach i (vorbup vorbdn vorbud )
     if (-e $file.$i"_unmixed" ) rm $file.$i"_unmixed"	
     if (-e $file.$i ) cp $file.$i $file.$i"_unmixed"	#save unmixed dmat
   end
   mv $file.scf2up $file.scf2upeece
   mv $file.scf2dn $file.scf2dneece
   mv $file.scf2up-tmp $file.scf2up
   mv $file.scf2dn-tmp $file.scf2dn
   if( $vresp == '-vresp' ) then
     mv $file.vrespvalup $file.vrespvaleeceup
     mv $file.vrespvaldn $file.vrespvaleecedn
     mv $file.vrespvalup-tmp $file.vrespvalup
     mv $file.vrespvaldn-tmp $file.vrespvaldn
     mv $file.vrespcorup-tmp $file.vrespcorup
     mv $file.vrespcordn-tmp $file.vrespcordn
   endif
   if( $tau == '-tau' ) then
     mv $file.tauvalup $file.tauvaleeceup
     mv $file.tauvaldn $file.tauvaleecedn
     mv $file.tauvalup-tmp $file.tauvalup
     mv $file.tauvaldn-tmp $file.tauvaldn
     mv $file.taucorup-tmp $file.taucorup
     mv $file.taucordn-tmp $file.taucordn
   endif
   goto scf1
endif

foreach i (dmatup dmatdn dmatud )
  if (-e $file.$i"_unmixed" ) rm $file.$i"_unmixed"	
  if (-e $file.$i ) cp $file.$i $file.$i"_unmixed"	#save the unmixed dmat
end

scf1:
foreach i (clmsum clmup clmdn vspup vspdn vnsup vnsdn )
  if (-e $file.$i ) cp $file.$i $file.$i"_old"		#save last cycle
end


mixer:
testinput	$file.inm error_input
if ( $?orbc ) then
    total_exec  mixer 
else
    total_exec  mixer $eece1 $orb 
endif
cat $file.scfm >> $file.scf

if ( -e .forcedmat ) then
   cp $file.dmatup_unmixed $file.dmatup
   cp $file.dmatdn_unmixed $file.dmatdn
   rm .forcedmat
endif

if ( -e .forceorb ) then
   cp $file.vorbup_unmixed $file.vorbup
   cp $file.vorbdn_unmixed $file.vorbdn
   rm .forceorb
endif

if($?renorm) then
   unset renorm
   rm $file.broy*
endif

mixer_tau:
testinput       $file.inm_tau   mixer_vresp
total_exec      mixer_tau
grep -e ":MIX " -e ":DIS" $file.scfm_tau | sed 's/:/:TAU/' >> $file.scf

mixer_vresp:
testinput       $file.inm_vresp energytest
total_exec      mixer_vresp
grep -e ":DIS" -e ":MIX " $file.scfm_vresp | sed 's/:/:VRESP/' >> $file.scf
#total_exec      int16

energytest:
#---> output energies
#set EF = `grep 'F E R' $file.scf2    |awk '{printf("%.5f", $NF)}'`
#set ET = `grep 'AL EN' $file.outputm |awk '{printf("%.5f", $NF)}'`
#cat << theend				>> $dayfile
#EF  $EF
#ET  $ET
#theend
#echo $ET 				> $file.finM

#---> test of energy convergence
#if ($ecut == "0") goto chargetest
set etest = (`$bin/testconv -p :ENE -c $ecut`)	
teststatus
echo ":ENERGY convergence:  $etest[1-3]"		>> $dayfile
if (! $?ec_test) goto chargetest
if ($etest[1]) then
  if ($nohns == '-nohns') then
      set nohns 
      echo "NOHNS deactivated by ENERGY convergence"		>> $dayfile
  else
#      set iter = 1
      set ec_conv
  endif
else
      unset ec_conv
endif

chargetest:
#if ($ccut == "0") goto nextiter
set ctest = (`$bin/testconv -p :DIS -c $ccut`)	
teststatus
echo ":CHARGE convergence:  $ctest[1-3]"		>> $dayfile
if (! $?cc_test) goto nextiter
if ($ctest[1]) then
  if ($nohns == '-nohns') then
      set nohns 
      echo "NOHNS deactivated by CHARGE convergence"		>> $dayfile
  else
#      set iter = 1
      set cc_conv
  endif
else
      unset cc_conv
endif

#---> output forces
#grep 'FTOT' $file.outputm|awk '{print "FT ",$2,$4,$5,$6}'\
#					>> $dayfile
#grep 'FTOT' $file.outputm|awk '{print $4,$5,$6}' \
#					>> $file.finM	

nextiter:
@  iter --
@ riter --
@ nohns1 --
@ icycle ++

#---> nohns
if (! $nohns1 ) then
  set nohns
  echo "NOHNS deactivated" 			>> $dayfile
endif

#---> restart
if (! $riter && -e $file.broyd1) then
  echo "    restart" 			>> $dayfile
  rm $file.broyd1 $file.broyd2
  set riter=$riter_save
endif

foreach i ($tmp)			#delete temporary files
  if (-e $i) rm $i
end

#output		cycle
#printf "%s\n\n" "$iter/$riter to go" 	>> $dayfile
if (-e .stop) goto stop1

if($?ec_conv && $?cc_conv && $?fc_conv) goto stop

if ($iter) goto cycle			#end of sc-cycle

if ( $?f_not_conv ) then
      printf "\n>   FORCES NOT CONVERGED\n"			>> $dayfile
      printf "\n>   stop\n"			                >> $dayfile 
      printf "\n>   FORCES NOT CONVERGED\n"		    
      exit 3
endif
if ( ! $?ec_conv ) then
      printf "\n>   energy in SCF NOT CONVERGED\n" 	>> $dayfile
      printf "\n>   stop\n"			        >> $dayfile
      printf "\n>   energy in SCF NOT CONVERGED\n"  
      exit 0
endif
if ( ! $?cc_conv ) then
      printf "\n>   charge in SCF NOT CONVERGED\n"	>> $dayfile  
      printf "\n>   stop\n"			        >> $dayfile
      printf "\n>   charge in SCF NOT CONVERGED\n"
      exit 0
endif

stop:					#normal exit
printf "\n>   stop\n"			>> $dayfile
printf "\n>   stop\n"	
exit 0 

stop1:					#normal exit
printf "\n>   stop due to .stop file\n"			>> $dayfile
if (-e .stop) rm .stop
printf "\n>   stop due to .stop file\n"	
exit 1 

error_input:					#error exit	
printf "\n>   stop error: the required input file $errin for the next step could not be found\n"		>> $dayfile
printf "\n>   stop error: the required input file $errin for the next step could not be found\n"
exit 9

error:					#error exit	
printf "\n>   stop error\n"		>> $dayfile
printf "\n>   stop error\n"
exit 9

help:					#help exit 
cat << theend 

PROGRAM:	$0

PURPOSE:	running the spinpolarized scf-cycle in WIEN with a
		fixed spin moment to be called within the case-directory
		has to be located in '$WIENROOT' directory

USAGE:		$name [OPTIONS] [FLAGS]

OPTIONS:
-m MOMENT ->    fixed mag. moment
-cc LIMIT ->	charge convergence LIMIT (0.0001 e)
-ec LIMIT ->	energy convergence LIMIT ($ecut Ry)
-fc LIMIT ->	force  convergence LIMIT (1.0 mRy/a.u.)
                default is -ec 0.0001; multiple convergence tests possible
-e PROGRAM ->	exit after PROGRAM ($stopafter)
-i NUMBER -> 	max. NUMBER ($iter) of iterations
-s PROGRAM -> 	start with PROGRAM ($next)
-r NUMBER -> 	restart after NUMBER ($riter) iterations (rm *.broyd*)
-nohns NUMBER ->do not use HNS for NUMBER iterations 
-in1new N ->    create "new" in1 file after N iter (write_in1 using scf2 info)
-ql LIMIT ->    select LIMIT ($qlimit) as min.charge for E-L setting in new in1
-scratch dir -> set scratch directory (for vector files)

FLAGS:
-h/-H ->	help
-I    ->	with initialization of in2-files to "TOT" 
-NI   ->	does NOT remove case.broyd* (default: rm *.broyd* after 60 sec)
-p    ->        run k-points in parallel (needs .machine file [speed:name])
-it   ->        use iterative diagonalization
-it1  ->        use iterative diag. with recreating H_inv (after basis change)
-it2  ->        use iterative diag. with reinitialization (after basis change)
-noHinv   ->    use iterative diag. without H_inv
-vec2pratt ->   use vec2pratt instead of vec2old for iterative diag.
-so   ->	NOT SUPPORTED for FSM
-dm   ->	calculate the density matrix (when -so is set, but -orb is not)
-eece ->        use EECE correction
-orb  ->        use LDA+U, OP or B-ext correction 
-orbc ->        use LDA+U correction, but with constant V-matrix 
-noorbud ->     use LDA+U with crossterms up-dn (needs also -so) 
-renorm->       start with mixer and renormalize density
-in1orig->      if present, use case.in1_orig file; do not modify case.in1
		
CONTROL FILES:
.lcore          runs core density superposition producing case.clmsc
.stop		stop after SCF cycle
.fulldiag	force full diagonalization
.noHinv         remove case.storeHinv files
.forceorb       using unmixed vorb files
.forcedmat      using unmixed dmat files
case.inm_vresp  activates calculation of vresp files for meta-GGAs
case.inm_tau    activates calculation of tau files for meta-GGAs
case.in0_grr    activates a second call of lapw0 (mBJ pot., or E_xc analysis)

ENVIRONMENT VARIBLES:
SCRATCH         directory  where vectors and help files should go

theend

exit 1




More information about the Wien mailing list