Add scripts for c_int scan at fixed N, k
This commit is contained in:
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#! /bin/zsh
|
||||
|
||||
# For given N (L) and k_fact (multiple of kF/4), this
|
||||
# computes the required DSF (up to required sumrule)
|
||||
# over a range of values of c_int.
|
||||
|
||||
if [[ $# -ne 5 ]]; then
|
||||
echo "Arguments needed: whichDSF, kBT, target_sumrule, N, nk (momentum in units of kF/4)."
|
||||
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 "N must be > 0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $5 -lt 0 ]]; then
|
||||
echo "nk must be > 0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
whichDSF=$1
|
||||
kBT=$2
|
||||
target_sumrule=$3
|
||||
N=$4
|
||||
nk=$5
|
||||
|
||||
correlator='rho-rho'
|
||||
if [[ $whichDSF == 'o' ]]; then
|
||||
correlator='psidag-psi'
|
||||
elif [[ $whichDSF == 'g' ]]; then
|
||||
correlator='psi-psidag'
|
||||
fi
|
||||
|
||||
iK=$(($nk * $N/8))
|
||||
|
||||
Max_Secs=3600
|
||||
refine=0
|
||||
|
||||
#clist=(1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 0.03125 0.015625)
|
||||
|
||||
# List of interactions: fractional powers of 2
|
||||
clist_raw=()
|
||||
for nc in {-128..128}
|
||||
do
|
||||
clist_raw=($clist_raw $(( 4 * 2**($nc/16.) )))
|
||||
done
|
||||
# Now cast the integer values to true integers
|
||||
zmodload zsh/mathfunc
|
||||
clist=()
|
||||
for c in $clist_raw
|
||||
do
|
||||
if [[ $((floor($c))) == $((ceil($c))) ]]; then
|
||||
clist=($clist $((int($c))))
|
||||
else
|
||||
clist=($clist $c)
|
||||
fi
|
||||
done
|
||||
|
||||
basedir="$(pwd)"
|
||||
|
||||
for c in $clist
|
||||
do
|
||||
echo '** Starting run for c =' $c', N = '$N
|
||||
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_scan/k_fixed/k_'${(l:2::0:)nk}'kFo4/sr_'$target_sumrule'/N_'$N'/data/store/c_'$c
|
||||
mkdir -p $dir
|
||||
cd $dir
|
||||
LiebLin_DSF $whichDSF $c $N $N $iK $iK $kBT $Max_Secs $target_sumrule $refine
|
||||
cd $basedir
|
||||
echo ' Successfully computed DSFs for c =' $c', N = '$N'.\n'
|
||||
done
|
||||
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#! /bin/zsh
|
||||
|
||||
# For given N (L) and k_fact (multiple of kF/4), this
|
||||
# computes the smoothened dsfs for a `build_LiebLin_c_scan_k_fixed` run.
|
||||
|
||||
if [[ $# -ne 6 ]]; then
|
||||
echo "Arguments needed: whichDSF, kBT, target_sumrule, N, nk (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 "N must be > 0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $5 -lt 0 ]]; then
|
||||
echo "nk must be > 0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $6 -lt 0 ]]; then
|
||||
echo "width must be > 0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
whichDSF=$1
|
||||
kBT=$2
|
||||
target_sumrule=$3
|
||||
N=$4
|
||||
nk=$5
|
||||
width=$6
|
||||
|
||||
correlator='rho-rho'
|
||||
if [[ $whichDSF == 'o' ]]; then
|
||||
correlator='psidag-psi'
|
||||
elif [[ $whichDSF == 'g' ]]; then
|
||||
correlator='psi-psidag'
|
||||
fi
|
||||
|
||||
iK=$(($nk * $N/8))
|
||||
|
||||
ommin=0
|
||||
ommax=$(($nk*($nk + 8)))
|
||||
Nom=1000
|
||||
|
||||
#clist=(1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 0.03125 0.015625)
|
||||
|
||||
# List of interactions: fractional powers of 2
|
||||
clist_raw=()
|
||||
for nc in {-128..128}
|
||||
do
|
||||
clist_raw=($clist_raw $(( 4 * 2**($nc/16.) )))
|
||||
done
|
||||
# Now cast the integer values to true integers
|
||||
zmodload zsh/mathfunc
|
||||
clist=()
|
||||
for c in $clist_raw
|
||||
do
|
||||
if [[ $((floor($c))) == $((ceil($c))) ]]; then
|
||||
clist=($clist $((int($c))))
|
||||
else
|
||||
clist=($clist $c)
|
||||
fi
|
||||
done
|
||||
|
||||
basedir="$(pwd)"
|
||||
|
||||
for c in $clist
|
||||
do
|
||||
echo '** Starting computation of DSFs for c =' $c', N = '$N
|
||||
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_scan/k_fixed/k_'${(l:2::0:)nk}'kFo4/sr_'$target_sumrule'/N_'$N'/data/store/c_'$c
|
||||
cd $dir
|
||||
Smoothen_LiebLin_DSF_Scaled $whichDSF $c $N $N $iK $iK $kBT 0 $ommin $ommax $Nom $width
|
||||
cd $basedir
|
||||
echo ' Successfully computed DSFs for c =' $c', N = '$N'.\n'
|
||||
done
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#! /bin/zsh
|
||||
|
||||
# For given N (L) and k_fact (multiple of kF/4), this
|
||||
# produces an interactive (tunable c_int) plot for S(k, \omega)
|
||||
# from data produced from `build_LiebLin_c_scan_k_fixed[_dsfs]` scripts.
|
||||
|
||||
if [[ $# -ne 6 ]]; then
|
||||
echo "Arguments needed: whichDSF, kBT, target_sumrule, N, nk (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 "N must be > 0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $5 -lt 0 ]]; then
|
||||
echo "nk must be > 0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $6 -lt 0 ]]; then
|
||||
echo "width must be > 0."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
whichDSF=$1
|
||||
kBT=$2
|
||||
target_sumrule=$3
|
||||
N=$4
|
||||
nk=$5
|
||||
width=$6
|
||||
|
||||
correlator='rho-rho'
|
||||
if [[ $whichDSF == 'o' ]]; then
|
||||
correlator='psidag-psi'
|
||||
elif [[ $whichDSF == 'g' ]]; then
|
||||
correlator='psi-psidag'
|
||||
fi
|
||||
|
||||
iK=$(($nk * $N/8))
|
||||
|
||||
Max_Secs=3600
|
||||
refine=0
|
||||
|
||||
#clist=(1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625 0.03125 0.015625)
|
||||
|
||||
# List of interactions: fractional powers of 2
|
||||
clist_raw=()
|
||||
for nc in {-128..128}
|
||||
do
|
||||
clist_raw=($clist_raw $(( 4 * 2**($nc/16.) )))
|
||||
done
|
||||
# Now cast the integer values to true integers
|
||||
zmodload zsh/mathfunc
|
||||
clist=()
|
||||
for c in $clist_raw
|
||||
do
|
||||
if [[ $((floor($c))) == $((ceil($c))) ]]; then
|
||||
clist=($clist $((int($c))))
|
||||
else
|
||||
clist=($clist $c)
|
||||
fi
|
||||
done
|
||||
|
||||
basedir="$(pwd)"
|
||||
|
||||
echo '** Starting run for N = '$N
|
||||
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_scan/k_fixed/k_'${(l:2::0:)nk}'kFo4/sr_'$target_sumrule'/N_'$N'/data/plots'
|
||||
mkdir -p $dir
|
||||
cd $dir
|
||||
plot_c_scan_k_fixed_dsfs.py $width
|
||||
cd $basedir
|
||||
echo ' Successfully computed DSFs for N = '$N'.\n'
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
"""
|
||||
Plot fixed momentum DSF.
|
||||
|
||||
Usage: python plot_dsf_k_fixed.py [omega file] [dsf file]
|
||||
"""
|
||||
|
||||
import glob
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.animation as animation
|
||||
import numpy as np
|
||||
import os
|
||||
import sys
|
||||
|
||||
width = str(sys.argv[1])
|
||||
|
||||
|
||||
# Get the list of interactions which have been computed
|
||||
dirlist = os.listdir('../store/')
|
||||
clist = sorted([float(c.lstrip('c_')) for c in dirlist])
|
||||
|
||||
# Get the Omega file
|
||||
omegafile = glob.glob('../store/c_%s*/Omega*' % str(clist[0]).rstrip('.0')[:12])[0]
|
||||
omega = np.loadtxt(omegafile)
|
||||
|
||||
# Load all the available dsfs from the data store
|
||||
dsfs = {}
|
||||
for c in clist:
|
||||
# Do some black magic here: for matching the interaction,
|
||||
# first try for exact match, stripping '.0' to treat integer values, e.g. 4.0 into 4
|
||||
# and then (if it doesn't work) use only the first 12 characters, plus wildcard, to cover rounding errors
|
||||
try:
|
||||
dsffile = glob.glob('../store/c_%s/*_w_%s.dsfs' % (str(c).rstrip('.0'), width))[0]
|
||||
except IndexError:
|
||||
dsffile = glob.glob('../store/c_%s*/*_w_%s.dsfs' % (str(c).rstrip('.0')[:12], width))[0]
|
||||
dsfs[str(c)] = np.loadtxt(dsffile)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
|
||||
ax.set_xlim(omega[0], omega[-1])
|
||||
# To determine the y axis limits, we look at the lowest value of c (sharpest peak)
|
||||
dsfsmax = max(dsfs[str(clist[0])])
|
||||
print('dsfsmax = ', dsfsmax)
|
||||
|
||||
ymax = 1.2 * dsfsmax
|
||||
xtext = 0.6 * omega[-1]
|
||||
ytext = 1.1 * dsfsmax
|
||||
|
||||
ax.set_ylim([0, ymax])
|
||||
ax.text(xtext, ytext, f'c = {clist[0]}')
|
||||
ax.plot(omega, dsfs[str(clist[0])])
|
||||
def animate(i):
|
||||
ax.clear()
|
||||
ax.set_xlim(omega[0], omega[-1])
|
||||
ax.set_ylim([0, ymax])
|
||||
ax.text(xtext, ytext, f'c = {clist[i]:10.6f}')
|
||||
ax.plot(omega, dsfs[str(clist[i])])
|
||||
|
||||
ani = animation.FuncAnimation(fig, animate, frames=len(clist), interval=100, repeat=False)
|
||||
|
||||
outfilename = (dsffile.partition('_c_')[0].rpartition('/')[2] + '_c_scan_' +
|
||||
dsffile.partition('_c_')[2].partition('_')[2].partition('.dsfs')[0])
|
||||
|
||||
ani.save(outfilename + '.mp4')
|
||||
|
||||
with open(outfilename + '.html', 'w') as file:
|
||||
file.write(ani.to_html5_video())
|
||||
|
||||
#plt.show()
|
||||
Reference in New Issue
Block a user