43real(8) scu,scu1,scu2,scu3
45real(8) axang(4),rot(3,3)
46real(8) rndavec,v(3),t1
47character(256) block,symb,str
169do k=1,3;
do j=1,3;
do i=1,3
172end do;
end do;
end do
202if (
allocated(vqlwrt))
deallocate(vqlwrt)
203allocate(vqlwrt(3,nphwrt))
254wsfac(1)=-1.1d6; wsfac(2)=1.1d6
353thetamld=45.d0*pi/180.d0
412open(50,file=
'elk.in',status=
'OLD',form=
'FORMATTED',iostat=ios)
415 write(*,
'("Error(readinput): error opening elk.in")')
420read(50,*,
end=30) block
422if ((block(1:1) ==
'!').or.(block(1:1) ==
'#'))
goto 10
423select case(trim(block))
426 read(50,
'(A)',err=20) str
427 if (trim(str) ==
'')
then
430 write(*,
'("Error(readinput): no tasks to perform")')
437 read(str,*,iostat=ios) tasks(i)
440 write(*,
'("Error(readinput): error reading tasks")')
441 write(*,
'("(blank line required after tasks block)")')
447 write(*,
'("Error(readinput): too many tasks")')
448 write(*,
'("Adjust maxtasks in modmain and recompile code")')
457 read(50,
'(A)',err=20) str
458 if (trim(str) ==
'')
goto 10
459 read(str,*,iostat=ios) zn,symb
462 write(*,
'("Error(readinput): error reading fractional species")')
463 write(*,
'("(blank line required after fspecies block)")')
469 write(*,
'("Error(readinput): fractional nuclear Z > 0 : ",G18.10)') zn
476 write(*,
'("Error(readinput): too many fractional nucleus species")')
481 read(50,
'(A)',err=20) str
482 read(str,*,err=20) avec(:,i)
483 read(str,*,iostat=ios) avec(:,i),davec(:,i)
488 read(50,*,err=20) sc1
490 read(50,*,err=20) sc2
492 read(50,*,err=20) sc3
494 read(50,*,err=20) scx
496 read(50,*,err=20) scy
498 read(50,*,err=20) scz
500 read(50,*,err=20) epslat
501 if (epslat <= 0.d0)
then
503 write(*,
'("Error(readinput): epslat <= 0 : ",G18.10)') epslat
508 read(50,*,err=20) primcell
510 read(50,*,err=20) tshift
512 read(50,*,err=20) autokpt
514 read(50,*,err=20) radkpt
515 if (radkpt <= 0.d0)
then
517 write(*,
'("Error(readinput): radkpt <= 0 : ",G18.10)') radkpt
522 read(50,
'(A)',err=20) str
523 read(str,*,err=20) ngridk(:)
524 read(str,*,iostat=ios) ngridk(:),dngridk(:)
525 if (any(ngridk(:) < 1))
then
527 write(*,
'("Error(readinput): invalid ngridk : ",3I8)') ngridk
533 read(50,*,err=20) vkloff(:)
534 if (any(vkloff(:) < 0.d0).or.any(vkloff(:) >= 1.d0))
then
536 write(*,
'("Error(readinput): vkloff components should be in [0,1) : ",&
542 read(50,*,err=20) reducek
544 read(50,*,err=20) ngridq(:)
545 if (any(ngridq(:) < 1))
then
547 write(*,
'("Error(readinput): invalid ngridq : ",3I8)') ngridq
552 read(50,*,err=20) reduceq
554 read(50,
'(A)',err=20) str
555 read(str,*,err=20) rgkmax
556 read(str,*,iostat=ios) rgkmax,drgkmax
557 if (rgkmax <= 0.d0)
then
559 write(*,
'("Error(readinput): rgkmax <= 0 : ",G18.10)') rgkmax
564 read(50,
'(A)',err=20) str
565 read(str,*,err=20) gmaxvr
566 read(str,*,iostat=ios) gmaxvr,dgmaxvr
568 read(50,
'(A)',err=20) str
569 read(str,*,err=20) lmaxapw
570 read(str,*,iostat=ios) lmaxapw,dlmaxapw
571 if (lmaxapw < 0)
then
573 write(*,
'("Error(readinput): lmaxapw < 0 : ",I8)') lmaxapw
577 if (lmaxapw >= maxlapw)
then
579 write(*,
'("Error(readinput): lmaxapw too large : ",I8)') lmaxapw
580 write(*,
'("Adjust maxlapw in modmain and recompile code")')
584case(
'lmaxo',
'lmaxvr')
585 read(50,
'(A)',err=20) str
586 read(str,*,err=20) lmaxo
587 read(str,*,iostat=ios) lmaxo,dlmaxo
590 write(*,
'("Error(readinput): lmaxo < 3 : ",I8)') lmaxo
594case(
'lmaxi',
'lmaxinr')
595 read(50,*,err=20) lmaxi
598 write(*,
'("Error(readinput): lmaxi < 1 : ",I8)') lmaxi
604 write(*,
'("Info(readinput): variable ''lmaxmat'' is no longer used")')
606 read(50,*,err=20) fracinr
608 read(50,*,err=20) trhonorm
610 read(50,*,err=20) spinpol
612 read(50,*,err=20) spinorb
614 read(50,*,err=20) socscf
615 if (socscf < 0.d0)
then
617 write(*,
'("Error(readinput): socscf < 0 : ",G18.10)') socscf
622 read(50,*,err=20) bforb
624 read(50,*,err=20) bfdmag
626 read(50,
'(A)',err=20) str
627 str=trim(str)//
' 0 0'
628 read(str,*,err=20) xctype(:)
630 read(50,
'(A)',err=20) str
631 str=trim(str)//
' 0 0'
632 read(str,*,err=20) xctsp(:)
634 read(50,
'(A)',err=20) str
635 str=trim(str)//
' 0 0'
636 read(str,*,err=20) ktype(:)
637 if (ktype(3) /= 0)
then
639 write(*,
'("Error(readinput): ktype(3) should be zero : ",I8)') ktype(3)
644 read(50,*,err=20) stype
646 read(50,*,err=20) swidth
647 if (swidth < 1.d-9)
then
649 write(*,
'("Error(readinput): swidth too small or negative : ",G18.10)') &
655 read(50,*,err=20) autoswidth
657 read(50,*,err=20) mstar
658 if (mstar <= 0.d0)
then
660 write(*,
'("Error(readinput): mstar <= 0 : ",G18.10)') mstar
665 read(50,*,err=20) epsocc
666 if (epsocc <= 0.d0)
then
668 write(*,
'("Error(readinput): epsocc <= 0 : ",G18.10)') epsocc
673 read(50,*,err=20) epschg
674 if (epschg <= 0.d0)
then
676 write(*,
'("Error(readinput): epschg <= 0 : ",G18.10)') epschg
680case(
'nempty',
'nempty0')
681 read(50,
'(A)',err=20) str
682 read(str,*,err=20) nempty0
683 read(str,*,iostat=ios) nempty0,dnempty0
684 if (nempty0 <= 0.d0)
then
686 write(*,
'("Error(readinput): nempty <= 0 : ",G18.10)') nempty0
691 read(50,*,err=20) mixtype
693 read(50,*,err=20) mixsave
694case(
'amixpm',
'beta0',
'betamax')
695 if (trim(block) ==
'amixpm')
then
696 read(50,*,err=20) amixpm(:)
697 else if (trim(block) ==
'beta0')
then
698 read(50,*,err=20) amixpm(1)
700 read(50,*,err=20) amixpm(2)
702 if (amixpm(1) < 0.d0)
then
704 write(*,
'("Error(readinput): beta0 [amixpm(1)] < 0 : ",G18.10)') amixpm(1)
708 if ((amixpm(2) < 0.d0).or.(amixpm(2) > 1.d0))
then
710 write(*,
'("Error(readinput): betamax [amixpm(2)] not in [0,1] : ",G18.10)')&
716 read(50,*,err=20) mixsdb
719 write(*,
'("Error(readinput): mixsdb < 2 : ",I8)') mixsdb
724 read(50,*,err=20) broydpm(:)
725 if ((broydpm(1) < 0.d0).or.(broydpm(1) > 1.d0).or. &
726 (broydpm(2) < 0.d0).or.(broydpm(2) > 1.d0))
then
728 write(*,
'("Error(readinput): invalid Broyden mixing parameters : ",&
734 read(50,*,err=20) mixrho
736 read(50,*,err=20) maxscl
739 write(*,
'("Error(readinput): maxscl < 0 : ",I8)') maxscl
744 read(50,*,err=20) epspot
746 read(50,*,err=20) epsengy
748 read(50,*,err=20) epsforce
750 read(50,*,err=20) epsstress
752 read(50,*,err=20) sppath
753 sppath=adjustl(sppath)
755 read(50,*,err=20) scrpath
757 read(50,*,err=20) molecule
759 read(50,*,err=20) nspecies
760 if (nspecies < 1)
then
762 write(*,
'("Error(readinput): nspecies < 1 : ",I8)') nspecies
766 if (nspecies > maxspecies)
then
768 write(*,
'("Error(readinput): nspecies too large : ",I8)') nspecies
769 write(*,
'("Adjust maxspecies in modmain and recompile code")')
774 read(50,*,err=20) spfname(is)
775 spfname(is)=adjustl(spfname(is))
776 read(50,*,err=20) natoms(is)
777 if (natoms(is) < 1)
then
779 write(*,
'("Error(readinput): natoms < 1 : ",I8)') natoms(is)
780 write(*,
'(" for species ",I4)') is
784 if (natoms(is) > maxatoms)
then
786 write(*,
'("Error(readinput): natoms too large : ",I8)') natoms(is)
787 write(*,
'(" for species ",I4)') is
788 write(*,
'("Adjust maxatoms in modmain and recompile code")')
793 read(50,
'(A)',err=20) str
794 read(str,*,err=20) atposl(:,ia,is)
795 read(str,*,iostat=ios) atposl(:,ia,is),bfcmt0(:,ia,is),datposl(:,ia,is)
799 read(50,*,err=20) nvp1d,npp1d
802 write(*,
'("Error(readinput): nvp1d < 1 : ",I8)') nvp1d
806 if (npp1d < nvp1d)
then
808 write(*,
'("Error(readinput): npp1d < nvp1d : ",2I8)') npp1d,nvp1d
812 if (
allocated(vvlp1d))
deallocate(vvlp1d)
813 allocate(vvlp1d(3,nvp1d))
815 read(50,*,err=20) vvlp1d(:,i)
818 read(50,*,err=20) ip01d
821 write(*,
'("Error(readinput): ip01d < 1 : ",I8)') ip01d
826 read(50,*,err=20) vclp2d(:,0)
827 read(50,*,err=20) vclp2d(:,1)
828 read(50,*,err=20) vclp2d(:,2)
829 read(50,*,err=20) np2d(:)
830 if ((np2d(1) < 1).or.(np2d(2) < 1))
then
832 write(*,
'("Error(readinput): np2d < 1 : ",2I8)') np2d
837 read(50,*,err=20) vclp3d(:,0)
838 read(50,*,err=20) vclp3d(:,1)
839 read(50,*,err=20) vclp3d(:,2)
840 read(50,*,err=20) vclp3d(:,3)
841 read(50,*,err=20) np3d(:)
842 if ((np3d(1) < 1).or.(np3d(2) < 1).or.(np3d(3) < 1))
then
844 write(*,
'("Error(readinput): np3d < 1 : ",3I8)') np3d
849 read(50,*,err=20) nwplot,ngrkf,nswplot
852 write(*,
'("Error(readinput): nwplot < 2 : ",I8)') nwplot
858 write(*,
'("Error(readinput): ngrkf < 1 : ",I8)') ngrkf
862 if (nswplot < 0)
then
864 write(*,
'("Error(readinput): nswplot < 0 : ",I8)') nswplot
868 read(50,*,err=20) wplot(:)
869 if (wplot(1) > wplot(2))
then
871 write(*,
'("Error(readinput): wplot(1) > wplot(2) : ",2G18.10)') wplot
876 read(50,*,err=20) dosocc
878 read(50,*,err=20) tpdos
880 read(50,*,err=20) dosmsum
882 read(50,*,err=20) dosssum
884 read(50,*,err=20) lmirep
886 read(50,*,err=20) atpopt
887case(
'maxatpstp',
'maxatmstp')
888 read(50,*,err=20) maxatpstp
889 if (maxatpstp < 1)
then
891 write(*,
'("Error(readinput): maxatpstp < 1 : ",I8)') maxatpstp
895case(
'tau0atp',
'tau0atm')
896 read(50,*,err=20) tau0atp
898 read(50,*,err=20) deltast
899 if (deltast <= 0.d0)
then
901 write(*,
'("Error(readinput): deltast <= 0 : ",G18.10)') deltast
906 read(50,*,err=20) avecref(:,1)
907 read(50,*,err=20) avecref(:,2)
908 read(50,*,err=20) avecref(:,3)
910 read(50,*,err=20) latvopt
912 read(50,*,err=20) maxlatvstp
913 if (maxlatvstp < 1)
then
915 write(*,
'("Error(readinput): maxlatvstp < 1 : ",I8)') maxlatvstp
920 read(50,*,err=20) tau0latv
923 write(*,
'("Info(readinput): variable ''nstfsp'' is no longer used")')
925 read(50,*,err=20) lradstp
926 if (lradstp < 1)
then
928 write(*,
'("Error(readinput): lradstp < 1 : ",I8)') lradstp
933 read(50,
'(A)',err=20) str
934 read(str,*,err=20) chgexs
935 read(str,*,iostat=ios) chgexs,dchgexs
938 write(*,
'("Info(readinput): variable ''nprad'' is no longer used")')
940 read(50,*,err=20) scissor
942 read(50,*,err=20) noptcomp
943 if ((noptcomp < 1).or.(noptcomp > 27))
then
945 write(*,
'("Error(readinput): noptcomp should be from 1 to 27 : ",I8)') &
952 read(50,
'(A)',err=20) str
953 if (trim(str) ==
'')
then
956 write(*,
'("Error(readinput): empty optical component list")')
963 str=trim(str)//
' 1 1'
964 read(str,*,iostat=ios) optcomp(:,i)
967 write(*,
'("Error(readinput): error reading optical component list")')
968 write(*,
'("(blank line required after optcomp block)")')
972 if (any(optcomp(:,i) < 1).or.any(optcomp(:,i) > 3))
then
974 write(*,
'("Error(readinput): invalid optcomp : ",3I8)') optcomp(:,i)
980 write(*,
'("Error(readinput): optical component list too long")')
984 read(50,*,err=20) intraband
986 read(50,*,err=20) evaltol
989 write(*,
'("Info(readinput): variable ''deband'' is no longer used")')
991 read(50,*,err=20) epsband
992 if (epsband <= 0.d0)
then
994 write(*,
'("Error(readinput): epsband <= 0 : ",G18.10)') epsband
999 read(50,*,err=20) demaxbnd
1000 if (demaxbnd <= 0.d0)
then
1002 write(*,
'("Error(readinput): demaxbnd <= 0 : ",G18.10)') demaxbnd
1007 read(50,*,err=20) autolinengy
1009 read(50,*,err=20) deapw
1010 if (abs(deapw) < 1.d-8)
then
1012 write(*,
'("Error(readinput): invalid deapw : ",G18.10)') deapw
1017 read(50,*,err=20) delorb
1018 if (abs(delorb) < 1.d-8)
then
1020 write(*,
'("Error(readinput): invalid delorb : ",G18.10)') delorb
1025 read(50,*,err=20) dlefe
1027 read(50,
'(A)',err=20) str
1028 read(str,*,err=20) bfieldc0(:)
1029 read(str,*,iostat=ios) bfieldc0(:),dbfieldc0(:)
1031 read(50,*,err=20) efieldc(:)
1033 read(50,*,err=20) dmaxefc
1034 if (dmaxefc < 0)
then
1036 write(*,
'("Error(readinput): dmaxefc < 0 : ",G18.10)') dmaxefc
1041 read(50,
'(A)',err=20) str
1042 read(str,*,err=20) afieldc(:)
1043 read(str,*,iostat=ios) afieldc(:),dafieldc(:)
1046 read(50,
'(A)',err=20) str
1047 read(str,*,err=20) afspc(i,:)
1048 read(str,*,iostat=ios) afspc(i,:),dafspc(i,:)
1050case(
'fsmtype',
'fixspin')
1051 read(50,*,err=20) fsmtype
1053 read(50,
'(A)',err=20) str
1054 read(str,*,err=20) momfix(:)
1055 read(str,*,iostat=ios) momfix(:),dmomfix(:)
1057 read(50,*,err=20) momfixm
1058 if (momfixm < 0.d0)
then
1060 write(*,
'("Error(readinput): momfixm < 0 : ",G18.10)') momfixm
1065 do ias=1,maxspecies*maxatoms
1066 read(50,
'(A)',err=20) str
1067 if (trim(str) ==
'')
goto 10
1068 read(str,*,iostat=ios) is,ia,mommtfix(:,ia,is)
1071 write(*,
'("Error(readinput): error reading muffin-tin fixed spin &
1073 write(*,
'("(blank line required after mommtfix block)")')
1079 do ias=1,maxspecies*maxatoms
1080 read(50,
'(A)',err=20) str
1081 if (trim(str) ==
'')
goto 10
1082 read(str,*,iostat=ios) is,ia,mommtfixm(ia,is)
1085 write(*,
'("Error(readinput): error reading muffin-tin fixed spin &
1086 &moment magnitudes")')
1087 write(*,
'("(blank line required after mommtfixm block)")')
1093 read(50,*,err=20) taufsm
1094 if (taufsm < 0.d0)
then
1096 write(*,
'("Error(readinput): taufsm < 0 : ",G18.10)') taufsm
1102 write(*,
'("Info(readinput): variable ''autormt'' is no longer used")')
1104 read(50,*,err=20) rmtdelta
1105 if (rmtdelta < 0.d0)
then
1107 write(*,
'("Warning(readinput): rmtdelta < 0 : ",G18.10)') rmtdelta
1110 read(50,*,err=20) isgkmax
1112 read(50,*,err=20) lv
1115 read(50,*,err=20) symtype
1116 if ((symtype < 0).or.(symtype > 2))
then
1118 write(*,
'("Error(readinput): symtype not defined : ",I8)') symtype
1123 read(50,*,err=20) deltaph
1124 if (deltaph <= 0.d0)
then
1126 write(*,
'("Error(readinput): deltaph <= 0 : ",G18.10)') deltaph
1131 read(50,*,err=20) nphwrt
1132 if (nphwrt < 1)
then
1134 write(*,
'("Error(readinput): nphwrt < 1 : ",I8)') nphwrt
1138 if (
allocated(vqlwrt))
deallocate(vqlwrt)
1139 allocate(vqlwrt(3,nphwrt))
1141 read(50,*,err=20) vqlwrt(:,i)
1144 if (
allocated(notes))
deallocate(notes)
1149 if (trim(str) ==
'')
goto 10
1150 notes=[notes(1:notelns),str]
1154 read(50,*,err=20) tforce
1157 write(*,
'("Info(readinput): variable ''tfibs'' is no longer used")')
1159 read(50,*,err=20) maxitoep
1160 if (maxitoep < 1)
then
1162 write(*,
'("Error(readinput): maxitoep < 1 : ",I8)') maxitoep
1168 write(*,
'("Info(readinput): variable ''tauoep'' is no longer used")')
1170 read(50,*,err=20) tau0oep
1171 if (tau0oep < 0.d0)
then
1173 write(*,
'("Error(readinput): tau0oep < 0 : ",G18.10)') tau0oep
1179 read(50,
'(A)',err=20) str
1180 if (trim(str) ==
'')
then
1183 write(*,
'("Error(readinput): empty k-point and state list")')
1191 read(str,*,iostat=ios) kstlist(:,i)
1194 write(*,
'("Error(readinput): error reading k-point and state list")')
1195 write(*,
'("(blank line required after kstlist block)")')
1201 write(*,
'("Error(readinput): k-point and state list too long")')
1205 read(50,*,err=20) vklem
1207 read(50,*,err=20) deltaem
1208 if (deltaem <= 0.d0)
then
1210 write(*,
'("Error(readinput): deltaem <= 0 : ",G18.10)') deltaem
1215 read(50,*,err=20) ndspem
1216 if ((ndspem < 1).or.(ndspem > 4))
then
1218 write(*,
'("Error(readinput): ndspem out of range : ",I8)') ndspem
1223 read(50,*,err=20) nosource
1225 read(50,*,err=20) spinsprl
1227 read(50,*,err=20) ssdph
1229 read(50,
'(A)',err=20) str
1230 read(str,*,err=20) vqlss
1231 read(str,*,iostat=ios) vqlss,dvqlss
1233 read(50,*,err=20) nwrite
1234case(
'DFT+U',
'dft+u',
'lda+u')
1235 read(50,*,err=20) dftu,inpdftu
1237 read(50,
'(A)',err=20) str
1238 if (trim(str) ==
'')
then
1242 select case(inpdftu)
1244 read(str,*,iostat=ios) is,l,ujdu(1:2,i)
1246 read(str,*,iostat=ios) is,l,(fdu(k,i),k=0,2*l,2)
1248 read(str,*,iostat=ios) is,l,(edu(k,i),k=0,l)
1250 read(str,*,iostat=ios) is,l,lamdu(i)
1252 read(str,*,iostat=ios) is,l,udufix(i),dudufix(i)
1253 read(str,*,iostat=ios) is,l,udufix(i)
1256 write(*,
'("Error(readinput): invalid inpdftu : ",I8)') inpdftu
1262 write(*,
'("Error(readinput): error reading DFT+U parameters")')
1263 write(*,
'("(blank line required after dft+u block)")')
1267 if ((is < 1).or.(is >= maxspecies))
then
1269 write(*,
'("Error(readinput): invalid species number in dft+u block : ", &
1276 write(*,
'("Error(readinput): l < 0 in dft+u block : ",I8)') l
1280 if (l > lmaxdm)
then
1282 write(*,
'("Error(readinput): l > lmaxdm in dft+u block : ",2I8)') l,lmaxdm
1288 if ((is == isldu(1,j)).and.(l == isldu(2,j)))
then
1290 write(*,
'("Error(readinput): repeated entry in DFT+U block")')
1299 write(*,
'("Error(readinput): too many DFT+U entries")')
1300 write(*,
'("Adjust maxdftu in modmain and recompile code")')
1303case(
'tmwrite',
'tmomlu')
1304 read(50,*,err=20) tmwrite
1305case(
'readadu',
'readalu')
1307 write(*,
'("Info(readinput): variable ''readadu'' is no longer used")')
1309 read(50,*,err=20) rdmxctype
1311 read(50,*,err=20) rdmmaxscl
1312 if (rdmmaxscl < 0)
then
1314 write(*,
'("Error(readinput): rdmmaxscl < 0 : ",I8)') rdmmaxscl
1318 read(50,*,err=20) maxitn
1320 read(50,*,err=20) maxitc
1322 read(50,*,err=20) taurdmn
1323 if (taurdmn < 0.d0)
then
1325 write(*,
'("Error(readinput): taurdmn < 0 : ",G18.10)') taurdmn
1330 read(50,*,err=20) taurdmc
1331 if (taurdmc < 0.d0)
then
1333 write(*,
'("Error(readinput): taurdmc < 0 : ",G18.10)') taurdmc
1338 read(50,*,err=20) rdmalpha
1339 if ((rdmalpha <= 0.d0).or.(rdmalpha >= 1.d0))
then
1341 write(*,
'("Error(readinput): rdmalpha not in (0,1) : ",G18.10)') rdmalpha
1346 read(50,*,err=20) rdmtemp
1347 if (rdmtemp < 0.d0)
then
1349 write(*,
'("Error(readinput): rdmtemp < 0 : ",G18.10)') rdmtemp
1354 read(50,*,err=20) reducebf
1355 if ((reducebf < 0.49d0).or.(reducebf > 1.d0))
then
1357 write(*,
'("Error(readinput): reducebf not in [0.5,1] : ",G18.10)') reducebf
1362 read(50,*,err=20) ptnucl
1363case(
'tefvr',
'tseqr')
1364 read(50,*,err=20) tefvr
1365case(
'tefvit',
'tseqit')
1366 read(50,*,err=20) tefvit
1367case(
'minitefv',
'minseqit')
1368 read(50,*,err=20) minitefv
1369 if (minitefv < 1)
then
1371 write(*,
'("Error(readinput): minitefv < 1 : ",I8)') minitefv
1375case(
'maxitefv',
'maxseqit')
1376 read(50,*,err=20) maxitefv
1377 if (maxitefv < 1)
then
1379 write(*,
'("Error(readinput): maxitefv < 1 : ",I8)') maxitefv
1383case(
'befvit',
'bseqit')
1384 read(50,*,err=20) befvit
1385 if (befvit <= 0.d0)
then
1387 write(*,
'("Error(readinput): befvit <= 0 : ",G18.10)') befvit
1391case(
'epsefvit',
'epsseqit')
1392 read(50,*,err=20) epsefvit
1393 if (epsefvit < 0.d0)
then
1395 write(*,
'("Error(readinput): epsefvit < 0 : ",G18.10)') epsefvit
1401 write(*,
'("Info(readinput): variable ''nseqit'' is no longer used")')
1404 write(*,
'("Info(readinput): variable ''tauseq'' is no longer used")')
1406 read(50,*,err=20) vecql(:)
1408 read(50,*,err=20) mustar
1410 read(50,*,err=20) sqados(:)
1412 read(50,*,err=20) test
1415 write(*,
'("Info(readinput): variable ''frozencr'' is no longer used")')
1417 read(50,*,err=20) spincore
1419 read(50,*,err=20) solscf
1420 if (solscf < 0.d0)
then
1422 write(*,
'("Error(readinput): solscf < 0 : ",G18.10)') solscf
1427 read(50,*,err=20) emaxelnes
1429 read(50,*,err=20) wsfac(:)
1431 read(50,*,err=20) vhmat(1,:)
1432 read(50,*,err=20) vhmat(2,:)
1433 read(50,*,err=20) vhmat(3,:)
1435 read(50,*,err=20) reduceh
1437 read(50,*,err=20) hybrid0
1438case(
'hybridc',
'hybmix')
1439 read(50,*,err=20) hybridc
1440 if ((hybridc < 0.d0).or.(hybridc > 1.d0))
then
1442 write(*,
'("Error(readinput): invalid hybridc : ",G18.10)') hybridc
1447 read(50,*,err=20) ecvcut
1449 read(50,*,err=20) esccut
1451 read(50,*,err=20) nvbse0
1452 if (nvbse0 < 0)
then
1454 write(*,
'("Error(readinput): nvbse < 0 : ",I8)') nvbse0
1459 read(50,*,err=20) ncbse0
1460 if (ncbse0 < 0)
then
1462 write(*,
'("Error(readinput): ncbse < 0 : ",I8)') ncbse0
1468 read(50,
'(A)',err=20) str
1469 if (trim(str) ==
'')
then
1472 write(*,
'("Error(readinput): empty BSE extra valence state list")')
1479 read(str,*,iostat=ios) istxbse(i)
1482 write(*,
'("Error(readinput): error reading BSE valence state list")')
1483 write(*,
'("(blank line required after istxbse block)")')
1489 write(*,
'("Error(readinput): BSE extra valence state list too long")')
1494 read(50,
'(A)',err=20) str
1495 if (trim(str) ==
'')
then
1498 write(*,
'("Error(readinput): empty BSE extra conduction state list")')
1505 read(str,*,iostat=ios) jstxbse(i)
1508 write(*,
'("Error(readinput): error reading BSE conduction state list")')
1509 write(*,
'("(blank line required after jstxbse block)")')
1515 write(*,
'("Error(readinput): BSE extra conduction state list too long")')
1519 read(50,*,err=20) bsefull
1521 read(50,*,err=20) hxbse
1523 read(50,*,err=20) hdbse
1524case(
'gmaxrf',
'gmaxrpa')
1525 read(50,*,err=20) gmaxrf
1526 if (gmaxrf < 0.d0)
then
1528 write(*,
'("Error(readinput): gmaxrf < 0 : ",G18.10)') gmaxrf
1533 read(50,*,err=20) mbwgrf
1535 read(50,*,err=20) emaxrf
1536 if (emaxrf < 0.d0)
then
1538 write(*,
'("Error(readinput): emaxrf < 0 : ",G18.10)') emaxrf
1543 read(50,
'(A)',err=20) str
1544 str=trim(str)//
' 0 0'
1545 read(str,*,err=20) fxctype
1547 read(50,
'(A)',err=20) str
1548 str=trim(str)//
' 0.0'
1549 read(str,*,err=20) fxclrc(:)
1551 read(50,*,err=20) ntemp
1554 write(*,
'("Error(readinput): ntemp < 1 : ",I8)') ntemp
1559 write(*,
'("Info(readinput): variable ''trimvg'' is no longer used")')
1561case(
'rndstate',
'rndseed')
1562 read(50,*,err=20) rndstate(0)
1563 rndstate(0)=abs(rndstate(0))
1565 read(50,*,err=20) rndatposc
1567 read(50,*,err=20) rndbfcmt
1569 read(50,*,err=20) rndavec
1571 read(50,*,err=20) c_tb09
1574case(
'lowq',
'highq',
'vhighq',
'uhighq')
1575 read(50,*,err=20) lv
1577 if (trim(block) ==
'lowq')
then
1595 else if (trim(block) ==
'highq')
then
1597 rgkmax=max(rgkmax,8.d0)
1598 gmaxvr=max(gmaxvr,16.d0)
1599 lmaxapw=max(lmaxapw,9)
1601 nrmtscf=max(nrmtscf,1.5d0)
1604 radkpt=max(radkpt,50.d0)
1607 nempty0=max(nempty0,10.d0)
1608 epspot=min(epspot,1.d-7)
1609 epsengy=min(epsengy,1.d-5)
1610 epsforce=min(epsforce,5.d-4)
1611 epsstress=min(epsstress,1.d-3)
1613 gmaxrf=max(gmaxrf,4.d0)
1614 else if (trim(block) ==
'vhighq')
then
1616 rgkmax=max(rgkmax,9.d0)
1617 gmaxvr=max(gmaxvr,18.d0)
1618 lmaxapw=max(lmaxapw,11)
1620 nrmtscf=max(nrmtscf,2.d0)
1623 radkpt=max(radkpt,90.d0)
1626 nempty0=max(nempty0,20.d0)
1627 epspot=min(epspot,1.d-7)
1628 epsengy=min(epsengy,1.d-6)
1629 epsforce=min(epsforce,2.d-4)
1630 epsstress=min(epsstress,5.d-4)
1632 gmaxrf=max(gmaxrf,5.d0)
1635 rgkmax=max(rgkmax,10.d0)
1636 gmaxvr=max(gmaxvr,20.d0)
1637 lmaxapw=max(lmaxapw,12)
1639 nrmtscf=max(nrmtscf,4.d0)
1642 radkpt=max(radkpt,120.d0)
1645 nempty0=max(nempty0,40.d0)
1646 epspot=min(epspot,1.d-7)
1647 epsengy=min(epsengy,1.d-6)
1648 epsforce=min(epsforce,1.d-4)
1649 epsstress=min(epsstress,2.d-4)
1651 gmaxrf=max(gmaxrf,6.d0)
1655 write(*,
'("Info(readinput): parameters set by ",A," option")') trim(block)
1656 write(*,
'(" rgkmax : ",G18.10)') rgkmax
1657 write(*,
'(" gmaxvr : ",G18.10)') gmaxvr
1658 write(*,
'(" lmaxapw : ",I4)') lmaxapw
1659 write(*,
'(" lmaxo : ",I4)') lmaxo
1660 write(*,
'(" nrmtscf : ",G18.10)') nrmtscf
1661 write(*,
'(" nxlo : ",I4)') nxlo
1662 write(*,
'(" lorbcnd : ",L1)') lorbcnd
1663 write(*,
'(" radkpt : ",G18.10)') radkpt
1664 write(*,
'(" autokpt : ",L1)') autokpt
1665 write(*,
'(" vkloff : ",3G18.10)') vkloff
1666 write(*,
'(" nempty0 : ",G18.10)') nempty0
1667 write(*,
'(" epspot : ",G18.10)') epspot
1668 write(*,
'(" epsengy : ",G18.10)') epsengy
1669 write(*,
'(" epsforce : ",G18.10)') epsforce
1670 write(*,
'(" epsstress : ",G18.10)') epsstress
1671 write(*,
'(" autolinengy : ",L1)') autolinengy
1672 write(*,
'(" gmaxrf : ",G18.10)') gmaxrf
1673 if (trim(block) ==
'lowq')
then
1674 write(*,
'(" lradstp : ",I4)') lradstp
1679 read(50,*,err=20) hmaxvr
1680 if (hmaxvr < 0.d0)
then
1682 write(*,
'("Error(readinput): hmaxvr < 0 : ",G18.10)') hmaxvr
1687 read(50,*,err=20) hkmax
1688 if (hkmax <= 0.d0)
then
1690 write(*,
'("Error(readinput): hkmax <= 0 : ",G18.10)') hkmax
1695 read(50,*,err=20) lorbcnd
1697 read(50,*,err=20) lorbordc
1698 if (lorbordc < 2)
then
1700 write(*,
'("Error(readinput): lorbordc < 2 : ",I8)') lorbordc
1704 if (lorbordc > maxlorbord)
then
1706 write(*,
'("Error(readinput): lorbordc too large : ",I8)') lorbordc
1707 write(*,
'("Adjust maxlorbord in modmain and recompile code")')
1712 read(50,
'(A)',err=20) str
1713 read(str,*,err=20) nrmtscf
1714 read(str,*,iostat=ios) nrmtscf,dnrmtscf
1715 if (nrmtscf < 0.5d0)
then
1717 write(*,
'("Error(readinput): nrmtscf < 0.5 : ",G18.10)') nrmtscf
1722 read(50,*,err=20) lmaxdos
1723 if (lmaxdos < 0)
then
1725 write(*,
'("Error(readinput): lmaxdos < 0 : ",I8)') lmaxdos
1730 read(50,*,err=20) epsdev
1731 if (epsdev <= 0.d0)
then
1733 write(*,
'("Error(readinput): epsdev <= 0 : ",G18.10)') epsdev
1739 write(*,
'("Info(readinput): variable ''msmooth'' is no longer used")')
1741 read(50,*,err=20) npmae0
1743 read(50,*,err=20) wrtvars
1745 read(50,*,err=20) ftmtype
1748 write(*,
'("Error(readinput): variable ''tmomfix'' is no longer used")')
1749 write(*,
'(" use tm3fix instead")')
1753 read(50,*,err=20) ntmfix
1754 if (ntmfix < 1)
then
1756 write(*,
'("Error(readinput): ntmfix < 1 : ",I8)') ntmfix
1760 if (
allocated(itmfix))
deallocate(itmfix)
1761 allocate(itmfix(7,ntmfix))
1762 if (
allocated(wkprfix))
deallocate(wkprfix)
1763 allocate(wkprfix(ntmfix))
1765 read(50,*,err=20) is,ia,l
1766 if ((is < 1).or.(ia < 1).or.(l < 0))
then
1768 write(*,
'("Error(readinput): invalid is, ia or l in tm3fix block : ",&
1777 read(50,*,err=20) itmfix(4:7,i)
1779 read(50,*,err=20) wkprfix(i)
1782 read(50,*,err=20) tauftm
1783 if (tauftm < 0.d0)
then
1785 write(*,
'("Error(readinput): tauftm < 0 : ",G18.10)') tauftm
1791 write(*,
'("Info(readinput): variable ''ftmstep'' is no longer used")')
1792case(
'cmagz',
'forcecmag')
1793 read(50,*,err=20) cmagz
1795 read(50,*,err=20) axang(:)
1797 read(50,*,err=20) tstime
1798 if (tstime <= 0.d0)
then
1800 write(*,
'("Error(readinput): tstime <= 0 : ",G18.10)') tstime
1805 read(50,*,err=20) dtimes
1806 if (dtimes <= 0.d0)
then
1808 write(*,
'("Error(readinput): dtimes <= 0 : ",G18.10)') dtimes
1813 read(50,*,err=20) npulse
1814 if (npulse < 1)
then
1816 write(*,
'("Error(readinput): npulse < 1 : ",I8)') npulse
1820 if (
allocated(pulse))
deallocate(pulse)
1821 allocate(pulse(12,npulse))
1823 read(50,
'(A)',err=20) str
1824 str=trim(str)//
' 1.0 0.0 0.0 0.0'
1825 read(str,*,err=20) pulse(:,i)
1828 read(50,*,err=20) nramp
1831 write(*,
'("Error(readinput): nramp < 1 : ",I8)') nramp
1835 if (
allocated(ramp))
deallocate(ramp)
1836 allocate(ramp(12,nramp))
1838 read(50,
'(A)',err=20) str
1839 str=trim(str)//
' 1.0 0.0 0.0 0.0'
1840 read(str,*,err=20) ramp(:,i)
1843 read(50,*,err=20) nstep
1846 write(*,
'("Error(readinput): nstep < 1 : ",I8)') nstep
1850 if (
allocated(step))
deallocate(step)
1851 allocate(step(9,nstep))
1853 read(50,
'(A)',err=20) str
1854 str=trim(str)//
' 1.0 0.0 0.0 0.0'
1855 read(str,*,err=20) step(:,i)
1859 write(*,
'("Info(readinput): variable ''ncgga'' is no longer used")')
1861 read(50,*,err=20) dncgga
1862 if (dncgga < 0.d0)
then
1864 write(*,
'("Error(readinput): dncgga < 0 : ",G18.10)') dncgga
1869 read(50,
'(A)',err=20) str
1871 read(str,*,err=20) ntswrite(:)
1872case(
'nxoapwlo',
'nxapwlo')
1873 read(50,*,err=20) nxoapwlo
1874 if (nxoapwlo < 0)
then
1876 write(*,
'("Error(readinput): nxoapwlo < 0 : ",I8)') nxoapwlo
1881 read(50,*,err=20) nxlo
1884 write(*,
'("Error(readinput): nxlo < 0 : ",I8)') nxlo
1889 read(50,*,err=20) tdrho1d
1891 read(50,*,err=20) tdrho2d
1893 read(50,*,err=20) tdrho3d
1895 read(50,*,err=20) tdmag1d
1897 read(50,*,err=20) tdmag2d
1899 read(50,*,err=20) tdmag3d
1900case(
'tdjr1d',
'tdcd1d')
1901 read(50,*,err=20) tdjr1d
1902case(
'tdjr2d',
'tdcd2d')
1903 read(50,*,err=20) tdjr2d
1904case(
'tdjr3d',
'tdcd3d')
1905 read(50,*,err=20) tdjr3d
1907 read(50,*,err=20) tddos
1909 read(50,*,err=20) tdlsj
1911 read(50,*,err=20) tdjtk
1913 read(50,*,err=20) tdxrmk
1916 write(*,
'("Info(readinput): variable ''epseph'' is no longer used")')
1918 read(50,*,err=20) rndevt0
1919case(
'sxcscf',
'ssxc',
'rstsf')
1920 read(50,
'(A)',err=20) str
1921 read(str,*,err=20) sxcscf
1922 read(str,*,iostat=ios) sxcscf,dsxcscf
1924 read(50,*,err=20) tempk
1925 if (tempk <= 0.d0)
then
1927 write(*,
'("Error(readinput): tempk <= 0 : ",G18.10)') tempk
1936 read(50,*,err=20) avecu(:,1)
1937 read(50,*,err=20) avecu(:,2)
1938 read(50,*,err=20) avecu(:,3)
1940 read(50,*,err=20) scu
1942 read(50,*,err=20) scu1
1944 read(50,*,err=20) scu2
1946 read(50,*,err=20) scu3
1948 read(50,*,err=20) q0cut
1950 read(50,*,err=20) rndbfcu
1951case(
'bfieldcu',
'bfielduc')
1952 read(50,*,err=20) bfieldcu
1953case(
'efieldcu',
'efielduc')
1954 read(50,*,err=20) efieldcu
1956 read(50,*,err=20) tplotq0
1958 read(50,*,err=20) trdvclr
1960 read(50,*,err=20) trdbfcr
1963 write(*,
'("Info(readinput): variable ''evtype'' is no longer used")')
1965 read(50,*,err=20) wmaxgw
1968 write(*,
'("Info(readinput): variable ''twdiag'' is no longer used")')
1970 read(50,*,err=20) tsediag
1972 read(50,*,err=20) actype
1974 read(50,*,err=20) npole
1977 write(*,
'("Error(readinput): npole < 1 : ",I8)') npole
1982 read(50,*,err=20) nspade
1983 if (nspade < 1)
then
1985 write(*,
'("Error(readinput): nspade < 1 : ",I8)') nspade
1990 read(50,*,err=20) tfav0
1992 read(50,*,err=20) rmtscf
1993 if (rmtscf <= 0.d0)
then
1995 write(*,
'("Error(readinput): rmtscf <= 0 : ",G18.10)') rmtscf
2000 read(50,*,err=20) mrmtav
2002 read(50,*,err=20) rmtall
2003case(
'maxthd',
'omp_num_threads',
'OMP_NUM_THREADS')
2004 read(50,*,err=20) maxthd
2006 read(50,*,err=20) maxthd1
2008 read(50,*,err=20) maxthdmkl
2009case(
'maxlvl',
'omp_max_active_levels',
'OMP_MAX_ACTIVE_LEVELS')
2010 read(50,*,err=20) maxlvl
2011 if (maxlvl < 1)
then
2013 write(*,
'("Error(readinput): maxlvl < 1 : ",I8)') maxlvl
2018 read(50,*,err=20) lv
2022 lmaxapw=max(lmaxapw,10)
2023 gmaxvr=max(gmaxvr,24.d0)
2024 msmgmt=max(msmgmt,4)
2027 write(*,
'("Info(readinput): parameters set by stable option")')
2028 write(*,
'(" autolinengy : ",L1)') autolinengy
2029 write(*,
'(" mrmtav : ",I4)') mrmtav
2030 write(*,
'(" lmaxapw : ",I4)') lmaxapw
2031 write(*,
'(" gmaxvr : ",G18.10)') gmaxvr
2032 write(*,
'(" msmgmt : ",I4)') msmgmt
2036 read(50,*,err=20) lv
2039 gmaxvr=max(gmaxvr,16.d0)
2040 nrmtscf=max(nrmtscf,3.d0)
2041 msmgmt=max(msmgmt,4)
2043 epsengy=min(epsengy,1.d-6)
2046 write(*,
'("Info(readinput): parameters set by metagga option")')
2047 write(*,
'(" lmaxi : ",I4)') lmaxi
2048 write(*,
'(" gmaxvr : ",G18.10)') gmaxvr
2049 write(*,
'(" nrmtscf : ",G18.10)') nrmtscf
2050 write(*,
'(" msmgmt : ",I4)') msmgmt
2051 write(*,
'(" epspot : ",G18.10)') epspot
2052 write(*,
'(" epsengy : ",G18.10)') epsengy
2057 write(*,
'("Info(readinput): variable ''t0tdlr'' is no longer used")')
2059 read(50,*,err=20) tdphi
2061 tdphi=tdphi*pi/180.d0
2063 read(50,*,err=20) thetamld
2065 thetamld=thetamld*pi/180.d0
2067 read(50,*,err=20) ntsbackup
2069 read(50,*,err=20) seedname
2070 seedname=adjustl(seedname)
2072 read(50,*,err=20) num_wann
2073case(
'idxw90',
'wann_bands')
2074 read(50,
'(A)',err=20) str
2076 if (
allocated(idxw90))
deallocate(idxw90)
2077 allocate(idxw90(num_bands))
2078 call numlist(str,num_bands,idxw90)
2080 read(50,*,err=20) num_iter
2082 read(50,*,err=20) dis_num_iter
2084 read(50,*,err=20) trial_step
2085case(
'xlwin',
'wannierExtra')
2086 if (
allocated(xlwin))
deallocate(xlwin)
2090 read(50,
'(A)',err=20) str
2091 if (trim(str) ==
'')
goto 10
2092 xlwin=[xlwin(1:nxlwin),str]
2096 read(50,*,err=20) wrtunk
2098 read(50,*,err=20) tbdip
2100 read(50,*,err=20) tjr
2102 read(50,*,err=20) tauefm
2104 read(50,*,err=20) epsefm
2106 read(50,*,err=20) ehfb
2108 read(50,*,err=20) t0gclq0
2110 read(50,*,err=20) tafindt
2113 write(*,
'("Info(readinput): variable ''afindscf'' is no longer used")')
2115 read(50,*,err=20) afindpm(:)
2116 if (afindpm(2) == 0.d0)
then
2118 write(*,
'("Error(readinput): afindpm(2) = 0")')
2123 read(50,*,err=20) nkspolar
2124 if (nkspolar < 1)
then
2126 write(*,
'("Error(readinput): nkspolar < 1 : ",I8)') nkspolar
2131 read(50,*,err=20) ntsforce
2132 if (ntsforce < 1)
then
2134 write(*,
'("Error(readinput): ntsforce < 1 : ",I8)') ntsforce
2139 read(50,*,err=20) wphcut
2140 if (wphcut <= 0.d0)
then
2142 write(*,
'("Error(readinput): wphcut <= 0 : ",G18.10)') wphcut
2147 read(50,*,err=20) ephscf(:)
2149 read(50,*,err=20) anomalous
2151 read(50,*,err=20) tephde
2153 read(50,*,err=20) bdiag
2155 read(50,*,err=20) ecutb
2156 if (ecutb <= 0.d0)
then
2158 write(*,
'("Error(readinput): ecutb <= 0 : ",G18.10)') ecutb
2163 read(50,*,err=20) ediag
2165 read(50,*,err=20) pwxpsn
2166 if (pwxpsn < 1)
then
2168 write(*,
'("Error(readinput): pwxpsn < 1 : ",I8)') pwxpsn
2173 read(50,*,err=20) ramdisk
2175 read(50,*,err=20) wrtdsk
2177 read(50,*,err=20) epsdmat
2179 read(50,*,err=20) tm3old
2181 read(50,*,err=20) batch
2183 read(50,*,err=20) tafspt
2185 read(50,*,err=20) tbaspat
2187 read(50,*,err=20) trdatdv
2189 read(50,*,err=20) atdfc
2190 if (atdfc < 0.d0)
then
2192 write(*,
'("Error(readinput): atdfc < 0 : ",G18.10)') atdfc
2197 read(50,*,err=20) maxforce
2198case(
'msmgmt',
'msmg2mt')
2199 read(50,*,err=20) msmgmt
2201 read(50,*,err=20) ntsorth
2203 read(50,*,err=20) deltabf
2204 if (deltabf <= 0.d0)
then
2206 write(*,
'("Error(readinput): deltabf <= 0 : ",G18.10)') deltabf
2211 read(50,*,err=20) jtconst0
2213 read(50,*,err=20) trmt0
2215 read(50,*,err=20) ksgwrho
2217 read(50,*,err=20) npfftg
2219 read(50,*,err=20) npfftgc
2221 read(50,*,err=20) npfftq
2223 read(50,*,err=20) npfftw
2225 read(50,*,err=20) tphnat
2227 read(50,*,err=20) ecutthc
2228 if (ecutthc <= 0.d0)
then
2230 write(*,
'("Error(readinput): ecutthc <= 0 : ",G18.10)') ecutthc
2235 read(50,*,err=20) tbdipu
2237 read(50,*,err=20) bdipscf
2242 write(*,
'("Error(readinput): invalid block name : ",A)') trim(block)
2249write(*,
'("Error(readinput): error reading from elk.in")')
2250write(*,
'("Problem occurred in ''",A,"'' block")') trim(block)
2251write(*,
'("Check input convention in manual")')
2259avec(:,:)=sc*avec(:,:)
2260avec(:,1)=sc1*avec(:,1)
2261avec(:,2)=sc2*avec(:,2)
2262avec(:,3)=sc3*avec(:,3)
2263avec(1,:)=scx*avec(1,:)
2264avec(2,:)=scy*avec(2,:)
2265avec(3,:)=scz*avec(3,:)
2272 call r3mv(rot,v,avec(:,i))
2276if (rndavec > 0.d0)
then
2279 t1=rndavec*(randomu()-0.5d0)
2280 avec(i,j)=avec(i,j)+t1
2285tavref=(any(abs(avecref(:,:)) > epslat))
2292 call r3mv(ainv,atposl(:,ia,is),v)
2293 atposl(:,ia,is)=v(:)
2298if (rndatposc > 0.d0)
then
2302 call r3mv(avec,atposl(:,ia,is),v)
2304 t1=rndatposc*(randomu()-0.5d0)
2307 call r3mv(ainv,v,atposl(:,ia,is))
2312if (rndbfcmt > 0.d0)
then
2316 t1=rndbfcmt*(randomu()-0.5d0)
2317 bfcmt0(i,ia,is)=bfcmt0(i,ia,is)+t1
2323if (fxctype(1) == -1) fxctype(:)=xctype(:)
2327avecu(:,1)=scu1*avecu(:,1)
2328avecu(:,2)=scu2*avecu(:,2)
2329avecu(:,3)=scu3*avecu(:,3)
2330avecu(:,:)=scu*avecu(:,:)