Index: /trunk/LMDZ.MARS/README
===================================================================
--- /trunk/LMDZ.MARS/README	(revision 1004)
+++ /trunk/LMDZ.MARS/README	(revision 1005)
@@ -1880,3 +1880,7 @@
   Gnome)
 
-
+== 18/07/2013 == EM
+- Bug fix: when running with photochemistry, ccns did not sediment! Fixed
+  initracer.F. Also added that callsedim/newsedim use updated temperatures.
+- Converted run0 and run_mcd scripts to bash.
+
Index: /trunk/LMDZ.MARS/deftank/run0
===================================================================
--- /trunk/LMDZ.MARS/deftank/run0	(revision 1004)
+++ /trunk/LMDZ.MARS/deftank/run0	(revision 1005)
@@ -1,8 +1,8 @@
-#!/bin/csh
+#!/bin/bash
 ###########################################################################
 # Script to perform several chained LMD Mars GCM simulations
 # SET HERE the maximum total number of simulations
 
-set nummax=1
+nummax=1
 
 ###########################################################################
@@ -12,56 +12,57 @@
 echo "starting run0"
 
-set dir=`pwd`
-set machine=`hostname`
-set address=`whoami`
+dir=`pwd`
+machine=`hostname`
+address=`whoami`
 
 # Look for file "num_run" which should contain 
 # the value of the previously computed season
 # (defaults to 0 if file "num_run" does not exist)
-if ( -f num_run ) then
- echo "found file num_run"
-  set numold=`cat num_run`
+if [[ -r num_run ]] ; then
+  echo "found file num_run"
+  numold=`cat num_run`
 else
-  set numold=0
-endif
+  numold=0
+fi
 echo "numold is set to" ${numold}
 
 
 # Set value of current season 
-set numnew=${numold}
-@ numnew = ${numnew} + 1
+(( numnew = ${numold} + 1 ))
 echo "numnew is set to" ${numnew}
 
 # Look for initialization data files (exit if none found)
-if ( ( -f start${numold}.nc ) && ( -f startfi${numold}.nc ) ) then
+if [[ ( -r start${numold}.nc  &&  -r startfi${numold}.nc ) ]] ; then
    \cp -f start${numold}.nc start.nc
    \cp -f startfi${numold}.nc startfi.nc
-else if ( ${numold} == 99999 ) then
+else
+   if (( ${numold} == 99999 )) ; then
     echo "No run because previous run crashed ! (99999 in num_run)"
     exit
-else
+   else
    echo "Where is file start"${numold}".nc??"
    exit
-endif
+   fi
+fi
 
 
 # Run GCM
-gcm.e >! lrun${numnew} 
+gcm.e > lrun${numnew} 
 
 
 # Check if run ended normaly and copy datafiles
-if ( ( -f restartfi.nc ) && ( -f restart.nc ) ) then
+if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
   echo "Run seems to have ended normaly"
   \mv -f restartfi.nc startfi${numnew}.nc
   \mv -f restart.nc start${numnew}.nc
 else
-  if ( -f num_run ) then
+  if [[ -r num_run ]] ; then
     \mv -f num_run num_run.crash
   else
     echo "No file num_run to build num_run.crash from !!"
     # Impose a default value of 0 for num_run
-    echo 0 >! num_run.crash
-  endif
- echo 99999 >! num_run
+    echo 0 > num_run.crash
+  fi
+ echo 99999 > num_run
 ############## To receive an Email message if the run crashes ########
 mail -s "crash run GCM" $address <<ENDMAIL
@@ -70,32 +71,32 @@
 ############################################"" 
  exit
-endif
+fi
 
 # Copy other datafiles that may have been generated
-if ( -f diagfi.nc ) then
+if [[ -r diagfi.nc ]] ; then
   \mv -f diagfi.nc diagfi${numnew}.nc
-endif
-if ( -f diagsoil.nc ) then
+fi
+if [[ -r diagsoil.nc ]] ; then
   \mv -f diagsoil.nc diagsoil${numnew}.nc
-endif
-if ( -f stats.nc ) then
+fi
+if [[ -r stats.nc ]] ; then
   \mv -f stats.nc stats${numnew}.nc
-endif
-if ( -f profiles.dat ) then
+fi
+if [[ -f profiles.dat ]] ; then
   \mv -f profiles.dat profiles${numnew}.dat
   \mv -f profiles.hdr profiles${numnew}.hdr
-endif
+fi
 
 # Prepare things for upcoming runs by writing
 # value of computed season in file num_run
-echo ${numnew} >! num_run
+echo ${numnew} > num_run
 
 # If we are over nummax : stop
-if ( `expr $numnew + 1 \> $nummax ` == 1) then
+if (( $numnew + 1 > $nummax )) ; then
    exit
 else
    \cp -f run0 exe_mars
-   exe_mars
-endif 
+   ./exe_mars
+fi 
 
 
Index: /trunk/LMDZ.MARS/deftank/run_mcd
===================================================================
--- /trunk/LMDZ.MARS/deftank/run_mcd	(revision 1004)
+++ /trunk/LMDZ.MARS/deftank/run_mcd	(revision 1005)
@@ -1,3 +1,3 @@
-#!/bin/csh
+#!/bin/bash
 ##############################################################################
 # Script to run successive monthly (a month spans 30 deg. in Ls)
@@ -26,53 +26,53 @@
 
 # 12 martian months (=30°deg Ls) of unequal length (excentric orbit)
-  sed s/9999/61/ run.def.ref >! run.def ; run0 >>& error     #1
-  sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #2
-  sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #3
-  sed s/9999/65/ run.def.ref >! run.def ; run0 >>& error     #4
-  sed s/9999/60/ run.def.ref >! run.def ; run0 >>& error     #5
-  sed s/9999/54/ run.def.ref >! run.def ; run0 >>& error     #6
-  sed s/9999/50/ run.def.ref >! run.def ; run0 >>& error     #7
-  sed s/9999/46/ run.def.ref >! run.def ; run0 >>& error     #8
-  sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #9
-  sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #10
-  sed s/9999/51/ run.def.ref >! run.def ; run0 >>& error     #11 
-  sed s/9999/56/ run.def.ref >! run.def ; run0 >>& error     #12
+  sed s/9999/61/ run.def.ref > run.def ; run0 >> error     #1
+  sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #2
+  sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #3
+  sed s/9999/65/ run.def.ref > run.def ; run0 >> error     #4
+  sed s/9999/60/ run.def.ref > run.def ; run0 >> error     #5
+  sed s/9999/54/ run.def.ref > run.def ; run0 >> error     #6
+  sed s/9999/50/ run.def.ref > run.def ; run0 >> error     #7
+  sed s/9999/46/ run.def.ref > run.def ; run0 >> error     #8
+  sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #9
+  sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #10
+  sed s/9999/51/ run.def.ref > run.def ; run0 >> error     #11 
+  sed s/9999/56/ run.def.ref > run.def ; run0 >> error     #12
 #
 # 12 martian months (=30°deg Ls) of unequal length (excentric orbit)
-# sed s/9999/61/ run.def.ref >! run.def ; run0 >>& error     #13
-# sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #14
-# sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #15
-# sed s/9999/65/ run.def.ref >! run.def ; run0 >>& error     #16
-# sed s/9999/60/ run.def.ref >! run.def ; run0 >>& error     #17
-# sed s/9999/54/ run.def.ref >! run.def ; run0 >>& error     #18
-# sed s/9999/50/ run.def.ref >! run.def ; run0 >>& error     #19
-# sed s/9999/46/ run.def.ref >! run.def ; run0 >>& error     #20
-# sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #21
-# sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #22
-# sed s/9999/51/ run.def.ref >! run.def ; run0 >>& error     #23
-# sed s/9999/56/ run.def.ref >! run.def ; run0 >>& error     #24
+# sed s/9999/61/ run.def.ref > run.def ; run0 >> error     #13
+# sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #14
+# sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #15
+# sed s/9999/65/ run.def.ref > run.def ; run0 >> error     #16
+# sed s/9999/60/ run.def.ref > run.def ; run0 >> error     #17
+# sed s/9999/54/ run.def.ref > run.def ; run0 >> error     #18
+# sed s/9999/50/ run.def.ref > run.def ; run0 >> error     #19
+# sed s/9999/46/ run.def.ref > run.def ; run0 >> error     #20
+# sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #21
+# sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #22
+# sed s/9999/51/ run.def.ref > run.def ; run0 >> error     #23
+# sed s/9999/56/ run.def.ref > run.def ; run0 >> error     #24
 #
 # 12 martian months (=30°deg Ls) of unequal length (excentric orbit)
-# sed s/9999/61/ run.def.ref >! run.def ; run0 >>& error     #25
-# sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #26
-# sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #27
-# sed s/9999/65/ run.def.ref >! run.def ; run0 >>& error     #28
-# sed s/9999/60/ run.def.ref >! run.def ; run0 >>& error     #29
-# sed s/9999/54/ run.def.ref >! run.def ; run0 >>& error     #30
-# sed s/9999/50/ run.def.ref >! run.def ; run0 >>& error     #31
-# sed s/9999/46/ run.def.ref >! run.def ; run0 >>& error     #32
-# sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #33
-# sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #34
-# sed s/9999/51/ run.def.ref >! run.def ; run0 >>& error     #35
-# sed s/9999/56/ run.def.ref >! run.def ; run0 >>& error     #36
+# sed s/9999/61/ run.def.ref > run.def ; run0 >> error     #25
+# sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #26
+# sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #27
+# sed s/9999/65/ run.def.ref > run.def ; run0 >> error     #28
+# sed s/9999/60/ run.def.ref > run.def ; run0 >> error     #29
+# sed s/9999/54/ run.def.ref > run.def ; run0 >> error     #30
+# sed s/9999/50/ run.def.ref > run.def ; run0 >> error     #31
+# sed s/9999/46/ run.def.ref > run.def ; run0 >> error     #32
+# sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #33
+# sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #34
+# sed s/9999/51/ run.def.ref > run.def ; run0 >> error     #35
+# sed s/9999/56/ run.def.ref > run.def ; run0 >> error     #36
 
 # These last lines allow to reconstruct the last num_run after a model crash 
 # (because after crash, num_run was set to 9999 so that no further simulation
 # Could be performed
-   set number=`cat num_run`
-   if ( $number == 99999) then
+   number=`cat num_run`
+   if (( $number == 99999)) ; then
       set numold=`cat num_run.crash`
-      echo '-----' >>& error
-      echo 'Seasonal simulation aborted after starting from start'$numold >>& error
+      echo '-----' >> error
+      echo 'Seasonal simulation aborted after starting from start'$numold >> error
       \mv -f num_run.crash num_run  
-   endif
+   fi
Index: /trunk/LMDZ.MARS/libf/dyn3d/test_period.F
===================================================================
--- /trunk/LMDZ.MARS/libf/dyn3d/test_period.F	(revision 1004)
+++ /trunk/LMDZ.MARS/libf/dyn3d/test_period.F	(revision 1005)
@@ -25,5 +25,7 @@
           PRINT *,'STOP dans test_period car ---  UCOV  ---  n est pas',  
      ,  ' periodique en longitude ! '
-          PRINT *,' l,  ij = ', l, ij, ij+iim
+          PRINT *,' l,  ij, ij+iim = ', l, ij, ij+iim
+          write(*,*) "ucov(ij,l)=",ucov(ij,l)," ucov(ij+iim,l)=",
+     &                ucov(ij+iim,l)
           STOP
           ENDIF
@@ -31,5 +33,7 @@
           PRINT *,'STOP dans test_period car ---  TETA  ---  n est pas',  
      ,   ' periodique en longitude ! '
-          PRINT *,' l,  ij = ', l, ij, ij+iim
+          PRINT *,' l,  ij, ij+iim = ', l, ij, ij+iim
+          write(*,*) "teta(ij,l)=",teta(ij,l)," teta(ij+iim,l)=",
+     &                teta(ij+iim,l)
           STOP
           ENDIF
@@ -43,6 +47,7 @@
           PRINT *,'STOP dans test_period car ---  VCOV  ---  n est pas',  
      ,   ' periodique en longitude !'
-          PRINT *,' l,  ij = ', l, ij, ij+iim,vcov(ij+iim,l),vcov(ij,l)
-          vcov(ij+iim,l)=vcov(ij,l)
+          PRINT *,' l,  ij, ij+iim = ', l, ij, ij+iim
+          write(*,*) "vcov(ij,l)=",vcov(ij,l),
+     &               " vcov(ij+iim,l)",vcov(ij+iim,l)
           STOP
           ENDIF
Index: /trunk/LMDZ.MARS/libf/phymars/callsedim.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/callsedim.F	(revision 1004)
+++ /trunk/LMDZ.MARS/libf/phymars/callsedim.F	(revision 1005)
@@ -1,4 +1,4 @@
       SUBROUTINE callsedim(ngrid,nlay, ptimestep,
-     &                pplev,zlev, zlay, pt, rdust, rice,
+     &                pplev,zlev, zlay, pt, pdt, rdust, rice,
      &                rsedcloud,rhocloud,
      &                pq, pdqfi, pdqsed,pdqs_sed,nq, 
@@ -6,5 +6,5 @@
 ! to use  'getin'
       USE ioipsl_getincom
-      USE updaterad
+      USE updaterad,only: updaterdust,updaterice_micro,updaterice_typ
       IMPLICIT NONE
 
@@ -35,20 +35,28 @@
 c   ----------
 
-      INTEGER ngrid              ! number of horizontal grid points
-      INTEGER nlay               ! number of atmospheric layers
-      REAL ptimestep             ! physics time step (s)
-      REAL pplev(ngrid,nlay+1)   ! pressure at inter-layers (Pa)
-      REAL pt(ngrid,nlay)        ! temperature at mid-layer (K)
-      REAL zlev(ngrid,nlay+1)    ! altitude at layer boundaries
+      integer,intent(in) :: ngrid  ! number of horizontal grid points
+      integer,intent(in) :: nlay   ! number of atmospheric layers
+      real,intent(in) :: ptimestep ! physics time step (s)
+      real,intent(in) :: pplev(ngrid,nlay+1) ! pressure at inter-layers (Pa)
+      real,intent(in) :: zlev(ngrid,nlay+1) ! altitude at layer boundaries
+      real,intent(in) :: zlay(ngrid,nlay)   ! altitude at the middle of the layers
+      real,intent(in) :: pt(ngrid,nlay) ! temperature at mid-layer (K)
+      real,intent(in) :: pdt(ngrid,nlay) ! tendency on temperature, from
+                                         ! previous processes (K/s)
 c    Aerosol radius provided by the water ice microphysical scheme:
-      REAL rdust(ngrid,nlay)     ! Dust geometric mean radius (m)
-      REAL rice(ngrid,nlay)      ! Ice geometric mean radius (m)
-
+      real,intent(out) :: rdust(ngrid,nlay) ! Dust geometric mean radius (m)
+      real,intent(out) :: rice(ngrid,nlay)  ! H2O Ice geometric mean radius (m)
+c     Sedimentation radius of water ice
+      real,intent(in) :: rsedcloud(ngridmx,nlayermx)
+c     Cloud density (kg.m-3)
+      real,intent(inout) :: rhocloud(ngridmx,nlayermx)
 c    Traceurs :
-      integer nq             ! number of tracers
-      real pq(ngrid,nlay,nq)  ! tracers (kg/kg)
-      real pdqfi(ngrid,nlay,nq)  ! tendency before sedimentation (kg/kg.s-1)
-      real pdqsed(ngrid,nlay,nq) ! tendency due to sedimentation (kg/kg.s-1)
-      real pdqs_sed(ngrid,nq)    ! flux at surface (kg.m-2.s-1)
+      real,intent(in) :: pq(ngrid,nlay,nq)  ! tracers (kg/kg)
+      real,intent(in) :: pdqfi(ngrid,nlay,nq)  ! tendency before sedimentation (kg/kg.s-1)
+      real,intent(out) :: pdqsed(ngrid,nlay,nq) ! tendency due to sedimentation (kg/kg.s-1)
+      real,intent(out) :: pdqs_sed(ngrid,nq)    ! flux at surface (kg.m-2.s-1)
+      integer,intent(in) :: nq  ! number of tracers
+      real,intent(in) :: tau(ngrid,nlay) ! dust opacity
+      real,intent(in) :: tauscaling(ngrid)
       
 c   local:
@@ -57,25 +65,19 @@
       INTEGER l,ig, iq
 
-      real zqi(ngridmx,nlayermx,nqmx) ! to locally store tracers
-      real masse (ngridmx,nlayermx) ! Layer mass (kg.m-2)
-      real epaisseur (ngridmx,nlayermx) ! Layer thickness (m)
-      real wq(ngridmx,nlayermx+1) ! displaced tracer mass (kg.m-2)
-      real r0(ngridmx,nlayermx) ! geometric mean radius used for
+      real zqi(ngrid,nlay,nq) ! to locally store tracers
+      real zt(ngrid,nlay) ! to locally store temperature
+      real masse (ngrid,nlay) ! Layer mass (kg.m-2)
+      real epaisseur (ngrid,nlay) ! Layer thickness (m)
+      real wq(ngrid,nlay+1) ! displaced tracer mass (kg.m-2)
+      real r0(ngrid,nlay) ! geometric mean radius used for
                                 !   sedimentation (m)
-      real r0dust(ngridmx,nlayermx) ! geometric mean radius used for
+      real r0dust(ngrid,nlay) ! geometric mean radius used for
                                     !   dust (m)
-!      real r0ccn(ngridmx,nlayermx)  ! geometric mean radius used for
+!      real r0ccn(ngrid,nlay)  ! geometric mean radius used for
 !                                    !   CCNs (m)
-c     Sedimentation radius of water ice
-      real rsedcloud(ngridmx,nlayermx)
-      real beta      ! correction for the shape of the ice particles (cf. newsedim)
-      save beta
-c     Cloud density (kg.m-3)
-      real rhocloud(ngridmx,nlayermx)
-      
+      real,save :: beta ! correction for the shape of the ice particles (cf. newsedim)
+
 c     for ice radius computation
       REAL Mo,No
-      REAL tau(ngrid,nlay), tauscaling(ngrid)
-      REAL zlay(ngrid,nlay)   ! altitude at the middle of the layers
       REAl ccntyp
 
@@ -86,23 +88,21 @@
 c       1) Parameters used to represent the changes in fall
 c          velocity as a function of particle size;
