Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- #
- # This script gathers all the files of the single consecutives runs
- # and puts them in one file. Then it runs the evaluation scripts
- #
- base_dir=$(pwd)
- max_run=$(grep max_run= run_sim.sh | cut -c9-)
- num_sweeps=$(grep production options | awk ' {print $1}')
- declare -a boxes=("1000" "400" "464")
- declare -a particles=("600" "384" "600")
- switches="0 0.0016 0.00016 0.0000016"
- #switches="0 0.0016 0.00016"
- for switch in $switches
- do
- for i in {0..2}
- do
- box=${boxes[$i]}
- particle=${particles[$i]}
- #echo $particle
- mydir="${particle}in${box}w${switch}"
- echo "is there $mydir?"
- if [[ ! -d $mydir ]]; then
- echo "no"
- continue
- fi
- echo "yes"
- cd "${mydir}/1"
- if [[ ! -f config.last ]]; then
- continue
- fi
- echo "Entering $(pwd)..."
- cp cluster_stat.dat ../cluster_stat.dat
- cp movie ../movie
- cp top.init ../
- cp config.init ../ #?
- #Get the maximal and minmal sweeps in the files (or length of the number)
- mov_max=$(($(grep sweep movie | awk '{print $2}' | tail -n1 | wc -m) -2))
- mov_min=$(($(grep sweep movie | awk '{print $2}' | head -n1 | wc -m) -2))
- cl_max=$(($(grep Sweep cluster_stat.dat | awk '{print $2}' | tail -n1 | wc -m) -1))
- cl_min=$(($(grep Sweep cluster_stat.dat | awk '{print $2}' | head -n1 | wc -m) -1))
- for (( dir=2; dir <= $max_run; dir++ ))
- do
- cd ../$dir
- if [[ -e config.last ]]; then
- echo "Entering $(pwd)..."
- sw=$((dir - 1))
- cp cluster_stat.dat{,.mod}
- cp movie{,.mod}
- # Adjust the sweep. Only works if max. sweep is 10^n
- for((k=$mov_min; k < $mov_max; k++)); do
- diff=$(($mov_max - $k - 1))
- zeros=""
- for((z=0; z < $diff; z++)); do
- zeros=$zeros"0"
- done
- sed -i "s/sweep \([0-9]\{$k\}\); /sweep $sw$zeros\1; /" movie.mod
- done
- sed -i "s/sweep 1\([0]\{$(($mov_max -1))\}\); /sweep $((sw + 1))\1; /" movie.mod
- for((k=$cl_min; k < $cl_max; k++)); do
- diff=$(($cl_max - $k - 1))
- zeros=""
- for((z=0; z < $diff; z++)); do
- zeros=$zeros"0"
- done
- sed -i "s/Sweep: \([0-9]\{$k\}\) /Sweep: $sw$zeros\1 /" cluster_stat.dat.mod
- done
- sed -i "s/Sweep: 1\([0]\{$(($cl_max -1))\}\) /Sweep: $((sw + 1))\1 /" cluster_stat.dat.mod
- cat cluster_stat.dat.mod >> ../cluster_stat.dat
- cat movie.mod >> ../movie
- rm cluster_stat.dat.mod
- rm movie.mod
- fi
- done
- cd ../
- #sc2vmd
- echo "Creating Plot for Cluster evolution..."
- ../gp_cluster.sh cluster_stat.dat
- echo "Creating Plot for fibre growth..."
- ../fibres.R
- cd $base_dir
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment