Index: /trunk/LMDZ.COMMON/libf/evolution/changelog.txt
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/changelog.txt	(revision 4067)
+++ /trunk/LMDZ.COMMON/libf/evolution/changelog.txt	(revision 4068)
@@ -849,5 +849,5 @@
     - "numerics" defines numerical types and constants for reproducibility, portability across compilers and future transitions (e.g. quadruple precision experiments);
     - "display" provides a single controlled interface for runtime messages, status output and diagnostics, avoiding direct 'print'/'write' to enable silent mode, log redirection, and MPI-safe output in the future.
-    - "utility" (new module) hosts generic helpers used throughout the code (e.g. "int2str" or "real2str");
+    - "utility" hosts generic helpers used throughout the code (e.g. "int2str" or "real2str");
 - Add modules "clim_state_init"/"clim_state_rec" which provide robust read/write logic for "start/startfi/startpem", including 1D fallbacks, mesh conversions and dimension checks. NetCDF file creation is centralized and explicit. Restart files are now self-consistent and future-proof, requiring changes only to affected variables;
 - Add module "atmosphere" which computes pressure fields, reconstructs potential temperature and air mass. It also holds the whole logic to define sigma or hybrid coordinates for altitudes;
@@ -865,2 +865,5 @@
 This revision is a structural milestone aiming to be behavior-preserving where possible. It has been tested via compilation and short integration runs. However, due to extensive renames, moves, and API changes, full validation is still ongoing.
 Note: the revision includes one (possibly two) easter egg hidden in the code for future archaeologists of the PEM. No physics were harmed.
+
+== 12/02/2026 == JBC
+Following r4065, some safeguards forgotten in "io_netcdf.F90" + 'tsurf' is not needed anymore in the "start1D.txt" + few forgotten small updates.
Index: /trunk/LMDZ.COMMON/libf/evolution/clim_state_init.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/clim_state_init.F90	(revision 4067)
+++ /trunk/LMDZ.COMMON/libf/evolution/clim_state_init.F90	(revision 4068)
@@ -137,5 +137,4 @@
 character(30)                   :: header
 real(dp), dimension(1,1)        :: tmp
-real(dp), dimension(nslope)     :: tmp_1d
 real(dp), dimension(1,1,nlayer) :: q_tmp, teta_tmp, wind_tmp
 real(dp), dimension(nlayer + 1) :: ap_tmp, bp_tmp
@@ -157,5 +156,5 @@
 
 do i = 1,nq
-    read(funit,*,iostat = ierr) header, (tmp_1d(j),j = 1,nslope), (q_tmp(1,1,k),k = 1,nlayer)
+    read(funit,*,iostat = ierr) header, (q_tmp(1,1,k),k = 1,nlayer)
     if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'not enough atmospheric layers defined in the file "'//start1D_name//'" for the tracer "'//trim(header)//'"!',1)
     call set_q_PCM(q_tmp,i)
@@ -165,5 +164,5 @@
 read(funit,*,iostat = ierr) header, (wind_tmp(1,1,k),k = 1,nlayer)
 call set_v_PCM(wind_tmp)
-read(funit,*,iostat = ierr) header, (tmp_1d(j),j = 1,nslope), (teta_tmp(1,1,k),k = 1,nlayer)
+read(funit,*,iostat = ierr) header, (teta_tmp(1,1,k),k = 1,nlayer)
 call set_teta_PCM(teta_tmp)
 
Index: /trunk/LMDZ.COMMON/libf/evolution/clim_state_rec.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/clim_state_rec.F90	(revision 4067)
+++ /trunk/LMDZ.COMMON/libf/evolution/clim_state_rec.F90	(revision 4068)
@@ -31,5 +31,5 @@
 
 !=======================================================================
-SUBROUTINE write_restart(ps4PCM,pa4PCM,preff4PCM,tsurf4PCM,q4PCM,teta4PCM,air_mass4PCM)
+SUBROUTINE write_restart(ps4PCM,pa4PCM,preff4PCM,q4PCM,teta4PCM,air_mass4PCM)
 !-----------------------------------------------------------------------
 ! NAME
@@ -61,5 +61,5 @@
 real(dp),                   intent(in) :: pa4PCM, preff4PCM
 real(dp), dimension(:),     intent(in) :: ps4PCM
-real(dp), dimension(:,:),   intent(in) :: tsurf4PCM, teta4PCM, air_mass4PCM
+real(dp), dimension(:,:),   intent(in) :: teta4PCM, air_mass4PCM
 real(dp), dimension(:,:,:), intent(in) :: q4PCM
 
@@ -75,5 +75,5 @@
 ! ~~~~~~~~~~~~~
 if (ngrid == 1) then
-    call write_restart1D(ps4PCM,pa4PCM,preff4PCM,tsurf4PCM,q4PCM)
+    call write_restart1D(ps4PCM,pa4PCM,preff4PCM,q4PCM)
     return
 end if
@@ -120,5 +120,5 @@
 
 !=======================================================================
-SUBROUTINE write_restart1D(ps4PCM,pa4PCM,preff4PCM,tsurf4PCM,q4PCM)
+SUBROUTINE write_restart1D(ps4PCM,pa4PCM,preff4PCM,q4PCM)
 !-----------------------------------------------------------------------
 ! NAME
@@ -151,5 +151,4 @@
 real(dp),                   intent(in) :: pa4PCM, preff4PCM
 real(dp), dimension(:),     intent(in) :: ps4PCM
-real(dp), dimension(:,:),   intent(in) :: tsurf4PCM
 real(dp), dimension(:,:,:), intent(in) :: q4PCM
 
@@ -170,5 +169,5 @@
 write(funit,*) 'u', (u_PCM(1,l), l = 1,nlayer)
 write(funit,*) 'v', (v_PCM(1,l), l = 1,nlayer)
-write(funit,*) 'teta', (tsurf4PCM(1,j), j = 1,nslope), (teta_PCM(1,l), l = 1,nlayer)
+write(funit,*) 'teta', (teta_PCM(1,l), l = 1,nlayer)
 close(funit)
 
Index: /trunk/LMDZ.COMMON/libf/evolution/config.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/config.F90	(revision 4067)
+++ /trunk/LMDZ.COMMON/libf/evolution/config.F90	(revision 4068)
@@ -76,5 +76,5 @@
 ! LOCAL VARIABLES
 ! ---------------
-logical(k4) :: here, evol_orbit_l, evol_obl_l, evol_ecc_l, evol_lsp_l, do_soil_l, reg_thprop_dependp_l, do_sorption_l, hybrid_alt_coord_l
+logical(k4) :: here, evol_orbit_l, evol_obl_l, evol_ecc_l, evol_lsp_l, do_soil_l, reg_thprop_dependp_l, do_sorption_l, hybrid
 logical(k4) :: icetable_equilibrium_l, icetable_dynamic_l, h2oice_flow_l, co2ice_flow_l, do_layering_l, impose_dust_ratio_l
 integer(di) :: output_rate_l
@@ -204,7 +204,7 @@
 
 ! Read "run_PCM.def" parameters
-hybrid_alt_coord_l = .true. ! Default setting
-call get_hybrid(hybrid_alt_coord_l)
-call set_atmosphere_config(hybrid_alt_coord_l)
+hybrid = .true. ! Default
+call get_hybrid(hybrid)
+call set_atmosphere_config(hybrid)
 
 ! Check incompatibilities
Index: /trunk/LMDZ.COMMON/libf/evolution/deftank/run_PEM.def
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/deftank/run_PEM.def	(revision 4067)
+++ /trunk/LMDZ.COMMON/libf/evolution/deftank/run_PEM.def	(revision 4068)
@@ -102,4 +102,4 @@
 # dust2ice_ratio=0.1
 
-# Some definitions for the physics, in file 'callphys.def'
+# Some definitions for the physics in file "run_PCM.def"
 INCLUDEDEF=run_PCM.def
Index: /trunk/LMDZ.COMMON/libf/evolution/io_netcdf.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/io_netcdf.F90	(revision 4067)
+++ /trunk/LMDZ.COMMON/libf/evolution/io_netcdf.F90	(revision 4068)
@@ -958,5 +958,7 @@
 call check_nc(nf90_get_att(ncid,varid,"_FillValue",fill_value),'getting fill value',has_fill)
 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill)
-if (has_fill .and. var == fill_value) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)
+if (has_fill) then
+    if (var == fill_value) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)
+end if
 
 ! Valid range
@@ -977,5 +979,7 @@
     end if
 end if