-      integer nr,ir
-      parameter (nr=12) !(nr=7) ! number of bins
-      real rd(nr),qr(ngridmx,nlayermx,nr)
-      real rdi(nr+1)    ! extreme and intermediate radii
-      real Sq(ngridmx,nlayermx)
-      real rdmin,rdmax,rdimin,rdimax
-      data rdmin/1.e-8/ !/1.e-7/
-      data rdmax/30.e-6/
-      data rdimin/1.e-10/
-      data rdimax/1e-4/
-      save rd, rdi
+      integer ir
+      integer,parameter :: nr=12 !(nr=7) ! number of bins
+      real,save :: rd(nr)
+      real qr(ngrid,nlay,nr)
+      real,save :: rdi(nr+1)    ! extreme and intermediate radii
+      real Sq(ngrid,nlay)
+      real,parameter :: rdmin=1.e-8
+      real,parameter :: rdmax=30.e-6
+      real,parameter :: rdimin=1.e-8 ! 1.e-7
+      real,parameter :: rdimax=1.e-4
 
 c       2) Second size distribution for the log-normal integration
 c          (the mass mixing ratio is computed for each radius)
 
-      integer ninter, iint
-      parameter (ninter=4)  ! nombre de point entre chaque rayon rdi
-      real rr(ninter,nr)
-      save rr
+      integer iint
+      integer,parameter :: ninter=4 ! number of points between each rdi radii
+      real,save :: rr(ninter,nr)
       integer radpower
       real sigma0
@@ -110,21 +110,14 @@
 c       3) Other local variables used in doubleq
 
