Add scripts and functions for catalogue over k range

This commit is contained in:
Jean-Sébastien
2021-12-14 12:17:34 +01:00
parent 9276bc8008
commit 25f4b1ac28
7 changed files with 452 additions and 19 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ elif [[ $whichDSF == 'g' ]]; then
fi
mkdir -p logs
logfile='logs/run_'$whichDSF'_kBT_'$kBT'_sr_'$target_sumrule'_'$(date '+%Y-%m-%d-%Hh%M')'.log'
logfile='logs/run_'$whichDSF'_kBT_'$kBT'_k_fixed_sr_'$target_sumrule'_'$(date '+%Y-%m-%d-%Hh%M')'.log'
touch $logfile
clist=(1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 0.03125 0.015625)
@@ -52,25 +52,32 @@ do
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_fixed/c_'$c'/k_fixed/k_'${(l:2::0:)nk}'kFo4/sr_'$target_sumrule'/store/plots'
mkdir -p $dir
cd $dir
# Move all K_, Omega_ and .dsfs files to the plots directory
mv ../data/*/K_* .
mv ../data/*/Omega_* .
mv ../data/*/*dsfs .
dirlist="$(ls)"
# Find the Omega file
for file in *
for datadir in ../data/*
do
if [[ $file = Omega* ]]; then
omegafile=$file
fi
done
echo 'Omega file: ' $omegafile
# For each .dsfs file, plot
for file in *.dsfs
do
echo 'Found file ' $file
# invoke the python script
plot_dsf_k_fixed.py $omegafile $file
N=${datadir#"../data/N_"}
mkdir -p 'N_'$N
cd 'N_'$N
# Move all K_, Omega_ and .dsfs files here
mv ../../data/N_$N/K_* .
mv ../../data/N_$N/Omega_* .
mv ../../data/N_$N/*dsfs .
# Find the K and Omega file
for file in *
do
if [[ $file = Omega* ]]; then
omegafile=$file
fi
done
# For each .dsfs file, plot
for file in *.dsfs
do
echo 'Found file ' $file
# invoke the python script
plot_dsf_k_fixed.py $omegafile $file
done
cd ..
done
cd $basedir
+76
View File
@@ -0,0 +1,76 @@
#! /bin/zsh
# We use zsh here to support floats (not supported in bash)
# This script produces a whole stack of subdirectories,
# for a range of values of c centered on 4 with 8 up/down factors of 2,
# and momenta in range from 0 to 4kF.
# For each c, the LiebLin_Catalogue_Fixed_c_Nscaling
# executable is invoked.
if [[ $# -ne 5 ]]; then
echo "Arguments needed: whichDSF, kBT, target_sumrule, nkmax (max momentum in units of kF/4), nr_minutes (for each c value)."
exit 1
fi
if [[ $1 != 'd' && $1 != 'g' && $1 != 'o' ]]; then
echo "Only the d, g and o scanning options are implemented."
exit 1
fi
if [[ $2 -lt 0 ]]; then
echo "Temperature kBT must be > 0."
exit 1
fi
if [[ $3 -lt 0 || $3 -gt 1 ]]; then
echo "Requirement: 0 < target_sumrule < 1."
exit 1
fi
if [[ $4 -lt 0 ]]; then
echo "nkmax must be > 0."
exit 1
fi
if [[ $5 -lt 1 ]]; then
echo "Please give a positive nr_minutes."
exit 1
fi
zmodload zsh/datetime
whichDSF=$1
kBT=$2
target_sumrule=$3
nkmax=$4
nr_minutes=$5
correlator='rho-rho'
if [[ $whichDSF == 'o' ]]; then
correlator='psidag-psi'
elif [[ $whichDSF == 'g' ]]; then
correlator='psi-psidag'
fi
mkdir -p logs
logfile='logs/run_'$whichDSF'_kBT_'$kBT'_k_range_sr_'$target_sumrule'_'$(date '+%Y-%m-%d-%Hh%M')'.log'
touch $logfile
clist=(1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 0.03125 0.015625)
basedir="$(pwd)"
for c in $clist
do
echo '** Starting run for c =' $c | tee -a $logfile
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_fixed/c_'$c'/k_range/k_0_to_'$nkmax'kFo4/sr_'$target_sumrule'/prelim'
mkdir -p $dir
cd $dir
LiebLin_Catalogue_Fixed_c_Nscaling $whichDSF $c $nkmax $kBT $target_sumrule 0 $nr_minutes | tee -a $basedir/$logfile
cd $basedir
echo '** Successfully completed run for c =' $c', kfact = '$nk'.\n' | tee -a $logfile
done
+74
View File
@@ -0,0 +1,74 @@
#! /bin/zsh
# We use zsh here to support floats (not supported in bash)
# This script produces the .dsfs files for the runs from `build_LiebLin_catalogue_k_range`
# runs which achieved the required sumrule saturation.
if [[ $# -ne 5 ]]; then
echo "Arguments needed: whichDSF, kBT, target_sumrule, nkmax (max momentum in units of kF/4), width."
exit 1
fi
if [[ $1 != 'd' && $1 != 'g' && $1 != 'o' ]]; then
echo "Only the d, g and o scanning options are implemented."
exit 1
fi
if [[ $2 -lt 0 ]]; then
echo "Temperature kBT must be > 0."
exit 1
fi
if [[ $3 -lt 0 || $3 -gt 1 ]]; then
echo "Requirement: 0 < target_sumrule < 1."
exit 1
fi
if [[ $4 -lt 0 ]]; then
echo "nkmax must be > 0."
exit 1
fi
if [[ $5 -lt 0 ]]; then
echo "width must be > 0."
exit 1
fi
whichDSF=$1
kBT=$2
target_sumrule=$3
nkmax=$4
width=$5
correlator='rho-rho'
if [[ $whichDSF == 'o' ]]; then
correlator='psidag-psi'
elif [[ $whichDSF == 'g' ]]; then
correlator='psi-psidag'
fi
clist=(1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 0.03125 0.015625)
basedir="$(pwd)"
ommin=0
ommax=$(($nkmax*($nkmax - 8))) # use lower branch of 1ph continuum
Nom=1000
for c in $clist
do
echo 'Starting computation of DSFs for c =' $c
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_fixed/c_'$c'/k_range/k_0_to_'${(l:2::0:)nkmax}'kFo4/sr_'$target_sumrule'/store/data'
cd $dir
for datadir in *
do
cd $datadir
N=${datadir#"N_"}
iKmax=$(($nkmax * $N/8))
Smoothen_LiebLin_DSF_Scaled $whichDSF $c $N $N 0 $iKmax $kBT 0 $ommin $ommax $Nom $width
cd ..
done
cd $basedir
echo ' Successfully computed DSFs for c =' $c
done
+95
View File
@@ -0,0 +1,95 @@
#! /bin/zsh
# We use zsh here to support floats (not supported in bash)
# This script produces the plots for the runs from `build_LiebLin_catalogue_k_range`
# runs which achieved the required sumrule saturation.
if [[ $# -ne 5 ]]; then
echo "Arguments needed: whichDSF, kBT, target_sumrule, nkmax (max momentum in units of kF/4), width."
exit 1
fi
if [[ $1 != 'd' && $1 != 'g' && $1 != 'o' ]]; then
echo "Only the d, g and o scanning options are implemented."
exit 1
fi
if [[ $2 -lt 0 ]]; then
echo "Temperature kBT must be > 0."
exit 1
fi
if [[ $3 -lt 0 || $3 -gt 1 ]]; then
echo "Requirement: 0 < target_sumrule < 1."
exit 1
fi
if [[ $4 -lt 0 ]]; then
echo "nkmax must be > 0."
exit 1
fi
if [[ $5 -lt 0 ]]; then
echo "width must be > 0."
exit 1
fi
whichDSF=$1
kBT=$2
target_sumrule=$3
nkmax=$4
width=$5
correlator='rho-rho'
if [[ $whichDSF == 'o' ]]; then
correlator='psidag-psi'
elif [[ $whichDSF == 'g' ]]; then
correlator='psi-psidag'
fi
clist=(1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 0.03125 0.015625)
basedir="$(pwd)"
for c in $clist
do
echo '** Starting plotting of DSFs for c =' $c
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_fixed/c_'$c'/k_range/k_0_to_'${(l:2::0:)nkmax}'kFo4/sr_'$target_sumrule'/store/plots'
mkdir -p $dir
cd $dir
for datadir in ../data/*
do
N=${datadir#"../data/N_"}
mkdir -p 'N_'$N
cd 'N_'$N
# Move all K_, Omega_ and .dsfs files here
mv ../../data/N_$N/K_* .
mv ../../data/N_$N/Omega_* .
mv ../../data/N_$N/*dsfs .
# Find the K and Omega file
for file in *
do
if [[ $file = Omega* ]]; then
omegafile=$file
elif [[ $file = K_* ]]; then
kfile=$file
fi
done
# For each .dsfs file, plot
for file in *.dsfs
do
echo 'Found file ' $file
# invoke the python script
plot_dsf_k_range.py $kfile $omegafile $file
done
cd ..
done
cd $basedir
echo '** Successfully plotted DSFs for c =' $c'.\n'
done
+39
View File
@@ -0,0 +1,39 @@
#! /usr/bin/env python
"""
Plot DSF.
Usage: python plot_dsf_k_range.py [k file] [omega file] [dsf file]
"""
import matplotlib.pyplot as plt
import numpy as np
import sys
kfile = str(sys.argv[1])
omegafile = str(sys.argv[2])
dsffile = str(sys.argv[3])
k = np.loadtxt(kfile)
omega = np.loadtxt(omegafile)
dsf = np.loadtxt(dsffile)
dsfsmax = 0.5
plt.pcolormesh(k, omega, dsf, vmax=dsfsmax)
plt.colorbar()
plt.xlabel('$k$')
plt.ylabel('$\omega$')
elements = dsffile.split('_')
c_int = elements[3]
L = elements[5]
N = elements[7]
width = elements[22].partition('.')[0]
rho = int(N)/int(L)
plt.title(f'c={c_int}, rho={rho} (N={N}), w={width}')
plt.savefig(dsffile.replace('.', '_') + '.png')