Providing an analysis for autocorrelation. It can be activated by introducing a …

…new error variable N_auto > 0. If no such variable is defined or if it is set to 0, the analysis is turned of by default.
1 parent 6c8b525a
......@@ -56,17 +56,20 @@
Type (Mat_C), allocatable :: Bins (:,:), Bins_R(:,:)
Complex (Kind=Kind(0.d0)), allocatable :: Bins0(:,:)
Complex (Kind=Kind(0.d0)) :: Z, Xmean,Xerr, Xmean_r, Xerr_r
Real (Kind=Kind(0.d0)) :: Xm,Xe
Real (Kind=Kind(0.d0)) :: Xk_p(2), XR_p(2) , XR1_p(2)
Complex (Kind=Kind(0.d0)), allocatable :: V_help(:), V_help_R(:)
Real (Kind=Kind(0.d0)) :: Pi, a1_p(2), a2_p(2), L1_p(2), L2_p(2), del_p(2)
Real (Kind=Kind(0.d0)), allocatable :: AutoCorr(:),En(:)
Integer :: L1, L2, I
Integer :: L1, L2, I, N_auto
Character (len=64) :: Model, Lattice_type
Type (Lattice) :: Latt
Character (len=64) :: File_out
NAMELIST /VAR_lattice/ L1, L2, Lattice_type, Model
NAMELIST /VAR_errors/ n_skip, N_rebin, N_Cov, N_Back
NAMELIST /VAR_errors/ n_skip, N_rebin, N_Cov, N_Back, N_auto
......@@ -192,6 +195,7 @@
endif
enddo
close(10)
N_auto=min(N_auto,Nbins/3)
Call Fourier_K_to_R(bins,bins_r,Latt)
......@@ -250,6 +254,33 @@
Close(33)
Close(34)
if(N_auto>0) then
ALLOCATE(AutoCorr(N_auto))
ALLOCATE(EN(Nbins))
Do n = 1,Nunit
Xk_p = dble(Latt%listk(n,1))*Latt%b1_p + dble(Latt%listk(n,2))*Latt%b2_p
if (Xk_p(1) >= -1.d-8 .and. XK_p(2) >= -1.d-8) then
write(File_out,'("Var_eq_Auto_Tr_",F4.2,"_",F4.2)') Xk_p(1), Xk_p(2)
OPEN (UNIT=21, FILE=File_out, STATUS='unknown')
WRITE(21,*)
do nb = 1,Nbins
Z=0
do no = 1,Norb
Z = Z+bins (n,nb)%el(no,no)
enddo
En(nb)=dble(Z)
enddo
Call AUTO_COR(En,AutoCorr)
do i = 1,N_auto
CALL ERRCALCJ(En,XM, XE,i)
write(21,*) i, AutoCorr(i), Xe
enddo
CLOSE(21)
endif
enddo
DEALLOCATE(AutoCorr)
endif
......
......@@ -50,14 +50,17 @@
! Complex (Kind=Kind(0.d0)) Z1,Z2,Z3,Z4,Z5
Complex (Kind=Kind(0.d0)), Allocatable :: Tmp(:)
REAL (Kind=Kind(0.d0)), Allocatable :: AutoCorr(:)
Integer :: Nobs
Integer :: Nbins, Nbins_eff, I, IOBS, N_Back
Integer :: N,N1 !, NBIN
Integer :: n_skip, N_rebin, N_Cov, ierr
NAMELIST /VAR_errors/ n_skip, N_rebin, N_Cov, N_Back
Integer :: n_skip, N_rebin, N_Cov, ierr, N_auto
Character (len=64) :: File_out
NAMELIST /VAR_errors/ n_skip, N_rebin, N_Cov, N_Back, N_auto
N_auto=0
OPEN(UNIT=5,FILE='parameters',STATUS='old',ACTION='read',IOSTAT=ierr)
IF (ierr /= 0) THEN
WRITE(*,*) 'unable to open <parameters>',ierr
......@@ -98,6 +101,7 @@
ENDDO
CLOSE(20)
2100 FORMAT(I6,2X,F16.8)
N_auto=min(N_auto,Nbins_eff/3)
OPEN (UNIT=21, FILE='Var_scalJ', STATUS='unknown')
WRITE(21,*) 'Effective number of bins, and bins: ', Nbins_eff, Nbins
......@@ -117,6 +121,25 @@
ENDDO
CLOSE(21)
2001 FORMAT('OBS : ', I4,4x,F12.6,2X, F12.6)
if(N_auto>0) then
ALLOCATE(AutoCorr(N_auto))
DO IOBS = 1,NOBS-1
write(File_out,'("Var_scal_Auto_",I1.1)') iobs
write(*,*) File_out
OPEN (UNIT=21, FILE=File_out, STATUS='unknown')
WRITE(21,*)
DO I = 1,Nbins_eff
EN (I) = Real(OBS(I,IOBS), kind(0.d0))
ENDDO
Call AUTO_COR(EN,AutoCorr)
do i = 1,N_auto
CALL ERRCALCJ(EN,XM,XERR,i)
write(21,*) i, AutoCorr(i), Xerr
enddo
CLOSE(21)
ENDDO
endif
DEALLOCATE (EN,SIGN,OBS)
......
......@@ -7,6 +7,12 @@ for filename in *_scal; do
cp $filename Var_scal
$ANNAL/cov_scal.out
mv "Var_scalJ" $filename"J"
for filename2 in Var_scal_Auto_*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_scal/${filename}/`
mv $filename2 $NewName
fi
done
rm Var_scal
# fi
done
......@@ -15,10 +21,16 @@ for filename in *_eq; do
echo $filename
export filename1=$filename"J"
# if [ "$filename1" -ot "$filename" ]; then
cp $filename ineq
ln $filename ineq
$ANNAL/cov_eq.out
mv "equalJ" $filename"JK"
mv "equalJR" $filename"JR"
for filename2 in Var_eq_Auto_Tr*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_eq/${filename}/`
mv $filename2 $NewName
fi
done
rm ineq
# fi
done
......@@ -26,7 +38,7 @@ done
for filename in *_tau; do
echo $filename
cp $filename intau
ln $filename intau
$ANNAL/cov_tau.out
rm intau
for filename1 in g_*; do
......
......@@ -7,6 +7,12 @@ for filename in *_scal; do
cp $filename Var_scal
$ANNAL/cov_scal.out
mv "Var_scalJ" $filename"J"
for filename2 in Var_scal_Auto_*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_scal/${filename}/`
mv $filename2 $NewName
fi
done
rm Var_scal
# fi
done
......@@ -15,10 +21,16 @@ for filename in *_eq; do
echo $filename
export filename1=$filename"J"
# if [ "$filename1" -ot "$filename" ]; then
cp $filename ineq
ln $filename ineq
$ANNAL/cov_eq.out
mv "equalJ" $filename"JK"
mv "equalJR" $filename"JR"
for filename2 in Var_eq_Auto_Tr*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_eq/${filename}/`
mv $filename2 $NewName
fi
done
rm ineq
# fi
done
......@@ -26,7 +38,7 @@ done
for filename in *_tau; do
echo $filename
cp $filename intau
ln $filename intau
$ANNAL/cov_tau.out
rm intau
for filename1 in g_*; do
......
......@@ -7,6 +7,12 @@ for filename in *_scal; do
cp $filename Var_scal
$ANNAL/cov_scal.out
mv "Var_scalJ" $filename"J"
for filename2 in Var_scal_Auto_*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_scal/${filename}/`
mv $filename2 $NewName
fi
done
rm Var_scal
# fi
done
......@@ -15,10 +21,16 @@ for filename in *_eq; do
echo $filename
export filename1=$filename"J"
# if [ "$filename1" -ot "$filename" ]; then
cp $filename ineq
ln $filename ineq
$ANNAL/cov_eq.out
mv "equalJ" $filename"JK"
mv "equalJR" $filename"JR"
for filename2 in Var_eq_Auto_Tr*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_eq/${filename}/`
mv $filename2 $NewName
fi
done
rm ineq
# fi
done
......@@ -26,7 +38,7 @@ done
for filename in *_tau; do
echo $filename
cp $filename intau
ln $filename intau
$ANNAL/cov_tau.out
rm intau
for filename1 in g_*; do
......
......@@ -7,6 +7,12 @@ for filename in *_scal; do
cp $filename Var_scal
$ANNAL/cov_scal.out
mv "Var_scalJ" $filename"J"
for filename2 in Var_scal_Auto_*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_scal/${filename}/`
mv $filename2 $NewName
fi
done
rm Var_scal
# fi
done
......@@ -15,10 +21,16 @@ for filename in *_eq; do
echo $filename
export filename1=$filename"J"
# if [ "$filename1" -ot "$filename" ]; then
cp $filename ineq
ln $filename ineq
$ANNAL/cov_eq.out
mv "equalJ" $filename"JK"
mv "equalJR" $filename"JR"
for filename2 in Var_eq_Auto_Tr*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_eq/${filename}/`
mv $filename2 $NewName
fi
done
rm ineq
# fi
done
......@@ -26,7 +38,7 @@ done
for filename in *_tau; do
echo $filename
cp $filename intau
ln $filename intau
$ANNAL/cov_tau.out
rm intau
for filename1 in g_*; do
......
......@@ -7,6 +7,12 @@ for filename in *_scal; do
cp $filename Var_scal
$ANNAL/cov_scal.out
mv "Var_scalJ" $filename"J"
for filename2 in Var_scal_Auto_*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_scal/${filename}/`
mv $filename2 $NewName
fi
done
rm Var_scal
# fi
done
......@@ -15,10 +21,16 @@ for filename in *_eq; do
echo $filename
export filename1=$filename"J"
# if [ "$filename1" -ot "$filename" ]; then
cp $filename ineq
ln $filename ineq
$ANNAL/cov_eq.out
mv "equalJ" $filename"JK"
mv "equalJR" $filename"JR"
for filename2 in Var_eq_Auto_Tr*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_eq/${filename}/`
mv $filename2 $NewName
fi
done
rm ineq
# fi
done
......@@ -26,7 +38,7 @@ done
for filename in *_tau; do
echo $filename
cp $filename intau
ln $filename intau
$ANNAL/cov_tau.out
rm intau
for filename1 in g_*; do
......
......@@ -7,6 +7,12 @@ for filename in *_scal; do
cp $filename Var_scal
$ANNAL/cov_scal.out
mv "Var_scalJ" $filename"J"
for filename2 in Var_scal_Auto_*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_scal/${filename}/`
mv $filename2 $NewName
fi
done
rm Var_scal
# fi
done
......@@ -15,10 +21,16 @@ for filename in *_eq; do
echo $filename
export filename1=$filename"J"
# if [ "$filename1" -ot "$filename" ]; then
cp $filename ineq
ln $filename ineq
$ANNAL/cov_eq.out
mv "equalJ" $filename"JK"
mv "equalJR" $filename"JR"
for filename2 in Var_eq_Auto_Tr*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_eq/${filename}/`
mv $filename2 $NewName
fi
done
rm ineq
# fi
done
......@@ -26,7 +38,7 @@ done
for filename in *_tau; do
echo $filename
cp $filename intau
ln $filename intau
$ANNAL/cov_tau.out
rm intau
for filename1 in g_*; do
......
......@@ -89,14 +89,16 @@
NP = SIZE(EN)
XM = 0.D0
XSQ = 0.D0
DO NT = 1,NP
XM = XM + EN(NT)
XSQ = XSQ + EN(NT)**2
ENDDO
XM = XM /DBLE(NP)
XSQ = 0.D0
DO NT = 1,NP
XSQ = XSQ + (EN(NT)-XM)**2
ENDDO
XSQ = XSQ/DBLE(NP)
XERR = (XSQ - XM**2)/DBLE(NP)
XERR = XSQ/DBLE(NP)
IF (XERR.GT.0.D0) THEN
XERR = SQRT(XERR)
ELSE
......@@ -146,7 +148,7 @@
IMPLICIT NONE
REAL (Kind=Kind(0.d0)), DIMENSION(:) :: EN
REAL (Kind=Kind(0.d0)) :: XM, XERR, X
REAL (Kind=Kind(0.d0)) :: XM, XERR, X, Xhelp
REAL (Kind=Kind(0.d0)), DIMENSION(:), ALLOCATABLE :: EN1
INTEGER :: NP, N, N1
......@@ -155,11 +157,13 @@
! Build the jackknife averages and send to errcalc.
Xhelp = 0.D0
DO N1 = 1,NP
Xhelp = Xhelp + EN(N1)
ENDDO
DO N = 1,NP
X = 0.D0
DO N1 = 1,NP
IF (N1.NE.N) X = X + EN(N1)
ENDDO
X = Xhelp - EN(N)
EN1(N) = X / DBLE(NP -1)
ENDDO
CALL ERRCALC(EN1,XM,XERR)
......@@ -177,7 +181,7 @@
IMPLICIT NONE
COMPLEX (Kind=Kind(0.d0)), DIMENSION(:) :: EN
COMPLEX (Kind=Kind(0.d0)) :: ZM, ZERR, Z
COMPLEX (Kind=Kind(0.d0)) :: ZM, ZERR, Z, Zhelp
COMPLEX (Kind=Kind(0.d0)), DIMENSION(:), ALLOCATABLE :: EN1
INTEGER :: NP, N, N1
......@@ -186,11 +190,13 @@
! Build the jackknife averages and send to errcalc.
Zhelp = CMPLX(0.D0, 0.D0, kind(0.D0))
DO N1 = 1,NP
Zhelp = Zhelp + EN(N1)
ENDDO
DO N = 1,NP
Z = CMPLX(0.D0, 0.D0, kind(0.D0))
DO N1 = 1,NP
IF (N1.NE.N) Z = Z + EN(N1)
ENDDO
Z = Zhelp - EN(N)
EN1(N) = Z / DBLE(NP -1)
ENDDO
CALL ERRCALC(EN1,ZM,ZERR)
......@@ -886,15 +892,18 @@
X2 = 0.0
X3 = 0.0
DO nt1 = 1, nb - ntau
X1 = X1 + DATA(nt1)*DATA(nt1 + ntau)
X2 = X2 + DATA(nt1)*DATA(nt1)
X3 = X3 + DATA(nt1)
ENDDO
X3 = X3 / dble(nb - ntau)
DO nt1 = 1, nb - ntau
X1 = X1 + (DATA(nt1)-x3)*(DATA(nt1 + ntau)-x3)
X2 = X2 + (DATA(nt1)-x3)*(DATA(nt1)-x3)
ENDDO
X1 = X1 / dble(nb - ntau)
X2 = X2 / dble(nb - ntau)
X3 = X3 / dble(nb - ntau)
Res(ntau) = ( X1 - X3**2)/(X2 - X3**2)
Res(ntau) = X1/X2
ENDDO
......
......@@ -24,16 +24,17 @@ export Libs
LIB_BLAS_LAPACK = -llapack -lblas
export LIB_BLAS_LAPACK
.PHONY: all lib ana program
all: lib ana program
lib:
cd Libraries && $(MAKE)
ana:
ana: lib
cd Analysis && $(MAKE)
program:
program: lib
cd Prog && $(MAKE)
.PHONY: clean cleanall cleanprog cleanlib cleanana help
clean: cleanall
cleanall: cleanprog cleanlib cleanana
cleanprog:
......
......@@ -7,6 +7,12 @@ for filename in *_scal; do
cp $filename Var_scal
$ANNAL/cov_scal.out
mv "Var_scalJ" $filename"J"
for filename2 in Var_scal_Auto_*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_scal/${filename}/`
mv $filename2 $NewName
fi
done
rm Var_scal
# fi
done
......@@ -15,10 +21,16 @@ for filename in *_eq; do
echo $filename
export filename1=$filename"J"
# if [ "$filename1" -ot "$filename" ]; then
cp $filename ineq
ln $filename ineq
$ANNAL/cov_eq.out
mv "equalJ" $filename"JK"
mv "equalJR" $filename"JR"
for filename2 in Var_eq_Auto_Tr*; do
if [ -e "${filename2}" ]; then
NewName=`echo ${filename2} | sed s/Var_eq/${filename}/`
mv $filename2 $NewName
fi
done
rm ineq
# fi
done
......@@ -26,7 +38,7 @@ done
for filename in *_tau; do
echo $filename
cp $filename intau
ln $filename intau
$ANNAL/cov_tau.out
rm intau
for filename1 in g_*; do
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!