Index: /trunk/LMDZ.COMMON/libf/evolution/orbit_param_criterion_mod.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/orbit_param_criterion_mod.F90	(revision 3068)
+++ /trunk/LMDZ.COMMON/libf/evolution/orbit_param_criterion_mod.F90	(revision 3069)
@@ -79,6 +79,5 @@
 close(73)
 if (last_ilask == 0 .or. last_ilask == size(yearlask,1) + 1) then
-    write(*,*) 'The current year could not be found in the file "obl_ecc_lsp.asc".'
-    stop
+    error stop 'The current year could not be found in the file "obl_ecc_lsp.asc".'
 else
     write(*,*) 'The current year in the "obl_ecc_lsp.asc" file is at line:', last_ilask
Index: /trunk/LMDZ.COMMON/libf/evolution/pem.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/pem.F90	(revision 3068)
+++ /trunk/LMDZ.COMMON/libf/evolution/pem.F90	(revision 3069)
@@ -1119,5 +1119,5 @@
     write(*,*) "restart_evol.nc has been written"
 #else
-    call writerestart1D('restart1D_evol.txt',ps(1),tsurf,nlayer,teta,ucov,vcov,nq,noms,qsurf,q)
+    call writerestart1D('restart1D_evol.txt',ps(1),tsurf(1,:),nlayer,size(tsurf,2),teta,ucov,vcov,nq,noms,qsurf(1,:,:),q)
     write(*,*) "restart1D_evol.txt has been written"
 #endif
Index: /trunk/LMDZ.COMMON/libf/evolution/recomp_orb_param_mod.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/recomp_orb_param_mod.F90	(revision 3068)
+++ /trunk/LMDZ.COMMON/libf/evolution/recomp_orb_param_mod.F90	(revision 3069)
@@ -102,8 +102,5 @@
 enddo
 
-if (.not. found_year) then
-    write(*,*) 'The new year could not be found in the file "obl_ecc_lsp.asc".'
-    stop
-endif
+if (.not. found_year) error stop 'The new year could not be found in the file "obl_ecc_lsp.asc".'
 
 halfaxe = 227.94
Index: /trunk/LMDZ.MARS/changelog.txt
===================================================================
--- /trunk/LMDZ.MARS/changelog.txt	(revision 3068)
+++ /trunk/LMDZ.MARS/changelog.txt	(revision 3069)
@@ -4233,2 +4233,3 @@
 == 03/10/2023 == JBC
 In 1D, 'q' has been converted from dimension (:,:) to (1,:,:) and 'q2' is now got through the module 'turb_mod'. It allows more generalization and to match dimension in the subroutines.
+Related to commit r3066, correction of a bug to write/read a restart/start in 1D and more adaptations of the code.
Index: /trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90	(revision 3068)
+++ /trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90	(revision 3069)
@@ -78,5 +78,5 @@
 ! Local variables
 !=======================================================================
-integer                   :: ierr, iq, ilayer, isoil, nlevel, nsoil, flagthermo, flagh2o
+integer                   :: ierr, iq, j, ilayer, isoil, nlevel, nsoil, flagthermo, flagh2o
 integer                   :: dayn ! Final date
 real, dimension(nlayer)   :: zlay ! altitude estimee dans les couches (km)
@@ -131,5 +131,5 @@
         write(*,*) '  (which should contain some input parameters along with the following line: INCLUDEDEF=callphys.def)'
         write(*,*) ' ... might as well stop here ...'
-        stop
+        error stop
     endif
 
@@ -151,6 +151,5 @@
         write(*,*) 'Initialization is done with default values.'
     else
-        write(*,*) 'Initialization cannot be done for the 1D PEM.'
-        stop
+        error stop 'Initialization cannot be done for the 1D PEM.'
     endif
 endif
@@ -161,6 +160,5 @@
         write(*,*) 'Initialization is done with default values.'
     else
-        write(*,*) 'Initialization cannot be done for the 1D PEM.'
-        stop
+        error stop 'Initialization cannot be done for the 1D PEM.'
     endif
 endif
@@ -218,5 +216,5 @@
     write(*,*) ' If you want to run with tracers, I need it'
     write(*,*) ' ... might as well stop here ...'
-    stop
+    error stop
 else
     write(*,*) "init_testphys1d: Reading file traceur.def"
@@ -227,10 +225,10 @@
         write(*,*) "init_testphys1d: error reading number of tracers"
         write(*,*) "   (first line of traceur.def) "
-        stop
+        error stop
     endif
     if (nq < 1) then
         write(*,*) "init_testphys1d: error number of tracers"
         write(*,*) "is nq=",nq," but must be >=1!"
-        stop
+        error stop
     endif
 endif
@@ -244,6 +242,5 @@
     read(90,'(80a)',iostat = ierr) line ! store the line from traceur.def
     if (ierr /= 0) then
-        write(*,*) 'init_testphys1d: error reading tracer names...'
-        stop
+        error stop 'init_testphys1d: error reading tracer names...'
     endif
     ! if format is tnom_0, tnom_transp (isotopes)
@@ -353,4 +350,5 @@
     call getin("psurf",psurf)
 else
+    open(3,file = start1Dname,status = "old",action = "read")
     read(3,*) header, psurf
 endif
@@ -452,14 +450,8 @@
 else
     do iq = 1,nq
