From 484b5195477a6241243f7443da0a368b1c9acd3e Mon Sep 17 00:00:00 2001 From: Sofia Kostoglou Date: Tue, 27 Feb 2018 09:19:31 +0100 Subject: [PATCH 1/4] fort13 added --- utilities/bash/dot_profile | 19 +++ utilities/bash/mad6t.sh | 9 +- utilities/bash/run_six.sh | 214 +++++++++++++++++++++--------- utilities/bash/set_env.sh | 91 +++++++++---- utilities/templates/lsf/mad6t1.sh | 20 ++- 5 files changed, 261 insertions(+), 92 deletions(-) diff --git a/utilities/bash/dot_profile b/utilities/bash/dot_profile index 068fe00..4f64dc6 100755 --- a/utilities/bash/dot_profile +++ b/utilities/bash/dot_profile @@ -685,6 +685,25 @@ sixdeskAllTunes(){ tunesYY=( ${tunesYY} ) inttunesYY=( ${inttunesYY} ) } +sixdeskAllAmplitudes_fort13(){ + pairs_per_job=$((sixdeskpairs*15)) + if [ -d "${sixdeskjobs_logs}/fort.13_jobs" ]; then + rm -rf ${sixdeskjobs_logs}/fort.13_jobs/* + else + mkdir ${sixdeskjobs_logs}/fort.13_jobs + fi + split -d -l $pairs_per_job fort.13 ${sixdeskjobs_logs}/fort.13_jobs/fort.13. + fort13_jobs=( $(find ${sixdeskjobs_logs}/fort.13_jobs/ -type f -name 'fort.13.*') ) + nb_fort13_jobs=${#fort13_jobs[@]} + echo Fort.13 will be split in $nb_fort13_jobs jobs + allAmplitudeSteps=( $(seq 1 1 $nb_fort13_jobs) ) + fAmpStarts=("${allAmplitudeSteps[@]}") + fAmpEnds=("${allAmplitudeSteps[@]}") + ampstart=${fAmpStarts[0]} + let __iLast=${#fAmpEnds[@]}-1 + ampfinish=${fAmpEnds[${__iLast}]} +} + sixdeskAllAmplitudes(){ # A.Mereghetti, 2017-04-08 # new function, to generate all amplitude steps diff --git a/utilities/bash/mad6t.sh b/utilities/bash/mad6t.sh index 3b0173b..315627f 100755 --- a/utilities/bash/mad6t.sh +++ b/utilities/bash/mad6t.sh @@ -150,9 +150,13 @@ function submit(){ # Loop over seeds mad6tjob=$lsfFilesPath/mad6t1.sh for (( iMad=$istamad ; iMad<=$iendmad ; iMad++ )) ; do - + if [ ${lflag_fort13} = true ] ; then + files="2 8 13 16 34" + else + files="2 8 16 34" + fi # clean away any existing results for this seed - for f in 2 8 16 34 ; do + for f in files ; do rm -f $sixtrack_input/fort.$f"_"$iMad.gz done @@ -168,6 +172,7 @@ function submit(){ -e 's?%FORT_34%?'$fort_34'?g' \ -e 's?%MADX_PATH%?'$MADX_PATH'?g' \ -e 's?%MADX%?'$MADX'?g' \ + -e 's?%lflag_fort13%?'$lflag_fort13'?g' \ -e 's?%SIXTRACK_INPUT%?'$sixtrack_input'?g' $mad6tjob > mad6t_"$iMad".sh chmod 755 mad6t_"$iMad".sh diff --git a/utilities/bash/run_six.sh b/utilities/bash/run_six.sh index 9ed7549..655c25c 100755 --- a/utilities/bash/run_six.sh +++ b/utilities/bash/run_six.sh @@ -264,23 +264,43 @@ function preProcessFort3(){ local __dp1=.0 local __dp2=.0 fi - sed -e 's/%turnss/%turnsl/g' \ - -e 's/%nss/'$sixdeskpairs'/g' \ - -e 's/%imc/'$__imc'/g' \ - -e 's/%iclo6/'$__iclo6'/g' \ - -e 's/%ax0s/%ax0l/g' \ - -e 's/%ax1s/%ax1l/g' \ - -e 's/%writebins/%writebinl/g' \ - -e 's/%ratios/%ratiol/g' \ - -e 's/%dp1/'$__dp1'/g' \ - -e 's/%dp2/'$__dp2'/g' \ - -e 's/%e0/'$e0'/g' \ - -e 's/%ition/'$__ition'/g' \ - -e 's/%idfor/'$idfor'/g' \ - -e 's/%ibtype/'$ibtype'/g' \ - -e 's/%bunch_charge/'$bunch_charge'/g' \ - -e 's?%Runnam?%Runnam '"$sixdeskTitle"'?g' \ - $sixdeskjobs_logs/fort.3.mother1 > $sixdeskjobs_logs/fortl.3.mask + + if [ $lflag_fort13 ]; then + sed -e 's/%turnss/%turnsl/g' \ + -e 's/%imc/'$__imc'/g' \ + -e 's/%iclo6/'$__iclo6'/g' \ + -e 's/%ax0s/%ax0l/g' \ + -e 's/%ax1s/%ax1l/g' \ + -e 's/%writebins/%writebinl/g' \ + -e 's/%ratios/%ratiol/g' \ + -e 's/%dp1/'$__dp1'/g' \ + -e 's/%dp2/'$__dp2'/g' \ + -e 's/%e0/'$e0'/g' \ + -e 's/%ition/'$__ition'/g' \ + -e 's/%idfor/'$idfor'/g' \ + -e 's/%ibtype/'$ibtype'/g' \ + -e 's/%bunch_charge/'$bunch_charge'/g' \ + -e 's?%Runnam?%Runnam '"$sixdeskTitle"'?g' \ + $sixdeskjobs_logs/fort.3.mother1 > $sixdeskjobs_logs/fortl.3.mask + else + sed -e 's/%turnss/%turnsl/g' \ + -e 's/%nss/'$sixdeskpairs'/g' \ + -e 's/%imc/'$__imc'/g' \ + -e 's/%iclo6/'$__iclo6'/g' \ + -e 's/%ax0s/%ax0l/g' \ + -e 's/%ax1s/%ax1l/g' \ + -e 's/%writebins/%writebinl/g' \ + -e 's/%ratios/%ratiol/g' \ + -e 's/%dp1/'$__dp1'/g' \ + -e 's/%dp2/'$__dp2'/g' \ + -e 's/%e0/'$e0'/g' \ + -e 's/%ition/'$__ition'/g' \ + -e 's/%idfor/'$idfor'/g' \ + -e 's/%ibtype/'$ibtype'/g' \ + -e 's/%bunch_charge/'$bunch_charge'/g' \ + -e 's?%Runnam?%Runnam '"$sixdeskTitle"'?g' \ + $sixdeskjobs_logs/fort.3.mother1 > $sixdeskjobs_logs/fortl.3.mask + fi let __lerr+=$? # - multipole blocks cat $sixdeskjobs_logs/fort.3.mad >> $sixdeskjobs_logs/fortl.3.mask @@ -508,7 +528,11 @@ function preProcessBoinc(){ function submitChromaJobs(){ local __destination=$1 - local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:sixdesklock:chromaJob0?:lin*:betaJob' + if [ ${lflag_fort13} = true ]; then + local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:fort.13*:sixdesklock:chromaJob0?:lin*:betaJob' + else + local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:sixdesklock:chromaJob0?:lin*:betaJob' + fi # -------------------------------------------------------------------------- # generate appropriate fort.3 files as: fort.3.tx + fort.3.mad + fort.3.m2 @@ -579,6 +603,9 @@ function submitChromaJobs(){ sixdeskmess 1 "Running the first one turn job for chromaticity" cat fort.3.t1 fort.3.mad fort.3.m2 > fort.3 rm -f fort.10 + if [ ${lflag_fort13} = true ]; then + cp $sixdeskhome/fort.13 . + fi $SIXTRACKEXE > first_oneturn if test $? -ne 0 -o ! -s fort.10 ; then sixdeskmess -1 "The first turn Sixtrack for chromaticity FAILED!!!" @@ -588,8 +615,12 @@ function submitChromaJobs(){ fi # save all interesting files from first job rm -rf chromaJob01 - mkdir chromaJob01 - cp fort.2 fort.3 fort.8 fort.16 fort.10 first_oneturn chromaJob01 + mkdir chromaJob01 + if [ ${lflag_fort13} = true ]; then + cp fort.2 fort.3 fort.8 fort.16 fort.10 fort.13 first_oneturn chromaJob01 + else + cp fort.2 fort.3 fort.8 fort.16 fort.10 first_oneturn chromaJob01 + fi gzip -f chromaJob01/* mv fort.10 fort.10_first_oneturn # clean dir @@ -601,6 +632,9 @@ function submitChromaJobs(){ sixdeskmess 1 "Running the second one turn job for chromaticity" cat fort.3.t2 fort.3.mad fort.3.m2 > fort.3 rm -f fort.10 + if [ ${lflag_fort13} = true ]; then + cp $sixdeskhome/fort.13 . + fi $SIXTRACKEXE > second_oneturn if test $? -ne 0 -o ! -s fort.10 ; then sixdeskmess -1 "The second turn Sixtrack for chromaticity FAILED!!!" @@ -611,7 +645,11 @@ function submitChromaJobs(){ # save all interesting files from second job rm -rf chromaJob02 mkdir chromaJob02 - cp fort.2 fort.3 fort.8 fort.16 fort.10 second_oneturn chromaJob02 + if [ ${lflag_fort13} = true ]; then + cp fort.2 fort.3 fort.8 fort.16 fort.10 fort.13 second_oneturn chromaJob02 + else + cp fort.2 fort.3 fort.8 fort.16 fort.10 second_oneturn chromaJob02 + fi gzip -f chromaJob02/* mv fort.10 fort.10_second_oneturn # clean dir @@ -633,8 +671,11 @@ function submitChromaJobs(){ function submitBetaJob(){ local __destination=$1 - local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:sixdesklock:chromaJob0?:lin*:betaJob' - + if [ ${lflag_fort13} = true ];then + local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:fort.13*:sixdesklock:chromaJob0?:lin*:betaJob' + else + local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:sixdesklock:chromaJob0?:lin*:betaJob' + fi # -------------------------------------------------------------------------- # generate appropriate fort.3 files as: fort.3.m1 + fort.3.mad + fort.3.m2 sed -e 's/%turnss/'1'/g' \ @@ -681,6 +722,9 @@ function submitBetaJob(){ # -------------------------------------------------------------------------- # actually run rm -f fort.10 + if [ ${lflag_fort13} = true ];then + cp $sixdeskhome/fort.13 . + fi $SIXTRACKEXE > lin if test $? -ne 0 -o ! -s fort.10 ; then sixdeskmess -1 "The one turn Sixtrack for betavalues FAILED!!!" @@ -691,7 +735,11 @@ function submitBetaJob(){ # save all interesting files from beta job rm -rf betaJob mkdir betaJob - cp fort.2 fort.3 fort.8 fort.16 fort.10 lin betaJob + if [ ${lflag_fort13} = true ];then + cp fort.2 fort.3 fort.8 fort.16 fort.10 fort.13 lin betaJob + else + cp fort.2 fort.3 fort.8 fort.16 fort.10 fort.13 lin betaJob + fi gzip -f betaJob/* mv lin lin_old cp fort.10 fort.10_old @@ -760,18 +808,28 @@ function submitCreateFinalFort3Short(){ function submitCreateFinalFort3Long(){ - local __lerr=0 - # returns ratio - sixdeskRatio $kang $lbackcomp - [ -n "${ratio}" ] || let __lerr+=1 - # returns ax0 and ax1 - sixdeskax0 $factor $beta_x $beta_x2 $beta_y $beta_y2 $ratio $kang $square $fampstart $fampend $lbackcomp - [ -n "${ax0}" ] || let __lerr+=1 - [ -n "${ax1}" ] || let __lerr+=1 + if [ $lflag_fort13 ]; then + ax0=0.0 + ax1=0.0 + cp ${fort13_jobs[${nConsidered} -1]} $sixdeskjobs_logs/fort.13 + fort13_current=$sixdeskjobs_logs/fort.13 + n_lines_fort13_current=$(cat $fort13_current | wc -l ) + sixdeskpairs_current=$(echo $n_lines_fort13_current 15 | awk '{printf ("%.f", ($1/$2))}') + else + local __lerr=0 + # returns ratio + sixdeskRatio $kang $lbackcomp + [ -n "${ratio}" ] || let __lerr+=1 + # returns ax0 and ax1 + sixdeskax0 $factor $beta_x $beta_x2 $beta_y $beta_y2 $ratio $kang $square $fampstart $fampend $lbackcomp + [ -n "${ax0}" ] || let __lerr+=1 + [ -n "${ax1}" ] || let __lerr+=1 + fi # sed -e 's/%turnsl/'$turnsl'/g' \ -e 's/%ax0l/'$ax0'/g' \ + -e 's/%nss/'$sixdeskpairs_current'/g' \ -e 's/%ax1l/'$ax1'/g' \ -e 's/%ratiol/'$ratio'/g' \ -e 's/%tunex/'$tunexx'/g' \ @@ -800,8 +858,12 @@ function submitCreateFinalInputs(){ sixdeskmess 1 "Taking care of SIXTRACK fort.2/fort.3/fort.8/fort.16 in $RundirFullPath" # fort.3 - gzip -c $sixdeskjobs_logs/fort.3 > $RundirFullPath/fort.3.gz - + if [ $lflag_fort13 ];then + gzip -c $fort13_current > $RundirFullPath/fort.13.gz + gzip -c $sixdeskjobs_logs/fort.3 > $RundirFullPath/fort.3.gz + else + gzip -c $sixdeskjobs_logs/fort.3 > $RundirFullPath/fort.3.gz + fi # input from MADX: fort.2/.8/.16 for iFort in 2 8 16 ; do [ ! -e $RundirFullPath/fort.${iFort}.gz ] || rm -f $RundirFullPath/fort.${iFort}.gz @@ -1435,9 +1497,14 @@ function treatLong(){ # separate output for current case from previous one echo "" - - sixdeskmess -1 "Considering amplitude step: $Ampl" - + + if [ $lflag_fort13=true ];then + sixdeskmess -1 "Considering job #$Ampl from fort.13" + else + sixdeskmess -1 "Considering amplitude step: $Ampl" + fi + #echo $lflag_fort13 hereeeeee2 + #exit if ${lReduceAngsWithAmplitude}; then jAmple=${iAmple} else @@ -2173,7 +2240,13 @@ if ${lgenerate} || ${lfix} ; then echo "$emit $gamma" > $sixdesktrackStudy/general_input let __lerr+=$? # - set up of fort.3 - for tmpFile in fort.3.mad fort.3.mother1 fort.3.mother2 ; do + if [ $lflag_fort13 = false ]; then + tmpFiles=(fort.3.mad fort.3.mother1 fort.3.mother2) + else + tmpFiles=(fort.3.mad fort.3.mother1 fort.3.mother2 fort.13) + fi + #for tmpFile in fort.3.mad fort.3.mother1 fort.3.mother2 ; do + for tmpFile in ${tmpFiles[@]}; do cp ${sixtrack_input}/${tmpFile} $sixdeskjobs_logs if [ $? -ne 0 ] ; then sixdeskmess -1 "unable to copy ${sixtrack_input}/${tmpFile} to $sixdeskjobs_logs" @@ -2378,30 +2451,41 @@ else sixdeskmess -1 " --> along a line in (Qx,Qy) - total: ${iTotalTunes} pairs;" fi fi - if [ $long -eq 1 ] ; then - # generate array of amplitudes (it returns allAmplitudeSteps, fAmpStarts, fAmpEnds, ampstart, ampfinish) - sixdeskAllAmplitudes - iTotalAmplitudeSteps=${#allAmplitudeSteps[@]} - sixdeskmess -1 "- Amplitudes: from $ns1l to $ns2l by $nsincl - total: ${iTotalAmplitudeSteps} amplitude steps;" - # generate array of angles (it returns KKs, Angles and kAngs, and KKs_ampl) - sixdeskAllAngles $kinil $kendl $kmaxl $kstep $ampstart $ampfinish $lbackcomp ${lReduceAngsWithAmplitude} ${totAngle} ${ampFactor} - iTotalAngles=${#KKs[@]} - sixdeskmess -1 "- Angles: $kinil, $kendl, $kmaxl by $kstep - total: ${iTotalAngles} angles" - if ${lReduceAngsWithAmplitude} ; then - sixdeskmess -1 " --> reduced angles with amplitude functionality active" - let iTotal=${iTotalMad}*${iTotalTunes}*${iTotalAngles} - else - let iTotal=${iTotalMad}*${iTotalTunes}*${iTotalAmplitudeSteps}*${iTotalAngles} - fi - elif [ $short -eq 1 ] || [ $da -eq 1 ] ; then - iTotalAmplitudeSteps=1 - sixdeskmess -1 "- Amplitudes: from $ns1s to $ns2s by $nss - total: ${iTotalAmplitudeSteps} amplitude steps;" - # generate array of angles (it returns KKs, Angles and kAngs, and KKs_ampl) - sixdeskAllAngles $kini $kend $kmax $kstep $ampstart $ampfinish $lbackcomp ${lReduceAngsWithAmplitude} ${totAngle} ${ampFactor} - iTotalAngles=${#KKs[@]} - sixdeskmess -1 "- Angles: $kini, $kend, $kmax by $kstep - total: ${iTotalAngles} angles" - let iTotal=${iTotalMad}*${iTotalTunes}*${iTotalAmplitudeSteps}*${iTotalAngles} - fi + if [ $lflag_fort13 = false ]; then + if [ $long -eq 1 ] ; then + # generate array of amplitudes (it returns allAmplitudeSteps, fAmpStarts, fAmpEnds, ampstart, ampfinish) + sixdeskAllAmplitudes + iTotalAmplitudeSteps=${#allAmplitudeSteps[@]} + sixdeskmess -1 "- Amplitudes: from $ns1l to $ns2l by $nsincl - total: ${iTotalAmplitudeSteps} amplitude steps;" + # generate array of angles (it returns KKs, Angles and kAngs, and KKs_ampl) + sixdeskAllAngles $kinil $kendl $kmaxl $kstep $ampstart $ampfinish $lbackcomp ${lReduceAngsWithAmplitude} ${totAngle} ${ampFactor} + iTotalAngles=${#KKs[@]} + sixdeskmess -1 "- Angles: $kinil, $kendl, $kmaxl by $kstep - total: ${iTotalAngles} angles" + if ${lReduceAngsWithAmplitude} ; then + sixdeskmess -1 " --> reduced angles with amplitude functionality active" + let iTotal=${iTotalMad}*${iTotalTunes}*${iTotalAngles} + else + let iTotal=${iTotalMad}*${iTotalTunes}*${iTotalAmplitudeSteps}*${iTotalAngles} + fi + elif [ $short -eq 1 ] || [ $da -eq 1 ] ; then + iTotalAmplitudeSteps=1 + sixdeskmess -1 "- Amplitudes: from $ns1s to $ns2s by $nss - total: ${iTotalAmplitudeSteps} amplitude steps;" + # generate array of angles (it returns KKs, Angles and kAngs, and KKs_ampl) + sixdeskAllAngles $kini $kend $kmax $kstep $ampstart $ampfinish $lbackcomp ${lReduceAngsWithAmplitude} ${totAngle} ${ampFactor} + iTotalAngles=${#KKs[@]} + sixdeskmess -1 "- Angles: $kini, $kend, $kmax by $kstep - total: ${iTotalAngles} angles" + let iTotal=${iTotalMad}*${iTotalTunes}*${iTotalAmplitudeSteps}*${iTotalAngles} + sixdeskmess -1 "for a total of ${iTotal} points." + fi + else + echo "-> Flag for fort.13 input is active" + ## To be changed!! + sixdeskAllAmplitudes_fort13 + sixdeskAllAngles $kinil $kendl $kmaxl $kstep $ampstart $ampfinish $lbackcomp ${lReduceAngsWithAmplitude} ${totAngle} ${ampFactor} + iTotalAmplitudeSteps=${#allAmplitudeSteps[@]} + iTotalAngles=${#KKs[@]} + fi + let iTotal=${iTotalMad}*${iTotalTunes}*${iTotalAmplitudeSteps}*${iTotalAngles} sixdeskmess -1 "for a total of ${iTotal} points." fi @@ -2430,7 +2514,11 @@ else echo "" sixdeskmess -1 "MADX seed $iMad" if ${lgenerate} || ${lfix} ; then - iForts="2 8 16" + if [ ${lflag_fort13} = true ] ; then + iForts="2 8 13 16" + else + iForts="2 8 16" + fi if [ "$fort_34" != "" ] ; then iForts="${iForts} 34" fi diff --git a/utilities/bash/set_env.sh b/utilities/bash/set_env.sh index 751a511..8667ea8 100755 --- a/utilities/bash/set_env.sh +++ b/utilities/bash/set_env.sh @@ -139,35 +139,74 @@ function setFurtherEnvs(){ # set exes sixdeskSetExes # scan angles: - lReduceAngsWithAmplitude=false - - if [ -n "${reduce_angs_with_aplitude}" ] ; then - sixdeskmess -1 "wrong spelling of reduce_angs_with_amplitude. Please correct it for future use" - reduce_angs_with_amplitude=${reduce_angs_with_aplitude} - fi - - if [ -z "${reduce_angs_with_amplitude}" ]; then - reduce_angs_with_amplitude=0 - elif (( $(echo "${reduce_angs_with_amplitude}" | awk '{print ($1 >=0)}') )); then - if [ ${long} -ne 1 ]; then - sixdeskmess -1 "reduced angles with amplitudes available only for long simulations!" + lflag_fort13=false + ## if flag exists in sixdeskenv + if [ -n "${flag_fort13}" ]; then + ### if flag is > 0 + if (( $(echo "${flag_fort13}" | awk '{print ($1 > 0)}'))); then + ## if fort.13 exists in sixjobs and it is not empty + if [ -s $sixdeskhome/fort.13 ]; then + n_lines_fort13=$(cat ${sixdeskhome}/fort.13 | wc -l ) + ## if the number of lines is divided by 15 + if (( $n_lines_fort13 % 15 == 0 ));then + ## if it is a long run + if [ ${long} -eq 1 ] ; then + lflag_fort13=true + idfor=2 + ## lock at 1 angle + kinil=1 + kendl=1 + kmaxl=1 + sixdeskmess="Flag for fort.13 is ON. The initial distribution will be created from the fort.13 file. idfor is set to 2" + sixdeskmess + else + sixdeskmess -1 "Fort.13 input is implemented only for long runs" + sixdeskexit 9 + fi + else + sixdeskmess -1 "The format of the fort.13 is not correct" sixdeskexit 9 + fi else - if [ ${kinil} -ne 1 ] || [ ${kendl} -ne ${kmaxl} ] || [ ${kstep} -ne 1 ]; then - sixdeskmess -1 "reduced angles with amplitudes available only for kmin=1, kend=kmax and kstep=1" - sixdeskexit 10 - elif (( $(echo "${reduce_angs_with_amplitude} ${ns2l}" | awk '{print ($1 >= $2)}') )); then - sixdeskmess -1 "reduced angles with amplitudes flag greater than maximum amplitude. Please de-activate the flag" - sixdeskexit 11 - else - lReduceAngsWithAmplitude=true - fi + sixdeskmess -1 "Flag for fort.13 is activated but fort.13 file was not found in ${sixdeskhome} or is empty. Either de-activate the flag or include a fort.13 " + sixdeskexit 9 fi - else - sixdeskmess -1 "reduced angles with amplitudes set to negative value. Flag de-activated" + fi + fi + + lReduceAngsWithAmplitude=false + if [ $lflag_fort13 = false ]; then + if [ -n "${reduce_angs_with_aplitude}" ] ; then + sixdeskmess -1 "wrong spelling of reduce_angs_with_amplitude. Please correct it for future use" + reduce_angs_with_amplitude=${reduce_angs_with_aplitude} + fi + + if [ -z "${reduce_angs_with_amplitude}" ]; then + reduce_angs_with_amplitude=0 + elif (( $(echo "${reduce_angs_with_amplitude}" | awk '{print ($1 >=0)}') )); then + if [ ${long} -ne 1 ]; then + sixdeskmess -1 "reduced angles with amplitudes available only for long simulations!" + sixdeskexit 9 + else + if [ ${kinil} -ne 1 ] || [ ${kendl} -ne ${kmaxl} ] || [ ${kstep} -ne 1 ]; then + sixdeskmess -1 "reduced angles with amplitudes available only for kmin=1, kend=kmax and kstep=1" + sixdeskexit 10 + elif (( $(echo "${reduce_angs_with_amplitude} ${ns2l}" | awk '{print ($1 >= $2)}') )); then + sixdeskmess -1 "reduced angles with amplitudes flag greater than maximum amplitude. Please de-activate the flag" + sixdeskexit 11 + else + lReduceAngsWithAmplitude=true + fi + fi + else + sixdeskmess -1 "reduced angles with amplitudes set to negative value. Flag de-activated" + fi + fi + export totAngle=90 export lReduceAngsWithAmplitude + export lflag_fort13 } # ============================================================================== @@ -481,6 +520,9 @@ else if ${llocalfort3} ; then cp ${envFilesPath}/fort.3.local studies/${LHCDescrip} fi + if ${lflag_fort13} ; then + cp ${envFilesPath}/fort.13 studies/${LHCDescrip} + fi if ${__lnew} ; then # new study sixdeskmess -1 "Created a NEW study $LHCDescrip" @@ -494,6 +536,9 @@ else if ${llocalfort3} ; then cp ${envFilesPath}/fort.3.local . fi + if ${lflag_fort13} ; then + cp ${envFilesPath}/fort.13 . + fi sixdeskmess -1 "Switched to study $LHCDescrip" fi fi diff --git a/utilities/templates/lsf/mad6t1.sh b/utilities/templates/lsf/mad6t1.sh index fb55cb0..cffa3f9 100644 --- a/utilities/templates/lsf/mad6t1.sh +++ b/utilities/templates/lsf/mad6t1.sh @@ -7,6 +7,7 @@ export CORR_TEST=%CORR_TEST% export fort_34=%FORT_34% export MADX_PATH=%MADX_PATH% export MADX=%MADX% +export lflag_fort13=%lflag_fort13% echo "Calling madx version $MADX in $MADX_PATH" $MADX_PATH/$MADX < $junktmp/$filejob."$i" > $filejob.out."$i" cp -f $filejob.out."$i" $junktmp @@ -115,7 +116,12 @@ touch fc.34 mv fc.2 fort.2 mv fc.16 fort.16 mv fc.8 fort.8 -for fil in fort.2 fort.8 fort.16 +if [ $lflag_fort13 = true ]; then + fils=(fort.2 fort.8 fort.13 fort.16) +else + fils=(fort.2 fort.8 fort.16) +fi +for fil in ${fils[@]} do if test -s $sixtrack_input/"$fil"_"$i".gz then @@ -131,9 +137,15 @@ do cat diffs >> $sixtrack_input/WARNINGS fi fi - mv "$fil" "$fil"_"$i" - gzip "$fil"_"$i" - cp "$fil"_"$i".gz $sixtrack_input + if [ $fil = "fort.13" ];then + cp $sixdeskhome/fort.13 $sixtrack_input + cp $sixtrack_input/fort.13 $sixtrack_input/fort.13_$i + gzip $sixtrack_input/fort.13_$i + else + mv "$fil" "$fil"_"$i" + gzip "$fil"_"$i" + cp "$fil"_"$i".gz $sixtrack_input + fi done if test "$CORR_TEST" -ne 0 then From 5a4b8e4df07f56bd8da4ae2999c73e103a7207c4 Mon Sep 17 00:00:00 2001 From: Sofia Kostoglou Date: Tue, 27 Feb 2018 10:30:53 +0100 Subject: [PATCH 2/4] fort.13 --- utilities/bash/dot_profile | 3 +- utilities/bash/mad6t.sh | 4 +-- utilities/bash/run_six.sh | 47 +++++++++++++------------------ utilities/bash/set_env.sh | 2 +- utilities/templates/lsf/mad6t1.sh | 2 +- 5 files changed, 26 insertions(+), 32 deletions(-) diff --git a/utilities/bash/dot_profile b/utilities/bash/dot_profile index 4f64dc6..faa0e58 100755 --- a/utilities/bash/dot_profile +++ b/utilities/bash/dot_profile @@ -686,7 +686,8 @@ sixdeskAllTunes(){ inttunesYY=( ${inttunesYY} ) } sixdeskAllAmplitudes_fort13(){ - pairs_per_job=$((sixdeskpairs*15)) + ## This function splits the fort.13 file according to the number of pairs set in sixdeskenv. A new directory fort13_jobs in the work directory is created which contains all the fort.13 jobs. The amplitude steps are named after the number of the job. + pairs_per_job=$((sixdeskpairs*15)) ## each pair correspons to 15 lines if [ -d "${sixdeskjobs_logs}/fort.13_jobs" ]; then rm -rf ${sixdeskjobs_logs}/fort.13_jobs/* else diff --git a/utilities/bash/mad6t.sh b/utilities/bash/mad6t.sh index 315627f..a61d7bb 100755 --- a/utilities/bash/mad6t.sh +++ b/utilities/bash/mad6t.sh @@ -150,8 +150,8 @@ function submit(){ # Loop over seeds mad6tjob=$lsfFilesPath/mad6t1.sh for (( iMad=$istamad ; iMad<=$iendmad ; iMad++ )) ; do - if [ ${lflag_fort13} = true ] ; then - files="2 8 13 16 34" + if [ "${lflag_fort13}" = true ] ; then + files="2 8 13 16 34" ## fort.13 is also included in sixtrack_input else files="2 8 16 34" fi diff --git a/utilities/bash/run_six.sh b/utilities/bash/run_six.sh index 655c25c..16610c6 100755 --- a/utilities/bash/run_six.sh +++ b/utilities/bash/run_six.sh @@ -264,8 +264,8 @@ function preProcessFort3(){ local __dp1=.0 local __dp2=.0 fi - - if [ $lflag_fort13 ]; then + ## if fort.13 flag is on keep %nss. There could be an unequal number of pairs in each fort.13 jobs + if $lflag_fort13; then sed -e 's/%turnss/%turnsl/g' \ -e 's/%imc/'$__imc'/g' \ -e 's/%iclo6/'$__iclo6'/g' \ @@ -528,7 +528,7 @@ function preProcessBoinc(){ function submitChromaJobs(){ local __destination=$1 - if [ ${lflag_fort13} = true ]; then + if ${lflag_fort13}; then local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:fort.13*:sixdesklock:chromaJob0?:lin*:betaJob' else local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:sixdesklock:chromaJob0?:lin*:betaJob' @@ -603,7 +603,7 @@ function submitChromaJobs(){ sixdeskmess 1 "Running the first one turn job for chromaticity" cat fort.3.t1 fort.3.mad fort.3.m2 > fort.3 rm -f fort.10 - if [ ${lflag_fort13} = true ]; then + if ${lflag_fort13}; then cp $sixdeskhome/fort.13 . fi $SIXTRACKEXE > first_oneturn @@ -615,8 +615,8 @@ function submitChromaJobs(){ fi # save all interesting files from first job rm -rf chromaJob01 - mkdir chromaJob01 - if [ ${lflag_fort13} = true ]; then + mkdir chromaJob01 + if ${lflag_fort13}; then cp fort.2 fort.3 fort.8 fort.16 fort.10 fort.13 first_oneturn chromaJob01 else cp fort.2 fort.3 fort.8 fort.16 fort.10 first_oneturn chromaJob01 @@ -627,12 +627,11 @@ function submitChromaJobs(){ export GLOBIGNORE=${__GLOBIGNORE} rm -f * export GLOBIGNORE= - # - second job sixdeskmess 1 "Running the second one turn job for chromaticity" cat fort.3.t2 fort.3.mad fort.3.m2 > fort.3 rm -f fort.10 - if [ ${lflag_fort13} = true ]; then + if ${lflag_fort13}; then cp $sixdeskhome/fort.13 . fi $SIXTRACKEXE > second_oneturn @@ -645,7 +644,7 @@ function submitChromaJobs(){ # save all interesting files from second job rm -rf chromaJob02 mkdir chromaJob02 - if [ ${lflag_fort13} = true ]; then + if ${lflag_fort13}; then cp fort.2 fort.3 fort.8 fort.16 fort.10 fort.13 second_oneturn chromaJob02 else cp fort.2 fort.3 fort.8 fort.16 fort.10 second_oneturn chromaJob02 @@ -671,7 +670,7 @@ function submitChromaJobs(){ function submitBetaJob(){ local __destination=$1 - if [ ${lflag_fort13} = true ];then + if ${lflag_fort13};then local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:fort.13*:sixdesklock:chromaJob0?:lin*:betaJob' else local __GLOBIGNORE='fort.[2,8]:fort.16:fort*.3.*:fort.10*:sixdesklock:chromaJob0?:lin*:betaJob' @@ -722,7 +721,7 @@ function submitBetaJob(){ # -------------------------------------------------------------------------- # actually run rm -f fort.10 - if [ ${lflag_fort13} = true ];then + if ${lflag_fort13};then cp $sixdeskhome/fort.13 . fi $SIXTRACKEXE > lin @@ -735,7 +734,7 @@ function submitBetaJob(){ # save all interesting files from beta job rm -rf betaJob mkdir betaJob - if [ ${lflag_fort13} = true ];then + if ${lflag_fort13};then cp fort.2 fort.3 fort.8 fort.16 fort.10 fort.13 lin betaJob else cp fort.2 fort.3 fort.8 fort.16 fort.10 fort.13 lin betaJob @@ -807,9 +806,7 @@ function submitCreateFinalFort3Short(){ } function submitCreateFinalFort3Long(){ - - - if [ $lflag_fort13 ]; then + if $lflag_fort13; then ax0=0.0 ax1=0.0 cp ${fort13_jobs[${nConsidered} -1]} $sixdeskjobs_logs/fort.13 @@ -826,7 +823,7 @@ function submitCreateFinalFort3Long(){ [ -n "${ax0}" ] || let __lerr+=1 [ -n "${ax1}" ] || let __lerr+=1 fi - # + ## if fort.13 flag is on %nss will now be substituted with the number of pairs in the current fort.13 job otherwise %nss does not exist anymore sed -e 's/%turnsl/'$turnsl'/g' \ -e 's/%ax0l/'$ax0'/g' \ -e 's/%nss/'$sixdeskpairs_current'/g' \ @@ -858,7 +855,7 @@ function submitCreateFinalInputs(){ sixdeskmess 1 "Taking care of SIXTRACK fort.2/fort.3/fort.8/fort.16 in $RundirFullPath" # fort.3 - if [ $lflag_fort13 ];then + if $lflag_fort13;then gzip -c $fort13_current > $RundirFullPath/fort.13.gz gzip -c $sixdeskjobs_logs/fort.3 > $RundirFullPath/fort.3.gz else @@ -1498,13 +1495,11 @@ function treatLong(){ # separate output for current case from previous one echo "" - if [ $lflag_fort13=true ];then + if $lflag_fort13;then sixdeskmess -1 "Considering job #$Ampl from fort.13" else sixdeskmess -1 "Considering amplitude step: $Ampl" fi - #echo $lflag_fort13 hereeeeee2 - #exit if ${lReduceAngsWithAmplitude}; then jAmple=${iAmple} else @@ -1613,7 +1608,6 @@ function treatLong(){ sixdeskmess 1 "Carrying on with next WU" continue fi - # final preparation of all SIXTRACK files # NB: for boinc, it returns workunitName submitCreateFinalInputs @@ -2240,12 +2234,11 @@ if ${lgenerate} || ${lfix} ; then echo "$emit $gamma" > $sixdesktrackStudy/general_input let __lerr+=$? # - set up of fort.3 - if [ $lflag_fort13 = false ]; then - tmpFiles=(fort.3.mad fort.3.mother1 fort.3.mother2) - else + if $lflag_fort13; then tmpFiles=(fort.3.mad fort.3.mother1 fort.3.mother2 fort.13) + else + tmpFiles=(fort.3.mad fort.3.mother1 fort.3.mother2) fi - #for tmpFile in fort.3.mad fort.3.mother1 fort.3.mother2 ; do for tmpFile in ${tmpFiles[@]}; do cp ${sixtrack_input}/${tmpFile} $sixdeskjobs_logs if [ $? -ne 0 ] ; then @@ -2451,7 +2444,7 @@ else sixdeskmess -1 " --> along a line in (Qx,Qy) - total: ${iTotalTunes} pairs;" fi fi - if [ $lflag_fort13 = false ]; then + if [ "$lflag_fort13" = false ]; then if [ $long -eq 1 ] ; then # generate array of amplitudes (it returns allAmplitudeSteps, fAmpStarts, fAmpEnds, ampstart, ampfinish) sixdeskAllAmplitudes @@ -2514,7 +2507,7 @@ else echo "" sixdeskmess -1 "MADX seed $iMad" if ${lgenerate} || ${lfix} ; then - if [ ${lflag_fort13} = true ] ; then + if ${lflag_fort13}; then iForts="2 8 13 16" else iForts="2 8 16" diff --git a/utilities/bash/set_env.sh b/utilities/bash/set_env.sh index 8667ea8..3e1c7d3 100755 --- a/utilities/bash/set_env.sh +++ b/utilities/bash/set_env.sh @@ -175,7 +175,7 @@ function setFurtherEnvs(){ fi lReduceAngsWithAmplitude=false - if [ $lflag_fort13 = false ]; then + if [ "$lflag_fort13" = false ]; then if [ -n "${reduce_angs_with_aplitude}" ] ; then sixdeskmess -1 "wrong spelling of reduce_angs_with_amplitude. Please correct it for future use" reduce_angs_with_amplitude=${reduce_angs_with_aplitude} diff --git a/utilities/templates/lsf/mad6t1.sh b/utilities/templates/lsf/mad6t1.sh index cffa3f9..d4f506a 100644 --- a/utilities/templates/lsf/mad6t1.sh +++ b/utilities/templates/lsf/mad6t1.sh @@ -116,7 +116,7 @@ touch fc.34 mv fc.2 fort.2 mv fc.16 fort.16 mv fc.8 fort.8 -if [ $lflag_fort13 = true ]; then +if $lflag_fort13; then fils=(fort.2 fort.8 fort.13 fort.16) else fils=(fort.2 fort.8 fort.16) From e4d3b9c4feab2dac43bd6058b6117a7a6c68ebcc Mon Sep 17 00:00:00 2001 From: skostogl Date: Sat, 3 Mar 2018 23:35:44 +0100 Subject: [PATCH 3/4] fort.13 for submission --- utilities/bash/mad6t.sh | 1 + utilities/templates/lsf/mad6t1.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/utilities/bash/mad6t.sh b/utilities/bash/mad6t.sh index a61d7bb..ddd59dc 100755 --- a/utilities/bash/mad6t.sh +++ b/utilities/bash/mad6t.sh @@ -173,6 +173,7 @@ function submit(){ -e 's?%MADX_PATH%?'$MADX_PATH'?g' \ -e 's?%MADX%?'$MADX'?g' \ -e 's?%lflag_fort13%?'$lflag_fort13'?g' \ + -e 's?%sixdeskstudy%?'$sixdeskstudy'?g' \ -e 's?%SIXTRACK_INPUT%?'$sixtrack_input'?g' $mad6tjob > mad6t_"$iMad".sh chmod 755 mad6t_"$iMad".sh diff --git a/utilities/templates/lsf/mad6t1.sh b/utilities/templates/lsf/mad6t1.sh index d4f506a..3312783 100644 --- a/utilities/templates/lsf/mad6t1.sh +++ b/utilities/templates/lsf/mad6t1.sh @@ -8,6 +8,7 @@ export fort_34=%FORT_34% export MADX_PATH=%MADX_PATH% export MADX=%MADX% export lflag_fort13=%lflag_fort13% +export sixdeskstudy=%sixdeskstudy% echo "Calling madx version $MADX in $MADX_PATH" $MADX_PATH/$MADX < $junktmp/$filejob."$i" > $filejob.out."$i" cp -f $filejob.out."$i" $junktmp @@ -138,7 +139,7 @@ do fi fi if [ $fil = "fort.13" ];then - cp $sixdeskhome/fort.13 $sixtrack_input + cp $sixdeskstudy/fort.13 $sixtrack_input cp $sixtrack_input/fort.13 $sixtrack_input/fort.13_$i gzip $sixtrack_input/fort.13_$i else From e0fe1bbb4d4330ae3722ccab84508668bbe0bcee Mon Sep 17 00:00:00 2001 From: skostogl Date: Wed, 25 Apr 2018 11:10:16 +0200 Subject: [PATCH 4/4] split modified --- utilities/bash/dot_profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/bash/dot_profile b/utilities/bash/dot_profile index faa0e58..1c57675 100755 --- a/utilities/bash/dot_profile +++ b/utilities/bash/dot_profile @@ -693,7 +693,7 @@ sixdeskAllAmplitudes_fort13(){ else mkdir ${sixdeskjobs_logs}/fort.13_jobs fi - split -d -l $pairs_per_job fort.13 ${sixdeskjobs_logs}/fort.13_jobs/fort.13. + split -a 6 -d -l $pairs_per_job fort.13 ${sixdeskjobs_logs}/fort.13_jobs/fort.13. fort13_jobs=( $(find ${sixdeskjobs_logs}/fort.13_jobs/ -type f -name 'fort.13.*') ) nb_fort13_jobs=${#fort13_jobs[@]} echo Fort.13 will be split in $nb_fort13_jobs jobs