-      INTEGER idust_mass   ! index of tracer containing dust mass
-                           !   mix. ratio
-      INTEGER idust_number ! index of tracer containing dust number
-                           !   mix. ratio
-      INTEGER iccn_mass    ! index of tracer containing CCN mass
-                           !   mix. ratio
-      INTEGER iccn_number  ! index of tracer containing CCN number
-                           !   mix. ratio
-      SAVE idust_mass,idust_number
-      SAVE iccn_mass,iccn_number
-      
-
-c     Firstcall:
-
-      LOGICAL firstcall
-      SAVE firstcall
-      DATA firstcall/.true./
+      INTEGER,SAVE :: idust_mass  ! index of tracer containing dust mass
+                                  !   mix. ratio
+      INTEGER,SAVE :: idust_number ! index of tracer containing dust number
+                                   !   mix. ratio
+      INTEGER,SAVE :: iccn_mass  ! index of tracer containing CCN mass
+                                 !   mix. ratio
+      INTEGER,SAVE :: iccn_number ! index of tracer containing CCN number
+                                  !   mix. ratio
+
+      LOGICAL,SAVE :: firstcall=.true.
 
 c    ** un petit test de coherence
@@ -169,7 +162,9 @@
           if (noms(iq).eq."dust_mass") then
             idust_mass=iq
+            write(*,*)"callsedim: idust_mass=",idust_mass
           endif
           if (noms(iq).eq."dust_number") then
             idust_number=iq
+            write(*,*)"callsedim: idust_number=",idust_number
           endif
         enddo
@@ -190,7 +185,9 @@
             if (noms(iq).eq."ccn_mass") then
               iccn_mass=iq
+              write(*,*)"callsedim: iccn_mass=",iccn_mass
             endif
             if (noms(iq).eq."ccn_number") then
               iccn_number=iq
+              write(*,*)"callsedim: iccn_number=",iccn_number
             endif
           enddo
@@ -223,16 +220,13 @@
 c    -----------------
 
-      zqi(1:ngrid,1:nlay,1:nqmx) = 0.
-c     Updating the mass mixing ratio with the tendencies coming
+!      zqi(1:ngrid,1:nlay,1:nqmx) = 0.
+c     Update the mass mixing ratio and temperature with the tendencies coming
 c       from other parameterizations:
 c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-      do iq=1,nq
-        do l=1,nlay
-          do ig=1,ngrid
-            zqi(ig,l,iq)=pq(ig,l,iq)+pdqfi(ig,l,iq)*ptimestep
-          enddo
-        enddo 
-      enddo
+      zqi(1:ngrid,1:nlay,1:nq)=pq(1:ngrid,1:nlay,1:nq)
+     &                         +pdqfi(1:ngrid,1:nlay,1:nq)*ptimestep
+      zt(1:ngrid,1:nlay)=pt(1:ngrid,1:nlay)
+     &                         +pdt(1:ngrid,1:nlay)*ptimestep
+
 
 c    Computing the different layer properties
@@ -342,5 +336,5 @@
           
                call newsedim(ngrid,nlay,1,1,ptimestep,
-     &         pplev,masse,epaisseur,pt,rd(ir),rho_dust,qr(1,1,ir),
+     &         pplev,masse,epaisseur,zt,rd(ir),rho_dust,qr(1,1,ir),
      &         wq,0.5)
 
@@ -365,10 +359,10 @@
               ! water ice sedimentation
               call newsedim(ngrid,nlay,ngrid*nlay,ngrid*nlay,
-     &        ptimestep,pplev,masse,epaisseur,pt,rsedcloud,rhocloud,
+     &        ptimestep,pplev,masse,epaisseur,zt,rsedcloud,rhocloud,
      &        zqi(1,1,iq),wq,beta)
             else
               ! water ice sedimentation
               call newsedim(ngrid,nlay,ngrid*nlay,1,
-     &        ptimestep,pplev,masse,epaisseur,pt,rsedcloud,rho_q(iq),
+     &        ptimestep,pplev,masse,epaisseur,zt,rsedcloud,rho_q(iq),
      &        zqi(1,1,iq),wq,beta)
             endif ! of if (microphys)
