Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/abort_gcm.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/abort_gcm.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/abort_gcm.F90	(revision 5116)
@@ -19,9 +19,9 @@
   !     ierr    = severity of situation ( = 0 normal )
 
-  character(len = *), intent(in) :: modname
+  CHARACTER(LEN = *), intent(in) :: modname
   integer, intent(in) :: ierr
-  character(len = *), intent(in) :: message
+  CHARACTER(LEN = *), intent(in) :: message
 
-  write(lunout, *) 'in abort_gcm'
+  WRITE(lunout, *) 'in abort_gcm'
 
   IF (using_xios) THEN
@@ -33,11 +33,11 @@
   CALL restclo
   CALL getin_dump
-  write(lunout, *) 'Stopping in ', modname
-  write(lunout, *) 'Reason = ', message
-  if (ierr == 0) then
-    write(lunout, *) 'Everything is cool'
+  WRITE(lunout, *) 'Stopping in ', modname
+  WRITE(lunout, *) 'Reason = ', message
+  if (ierr == 0) THEN
+    WRITE(lunout, *) 'Everything is cool'
     stop
   else
-    write(lunout, *) 'Houston, we have a problem, ierr = ', ierr
+    WRITE(lunout, *) 'Houston, we have a problem, ierr = ', ierr
     stop 1
   endif
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/addfi.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/addfi.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/addfi.F90	(revision 5116)
@@ -119,5 +119,5 @@
   ENDDO
 
-  if (planet_type=="earth") then
+  if (planet_type=="earth") THEN
     ! earth case, special treatment for first 2 tracers (water)
     DO iq = 1, 2
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/advtrac.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/advtrac.f90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/advtrac.f90	(revision 5116)
@@ -15,4 +15,5 @@
   USE strings_mod, ONLY: int2str
   USE lmdz_description, ONLY: descript
+  USE lmdz_libmath, ONLY: minmax
 
   IMPLICIT NONE
@@ -49,5 +50,4 @@
   REAL, DIMENSION(ip1jmp1, llm) :: pbaruc, pbarug, massem, wg
   REAL, DIMENSION(ip1jm, llm) :: pbarvc, pbarvg
-  EXTERNAL  minmax
   SAVE massem, pbaruc, pbarvc
   !---------------------------------------------------------------------------
@@ -129,5 +129,5 @@
   ! Calcul des criteres CFL en X, Y et Z
   !-------------------------------------------------------------------------
-  IF(countcfl == 0.) then
+  IF(countcfl == 0.) THEN
     cflxmax(:) = 0.
     cflymax(:) = 0.
@@ -141,5 +141,5 @@
   DO l = 1, llm
     DO ij = iip2, ip1jm - 1
-      IF(pbarug(ij, l)>=0.) then
+      IF(pbarug(ij, l)>=0.) THEN
         cflx(ij, l) = pbarug(ij, l) * dtvr / masse(ij, l)
       ELSE
@@ -157,5 +157,5 @@
   DO l = 1, llm
     DO ij = 1, ip1jm
-      IF(pbarvg(ij, l)>=0.) then
+      IF(pbarvg(ij, l)>=0.) THEN
         cfly(ij, l) = pbarvg(ij, l) * dtvr / masse(ij, l)
       ELSE
@@ -184,7 +184,7 @@
   ! Par defaut, on sort le diagnostic des CFL tous les jours.
   ! Si on veut le sortir a chaque pas d'advection en cas de plantage
-  !       IF(countcfl==iapp_tracvl) then
+  !       IF(countcfl==iapp_tracvl) THEN
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  IF(countcfl==day_step) then
+  IF(countcfl==day_step) THEN
     DO l = 1, llm
       WRITE(lunout, *) 'L, CFL[xyz]max:', l, cflxmax(l), cflymax(l), cflzmax(l)
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/bilan_dyn.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/bilan_dyn.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/bilan_dyn.F90	(revision 5116)
@@ -36,24 +36,24 @@
   !   ===========
 
-  integer :: ntrac
-  real :: dt_app, dt_cum
-  real :: ps(iip1, jjp1)
-  real :: masse(iip1, jjp1, llm), pk(iip1, jjp1, llm)
-  real :: flux_u(iip1, jjp1, llm)
-  real :: flux_v(iip1, jjm, llm)
-  real :: teta(iip1, jjp1, llm)
-  real :: phi(iip1, jjp1, llm)
-  real :: ucov(iip1, jjp1, llm)
-  real :: vcov(iip1, jjm, llm)
-  real :: trac(iip1, jjp1, llm, ntrac)
+  INTEGER :: ntrac
+  REAL :: dt_app, dt_cum
+  REAL :: ps(iip1, jjp1)
+  REAL :: masse(iip1, jjp1, llm), pk(iip1, jjp1, llm)
+  REAL :: flux_u(iip1, jjp1, llm)
+  REAL :: flux_v(iip1, jjm, llm)
+  REAL :: teta(iip1, jjp1, llm)
+  REAL :: phi(iip1, jjp1, llm)
+  REAL :: ucov(iip1, jjp1, llm)
+  REAL :: vcov(iip1, jjm, llm)
+  REAL :: trac(iip1, jjp1, llm, ntrac)
 
   !   Local :
   !   =======
 
-  integer :: icum, ncum
+  INTEGER :: icum, ncum
   logical :: first
-  real :: zz, zqy, zfactv(jjm, llm)
-
-  integer :: nQ
+  REAL :: zz, zqy, zfactv(jjm, llm)
+
+  INTEGER :: nQ
   parameter (nQ = 7)
 
@@ -64,10 +64,10 @@
   character*6, save :: unites(nQ)
 
-  character(len = 10) :: file
-  integer :: ifile
+  CHARACTER(LEN = 10) :: file
+  INTEGER :: ifile
   parameter (ifile = 4)
 
-  integer :: itemp, igeop, iecin, iang, iu, iovap, iun
-  integer :: i_sortie
+  INTEGER :: itemp, igeop, iecin, iang, iu, iovap, iun
+  INTEGER :: i_sortie
 
   save first, icum, ncum
@@ -75,6 +75,6 @@
   save i_sortie
 
-  real :: time
-  integer :: itau
+  REAL :: time
+  INTEGER :: itau
   save time, itau
   data time, itau/0., 0/
@@ -84,5 +84,5 @@
   data i_sortie/1/
 
-  real :: ww
+  REAL :: ww
 
   !   variables dynamiques intermédiaires
@@ -95,16 +95,16 @@
 
   !   champ contenant les scalaires advectés.
-  real :: Q(iip1, jjp1, llm, nQ)
+  REAL :: Q(iip1, jjp1, llm, nQ)
 
   !   champs cumulés
-  real :: ps_cum(iip1, jjp1)
-  real :: masse_cum(iip1, jjp1, llm)
-  real :: flux_u_cum(iip1, jjp1, llm)
-  real :: flux_v_cum(iip1, jjm, llm)
-  real :: Q_cum(iip1, jjp1, llm, nQ)
-  real :: flux_uQ_cum(iip1, jjp1, llm, nQ)
-  real :: flux_vQ_cum(iip1, jjm, llm, nQ)
-  real :: flux_wQ_cum(iip1, jjp1, llm, nQ)
-  real :: dQ(iip1, jjp1, llm, nQ)
+  REAL :: ps_cum(iip1, jjp1)
+  REAL :: masse_cum(iip1, jjp1, llm)
+  REAL :: flux_u_cum(iip1, jjp1, llm)
+  REAL :: flux_v_cum(iip1, jjm, llm)
+  REAL :: Q_cum(iip1, jjp1, llm, nQ)
+  REAL :: flux_uQ_cum(iip1, jjp1, llm, nQ)
+  REAL :: flux_vQ_cum(iip1, jjm, llm, nQ)
+  REAL :: flux_wQ_cum(iip1, jjp1, llm, nQ)
+  REAL :: dQ(iip1, jjp1, llm, nQ)
 
   save ps_cum, masse_cum, flux_u_cum, flux_v_cum
@@ -112,5 +112,5 @@
 
   !   champs de tansport en moyenne zonale
-  integer :: ntr, itr
+  INTEGER :: ntr, itr
   parameter (ntr = 5)
 
@@ -122,16 +122,16 @@
   character*10, save :: zunites(ntr, nQ)
 
-  integer :: iave, itot, immc, itrs, istn
+  INTEGER :: iave, itot, immc, itrs, istn
   data iave, itot, immc, itrs, istn/1, 2, 3, 4, 5/
-  character(len = 3) :: ctrs(ntr)
+  CHARACTER(LEN = 3) :: ctrs(ntr)
   data ctrs/'  ', 'TOT', 'MMC', 'TRS', 'STN'/
 
-  real :: zvQ(jjm, llm, ntr, nQ), zvQtmp(jjm, llm)
-  real :: zavQ(jjm, ntr, nQ), psiQ(jjm, llm + 1, nQ)
-  real :: zmasse(jjm, llm), zamasse(jjm)
-
-  real :: zv(jjm, llm), psi(jjm, llm + 1)
-
-  integer :: i, j, l, iQ
+  REAL :: zvQ(jjm, llm, ntr, nQ), zvQtmp(jjm, llm)
+  REAL :: zavQ(jjm, ntr, nQ), psiQ(jjm, llm + 1, nQ)
+  REAL :: zmasse(jjm, llm), zamasse(jjm)
+
+  REAL :: zv(jjm, llm), psi(jjm, llm + 1)
+
+  INTEGER :: i, j, l, iQ
 
 
@@ -139,22 +139,22 @@
   !   ---------------------------------------------------------
 
-  character(len = 10) :: infile
-
-  integer :: fileid
-  integer :: thoriid, zvertiid
+  CHARACTER(LEN = 10) :: infile
+
+  INTEGER :: fileid
+  INTEGER :: thoriid, zvertiid
   save fileid
 
-  integer :: ndex3d(jjm * llm)
+  INTEGER :: ndex3d(jjm * llm)
 
   !   Variables locales
   !
-  integer :: tau0
-  real :: zjulian
-  character(len = 3) :: str
-  character(len = 10) :: ctrac
-  integer :: ii, jj
-  integer :: zan, dayref
-  !
-  real :: rlong(jjm), rlatg(jjm)
+  INTEGER :: tau0
+  REAL :: zjulian
+  CHARACTER(LEN = 3) :: str
+  CHARACTER(LEN = 10) :: ctrac
+  INTEGER :: ii, jj
+  INTEGER :: zan, dayref
+  !
+  REAL :: rlong(jjm), rlatg(jjm)
 
 
@@ -169,6 +169,5 @@
   ndex3d = 0
 
-  if (first) then
-
+  if (first) THEN
     icum = 0
     ! initialisation des fichiers
@@ -176,5 +175,5 @@
     !   ncum est la frequence de stokage en pas de temps
     ncum = dt_cum / dt_app
-    if (abs(ncum * dt_app - dt_cum)>1.e-5 * dt_app) then
+    if (abs(ncum * dt_app - dt_cum)>1.e-5 * dt_app) THEN
       WRITE(lunout, *) &
               'Pb : le pas de cumule doit etre multiple du pas'
@@ -184,5 +183,5 @@
     endif
 
