You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

c_scan_N_fixed_data.sh 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #! /bin/zsh
  2. # For given N (L), this
  3. # computes the required DSF (up to required sumrule)
  4. # over a range of values of c_int.
  5. # The data can then be used to produce animated graphs (with c_int evolving),
  6. # see the `c_scan_N_fixed_dsfs[_plot]` scripts.
  7. if [[ $# -ne 7 ]]; then
  8. echo "Arguments needed: whichDSF, kBT, target_sumrule, N, nkmax (max momentum in units of kF/4), Max_Secs (per c), refine."
  9. exit 1
  10. fi
  11. if [[ $1 != 'd' && $1 != 'g' && $1 != 'o' ]]; then
  12. echo "Only the d, g and o scanning options are implemented."
  13. exit 1
  14. fi
  15. if [[ $2 -lt 0 ]]; then
  16. echo "Temperature kBT must be > 0."
  17. exit 1
  18. fi
  19. if [[ $3 -lt 0 || $3 -gt 1 ]]; then
  20. echo "Requirement: 0 < target_sumrule < 1."
  21. exit 1
  22. fi
  23. if [[ $4 -lt 0 ]]; then
  24. echo "N must be > 0."
  25. exit 1
  26. fi
  27. if [[ $5 -lt 0 ]]; then
  28. echo "nkmax must be > 0."
  29. exit 1
  30. fi
  31. if [[ $6 -lt 0 ]]; then
  32. echo "Max_Secs must be > 0."
  33. exit 1
  34. fi
  35. if [[ $7 != 0 && $7 != 1 ]]; then
  36. echo "refine must be 0 (false) or 1 (true)."
  37. exit 1
  38. fi
  39. timestart=$(date +%s)
  40. whichDSF=$1
  41. kBT=$2
  42. target_sumrule=$3
  43. N=$4
  44. nkmax=$5
  45. Max_Secs=$6
  46. refine=$7
  47. correlator='rho-rho'
  48. if [[ $whichDSF == 'o' ]]; then
  49. correlator='psidag-psi'
  50. elif [[ $whichDSF == 'g' ]]; then
  51. correlator='psi-psidag'
  52. fi
  53. mkdir -p logs
  54. logfile='logs/c_scan_N_fixed_'$whichDSF'_kBT_'$kBT'_sr_'$target_sumrule'_N_'$N'_nkmax_'$nkmax'_'$(date '+%Y-%m-%d-%Hh%M')'.log'
  55. touch $logfile
  56. iKmax=$(($nkmax * $N/8))
  57. # List of interactions: fractional powers of 2
  58. clist_raw=()
  59. for nc in {-160..160}
  60. do
  61. clist_raw=($clist_raw $(( 4 * 2**($nc/16.) )))
  62. done
  63. # Now cast the integer values to true integers
  64. zmodload zsh/mathfunc
  65. clist=()
  66. for c in $clist_raw
  67. do
  68. if [[ $((floor($c))) == $((ceil($c))) ]]; then
  69. clist=($clist $((int($c))))
  70. else
  71. clist=($clist $c)
  72. fi
  73. done
  74. basedir="$(pwd)"
  75. # Safety barrier:
  76. # if directory exists, don't do anything and request directory deletion before proceeding
  77. dircheck='Lieb-Liniger/'$correlator'/T_'$kBT'/c_scan_N_fixed/k_0_to_'${(l:2::0:)nkmax}'kFo4/sr_'$target_sumrule'/store/data/N_'$N
  78. if [[ -d $dircheck ]]; then
  79. echo 'A c scan with these parameters already exists. Aborting.'
  80. echo 'If you really want to run this command, please first delete directory:\n'$dircheck
  81. exit 1
  82. fi
  83. for c in $clist
  84. do
  85. echo '** Starting run for c =' $c', N = '$N | tee -a $logfile
  86. dir='Lieb-Liniger/'$correlator'/T_'$kBT'/c_scan_N_fixed/k_0_to_'${(l:2::0:)nkmax}'kFo4/sr_'$target_sumrule'/store/data/N_'$N'/c_'$c
  87. mkdir -p $dir
  88. cd $dir
  89. clock1=$(date +%s)
  90. LiebLin_DSF $whichDSF $c $N $N 0 $iKmax $kBT $Max_Secs $target_sumrule $refine
  91. clock2=$(date +%s)
  92. dt=$(($clock2 - $clock1))
  93. dt_hrs=$(($dt/3600))
  94. dt_min=$((($dt - 3600*$dt_hrs)/60))
  95. dt_sec=$(($dt - 3600*$dt_hrs - 60*$dt_min))
  96. cd $basedir
  97. echo '++ Successfully computed DSFs for c =' $c', N = '$N'.' | tee -a $logfile
  98. echo 'Time required: '$dt_hrs'h '$dt_min'm '$dt_sec's.\n' | tee -a $logfile
  99. done
  100. echo '\n++ Successfully completed c_scan_N_fixed_data for N = '$N' on '$(date '+%Y-%m-%d-%Hh%M')'.\n' | tee -a $logfile
  101. timestop=$(date +%s)
  102. duration=$(($timestop - $timestart))
  103. hours=$(($duration/3600))
  104. minutes=$((($duration - 3600*$hours)/60))
  105. seconds=$(($duration - 3600*$hours - 60*$minutes)) # don't bother printing
  106. echo 'Total time required: '$hours'h '$minutes'm.\n' | tee -a $logfile