Index: LMDZ5/trunk/libf/grid/dimension/makdim
===================================================================
--- LMDZ5/trunk/libf/grid/dimension/makdim	(revision 1907)
+++ LMDZ5/trunk/libf/grid/dimension/makdim	(revision 2202)
@@ -5,25 +5,32 @@
 if (( $# < 1 )) || (( $# > 3 ))
 then
- echo "Wrong number of parameters in $0 !!!"
- echo " Usage:"
- echo "  $0 [im] [jm] lm"
- echo " where im, jm and lm are the dimensions"
- exit
+    echo "Wrong number of parameters in $0 !!!"
+    echo " Usage:"
+    echo "  $0 [im] [jm] lm"
+    echo " where im, jm and lm are the dimensions"
+    exit 1
+fi
+
+if (($1 % 8 != 0))
+then
+    echo "The number of longitudes must be a multiple of 8."
+    echo "See the files dyn3d/groupe.F and dyn3dmem/groupe_loc.F."
+    exit 1
 fi
 
 # build "fichnom", the relevant 'dimensions.im.jm.lm' file name
 for i in $*
-  do
-  list=$list.$i
+do
+    list=$list.$i
 done
 fichdim=dimensions${list}
 
 if [ ! -f $fichdim ]
-    then
+then
 #    echo "$fichdim does not exist"
 
     # assign values of im, jm and lm
     if [ $# -ge 3 ]
-        then
+    then
         im=$1
         jm=$2
@@ -31,5 +38,5 @@
         ndm=1
     elif [ $# -ge 2 ]
-        then
+    then
         im=1
         jm=$1
@@ -37,5 +44,5 @@
         ndm=1
     elif [ $# -ge 1 ]
-        then
+    then
         im=1
         jm=1
@@ -45,5 +52,5 @@
 
 # since the file doesn't exist, we create it
-cat << EOF > $fichdim
+    cat << EOF > $fichdim
 !-----------------------------------------------------------------------
 !   INCLUDE 'dimensions.h'
@@ -64,5 +71,5 @@
 # remove 'old' dimensions.h file (if any) and replace it with new one
 if [ -f ../dimensions.h ] ; then
-\rm ../dimensions.h
+    \rm ../dimensions.h
 fi
 tar cf - $fichdim | ( cd .. ; tar xf - ; mv $fichdim dimensions.h )
