Index: trunk/LMDZ.MARS/libf/phymars/phyredem.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/phyredem.F90	(revision 3799)
+++ trunk/LMDZ.MARS/libf/phymars/phyredem.F90	(revision 3804)
@@ -7,26 +7,22 @@
 !=======================================================================
 
-subroutine physdem0(filename,lonfi,latfi,nsoil,ngrid,nlay,nq, &
-                         phystep,day_ini,time,airefi, &
-                         alb,ith,def_slope, &
-                         subslope_dist)
-
+subroutine physdem0(filename,lonfi,latfi,nsoil,ngrid,nlay,nq,phystep,day_ini, &
+                    time,airefi,alb,ith,def_slope,subslope_dist)
 ! create physics restart file and write time-independent variables
-  use comsoil_h, only: inertiedat, volcapa, mlayer
-  use geometry_mod, only: cell_area
-  use surfdat_h, only: zmea, zstd, zsig, zgam, zthe, &
-                       z0_default, albedice, emisice, emissiv, &
-                       iceradius, dtemisice, phisfi, z0,   &
-                       hmons,summit,base,watercaptag
-  use dimradmars_mod, only: tauvis
-  use iostart, only : open_restartphy, close_restartphy, & 
-                      put_var, put_field, length, ldscrpt, ndscrpt
-  use mod_grid_phy_lmdz, only : klon_glo
-  use planete_h, only: aphelie, emin_turb, lmixmin, obliquit, &
-                       peri_day, periheli, year_day
-  use comcstfi_h, only: g, mugaz, omeg, rad, rcp
-  use time_phylmdz_mod, only: daysec
-  use comslope_mod, ONLY: nslope
-  USE paleoclimate_mod, ONLY: paleoclimate, h2o_ice_depth, lag_co2_ice, d_coef, zdqsdif_ssi_tot
+
+  use comsoil_h,          only: inertiedat, volcapa, mlayer
+  use geometry_mod,       only: cell_area
+  use surfdat_h,          only: zmea, zstd, zsig, zgam, zthe, z0_default, &
+                                albedice, emisice, emissiv, iceradius,    &
+                                dtemisice, phisfi, z0, hmons, summit, base, watercaptag
+  use dimradmars_mod,     only: tauvis
+  use iostart,            only: open_restartphy, close_restartphy, & 
+                                put_var, put_field, length, ldscrpt, ndscrpt
+  use mod_grid_phy_lmdz,  only: klon_glo
+  use planete_h,          only: aphelie, emin_turb, lmixmin, obliquit, &
+                                peri_day, periheli, year_day
+  use comcstfi_h,         only: g, mugaz, omeg, rad, rcp
+  use time_phylmdz_mod,   only: daysec
+  use comslope_mod,       only: nslope
 
   implicit none
@@ -189,12 +185,4 @@
   call put_field("subslope_dist","under mesh slope distribution",subslope_dist)
 
-  ! Paleoclimate outputs
-  if (paleoclimate) then
-    call put_field("h2o_ice_depth","Depth to the fisrt H2O ice",h2o_ice_depth)
-    call put_field("lag_co2_ice","Depth of the CO2 lags",lag_co2_ice)
-    call put_field("zdqsdif_ssi_tot","Total flux with SSI",zdqsdif_ssi_tot)
-    call put_field("d_coef","Diffusion coefficent",d_coef)
-  endif
-
   ! Close file
   call close_restartphy
@@ -204,22 +192,21 @@
 !=======================================================================
 
-subroutine physdem1(filename,nsoil,ngrid,nlay,nq,nqsoil, &
-                    phystep,time,tsurf,tsoil,inertiesoil, &
-                    albedo,emis,q2,qsurf,qsoil,&
-                    tauscaling,totcloudfrac,wstar, &
-                    watercap,perennial_co2ice)
+subroutine physdem1(filename,nsoil,ngrid,nlay,nq,nqsoil,phystep,time,tsurf,tsoil,inertiesoil, &
+                    albedo,emis,q2,qsurf,qsoil,tauscaling,totcloudfrac,wstar,watercap,perennial_co2ice)
   ! write time-dependent variable to restart file
-  use iostart, only : open_restartphy, close_restartphy, & 
-                      put_var, put_field
-  use tracer_mod, only: noms ! tracer names
-  use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd
-  use compute_dtau_mod, only: dtau
+
+  use iostart,             only: open_restartphy, close_restartphy, put_var, put_field
+  use tracer_mod,          only: noms ! tracer names
+  use nonoro_gwd_ran_mod,  only: du_nonoro_gwd, dv_nonoro_gwd
+  use compute_dtau_mod,    only: dtau
   use dust_rad_adjust_mod, only: dust_rad_adjust_prev,dust_rad_adjust_next
-  use dust_param_mod, only: dustscaling_mode
-  use comsoil_h,only: flux_geo,adsorption_soil,igcm_h2o_vap_soil, &
-                      igcm_h2o_ice_soil,igcm_h2o_vap_ads
-  use comslope_mod, only: nslope
-  use paleoclimate_mod, only: paleoclimate
-  use callkeys_mod, only: calltherm, dustinjection, calllott_nonoro
+  use dust_param_mod,      only: dustscaling_mode
+  use comsoil_h,           only: flux_geo,adsorption_soil,igcm_h2o_vap_soil, &
+                                 igcm_h2o_ice_soil,igcm_h2o_vap_ads
+  use comslope_mod,        only: nslope
+  use paleoclimate_mod,    only: paleoclimate
+  use callkeys_mod,        only: calltherm, dustinjection, calllott_nonoro
+  use paleoclimate_mod,    only: paleoclimate, h2o_ice_depth, lag_co2_ice, d_coef, zdqsdif_ssi_tot
+
   implicit none
   
@@ -394,4 +381,13 @@
   endif
 
+  ! Paleoclimate
+  if (paleoclimate) then
+    print*, 'yooooooooo', h2o_ice_depth
+    call put_field("h2o_ice_depth","Depth to the fisrt H2O ice",h2o_ice_depth)
+    call put_field("lag_co2_ice","Depth of the CO2 lags",lag_co2_ice)
+    call put_field("zdqsdif_ssi_tot","Total flux with SSI",zdqsdif_ssi_tot)
+    call put_field("d_coef","Diffusion coefficent",d_coef)
+  endif
+
   ! Close file
   call close_restartphy
