Index: LMDZ6/trunk/libf/phylmd/cosp2/cosp.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/cosp2/cosp.F90	(revision 3371)
+++ LMDZ6/trunk/libf/phylmd/cosp2/cosp.F90	(revision 3372)
@@ -1357,6 +1357,10 @@
     if (use_vgrid) then
       Nlvgrid  = Nvgrid
+      if (.not. allocated(vgrid_zl)) allocate(vgrid_zl(Nlvgrid)) 
+      if (.not. allocated(vgrid_zu)) allocate(vgrid_zu(Nlvgrid))
+      if (.not. allocated(vgrid_z)) allocate(vgrid_z(Nlvgrid)) 
+
       print*,'allocation vgrid_zl zu z dans  COSP_INIT'
-       allocate(vgrid_zl(Nlvgrid),vgrid_zu(Nlvgrid),vgrid_z(Nlvgrid))
+!       allocate(vgrid_zl(Nlvgrid),vgrid_zu(Nlvgrid),vgrid_z(Nlvgrid))
        ! CloudSat grid requested
        if (luseCSATvgrid)       zstep = 480._wp
@@ -1370,5 +1374,7 @@
     else
        Nlvgrid = Nlevels
-       allocate(vgrid_zl(Nlvgrid),vgrid_zu(Nlvgrid),vgrid_z(Nlvgrid))
+      if (.not. allocated(vgrid_zl)) allocate(vgrid_zl(Nlvgrid)) 
+      if (.not. allocated(vgrid_zu)) allocate(vgrid_zu(Nlvgrid)) 
+      if (.not. allocated(vgrid_z)) allocate(vgrid_z(Nlvgrid)) 
     endif
 
@@ -1393,5 +1399,7 @@
   !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   subroutine cosp_cleanUp()
-    deallocate(vgrid_zl,vgrid_zu,vgrid_z)
+    if (allocated(vgrid_zl)) deallocate(vgrid_zl)
+    if (allocated(vgrid_zu)) deallocate(vgrid_zu)
+    if (allocated(vgrid_z)) deallocate(vgrid_z)
   end subroutine cosp_cleanUp
    
Index: LMDZ6/trunk/libf/phylmd/cosp2/cosp_read_otputkeys.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/cosp2/cosp_read_otputkeys.F90	(revision 3371)
+++ LMDZ6/trunk/libf/phylmd/cosp2/cosp_read_otputkeys.F90	(revision 3372)
@@ -659,5 +659,5 @@
   if (Lproftemp)                cfg%out_list(i) = 'proftemp'         !TIBO
     
-  if (i /= 78) then
+  if (i.gt.78) then
      print *, 'COSP_IO: wrong number of output diagnostics'
      print *, i,78