-if (has_range .and. (var < valid_min .or. var > valid_max)) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1)
+if (has_range) then
+    if (var < valid_min .or. var > valid_max) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1)
+end if
 
 END SUBROUTINE check_valid_var0d_nc
@@ -1124,5 +1128,7 @@
 call check_nc(nf90_get_att(ncid,varid,"_FillValue",fill_value),'getting fill value',has_fill)
 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill)
-if (has_fill .and. any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)
+if (has_fill) then
+    if (any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)
+end if
 
 ! Valid range
@@ -1143,5 +1149,7 @@
     end if
 end if
-if (has_range .and. (any(var < valid_min) .or. any(var > valid_max))) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1)
+if (has_range) then
+    if (any(var < valid_min) .or. any(var > valid_max)) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1)
+end if
 
 END SUBROUTINE check_valid_var2d_nc
@@ -1205,5 +1213,7 @@
 call check_nc(nf90_get_att(ncid,varid,"_FillValue",fill_value),'getting fill value',has_fill)
 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill)
-if (has_fill .and. any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)
+if (has_fill) then
+    if (any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)
+end if
 
 ! Valid range
@@ -1224,5 +1234,7 @@
     end if
 end if
-if (has_range .and. (any(var < valid_min) .or. any(var > valid_max))) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1)
+if (has_range) then
+    if (any(var < valid_min) .or. any(var > valid_max)) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1)
+end if
 
 END SUBROUTINE check_valid_var3d_nc
@@ -1286,5 +1298,7 @@
 call check_nc(nf90_get_att(ncid,varid,"_FillValue",fill_value),'getting fill value',has_fill)
 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill)
-if (has_fill .and. any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)
+if (has_fill) then
+    if (any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)
+end if
 
 ! Valid range
@@ -1305,5 +1319,7 @@
     end if
 end if
-if (has_range .and. (any(var < valid_min) .or. any(var > valid_max))) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1)
+if (has_range) then
+    if(any(var < valid_min) .or. any(var > valid_max)) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1)
+end if
 
 END SUBROUTINE check_valid_var4d_nc
Index: /trunk/LMDZ.COMMON/libf/evolution/layered_deposits.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/layered_deposits.F90	(revision 4067)
+++ /trunk/LMDZ.COMMON/libf/evolution/layered_deposits.F90	(revision 4068)
@@ -117,5 +117,5 @@
 d_dust = d_dust_in
 dust2ice_ratio = dust2ice_ratio_in
-call print_msg('do_layering     = '//bool2str(do_layering))
+call print_msg('do_layering       = '//bool2str(do_layering))
 call print_msg('impose_dust_ratio = '//bool2str(impose_dust_ratio))
 call print_msg('d_dust            = '//real2str(d_dust))
Index: /trunk/LMDZ.COMMON/libf/evolution/pem.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/pem.F90	(revision 4067)
+++ /trunk/LMDZ.COMMON/libf/evolution/pem.F90	(revision 4068)
@@ -265,5 +265,5 @@
     allocate(character(8) :: num)
 end if
-allocate(delta_icetable(ngrid),icetable_depth_old(ngrid,nslope),is_co2ice_disappeared(ngrid,nslope))
+allocate(delta_icetable(ngrid),icetable_depth_old(ngrid,nslope),is_co2ice_disappeared(ngrid,nslope),tsoil_ts_old(ngrid,nsoil,nslope,nday))
 is_co2ice_disappeared(:,:) = .false.
 delta_icetable(:) = 0._dp
@@ -290,5 +290,4 @@
         ! Conversion to surface ice
         call layering2surfice(layerings_map,h2o_ice,co2_ice,h2oice_depth)
-
     else
         zlag(:,:) = 0._dp
@@ -324,5 +323,4 @@
 
         ! Evolve soil temperature
-        allocate(tsoil_ts_old(ngrid,nsoil,nslope,nday))
         call evolve_soil_temp(tsoil_avg,tsurf_avg,tsoil_ts,tsoil_ts_old,h2o_soildensity_avg)
 
@@ -491,5 +489,5 @@
 
 ! Write the "start.nc"
-call write_restart(ps4PCM,pa4PCM,preff4PCM,tsurf4PCM,q4PCM,teta4PCM,air_mass4PCM)
+call write_restart(ps4PCM,pa4PCM,preff4PCM,q4PCM,teta4PCM,air_mass4PCM)
 
 ! Update the duration information of the simulation