-    if (i_sortie==1) then
+    if (i_sortie==1) THEN
       file = 'dynzon'
       CALL inigrads(ifile, 1 &
@@ -235,5 +234,5 @@
     do iQ = 1, nQ
       do itr = 1, ntr
-        if(itr==1) then
+        IF(itr==1) THEN
           znom(itr, iQ) = nom(iQ)
           znoml(itr, iQ) = nom(iQ)
@@ -327,5 +326,5 @@
   !=====================================================================
   !
-  if(icum==0) then
+  IF(icum==0) THEN
     ps_cum = 0.
     masse_cum = 0.
@@ -408,5 +407,5 @@
   !   PAS DE TEMPS D'ECRITURE
   !=====================================================================
-  if (icum==ncum) then
+  if (icum==ncum) THEN
     !=====================================================================
 
@@ -529,5 +528,5 @@
     ! PRINT*,'4OK'
     !   sorties proprement dites
-    if (i_sortie==1) then
+    if (i_sortie==1) THEN
       do iQ = 1, nQ
         do itr = 1, ntr
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/caladvtrac.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/caladvtrac.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/caladvtrac.F90	(revision 5116)
@@ -30,5 +30,5 @@
   REAL :: pbaru(ip1jmp1, llm), pbarv(ip1jm, llm), masse(ip1jmp1, llm)
   REAL :: p(ip1jmp1, llmp1), q(ip1jmp1, llm, nqtot)
-  real :: dq(ip1jmp1, llm, nqtot)
+  REAL :: dq(ip1jmp1, llm, nqtot)
   REAL :: teta(ip1jmp1, llm), pk(ip1jmp1, llm)
   REAL :: flxw(ip1jmp1, llm)
@@ -50,5 +50,5 @@
   !
   ! Earth-specific stuff for the first 2 tracers (water)
-  if (planet_type=="earth") then
+  if (planet_type=="earth") THEN
     ! initialisation
     ! CRisi: il faut gérer tous les traceurs si on veut pouvoir faire des
@@ -70,5 +70,5 @@
 
   IF(iapptrac==iapp_tracvl) THEN
-    if (planet_type=="earth") then
+    if (planet_type=="earth") THEN
       ! Earth-specific treatment for the first 2 tracers (water)
       !
@@ -84,7 +84,7 @@
       ENDDO
 
-      !write(*,*) 'caladvtrac 87'
+      !WRITE(*,*) 'caladvtrac 87'
       CALL qminimum(q, nqtot, finmasse)
-      !write(*,*) 'caladvtrac 89'
+      !WRITE(*,*) 'caladvtrac 89'
 
       CALL SCOPY   (ip1jmp1 * llm, masse, 1, finmasse, 1)
@@ -107,5 +107,5 @@
     endif ! of if (planet_type.eq."earth")
   ELSE
-    if (planet_type=="earth") then
+    if (planet_type=="earth") THEN
       ! Earth-specific treatment for the first 2 tracers (water)
       dq(:, :, 1:nqtot) = 0.
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/check_isotopes.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/check_isotopes.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/check_isotopes.F90	(revision 5116)
@@ -35,5 +35,5 @@
       iso_O17 = strIdx(isoName,'H217O')
       iso_HTO = strIdx(isoName,'HTO')
-      if (tnat1) then
+      if (tnat1) THEN
               tnat(:)=1.0
       else
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/conf_gcm.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/conf_gcm.f90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/conf_gcm.f90	(revision 5116)
@@ -6,5 +6,5 @@
   use IOIPSL
   USE infotrac, ONLY: type_trac
-  use lmdz_assert, only: assert
+  use lmdz_assert, ONLY: assert
   USE comconst_mod, ONLY: dissip_deltaz, dissip_factz, dissip_zref, &
           iflag_top_bound, mode_top_bound, tau_top_bound, &
@@ -414,5 +414,5 @@
 
     IF(ABS(clat - clatt)>= 0.001)  THEN
-      write(lunout, *)'conf_gcm: La valeur de clat passee par run.def', &
+      WRITE(lunout, *)'conf_gcm: La valeur de clat passee par run.def', &
               ' est differente de celle lue sur le fichier  start '
       CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -428,5 +428,5 @@
 
     IF(ABS(grossismx - grossismxx)>= 0.001)  THEN
-      write(lunout, *)'conf_gcm: La valeur de grossismx passee par ', &
+      WRITE(lunout, *)'conf_gcm: La valeur de grossismx passee par ', &
               'run.def est differente de celle lue sur le fichier  start '
       CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -442,5 +442,5 @@
 
     IF(ABS(grossismy - grossismyy)>= 0.001)  THEN
-      write(lunout, *)'conf_gcm: La valeur de grossismy passee par ', &
+      WRITE(lunout, *)'conf_gcm: La valeur de grossismy passee par ', &
               'run.def est differente de celle lue sur le fichier  start '
       CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -448,5 +448,5 @@
 
     IF(grossismx<1.)  THEN
-      write(lunout, *) &
+      WRITE(lunout, *) &
               'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
       CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -456,5 +456,5 @@
 
     IF(grossismy<1.)  THEN
-      write(lunout, *) &
+      WRITE(lunout, *) &
               'conf_gcm: ***  ATTENTION !! grossismy < 1 .   *** '
       CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -463,5 +463,5 @@
     ENDIF
 
-    write(lunout, *)'conf_gcm: alphax alphay', alphax, alphay
+    WRITE(lunout, *)'conf_gcm: alphax alphay', alphax, alphay
 
     !    alphax et alphay sont les anciennes formulat. des grossissements
@@ -477,6 +477,6 @@
     IF(.NOT.fxyhypb)  THEN
       IF(fxyhypbb)     THEN
-        write(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
-        write(lunout, *)' *** fxyhypb lu sur le fichier start est ', &
+        WRITE(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
+        WRITE(lunout, *)' *** fxyhypb lu sur le fichier start est ', &
                 'F alors  qu il est  T  sur  run.def  ***'
         CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -484,6 +484,6 @@
     ELSE
       IF(.NOT.fxyhypbb)   THEN
-        write(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
-        write(lunout, *)' ***  fxyhypb lu sur le fichier start est ', &
+        WRITE(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
+        WRITE(lunout, *)' ***  fxyhypb lu sur le fichier start est ', &
                 'T alors  qu il est  F  sur  run.def  ****  '
         CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -501,5 +501,5 @@
     IF(fxyhypb)  THEN
       IF(ABS(dzoomx - dzoomxx)>= 0.001)  THEN
-        write(lunout, *)'conf_gcm: La valeur de dzoomx passee par ', &
+        WRITE(lunout, *)'conf_gcm: La valeur de dzoomx passee par ', &
                 'run.def est differente de celle lue sur le fichier  start '
         CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -517,5 +517,5 @@
     IF(fxyhypb)  THEN
       IF(ABS(dzoomy - dzoomyy)>= 0.001)  THEN
-        write(lunout, *)'conf_gcm: La valeur de dzoomy passee par ', &
+        WRITE(lunout, *)'conf_gcm: La valeur de dzoomy passee par ', &
                 'run.def est differente de celle lue sur le fichier  start '
         CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -532,5 +532,5 @@
     IF(fxyhypb)  THEN
       IF(ABS(taux - tauxx)>= 0.001)  THEN
-        write(lunout, *)'conf_gcm: La valeur de taux passee par ', &
+        WRITE(lunout, *)'conf_gcm: La valeur de taux passee par ', &
                 'run.def est differente de celle lue sur le fichier  start '
         CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -547,5 +547,5 @@
     IF(fxyhypb)  THEN
       IF(ABS(tauy - tauyy)>= 0.001)  THEN
-        write(lunout, *)'conf_gcm: La valeur de tauy passee par ', &
+        WRITE(lunout, *)'conf_gcm: La valeur de tauy passee par ', &
                 'run.def est differente de celle lue sur le fichier  start '
         CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -567,6 +567,6 @@
       IF(.NOT.ysinus)  THEN
         IF(ysinuss)     THEN
-          write(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
-          write(lunout, *)' *** ysinus lu sur le fichier start est F', &
+          WRITE(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
+          WRITE(lunout, *)' *** ysinus lu sur le fichier start est F', &
                   ' alors  qu il est  T  sur  run.def  ***'
           CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -574,6 +574,6 @@
       ELSE
         IF(.NOT.ysinuss)   THEN
-          write(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
-          write(lunout, *)' *** ysinus lu sur le fichier start est T', &
+          WRITE(lunout, *)' ********  PBS DANS  CONF_GCM  ******** '
+          WRITE(lunout, *)' *** ysinus lu sur le fichier start est T', &
                   ' alors  qu il est  F  sur  run.def  ****  '
           CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -634,46 +634,46 @@
     CALL getin('ok_dyn_ave', ok_dyn_ave)
 
-    write(lunout, *)' #########################################'
-    write(lunout, *)' Configuration des parametres du gcm: '
-    write(lunout, *)' planet_type = ', planet_type
-    write(lunout, *)' calend = ', calend
-    write(lunout, *)' dayref = ', dayref
-    write(lunout, *)' anneeref = ', anneeref
-    write(lunout, *)' nday = ', nday
-    write(lunout, *)' day_step = ', day_step
-    write(lunout, *)' iperiod = ', iperiod
-    write(lunout, *)' nsplit_phys = ', nsplit_phys
-    write(lunout, *)' iconser = ', iconser
-    write(lunout, *)' iecri = ', iecri
-    write(lunout, *)' periodav = ', periodav
-    write(lunout, *)' output_grads_dyn = ', output_grads_dyn
-    write(lunout, *)' dissip_period = ', dissip_period
-    write(lunout, *)' lstardis = ', lstardis
-    write(lunout, *)' nitergdiv = ', nitergdiv
-    write(lunout, *)' nitergrot = ', nitergrot
-    write(lunout, *)' niterh = ', niterh
-    write(lunout, *)' tetagdiv = ', tetagdiv
-    write(lunout, *)' tetagrot = ', tetagrot
-    write(lunout, *)' tetatemp = ', tetatemp
-    write(lunout, *)' coefdis = ', coefdis
-    write(lunout, *)' purmats = ', purmats
-    write(lunout, *)' read_start = ', read_start
-    write(lunout, *)' iflag_phys = ', iflag_phys
-    write(lunout, *)' iphysiq = ', iphysiq
-    write(lunout, *)' clonn = ', clonn
-    write(lunout, *)' clatt = ', clatt
-    write(lunout, *)' grossismx = ', grossismx
-    write(lunout, *)' grossismy = ', grossismy
-    write(lunout, *)' fxyhypbb = ', fxyhypbb
-    write(lunout, *)' dzoomxx = ', dzoomxx
-    write(lunout, *)' dzoomy = ', dzoomyy
-    write(lunout, *)' tauxx = ', tauxx
-    write(lunout, *)' tauyy = ', tauyy
-    write(lunout, *)' offline = ', offline
-    write(lunout, *)' type_trac = ', type_trac
-    write(lunout, *)' ok_dynzon = ', ok_dynzon
-    write(lunout, *)' ok_dyn_ins = ', ok_dyn_ins
-    write(lunout, *)' ok_dyn_ave = ', ok_dyn_ave
-    write(lunout, *)' adv_qsat_liq = ', adv_qsat_liq
+    WRITE(lunout, *)' #########################################'
+    WRITE(lunout, *)' Configuration des parametres du gcm: '
+    WRITE(lunout, *)' planet_type = ', planet_type
+    WRITE(lunout, *)' calend = ', calend
+    WRITE(lunout, *)' dayref = ', dayref
+    WRITE(lunout, *)' anneeref = ', anneeref
+    WRITE(lunout, *)' nday = ', nday
+    WRITE(lunout, *)' day_step = ', day_step
+    WRITE(lunout, *)' iperiod = ', iperiod
+    WRITE(lunout, *)' nsplit_phys = ', nsplit_phys
+    WRITE(lunout, *)' iconser = ', iconser
+    WRITE(lunout, *)' iecri = ', iecri
+    WRITE(lunout, *)' periodav = ', periodav
+    WRITE(lunout, *)' output_grads_dyn = ', output_grads_dyn
+    WRITE(lunout, *)' dissip_period = ', dissip_period
+    WRITE(lunout, *)' lstardis = ', lstardis
+    WRITE(lunout, *)' nitergdiv = ', nitergdiv
+    WRITE(lunout, *)' nitergrot = ', nitergrot
+    WRITE(lunout, *)' niterh = ', niterh
+    WRITE(lunout, *)' tetagdiv = ', tetagdiv
+    WRITE(lunout, *)' tetagrot = ', tetagrot
+    WRITE(lunout, *)' tetatemp = ', tetatemp
+    WRITE(lunout, *)' coefdis = ', coefdis
+    WRITE(lunout, *)' purmats = ', purmats
+    WRITE(lunout, *)' read_start = ', read_start
+    WRITE(lunout, *)' iflag_phys = ', iflag_phys
+    WRITE(lunout, *)' iphysiq = ', iphysiq
+    WRITE(lunout, *)' clonn = ', clonn
+    WRITE(lunout, *)' clatt = ', clatt
+    WRITE(lunout, *)' grossismx = ', grossismx
+    WRITE(lunout, *)' grossismy = ', grossismy
+    WRITE(lunout, *)' fxyhypbb = ', fxyhypbb
+    WRITE(lunout, *)' dzoomxx = ', dzoomxx
+    WRITE(lunout, *)' dzoomy = ', dzoomyy
+    WRITE(lunout, *)' tauxx = ', tauxx
+    WRITE(lunout, *)' tauyy = ', tauyy
+    WRITE(lunout, *)' offline = ', offline
+    WRITE(lunout, *)' type_trac = ', type_trac
+    WRITE(lunout, *)' ok_dynzon = ', ok_dynzon
+    WRITE(lunout, *)' ok_dyn_ins = ', ok_dyn_ins
+    WRITE(lunout, *)' ok_dyn_ave = ', ok_dyn_ave
+    WRITE(lunout, *)' adv_qsat_liq = ', adv_qsat_liq
   ELSE
     !Config  Key  = clon
@@ -710,5 +710,5 @@
 
     IF(grossismx<1.)  THEN
-      write(lunout, *) &
+      WRITE(lunout, *) &
               'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
       CALL abort_gcm("conf_gcm", "stopped", 1)
@@ -718,5 +718,5 @@
 
     IF(grossismy<1.)  THEN
-      write(lunout, *) 'conf_gcm: ***ATTENTION !! grossismy < 1 . *** '
+      WRITE(lunout, *) 'conf_gcm: ***ATTENTION !! grossismy < 1 . *** '
       CALL abort_gcm("conf_gcm", "stopped", 1)
     ELSE
@@ -724,5 +724,5 @@
     ENDIF
 
-    write(lunout, *)'conf_gcm: alphax alphay ', alphax, alphay
+    WRITE(lunout, *)'conf_gcm: alphax alphay ', alphax, alphay
 
     !    alphax et alphay sont les anciennes formulat. des grossissements
@@ -865,50 +865,50 @@
     CALL getin('read_orop', read_orop)
 
-    write(lunout, *)' #########################################'
-    write(lunout, *)' Configuration des parametres de cel0_limit: '
-    write(lunout, *)' planet_type = ', planet_type
-    write(lunout, *)' calend = ', calend
-    write(lunout, *)' dayref = ', dayref
-    write(lunout, *)' anneeref = ', anneeref
-    write(lunout, *)' nday = ', nday
-    write(lunout, *)' day_step = ', day_step
-    write(lunout, *)' iperiod = ', iperiod
-    write(lunout, *)' iconser = ', iconser
-    write(lunout, *)' iecri = ', iecri
-    write(lunout, *)' periodav = ', periodav
-    write(lunout, *)' output_grads_dyn = ', output_grads_dyn
-    write(lunout, *)' dissip_period = ', dissip_period
-    write(lunout, *)' lstardis = ', lstardis
-    write(lunout, *)' nitergdiv = ', nitergdiv
-    write(lunout, *)' nitergrot = ', nitergrot
-    write(lunout, *)' niterh = ', niterh
-    write(lunout, *)' tetagdiv = ', tetagdiv
-    write(lunout, *)' tetagrot = ', tetagrot
-    write(lunout, *)' tetatemp = ', tetatemp
-    write(lunout, *)' coefdis = ', coefdis
-    write(lunout, *)' purmats = ', purmats
-    write(lunout, *)' read_start = ', read_start
-    write(lunout, *)' iflag_phys = ', iflag_phys
-    write(lunout, *)' iphysiq = ', iphysiq
-    write(lunout, *)' clon = ', clon
-    write(lunout, *)' clat = ', clat
-    write(lunout, *)' grossismx = ', grossismx
-    write(lunout, *)' grossismy = ', grossismy
-    write(lunout, *)' fxyhypb = ', fxyhypb
-    write(lunout, *)' dzoomx = ', dzoomx
-    write(lunout, *)' dzoomy = ', dzoomy
-    write(lunout, *)' taux = ', taux
-    write(lunout, *)' tauy = ', tauy
-    write(lunout, *)' offline = ', offline
-    write(lunout, *)' type_trac = ', type_trac
-    write(lunout, *)' ok_dynzon = ', ok_dynzon
-    write(lunout, *)' ok_dyn_ins = ', ok_dyn_ins
-    write(lunout, *)' ok_dyn_ave = ', ok_dyn_ave
-    write(lunout, *)' ok_strato = ', ok_strato
-    write(lunout, *)' ok_gradsfile = ', ok_gradsfile
-    write(lunout, *)' ok_limit = ', ok_limit
-    write(lunout, *)' ok_etat0 = ', ok_etat0
-    write(lunout, *)' ok_guide = ', ok_guide
-    write(lunout, *)' read_orop = ', read_orop
+    WRITE(lunout, *)' #########################################'
+    WRITE(lunout, *)' Configuration des parametres de cel0_limit: '
+    WRITE(lunout, *)' planet_type = ', planet_type
+    WRITE(lunout, *)' calend = ', calend
+    WRITE(lunout, *)' dayref = ', dayref
+    WRITE(lunout, *)' anneeref = ', anneeref
+    WRITE(lunout, *)' nday = ', nday
+    WRITE(lunout, *)' day_step = ', day_step
+    WRITE(lunout, *)' iperiod = ', iperiod
+    WRITE(lunout, *)' iconser = ', iconser
+    WRITE(lunout, *)' iecri = ', iecri
+    WRITE(lunout, *)' periodav = ', periodav
+    WRITE(lunout, *)' output_grads_dyn = ', output_grads_dyn
+    WRITE(lunout, *)' dissip_period = ', dissip_period
+    WRITE(lunout, *)' lstardis = ', lstardis
+    WRITE(lunout, *)' nitergdiv = ', nitergdiv
+    WRITE(lunout, *)' nitergrot = ', nitergrot
+    WRITE(lunout, *)' niterh = ', niterh
+    WRITE(lunout, *)' tetagdiv = ', tetagdiv
+    WRITE(lunout, *)' tetagrot = ', tetagrot
+    WRITE(lunout, *)' tetatemp = ', tetatemp
+    WRITE(lunout, *)' coefdis = ', coefdis
+    WRITE(lunout, *)' purmats = ', purmats
+    WRITE(lunout, *)' read_start = ', read_start
+    WRITE(lunout, *)' iflag_phys = ', iflag_phys
+    WRITE(lunout, *)' iphysiq = ', iphysiq
+    WRITE(lunout, *)' clon = ', clon
+    WRITE(lunout, *)' clat = ', clat
+    WRITE(lunout, *)' grossismx = ', grossismx
+    WRITE(lunout, *)' grossismy = ', grossismy
+    WRITE(lunout, *)' fxyhypb = ', fxyhypb
+    WRITE(lunout, *)' dzoomx = ', dzoomx
+    WRITE(lunout, *)' dzoomy = ', dzoomy
+    WRITE(lunout, *)' taux = ', taux
+    WRITE(lunout, *)' tauy = ', tauy
+    WRITE(lunout, *)' offline = ', offline
+    WRITE(lunout, *)' type_trac = ', type_trac
+    WRITE(lunout, *)' ok_dynzon = ', ok_dynzon
+    WRITE(lunout, *)' ok_dyn_ins = ', ok_dyn_ins
+    WRITE(lunout, *)' ok_dyn_ave = ', ok_dyn_ave
+    WRITE(lunout, *)' ok_strato = ', ok_strato
+    WRITE(lunout, *)' ok_gradsfile = ', ok_gradsfile
+    WRITE(lunout, *)' ok_limit = ', ok_limit
+    WRITE(lunout, *)' ok_etat0 = ', ok_etat0
+    WRITE(lunout, *)' ok_guide = ', ok_guide
+    WRITE(lunout, *)' read_orop = ', read_orop
   ENDIF test_etatinit
 
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/dynetat0.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/dynetat0.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/dynetat0.F90	(revision 5116)
@@ -157,8 +157,8 @@
       iqParent = tracers(iq)%iqParent
       IF(tracers(iq)%iso_iZone == 0) THEN
-         if (tnat1) then
+         if (tnat1) THEN
                  tnat=1.0
                  alpha_ideal=1.0
-                 write(*,*) 'attention dans dynetat0: les alpha_ideal sont a 1'
+                 WRITE(*,*) 'attention dans dynetat0: les alpha_ideal sont a 1'
          else
           IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/fluxstokenc.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/fluxstokenc.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/fluxstokenc.F90	(revision 5116)
@@ -31,9 +31,9 @@
 
   REAL :: pbarvst(iip1, jjp1, llm), zistdyn
-  real :: dtcum
+  REAL :: dtcum
 
   INTEGER :: iadvtr, ndex(1)
-  integer :: nscal
-  real :: tst(1), ist(1), istp(1)
+  INTEGER :: nscal
+  REAL :: tst(1), ist(1), istp(1)
   INTEGER :: ij, l, irec, i, j, itau
   INTEGER, SAVE :: fluxid, fluxvid, fluxdid
@@ -52,6 +52,5 @@
   wg(:, :) = 0.
 
-  if(first) then
-
+  IF(first) THEN
     CALL initfluxsto('fluxstoke', &
             time_step, istdyn * time_step, istdyn * time_step, &
@@ -134,5 +133,5 @@
 
     iadvtr = 0
-    write(lunout, *)'ITAU auquel on stoke les fluxmasses', itau
+    WRITE(lunout, *)'ITAU auquel on stoke les fluxmasses', itau
 
     CALL histwrite(fluxid, 'masse', itau, massem, &
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/friction.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/friction.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/friction.F90	(revision 5116)
@@ -47,7 +47,7 @@
     ! set friction type
     CALL getin("friction_type", friction_type)
-    if ((friction_type<0).or.(friction_type>1)) then
+    if ((friction_type<0).or.(friction_type>1)) THEN
       abort_message = "wrong friction type"
-      write(lunout, *)'Friction: wrong friction type', friction_type
+      WRITE(lunout, *)'Friction: wrong friction type', friction_type
       CALL abort_gcm(modname, abort_message, 42)
     endif
@@ -55,5 +55,5 @@
   ENDIF
 
-  if (friction_type==0) then
+  if (friction_type==0) THEN
     !   calcul des composantes au carre du vent naturel
     do j = 1, jjp1
@@ -118,5 +118,5 @@
   endif ! of if (friction_type.eq.0)
 
-  if (friction_type==1) then
+  if (friction_type==1) THEN
     do l = 1, llm
       ucov(:, :, l) = ucov(:, :, l) * (1. - pdt * kfrict(l))
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/gcm.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/gcm.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/gcm.F90	(revision 5116)
@@ -167,13 +167,13 @@
   !      calend = 'earth_365d'
 
-  if (calend == 'earth_360d') then
+  if (calend == 'earth_360d') THEN
      CALL ioconf_calendar('360_day')
-     write(lunout,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an'
-  else if (calend == 'earth_365d') then
+     WRITE(lunout,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an'
+  else if (calend == 'earth_365d') THEN
      CALL ioconf_calendar('noleap')
-     write(lunout,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an'
-  else if (calend == 'gregorian') then
+     WRITE(lunout,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an'
+  else if (calend == 'gregorian') THEN
      CALL ioconf_calendar('gregorian')
-     write(lunout,*)'CALENDRIER CHOISI: Terrestre bissextile'
+     WRITE(lunout,*)'CALENDRIER CHOISI: Terrestre bissextile'
   else
      abort_message = 'Mauvais choix de calendrier'
@@ -203,12 +203,12 @@
 
   !  lecture du fichier start.nc
-  if (read_start) then
+  if (read_start) THEN
      ! we still need to run iniacademic to initialize some
      ! constants & fields, if we run the 'newtonian' or 'SW' cases:
-     if (iflag_phys/=1) then
+     if (iflag_phys/=1) THEN
         CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0)
      endif
 
-     !        if (planet_type.eq."earth") then
+     !        if (planet_type.eq."earth") THEN
      ! Load an Earth-format start file
      CALL dynetat0("start.nc",vcov,ucov, &
@@ -216,9 +216,9 @@
      !        endif ! of if (planet_type.eq."earth")
 
-     !       write(73,*) 'ucov',ucov
-     !       write(74,*) 'vcov',vcov
-     !       write(75,*) 'teta',teta
-     !       write(76,*) 'ps',ps
-     !       write(77,*) 'q',q
+     !       WRITE(73,*) 'ucov',ucov
+     !       WRITE(74,*) 'vcov',vcov
+     !       WRITE(75,*) 'teta',teta
+     !       WRITE(76,*) 'ps',ps
+     !       WRITE(77,*) 'q',q
 
   endif ! of if (read_start)
@@ -228,5 +228,5 @@
   IF (prt_level > 9) WRITE(lunout,*) &
        'GCM: AVANT iniacademic AVANT AVANT AVANT AVANT'
-  if (.not.read_start) then
+  if (.not.read_start) THEN
      start_time=0.
      annee_ref=anneeref
@@ -260,8 +260,8 @@
   ! on remet le calendrier \`a zero si demande
 
-  IF (start_time /= starttime) then
+  IF (start_time /= starttime) THEN
      WRITE(lunout,*)' GCM: Attention l''heure de depart lue dans le' &
           ,' fichier restart ne correspond pas a celle lue dans le run.def'
-     IF (raz_date == 1) then
+     IF (raz_date == 1) THEN
         WRITE(lunout,*)'Je prends l''heure lue dans run.def'
         start_time = starttime
@@ -277,27 +277,27 @@
      itau_phy = 0
      time_0 = 0.
-     write(lunout,*) &
+     WRITE(lunout,*) &
           'GCM: On reinitialise a la date lue dans gcm.def'
   ELSE IF (annee_ref /= anneeref .or. day_ref /= dayref) THEN
-     write(lunout,*) &
+     WRITE(lunout,*) &
           'GCM: Attention les dates initiales lues dans le fichier'
-     write(lunout,*) &
+     WRITE(lunout,*) &
           ' restart ne correspondent pas a celles lues dans '
-     write(lunout,*)' gcm.def'
-     write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref
-     write(lunout,*)' day_ref=',day_ref," dayref=",dayref
-     write(lunout,*)' Pas de remise a zero'
-  ENDIF
-
-  !      if (annee_ref .ne. anneeref .or. day_ref .ne. dayref) then
-  !        write(lunout,*)
+     WRITE(lunout,*)' gcm.def'
+     WRITE(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref
+     WRITE(lunout,*)' day_ref=',day_ref," dayref=",dayref
+     WRITE(lunout,*)' Pas de remise a zero'
+  ENDIF
+
+  !      if (annee_ref .ne. anneeref .or. day_ref .ne. dayref) THEN
+  !        WRITE(lunout,*)
   !     .  'GCM: Attention les dates initiales lues dans le fichier'
-  !        write(lunout,*)
+  !        WRITE(lunout,*)
   !     .  ' restart ne correspondent pas a celles lues dans '
-  !        write(lunout,*)' gcm.def'
-  !        write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref
-  !        write(lunout,*)' day_ref=',day_ref," dayref=",dayref
-  !        if (raz_date .ne. 1) then
-  !          write(lunout,*)
+  !        WRITE(lunout,*)' gcm.def'
+  !        WRITE(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref
+  !        WRITE(lunout,*)' day_ref=',day_ref," dayref=",dayref
+  !        if (raz_date .ne. 1) THEN
+  !          WRITE(lunout,*)
   !     .    'GCM: On garde les dates du fichier restart'
   !        else
@@ -308,5 +308,5 @@
   !          itau_phy = 0
   !          time_0 = 0.
-  !          write(lunout,*)
+  !          WRITE(lunout,*)
   !     .   'GCM: On reinitialise a la date lue dans gcm.def'
   !        endif
@@ -323,13 +323,13 @@
   CALL ioconf_startdate(INT(jD_ref), jH_ref)
 
-  write(lunout,*)'DEBUG'
-  write(lunout,*)'annee_ref, mois, day_ref, heure, jD_ref'
-  write(lunout,*)annee_ref, mois, day_ref, heure, jD_ref
+  WRITE(lunout,*)'DEBUG'
+  WRITE(lunout,*)'annee_ref, mois, day_ref, heure, jD_ref'
+  WRITE(lunout,*)annee_ref, mois, day_ref, heure, jD_ref
   CALL ju2ymds(jD_ref+jH_ref,an, mois, jour, heure)
-  write(lunout,*)'jD_ref+jH_ref,an, mois, jour, heure'
-  write(lunout,*)jD_ref+jH_ref,an, mois, jour, heure
-
-
-  if (iflag_phys==1) then
+  WRITE(lunout,*)'jD_ref+jH_ref,an, mois, jour, heure'
+  WRITE(lunout,*)jD_ref+jH_ref,an, mois, jour, heure
+
+
+  if (iflag_phys==1) THEN
      ! these initialisations have already been done (via iniacademic)
      ! if running in SW or Newtonian mode
@@ -365,5 +365,5 @@
 
 
-  if (nday>=0) then
+  if (nday>=0) THEN
      day_end = day_ini + nday
   else
@@ -395,5 +395,5 @@
   ENDIF ! of IF ((iflag_phys==1).or.(iflag_phys>=100))
 
-  !      if (planet_type.eq."earth") then
+  !      if (planet_type.eq."earth") THEN
   ! Write an Earth-format restart file
 
@@ -404,5 +404,5 @@
 
   time_step = zdtvr
-  if (ok_dyn_ins) then
+  if (ok_dyn_ins) THEN
      ! initialize output file for instantaneous outputs
      ! t_ops = iecri * daysec ! do operations every t_ops
@@ -432,9 +432,9 @@
   !   ----------------------------------
 
-  !       write(78,*) 'ucov',ucov
-  !       write(78,*) 'vcov',vcov
-  !       write(78,*) 'teta',teta
-  !       write(78,*) 'ps',ps
-  !       write(78,*) 'q',q
+  !       WRITE(78,*) 'ucov',ucov
+  !       WRITE(78,*) 'vcov',vcov
+  !       WRITE(78,*) 'teta',teta
+  !       WRITE(78,*) 'ps',ps
+  !       WRITE(78,*) 'q',q
 
 
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/getparam.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/getparam.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/getparam.F90	(revision 5116)
@@ -46,7 +46,7 @@
     CALL getin(TARGET,ret_val)
 
-    write(out_eff,*) '######################################'
-    write(out_eff,*) '#### ',comment,' #####'
-    write(out_eff,*) TARGET,'=',ret_val
+    WRITE(out_eff,*) '######################################'
+    WRITE(out_eff,*) '#### ',comment,' #####'
+    WRITE(out_eff,*) TARGET,'=',ret_val
 
   END SUBROUTINE getparamr
@@ -69,8 +69,8 @@
     CALL getin(TARGET,ret_val)
 
-    write(out_eff,*) '######################################'
-    write(out_eff,*) '#### ',comment,' #####'
-    write(out_eff,*) comment
-    write(out_eff,*) TARGET,'=',ret_val
+    WRITE(out_eff,*) '######################################'
+    WRITE(out_eff,*) '#### ',comment,' #####'
+    WRITE(out_eff,*) comment
+    WRITE(out_eff,*) TARGET,'=',ret_val
 
   END SUBROUTINE getparami
@@ -93,7 +93,7 @@
     CALL getin(TARGET,ret_val)
 
-    write(out_eff,*) '######################################'
-    write(out_eff,*) '#### ',comment,' #####'
-    write(out_eff,*) TARGET,'=',ret_val
+    WRITE(out_eff,*) '######################################'
+    WRITE(out_eff,*) '#### ',comment,' #####'
+    WRITE(out_eff,*) TARGET,'=',ret_val
 
   END SUBROUTINE getparaml
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/groupe.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/groupe.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/groupe.F90	(revision 5116)
@@ -3,5 +3,5 @@
 SUBROUTINE groupe(pext, pbaru, pbarv, pbarum, pbarvm, wm)
 
-  use comconst_mod, only: ngroup
+  use comconst_mod, ONLY: ngroup
 
   IMPLICIT NONE
@@ -25,15 +25,15 @@
   ! parameter (ngroup=3)
 
-  real :: pbaru(iip1, jjp1, llm), pbarv(iip1, jjm, llm)
-  real :: pext(iip1, jjp1, llm)
+  REAL :: pbaru(iip1, jjp1, llm), pbarv(iip1, jjm, llm)
+  REAL :: pext(iip1, jjp1, llm)
 
-  real :: pbarum(iip1, jjp1, llm), pbarvm(iip1, jjm, llm)
-  real :: wm(iip1, jjp1, llm)
+  REAL :: pbarum(iip1, jjp1, llm), pbarvm(iip1, jjm, llm)
+  REAL :: wm(iip1, jjp1, llm)
 
-  real :: zconvm(iip1, jjp1, llm), zconvmm(iip1, jjp1, llm)
+  REAL :: zconvm(iip1, jjp1, llm), zconvmm(iip1, jjp1, llm)
 
-  real :: uu
+  REAL :: uu
 
-  integer :: i, j, l
+  INTEGER :: i, j, l
 
   logical :: firstcall, groupe_ok
@@ -43,11 +43,11 @@
   data groupe_ok/.TRUE./
 
-  if (iim==1) then
+  if (iim==1) THEN
     groupe_ok = .FALSE.
   endif
 
-  if (firstcall) then
-    if (groupe_ok) then
-      if(mod(iim, 2**ngroup)/=0) &
+  if (firstcall) THEN
+    if (groupe_ok) THEN
+      IF(mod(iim, 2**ngroup)/=0) &
               CALL abort_gcm('groupe', 'probleme du nombre de point', 1)
     endif
@@ -63,5 +63,5 @@
   CALL scopy(ijmllm, pbarv, 1, pbarvm, 1)
 
-  if (groupe_ok) then
+  if (groupe_ok) THEN
     CALL groupeun(jjp1, llm, zconvmm)
     CALL groupeun(jjm, llm, pbarvm)
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/guide_mod.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/guide_mod.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/guide_mod.F90	(revision 5116)
@@ -72,5 +72,5 @@
   SUBROUTINE guide_init
 
-    use netcdf, only: nf90_noerr
+    use netcdf, ONLY: nf90_noerr
     USE control_mod, ONLY: day_step
     USE serre_mod, ONLY: grossismx
@@ -127,5 +127,5 @@
     IF (iguide_sav>0) THEN
        iguide_sav=day_step/iguide_sav
-    ELSE if (iguide_sav == 0) then
+    ELSE if (iguide_sav == 0) THEN
        iguide_sav = huge(0)
     ELSE
@@ -173,6 +173,6 @@
 ! ---------------------------------------------
     ncidpl=-99
-    if (guide_plevs==1) then
-       if (ncidpl==-99) then
+    if (guide_plevs==1) THEN
+       if (ncidpl==-99) THEN
           rcod=nf90_open('apbp.nc',nf90_nowrite, ncidpl)
           if (rcod/=nf90_noerr) THEN
@@ -181,6 +181,6 @@
           endif
        endif
-    elseif (guide_plevs==2) then
-       if (ncidpl==-99) then
+    elseif (guide_plevs==2) THEN
+       if (ncidpl==-99) THEN
           rcod=nf90_open('P.nc',nf90_nowrite,ncidpl)
           if (rcod/=nf90_noerr) THEN
@@ -190,6 +190,6 @@
        endif
 
-    elseif (guide_u) then
-           if (ncidpl==-99) then
+    elseif (guide_u) THEN
+           if (ncidpl==-99) THEN
                rcod=nf90_open('u.nc',nf90_nowrite,ncidpl)
                if (rcod/=nf90_noerr) THEN
@@ -199,6 +199,6 @@
            endif
 
-    elseif (guide_v) then
-           if (ncidpl==-99) then
+    elseif (guide_v) THEN
+           if (ncidpl==-99) THEN
                rcod=nf90_open('v.nc',nf90_nowrite,ncidpl)
                if (rcod/=nf90_noerr) THEN
@@ -207,6 +207,6 @@
                endif
            endif
-    elseif (guide_T) then
-           if (ncidpl==-99) then
+    elseif (guide_T) THEN
+           if (ncidpl==-99) THEN
                rcod=nf90_open('T.nc',nf90_nowrite,ncidpl)
                if (rcod/=nf90_noerr) THEN
@@ -215,6 +215,6 @@
                endif
            endif
-    elseif (guide_Q) then
-           if (ncidpl==-99) then
+    elseif (guide_Q) THEN
+           if (ncidpl==-99) THEN
                rcod=nf90_open('hur.nc',nf90_nowrite, ncidpl)
                if (rcod/=nf90_noerr) THEN
@@ -232,5 +232,5 @@
     ENDIF
     error=nf90_inquire_dimension(ncidpl,rid,len=nlevnc)
-    write(*,*)trim(modname)//' : number of vertical levels nlevnc', nlevnc 
+    WRITE(*,*)trim(modname)//' : number of vertical levels nlevnc', nlevnc
     rcod = nf90_close(ncidpl)
 
@@ -406,5 +406,5 @@
         CALL tau2alpha(1,iip1,jjp1,factt,tau_min_Q,tau_max_Q,alpha_Q)
 ! correction de rappel dans couche limite
-        if (guide_BL) then
+        if (guide_BL) THEN
              alpha_pcor(:)=1.
         else
@@ -453,5 +453,5 @@
       IF (reste==0.) THEN
           IF (itau_test==itau) THEN
-            write(lunout,*)trim(modname)//' second pass in advreel at itau=',&
+            WRITE(lunout,*)trim(modname)//' second pass in advreel at itau=',&
             itau
               abort_message='stopped'
@@ -466,5 +466,5 @@
               step_rea=step_rea+1
               itau_test=itau
-              write(*,*)trim(modname)//' Reading nudging files, step ',&
+              WRITE(*,*)trim(modname)//' Reading nudging files, step ',&
                      step_rea,'after ',count_no_rea,' skips'
               IF (guide_2D) THEN
@@ -502,5 +502,5 @@
       ! compute pressures at layer interfaces
       CALL pression(ip1jmp1,ap,bp,ps,p)
-      if (pressure_exner) then
+      if (pressure_exner) THEN
         CALL exner_hyb(ip1jmp1,ps,p,pks,pk)
       else
@@ -515,6 +515,6 @@
     ENDIF
     
-    if (guide_u) then
-        if (guide_add) then
+    if (guide_u) THEN
+        if (guide_add) THEN
            f_add=(1.-tau)*ugui1+tau*ugui2
         else
@@ -529,6 +529,6 @@
     endif
 
-    if (guide_T) then
-        if (guide_add) then
+    if (guide_T) THEN
+        if (guide_add) THEN
            f_add=(1.-tau)*tgui1+tau*tgui2
         else
@@ -541,6 +541,6 @@
     endif
 
-    if (guide_P) then
-        if (guide_add) then
+    if (guide_P) THEN
+        if (guide_add) THEN
            f_add(1:ip1jmp1,1)=(1.-tau)*psgui1+tau*psgui2
         else
@@ -555,6 +555,6 @@
     endif
 
-    if (guide_Q) then
-        if (guide_add) then
+    if (guide_Q) THEN
+        if (guide_add) THEN
            f_add=(1.-tau)*qgui1+tau*qgui2
         else
@@ -567,6 +567,6 @@
     endif
 
-    if (guide_v) then
-        if (guide_add) then
+    if (guide_v) THEN
+        if (guide_add) THEN
            f_add(1:ip1jm,:)=(1.-tau)*vgui1+tau*vgui2
         else
@@ -670,8 +670,8 @@
   SUBROUTINE guide_interp(psi,teta)
   
-  use exner_hyb_m, only: exner_hyb
-  use exner_milieu_m, only: exner_milieu
-  use comconst_mod, only: kappa, cpp
-  use comvert_mod, only: preff, pressure_exner, bp, ap
+  use exner_hyb_m, ONLY: exner_hyb
+  use exner_milieu_m, ONLY: exner_milieu
+  use comconst_mod, ONLY: kappa, cpp
+  use comvert_mod, ONLY: preff, pressure_exner, bp, ap
   IMPLICIT NONE
 
@@ -705,9 +705,9 @@
   CHARACTER(LEN=20),PARAMETER :: modname="guide_interp"
   
-    write(*,*)trim(modname)//': interpolate nudging variables'
+    WRITE(*,*)trim(modname)//': interpolate nudging variables'
 ! -----------------------------------------------------------------
 ! Calcul des niveaux de pression champs guidage
 ! -----------------------------------------------------------------
-IF (guide_modele) then
+IF (guide_modele) THEN
     do i=1,iip1
         do j=1,jjp1
@@ -729,25 +729,25 @@
 
 END IF
-    if (first) then
+    if (first) THEN
         first=.FALSE.
-        write(*,*)trim(modname)//' : check vertical level order'
-        write(*,*)trim(modname)//' LMDZ :'
+        WRITE(*,*)trim(modname)//' : check vertical level order'
+        WRITE(*,*)trim(modname)//' LMDZ :'
         do l=1,llm
-          write(*,*)trim(modname)//' PL(',l,')=',(ap(l)+ap(l+1))/2. &
+          WRITE(*,*)trim(modname)//' PL(',l,')=',(ap(l)+ap(l+1))/2. &
                   +psi(1,jjp1)*(bp(l)+bp(l+1))/2.
         enddo
-        write(*,*)trim(modname)//' nudging file :'
+        WRITE(*,*)trim(modname)//' nudging file :'
         do l=1,nlevnc
-          write(*,*)trim(modname)//' PL(',l,')=',plnc2(1,1,l)
+          WRITE(*,*)trim(modname)//' PL(',l,')=',plnc2(1,1,l)
         enddo
-        write(*,*)trim(modname)//' invert ordering: invert_p=',invert_p
-        if (guide_u) then
+        WRITE(*,*)trim(modname)//' invert ordering: invert_p=',invert_p
+        if (guide_u) THEN
             do l=1,nlevnc
-              write(*,*)trim(modname)//' U(',l,')=',unat2(1,1,l)
+              WRITE(*,*)trim(modname)//' U(',l,')=',unat2(1,1,l)
             enddo
         endif
-        if (guide_T) then
+        if (guide_T) THEN
             do l=1,nlevnc
-              write(*,*)trim(modname)//' T(',l,')=',tnat2(1,1,l)
+              WRITE(*,*)trim(modname)//' T(',l,')=',tnat2(1,1,l)
             enddo
         endif
@@ -758,5 +758,5 @@
 ! -----------------------------------------------------------------
     CALL pression( ip1jmp1, ap, bp, psi, p )
-    if (pressure_exner) then
+    if (pressure_exner) THEN
       CALL exner_hyb(ip1jmp1,psi,p,pks,pk)
     else
@@ -803,5 +803,5 @@
 ! Conversion en variables gcm (ucov, vcov...)
 ! -----------------------------------------------------------------
-    if (guide_P) then
+    if (guide_P) THEN
         do j=1,jjp1
             do i=1,iim
@@ -921,6 +921,6 @@
 ! Calcul des constantes de rappel alpha (=1/tau)
 
-    use comconst_mod, only: pi
-    use serre_mod, only: clon, clat, grossismx, grossismy
+    use comconst_mod, ONLY: pi
+    use serre_mod, ONLY: clon, clat, grossismx, grossismy
     
     IMPLICIT NONE
@@ -948,5 +948,5 @@
     real alphamin,alphamax,xi
     integer i,j,ilon,ilat
-    character(len=20),parameter :: modname="tau2alpha"
+    CHARACTER(LEN=20),parameter :: modname="tau2alpha"
     CHARACTER (len = 80)   :: abort_message
 
@@ -962,11 +962,11 @@
             do j=1,pjm
                 do i=1,pim
-                    if (typ==2) then
+                    if (typ==2) THEN
                        zlat=rlatu(j)*180./pi
                        zlon=rlonu(i)*180./pi
-                    elseif (typ==1) then
+                    elseif (typ==1) THEN
                        zlat=rlatu(j)*180./pi
                        zlon=rlonv(i)*180./pi
-                    elseif (typ==3) then
+                    elseif (typ==3) THEN
                        zlat=rlatv(j)*180./pi
                        zlon=rlonv(i)*180./pi
@@ -1037,21 +1037,21 @@
             enddo
             ! Calcul de gamma
-            if (abs(grossismx-1.)<0.1.or.abs(grossismy-1.)<0.1) then
-              write(*,*)trim(modname)//' ATTENTION modele peu zoome'
-              write(*,*)trim(modname)//' ATTENTION on prend une constante de guidage cste'
+            if (abs(grossismx-1.)<0.1.or.abs(grossismy-1.)<0.1) THEN
+              WRITE(*,*)trim(modname)//' ATTENTION modele peu zoome'
+              WRITE(*,*)trim(modname)//' ATTENTION on prend une constante de guidage cste'
               gamma=0.
             else
               gamma=(dxdy_max-2.*dxdy_min)/(dxdy_max-dxdy_min)
-              write(*,*)trim(modname)//' gamma=',gamma
-              if (gamma<1.e-5) then
-                write(*,*)trim(modname)//' gamma =',gamma,'<1e-5'
+              WRITE(*,*)trim(modname)//' gamma=',gamma
+              if (gamma<1.e-5) THEN
+                WRITE(*,*)trim(modname)//' gamma =',gamma,'<1e-5'
                 abort_message='stopped'
                 CALL abort_gcm(modname,abort_message,1)
               endif
               gamma=log(0.5)/log(gamma)
-              if (gamma4) then 
+              if (gamma4) THEN
                 gamma=min(gamma,4.)
               endif
-              write(*,*)trim(modname)//' gamma=',gamma
+              WRITE(*,*)trim(modname)//' gamma=',gamma
             endif
         ENDIF !first
@@ -1059,15 +1059,15 @@
         do j=1,pjm
             do i=1,pim
-                if (typ==1) then
+                if (typ==1) THEN
                    dxdy_=dxdys(i,j)
                    zlat=rlatu(j)*180./pi
-                elseif (typ==2) then
+                elseif (typ==2) THEN
                    dxdy_=dxdyu(i,j)
                    zlat=rlatu(j)*180./pi
-                elseif (typ==3) then
+                elseif (typ==3) THEN
                    dxdy_=dxdyv(i,j)
                    zlat=rlatv(j)*180./pi
                 endif
-                if (abs(grossismx-1.)<0.1.or.abs(grossismy-1.)<0.1) then
+                if (abs(grossismx-1.)<0.1.or.abs(grossismy-1.)<0.1) THEN
                 ! pour une grille reguliere, xi=xxx**0=1 -> alpha=alphamin
                     alpha(i,j)=alphamin
@@ -1075,5 +1075,5 @@
                     xi=((dxdy_max-dxdy_)/(dxdy_max-dxdy_min))**gamma
                     xi=min(xi,1.)
-                    if(lat_min_g<=zlat .and. zlat<=lat_max_g) then
+                    IF(lat_min_g<=zlat .and. zlat<=lat_max_g) THEN
                         alpha(i,j)=xi*alphamin+(1.-xi)*alphamax
                     else
@@ -1113,10 +1113,10 @@
 ! Premier appel: initialisation de la lecture des fichiers
 ! -----------------------------------------------------------------
-    if (first) then
+    if (first) THEN
          ncidpl=-99
-         write(*,*) trim(modname)//': opening nudging files '
+         WRITE(*,*) trim(modname)//': opening nudging files '
 ! Niveaux de pression si non constants
-         if (guide_plevs==1) then
-             write(*,*) trim(modname)//' Reading nudging on model levels'
+         if (guide_plevs==1) THEN
+             WRITE(*,*) trim(modname)//' Reading nudging on model levels'
              rcode = nf90_open('apbp.nc', nf90_nowrite, ncidpl)
              IF (rcode/=nf90_noerr) THEN
@@ -1134,9 +1134,9 @@
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
-             write(*,*) trim(modname)//' ncidpl,varidap',ncidpl,varidap
+             WRITE(*,*) trim(modname)//' ncidpl,varidap',ncidpl,varidap
          endif
 
 ! Pression si guidage sur niveaux P variables
-         if (guide_plevs==2) then
+         if (guide_plevs==2) THEN
              rcode = nf90_open('P.nc', nf90_nowrite, ncidp)
              IF (rcode/=nf90_noerr) THEN
@@ -1149,10 +1149,10 @@
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
-             write(*,*) trim(modname)//' ncidp,varidp',ncidp,varidp
+             WRITE(*,*) trim(modname)//' ncidp,varidp',ncidp,varidp
              if (ncidpl==-99) ncidpl=ncidp
          endif
 
 ! Vent zonal
-         if (guide_u) then
+         if (guide_u) THEN
              rcode = nf90_open('u.nc', nf90_nowrite, ncidu)
              IF (rcode/=nf90_noerr) THEN
@@ -1165,5 +1165,5 @@
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
-             write(*,*) trim(modname)//' ncidu,varidu',ncidu,varidu
+             WRITE(*,*) trim(modname)//' ncidu,varidu',ncidu,varidu
              if (ncidpl==-99) ncidpl=ncidu
 
@@ -1185,5 +1185,5 @@
 
 ! Vent meridien
-         if (guide_v) then
+         if (guide_v) THEN
              rcode = nf90_open('v.nc', nf90_nowrite, ncidv)
              IF (rcode/=nf90_noerr) THEN
@@ -1196,5 +1196,5 @@
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
-             write(*,*) trim(modname)//' ncidv,varidv',ncidv,varidv
+             WRITE(*,*) trim(modname)//' ncidv,varidv',ncidv,varidv
              if (ncidpl==-99) ncidpl=ncidv
              
@@ -1218,5 +1218,5 @@
 
 ! Temperature
-         if (guide_T) then
+         if (guide_T) THEN
              rcode = nf90_open('T.nc', nf90_nowrite, ncidt)
              IF (rcode/=nf90_noerr) THEN
@@ -1229,5 +1229,5 @@
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
-             write(*,*) trim(modname)//' ncidT,varidT',ncidt,varidt
+             WRITE(*,*) trim(modname)//' ncidT,varidT',ncidt,varidt
              if (ncidpl==-99) ncidpl=ncidt
 
@@ -1249,5 +1249,5 @@
 
 ! Humidite
-         if (guide_Q) then
+         if (guide_Q) THEN
              rcode = nf90_open('hur.nc', nf90_nowrite, ncidQ)
              IF (rcode/=nf90_noerr) THEN
@@ -1260,5 +1260,5 @@
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
-             write(*,*) trim(modname)//' ncidQ,varidQ',ncidQ,varidQ
+             WRITE(*,*) trim(modname)//' ncidQ,varidQ',ncidQ,varidQ
              if (ncidpl==-99) ncidpl=ncidQ
 
@@ -1280,5 +1280,5 @@
 
 ! Pression de surface
-         if ((guide_P).OR.(guide_modele)) then
+         if ((guide_P).OR.(guide_modele)) THEN
              rcode = nf90_open('ps.nc', nf90_nowrite, ncidps)
              IF (rcode/=nf90_noerr) THEN
@@ -1291,14 +1291,14 @@
               CALL abort_gcm(modname,abort_message,1)
              ENDIF
-             write(*,*) trim(modname)//' ncidps,varidps',ncidps,varidps
+             WRITE(*,*) trim(modname)//' ncidps,varidps',ncidps,varidps
          endif
 ! Coordonnee verticale
-         if (guide_plevs==0) then
+         if (guide_plevs==0) THEN
               rcode = nf90_inq_varid(ncidpl, 'LEVEL', varidpl)
               IF (rcode/=0) rcode = nf90_inq_varid(ncidpl, 'PRESSURE', varidpl)
-              write(*,*) trim(modname)//' ncidpl,varidpl',ncidpl,varidpl
+              WRITE(*,*) trim(modname)//' ncidpl,varidpl',ncidpl,varidpl
          endif
 ! Coefs ap, bp pour calcul de la pression aux differents niveaux
-         if (guide_plevs==1) then
+         if (guide_plevs==1) THEN
              status=nf90_get_var(ncidpl,varidap,apnc,[1],[nlevnc])
              status=nf90_get_var(ncidpl,varidbp,bpnc,[1],[nlevnc])
@@ -1328,5 +1328,5 @@
 
 ! Pression 
-     if (guide_plevs==2) then
+     if (guide_plevs==2) THEN
          status=nf90_get_var(ncidp,varidp,pnat2,start,count)
          IF (invert_y) THEN
@@ -1338,5 +1338,5 @@
 
 !  Vent zonal
-     if (guide_u) then
+     if (guide_u) THEN
          status=nf90_get_var(ncidu,varidu,unat2,start,count)
          IF (invert_y) THEN
@@ -1346,5 +1346,5 @@
 
 !  Temperature
-     if (guide_T) then
+     if (guide_T) THEN
          status=nf90_get_var(ncidt,varidt,tnat2,start,count)
          IF (invert_y) THEN
@@ -1354,5 +1354,5 @@
 
 !  Humidite
-     if (guide_Q) then
+     if (guide_Q) THEN
          status=nf90_get_var(ncidQ,varidQ,qnat2,start,count)
          IF (invert_y) THEN
@@ -1363,5 +1363,5 @@
 
 !  Vent meridien
-     if (guide_v) then
+     if (guide_v) THEN
          count(2)=jjm
          status=nf90_get_var(ncidv,varidv,vnat2,start,count)
@@ -1372,5 +1372,5 @@
 
 !  Pression de surface
-     if ((guide_P).OR.(guide_modele))  then
+     if ((guide_P).OR.(guide_modele))  THEN
          start(3)=timestep
          start(4)=0
@@ -1413,10 +1413,10 @@
 ! Premier appel: initialisation de la lecture des fichiers
 ! -----------------------------------------------------------------
-    if (first) then
+    if (first) THEN
          ncidpl=-99
-         write(*,*)trim(modname)//' : opening nudging files '
+         WRITE(*,*)trim(modname)//' : opening nudging files '
 ! Ap et Bp si niveaux de pression hybrides
-         if (guide_plevs==1) then
-           write(*,*)trim(modname)//' Reading nudging on model levels'
+         if (guide_plevs==1) THEN
+           WRITE(*,*)trim(modname)//' Reading nudging on model levels'
            rcode = nf90_open('apbp.nc', nf90_nowrite, ncidpl)
            IF (rcode/=nf90_noerr) THEN
@@ -1434,8 +1434,8 @@
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
-           write(*,*)trim(modname)//'ncidpl,varidap',ncidpl,varidap
+           WRITE(*,*)trim(modname)//'ncidpl,varidap',ncidpl,varidap
          endif
 ! Pression
-         if (guide_plevs==2) then
+         if (guide_plevs==2) THEN
            rcode = nf90_open('P.nc', nf90_nowrite, ncidp)
            IF (rcode/=nf90_noerr) THEN
@@ -1448,9 +1448,9 @@
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
-           write(*,*)trim(modname)//' ncidp,varidp',ncidp,varidp
+           WRITE(*,*)trim(modname)//' ncidp,varidp',ncidp,varidp
            if (ncidpl==-99) ncidpl=ncidp
          endif
 ! Vent zonal
-         if (guide_u) then
+         if (guide_u) THEN
            rcode = nf90_open('u.nc', nf90_nowrite, ncidu)
            IF (rcode/=nf90_noerr) THEN
@@ -1463,9 +1463,9 @@
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
-           write(*,*)trim(modname)//' ncidu,varidu',ncidu,varidu
+           WRITE(*,*)trim(modname)//' ncidu,varidu',ncidu,varidu
            if (ncidpl==-99) ncidpl=ncidu
          endif
 ! Vent meridien
-         if (guide_v) then
+         if (guide_v) THEN
            rcode = nf90_open('v.nc', nf90_nowrite, ncidv)
            IF (rcode/=nf90_noerr) THEN
@@ -1478,9 +1478,9 @@
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
-           write(*,*)trim(modname)//' ncidv,varidv',ncidv,varidv
+           WRITE(*,*)trim(modname)//' ncidv,varidv',ncidv,varidv
            if (ncidpl==-99) ncidpl=ncidv
          endif
 ! Temperature
-         if (guide_T) then
+         if (guide_T) THEN
            rcode = nf90_open('T.nc', nf90_nowrite, ncidt)
            IF (rcode/=nf90_noerr) THEN
@@ -1493,9 +1493,9 @@
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
-           write(*,*)trim(modname)//' ncidT,varidT',ncidt,varidt
+           WRITE(*,*)trim(modname)//' ncidT,varidT',ncidt,varidt
            if (ncidpl==-99) ncidpl=ncidt
          endif
 ! Humidite
-         if (guide_Q) then
+         if (guide_Q) THEN
            rcode = nf90_open('hur.nc', nf90_nowrite, ncidQ)
            IF (rcode/=nf90_noerr) THEN
@@ -1508,9 +1508,9 @@
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
-           write(*,*)trim(modname)//' ncidQ,varidQ',ncidQ,varidQ
+           WRITE(*,*)trim(modname)//' ncidQ,varidQ',ncidQ,varidQ
            if (ncidpl==-99) ncidpl=ncidQ
          endif
 ! Pression de surface
-         if ((guide_P).OR.(guide_modele)) then
+         if ((guide_P).OR.(guide_modele)) THEN
            rcode = nf90_open('ps.nc', nf90_nowrite, ncidps)
            IF (rcode/=nf90_noerr) THEN
@@ -1523,14 +1523,14 @@
              CALL abort_gcm(modname,abort_message,1)
            ENDIF
-           write(*,*)trim(modname)//' ncidps,varidps',ncidps,varidps
+           WRITE(*,*)trim(modname)//' ncidps,varidps',ncidps,varidps
          endif
 ! Coordonnee verticale
-         if (guide_plevs==0) then
+         if (guide_plevs==0) THEN
            rcode = nf90_inq_varid(ncidpl, 'LEVEL', varidpl)
            IF (rcode/=0) rcode = nf90_inq_varid(ncidpl, 'PRESSURE', varidpl)
-           write(*,*)trim(modname)//' ncidpl,varidpl',ncidpl,varidpl
+           WRITE(*,*)trim(modname)//' ncidpl,varidpl',ncidpl,varidpl
          endif
 ! Coefs ap, bp pour calcul de la pression aux differents niveaux
-         if (guide_plevs==1) then
+         if (guide_plevs==1) THEN
              status=nf90_get_var(ncidpl,varidap,apnc,[1],[nlevnc])
              status=nf90_get_var(ncidpl,varidbp,bpnc,[1],[nlevnc])
@@ -1559,5 +1559,5 @@
 
 !  Pression
-     if (guide_plevs==2) then
+     if (guide_plevs==2) THEN
          status=nf90_get_var(ncidp,varidp,zu,start,count)
          DO i=1,iip1
@@ -1572,5 +1572,5 @@
      endif
 !  Vent zonal
-     if (guide_u) then
+     if (guide_u) THEN
          status=nf90_get_var(ncidu,varidu,zu,start,count)
          DO i=1,iip1
@@ -1585,5 +1585,5 @@
 
 !  Temperature
-     if (guide_T) then
+     if (guide_T) THEN
          status=nf90_get_var(ncidt,varidt,zu,start,count)
          DO i=1,iip1
@@ -1598,5 +1598,5 @@
 
 !  Humidite
-     if (guide_Q) then
+     if (guide_Q) THEN
          status=nf90_get_var(ncidQ,varidQ,zu,start,count)
          DO i=1,iip1
@@ -1611,5 +1611,5 @@
 
 !  Vent meridien
-     if (guide_v) then
+     if (guide_v) THEN
          count(2)=jjm
          status=nf90_get_var(ncidv,varidv,zv,start,count)
@@ -1625,5 +1625,5 @@
 
 !  Pression de surface
-     if ((guide_P).OR.(guide_plevs==1))  then
+     if ((guide_P).OR.(guide_plevs==1))  THEN
          start(3)=timestep
          start(4)=0
@@ -1674,5 +1674,5 @@
     CHARACTER(LEN=20),PARAMETER :: modname="guide_out"
 
-    write(*,*)trim(modname)//': output timestep',timestep,'var ',varname
+    WRITE(*,*)trim(modname)//': output timestep',timestep,'var ',varname
     IF (timestep==0) THEN
 ! ----------------------------------------------
@@ -1804,5 +1804,5 @@
     do l=1,nl
         do i=2,iim-1
-            if(abs(x(i,l))>1.e10) then
+            IF(abs(x(i,l))>1.e10) THEN
                zz=0.5*(x(i-1,l)+x(i+1,l))
               PRINT*,'correction ',i,l,x(i,l),zz
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/iniacademic.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/iniacademic.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/iniacademic.F90	(revision 5116)
@@ -7,6 +7,6 @@
   USE infotrac,    ONLY: nqtot, niso, iqIsoPha, tracers, getKey, isoName
   USE control_mod, ONLY: day_step,planet_type
-  use exner_hyb_m, only: exner_hyb
-  use exner_milieu_m, only: exner_milieu
+  use exner_hyb_m, ONLY: exner_hyb
+  use exner_milieu_m, ONLY: exner_milieu
   USE IOIPSL, ONLY: getin
   USE Write_Field
@@ -60,5 +60,5 @@
   INTEGER i,j,l,lsup,ij, iq, iName, iPhase, iqParent
 
-  integer :: nid_relief,varid,ierr
+  INTEGER :: nid_relief,varid,ierr
   real, dimension(iip1,jjp1) :: relief
 
@@ -75,12 +75,12 @@
   LOGICAL,PARAMETER :: tnat1=.TRUE.
   
-  character(len=*),parameter :: modname="iniacademic"
-  character(len=80) :: abort_message
+  CHARACTER(LEN=*),parameter :: modname="iniacademic"
+  CHARACTER(LEN=80) :: abort_message
 
   ! Sanity check: verify that options selected by user are not incompatible
-  if ((iflag_phys==1).and. .not. read_start) then
-    write(lunout,*) trim(modname)," error: if read_start is set to ", &
+  if ((iflag_phys==1).and. .not. read_start) THEN
+    WRITE(lunout,*) trim(modname)," error: if read_start is set to ", &
     " false then iflag_phys should not be 1"
-    write(lunout,*) "You most likely want an aquaplanet initialisation", &
+    WRITE(lunout,*) "You most likely want an aquaplanet initialisation", &
     " (iflag_phys >= 100)"
     CALL abort_gcm(modname,"incompatible iflag_phys==1 and read_start==.FALSE.",1)
@@ -109,5 +109,5 @@
   ang0       = 0.
 
-  if (llm == 1) then
+  if (llm == 1) THEN
      ! specific initializations for the shallow water case
      kappa=1
@@ -164,5 +164,5 @@
      CALL pression ( ip1jmp1, ap, bp, ps, p       )
 
-     if (pressure_exner) then
+     if (pressure_exner) THEN
        CALL exner_hyb( ip1jmp1, ps, p, pks, pk)
      else
@@ -172,7 +172,7 @@
   ENDIF
 
-  if (llm == 1) then
+  if (llm == 1) THEN
      ! initialize fields for the shallow water case, if required
-     if (.not.read_start) then
+     if (.not.read_start) THEN
         phis(:)=0.
         q(:,:,:)=0
@@ -181,5 +181,5 @@
   endif
 
-  academic_case: if (iflag_phys >= 2) then
+  academic_case: if (iflag_phys >= 2) THEN
      ! initializations
 
@@ -249,5 +249,5 @@
            tetajl(j,l)=teta0-delt_y*ddsin*ddsin+eps*ddsin &
                 -delt_z*(1.-ddsin*ddsin)*log(zsig)
-           if (planet_type=="giant") then
+           if (planet_type=="giant") THEN
              tetajl(j,l)=teta0+(delt_y*                   &
                 ((sin(rlatu(j)*3.14159*eps+0.0001))**2)   &
@@ -293,5 +293,5 @@
 
         ! winds
-        if (ok_geost) then
+        if (ok_geost) THEN
            CALL ugeostr(phi,ucov)
         else
@@ -301,5 +301,5 @@
 
         ! bulk initialization of tracers
-        if (planet_type=="earth") then
+        if (planet_type=="earth") THEN
            ! Earth: first two tracers will be water
            do iq=1,nqtot
@@ -315,8 +315,8 @@
               iqParent = tracers(iq)%iqParent
               IF(tracers(iq)%iso_iZone == 0) THEN
-                 if (tnat1) then
+                 if (tnat1) THEN
                          tnat=1.0
                          alpha_ideal=1.0
-                         write(*,*) 'Attention dans iniacademic: alpha_ideal=1'
+                         WRITE(*,*) 'Attention dans iniacademic: alpha_ideal=1'
                  else
                     IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/iniinterp_horiz.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/iniinterp_horiz.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/iniinterp_horiz.F90	(revision 5116)
@@ -32,17 +32,17 @@
   !  """""""""
   ! INPUT
-  integer :: imo, jmo ! dimensions ancienne grille
-  integer :: imn, jmn  ! dimensions nouvelle grille
-  integer :: kllm ! taille du tableau des intersections
-  real :: rlonuo(imo + 1)     !  Latitude et
-  real :: rlatvo(jmo)       !  longitude des
-  real :: rlonun(imn + 1)     !  bord des
-  real :: rlatvn(jmn)     !  cases "scalaires" (input)
+  INTEGER :: imo, jmo ! dimensions ancienne grille
+  INTEGER :: imn, jmn  ! dimensions nouvelle grille
+  INTEGER :: kllm ! taille du tableau des intersections
+  REAL :: rlonuo(imo + 1)     !  Latitude et
+  REAL :: rlatvo(jmo)       !  longitude des
+  REAL :: rlonun(imn + 1)     !  bord des
+  REAL :: rlatvn(jmn)     !  cases "scalaires" (input)
 
   ! OUTPUT
-  integer :: ktotal ! nombre totale d'intersections reperees
-  integer :: iik(kllm), jjk(kllm), jk(kllm), ik(kllm)
-  real :: intersec(kllm)  ! surface des intersections (m2)
-  real :: airen (imn + 1, jmn + 1) ! aire dans la nouvelle grille
+  INTEGER :: ktotal ! nombre totale d'intersections reperees
+  INTEGER :: iik(kllm), jjk(kllm), jk(kllm), ik(kllm)
+  REAL :: intersec(kllm)  ! surface des intersections (m2)
+  REAL :: airen (imn + 1, jmn + 1) ! aire dans la nouvelle grille
 
 
@@ -51,9 +51,9 @@
   ! Autres variables
   ! """"""""""""""""
-  integer :: i, j, ii, jj, k
-  real :: a(imo + 1), b(imo + 1), c(jmo + 1), d(jmo + 1)
-  real :: an(imn + 1), bn(imn + 1), cn(jmn + 1), dn(jmn + 1)
-  real :: aa, bb, cc, dd
-  real :: pi
+  INTEGER :: i, j, ii, jj, k
+  REAL :: a(imo + 1), b(imo + 1), c(jmo + 1), d(jmo + 1)
+  REAL :: an(imn + 1), bn(imn + 1), cn(jmn + 1), dn(jmn + 1)
+  REAL :: aa, bb, cc, dd
+  REAL :: pi
 
   pi = 2. * ASIN(1.)
@@ -116,5 +116,5 @@
   do jj = 1, jmn + 1
     do j = 1, jmo + 1
-      if((cn(jj)<d(j)).and.(dn(jj)>c(j)))then
+      if((cn(jj)<d(j)).and.(dn(jj)>c(j)))THEN
         do ii = 1, imn + 1
           do i = 1, imo + 1
@@ -124,5 +124,5 @@
                     .or. ((an(ii)<b(i) + 2 * pi).and.(bn(ii)>a(i) + 2 * pi) &
                             .and.(a(i) + 2 * pi>pi)) &
-                    )then
+                    )THEN
               ktotal = ktotal + 1
               iik(ktotal) = ii
@@ -135,10 +135,10 @@
               if (cc< c(j))cc = c(j)
               if((an(ii)<b(i) - 2 * pi).and. &
-                      (bn(ii)>a(i) - 2 * pi)) then
+                      (bn(ii)>a(i) - 2 * pi)) THEN
                 bb = min(b(i) - 2 * pi, bn(ii))
                 aa = an(ii)
                 if (aa<a(i) - 2 * pi) aa = a(i) - 2 * pi
               else if((an(ii)<b(i) + 2 * pi).and. &
-                      (bn(ii)>a(i) + 2 * pi)) then
+                      (bn(ii)>a(i) + 2 * pi)) THEN
                 bb = min(b(i) + 2 * pi, bn(ii))
                 aa = an(ii)
@@ -165,12 +165,12 @@
   !  i = ik(k)
   !  j = jk(k)
-  !  if ((ii.eq.10).and.(jj.eq.10).and.(i.eq.10).and.(j.eq.10))then
-  !  if (jj.eq.2.and.(ii.eq.1))then
-  !      write(*,*) '**************** jj=',jj,'ii=',ii
-  !      write(*,*) 'i,j =',i,j
-  !      write(*,*) 'an,bn,cn,dn', an(ii), bn(ii), cn(jj),dn(jj)
-  !      write(*,*) 'a,b,c,d', a(i), b(i), c(j),d(j)
-  !      write(*,*) 'intersec(k)',intersec(k)
-  !      write(*,*) 'airen(ii,jj)=',airen(ii,jj)
+  !  if ((ii.eq.10).and.(jj.eq.10).and.(i.eq.10).and.(j.eq.10))THEN
+  !  if (jj.eq.2.and.(ii.eq.1))THEN
+  !      WRITE(*,*) '**************** jj=',jj,'ii=',ii
+  !      WRITE(*,*) 'i,j =',i,j
+  !      WRITE(*,*) 'an,bn,cn,dn', an(ii), bn(ii), cn(jj),dn(jj)
+  !      WRITE(*,*) 'a,b,c,d', a(i), b(i), c(j),d(j)
+  !      WRITE(*,*) 'intersec(k)',intersec(k)
+  !      WRITE(*,*) 'airen(ii,jj)=',airen(ii,jj)
   !  end if
   ! END DO
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/integrd.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/integrd.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/integrd.F90	(revision 5116)
@@ -7,7 +7,7 @@
 
   use control_mod, ONLY: planet_type
-  use comconst_mod, only: pi
+  use comconst_mod, ONLY: pi
   USE logic_mod, ONLY: leapf
-  use comvert_mod, only: ap, bp
+  use comvert_mod, ONLY: ap, bp
   USE temps_mod, ONLY: dt
 
@@ -98,10 +98,10 @@
   DO ij = 1, ip1jmp1
     IF(ps(ij)<0.) THEN
-      write(lunout, *) "integrd: negative surface pressure ", ps(ij)
-      write(lunout, *) " at node ij =", ij
+      WRITE(lunout, *) "integrd: negative surface pressure ", ps(ij)
+      WRITE(lunout, *) " at node ij =", ij
       ! since ij=j+(i-1)*jjp1 , we have
       j = modulo(ij, jjp1)
       i = 1 + (ij - j) / jjp1
-      write(lunout, *) " lon = ", rlonv(i) * 180. / pi, " deg", &
+      WRITE(lunout, *) " lon = ", rlonv(i) * 180. / pi, " deg", &
               " lat = ", rlatu(j) * 180. / pi, " deg"
       CALL abort_gcm("integrd", "", 1)
@@ -203,5 +203,5 @@
   !$$$      ENDIF
 
-  if (planet_type=="earth") then
+  if (planet_type=="earth") THEN
     ! Earth-specific treatment of first 2 tracers (water)
     DO l = 1, llm
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/interp_horiz.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/interp_horiz.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/interp_horiz.F90	(revision 5116)
@@ -22,29 +22,29 @@
   !  """""""""
 
-  integer :: imo, jmo ! dimensions ancienne grille (input)
-  integer :: imn, jmn  ! dimensions nouvelle grille (input)
+  INTEGER :: imo, jmo ! dimensions ancienne grille (input)
+  INTEGER :: imn, jmn  ! dimensions nouvelle grille (input)
 
-  real :: rlonuo(imo + 1)     !  Latitude et
-  real :: rlatvo(jmo)       !  longitude des
-  real :: rlonun(imn + 1)     !  bord des
-  real :: rlatvn(jmn)     !  cases "scalaires" (input)
+  REAL :: rlonuo(imo + 1)     !  Latitude et
+  REAL :: rlatvo(jmo)       !  longitude des
+  REAL :: rlonun(imn + 1)     !  bord des
+  REAL :: rlatvn(jmn)     !  cases "scalaires" (input)
 
-  integer :: lm ! dimension verticale (input)
-  real :: varo (imo + 1, jmo + 1, lm) ! var dans l'ancienne grille (input)
-  real :: varn (imn + 1, jmn + 1, lm) ! var dans la nouvelle grille (output)
+  INTEGER :: lm ! dimension verticale (input)
+  REAL :: varo (imo + 1, jmo + 1, lm) ! var dans l'ancienne grille (input)
+  REAL :: varn (imn + 1, jmn + 1, lm) ! var dans la nouvelle grille (output)
 
   ! Autres variables
   ! """"""""""""""""
-  real :: airetest(imn + 1, jmn + 1)
-  integer :: ii, jj, l
+  REAL :: airetest(imn + 1, jmn + 1)
+  INTEGER :: ii, jj, l
 
-  real :: airen (imn + 1, jmn + 1) ! aire dans la nouvelle grille
+  REAL :: airen (imn + 1, jmn + 1) ! aire dans la nouvelle grille
   !    Info sur les ktotal intersection entre les cases new/old grille
-  integer :: kllm, k, ktotal
+  INTEGER :: kllm, k, ktotal
   parameter (kllm = 400 * 200 * 10)
-  integer :: iik(kllm), jjk(kllm), jk(kllm), ik(kllm)
-  real :: intersec(kllm)
-  real :: R
-  real :: totn, tots
+  INTEGER :: iik(kllm), jjk(kllm), jk(kllm), ik(kllm)
+  REAL :: intersec(kllm)
+  REAL :: R
+  REAL :: totn, tots
 
   logical :: firstcall, firsttest, aire_ok
@@ -128,8 +128,8 @@
   !!        do ii=1, imn+1
   !!          r = airen(ii,jj)/airetest(ii,jj)
-  !!          if ((r.gt.1.001).or.(r.lt.0.999)) then
+  !!          if ((r.gt.1.001).or.(r.lt.0.999)) THEN
   !! !             write (*,*) '********** PROBLEME D'' AIRES !!!',
   !! !     &                   ' DANS L''INTERPOLATION HORIZONTALE'
-  !! !             write(*,*)'ii,jj,airen,airetest',
+  !! !             WRITE(*,*)'ii,jj,airen,airetest',
   !! !     &          ii,jj,airen(ii,jj),airetest(ii,jj)
   !!              aire_ok = .FALSE.
@@ -137,5 +137,5 @@
   !!        END DO
   !!       END DO
-  !! !      if (aire_ok) write(*,*) 'INTERP. HORIZ. : AIRES OK'
+  !! !      if (aire_ok) WRITE(*,*) 'INTERP. HORIZ. : AIRES OK'
   !!  99   continue
 
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/leapfrog.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/leapfrog.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/leapfrog.F90	(revision 5116)
@@ -15,6 +15,6 @@
           iecri, ip_ebil_dyn, ok_dynzon, ok_dyn_ins, &
           periodav, ok_dyn_ave, output_grads_dyn
-  use exner_hyb_m, only: exner_hyb
-  use exner_milieu_m, only: exner_milieu
+  use exner_hyb_m, ONLY: exner_hyb
+  use exner_milieu_m, ONLY: exner_milieu
   USE comvert_mod, ONLY: ap, bp, pressure_exner, presnivs
   USE comconst_mod, ONLY: cpp, dtphys, dtvr, pi, ihf
@@ -85,5 +85,5 @@
   REAL :: w(ip1jmp1, llm)                    ! vertical velocity
 
-  real :: zqmin, zqmax
+  REAL :: zqmin, zqmax
 
   ! variables dynamiques intermediaire pour le transport
@@ -124,5 +124,5 @@
   INTEGER :: ik
 
-  real :: time_step, t_wrt, t_ops
+  REAL :: time_step, t_wrt, t_ops
 
   ! REAL rdayvrai,rdaym_ini
@@ -137,13 +137,13 @@
   save first
   data first/.TRUE./
-  real :: dt_cum
-  character(len = 10) :: infile
-  integer :: zan, tau0, thoriid
-  integer :: nid_ctesGCM
+  REAL :: dt_cum
+  CHARACTER(LEN = 10) :: infile
+  INTEGER :: zan, tau0, thoriid
+  INTEGER :: nid_ctesGCM
   save nid_ctesGCM
-  real :: degres
-  real :: rlong(iip1), rlatg(jjp1)
-  real :: zx_tmp_2d(iip1, jjp1)
-  integer :: ndex2d(iip1 * jjp1)
+  REAL :: degres
+  REAL :: rlong(iip1), rlatg(jjp1)
+  REAL :: zx_tmp_2d(iip1, jjp1)
+  INTEGER :: ndex2d(iip1 * jjp1)
   logical :: ok_sync
   parameter (ok_sync = .TRUE.)
@@ -151,5 +151,5 @@
 
   data callinigrads/.TRUE./
-  character(len = 10) :: string10
+  CHARACTER(LEN = 10) :: string10
 
   REAL :: flxw(ip1jmp1, llm)  ! flux de masse verticale
@@ -170,7 +170,7 @@
   !-jld
 
-  character(len = 80) :: dynhist_file, dynhistave_file
-  character(len = *), parameter :: modname = "leapfrog"
-  character(len = 80) :: abort_message
+  CHARACTER(LEN = 80) :: dynhist_file, dynhistave_file
+  CHARACTER(LEN = *), parameter :: modname = "leapfrog"
+  CHARACTER(LEN = 80) :: abort_message
 
   logical :: dissip_conservative
@@ -186,7 +186,7 @@
   logical, parameter :: flag_verif = .FALSE.
 
-  integer :: itau_w   ! pas de temps ecriture = itap + itau_phy
-
-  if (nday>=0) then
+  INTEGER :: itau_w   ! pas de temps ecriture = itap + itau_phy
+
+  if (nday>=0) THEN
     itaufin = nday * day_step
   else
@@ -212,5 +212,5 @@
   dq(:, :, :) = 0.
   CALL pression (ip1jmp1, ap, bp, ps, p)
-  if (pressure_exner) then
+  if (pressure_exner) THEN
     CALL exner_hyb(ip1jmp1, ps, p, pks, pk, pkf)
   else
@@ -236,5 +236,5 @@
   CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 321')
 
-  if (ok_guide) then
+  if (ok_guide) THEN
     CALL guide_main(itau,ucov,vcov,teta,q,masse,ps)
   endif
@@ -310,5 +310,5 @@
   ! Ehouarn: for Shallow Water case (ie: 1 vertical layer),
   ! supress dissipation step
-  if (llm==1) then
+  if (llm==1) THEN
     apdiss = .FALSE.
   endif
@@ -341,5 +341,5 @@
             p, masse, dq, teta, &
             flxw, pk)
-    !write(*,*) 'caladvtrac 346'
+    !WRITE(*,*) 'caladvtrac 346'
 
     IF (offline) THEN
@@ -389,5 +389,5 @@
 
     CALL pression (ip1jmp1, ap, bp, ps, p)
-    if (pressure_exner) then
+    if (pressure_exner) THEN
       CALL exner_hyb(ip1jmp1, ps, p, pks, pk, pkf)
     else
@@ -417,7 +417,7 @@
     jD_cur = jD_cur + int(jH_cur)
     jH_cur = jH_cur - int(jH_cur)
-    ! write(lunout,*)'itau, jD_cur = ', itau, jD_cur, jH_cur
+    ! WRITE(lunout,*)'itau, jD_cur = ', itau, jD_cur, jH_cur
     ! CALL ju2ymds(jD_cur+jH_cur, an, mois, jour, secondes)
-    ! write(lunout,*)'current date = ',an, mois, jour, secondes
+    ! WRITE(lunout,*)'current date = ',an, mois, jour, secondes
 
     ! rajout debug
@@ -453,5 +453,5 @@
     CALL pression (ip1jmp1, ap, bp, ps, p)
     CALL massdair(p, masse)
-    if (pressure_exner) then
+    if (pressure_exner) THEN
       CALL exner_hyb(ip1jmp1, ps, p, pks, pk, pkf)
     else
@@ -485,5 +485,5 @@
     ENDDO ! of DO l=1,llm
 
-    if (planet_type=="giant") then
+    if (planet_type=="giant") THEN
       ! add an intrinsic heat flux at the base of the atmosphere
       teta(:, 1) = teta(:, 1) + dtvr * aire(:) * ihf / cpp / masse(:, 1)
@@ -511,5 +511,5 @@
 
   CALL pression (ip1jmp1, ap, bp, ps, p)
-  if (pressure_exner) then
+  if (pressure_exner) THEN
     CALL exner_hyb(ip1jmp1, ps, p, pks, pk, pkf)
   else
@@ -539,5 +539,5 @@
 
     !------------------------------------------------------------------------
-    if (dissip_conservative) then
+    if (dissip_conservative) THEN
       ! On rajoute la tendance due a la transform. Ec -> E therm. cree
       ! lors de la dissipation
@@ -570,5 +570,5 @@
     ENDDO
 
-    if (1 == 0) then
+    if (1 == 0) THEN
       !!! Ehouarn: lines here 1) kill 1+1=2 in the dynamics
       !!!                     2) should probably not be here anyway
@@ -590,5 +590,5 @@
 
   ! ajout debug
-  ! IF( lafin ) then
+  ! IF( lafin ) THEN
   !   abort_message = 'Simulation finished'
   !   CALL abort_gcm(modname,abort_message,0)
@@ -620,11 +620,11 @@
     ENDIF
 
-    IF(itau == itaufinp1) then
-      if (flag_verif) then
-        write(79, *) 'ucov', ucov
-        write(80, *) 'vcov', vcov
-        write(81, *) 'teta', teta
-        write(82, *) 'ps', ps
-        write(83, *) 'q', q
+    IF(itau == itaufinp1) THEN
+      if (flag_verif) THEN
+        WRITE(79, *) 'ucov', ucov
+        WRITE(80, *) 'vcov', vcov
+        WRITE(81, *) 'teta', teta
+        WRITE(82, *) 'ps', ps
+        WRITE(83, *) 'q', q
         WRITE(85, *) 'q1 = ', q(:, :, 1)
         WRITE(86, *) 'q3 = ', q(:, :, 3)
@@ -668,5 +668,5 @@
     IF(MOD(itau, iecri)==0) THEN
       ! ! Ehouarn: output only during LF or Backward Matsuno
-      if (leapf.or.(.not.leapf.and.(.not.forward))) then
+      if (leapf.or.(.not.leapf.and.(.not.forward))) THEN
         CALL geopot(ip1jmp1, teta, pk, pks, phis, phi)
         unat = 0.
@@ -675,6 +675,6 @@
           vnat(:, l) = vcov(:, l) / cv(:)
         enddo
-          if (ok_dyn_ins) then
-            ! write(lunout,*) "leapfrog: CALL writehist, itau=",itau
+          if (ok_dyn_ins) THEN
+            ! WRITE(lunout,*) "leapfrog: CALL writehist, itau=",itau
            CALL writehist(itau,vcov,ucov,teta,phi,q,masse,ps,phis)
             ! CALL WriteField('ucov',reshape(ucov,(/iip1,jmp1,llm/)))
@@ -685,5 +685,5 @@
           endif ! of if (ok_dyn_ins)
         ! For some Grads outputs of fields
-        if (output_grads_dyn) then
+        if (output_grads_dyn) THEN
           include "write_grads_dyn.h"
         endif
@@ -694,5 +694,5 @@
 
 
-      ! if (planet_type.eq."earth") then
+      ! if (planet_type.eq."earth") THEN
       ! Write an Earth-format restart file
       CALL dynredem1("restart.nc", start_time, &
@@ -701,5 +701,5 @@
 
       CLOSE(99)
-      if (ok_guide) then
+      if (ok_guide) THEN
         ! ! set ok_guide to false to avoid extra output
         ! ! in following forward step
@@ -760,5 +760,5 @@
 
       forward = .FALSE.
-      IF(itau == itaufinp1) then
+      IF(itau == itaufinp1) THEN
         abort_message = 'Simulation finished'
         CALL abort_gcm(modname, abort_message, 0)
@@ -799,11 +799,11 @@
           vnat(:, l) = vcov(:, l) / cv(:)
         enddo
-          if (ok_dyn_ins) then
-             ! write(lunout,*) "leapfrog: CALL writehist (b)",
+          if (ok_dyn_ins) THEN
+             ! WRITE(lunout,*) "leapfrog: CALL writehist (b)",
   ! &                        itau,iecri
             CALL writehist(itau,vcov,ucov,teta,phi,q,masse,ps,phis)
           endif ! of if (ok_dyn_ins)
         ! For some Grads outputs
-        if (output_grads_dyn) then
+        if (output_grads_dyn) THEN
           include "write_grads_dyn.h"
         endif
@@ -812,9 +812,9 @@
 
       IF(itau==itaufin) THEN
-        ! if (planet_type.eq."earth") then
+        ! if (planet_type.eq."earth") THEN
         CALL dynredem1("restart.nc", start_time, &
                 vcov, ucov, teta, q, masse, ps)
         ! endif ! of if (planet_type.eq."earth")
-        if (ok_guide) then
+        if (ok_guide) THEN
           ! ! set ok_guide to false to avoid extra output
           ! ! in following forward step
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/qminimum.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/qminimum.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/qminimum.F90	(revision 5116)
@@ -33,6 +33,6 @@
   REAL :: zx_defau, zx_abc, zx_pump(ip1jmp1), pompe
 
-  real :: zx_defau_diag(ip1jmp1, llm, 2)
-  real :: q_follow(ip1jmp1, llm, 2)
+  REAL :: zx_defau_diag(ip1jmp1, llm, 2)
+  REAL :: q_follow(ip1jmp1, llm, 2)
   !
   REAL :: SSUM
@@ -64,6 +64,5 @@
   DO k = 1, llm
     DO i = 1, ip1jmp1
-      if (seuil_liq - q(i, k, iq_liq) > 0.d0) then
-
+      if (seuil_liq - q(i, k, iq_liq) > 0.d0) THEN
         if (niso > 0) zx_defau_diag(i, k, 2) = AMAX1 &
                 (seuil_liq - q(i, k, iq_liq), 0.0)
@@ -81,6 +80,5 @@
     !cc      zx_abc = dpres(k) / dpres(k-1)
     DO i = 1, ip1jmp1
-      if (seuil_vap - q(i, k, iq_vap) > 0.d0) then
-
+      if (seuil_vap - q(i, k, iq_vap) > 0.d0) THEN
         if (niso > 0) zx_defau_diag(i, k, 1) &
                 = AMAX1(seuil_vap - q(i, k, iq_vap), 0.0)
@@ -113,6 +111,6 @@
   ENDIF
 
-  !write(*,*) 'qminimum 128'
-  if (niso > 0) then
+  !WRITE(*,*) 'qminimum 128'
+  if (niso > 0) THEN
     ! CRisi: traiter de même les traceurs d'eau
     ! Mais il faut les prendre à l'envers pour essayer de conserver la
@@ -123,14 +121,14 @@
     ! génant
     DO i = 1, ip1jmp1
-      if (zx_pump(i)>0.0) then
+      if (zx_pump(i)>0.0) THEN
         q_follow(i, 1, 1) = q_follow(i, 1, 1) + zx_pump(i)
-      endif !if (zx_pump(i).gt.0.0) then
+      endif !if (zx_pump(i).gt.0.0) THEN
     enddo !DO i = 1,ip1jmp1
 
     ! 2) transfert de vap vers les couches plus hautes
-    !write(*,*) 'qminimum 139'
+    !WRITE(*,*) 'qminimum 139'
     do k = 2, llm
       DO i = 1, ip1jmp1
-        if (zx_defau_diag(i, k, 1)>0.0) then
+        if (zx_defau_diag(i, k, 1)>0.0) THEN
           ! on ajoute la vapeur en k
           do ixt = 1, ntiso
@@ -153,5 +151,5 @@
                   - zx_defau_diag(i, k, 1) &
                           * deltap(i, k) / deltap(i, k - 1)
-        endif !if (zx_defau_diag(i,k,1).gt.0.0) then
+        endif !if (zx_defau_diag(i,k,1).gt.0.0) THEN
       enddo !DO i = 1, ip1jmp1
     enddo !do k=2,llm
@@ -161,9 +159,8 @@
 
     ! 3) transfert d'eau de la vapeur au liquide
-    !write(*,*) 'qminimum 164'
+    !WRITE(*,*) 'qminimum 164'
     do k = 1, llm
       DO i = 1, ip1jmp1
-        if (zx_defau_diag(i, k, 2)>0.0) then
-
+        if (zx_defau_diag(i, k, 2)>0.0) THEN
           ! ! on ajoute eau liquide en k en k
           do ixt = 1, ntiso
@@ -180,5 +177,5 @@
           q_follow(i, k, 1) = q_follow(i, k, 1) &
                   - zx_defau_diag(i, k, 2)
-        endif !if (zx_defau_diag(i,k,1).gt.0.0) then
+        endif !if (zx_defau_diag(i,k,1).gt.0.0) THEN
       enddo !DO i = 1, ip1jmp1
     enddo !do k=2,llm
@@ -186,6 +183,6 @@
     CALL check_isotopes_seq(q, ip1jmp1, 'qminimum 197')
 
-  endif !if (niso > 0) then
-  ! !write(*,*) 'qminimum 188'
+  endif !if (niso > 0) THEN
+  ! !WRITE(*,*) 'qminimum 188'
 
   !
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/replay3d.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/replay3d.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/replay3d.F90	(revision 5116)
@@ -71,5 +71,5 @@
   LOGICAL lafin
 
-  integer :: ntime=10000,it,klon,klev
+  INTEGER :: ntime=10000,it,klon,klev
 
 
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/sw_case_williamson91_6.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/sw_case_williamson91_6.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/sw_case_williamson91_6.F90	(revision 5116)
@@ -87,5 +87,5 @@
       enddo
     enddo
-    write(lunout, *) 'W91 ps', MAXVAL(ps), MINVAL(ps)
+    WRITE(lunout, *) 'W91 ps', MAXVAL(ps), MINVAL(ps)
     ! vitesse zonale ucov
     do j = 1, jjp1
@@ -101,5 +101,5 @@
       enddo
     enddo
-    write(lunout, *) 'W91 u', MAXVAL(ucov(:, 1)), MINVAL(ucov(:, 1))
+    WRITE(lunout, *) 'W91 u', MAXVAL(ucov(:, 1)), MINVAL(ucov(:, 1))
     ucov(:, 1) = ucov(:, 1) * cu
     ! vitesse meridienne vcov
@@ -114,5 +114,5 @@
       enddo
     enddo
-    write(lunout, *) 'W91 v', MAXVAL(vcov(:, 1)), MINVAL(vcov(:, 1))
+    WRITE(lunout, *) 'W91 v', MAXVAL(vcov(:, 1)), MINVAL(vcov(:, 1))
     vcov(:, 1) = vcov(:, 1) * cv
 
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/tetaleveli1j.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/tetaleveli1j.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/tetaleveli1j.F90	(revision 5116)
@@ -33,5 +33,5 @@
   REAL :: pgcm(ilon, ilev)
   REAL :: Qgcm(ilon, ilev)
-  real :: pres
+  REAL :: pres
   REAL :: Qpres(ilon)
 
@@ -54,5 +54,5 @@
   ! PRINT*,'tetalevel pres=',pres
   !=====================================================================
-  if (lnew) then
+  if (lnew) THEN
     !   on réinitialise les réindicages et les poids
     !=====================================================================
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/tetaleveli1j1.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/tetaleveli1j1.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/tetaleveli1j1.F90	(revision 5116)
@@ -33,5 +33,5 @@
   REAL :: pgcm(ilon, ilev)
   REAL :: Qgcm(ilon, ilev)
-  real :: pres
+  REAL :: pres
   REAL :: Qpres(ilon)
 
@@ -54,5 +54,5 @@
   ! PRINT*,'tetalevel pres=',pres
   !=====================================================================
-  if (lnew) then
+  if (lnew) THEN
     !   on réinitialise les réindicages et les poids
     !=====================================================================
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/top_bound.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/top_bound.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/top_bound.F90	(revision 5116)
@@ -70,5 +70,5 @@
   REAL :: uzon(jjp1, llm), vzon(jjm, llm), tzon(jjp1, llm)
 
-  integer :: i
+  INTEGER :: i
   REAL, SAVE :: rdamp(llm) ! quenching coefficient
   real, save :: lambda(llm) ! inverse or quenching time scale (Hz)
@@ -80,6 +80,6 @@
   if (iflag_top_bound==0) return
 
-  if (first) then
-    if (iflag_top_bound==1) then
+  if (first) THEN
+    if (iflag_top_bound==1) THEN
       ! sponge quenching over the topmost 4 atmospheric layers
       lambda(:) = 0.
@@ -88,5 +88,5 @@
       lambda(llm - 2) = tau_top_bound / 4.
       lambda(llm - 3) = tau_top_bound / 8.
-    else if (iflag_top_bound==2) then
+    else if (iflag_top_bound==2) THEN
       ! sponge quenching over topmost layers down to pressures which are
       ! higher than 100 times the topmost layer pressure
@@ -99,10 +99,10 @@
     rdamp(:) = 1. - exp(-lambda(:) * dt)
 
-    write(lunout, *)'TOP_BOUND mode', mode_top_bound
-    write(lunout, *)'Sponge layer coefficients'
-    write(lunout, *)'p (Pa)  z(km)  tau(s)   1./tau (Hz)'
+    WRITE(lunout, *)'TOP_BOUND mode', mode_top_bound
+    WRITE(lunout, *)'Sponge layer coefficients'
+    WRITE(lunout, *)'p (Pa)  z(km)  tau(s)   1./tau (Hz)'
     do l = 1, llm
-      if (rdamp(l)/=0.) then
-        write(lunout, '(6(1pe12.4,1x))') &
+      if (rdamp(l)/=0.) THEN
+        WRITE(lunout, '(6(1pe12.4,1x))') &
                 presnivs(l), log(preff / presnivs(l)) * scaleheight, &
                 1. / lambda(l), lambda(l)
@@ -115,5 +115,5 @@
 
   ! compute zonal average of vcov and u
-  if (mode_top_bound>=2) then
+  if (mode_top_bound>=2) THEN
     do l = 1, llm
       do j = 1, jjm
@@ -147,5 +147,5 @@
 
   ! compute zonal average of potential temperature, if necessary
-  if (mode_top_bound>=3) then
+  if (mode_top_bound>=3) THEN
     do l = 1, llm
       do j = 2, jjm ! excluding poles
@@ -161,5 +161,5 @@
   endif ! of if (mode_top_bound.ge.3)
 
-  if (mode_top_bound>=1) then
+  if (mode_top_bound>=1) THEN
     ! Apply sponge quenching on vcov:
     do l = 1, llm
@@ -183,5 +183,5 @@
   endif ! of if (mode_top_bound.ge.1)
 
-  if (mode_top_bound>=3) then
+  if (mode_top_bound>=3) THEN
     ! Apply sponge quenching on teta:
     do l = 1, llm
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/vlsplt.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/vlsplt.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/vlsplt.F90	(revision 5116)
@@ -361,5 +361,5 @@
   ! CRisi: appel récursif de l'advection sur les fils.
   ! Il faut faire ça avant d'avoir mis à jour q et masse
-  !write(*,*) 'vlsplt 326: iq,nqDesc(iq)=',iq,tracers(iq)%nqDescen
+  !WRITE(*,*) 'vlsplt 326: iq,nqDesc(iq)=',iq,tracers(iq)%nqDescen
 
   do ifils=1,tracers(iq)%nqDescen
@@ -372,5 +372,5 @@
         !Mvals: veiller a ce qu'on n'ait pas de denominateur nul
         masseq(ij,l,iq2)=max(masse(ij,l,iq)*q(ij,l,iq),min_qMass)
-        if (q(ij,l,iq)>min_qParent) then
+        if (q(ij,l,iq)>min_qParent) THEN
           Ratio(ij,l,iq2)=q(ij,l,iq2)/q(ij,l,iq)
         else
@@ -464,5 +464,5 @@
 
   REAL :: convpn,convps,convmpn,convmps
-  real :: massepn,masseps,qpn,qps
+  REAL :: massepn,masseps,qpn,qps
   REAL :: sinlon(iip1),sinlondlon(iip1)
   REAL :: coslon(iip1),coslondlon(iip1)
@@ -479,5 +479,5 @@
   DATA first/.TRUE./
 
-  ! !write(*,*) 'vly 578: entree, iq=',iq
+  ! !WRITE(*,*) 'vly 578: entree, iq=',iq
 
   IF(first) THEN
@@ -658,5 +658,5 @@
   ENDDO
 
-  ! !write(*,*) 'vly 756'
+  ! !WRITE(*,*) 'vly 756'
   DO l=1,llm
    DO ij=1,ip1jm
@@ -676,5 +676,5 @@
   ! CRisi: appel récursif de l'advection sur les fils.
   ! Il faut faire ça avant d'avoir mis à jour q et masse
-   ! write(*,*) 'vly 689: iq,nqDesc(iq)=',iq,tracers(iq)%nqDescen
+   ! WRITE(*,*) 'vly 689: iq,nqDesc(iq)=',iq,tracers(iq)%nqDescen
 
   do ifils=1,tracers(iq)%nqDescen
@@ -688,5 +688,5 @@
         ! !MVals: veiller a ce qu'on n'ait pas de denominateur nul
         masseq(ij,l,iq2)=max(masse(ij,l,iq)*q(ij,l,iq),min_qMass)
-        if (q(ij,l,iq)>min_qParent) then
+        if (q(ij,l,iq)>min_qParent) THEN
           Ratio(ij,l,iq2)=q(ij,l,iq2)/q(ij,l,iq)
         else
@@ -744,5 +744,5 @@
   enddo
 
-  ! !write(*,*) 'vly 853: sortie'
+  ! !WRITE(*,*) 'vly 853: sortie'
 
 
@@ -814,5 +814,5 @@
   ENDDO
 
-  ! !write(*,*) 'vlz 954'
+  ! !WRITE(*,*) 'vlz 954'
   DO ij=1,ip1jmp1
      dzq(ij,1)=0.
@@ -846,5 +846,5 @@
   ! CRisi: appel récursif de l'advection sur les fils.
   ! Il faut faire ça avant d'avoir mis à jour q et masse
-  ! !write(*,*) 'vlsplt 942: iq,nqChildren(iq)=',iq,nqChildren(iq)
+  ! !WRITE(*,*) 'vlsplt 942: iq,nqChildren(iq)=',iq,nqChildren(iq)
   do ifils=1,tracers(iq)%nqDescen
     iq2=tracers(iq)%iqDescen(ifils)
@@ -855,5 +855,5 @@
         ! !MVals: veiller a ce qu'on n'ait pas de denominateur nul
         masseq(ij,l,iq2)=max(masse(ij,l,iq)*q(ij,l,iq),min_qMass)
-        if (q(ij,l,iq)>min_qParent) then
+        if (q(ij,l,iq)>min_qParent) THEN
           Ratio(ij,l,iq2)=q(ij,l,iq2)/q(ij,l,iq)
         else
@@ -897,8 +897,8 @@
   INCLUDE "paramet.h"
 
-  character(len=20) :: comment
-  real :: qmin,qmax
-  real :: zq(ip1jmp1,llm)
-  real :: zzq(iip1,jjp1,llm)
+  CHARACTER(LEN=20) :: comment
+  REAL :: qmin,qmax
+  REAL :: zq(ip1jmp1,llm)
+  REAL :: zzq(iip1,jjp1,llm)
 
 END SUBROUTINE  minmaxq
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/vlspltqs.F90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/vlspltqs.F90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/vlspltqs.F90	(revision 5116)
@@ -171,5 +171,5 @@
     ENDDO
   enddo
-  !write(*,*) 'vlspltqs 183: fin de la routine'
+  !WRITE(*,*) 'vlspltqs 183: fin de la routine'
 
 
@@ -452,5 +452,5 @@
   ! CRisi: appel récursif de l'advection sur les fils.
   ! Il faut faire ça avant d'avoir mis à jour q et masse
-  !write(*,*) 'vlspltqs 326: iq,nqChildren(iq)=',iq,
+  !WRITE(*,*) 'vlspltqs 326: iq,nqChildren(iq)=',iq,
   ! &                 tracers(iq)%nqChildren
 
@@ -758,5 +758,5 @@
   ! CRisi: appel récursif de l'advection sur les fils.
   ! Il faut faire ça avant d'avoir mis à jour q et masse
-  !write(*,*) 'vlyqs 689: iq,nqChildren(iq)=',iq,
+  !WRITE(*,*) 'vlyqs 689: iq,nqChildren(iq)=',iq,
   ! &              tracers(iq)%nqChildren
 
@@ -772,5 +772,5 @@
   do ifils = 1, tracers(iq)%nqChildren
     iq2 = tracers(iq)%iqDescen(ifils)
-    ! !write(*,*) 'vlyqs 783: appel rec de vly, iq2=',iq2
+    ! !WRITE(*,*) 'vlyqs 783: appel rec de vly, iq2=',iq2
     CALL vly(Ratio, pente_max, masseq, qbyv, iq2)
   enddo
@@ -827,5 +827,5 @@
   ENDDO
 
-  ! !write(*,*) 'vly 866'
+  ! !WRITE(*,*) 'vly 866'
 
   ! retablir les fils en rapport de melange par rapport a l'air:
@@ -838,5 +838,5 @@
     enddo
   enddo
-  ! !write(*,*) 'vly 879'
+  ! !WRITE(*,*) 'vly 879'
 
 
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/wrgrads.f90
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/wrgrads.f90	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/wrgrads.f90	(revision 5116)
@@ -2,4 +2,5 @@
 
 subroutine wrgrads(if, nl, field, name, titlevar)
+  USE lmdz_formcoord, ONLY: formcoord
   IMPLICIT NONE
 
@@ -14,16 +15,16 @@
 
   !   arguments
-  integer :: if, nl
-  real :: field(imx * jmx * lmx)
+  INTEGER :: if, nl
+  REAL :: field(imx * jmx * lmx)
 
   integer, parameter :: wp = selected_real_kind(p = 6, r = 36)
   real(wp) field4(imx * jmx * lmx)
 
-  character(len = 10) :: name, file
-  character(len = 10) :: titlevar
+  CHARACTER(LEN = 10) :: name, file
+  CHARACTER(LEN = 10) :: titlevar
 
   !   local
 
-  integer :: im, jm, lm, i, j, l, iv, iii, iji, iif, ijf
+  INTEGER :: im, jm, lm, i, j, l, iv, iii, iji, iif, ijf
 
   logical :: writectl
@@ -43,6 +44,6 @@
   ! print*,im,jm,lm,name,firsttime(if)
 
-  if(firsttime(if)) then
-    if(name==var(1, if)) then
+  IF(firsttime(if)) THEN
+    IF(name==var(1, if)) THEN
       firsttime(if) = .false.
       ivar(if) = 1
@@ -66,10 +67,10 @@
   else
     ivar(if) = mod(ivar(if), nvar(if)) + 1
-    if (ivar(if)==nvar(if)) then
+    if (ivar(if)==nvar(if)) THEN
       writectl = .true.
       itime(if) = itime(if) + 1
     endif
 
-    if(var(ivar(if), if)/=name) then
+    IF(var(ivar(if), if)/=name) THEN
       print*, 'Il faut stoker la meme succession de champs a chaque'
       print*, 'pas de temps'
@@ -90,32 +91,31 @@
     !    s (l-1)*imd(if)*jmd(if)+(iji-1)*imd(if)+iii
     !    s ,(l-1)*imd(if)*jmd(if)+(ijf-1)*imd(if)+iif
-    write(unit(if) + 1, rec = irec(if)) &
+    WRITE(unit(if) + 1, rec = irec(if)) &
             ((field4((l - 1) * imd(if) * jmd(if) + (j - 1) * imd(if) + i) &
                     , i = iii, iif), j = iji, ijf)
   enddo
-  if (writectl) then
-
+  if (writectl) THEN
     file = fichier(if)
     !   WARNING! on reecrase le fichier .ctl a chaque ecriture
     open(unit(if), file = trim(file) // '.ctl' &
             , form = 'formatted', status = 'unknown')
-    write(unit(if), '(a5,1x,a40)') &
+    WRITE(unit(if), '(a5,1x,a40)') &
             'DSET ', '^' // trim(file) // '.dat'
 
-    write(unit(if), '(a12)') 'UNDEF 1.0E30'
-    write(unit(if), '(a5,1x,a40)') 'TITLE ', title(if)
+    WRITE(unit(if), '(a12)') 'UNDEF 1.0E30'
+    WRITE(unit(if), '(a5,1x,a40)') 'TITLE ', title(if)
     CALL formcoord(unit(if), im, xd(iii, if), 1., .false., 'XDEF')
     CALL formcoord(unit(if), jm, yd(iji, if), 1., .true., 'YDEF')
     CALL formcoord(unit(if), lm, zd(1, if), 1., .false., 'ZDEF')
-    write(unit(if), '(a4,i10,a30)') &
+    WRITE(unit(if), '(a4,i10,a30)') &
             'TDEF ', itime(if), ' LINEAR 02JAN1987 1MO '
-    write(unit(if), '(a4,2x,i5)') 'VARS', nvar(if)
+    WRITE(unit(if), '(a4,2x,i5)') 'VARS', nvar(if)
     do iv = 1, nvar(if)
       ! print*,'if,var(iv,if),nld(iv,if),nld(iv,if)-1/nld(iv,if)'
       ! print*,if,var(iv,if),nld(iv,if),nld(iv,if)-1/nld(iv,if)
-      write(unit(if), 1000) var(iv, if), nld(iv, if) - 1 / nld(iv, if) &
+      WRITE(unit(if), 1000) var(iv, if), nld(iv, if) - 1 / nld(iv, if) &
               , 99, tvar(iv, if)
     enddo
-    write(unit(if), '(a7)') 'ENDVARS'
+    WRITE(unit(if), '(a7)') 'ENDVARS'
     !
     1000   format(a5, 3x, i4, i3, 1x, a39)
@@ -125,6 +125,4 @@
   endif ! writectl
 
-
-
 END SUBROUTINE wrgrads
 
Index: LMDZ6/branches/Amaury_dev/libf/dyn3d/write_paramLMDZ_dyn.h
===================================================================
--- LMDZ6/branches/Amaury_dev/libf/dyn3d/write_paramLMDZ_dyn.h	(revision 5114)
+++ LMDZ6/branches/Amaury_dev/libf/dyn3d/write_paramLMDZ_dyn.h	(revision 5116)
@@ -107,9 +107,9 @@
      .               zx_tmp_2d,iip1*jjp1,ndex2d)
 c
-      if (calend == 'earth_360d') then
+      if (calend == 'earth_360d') THEN
         zx_tmp_2d(1:iip1,1:jjp1)=1.
-      else if (calend == 'earth_365d') then
+      else if (calend == 'earth_365d') THEN
         zx_tmp_2d(1:iip1,1:jjp1)=2.
-      else if (calend == 'earth_366d') then
+      else if (calend == 'earth_366d') THEN
         zx_tmp_2d(1:iip1,1:jjp1)=3.
       endif
@@ -240,5 +240,5 @@
 c=================================================================
 c
-      if (ok_sync) then
+      if (ok_sync) THEN
         CALL histsync(nid_ctesGCM)
       endif
