#!/bin/bash 
# ./run pixel_inicio pixel_final pixel_paso frecuencia_inicio frecuencia_final 
# frecuencia_paso resolucion_espacial Rt modelo path
COUNTERX=$1
while [  $COUNTERX -le $2 ]; do
if [ ! -d "/home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}" ]; then
    # Control will enter here if $DIRECTORY doesn't exist
    mkdir /home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}
fi
COUNTER=$4
while [  $COUNTER -le $5 ]; do  
    echo Computing $COUNTERX $COUNTER
    mpiexec -n 1 ./pakal -model $9 -min 1e-40 -r $7 -xy ${COUNTERX} 0 -detail 1 -big 1 -nu ${COUNTER} -Rt $8 -h 7.353e5 -f -7.36e5 -v 10 > /home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}/${COUNTER}GHz.dat
    mv emission_${COUNTERX}_0.dat /home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}/${COUNTER}GHz_emission_0_0.dat
    mv profile_${COUNTERX}_0.dat /home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}/${COUNTER}GHz_profile_0_0.dat
  let COUNTER=COUNTER+$6
done
let COUNTERX=COUNTERX+$3
done
