Fenòmens p4: allow to save final configuration

Change-Id: I9f14110403a8313357ab04df624373789de47233
diff --git a/quad10/fenomens/lab/p4/run.bash b/quad10/fenomens/lab/p4/run.bash
index 96122de..2c95bdd 100755
--- a/quad10/fenomens/lab/p4/run.bash
+++ b/quad10/fenomens/lab/p4/run.bash
@@ -5,7 +5,7 @@
 
   Usage: $progname T L [outFilePrefix [--help --skipIfComputed
              --nSeeds NSEEDS --mcTot MCTOT --mcIni MCINI --mcD MCD
-             --initialSeed INITIALSEED]]
+             --initialSeed INITIALSEED --saveFinalConf]]
 
   the output file will be saved at "data_out/{{outFilePrefix}}"
 
@@ -22,6 +22,8 @@
     -d, --mcD             the program will measure the physical
                           properties when iteration % MCD == 0.
     --initialSeed         initial seed for the Monte Carlo algorithm.
+    --saveFinalConf       save a file with the configuration which
+                          belongs to the last Montecarlo iteration.
 END
 }
 
@@ -35,7 +37,7 @@
 defaultOutFilePrefix="L$L-T$T"
 outFilePrefix="${3:-$defaultOutFilePrefix}"
 
-opts=$(getopt -l "help,skipIfComputed,nSeeds:,mcTot:,mcIni:,mcD:,initialSeed:" -o "hsn:m:i:d:" -n "$progname" -- "${@:4}")
+opts=$(getopt -l "help,skipIfComputed,nSeeds:,mcTot:,mcIni:,mcD:,initialSeed:,saveFinalConf" -o "hsn:m:i:d:" -n "$progname" -- "${@:4}")
 eval set -- "$opts"
 
 skipIfComputed=false
@@ -44,6 +46,7 @@
 mcIni=2000
 mcD=20
 initialSeed=117654
+saveFinalConf=F
 
 while true; do
   case "$1" in
@@ -75,6 +78,10 @@
       initialSeed="$2"
       shift 2
       ;;
+    --saveFinalConf)
+      saveFinalConf=T
+      shift
+      ;;
     *) break ;;
   esac
 done
@@ -96,5 +103,6 @@
 MCTOT=$mcTot,
 MCINI=$mcIni,
 MCD=$mcD
+SAVEFINALCONF=$saveFinalConf
 &END
 EOF