ABACUS/scripts/catalogue/c_fixed_N_prog_data.sh

90 lignes
2.5 KiB
Bash
Fichiers exécutables

#! /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 nkmax * kF/4.
# For each c, the LiebLin_Catalogue_Fixed_c_Nscaling
# executable is invoked, which computes up to the highest N possible in the allocated time.
# This script is restartable: a new run will pick up where a previous left off,
# provided the previous run terminated cleanly.
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
timestart=$(date +%s)
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/c_fixed_N_prog_'$whichDSF'_kBT_'$kBT'_sr_'$target_sumrule'_nkmax_'$nkmax'_nr_minutes_'$nr_minutes'_'$(date '+%Y-%m-%d-%Hh%M')'.log'
touch $logfile
clist=(0.015625 0.03125 0.0625 0.125 0.25 0.5 1 2 4 8 16 32 64 128 256 512 1024)
basedir="$(pwd)"
for c in $clist
do
echo '** Starting run for c =' $c | tee -a $logfile
dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_fixed_N_prog/c_'$c'/k_0_to_'${(l:2::0:)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'.\n' | tee -a $logfile
done
echo '\n\n++ Successfully completed c_fixed_N_prog_data on '$(date '+%Y-%m-%d-%Hh%M')'.\n' | tee -a $logfile
timestop=$(date +%s)
duration=$(($timestop - $timestart))
hours=$(($duration/3600))
minutes=$((($duration - 3600*$hours)/60))
seconds=$(($duration - 3600*$hours - 60*$minutes)) # don't bother printing
echo 'Total time used: '$hours'h '$minutes'm.\n' | tee -a $logfile