Writing submaps optional?
this line
echo ${profile_cmd} ${gmconvert} -imap ${map_name} -gmml 'tmp_$((SLURM_ARRAY_TASK_ID+offset)).txt' -oimap $n/'sub_$((SLURM_ARRAY_TASK_ID+offset-1)).mrc' -ogmm $n/${n}_'$((SLURM_ARRAY_TASK_ID-1+offset))'.gmm -ng ${n_gaussians} -zth ${threshold}
should be
echo ${profile_cmd} ${gmconvert} -imap ${map_name} -gmml 'tmp_$((SLURM_ARRAY_TASK_ID+offset)).txt' -ogmm $n/${n}_'$((SLURM_ARRAY_TASK_ID-1+offset))'.gmm -ng ${n_gaussians} -zth ${threshold}
unless submaps are needed for something else...
that will save a lot of disk space (and time)