@@ -383,5 +377,5 @@
           else
             call newsedim(ngrid,nlay,1,1,ptimestep,
-     &      pplev,masse,epaisseur,pt,radius(iq),rho_q(iq),
+     &      pplev,masse,epaisseur,zt,radius(iq),rho_q(iq),
      &      zqi(1,1,iq),wq,1.0)
 c           Tendencies
@@ -405,5 +399,5 @@
 c =================================================================
       enddo ! of do iq=1,nq
- 
+
 c     Update the dust particle size "rdust"
 c     -------------------------------------
@@ -451,5 +445,4 @@
       endif ! of if (water)
 
-      RETURN
       END
 
Index: /trunk/LMDZ.MARS/libf/phymars/initracer.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/initracer.F	(revision 1004)
+++ /trunk/LMDZ.MARS/libf/phymars/initracer.F	(revision 1005)
@@ -14,14 +14,4 @@
 c   by the dynamics in "advtrac.h"
 c
-c   Old conventions: (not used any more)
-c
-c   If water=T : q(iq=nqmx) is the water mass mixing ratio
-c     and q(iq=nqmx-1) is the ice mass mixing ratio
-
-c   If there is transported dust, it uses iq=1 to iq=dustbin
-c   If there is no transported dust : dustbin=0
-c   If doubleq=T : q(iq=1) is the dust mass mixing ratio
-c                  q(iq=2) is the dust number mixing ratio 
-
 c
 c   author: F.Forget
@@ -380,8 +370,14 @@
 
 c------------------------------------------------------------
-c     Initialisation tracers ....
+c     Initialize tracers .... (in tracer.h)
 c------------------------------------------------------------
-      call zerophys(nqmx,rho_q)
-
+      ! start by setting everything to (default) zero
+      rho_q(1:nqmx)=0     ! tracer density (kg.m-3)
+      radius(1:nqmx)=0.   ! tracer particle radius (m)
+      alpha_lift(1:nqmx) =0.  ! tracer saltation vertical flux/horiz flux ratio (m-1)
+      alpha_devil(1:nqmx)=0.  ! tracer lifting coefficient by dust devils
+
+
+      ! some reference values
       rho_dust=2500.  ! Mars dust density (kg.m-3)
       rho_ice=920.    ! Water ice density (kg.m-3)
@@ -497,19 +493,4 @@
       end if  ! (submicron)
 
-c     Initialization for photochemistry:
-c     ---------------------------------
-      if (photochem) then
-      ! initialize chemistry+water (water will be correctly initialized below)
-      ! by initializing everything which is not dust ...
-        do iq=1,nqmx
-          txt=noms(iq)
-          if (txt(1:4).ne."dust") then
-            radius(iq)=0.
-            alpha_lift(iq) =0.
-            alpha_devil(iq)=0.
-          endif
-        enddo ! do iq=1,nqmx
-      endif
-
 c     Initialization for water vapor
 c     ------------------------------
Index: /trunk/LMDZ.MARS/libf/phymars/physiq.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/physiq.F	(revision 1004)
+++ /trunk/LMDZ.MARS/libf/phymars/physiq.F	(revision 1005)
@@ -1172,5 +1172,5 @@
 
            call callsedim(ngrid,nlayer, ptimestep,
-     &                zplev,zzlev, zzlay, pt, rdust, rice,
+     &                zplev,zzlev, zzlay, pt, pdt, rdust, rice,
      &                rsedcloud,rhocloud,
      &                pq, pdq, zdqsed, zdqssed,nq, 
Index: /trunk/LMDZ.MARS/libf/phymars/writediagfi.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/writediagfi.F	(revision 1004)
+++ /trunk/LMDZ.MARS/libf/phymars/writediagfi.F	(revision 1005)
@@ -92,6 +92,6 @@
       integer,save :: n_nom_def
       integer :: n
-      integer,parameter :: n_nom_def_max=99
-      character(len=20),save :: nom_def(n_nom_def_max)
+      integer,parameter :: n_nom_def_max=199
+      character(len=120),save :: nom_def(n_nom_def_max)
       logical,save :: firstcall=.true.
       
