[Wien] init_phonon_lapw, strange behaviour

Peter Blaha peter.blaha at tuwien.ac.at
Sun Jul 24 14:21:04 CEST 2022


This was a bug which occurred for more than 100 atoms, when there was no 
space between   ATOM:-100.  It is fixed here.

.lcore is now only copied if it exists.

I also changed the settings of RMT and use  setrmt instead. No counting 
of atoms anymore ....

Regards
Peter

Am 24.07.2022 um 09:16 schrieb Fecher, Gerhard:
> Dear Peter or Pavel,
> If running init_phonon for n cases using for init option "2", run init_lapw (batch mode) for every second case for positive and negative displacement,
> then the last structure (n)  is wrong and has the same displacement as the last but one (n-1).
> When running init_lapw for all cases the structures for n-1 and n are different, as they are supposed to be.
> 
> It's strange that it always happens only for the last case, however, I did not analyse the script in detail.
> Wien2k Version 21.1, I do not remember whether it was always like that, as I didn't calculate phonons for some years.
> 
> Example for 6 cases, the structures case_5.struc and case_6.struc are the same, _1 and _2, _3 and _4, are ok, that is these 2 pairs have opposite displacements
> Example for 8 cases, the structures case_7.struc and case_8.struc are the same, _1 and _2, _3 and _4, _5 and _6 are ok, that is these 3 pairs have opposite displacements
> 
> For test I attached a case.d45 file for the latter case.
> 
> Another small thing:
> the command in lines 157 and 176
>      cp .lcore
> forces an error message because .lcore does not exist anymore, maybe it is a left over from an old version.
> 
> Ciao
> Gerhard
> 
> DEEP THOUGHT in D. Adams; Hitchhikers Guide to the Galaxy:
> "I think the problem, to be quite honest with you,
> is that you have never actually known what the question is."
> 
> ====================================
> Dr. Gerhard H. Fecher
> Institut of Physics
> Johannes Gutenberg - University
> 55099 Mainz
> ________________________________________
> 
> 
> _______________________________________________
> 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
#
# init_phonon phonon-file
#
#
set file    = `pwd`
set file    = $file:t		#tail of file-names

#if($#argv != 1) then
#echo ' '
#echo Usage:   init_phonon   Phonon-file.d45
#exit 1
#endif

#if (! -e $1 ) then
if (! -e $file.d45 ) then
echo $file.d45 is required but does not exist 
exit 1
endif

phonon2wien2k_sym <<EOF
$file.d45
EOF

set c=(`grep 'Number of Atomic Displacements' $file.d45 `) 
set cases=$c[1]

set nat=`head -2 case_1.struct |tail -1 |cut -c28-30` 
set j=1
set rmt2
while ($j <= $nat)
set rmt2=($rmt2 2.0)
@ j ++
end 

cp case_1.struct $file.struct
echo nn is executed next and you must then select proper RMT. 
echo "(Ignore at the moment any error messages about equivalent atoms)."
x nn
$EDITOR $file.outputnn

