mirror of
https://github.com/triqs/dft_tools
synced 2024-09-11 13:18:30 +02:00
First import. triqs 1.0 alpha1
This commit is contained in:
commit
0e585ad9b4
23
CMakeLists.txt
Normal file
23
CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
# Append triqs installed files to the cmake load path
|
||||
list(APPEND CMAKE_MODULE_PATH ${TRIQS_PATH}/share/triqs/cmake)
|
||||
|
||||
# start configuration
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project(ctseg CXX Fortran)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
enable_testing()
|
||||
|
||||
# Load TRIQS, including all predefined variables from TRIQS installation
|
||||
find_package(TRIQS)
|
||||
|
||||
if (NOT ${TRIQS_WITH_PYTHON_SUPPORT})
|
||||
MESSAGE(FATAL_ERROR "Wien2TRIQS require Python support in TRIQS")
|
||||
endif()
|
||||
|
||||
# We want to be installed in the TRIQS tree
|
||||
set(CMAKE_INSTALL_PREFIX ${TRIQS_PATH})
|
||||
|
||||
add_subdirectory(fortran/dmftproj)
|
||||
add_subdirectory(fortran/F90)
|
||||
add_subdirectory(python)
|
||||
add_subdirectory(test)
|
3
fortran/F90/CMakeLists.txt
Normal file
3
fortran/F90/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
triqs_build_f2py_module( triqs_DFT vertex vertex.pyf vertex.f90)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/vertex.so DESTINATION ${TRIQS_PYTHON_LIB_DEST}/applications/dft)
|
226
fortran/F90/vertex.f90
Normal file
226
fortran/F90/vertex.f90
Normal file
@ -0,0 +1,226 @@
|
||||
SUBROUTINE u4ind(u_out,rcl,l,N,TM)
|
||||
|
||||
IMPLICIT NONE
|
||||
|
||||
INTEGER,INTENT(in) :: l,N
|
||||
COMPLEX*16, DIMENSION(N,N), INTENT(in) :: TM !Transformation Matrix
|
||||
DOUBLE PRECISION, DIMENSION(2*l+1,2*l+1,2*l+1,2*l+1) :: uc
|
||||
!double precision, dimension(N,N,N,N), intent(out) :: u_out
|
||||
COMPLEX*16, DIMENSION(N,N,N,N), INTENT(out) :: u_out
|
||||
DOUBLE PRECISION, DIMENSION(N,N,N,N) :: u_tmp
|
||||
DOUBLE PRECISION, DIMENSION(l+1), INTENT(in) :: rcl
|
||||
|
||||
INTEGER :: mmax,k,k2p1,ms1,ms2,ms3,ms4,ms5,ms6,ms7,ms8
|
||||
INTEGER :: sp,ms1sig,ms2sig,ms3sig,ms4sig
|
||||
INTEGER :: xk,xm1,xm2,xm3,xm,xm4
|
||||
DOUBLE PRECISION :: cgk0,cgk1,cgk2,yor(7,7),yoi(7,7)
|
||||
COMPLEX*16 :: am1,am2,am3,am4
|
||||
|
||||
!external cgk, ctormt
|
||||
|
||||
!WRITE(*,*)l,N
|
||||
mmax=2*l+1
|
||||
|
||||
IF ((N==mmax).OR.(N==2*mmax)) THEN
|
||||
! dimensions are fine:
|
||||
uc=0.d0
|
||||
|
||||
DO k = 0, 2*l, 2
|
||||
k2p1 = k/2 + 1
|
||||
cgk0 = cgk(l,0,k,0,l,0)
|
||||
DO ms1 = 1,mmax
|
||||
xm1 = (ms1-l-1)
|
||||
DO ms2 = 1,mmax
|
||||
xm2 = (ms2-l-1)
|
||||
DO ms3 = 1,mmax
|
||||
xm3 = (ms3-l-1)
|
||||
xm = xm1 - xm3
|
||||
DO ms4 = 1,mmax
|
||||
IF ((ms1+ms2-ms3-ms4).NE.0) CYCLE
|
||||
xm4 = (ms4-l-1)
|
||||
cgk1 = cgk(l,xm3,k,xm,l,xm1)
|
||||
cgk2 = cgk(l,xm2,k,xm,l,xm4)
|
||||
uc(ms1,ms2,ms3,ms4) = uc(ms1,ms2,ms3,ms4) + rcl(k2p1)*cgk0*cgk0*cgk1*cgk2
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
|
||||
u_tmp = 0.d0
|
||||
sp = (N/mmax)-1
|
||||
|
||||
! Now construct the big u matrix:
|
||||
! expand in spins:
|
||||
DO ms1=1,mmax
|
||||
DO ms1sig =0,sp
|
||||
DO ms2=1,mmax
|
||||
DO ms2sig=0,sp
|
||||
DO ms3 = 1,mmax
|
||||
DO ms3sig = 0,sp
|
||||
DO ms4 = 1,mmax
|
||||
DO ms4sig = 0,sp
|
||||
IF ((ms1sig==ms3sig).AND.(ms2sig==ms4sig)) THEN
|
||||
u_tmp(ms1sig*mmax+ms1,ms2sig*mmax+ms2,ms3sig*mmax+ms3,ms4sig*mmax+ms4) = uc(ms1,ms2,ms3,ms4)
|
||||
ENDIF
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
|
||||
!call ctormt()
|
||||
! Transformation:
|
||||
!write(*,*)'TEST'
|
||||
u_out = 0.d0
|
||||
DO ms1=1,N
|
||||
DO ms2=1,N
|
||||
DO ms3=1,N
|
||||
DO ms4=1,N
|
||||
DO ms5=1,N
|
||||
am1 = CONJG(TM(ms1,ms5)) !cmplx(yor(ms1,ms5),-yoi(ms1,ms5))
|
||||
DO ms6=1,N
|
||||
am2 = CONJG(TM(ms2,ms6)) !cmplx(yor(ms2,ms6),-yoi(ms2,ms6))
|
||||
DO ms7=1,N
|
||||
am3 = TM(ms3,ms7) !cmplx(yor(ms3,ms7),yoi(ms3,ms7))
|
||||
DO ms8=1,N
|
||||
am4 = TM(ms4,ms8) !cmplx(yor(ms4,ms8),yoi(ms4,ms8))
|
||||
u_out(ms1,ms2,ms3,ms4) = u_out(ms1,ms2,ms3,ms4) + am1*am2*am3*am4 * u_tmp(ms5,ms6,ms7,ms8)
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
!if (abs(u_out(ms1,ms2,ms3,ms4))>0.0001d0) then
|
||||
! write(*,*)ms1,ms2,ms3,ms4, u_out(ms1,ms2,ms3,ms4)
|
||||
!endif
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
|
||||
ELSE
|
||||
|
||||
WRITE(*,*)"N and l does not fit together: N=2l+1 or 2*(2l+1)!"
|
||||
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
CONTAINS
|
||||
|
||||
|
||||
SUBROUTINE ctormt
|
||||
IMPLICIT NONE
|
||||
DOUBLE PRECISION :: sqtwo, sq54, sq34
|
||||
|
||||
yor=0.d0
|
||||
yoi=0.d0
|
||||
sqtwo=1.d0/SQRT(2.d0)
|
||||
sq54=SQRT(5.d0)/4d0
|
||||
sq34=SQRT(3.d0)/4d0
|
||||
IF (l.EQ.0) THEN
|
||||
yor(1,1)=1.d0
|
||||
ELSEIF (l.EQ.1) THEN
|
||||
yor(1,1)= sqtwo
|
||||
yor(1,3)=-sqtwo
|
||||
yor(2,2)=1.d0
|
||||
yoi(3,1)= sqtwo
|
||||
yoi(3,3)= sqtwo
|
||||
ELSEIF (l.EQ.2) THEN
|
||||
!yoi(1,1)= sqtwo
|
||||
!yoi(1,5)=-sqtwo
|
||||
!yoi(2,2)= sqtwo
|
||||
!yoi(2,4)= sqtwo
|
||||
!yor(3,3)=1.d0
|
||||
!yor(4,2)= sqtwo
|
||||
!yor(4,4)=-sqtwo
|
||||
!yor(5,1)= sqtwo
|
||||
!yor(5,5)= sqtwo
|
||||
! Wien2K matrix:
|
||||
yor(3,1) = -sqtwo
|
||||
yor(3,5) = sqtwo
|
||||
yor(5,2) = sqtwo
|
||||
yor(5,4) = sqtwo
|
||||
yor(1,3) = 1.d0
|
||||
yor(4,2) = sqtwo
|
||||
yor(4,4) = -sqtwo
|
||||
yor(2,1) = sqtwo
|
||||
yor(2,5) = sqtwo
|
||||
ELSEIF (l.EQ.3) THEN
|
||||
yoi(1,2)=sqtwo
|
||||
yoi(1,6)=-sqtwo
|
||||
yor(2,1)=-sq54
|
||||
yor(2,3)=sq34
|
||||
yor(2,5)=-sq34
|
||||
yor(2,7)=sq54
|
||||
yoi(3,1)=-sq54
|
||||
yoi(3,3)=-sq34
|
||||
yoi(3,5)=-sq34
|
||||
yoi(3,7)=-sq54
|
||||
yor(4,4)=1.d0
|
||||
yor(5,1)=-sq34
|
||||
yor(5,3)=-sq54
|
||||
yor(5,5)=sq54
|
||||
yor(5,7)=sq34
|
||||
yoi(6,1)=sq34
|
||||
yoi(6,3)=-sq54
|
||||
yoi(6,5)=-sq54
|
||||
yoi(6,7)=sq34
|
||||
yor(7,2)=sqtwo
|
||||
yor(7,6)=sqtwo
|
||||
ENDIF
|
||||
END SUBROUTINE ctormt
|
||||
|
||||
|
||||
DOUBLE PRECISION FUNCTION cgk(a,al,b,be,c,ga)
|
||||
IMPLICIT NONE
|
||||
|
||||
INTEGER :: a,al,b,be,c,ga
|
||||
|
||||
INTEGER :: z,zmin,zmax,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13
|
||||
DOUBLE PRECISION :: fa(0:20), fac
|
||||
|
||||
fa = (/1.d0, 1.d0, 2.d0, 6.d0, 24.d0, 12.d1, 72.d1, 504.d1,&
|
||||
4032.d1, 36288.d1, 36288.d2, 399168.d2, 4790016.d2,&
|
||||
62270208.d2, 871782912.d2, 1307674368.d3, 20922789888.d3,&
|
||||
355687428096.d3, 6402373705728.d3, 121645100408832.d3,243290200817664.d4/)
|
||||
|
||||
|
||||
i1=0
|
||||
i2=(a+b-c)
|
||||
i3=(a-al)
|
||||
i4=(b+be)
|
||||
i5=(c-b+al)
|
||||
i6=(c-a-be)
|
||||
zmin=MAX(i1,-i5,-i6)
|
||||
zmax=MIN(i2, i3, i4)
|
||||
cgk=0.d0
|
||||
IF (ABS(al).GT.a) RETURN
|
||||
IF (ABS(be).GT.b) RETURN
|
||||
IF (ABS(ga).GT.c) RETURN
|
||||
IF ( zmin.GT.zmax ) RETURN
|
||||
IF ( (al+be).NE.ga ) RETURN
|
||||
i7=(a-b+c)
|
||||
i8=(c+b-a)
|
||||
i9=(c+b+a)
|
||||
i10=(a+al)
|
||||
i11=(b-be)
|
||||
i12=(c+ga)
|
||||
i13=(c-ga)
|
||||
DO z=zmin,zmax
|
||||
IF (MOD(z,2)==0) THEN
|
||||
fac = 1.d0
|
||||
ELSE
|
||||
fac=-1.d0
|
||||
ENDIF
|
||||
cgk=cgk+fac/(fa(z)*fa(i2-z)*fa(i3-z)*fa(i4-z)*fa(i5+z)* fa(i6+z))
|
||||
ENDDO
|
||||
cgk=cgk*SQRT(fa(i2)*fa(i7)*fa(i8)*fa(i10)*fa(i3)*fa(i4)*fa(i11)*fa(i12)*fa(i13)*(2.d0*c+1.d0)/fa(i9+1))
|
||||
|
||||
END FUNCTION cgk
|
||||
|
||||
END SUBROUTINE u4ind
|
17
fortran/F90/vertex.pyf
Normal file
17
fortran/F90/vertex.pyf
Normal file
@ -0,0 +1,17 @@
|
||||
! -*- f90 -*-
|
||||
! Note: the context of this file is case sensitive.
|
||||
|
||||
python module vertex ! in
|
||||
interface ! in :vertex
|
||||
subroutine u4ind(u_out,rcl,l,n,tm) ! in :vertex:vertex.f90
|
||||
complex*16 dimension(n,n,n,n),intent(out),depend(n,n,n,n) :: u_out
|
||||
double precision dimension(l + 1),intent(in) :: rcl
|
||||
integer optional,intent(in),check((len(rcl)-1)>=l),depend(rcl) :: l=(len(rcl)-1)
|
||||
integer optional,intent(in),check(shape(tm,0)==n),depend(tm) :: n=shape(tm,0)
|
||||
complex*16 dimension(n,n),intent(in) :: tm
|
||||
end subroutine u4ind
|
||||
end interface
|
||||
end python module vertex
|
||||
|
||||
! This file was auto-generated with f2py (version:1).
|
||||
! See http://cens.ioc.ee/projects/f2py2e/
|
33
fortran/dmftproj/CMakeLists.txt
Normal file
33
fortran/dmftproj/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
# List the sources
|
||||
set (SOURCES modules dmftproj readcomline set_ang_trans setsym
|
||||
set_rotloc timeinv read_k_list set_projections orthogonal
|
||||
rot_projectmat density symmetrize_mat rot_dens
|
||||
orthogonal_wannier outputqmc outbwin outband)
|
||||
|
||||
# add the extension and the path
|
||||
FOREACH(f ${SOURCES} )
|
||||
set(S "${CMAKE_CURRENT_SOURCE_DIR}/${f}.f;${S}")
|
||||
ENDFOREACH(f)
|
||||
|
||||
# The main target and what to link with...
|
||||
add_executable(dmftproj ${S})
|
||||
target_link_libraries(dmftproj ${TRIQS_LIBRARY_LAPACK} )
|
||||
|
||||
# where to install
|
||||
install (TARGETS dmftproj DESTINATION bin )
|
||||
|
||||
# that is it !
|
||||
|
||||
SET( D ${CMAKE_CURRENT_SOURCE_DIR}/SRC_templates/)
|
||||
SET(WIEN_SRC_TEMPL_FILES ${D}/case.cf_f_mm2 ${D}/case.cf_p_cubic ${D}/case.indmftpr ${D}/run_triqs ${D}/runsp_triqs)
|
||||
|
||||
# build the fortran stuff...
|
||||
message(STATUS "-----------------------------------------------------------------------------")
|
||||
message(STATUS " ******** WARNING ******** ")
|
||||
message(STATUS " Wien2k users : after installation of TRIQS, copy the files from ")
|
||||
message(STATUS " ${CMAKE_INSTALL_PREFIX}/share/triqs/Wien2k_SRC_files/SRC_templates ")
|
||||
message(STATUS " to your Wien2k installation WIENROOT/SRC_templates (Cf documentation). ")
|
||||
message(STATUS " This is not handled automatically by the installation process. ")
|
||||
message(STATUS "-----------------------------------------------------------------------------")
|
||||
install (FILES ${WIEN_SRC_TEMPL_FILES} DESTINATION share/triqs/Wien2k_SRC_files/SRC_templates )
|
||||
|
14
fortran/dmftproj/SRC_templates/case.cf_f_mm2
Normal file
14
fortran/dmftproj/SRC_templates/case.cf_f_mm2
Normal file
@ -0,0 +1,14 @@
|
||||
0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
|
||||
*0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. A1
|
||||
*0. 0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. -.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. A2
|
||||
0. 0.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
|
||||
*0. 0. 0. 0. 0. 0.70710678 0. 0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. B1
|
||||
0.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
|
||||
*0. 0. 0. 0. 0.70710678 0. 0. 0. -.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. B2
|
||||
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.
|
||||
*0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. A1
|
||||
*0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. -.70710678 0. 0. A2
|
||||
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.70710678
|
||||
*0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. 0.70710678 0. 0. 0. 0. B1
|
||||
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -.70710678 0.
|
||||
*0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.70710678 0. 0. 0. -.70710678 0. 0. 0. 0. 0. B2
|
7
fortran/dmftproj/SRC_templates/case.cf_p_cubic
Normal file
7
fortran/dmftproj/SRC_templates/case.cf_p_cubic
Normal file
@ -0,0 +1,7 @@
|
||||
0.707106781 0. 0. 0. -0.707106781 0. 0. 0. 0. 0. 0. 0.
|
||||
0. 0.707106781 0. 0. 0. 0.707106781 0. 0. 0. 0. 0. 0.
|
||||
*0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0.
|
||||
0. 0. 0. 0. 0. 0. 0.707106781 0. 0. 0. -0.707106781 0.
|
||||
0. 0. 0. 0. 0. 0. 0. 0.707106781 0. 0. 0. 0.707106781
|
||||
*0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0.
|
||||
|
16
fortran/dmftproj/SRC_templates/case.indmftpr
Normal file
16
fortran/dmftproj/SRC_templates/case.indmftpr
Normal file
@ -0,0 +1,16 @@
|
||||
3 ! Nsort
|
||||
1 1 3 ! Mult(Nsort)
|
||||
3 ! lmax
|
||||
complex ! choice of angular harmonics
|
||||
1 1 0 0 ! l included for each sort
|
||||
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
|
||||
cubic ! choice of angular harmonics
|
||||
1 1 2 0 ! l included for each sort
|
||||
0 0 2 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
|
||||
01 !
|
||||
0 ! SO flag
|
||||
complex ! choice of angular harmonics
|
||||
1 1 0 0 ! l included for each sort
|
||||
0 0 0 0 ! If split into ireps, gives number of ireps. for a given orbital (otherwise 0)
|
||||
-0.6 0.14 ! t2g + eg + Op
|
||||
|
784
fortran/dmftproj/SRC_templates/run_triqs
Executable file
784
fortran/dmftproj/SRC_templates/run_triqs
Executable file
@ -0,0 +1,784 @@
|
||||
#!/bin/csh -f
|
||||
hup
|
||||
unalias rm
|
||||
unalias mv
|
||||
|
||||
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
|
||||
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 (! -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;'\
|
||||
'teststop \!:1'
|
||||
alias TOTtoFOR 'sed "s/TOT/FOR/" \!:1 > $tmp;'\
|
||||
'mv $tmp \!:1'
|
||||
alias FORtoTOT 'sed "s/FOR/TOT/" \!:1 > $tmp;'\
|
||||
'mv $tmp \!:1'
|
||||
alias IPRINT_inc 'sed "s/0 NUMBER/1 NUMBER/g" \!:1 > .case.inc;'\
|
||||
'mv .case.inc \!: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
|
||||
set it0
|
||||
unset vec2pratt
|
||||
set itnum=0
|
||||
set itnum1=0
|
||||
set so
|
||||
set complex
|
||||
set complex2
|
||||
set cmplx
|
||||
set cmplx2
|
||||
set broyd
|
||||
set ctest=(0 0 0)
|
||||
set etest=(0 0 0)
|
||||
set msrcount=0
|
||||
# QDMFT
|
||||
set qdmft
|
||||
set hf
|
||||
set diaghf
|
||||
set nonself
|
||||
set noibz
|
||||
set newklist
|
||||
set redklist
|
||||
set NSLOTS = 1
|
||||
# END QDMFT
|
||||
|
||||
#---> default flags
|
||||
unset renorm
|
||||
set in1orig
|
||||
unset force #set -> force-calculation after self-consistency
|
||||
unset f_not_conv
|
||||
unset help #set -> help output
|
||||
unset init #set -> switches initially set to total energy calc.
|
||||
|
||||
#---> handling of input options
|
||||
echo "> ($name) options: $argv" >> $logfile
|
||||
alias sb 'shift; breaksw' #definition used in switch
|
||||
while ($#argv)
|
||||
switch ($1)
|
||||
case -[H|h]:
|
||||
set help; sb
|
||||
case -so:
|
||||
set complex2 = c
|
||||
set cmplx2 = -c
|
||||
set so = -so; sb
|
||||
case -nohns:
|
||||
set nohns = -nohns; shift; set nohns1 = $1;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
|
||||
# QDMFT
|
||||
case -qdmft:
|
||||
set qdmft=-qdmft; set NSLOTS = $1; sb
|
||||
# END QDMFT
|
||||
case -hf:
|
||||
set hf = -hf; sb
|
||||
case -diaghf:
|
||||
set diaghf = -diaghf; set hf = -hf; set iter = 1; sb
|
||||
case -nonself:
|
||||
set nonself = -nonself; set hf = -hf; set iter = 1; sb
|
||||
case -noibz:
|
||||
set noibz = -noibz; sb
|
||||
case -newklist:
|
||||
set newklist = -newklist; set hf = -hf; sb
|
||||
case -redklist:
|
||||
set redklist = -redklist; set hf = -hf; sb
|
||||
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/VERSION` in $WIENROOT" >> $dayfile
|
||||
printf "\n:LABEL1: Calculations in `pwd`\n:LABEL2: on `hostname` at `date`\n" >> $file.scf
|
||||
echo ":LABEL3: using `cat $WIENROOT/VERSION` in $WIENROOT" >> $file.scf
|
||||
|
||||
if ( "$so" == "-so" && "$hf" == "-hf") then
|
||||
echo "Hartree-Fock and spin-orbit coupling not supported yet. STOP"
|
||||
echo "Hartree-Fock and spin-orbit coupling not supported yet. STOP" >> $file.dayfile
|
||||
exit 9
|
||||
endif
|
||||
|
||||
if ( "$hf" == "-hf") then
|
||||
if (-e $file.corewf) rm $file.corewf
|
||||
IPRINT_inc $file.inc #modify IPRINT switch in case.inc
|
||||
endif
|
||||
|
||||
#---> complex
|
||||
if ((-e $file.in1c) && !(-z $file.in1c)) then
|
||||
set complex = c
|
||||
set complex2 = c
|
||||
set cmplx = -c
|
||||
set cmplx2 = -c
|
||||
endif
|
||||
|
||||
set vresp
|
||||
testinput $file.inm_vresp no_vresp
|
||||
set vresp=-vresp
|
||||
no_vresp:
|
||||
|
||||
# set iter/riter to 999 when MSR1a/MSECa is used
|
||||
set testmsr=`head -1 $file.inm | grep "MSR[12]a" | cut -c1-3`
|
||||
set testmsr1=`head -1 $file.inm | grep "MSECa" | cut -c1-5`
|
||||
if($testmsr1 == 'MSECa') set testmsr=MSR
|
||||
if ($testmsr == 'MSR') then
|
||||
if($riter == "99") set riter=999
|
||||
if($iter == "40") set iter=999
|
||||
foreach i ($file.in2*)
|
||||
TOTtoFOR $i #switch FOR-label
|
||||
echo changing TOT to FOR in $i
|
||||
end
|
||||
if (! -e $file.inM && ! -z $file.inM ) then
|
||||
x pairhess
|
||||
echo $file.inM and .minrestart have been created by pairhess >>$dayfile
|
||||
endif
|
||||
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
|
||||
if ($?init && $testmsr != 'MSR' ) 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.clmval) 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
|
||||
total_exec lapw0 $para
|
||||
|
||||
if ($fcut == "0") goto lapw1
|
||||
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 lapw1
|
||||
if($?cc_test) goto lapw1
|
||||
goto error
|
||||
endif
|
||||
#---> test of force-convergence for all forces
|
||||
if !(-e $file.scf) goto lapw1
|
||||
if(! $?ec_conv) goto lapw1
|
||||
if(! $?cc_conv) goto lapw1
|
||||
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
|
||||
set nohns
|
||||
echo "NOHNS deactivated by FORCE convergence" >> $dayfile
|
||||
else
|
||||
# set iter = 1
|
||||
if(! $?ec_conv) goto lapw1
|
||||
if(! $?cc_conv) goto lapw1
|
||||
set fc_conv
|
||||
unset f_not_conv
|
||||
foreach i ($file.in2*)
|
||||
TOTtoFOR $i #switch FOR-label
|
||||
end
|
||||
endif
|
||||
else
|
||||
unset fc_conv
|
||||
endif
|
||||
|
||||
lapw1:
|
||||
testinput $file.in1$complex error_input
|
||||
#generates in1-file from :EPL/EPH in case.scf2
|
||||
# if ($icycle == $in1new) rm $file.broyd1 $file.broyd2
|
||||
if ($icycle >= $in1new ) then
|
||||
if (! -e $file.in1${complex}_orig ) cp $file.in1${complex} $file.in1${complex}_orig
|
||||
write_in1_lapw $write_all -ql $qlimit $cmplx >> $dayfile
|
||||
if($status == 0 ) cp $file.in1${complex}new $file.in1${complex}
|
||||
endif
|
||||
if($in1orig == '-in1orig') then
|
||||
if ( -e $file.in1${complex}_orig ) mv $file.in1${complex}_orig $file.in1${complex}
|
||||
# unset in1orig
|
||||
endif
|
||||
|
||||
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 >> $dayfile
|
||||
else
|
||||
vec2pratt_lapw $para >> $dayfile
|
||||
endif
|
||||
endif
|
||||
|
||||
if ( $hf == "-hf" ) then
|
||||
if ((-e $file.vectorhf) && !(-z $file.vectorhf)) then
|
||||
mv $file.vectorhf $file.vectorhf_old
|
||||
if (!(-e $file.weighhf) || (-z $file.weighhf)) mv $file.energyhf $file.tmp_energyhf
|
||||
else if ((-e $file.vectorhf_old) && !(-z $file.vectorhf_old)) then
|
||||
if (!(-e $file.weighhf) || (-z $file.weighhf)) mv $file.energyhf $file.tmp_energyhf
|
||||
else
|
||||
cp $file.kgen_fbz $file.kgen
|
||||
cp $file.klist_fbz $file.klist
|
||||
total_exec lapw1 $it0 $nohns $readHinv0 $cmplx
|
||||
mv $file.vector $file.vectorhf_old
|
||||
mv $file.energy $file.tmp_energyhf
|
||||
if (-e $file.weighhf) rm $file.weighhf
|
||||
endif
|
||||
cp $file.kgen_ibz $file.kgen
|
||||
cp $file.klist_ibz $file.klist
|
||||
if (!(-e $file.vsp_old) || (-z $file.vsp_old)) then
|
||||
cp $file.vsp $file.vsp_old
|
||||
endif
|
||||
endif
|
||||
|
||||
total_exec lapw1 $it0 $para $nohns $readHinv0 $cmplx
|
||||
set it0 = $it
|
||||
set readHinv0 = $readHinv
|
||||
|
||||
lapwso:
|
||||
if ( -e $file.scfso ) rm $file.scfso
|
||||
if ( "$so" == "-so" ) then
|
||||
testinput $file.inso error_input
|
||||
total_exec lapwso $para $cmplx
|
||||
endif
|
||||
|
||||
lapw2:
|
||||
testinput $file.in2$complex2 error_input
|
||||
if ( $hf == "-hf" ) then
|
||||
if (!(-e $file.weighhf) || (-z $file.weighhf)) then
|
||||
cp $file.kgen_fbz $file.kgen
|
||||
cp $file.klist_fbz $file.klist
|
||||
if (-e $file.vector) mv $file.vector $file.vector_save
|
||||
mv $file.vectorhf_old $file.vector
|
||||
if (-e $file.energy) mv $file.energy $file.energy_save
|
||||
mv $file.tmp_energyhf $file.energy
|
||||
total_exec lapw2 $vresp $in1orig $cmplx2
|
||||
mv $file.weigh $file.weighhf
|
||||
mv $file.vector $file.vectorhf_old
|
||||
if (-e $file.vector_save) mv $file.vector_save $file.vector
|
||||
mv $file.energy $file.energyhf
|
||||
if (-e $file.energy_save) mv $file.energy_save $file.energy
|
||||
cp $file.kgen_ibz $file.kgen
|
||||
cp $file.klist_ibz $file.klist
|
||||
endif
|
||||
endif
|
||||
#QDMFT
|
||||
if ( "$qdmft" == "-qdmft" ) then
|
||||
total_exec lapw2 $para $vresp -almd $cmplx2 $so
|
||||
dmftproj $so # please check: $so can't be here
|
||||
# pytriqs call
|
||||
printf "\n> ERROR: Insert a correct call of pytriqs (with mpi wrapper, if needed) in run_triqs Wien2k script\n" >> $dayfile
|
||||
printf "\n> stop\n" >> $dayfile
|
||||
printf "\n> ERROR: Insert a correct call of pytriqs (with mpi wrapper, if needed) in run_triqs Wien2k script\n"
|
||||
exit 0
|
||||
# to call pytriqs uncomment and modify the line below to adapt it to your system
|
||||
# the number of core is in NSLOTS variable
|
||||
#mpprun --force-mpi=openmpi/1.3.2-i110074 /home/x_leopo/TRIQS_segment/triqs_install/bin/pytriqs $file.py
|
||||
total_exec lapw2 $para $vresp -qdmft $cmplx2 $so
|
||||
else
|
||||
total_exec lapw2 $para $vresp $in1orig $cmplx2 $so
|
||||
if ( $hf == "-hf" ) then
|
||||
sed 's/:SUM/:SLSUM/g' < $file.scf2 > $file.scf2_tmp
|
||||
mv $file.scf2_tmp $file.scf2
|
||||
mv $file.clmval $file.clmvalsl
|
||||
if ( -e $file.scfhf_1 ) rm $file.scfhf_*
|
||||
endif
|
||||
endif
|
||||
# END QDMFT
|
||||
|
||||
rm -f $file.clmsc
|
||||
|
||||
if ( $hf == "-hf" ) goto hf
|
||||
|
||||
lapw1s:
|
||||
testinput $file.in1${complex}s lcore
|
||||
total_exec lapw1 -sc $para $nohns $readHinv $cmplx
|
||||
|
||||
lapw2s:
|
||||
testinput $file.in2${complex2}s error_input
|
||||
total_exec lapw2 -sc $para $vresp $in1orig $cmplx2
|
||||
goto lcore
|
||||
|
||||
hf:
|
||||
testinput $file.inhf error_input
|
||||
if (!(-e $file.corewf) || (-z $file.corewf)) then
|
||||
total_exec lcore
|
||||
endif
|
||||
total_exec hf $diaghf $nonself $noibz $newklist $redklist $para $cmplx
|
||||
|
||||
lapw2hf:
|
||||
testinput $file.in2$complex2 error_input
|
||||
cp $file.kgen_fbz $file.kgen
|
||||
cp $file.klist_fbz $file.klist
|
||||
total_exec lapw2 -hf $vresp $in1orig $cmplx2
|
||||
cp $file.kgen_ibz $file.kgen
|
||||
cp $file.klist_ibz $file.klist
|
||||
|
||||
lcore:
|
||||
testinput $file.inc scf
|
||||
total_exec lcore
|
||||
|
||||
coresuper:
|
||||
if ( ! -e .lcore) goto scf
|
||||
total_exec dstart -lcore
|
||||
rm -f $file.clmcor
|
||||
endif
|
||||
|
||||
scf:
|
||||
if ( $hf == "-hf" ) then
|
||||
foreach i ( 0 0_grr 1 so 2 1s 2s c hf 2hf )
|
||||
if (-e $file.scf$i) cat $file.scf$i >> $file.scf
|
||||
end
|
||||
else
|
||||
foreach i ( 0 1 so 2 1s 2s c )
|
||||
if (-e $file.scf$i) cat $file.scf$i >> $file.scf
|
||||
end
|
||||
endif
|
||||
scf1:
|
||||
foreach i (clmsum vsp vns vrespsum )
|
||||
if (-e $file.$i ) \
|
||||
cp $file.$i $file.${i}_old #save last cycle
|
||||
end
|
||||
|
||||
|
||||
mixer:
|
||||
testinput $file.inm error_input
|
||||
total_exec mixer
|
||||
cat $file.scfm >> $file.scf
|
||||
|
||||
if($?renorm) then
|
||||
unset renorm
|
||||
rm $file.broy*
|
||||
endif
|
||||
|
||||
mixer_vresp:
|
||||
testinput $file.inm_vresp energytest
|
||||
total_exec mixer_vresp
|
||||
grep -e "CTO " -e NEC $file.outputm_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.0000") 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
|
||||
|
||||
# check F-condition for MSR1a mode
|
||||
if ($testmsr == 'MSR') then
|
||||
set msrtest =(`grep :FRMS $file.scf |tail -1` )
|
||||
if ($#msrtest >= 13 ) then
|
||||
echo msrcount $msrcount msrtest $msrtest[13]
|
||||
# Trap silly early convergene with "minimum-requests"
|
||||
set etest2 = (`$bin/testconv -p :ENE -c 0.001`)
|
||||
if ( $etest2[1] == '0')set msrtest[13]='F'
|
||||
set ctest2 = (`$bin/testconv -p :DIS -c 0.01`)
|
||||
if ( $ctest2[1] == '0')set msrtest[13]='F'
|
||||
#
|
||||
if ($msrtest[13] == 'T') then
|
||||
#change in case.inm MSR1a/MSECa to MSR1/MSEC3, rm *.bro*, unset testmsr
|
||||
@ msrcount ++
|
||||
if($msrcount == 3) then
|
||||
sed "1s/MSR1a/MSR1 /" $file.inm >$file.inm_tmp
|
||||
sed "1s/MSECa/MSEC3/" $file.inm_tmp >$file.inm
|
||||
rm *.broy* $file.inm_tmp
|
||||
set a=`grep -e GREED *scfm | tail -1 | cut -c 50-55`
|
||||
set b=`echo "scale=5; if( $a/2 > 0.05) $a/2 else 0.05 " |bc -l`
|
||||
echo $b > .msec
|
||||
echo "MSR1a/MSECa changed to MSR1/MSEC3 in $file.inm, relaxing only electrons" >> $dayfile
|
||||
set testmsr
|
||||
endif
|
||||
else
|
||||
set msrcount=0
|
||||
endif
|
||||
endif
|
||||
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 ++
|
||||
|
||||
if ($icycle == 2) set newklist
|
||||
|
||||
#---> 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 ($testmsr == 'MSR' && -e .minstop) then
|
||||
sed "1s/MSR1a/MSR1 /" $file.inm >$file.inm_tmp
|
||||
sed "1s/MSECa/MSEC3/" $file.inm_tmp >$file.inm
|
||||
rm *.broy* $file.inm_tmp
|
||||
set a=`grep -e GREED *scfm | tail -1 | cut -c 50-55`
|
||||
set b=`echo "scale=5; if( $a/2 > 0.05) $a/2 else 0.05 " |bc -l`
|
||||
echo $b > .msec
|
||||
echo "MSR1a/MSECa changed to MSR1/MSEC3 in $file.inm, relaxing only electrons" >> $dayfile
|
||||
set testmsr
|
||||
endif
|
||||
|
||||
echo ec cc and fc_conv $?ec_conv $?cc_conv $?fc_conv
|
||||
echo ec cc and fc_conv $?ec_conv $?cc_conv $?fc_conv >> $dayfile
|
||||
if($?ec_conv && $?cc_conv && $?fc_conv && ($testmsr == '') ) 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
|
||||
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 nonmagnetic scf-cycle in WIEN
|
||||
to be called within the case-subdirectory
|
||||
has to be located in WIEN-executable directory
|
||||
|
||||
USAGE: $name [OPTIONS] [FLAGS]
|
||||
|
||||
OPTIONS:
|
||||
-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
|
||||
-qdmft NP -> including DMFT from Aichhorn/Georges/Biermann running on NP proc
|
||||
|
||||
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 -> run SCF including spin-orbit coupling
|
||||
-renorm-> start with mixer and renormalize density
|
||||
-in1orig-> if present, use case.in1_orig file; do not modify case.in1
|
||||
-hf -> HF/hybrid-DFT calculation
|
||||
-diaghf -> non-selfconsistent HF with diagonal HF only (only e_i)
|
||||
-nonself -> non-selfconsistent HF/hybrid-DFT calculation (only E_x(HF))
|
||||
-newklist -> HF/hybrid-DFT calculation starting from a different k-mesh
|
||||
-redklist -> HF/hybrid-DFT calculation with a reduced k-mesh for the potential
|
||||
|
||||
CONTROL FILES:
|
||||
.lcore runs core density superposition producing case.clmsc
|
||||
.stop stop after SCF cycle
|
||||
.minstop stops MSR1a minimization and changes to MSR1
|
||||
.fulldiag force full diagonalization
|
||||
.noHinv remove case.storeHinv files
|
||||
case.inm_vresp activates calculation of vresp 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
|
||||
|
||||
|
975
fortran/dmftproj/SRC_templates/runsp_triqs
Executable file
975
fortran/dmftproj/SRC_templates/runsp_triqs
Executable file
@ -0,0 +1,975 @@
|
||||
#!/bin/csh -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
|
||||
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'
|
||||
alias IPRINT_inc 'sed "s/0 NUMBER/1 NUMBER/g" \!: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 complex
|
||||
set complex2
|
||||
set cmplx
|
||||
set cmplx2
|
||||
set so
|
||||
set orb
|
||||
set broyd
|
||||
set eece1
|
||||
unset eece
|
||||
unset orbc
|
||||
unset orbdu
|
||||
unset dm
|
||||
set ctest=(0 0 0)
|
||||
set etest=(0 0 0)
|
||||
set msrcount=0
|
||||
# QDMFT
|
||||
set qdmft
|
||||
set hf
|
||||
set diaghf
|
||||
set nonself
|
||||
set noibz
|
||||
set newklist
|
||||
set redklist
|
||||
set NSLOTS = 1
|
||||
# END QDMFT
|
||||
|
||||
#---> 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.
|
||||
unset lcore #set -> core density superposition
|
||||
|
||||
#---> handling of input options
|
||||
echo "> ($name) options: $argv" >> $logfile
|
||||
alias sb 'shift; breaksw' #definition used in switch
|
||||
while ($#argv)
|
||||
switch ($1)
|
||||
case -[H|h]:
|
||||
set help; sb
|
||||
case -so:
|
||||
set complex2 = c
|
||||
set cmplx2 = -c
|
||||
set so = -so; sb
|
||||
case -nohns:
|
||||
set nohns = -nohns; shift; set nohns1 = $1;sb
|
||||
case -dm:
|
||||
set dm; sb
|
||||
case -orb:
|
||||
set orb = -orb; sb
|
||||
case -orbc:
|
||||
set orbc
|
||||
set orb = -orb; sb
|
||||
case -eece:
|
||||
set eece
|
||||
set eece1 = -eece
|
||||
set orbc
|
||||
set orb = -orb; sb
|
||||
case -orbdu:
|
||||
set orbdu
|
||||
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
|
||||
# QDMFT
|
||||
case -qdmft:
|
||||
set qdmft=-qdmft; shift; set NSLOTS = $1; sb
|
||||
# END QDMFT
|
||||
case -hf:
|
||||
set hf = -hf; sb
|
||||
case -diaghf:
|
||||
set diaghf = -diaghf; set hf = -hf; set iter = 1; sb
|
||||
case -nonself:
|
||||
set nonself = -nonself; set hf = -hf; set iter = 1; sb
|
||||
case -noibz:
|
||||
set noibz = -noibz; sb
|
||||
case -newklist:
|
||||
set newklist = -newklist; set hf = -hf; sb
|
||||
case -redklist:
|
||||
set redklist = -redklist; set hf = -hf; sb
|
||||
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/VERSION` in $WIENROOT" >> $dayfile
|
||||
printf "\n:LABEL1: Calculations in `pwd`\n:LABEL2: on `hostname` at `date`\n" >> $file.scf
|
||||
echo ":LABEL3: using `cat $WIENROOT/VERSION` in $WIENROOT" >> $file.scf
|
||||
|
||||
if ( "$so" == "-so" && "$hf" == "-hf") then
|
||||
echo "Hartree-Fock and spin-orbit coupling not supported yet. STOP"
|
||||
echo "Hartree-Fock and spin-orbit coupling not supported yet. STOP" >> $file.dayfile
|
||||
exit 9
|
||||
endif
|
||||
|
||||
if ( "$hf" == "-hf") then
|
||||
if (-e $file.corewfup) rm $file.corewfup
|
||||
if (-e $file.corewfdn) rm $file.corewfdn
|
||||
IPRINT_inc $file.inc # modify IPRINT switch in case.inc
|
||||
if ( ! -z $file.incup && -e $file.incup ) then
|
||||
IPRINT_inc $file.incup
|
||||
IPRINT_inc $file.incdn
|
||||
endif
|
||||
endif
|
||||
|
||||
#---> complex
|
||||
if ((-e $file.in1c) && !(-z $file.in1c)) then
|
||||
set complex = c
|
||||
set complex2 = c
|
||||
set cmplx = -c
|
||||
set cmplx2 = -c
|
||||
endif
|
||||
|
||||
set vresp
|
||||
testinput $file.inm_vresp no_vresp
|
||||
set vresp=-vresp
|
||||
no_vresp:
|
||||
|
||||
# set iter/riter to 999 when MSR1a/MSECa is used
|
||||
set testmsr=`head -1 $file.inm | grep "MSR[12]a" | cut -c1-3`
|
||||
set testmsr1=`head -1 $file.inm | grep "MSECa" | cut -c1-5`
|
||||
if($testmsr1 == 'MSECa') set testmsr=MSR
|
||||
if ($testmsr == 'MSR') then
|
||||
if($riter == "99") set riter=999
|
||||
if($iter == "40") set iter=999
|
||||
foreach i ($file.in2*)
|
||||
TOTtoFOR $i #switch FOR-label
|
||||
echo changing $i
|
||||
end
|
||||
if (! -e $file.inM && ! -z $file.inM ) then
|
||||
x pairhess
|
||||
echo $file.inM and .minrestart have been created by pairhess >>$dayfile
|
||||
endif
|
||||
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
|
||||
if ($?init && $testmsr != 'MSR') 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.scforbdu ) rm $file.scforbdu
|
||||
if ( -e $file.vorbdu ) rm $file.vorbdu
|
||||
|
||||
if ( "$orb" != "-orb" ) goto lapw1
|
||||
if ( $?orbc ) goto lapw1
|
||||
if (! -e $file.dmatup || -z $file.dmatup ) then
|
||||
set renorm
|
||||
goto lapw1
|
||||
endif
|
||||
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( $?orbdu ) then
|
||||
total_exec orb -du $para
|
||||
# vorbdu seems unphysical large, so we use it only with -orbdu switch)
|
||||
endif
|
||||
endif
|
||||
|
||||
lapw1:
|
||||
testinput $file.in1$complex 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
|
||||
touch ${scratch}$file.vector.old
|
||||
rm ${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
|
||||
vec2old_lapw $para -dn >> $dayfile
|
||||
else
|
||||
vec2pratt_lapw $para -up >> $dayfile
|
||||
vec2pratt_lapw $para -dn >> $dayfile
|
||||
endif
|
||||
endif
|
||||
|
||||
if ( -e dnlapw1.error ) rm dnlapw1.error
|
||||
|
||||
if ( $hf == "-hf" ) then
|
||||
if ((-e $file.vectorhfup) && !(-z $file.vectorhfup) && \
|
||||
(-e $file.vectorhfdn) && !(-z $file.vectorhfdn)) then
|
||||
mv $file.vectorhfup $file.vectorhfup_old
|
||||
mv $file.vectorhfdn $file.vectorhfdn_old
|
||||
if (!(-e $file.weighhfup) || (-z $file.weighhfup) || \
|
||||
!(-e $file.weighhfdn) || (-z $file.weighhfdn)) then
|
||||
mv $file.energyhfup $file.tmp_energyhfup
|
||||
mv $file.energyhfdn $file.tmp_energyhfdn
|
||||
endif
|
||||
else if ((-e $file.vectorhfup_old) && !(-z $file.vectorhfup_old) && \
|
||||
(-e $file.vectorhfdn_old) && !(-z $file.vectorhfdn_old)) then
|
||||
if (!(-e $file.weighhfup) || (-z $file.weighhfup) || \
|
||||
!(-e $file.weighhfdn) || (-z $file.weighhfdn)) then
|
||||
mv $file.energyhfup $file.tmp_energyhfup
|
||||
mv $file.energyhfdn $file.tmp_energyhfdn
|
||||
endif
|
||||
else
|
||||
cp $file.kgen_fbz $file.kgen
|
||||
cp $file.klist_fbz $file.klist
|
||||
total_exec lapw1 $it0 -up $nohns $readHinv0 $cmplx
|
||||
total_exec lapw1 $it0 -dn $nohns $readHinv0 $cmplx
|
||||
mv $file.vectorup $file.vectorhfup_old
|
||||
mv $file.vectordn $file.vectorhfdn_old
|
||||
mv $file.energyup $file.tmp_energyhfup
|
||||
mv $file.energydn $file.tmp_energyhfdn
|
||||
if (-e $file.weighhfup) rm $file.weighhfup
|
||||
if (-e $file.weighhfdn) rm $file.weighhfdn
|
||||
endif
|
||||
cp $file.kgen_ibz $file.kgen
|
||||
cp $file.klist_ibz $file.klist
|
||||
if (!(-e $file.vspup_old) || (-z $file.vspup_old) || \
|
||||
!(-e $file.vspdn_old) || (-z $file.vspdn_old)) then
|
||||
cp $file.vspup $file.vspup_old
|
||||
cp $file.vspdn $file.vspdn_old
|
||||
endif
|
||||
endif
|
||||
|
||||
#generates in1-file from :EPL/EPH in case.scf2
|
||||
# if ($icycle == $in1new) rm $file.broyd1 $file.broyd2
|
||||
if ($icycle >= $in1new ) then
|
||||
if (! -e $file.in1${complex}_orig ) cp $file.in1${complex} $file.in1${complex}_orig
|
||||
write_in1_lapw $write_all -up -ql $qlimit ${cmplx} >> $dayfile
|
||||
if($status == 0 ) cp $file.in1${complex}new $file.in1${complex}
|
||||
endif
|
||||
if($?in1orig == '-in1orig') then
|
||||
if ( -e $file.in1${complex}_orig ) mv $file.in1${complex}_orig $file.in1${complex}
|
||||
# unset in1orig
|
||||
endif
|
||||
if ( "$so" == "-so" ) then
|
||||
total_exec lapw1 $it0 -up $para $nohns $readHinv0 $cmplx
|
||||
else
|
||||
total_exec lapw1 $it0 -up $para $nohns $orb $readHinv0 $cmplx
|
||||
endif
|
||||
if ($icycle >= $in1new ) then
|
||||
write_in1_lapw $write_all -dn -ql $qlimit ${cmplx}>> $dayfile
|
||||
if($status == 0 ) cp $file.in1${complex}new $file.in1${complex}
|
||||
endif
|
||||
if ( "$so" == "-so" ) then
|
||||
total_exec lapw1 $it0 -dn $para $nohns $readHinv0 $cmplx
|
||||
else
|
||||
total_exec lapw1 $it0 -dn $para $nohns $orb $readHinv0 $cmplx
|
||||
endif
|
||||
set it0 = $it
|
||||
set readHinv0 = $readHinv
|
||||
|
||||
lapwso:
|
||||
if ( -e $file.scfso ) rm $file.scfso
|
||||
if ( "$so" == "-so" ) then
|
||||
testinput $file.inso error_input
|
||||
total_exec lapwso -up $orb $para $cmplx
|
||||
endif
|
||||
|
||||
lapw2:
|
||||
testinput $file.in2$complex2 error_input
|
||||
if ( -e dnlapw2.error ) rm dnlapw2.error
|
||||
if ( $hf == "-hf" ) then
|
||||
if (!(-e $file.weighhfup) || (-z $file.weighhfup) || \
|
||||
!(-e $file.weighhfdn) || (-z $file.weighhfdn)) then
|
||||
cp $file.kgen_fbz $file.kgen
|
||||
cp $file.klist_fbz $file.klist
|
||||
if (-e $file.vectorup) mv $file.vectorup $file.vectorup_save
|
||||
if (-e $file.vectordn) mv $file.vectordn $file.vectordn_save
|
||||
mv $file.vectorhfup_old $file.vectorup
|
||||
mv $file.vectorhfdn_old $file.vectordn
|
||||
if (-e $file.energyup) mv $file.energyup $file.energyup_save
|
||||
if (-e $file.energydn) mv $file.energydn $file.energydn_save
|
||||
mv $file.tmp_energyhfup $file.energyup
|
||||
mv $file.tmp_energyhfdn $file.energydn
|
||||
total_exec lapw2 -up $vresp $in1orig $cmplx2
|
||||
total_exec lapw2 -dn $vresp $in1orig $cmplx2
|
||||
mv $file.weighup $file.weighhfup
|
||||
mv $file.weighdn $file.weighhfdn
|
||||
mv $file.vectorup $file.vectorhfup_old
|
||||
mv $file.vectordn $file.vectorhfdn_old
|
||||
if (-e $file.vectorup_save) mv $file.vectorup_save $file.vectorup
|
||||
if (-e $file.vectordn_save) mv $file.vectordn_save $file.vectordn
|
||||
mv $file.energyup $file.energyhfup
|
||||