Index: /trunk/LMDZ.MARS/libf/phymars/calltherm_interface.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/calltherm_interface.F90	(revision 694)
+++ /trunk/LMDZ.MARS/libf/phymars/calltherm_interface.F90	(revision 695)
@@ -2,5 +2,5 @@
 ! AC 2011-01-05
 !
-      SUBROUTINE calltherm_interface (firstcall, &
+      SUBROUTINE calltherm_interface (firstcall, & 
      & zzlev,zzlay, &
      & ptimestep,pu,pv,pt,pq,pdu,pdv,pdt,pdq,q2, &
@@ -24,5 +24,6 @@
 !      REAL, INTENT(IN) :: long(ngridmx),lati(ngridmx)
       REAL, INTENT(IN) :: ptimestep
-      REAL, INTENT(IN) :: pplev(ngridmx,nlayermx+1),pplay(ngridmx,nlayermx)
+      REAL, INTENT(IN) :: pplev(ngridmx,nlayermx+1)
+      REAL, INTENT(IN) :: pplay(ngridmx,nlayermx)
       REAL, INTENT(IN) :: pphi(ngridmx,nlayermx)
       REAL, INTENT(IN) :: pu(ngridmx,nlayermx),pv(ngridmx,nlayermx)
@@ -32,5 +33,6 @@
       LOGICAL, INTENT(IN) :: firstcall
       REAL, INTENT(IN) :: pdu(ngridmx,nlayermx),pdv(ngridmx,nlayermx)
-      REAL, INTENT(IN) :: pdq(ngridmx,nlayermx,nqmx),pdt(ngridmx,nlayermx)
+      REAL, INTENT(IN) :: pdq(ngridmx,nlayermx,nqmx)
+      REAL, INTENT(IN) :: pdt(ngridmx,nlayermx)
       REAL, INTENT(IN) :: q2(ngridmx,nlayermx+1)
       REAL, INTENT(IN) :: zpopsk(ngridmx,nlayermx)
Index: /trunk/LMDZ.MARS/libf/phymars/nlte_aux.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/nlte_aux.F	(revision 694)
+++ /trunk/LMDZ.MARS/libf/phymars/nlte_aux.F	(revision 695)
@@ -277,5 +277,5 @@
 c arguments                 
       integer         ig        ! ADDED FOR TRACEBACK
-      real*8		me      ! I. path's absorber amount  
+      real*8          me      ! I. path's absorber amount  
       real*8          pe        ! I. path's presion total
       real*8          plaux     ! I. path's partial pressure of CO2
@@ -287,8 +287,8 @@
       
 c local variables                               
-      integer 	i                                     
-      real*8 		y,x,wl,wd                    
-      real*8		cn(0:7),dn(0:7)                        
-      real*8 		pi, xx                                
+      integer         i                                     
+      real*8          y,x,wl,wd                    
+      real*8          cn(0:7),dn(0:7)                        
+      real*8          pi, xx                                
       real*8          f_sat_box                      
       real*8          dv_sat_box, dv_corte_box       
@@ -558,5 +558,5 @@
       write(2,7) c1,c,c2,fsim(c1),fsim(c),fsim(c2)    
       write(*,7) c1,c,c2,fsim(c1),fsim(c),fsim(c2)      
- 7    format(2x,17hsimrule fails at ,/,3e15.6,/,3e15.6)     
+ 7    format(2x,'17hsimrule fails at ',/,3e15.6,/,3e15.6)     
       goto 8                                         
  5    a0=s1(n)                                  
Index: /trunk/LMDZ.MARS/libf/phymars/nlte_calc.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/nlte_calc.F	(revision 694)
+++ /trunk/LMDZ.MARS/libf/phymars/nlte_calc.F	(revision 695)
@@ -155,8 +155,8 @@
                                                             
 c vibr. temp of the bending mode :              
-      if (isot.eq.1) call interdp ( tvtbs,zyd,nzy, v626t1,zld,nl, 1 )  
-      if (isot.eq.2) call interdp ( tvtbs,zyd,nzy, v628t1,zld,nl, 1 )  
-      if (isot.eq.3) call interdp ( tvtbs,zyd,nzy, v636t1,zld,nl, 1 )  
-      if (isot.eq.4) call interdp ( tvtbs,zyd,nzy, v627t1,zld,nl, 1 )  
+      if (isot.eq.1) call interdp (tvtbs,zyd,nzy,v626t1,zld,nl,1)  
+      if (isot.eq.2) call interdp (tvtbs,zyd,nzy,v628t1,zld,nl,1)  
+      if (isot.eq.3) call interdp (tvtbs,zyd,nzy,v636t1,zld,nl,1)  
+      if (isot.eq.4) call interdp (tvtbs,zyd,nzy,v627t1,zld,nl,1)  
       
 c 2nd: correccion a la n10(i) (cantidad de absorbente en el lower state)
@@ -683,7 +683,10 @@
 c***********************************************************************
                                                             
-      call mzescape (ig,taustar21,tauinf210,tauii210,1,2,irw_mztf,imu) 
-      call mzescape (ig,taustar31,tauinf310,tauii310,1,3,irw_mztf,imu)
-      call mzescape (ig,taustar41,tauinf410,tauii410,1,4,irw_mztf,imu)
+      call mzescape (ig,taustar21,tauinf210,tauii210,1,2
+     & ,irw_mztf,imu) 
+      call mzescape (ig,taustar31,tauinf310,tauii310,1,3
+     & ,irw_mztf,imu)
+      call mzescape (ig,taustar41,tauinf410,tauii410,1,4
+     & ,irw_mztf,imu)
                                                             
       istyle = 2                                     
@@ -915,8 +918,8 @@
       enddo      
 c vibr. temp of the bending mode :  
-      if (isot.eq.1) call interdp ( tvtbs,zyd,nzy, v626t1,zld,nl, 1 )  
-      if (isot.eq.2) call interdp ( tvtbs,zyd,nzy, v628t1,zld,nl, 1 )  
-      if (isot.eq.3) call interdp ( tvtbs,zyd,nzy, v636t1,zld,nl, 1 )  
-      if (isot.eq.4) call interdp ( tvtbs,zyd,nzy, v627t1,zld,nl, 1 )  
+      if (isot.eq.1) call interdp(tvtbs,zyd,nzy, v626t1,zld,nl,1)  
+      if (isot.eq.2) call interdp(tvtbs,zyd,nzy, v628t1,zld,nl,1)  
+      if (isot.eq.3) call interdp(tvtbs,zyd,nzy, v636t1,zld,nl,1)  
+      if (isot.eq.4) call interdp(tvtbs,zyd,nzy, v627t1,zld,nl,1)  
         !if (isot.eq.5) call interdp ( tvtbs,zxd,nz, vcot1,zld,nl, 1 )  
         
@@ -2037,8 +2040,8 @@
             
 c vibr. temp of the bending mode :  
-      if (isot.eq.1) call interdp ( tvtbs,zyd,nzy, v626t1,zld,nl, 1 )  
-      if (isot.eq.2) call interdp ( tvtbs,zyd,nzy, v628t1,zld,nl, 1 )  
-      if (isot.eq.3) call interdp ( tvtbs,zyd,nzy, v636t1,zld,nl, 1 )  
-      if (isot.eq.4) call interdp ( tvtbs,zyd,nzy, v627t1,zld,nl, 1 )  
+      if (isot.eq.1) call interdp(tvtbs,zyd,nzy, v626t1,zld,nl,1)  
+      if (isot.eq.2) call interdp(tvtbs,zyd,nzy, v628t1,zld,nl,1)  
+      if (isot.eq.3) call interdp(tvtbs,zyd,nzy, v636t1,zld,nl,1)  
+      if (isot.eq.4) call interdp(tvtbs,zyd,nzy, v627t1,zld,nl,1)  
         !if (isot.eq.5) call interdp ( tvtbs,zxd,nz, vcot1,zld,nl, 1 )  
             
@@ -2533,22 +2536,22 @@
                                                 
 ! tvtbs is the bending mode of the molecule. used in xqv.   
-      if (isot.eq.1) call interdp (tvtbs,zyd,nzy, v626t1,zld,nl, 1 )  
-      if (isot.eq.2) call interdp (tvtbs,zyd,nzy, v628t1,zld,nl, 1 )  
-      if (isot.eq.3) call interdp (tvtbs,zyd,nzy, v636t1,zld,nl, 1 )  
-      if (isot.eq.4) call interdp (tvtbs,zyd,nzy, v627t1,zld,nl, 1 )  
-      if (isot.eq.5) call interdp (tvtbs,zyd,nzy, vcot1,zld,nl, 1 )   
+      if (isot.eq.1) call interdp (tvtbs,zyd,nzy,v626t1,zld,nl,1)  
+      if (isot.eq.2) call interdp (tvtbs,zyd,nzy,v628t1,zld,nl,1)  
+      if (isot.eq.3) call interdp (tvtbs,zyd,nzy,v636t1,zld,nl,1)  
+      if (isot.eq.4) call interdp (tvtbs,zyd,nzy,v627t1,zld,nl,1)  
+      if (isot.eq.5) call interdp (tvtbs,zyd,nzy,vcot1,zld,nl,1)   
       
 ! tvt0 is the lower level of the transition. used in xlower.            
       if (ib.eq.2 .or. ib.eq.3 .or. ib.eq.4 .or. ib.eq.15) then  
-         if (isot.eq.1) call interdp (tvt0,zyd,nzy, v626t1,zld,nl, 1 ) 
-         if (isot.eq.2) call interdp (tvt0,zyd,nzy, v628t1,zld,nl, 1 ) 
-         if (isot.eq.3) call interdp (tvt0,zyd,nzy, v636t1,zld,nl, 1 ) 
-         if (isot.eq.4) call interdp (tvt0,zyd,nzy, v627t1,zld,nl, 1 ) 
+         if (isot.eq.1) call interdp(tvt0,zyd,nzy,v626t1,zld,nl,1) 
+         if (isot.eq.2) call interdp(tvt0,zyd,nzy,v628t1,zld,nl,1) 
+         if (isot.eq.3) call interdp(tvt0,zyd,nzy,v636t1,zld,nl,1) 
+         if (isot.eq.4) call interdp(tvt0,zyd,nzy,v627t1,zld,nl,1) 
       elseif (ib.eq.6 .or. ib.eq.8 .or. ib.eq.10     
      @        .or. ib.eq.13 .or. ib.eq.14                  
      @        .or. ib.eq.17 .or. ib.eq.19 .or. ib.eq.20) then          
-         if (isot.eq.1) call interdp ( tvt0,zyd,nzy, v626t2,zld,nl, 1 )
-         if (isot.eq.2) call interdp ( tvt0,zyd,nzy, v628t2,zld,nl, 1 )
-         if (isot.eq.3) call interdp ( tvt0,zyd,nzy, v636t2,zld,nl, 1 )
+         if (isot.eq.1) call interdp(tvt0,zyd,nzy,v626t2,zld,nl,1)
+         if (isot.eq.2) call interdp(tvt0,zyd,nzy,v628t2,zld,nl,1)
+         if (isot.eq.3) call interdp(tvt0,zyd,nzy,v636t2,zld,nl,1)
          if (isot.eq.4) then  
             call interdp ( tvt0,zyd,nzy, v627t2,zld,nl, 1 )
@@ -2566,8 +2569,8 @@
 c tvt1 is the upper level of the transition.    
       if (ib.eq.13 .or. ib.eq.14) then 
-         if (isot.eq.1) call interdp ( tvt1,zyd,nzy, v626t4,zld,nl, 1 )
-         if (isot.eq.2) call interdp ( tvt1,zyd,nzy, v628t4,zld,nl, 1 ) 
-         if (isot.eq.3) call interdp ( tvt1,zyd,nzy, v636t4,zld,nl, 1 )
-         if (isot.eq.4) call interdp ( tvt1,zyd,nzy, v627t4,zld,nl, 1 )
+         if (isot.eq.1) call interdp(tvt1,zyd,nzy,v626t4,zld,nl,1)
+         if (isot.eq.2) call interdp(tvt1,zyd,nzy,v628t4,zld,nl,1) 
+         if (isot.eq.3) call interdp(tvt1,zyd,nzy,v636t4,zld,nl,1)
+         if (isot.eq.4) call interdp(tvt1,zyd,nzy,v627t4,zld,nl,1)
       end if
       
@@ -2586,6 +2589,6 @@
 
 	    !!! vt of the 3 levels in (020)  (see pag. 36a-sn1 for this)       
-	    xalfa = 1.d0/2.d0* exp( dble(-ee*(nu12_1000-nu(1,2))/ty(i)) )      
-	    xbeta = 1.d0/2.d0* exp( dble(-ee*(nu12_0200-nu(1,2))/ty(i)) )      
+	    xalfa = 1.d0/2.d0*exp(dble(-ee*(nu12_1000-nu(1,2))/ty(i)))      
+	    xbeta = 1.d0/2.d0*exp(dble(-ee*(nu12_0200-nu(1,2))/ty(i)))      
 	    xtv0200 = dble( - ee * nu12_0200 ) /       
      @           ( log( xbeta/(1.d0+xalfa+xbeta) ) - 
@@ -2603,5 +2606,5 @@
      @           ( log(2./(1.d0+xalfa+xbeta)) - ee*nu(1,2)/tvt0(i) ) )     
 	    xtv1000 = dble( - ee * nu12_1000 /       
-     @           ( log(4.*xalfa/(1.d0+xalfa+xbeta))-ee*nu(1,2)/tvt0(i)))
+     @           (log(4.*xalfa/(1.d0+xalfa+xbeta))-ee*nu(1,2)/tvt0(i)))
 
 !            if ( icurt_pop.eq.30 ) then 
@@ -4013,5 +4016,5 @@
 	    !write (*,*)  ' cm15um_hb/11 '                                  
 	    !write (*,*)  ' ib, ist, irw, imu =', ib, ist, irw_mztf, imu     
-               call mztf ( ig,cax1,cax2,cax3,v1,v2, ib,ist,irw_mztf,imu,      
+               call mztf(ig,cax1,cax2,cax3,v1,v2,ib,ist,irw_mztf,imu,
      @              itauout,icfout,itableout)                    
 !	  else                                         
Index: /trunk/LMDZ.MARS/libf/phymars/nlte_tcool.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/nlte_tcool.F	(revision 694)
+++ /trunk/LMDZ.MARS/libf/phymars/nlte_tcool.F	(revision 695)
@@ -238,5 +238,6 @@
 !          	hrkday_factor(i) =  hrkday_convert( t(i),        
 !     @        	  co2vmr(i), o3pvmr(i), n2vmr(i), covmr(i) )
-         hrkday_factor(i) = hrkday_convert(mmean_nlte(i),cpnew_nlte(i))
+         hrkday_factor(i) = hrkday_convert(mmean_nlte(i)
+     &                          ,cpnew_nlte(i))
 
       enddo
Index: /trunk/LMDZ.MARS/libf/phymars/nuclea.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/nuclea.F	(revision 694)
+++ /trunk/LMDZ.MARS/libf/phymars/nuclea.F	(revision 695)
@@ -161,5 +161,6 @@
           !! ... + TERM B
           yeah = (rap-cost)/yeah
-          fshape = fshape + rap*rap*rap*(2.-3.*yeah+yeah*yeah*yeah)
+          fshape = fshape + 
+     & rap*rap*rap*(2.-3.*yeah+yeah*yeah*yeah)
           !! ... + TERM C 
           fshape = fshape + 3. * cost * rap * rap * (yeah-1.)
Index: /trunk/LMDZ.MARS/libf/phymars/physiq.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/physiq.F	(revision 694)
+++ /trunk/LMDZ.MARS/libf/phymars/physiq.F	(revision 695)
@@ -1527,29 +1527,29 @@
 c        "stats")          only possible in 3D runs !
          
-         IF (callstats) THEN
-
-           call wstats(ngrid,"ps","Surface pressure","Pa",2,ps)
-           call wstats(ngrid,"tsurf","Surface temperature","K",2,tsurf)
-           call wstats(ngrid,"co2ice","CO2 ice cover",
+       IF (callstats) THEN
+
+        call wstats(ngrid,"ps","Surface pressure","Pa",2,ps)
+        call wstats(ngrid,"tsurf","Surface temperature","K",2,tsurf)
+        call wstats(ngrid,"co2ice","CO2 ice cover",
      &                "kg.m-2",2,co2ice)
-           call wstats(ngrid,"fluxsurf_lw",
+        call wstats(ngrid,"fluxsurf_lw",
      &                "Thermal IR radiative flux to surface","W.m-2",2,
      &                fluxsurf_lw)
-           call wstats(ngrid,"fluxsurf_sw",
+        call wstats(ngrid,"fluxsurf_sw",
      &                "Solar radiative flux to surface","W.m-2",2,
      &                fluxsurf_sw_tot)
-           call wstats(ngrid,"fluxtop_lw",
+        call wstats(ngrid,"fluxtop_lw",
      &                "Thermal IR radiative flux to space","W.m-2",2,
      &                fluxtop_lw)
-           call wstats(ngrid,"fluxtop_sw",
+        call wstats(ngrid,"fluxtop_sw",
      &                "Solar radiative flux to space","W.m-2",2,
      &                fluxtop_sw_tot)
-           call wstats(ngrid,"temp","Atmospheric temperature","K",3,zt)
-           call wstats(ngrid,"u","Zonal (East-West) wind","m.s-1",3,zu)
-           call wstats(ngrid,"v","Meridional (North-South) wind",
+        call wstats(ngrid,"temp","Atmospheric temperature","K",3,zt)
+        call wstats(ngrid,"u","Zonal (East-West) wind","m.s-1",3,zu)
+        call wstats(ngrid,"v","Meridional (North-South) wind",
      &                "m.s-1",3,zv)
 c           call wstats(ngrid,"w","Vertical (down-up) wind",
 c     &                "m.s-1",3,pw)
-           call wstats(ngrid,"rho","Atmospheric density","kg/m3",3,rho)
+        call wstats(ngrid,"rho","Atmospheric density","kg/m3",3,rho)
 c           call wstats(ngrid,"pressure","Pressure","Pa",3,pplay)
 c          call wstats(ngrid,"q2",
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/SCRIPTS/copy_model
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/SCRIPTS/copy_model	(revision 694)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/SCRIPTS/copy_model	(revision 695)
@@ -132,4 +132,7 @@
 mkdir mars_lmd/libf/phymars
 ln -sf $WRFSRC/WRFV2/mars_lmd/libf/phymars/* mars_lmd/libf/phymars/
+\rm mars_lmd/libf/phymars/meso_inc
+mkdir mars_lmd/libf/phymars/meso_inc
+ln -sf $WRFSRC/WRFV2/mars_lmd/libf/phymars/meso_inc/* mars_lmd/libf/phymars/meso_inc/
 mkdir mars_lmd/libf/dyn3d
 ln -sf $WRFSRC/WRFV2/mars_lmd/libf/dyn3d/* mars_lmd/libf/dyn3d/
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate2
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate2	(revision 694)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate2	(revision 695)
@@ -24,10 +24,13 @@
 cd phymars
 cp ../generate2 .
-find * -exec generate2 {} \;
+find *.F -exec generate2 {} \;
+find *.h -exec generate2 {} \;
+find *.F90 -exec generate2 {} \;
+find *.inc -exec generate2 {} \;
 \rm *generate2
 cd ..
 
 cd phymars/meso_inc/
-cp ../generate2 .
+cp ../../generate2 .
 find * -exec generate2 {} \;
 \rm *generate2
@@ -46,4 +49,2 @@
 \rm *generate2
 cd ..
-
-  
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate3
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate3	(revision 694)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate3	(revision 695)
@@ -27,11 +27,13 @@
 cd phymars
 cp ../generate3 .
-find * -exec generate3 {} \;
+find *.F -exec generate3 {} \;
+find *.h -exec generate3 {} \;
+find *.F90 -exec generate3 {} \;
+find *.inc -exec generate3 {} \;
 \rm *generate3
 cd ..
 
-
 cd phymars/meso_inc/
-cp ../generate3 .
+cp ../../generate3 .
 find * -exec generate3 {} \;
 \rm *generate3
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate4
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate4	(revision 694)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/duplicate4	(revision 695)
@@ -27,11 +27,13 @@
 cd phymars
 cp ../generate4 .
-find * -exec generate4 {} \;
+find *.F -exec generate4 {} \;
+find *.h -exec generate4 {} \;
+find *.F90 -exec generate4 {} \;
+find *.inc -exec generate4 {} \;
 \rm *generate4
 cd ..
 
-
 cd phymars/meso_inc/
-cp ../generate4 .
+cp ../../generate4 .
 find * -exec generate4 {} \;
 \rm *generate4
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate2
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate2	(revision 694)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate2	(revision 695)
@@ -1,3 +1,3 @@
-#script
+# script
 # execute: find * -exec generate2 {} \;
 # change number sed -e s/d2/d3/g generate2 > generate3
@@ -7,12 +7,31 @@
 # Specifcic cases for newphys compilation:
 
+sed -e s/'[mM][oO][dD][uU][lL][eE] '/'MODULE d2_'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/'d2_[pP][rR][oO][cC][eE][dD][uU][rR][eE] '/'PROCEDURE '/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/'[iI][nN][tT][eE][rR][fF][aA][cC][eE] '/'INTERFACE d2_'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/'[eE][nN][dD] INTERFACE d2_'/'END INTERFACE '/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/'calltherm_INTERFACE d2_'/'calltherm_interface '/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
 sed -e s/'meso_inc_'/'d2_meso_inc_'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
 sed -e s+'d2_meso_inc/'+'meso_inc/'+g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/'[uU][sS][eE] ioipsl_getincom'/'USE d2_ioipsl_getincom'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
 sed -e s/'PUBLIC :: getin, getin_dump'/'PUBLIC :: d2_getin, d2_getin_dump'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
 sed -e s/' getinrs, getinr1d, getinr2d,'/' d2_getinrs, d2_getinr1d, d2_getinr2d,'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
 sed -e s/' getinis, getini1d, getini2d,'/' d2_getinis, d2_getini1d, d2_getini2d,'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
 sed -e s/' getincs, getinc1d, getinc2d,'/' d2_getincs, d2_getinc1d, d2_getinc2d,'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
-sed -e s/' getinls, getinl1d, getinl2d,'/' d2_getinls, d2_getinl1d, d2_getinl2d,'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/' getinls, getinl1d, getinl2d'/' d2_getinls, d2_getinl1d, d2_getinl2d'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
 sed -e s/'PUBLIC :: ipslnlf, ipslerr, ipslerr_act, ipslerr_inq, histerr, ipsldbg'/'PUBLIC :: d2_ipslnlf, d2_ipslerr, d2_ipslerr_act, d2_ipslerr_inq, d2_histerr, d2_ipsldbg'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/'USE ioipsl_errioipsl, ONLY : ipslerr'/'USE d2_ioipsl_errioipsl, ONLY : d2_ipslerr'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/'USE ioipsl_stringop'/'USE d2_ioipsl_stringop'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+sed -e s/'ONLY : nocomma,cmpblank,strlowercase'/'ONLY : d2_nocomma,d2_cmpblank,d2_strlowercase'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp
+
+# Functions
+
+case ${1} in 
+   'nlte_aux.F') sed -e s/'iaa_we'/'d2_iaa_we'/g d2_${1}_temp | sed -e s/'simrul'/'d2_simrul'/g | sed -e s/'iaa_f'/'d2_iaa_f'/g | sed -e s/'iaa_fi'/'d2_iaa_fi'/g | sed -e s/'voigtf'/'d2_voigtf'/g | sed -e s/'planckdp'/'d2_planckdp'/g | sed -e s/'bandid'/'d2_bandid'/g > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp ;;
+   'nlte_tcool.F') sed -e s/'planckdp'/'d2_planckdp'/g d2_${1}_temp | sed -e s/'hrkday_convert'/'d2_hrkday_convert'/g > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp ;;
+   'nlte_calc.F') sed -e s/'bandid'/'d2_bandid'/g d2_${1}_temp > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp ;;
+   'geticecover.F90') sed -e s/'isitice'/'d2_isitice'/g d2_${1}_temp | sed -e s/'splatcrocus'/'d2_splatcrocus'/g | sed -e s/'nplatcrocus'/'d2_nplatcrocus'/g > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp ;;
+   'nuclea.F')  sed -e s/'fshape'/'d2_fshape'/g d2_${1}_temp | sed -e s/'d2_fshapesimple'/'fshapesimple'/g | sed -e s/'zed2_fshape'/'zefshape'/g > d2_${1}_temp2 ; \mv d2_${1}_temp2 d2_${1}_temp ;;
+esac
 
 # Cleanup
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate3
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate3	(revision 694)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate3	(revision 695)
@@ -1,5 +1,5 @@
-#script
-# execute: find * -exec generate_d3 {} \;
-# change number sed -e s/d3/d3/g generate_d3 > generated3
+# script
+# execute: find * -exec generate2 {} \;
+# change number sed -e s/d2/d3/g generate2 > generate3
 
 sed -e s/'[cC][aA][lL][lL] '/'call d3_'/g ${1} | sed -e s/'call d3_[aA][bB][oO][rR][tT]'/'call ABORT'/g | sed -e s/'call d3_[eE][xX][iI][tT]'/'call EXIT'/g | sed -e s/'firstcall d3_'/'firstcall '/g | sed -e s/'lastcall d3_'/'lastcall '/g | sed -e s/'[sS][uU][bB][rR][oO][uU][tT][iI][nN][eE] '/'subroutine d3_'/g | sed -e s/'callphys.def'/'callphysd3_.def '/g | sed -e s/'diagfi.nc'/'diagfid3_.nc'/g | sed -e s/'[iI][nN][cC][lL][uU][dD][eE] "'/'include "d3_'/g | sed -e s/"[iI][nN][cC][lL][uU][dD][eE] '"/"include 'd3_"/g | sed -e s+"[cC][oO][mM][mM][oO][nN]/"+"common/d3_"+g | sed -e s+"[cC][oO][mM][mM][oO][nN] /"+"common /d3_"+g | sed -e s+"d3_netcdf.inc"+"netcdf.inc"+g > d3_${1}_temp
@@ -7,14 +7,33 @@
 # Specifcic cases for newphys compilation:
 
+sed -e s/'[mM][oO][dD][uU][lL][eE] '/'MODULE d3_'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/'d3_[pP][rR][oO][cC][eE][dD][uU][rR][eE] '/'PROCEDURE '/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/'[iI][nN][tT][eE][rR][fF][aA][cC][eE] '/'INTERFACE d3_'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/'[eE][nN][dD] INTERFACE d3_'/'END INTERFACE '/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/'calltherm_INTERFACE d3_'/'calltherm_interface '/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
 sed -e s/'meso_inc_'/'d3_meso_inc_'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
 sed -e s+'d3_meso_inc/'+'meso_inc/'+g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/'[uU][sS][eE] ioipsl_getincom'/'USE d3_ioipsl_getincom'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
 sed -e s/'PUBLIC :: getin, getin_dump'/'PUBLIC :: d3_getin, d3_getin_dump'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
 sed -e s/' getinrs, getinr1d, getinr2d,'/' d3_getinrs, d3_getinr1d, d3_getinr2d,'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
 sed -e s/' getinis, getini1d, getini2d,'/' d3_getinis, d3_getini1d, d3_getini2d,'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
 sed -e s/' getincs, getinc1d, getinc2d,'/' d3_getincs, d3_getinc1d, d3_getinc2d,'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
-sed -e s/' getinls, getinl1d, getinl2d,'/' d3_getinls, d3_getinl1d, d3_getinl2d,'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/' getinls, getinl1d, getinl2d'/' d3_getinls, d3_getinl1d, d3_getinl2d'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
 sed -e s/'PUBLIC :: ipslnlf, ipslerr, ipslerr_act, ipslerr_inq, histerr, ipsldbg'/'PUBLIC :: d3_ipslnlf, d3_ipslerr, d3_ipslerr_act, d3_ipslerr_inq, d3_histerr, d3_ipsldbg'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/'USE ioipsl_errioipsl, ONLY : ipslerr'/'USE d3_ioipsl_errioipsl, ONLY : d3_ipslerr'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/'USE ioipsl_stringop'/'USE d3_ioipsl_stringop'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+sed -e s/'ONLY : nocomma,cmpblank,strlowercase'/'ONLY : d3_nocomma,d3_cmpblank,d3_strlowercase'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp
+
+# Functions
+
+case ${1} in 
+   'nlte_aux.F') sed -e s/'iaa_we'/'d3_iaa_we'/g d3_${1}_temp | sed -e s/'simrul'/'d3_simrul'/g | sed -e s/'iaa_f'/'d3_iaa_f'/g | sed -e s/'iaa_fi'/'d3_iaa_fi'/g | sed -e s/'voigtf'/'d3_voigtf'/g | sed -e s/'planckdp'/'d3_planckdp'/g | sed -e s/'bandid'/'d3_bandid'/g > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp ;;
+   'nlte_tcool.F') sed -e s/'planckdp'/'d3_planckdp'/g d3_${1}_temp | sed -e s/'hrkday_convert'/'d3_hrkday_convert'/g > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp ;;
+   'nlte_calc.F') sed -e s/'bandid'/'d3_bandid'/g d3_${1}_temp > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp ;;
+   'geticecover.F90') sed -e s/'isitice'/'d3_isitice'/g d3_${1}_temp | sed -e s/'splatcrocus'/'d3_splatcrocus'/g | sed -e s/'nplatcrocus'/'d3_nplatcrocus'/g > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp ;;
+   'nuclea.F')  sed -e s/'fshape'/'d3_fshape'/g d3_${1}_temp | sed -e s/'d3_fshapesimple'/'fshapesimple'/g | sed -e s/'zed3_fshape'/'zefshape'/g > d3_${1}_temp2 ; \mv d3_${1}_temp2 d3_${1}_temp ;;
+esac
 
 # Cleanup
 
-\mv d3_${1}_temp d3_${1} 
+\mv d3_${1}_temp d3_${1}
Index: /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate4
===================================================================
--- /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate4	(revision 694)
+++ /trunk/MESOSCALE/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/libf/generate4	(revision 695)
@@ -1,5 +1,5 @@
-#script
-# execute: find * -exec generate_d4 {} \;
-# change number sed -e s/d4/d4/g generate_d4 > generated4
+# script
+# execute: find * -exec generate2 {} \;
+# change number sed -e s/d2/d3/g generate2 > generate3
 
 sed -e s/'[cC][aA][lL][lL] '/'call d4_'/g ${1} | sed -e s/'call d4_[aA][bB][oO][rR][tT]'/'call ABORT'/g | sed -e s/'call d4_[eE][xX][iI][tT]'/'call EXIT'/g | sed -e s/'firstcall d4_'/'firstcall '/g | sed -e s/'lastcall d4_'/'lastcall '/g | sed -e s/'[sS][uU][bB][rR][oO][uU][tT][iI][nN][eE] '/'subroutine d4_'/g | sed -e s/'callphys.def'/'callphysd4_.def '/g | sed -e s/'diagfi.nc'/'diagfid4_.nc'/g | sed -e s/'[iI][nN][cC][lL][uU][dD][eE] "'/'include "d4_'/g | sed -e s/"[iI][nN][cC][lL][uU][dD][eE] '"/"include 'd4_"/g | sed -e s+"[cC][oO][mM][mM][oO][nN]/"+"common/d4_"+g | sed -e s+"[cC][oO][mM][mM][oO][nN] /"+"common /d4_"+g | sed -e s+"d4_netcdf.inc"+"netcdf.inc"+g > d4_${1}_temp
@@ -7,14 +7,33 @@
 # Specifcic cases for newphys compilation:
 
+sed -e s/'[mM][oO][dD][uU][lL][eE] '/'MODULE d4_'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/'d4_[pP][rR][oO][cC][eE][dD][uU][rR][eE] '/'PROCEDURE '/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/'[iI][nN][tT][eE][rR][fF][aA][cC][eE] '/'INTERFACE d4_'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/'[eE][nN][dD] INTERFACE d4_'/'END INTERFACE '/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/'calltherm_INTERFACE d4_'/'calltherm_interface '/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
 sed -e s/'meso_inc_'/'d4_meso_inc_'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
 sed -e s+'d4_meso_inc/'+'meso_inc/'+g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/'[uU][sS][eE] ioipsl_getincom'/'USE d4_ioipsl_getincom'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
 sed -e s/'PUBLIC :: getin, getin_dump'/'PUBLIC :: d4_getin, d4_getin_dump'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
 sed -e s/' getinrs, getinr1d, getinr2d,'/' d4_getinrs, d4_getinr1d, d4_getinr2d,'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
 sed -e s/' getinis, getini1d, getini2d,'/' d4_getinis, d4_getini1d, d4_getini2d,'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
 sed -e s/' getincs, getinc1d, getinc2d,'/' d4_getincs, d4_getinc1d, d4_getinc2d,'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
-sed -e s/' getinls, getinl1d, getinl2d,'/' d4_getinls, d4_getinl1d, d4_getinl2d,'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/' getinls, getinl1d, getinl2d'/' d4_getinls, d4_getinl1d, d4_getinl2d'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
 sed -e s/'PUBLIC :: ipslnlf, ipslerr, ipslerr_act, ipslerr_inq, histerr, ipsldbg'/'PUBLIC :: d4_ipslnlf, d4_ipslerr, d4_ipslerr_act, d4_ipslerr_inq, d4_histerr, d4_ipsldbg'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/'USE ioipsl_errioipsl, ONLY : ipslerr'/'USE d4_ioipsl_errioipsl, ONLY : d4_ipslerr'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/'USE ioipsl_stringop'/'USE d4_ioipsl_stringop'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+sed -e s/'ONLY : nocomma,cmpblank,strlowercase'/'ONLY : d4_nocomma,d4_cmpblank,d4_strlowercase'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp
+
+# Functions
+
+case ${1} in 
+   'nlte_aux.F') sed -e s/'iaa_we'/'d4_iaa_we'/g d4_${1}_temp | sed -e s/'simrul'/'d4_simrul'/g | sed -e s/'iaa_f'/'d4_iaa_f'/g | sed -e s/'iaa_fi'/'d4_iaa_fi'/g | sed -e s/'voigtf'/'d4_voigtf'/g | sed -e s/'planckdp'/'d4_planckdp'/g | sed -e s/'bandid'/'d4_bandid'/g > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp ;;
+   'nlte_tcool.F') sed -e s/'planckdp'/'d4_planckdp'/g d4_${1}_temp | sed -e s/'hrkday_convert'/'d4_hrkday_convert'/g > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp ;;
+   'nlte_calc.F') sed -e s/'bandid'/'d4_bandid'/g d4_${1}_temp > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp ;;
+   'geticecover.F90') sed -e s/'isitice'/'d4_isitice'/g d4_${1}_temp | sed -e s/'splatcrocus'/'d4_splatcrocus'/g | sed -e s/'nplatcrocus'/'d4_nplatcrocus'/g > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp ;;
+   'nuclea.F')  sed -e s/'fshape'/'d4_fshape'/g d4_${1}_temp | sed -e s/'d4_fshapesimple'/'fshapesimple'/g | sed -e s/'zed4_fshape'/'zefshape'/g > d4_${1}_temp2 ; \mv d4_${1}_temp2 d4_${1}_temp ;;
+esac
 
 # Cleanup
 
-\mv d4_${1}_temp d4_${1} 
+\mv d4_${1}_temp d4_${1}