goto new_setrmt
# use setrmt instead of manual selection
echo select RMT radii for atoms with RMT different from 2.0: 
set a
loop:
echo 'Enter: RMT and ONE atom-number range (e.g. 2.25 1-6, exit with ENTER-key only) ' 
set a=($<)
if ($#a == 0) goto endloop
#if ($#a != 2) goto loop 
if ($#a < 2) goto loop 
#if ($a[1] < 1) goto loop
#if ($a[1] > $nat) goto loop
#set rmt2[$a[1]]=$a[2]
# expand  input like atoms 1-4, must be at position 2
set j=2
  set test1=`echo $a[$j] | cut -d- -f 1`
  if( $test1 == $a[$j] ) goto l1
  set test2=`echo $a[$j] | cut -d- -f 2`
#@ nat1 = $test2 - $test1 
#@ nat1 ++

set a=$a[1]
while ($test1 <= $test2 )
set a=($a $test1 )
@ test1 ++
end
#echo $a

l1:
set nat1=$#a
set j=2
while ($j <= $nat1 )
  if ($a[$j] < 1) then
  echo Neglecting atom $a[$j] which does not exist.
  goto loop1
  endif
  if ($a[$j] > $nat) then
  echo Neglecting atom $a[$j] which does not exist.
  goto loop1
  endif
set rmt2[$a[$j]]=$a[1]
loop1:
@ j ++
end 
goto loop
endloop:
echo You selected the following RMT: $rmt2. 'OK (Y/n)'
set a=($<)
if ($a == n) goto loop

set j=1
set rmt
while ($j <= $nat)
set rmt=($rmt `echo $rmt2[$j]00000 |cut -c1-6`)
@ j ++
end 

new_setrmt:
set i=0
set structfiles_ind

echo "We use setrmt to set sphere sizes. You can specify a global reduction or specific RMTs using:"
echo "  -r XX       or   -a XX:R1,YY:R2,... "
echo "Please enter your setrmt options as in the examples above:"
set opt=($<)
if($#opt == 0) goto new_setrmt

top:
if(! -d case_$i ) then
  mkdir case_$i
endif
set structfiles_ind=($structfiles_ind $i)
#old way of setting rmt
#set j=1
#set k=7
#while ($j <= $nat)
# sed "${k}s/RMT=    2.0000/RMT=    $rmt[$j]/" case_$i.struct > new.struct
# mv new.struct case_$i.struct
# @ j ++
# @ k += 6
#end

setrmt case_$i $opt
cp case_$i.struct_setrmt case_$i.struct
cp case_$i.struct case_$i
cd case_$i
cd ..
@ i ++
if($i <= $cases) goto top

echo RMTs set in all   case_i.struct    files and  case_i directories generated


#instgen_lapw

echo "Do you want to run   init_lapw (Y/n .. if already done before)"
echo "(Take equiv.atoms from nn into account, but ignore changes suggested by sgroup)" 
set a=($<)
if ($a != 'n' ) then
  init_lapw -h
  echo "Do you want to run   init_lapw in batchmode (Y/n)"
  set a1=($<)
  set init_opt
  if ('n' != $a1 ) then
    echo " Enter batch options like:  -b -numk 1 -rkmax 7 ... other-batch-options)"
    set a1=($<)
    set init_opt=($a1)
  endif
  set i=1
  set a=y
  while ($i <= $cases)
    cd case_$i
    if ($a == 'y' ) then
##      instgen_lapw
      init_lapw $init_opt
      cp $WIENROOT/SRC_templates/.machines .
#      $EDITOR .machines
    else if ($a == '2' ) then
@ i1 = $i / 2 
@ i1 = $i1 * 2
      if($i1 != $i ) then
##        instgen_lapw
        init_lapw $init_opt
        cp $WIENROOT/SRC_templates/.machines .
#        $EDITOR .machines
      else
@ i1 --
        echo copying case_$i1 to case_$i
        if(-e ../.core) cp ../.lcore .
        cp ../case_$i1/*.in* .
        cp ../case_$i1/case_$i1.clm* .
        cp ../case_$i1/case_$i1.klist .
        cp ../case_$i1/case_$i1.kgen .
        cp ../case_$i1/.machines .
        rename_files_lapw case_$i1. case_$i.
        cp ../case_$i1/case_$i1.struct .
        set x1=`diff -e ../case_$i.struct ../case_$i1.struct`
        set x1n=$#x1
	set xstart=4
	if($x1n == 6) set xstart=3
@ x1n --
        set x1=($x1[$xstart-$x1n])
        set x2=`diff -e ../case_$i1.struct ../case_$i.struct`
        set x2n=$#x2
@ x2n --
        set x2=($x2[$xstart-$x2n])
        sed "1,$ s/$x1/$x2/" case_$i1.struct >case_$i.struct
      endif
    else
      if(-e ../.core) cp ../.lcore .
      cp ../case_1/*.in* .
      cp ../case_1/case_1.clm* .
      cp ../case_1/case_1.klist .
      cp ../case_1/case_1.kgen .
      cp ../case_1/.machines .
      rename_files_lapw case_1. case_$i.
      sed "/NUMBER/s/0/1/" case_$i.struct >new.struct
      mv new.struct case_$i.struct
    endif
cd ..
 @ i ++

if( $i == 2 ) then
 echo " "
 echo "Do you want to run   init_lapw   for all cases (Y/n) or every 2nd case (2) ?"
 echo "No, if you have only the identity-symmetry in all cases, than the setup  copies and renames the files from case_1)"
 echo "2, if you have pos. and neg. displacements. (setup copies and renames the files from positive displacements)"
 set a=($<)
 if ($a != 'n' ) then
  if ($a != '2' ) then
   set a=y
  endif
 endif
endif

end 

else

 set i=1
 while ($i <= $cases)
  cd case_$i
  sed "/NUMBER/s/0/1/" case_$i.struct >new.struct
  mv new.struct case_$i.struct
  cd ..
  @ i ++
 end
endif

set klist=k
set rkmax=rkm
set pot=lda
if (-e case_1/case_1.klist) then
   set k=(`head -1 case_1/case_1.klist`)
   set klist=${k[9]}k
endif
if (-e case_1/case_1.in1c) then
   set k=(`head -2 case_1/case_1.in1c |tail -1`)
   set rkmax=rkm$k[1]
endif
if (-e case_1/case_1.in0) then
   set k=(`head -1 case_1/case_1.in0`)
   if($k[2] == 13 ) then
     set pot=gga
   endif
   if($k[2] == 11 ) then
     set pot=wc
   endif
endif

echo '#\!/bin/tcsh -f ' > run_phonon
echo '#' >> run_phonon
echo set file=$file >> run_phonon
echo '#' >> run_phonon
echo 'foreach i ( \' >> run_phonon
set i=2
while ($i <= $#structfiles_ind)  
echo "       $structfiles_ind[$i] " ' \' >> run_phonon
@ i ++
end
echo "  )" >> run_phonon
echo ' cd case_$i ' >> run_phonon
echo ' echo running case_$i ' >> run_phonon
echo '# ' >> run_phonon
echo '# select other options if necessary ' >> run_phonon
echo '  run_lapw -I -i 40 -p -fc 0.1' >> run_phonon
echo '# ' >> run_phonon
echo '# select other save-name if necessary ' >> run_phonon
echo '  save_lapw case_${i}'"_${pot}_${rkmax}_${klist} " >> run_phonon
echo '  cd ..' >> run_phonon
echo end >> run_phonon

chmod +x run_phonon

echo "Edit run_phonon (set options in run_lapw, ....)"
 
$EDITOR run_phonon
echo ' '
echo Execute    ./run_phonon         and when the job has finished create 
echo "case.dat (Phonon-HF-force file) with     analyse_phonon_lapw $file.d45 "

exit 0



More information about the Wien mailing list