From 4ab1e4315d06be7662fe3ed8a0b5640434c7c63b Mon Sep 17 00:00:00 2001
From: samuel hanot <smlhnt@gmail.com>
Date: Sat, 10 Mar 2018 14:23:24 +0100
Subject: [PATCH] added new option (-0 n0) that can be used to specify number
 of gaussians at first iteration

---
 README.md              | 2 ++
 recursive_gmconvert.sh | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 3216bf0..0a2d9e8 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,8 @@ ${SRC_DIR}/recursive_gmconvert.sh -f map_filename -t threshold -n num_gaussians
 
 `-n num_gaussians`: number of gaussians per sub-process
 
+`-0 num_gaussians0`: number of gaussians for first iteration
+
 `-N num_iterations`: number of recursion levels
 
 ### Optional arguments:
diff --git a/recursive_gmconvert.sh b/recursive_gmconvert.sh
index 1716adc..498dae8 100755
--- a/recursive_gmconvert.sh
+++ b/recursive_gmconvert.sh
@@ -7,6 +7,7 @@ Required arguments:
 -f map_filename: the file name of the input EM map
 -t threshold: the density threshold
 -n num_gaussians: number of gaussians per sub-process
+-0 num_gaussians0: number of gaussians for first iteration
 -N num_iterations: number of recursion levels
 Optional arguments:
 -i first_iteration: initial recursion level (defaults to 1)
@@ -18,16 +19,18 @@ Optional arguments:
 map_name=
 threshold=
 n_gaussians=
+n_gaussians0=
 N=
 i0=1
 serial=0
 
-while getopts f:t:n:N:i:sh opt
+while getopts f:t:n:N:i:0:sh opt
 do
     case "$opt" in
       f)  map_name="$OPTARG";;
 			t)  threshold="$OPTARG";;
 			n)  n_gaussians="$OPTARG";;
+			0)  n_gaussians0="$OPTARG";;
 			N)  N="$OPTARG";;
 			i)  i0="$OPTARG";;
 			s)  serial=1;;
@@ -67,7 +70,6 @@ cd $map_root_dir
 mkdir -p converged
 for ((i=$i0 ; i<=N ; i++))
 do
-	n=$((n_gaussians**i))
 	n=$((i))
 	jobname=${map_name}_${n}
 
@@ -78,7 +80,7 @@ do
 		then
 			${gmconvert} -imap ${map_name} -zth ${threshold} -oimap threshold.map -ogmm /dev/null -ng 0
 	  fi
-		echo ${profile_cmd} ${gmconvert} -imap ${map_name} -ogmm $n/${n}_0.gmm -ng ${n_gaussians} -zth ${threshold}
+		echo ${profile_cmd} ${gmconvert} -imap ${map_name} -ogmm $n/${n}_0.gmm -ng ${n_gaussians0} -zth ${threshold}
 		echo ${gmconvert}  -igmm $n/${n}_0.gmm -imap ${map_name} -omap /dev/null
 	else
 		n_prev=$((i-1))
-- 
GitLab