-        open(3,file = start1Dname,status = "old",action = "read")
-        read(3,*) header, qsurf(1,iq,1),(q(1,ilayer,iq), ilayer = 1,nlayer)
-        if (trim(tname(iq)) /= trim(header)) then
-            write(*,*) 'Tracer names not compatible for initialization with "'//trim(start1Dname)//'"!'
-            stop
-        endif
+        read(3,*) header, (qsurf(1,iq,j), j = 1,size(qsurf,3)), (q(1,ilayer,iq), ilayer = 1,nlayer)
+        if (trim(tname(iq)) /= trim(header)) error stop 'Tracer names not compatible for initialization with "'//trim(start1Dname)//'"!'
     enddo
 endif
-
-
 
 ! Initialize albedo / soil thermal inertia
@@ -562,8 +554,5 @@
     if (trim(tname(iq)) == "co2") igcm_co2 = iq
 enddo
-if (igcm_co2 == 0) then
-    write(*,*) "init_testphys1d error, missing co2 tracer!"
-    stop
-endif
+if (igcm_co2 == 0) error stop "init_testphys1d error, missing co2 tracer!"
 
 if (.not. startfiles_1D) then
@@ -615,5 +604,5 @@
     temp(:) = tmp2(1:)
 else
-    read(3,*) header, tsurf, (temp(ilayer), ilayer = 1,nlayer)
+    read(3,*) header, (tsurf(1,:), j = 1,size(tsurf,2)), (temp(ilayer), ilayer = 1,nlayer)
     close(3)
 endif
@@ -719,6 +708,5 @@
         write(*,*) 'Unless it reaches saturation (maximal value)'
     else
-        write(*,*) 'Water vapor profile value not correct!'
-        stop
+        error stop 'Water vapor profile value not correct!'
     endif
 endif
@@ -740,6 +728,5 @@
         else
             write(*,*) 'Reference atmospheric water vapor profile not known!'
-            write(*,*) 'Please, specify atm_wat_profile'
-            stop
+            error stop 'Please, specify atm_wat_profile'
         endif
     endif
Index: /trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90	(revision 3068)
+++ /trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90	(revision 3069)
@@ -225,5 +225,5 @@
 
 ! Writing the "restart1D.txt" file for the next run
-if (startfiles_1D) call writerestart1D('restart1D.txt',psurf,tsurf(:,1),nlayer,temp,u,v,nq,noms,qsurf(1,:,1),q)
+if (startfiles_1D) call writerestart1D('restart1D.txt',psurf,tsurf(1,:),nlayer,size(tsurf,2),temp,u,v,nq,noms,qsurf(1,:,:),q)
 
 write(*,*) "testphys1d: everything is cool."
@@ -243,8 +243,5 @@
 real, dimension(ngrid,nfield) :: pfi
 
-if (ngrid /= 1) then
-    write(*,*) "gr_fi_dyn error: in 1D ngrid should be 1!!!"
-    stop
-endif
+if (ngrid /= 1) error stop 'gr_fi_dyn error: in 1D ngrid should be 1!!!'
 
 pdyn(1,1,1:nfield) = pfi(1,1:nfield)
Index: /trunk/LMDZ.MARS/libf/phymars/dyn1d/writerestart1D.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/dyn1d/writerestart1D.F90	(revision 3068)
+++ /trunk/LMDZ.MARS/libf/phymars/dyn1d/writerestart1D.F90	(revision 3069)
@@ -1,3 +1,3 @@
-SUBROUTINE writerestart1D(filename,psurf,tsurf,nlayer,temp,u,v,nq,qnames,qsurf,q)
+SUBROUTINE writerestart1D(filename,psurf,tsurf,nlayer,nslope,temp,u,v,nq,qnames,qsurf,q)
 
 implicit none
@@ -5,23 +5,24 @@
 ! Arguments
 character(len = *),                intent(in) :: filename
-integer,                           intent(in) :: nlayer, nq
-real,                              intent(in) :: psurf, tsurf
+integer,                           intent(in) :: nlayer, nq, nslope
+real,                              intent(in) :: psurf
+real, dimension(nslope),           intent(in) :: tsurf
 real, dimension(nlayer),           intent(in) :: temp, u, v
 real, dimension(nlayer,nq),        intent(in) :: q
-real, dimension(nq),               intent(in) :: qsurf
+real, dimension(nq,nslope),        intent(in) :: qsurf
 character(len = *), dimension(nq), intent(in) :: qnames
 
 ! Local variables
-integer :: il, iq
+integer :: i, j, il
 
 ! Write the data needed for a restart in "restart1D.txt"
 open(1,file = filename,status = "replace",action = "write")
-do iq = 1,nq
-    write(1,*) qnames(iq), qsurf(iq), (q(il,iq), il = 1,nlayer)
+write(1,*) 'ps', psurf
+do i = 1,nq
+    write(1,*) qnames(i), (qsurf(i,j), j = 1,nslope), (q(il,i), il = 1,nlayer)
 enddo
-write(1,*) 'ps', psurf
 write(1,*) 'u', (u(il), il = 1,nlayer)
 write(1,*) 'v', (v(il), il = 1,nlayer)
-write(1,*) 'teta', tsurf, (temp(il), il = 1,nlayer)
+write(1,*) 'teta', (tsurf(j), j = 1,nslope), (temp(il), il = 1,nlayer)
 close(1)
 
