Index: /trunk/LMDZ.COMMON/libf/bibio/ioipsl_getincom_p.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/bibio/ioipsl_getincom_p.F90	(revision 1315)
+++ /trunk/LMDZ.COMMON/libf/bibio/ioipsl_getincom_p.F90	(revision 1315)
@@ -0,0 +1,170 @@
+!
+! $Id$
+!
+! Module/Routines extracted from IOIPSL v2_1_8
+!
+MODULE ioipsl_getincom_p
+!-
+!$Id: getincom.f90 536 2009-01-30 11:46:27Z bellier $
+!-
+! This software is governed by the CeCILL license
+! See IOIPSL/IOIPSL_License_CeCILL.txt
+!---------------------------------------------------------------------
+USE ioipsl_getincom ! to use  'getin'
+USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
+USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
+use mod_phys_lmdz_para, only : bcast
+!-
+IMPLICIT NONE
+!-
+PRIVATE
+PUBLIC :: getin_p
+!-
+INTERFACE getin_p
+
+  MODULE PROCEDURE getinrs_p, getinr1d_p, getinr2d_p, &
+ &                 getinis_p, getini1d_p, getini2d_p, &
+ &                 getincs_p, 		              &
+ &                 getinls_p, getinl1d_p, getinl2d_p
+END INTERFACE
+!-
+CONTAINS
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!   Definition des getin -> bcast      !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+!! -- Les chaines de caracteres -- !!
+  
+  SUBROUTINE getincs_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    CHARACTER(LEN=*),INTENT(INOUT) :: VarOut    
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getincs_p
+
+!! -- Les entiers -- !!
+  
+  SUBROUTINE getinis_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    INTEGER,INTENT(INOUT) :: VarOut    
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getinis_p
+
+  SUBROUTINE getini1d_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    INTEGER,INTENT(INOUT) :: VarOut(:)
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getini1d_p
+
+  SUBROUTINE getini2d_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    INTEGER,INTENT(INOUT) :: VarOut(:,:)
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getini2d_p
+
+!! -- Les flottants -- !!
+  
+  SUBROUTINE getinrs_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    REAL,INTENT(INOUT) :: VarOut
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getinrs_p
+
+  SUBROUTINE getinr1d_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    REAL,INTENT(INOUT) :: VarOut(:)
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getinr1d_p
+
+  SUBROUTINE getinr2d_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    REAL,INTENT(INOUT) :: VarOut(:,:)
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getinr2d_p
+
+!! -- Les Booleens -- !!
+  
+  SUBROUTINE getinls_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    LOGICAL,INTENT(INOUT) :: VarOut
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getinls_p
+
+  SUBROUTINE getinl1d_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    LOGICAL,INTENT(INOUT) :: VarOut(:)
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getinl1d_p
+
+  SUBROUTINE getinl2d_p(VarIn,VarOut)
+    IMPLICIT NONE    
+    CHARACTER(LEN=*),INTENT(IN) :: VarIn
+    LOGICAL,INTENT(INOUT) :: VarOut(:,:)
+
+!$OMP BARRIER
+    IF (is_mpi_root .AND. is_omp_root) THEN
+    	CALL getin(VarIn,VarOut)
+    ENDIF
+    CALL bcast(VarOut)
+  END SUBROUTINE getinl2d_p
+!-
+!-----------------------------
+!-----------------------------
+!-----------------------------
+
+END MODULE ioipsl_getincom_p
Index: /trunk/LMDZ.COMMON/libf/dyn3d_common/cpdet_mod.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/dyn3d_common/cpdet_mod.F90	(revision 1314)
+++ /trunk/LMDZ.COMMON/libf/dyn3d_common/cpdet_mod.F90	(revision 1315)
@@ -142,4 +142,5 @@
 ! Parallel version of t2tpot, for an arbitrary number of columns
       USE control_mod, only : planet_type
+      USE parallel_lmdz, only : OMP_CHUNK
       IMPLICIT none
 
@@ -179,5 +180,5 @@
 ! Parallel version of t2tpot, over the full dynamics (scalar) grid
 ! (more efficient than multiple calls to t2tpot_p() with slices of data)
-      USE parallel_lmdz, only : jj_begin,jj_end
+      USE parallel_lmdz, only : jj_begin,jj_end,OMP_CHUNK
       USE control_mod, only : planet_type
       IMPLICIT none
@@ -223,4 +224,5 @@
 ! Parallel version of tpot2t, for an arbitrary number of columns
       USE control_mod, only : planet_type
+      USE parallel_lmdz, only : OMP_CHUNK
       IMPLICIT none
 ! for cpp, nu_venus and t0_venus:
@@ -259,5 +261,5 @@
 ! Parallel version of tpot2t, over the full dynamics (scalar) grid
 ! (more efficient than multiple calls to tpot2t_p() with slices of data)
-      USE parallel_lmdz, only : jj_begin,jj_end
+      USE parallel_lmdz, only : jj_begin,jj_end,OMP_CHUNK
       USE control_mod, only : planet_type
       IMPLICIT none
Index: /trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F
===================================================================
--- /trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F	(revision 1314)
+++ /trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F	(revision 1315)
@@ -599,5 +599,8 @@
 c       write(78,*) 'q',q
 
-c$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/,/logici/,/logicl/)
+!c$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/,/logici/,/logicl/)
+!variable temps no longer exists
+c$OMP PARALLEL DEFAULT(SHARED)
+c$OMP1 COPYIN(/temps_r/,/temps_i/,/temps_c/,/logici/,/logicl/)
       CALL leapfrog_p(ucov,vcov,teta,ps,masse,phis,q,
      .              time_0)
Index: /trunk/LMDZ.COMMON/libf/dyn3dpar/sponge_mod_p.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/dyn3dpar/sponge_mod_p.F90	(revision 1314)
+++ /trunk/LMDZ.COMMON/libf/dyn3dpar/sponge_mod_p.F90	(revision 1315)
@@ -31,5 +31,5 @@
 
       USE Write_Field_p
-      use parallel_lmdz, only: pole_sud,pole_nord,jj_begin,jj_end
+      use parallel_lmdz, only: pole_sud,pole_nord,jj_begin,jj_end,OMP_CHUNK
       implicit none
 #include "dimensions.h"
Index: /trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90	(revision 1315)
@@ -67,4 +67,5 @@
 
       LOGICAL,SAVE :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
       REAL CBRT
       EXTERNAL CBRT
@@ -72,4 +73,5 @@
       INTEGER,SAVE :: i_co2ice=0      ! co2 ice
       INTEGER,SAVE :: i_h2oice=0      ! water ice
+!$OMP THREADPRIVATE(i_co2ice,i_h2oice)
       CHARACTER(LEN=20) :: tracername ! to temporarily store text
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/aeroptproperties.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/aeroptproperties.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/aeroptproperties.F90	(revision 1315)
@@ -67,4 +67,5 @@
 !     Pi!
       REAL,SAVE :: pi
+!$OMP THREADPRIVATE(pi)
 !     Variables used by the Gauss-Legendre integration:
       INTEGER radius_id,gausind
@@ -87,4 +88,5 @@
                       0.08327674160932,0.06267204829828, &
                       0.04060142982019,0.01761400714091/
+!$OMP THREADPRIVATE(radgaus,weightgaus)
 !     Indices
       INTEGER :: i,j,k,l,m,iaer,idomain
@@ -102,4 +104,5 @@
 !     Grid used to remember which calculation is done
       LOGICAL,SAVE :: checkgrid(refftabsize,nuefftabsize,naerkind,2) = .false.
+!$OMP THREADPRIVATE(refftab,nuefftab,logvratgrid,vratgrid,checkgrid)
 !     Optical properties of the grid (VISIBLE)
       REAL,SAVE :: qsqrefVISgrid(refftabsize,nuefftabsize,L_NSPECTV,naerkind)
@@ -108,4 +111,5 @@
       REAL,SAVE :: omegVISgrid(refftabsize,nuefftabsize,L_NSPECTV,naerkind)
       REAL,SAVE :: gVISgrid(refftabsize,nuefftabsize,L_NSPECTV,naerkind)
+!$OMP THREADPRIVATE(qsqrefVISgrid,qextVISgrid,qscatVISgrid,omegVISgrid,gVISgrid)
 !     Optical properties of the grid (INFRARED)
       REAL,SAVE :: qsqrefIRgrid(refftabsize,nuefftabsize,L_NSPECTI,naerkind)
@@ -114,4 +118,5 @@
       REAL,SAVE :: omegIRgrid(refftabsize,nuefftabsize,L_NSPECTI,naerkind)
       REAL,SAVE :: gIRgrid(refftabsize,nuefftabsize,L_NSPECTI,naerkind)
+!$OMP THREADPRIVATE(qsqrefIRgrid,qextIRgrid,qscatIRgrid,omegIRgrid,gIRgrid)
 !     Optical properties of the grid (REFERENCE WAVELENGTHS)
       REAL,SAVE :: qrefVISgrid(refftabsize,nuefftabsize,naerkind)
@@ -121,13 +126,18 @@
       REAL,SAVE :: omegrefVISgrid(refftabsize,nuefftabsize,naerkind)
       REAL,SAVE :: omegrefIRgrid(refftabsize,nuefftabsize,naerkind)
+!$OMP THREADPRIVATE(qrefVISgrid,qscatrefVISgrid,qrefIRgrid,qscatrefIRgrid,omegrefVISgrid,&
+	!$OMP omegrefIRgrid)
 !     Firstcall
       LOGICAL,SAVE :: firstcall = .true.
+!$OMP THREADPRIVATE(firstcall)
 !     Variables used by the Gauss-Legendre integration:
       REAL,SAVE :: normd(refftabsize,nuefftabsize,naerkind,2)
       REAL,SAVE :: dista(refftabsize,nuefftabsize,naerkind,2,ngau)
       REAL,SAVE :: distb(refftabsize,nuefftabsize,naerkind,2,ngau)
+!$OMP THREADPRIVATE(normd,dista,distb)
 
       REAL,SAVE :: radGAUSa(ngau,naerkind,2)
       REAL,SAVE :: radGAUSb(ngau,naerkind,2)
+!$OMP THREADPRIVATE(radGAUSa,radGAUSb)
 
       REAL,SAVE :: qsqrefVISa(L_NSPECTV,ngau,naerkind)
@@ -141,4 +151,6 @@
       REAL,SAVE :: gVISa(L_NSPECTV,ngau,naerkind)
       REAL,SAVE :: gVISb(L_NSPECTV,ngau,naerkind)
+!$OMP THREADPRIVATE(qsqrefVISa,qrefVISa,qsqrefVISb,qrefVISb,omegVISa, &
+	!$OMP omegrefVISa,omegVISb,omegrefVISb,gVISa,gVISb)
 
       REAL,SAVE :: qsqrefIRa(L_NSPECTI,ngau,naerkind)
@@ -152,4 +164,6 @@
       REAL,SAVE :: gIRa(L_NSPECTI,ngau,naerkind)
       REAL,SAVE :: gIRb(L_NSPECTI,ngau,naerkind)
+!$OMP THREADPRIVATE(qsqrefIRa,qrefIRa,qsqrefIRb,qrefIRb,omegIRa,omegrefIRa,&
+	!$OMP omegIRb,omegrefIRb,gIRa,gIRb)
 
       REAL :: radiusm
Index: /trunk/LMDZ.GENERIC/libf/phystd/aerosol_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/aerosol_mod.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/aerosol_mod.F90	(revision 1315)
@@ -16,4 +16,5 @@
 ! two-layer simple aerosol model
       integer :: iaero_back2lay = 0
+!$OMP THREADPRIVATE(iaero_co2,iaero_h2o,iaero_dust,iaero_h2so4,noaero,iaero_back2lay)
       
 !==================================================================
Index: /trunk/LMDZ.GENERIC/libf/phystd/ave_stelspec.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/ave_stelspec.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/ave_stelspec.F90	(revision 1315)
@@ -38,5 +38,5 @@
       integer ifine
 
-      real,allocatable :: lam(:),stel_f(:)
+      real,allocatable,save :: lam(:),stel_f(:) 	!read by master
       real band,lamm,lamp
       real dl
@@ -116,4 +116,5 @@
          End Select
 
+!$OMP MASTER
 	 allocate(lam(Nfine),stel_f(Nfine))
 
@@ -153,4 +154,6 @@
            close(111)
          endif
+!$OMP END MASTER
+!$OMP BARRIER
 	 
          ! sum data by band
@@ -173,6 +176,10 @@
 	 
          STELLAR(1:L_NSPECTV)=STELLAR(1:L_NSPECTV)/sum(STELLAR(1:L_NSPECTV))
-         deallocate(lam,stel_f)
-         
+!$OMP BARRIER
+!$OMP MASTER
+	 if (allocated(lam)) deallocate(lam)
+	 if (allocated(stel_f)) deallocate(stel_f)
+!$OMP END MASTER
+!$OMP BARRIER         
       endif
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/bilinearbig.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/bilinearbig.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/bilinearbig.F90	(revision 1315)
@@ -14,4 +14,5 @@
       real*8 f2d_arr(nX,nY)
       real*8,save :: x,y
+!$OMP THREADPRIVATE(x,y)
 
       integer strlen
Index: /trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90	(revision 1315)
@@ -12,5 +12,6 @@
       use watercommon_h
       use datafile_mod, only: datadir
-      use ioipsl_getincom 
+!      use ioipsl_getincom 
+      use ioipsl_getincom_p
       use gases_h
       use radii_mod, only : su_aer_radii,co2_reffrad,h2o_reffrad,dust_reffrad,h2so4_reffrad,back2lay_reffrad
@@ -92,4 +93,5 @@
       REAL,ALLOCATABLE,SAVE :: reffrad(:,:,:) ! aerosol effective radius (m)
       REAL,ALLOCATABLE,SAVE :: nueffrad(:,:,:) ! aerosol effective variance
+!$OMP THREADPRIVATE(reffrad,nueffrad)
 
 !-----------------------------------------------------------------------
@@ -128,4 +130,5 @@
       logical global1d
       save szangle,global1d
+!$OMP THREADPRIVATE(szangle,global1d)
       real*8 taugsurf(L_NSPECTV,L_NGAUSS-1)
       real*8 taugsurfi(L_NSPECTI,L_NGAUSS-1)
@@ -146,4 +149,5 @@
       real, dimension(:,:,:), save, allocatable :: QREFvis3d
       real, dimension(:,:,:), save, allocatable :: QREFir3d
+!$OMP THREADPRIVATE(QXVAER,QSVAER,GVAER,QXIAER,QSIAER,GIAER,QREFvis3d,QREFir3d)
 
 
@@ -214,5 +218,5 @@
 !     set up correlated k
          print*, "callcorrk: Correlated-k data base folder:",trim(datadir)
-         call getin("corrkdir",corrkdir)
+         call getin_p("corrkdir",corrkdir)
          print*, "corrkdir = ",corrkdir
          write( tmp1, '(i3)' ) L_NSPECTI
@@ -238,5 +242,5 @@
            PRINT*, 'Simulate global averaged conditions ?'
            global1d = .false. ! default value
-           call getin("global1d",global1d)
+           call getin_p("global1d",global1d)
            write(*,*) "global1d = ",global1d
            ! Test of incompatibility:
@@ -251,5 +255,5 @@
              PRINT *,'(assumed for averaged solar flux S/4)'
              szangle=60.0  ! default value
-             call getin("szangle",szangle)
+             call getin_p("szangle",szangle)
              write(*,*) "szangle = ",szangle
            endif
@@ -866,8 +870,12 @@
         IF( ALLOCATED( gasi ) ) DEALLOCATE( gasi )
         IF( ALLOCATED( gasv ) ) DEALLOCATE( gasv )
+!$OMP BARRIER
+!$OMP MASTER
         IF( ALLOCATED( pgasref ) ) DEALLOCATE( pgasref )
         IF( ALLOCATED( tgasref ) ) DEALLOCATE( tgasref )
         IF( ALLOCATED( wrefvar ) ) DEALLOCATE( wrefvar )
         IF( ALLOCATED( pfgasref ) ) DEALLOCATE( pfgasref )
+!$OMP END MASTER
+!$OMP BARRIER	
         IF ( ALLOCATED(reffrad)) DEALLOCATE(reffrad)
         IF ( ALLOCATED(nueffrad)) DEALLOCATE(nueffrad)
Index: /trunk/LMDZ.GENERIC/libf/phystd/callkeys.h
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/callkeys.h	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/callkeys.h	(revision 1315)
@@ -117,2 +117,4 @@
       real J2
       real MassPlanet
+      
+      logical :: iscallphys=.false.!existence of callphys.def
Index: /trunk/LMDZ.GENERIC/libf/phystd/callsedim.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/callsedim.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/callsedim.F	(revision 1315)
@@ -69,4 +69,5 @@
 
       LOGICAL,SAVE :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
 
 c    ** un petit test de coherence
Index: /trunk/LMDZ.GENERIC/libf/phystd/comdiurn_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/comdiurn_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/comdiurn_h.F90	(revision 1315)
@@ -6,4 +6,5 @@
        real, allocatable, dimension(:) :: sinlon, coslon, sinlat, coslat
        logical :: ldiurn
+!$OMP THREADPRIVATE(sinlon,coslon,sinlat,coslat,ldiurn) !ldiurn is unused
 
        end module comdiurn_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/comgeomfi_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/comgeomfi_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/comgeomfi_h.F90	(revision 1315)
@@ -6,4 +6,5 @@
        REAL,ALLOCATABLE,DIMENSION(:) :: long,lati,area
        REAL :: totarea, totarea_planet
+!$OMP THREADPRIVATE(long,lati,area,totarea)
 
        end module comgeomfi_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/comsaison_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/comsaison_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/comsaison_h.F90	(revision 1315)
@@ -9,4 +9,5 @@
 
        real, allocatable, dimension(:) :: mu0,fract
+!$OMP THREADPRIVATE(isaison,callsais,dist_star,declin,mu0,fract)
 
        end module comsaison_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/comsoil_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/comsoil_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/comsoil_h.F90	(revision 1315)
@@ -14,4 +14,5 @@
        !     in physdem (or set via tabfi, or initialized in
        !                 soil_settings.F)
+!$OMP THREADPRIVATE(layer,mlayer,inertiedat,volcapa)
 
 contains
Index: /trunk/LMDZ.GENERIC/libf/phystd/condense_cloud.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/condense_cloud.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/condense_cloud.F90	(revision 1315)
@@ -133,6 +133,8 @@
       REAL,SAVE :: cpice=1000.
       REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: emisref
+!$OMP THREADPRIVATE(latcond,ccond,cpice,emisref)
 
       LOGICAL,SAVE :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
       REAL,EXTERNAL :: SSUM
 
@@ -140,4 +142,5 @@
 
       INTEGER,SAVE :: i_co2ice=0      ! co2 ice
+!$OMP THREADPRIVATE(i_co2ice)
       CHARACTER(LEN=20) :: tracername ! to temporarily store text
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/convadj.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/convadj.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/convadj.F	(revision 1315)
@@ -67,8 +67,10 @@
       INTEGER iq,ico2
       save ico2
+!$OMP THREADPRIVATE(ico2)
       REAL zq(ngrid,nlay,nq), zq2(ngrid,nlay,nq)
       REAL zqm(nq),zqco2m
       real m_co2, m_noco2, A , B
       save A, B
+!$OMP THREADPRIVATE(A,B)
 
       real mtot1, mtot2 , mm1, mm2
@@ -77,4 +79,5 @@
       save firstcall
       data firstcall/.true./
+!$OMP THREADPRIVATE(firstcall)
 
 !     for conservation test
Index: /trunk/LMDZ.GENERIC/libf/phystd/dimphy.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/dimphy.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/dimphy.F90	(revision 1315)
@@ -2,7 +2,7 @@
   
   INTEGER,SAVE :: klon   ! number of atmospheric columns (for this OpenMP subgrid)
-  INTEGER,SAVE :: klev   ! number of atmospheric layers
-  INTEGER,SAVE :: klevp1 ! number of atmospheric layers+1
-  INTEGER,SAVE :: klevm1 ! number of atmospheric layers-1
+  INTEGER,SAVE :: klev   ! number of atmospheric layers, read by master
+  INTEGER,SAVE :: klevp1 ! number of atmospheric layers+1, read by master
+  INTEGER,SAVE :: klevm1 ! number of atmospheric layers-1, read by master
 !  INTEGER,SAVE :: kflev
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/gases_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/gases_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/gases_h.F90	(revision 1315)
@@ -14,5 +14,5 @@
       integer :: ngasmx
       integer :: vgas
-      character*20,allocatable,DIMENSION(:) :: gnom ! name of the gas
+      character*20,allocatable,DIMENSION(:) :: gnom ! name of the gas, read by master
       real,allocatable,DIMENSION(:) :: gfrac
 
@@ -31,4 +31,7 @@
       integer :: igas_C2H2
       integer :: igas_C2H6
+!!$OMP THREADPRIVATE(ngasmx,vgas,gnom,gfrac,&
+!	!$OMP igas_H2,igas_He,igas_H2O,igas_CO2,igas_CO,igas_N2,&
+!	!$OMP igas_O2,igas_SO2,igas_H2S,igas_CH4,igas_NH3,igas_C2H2,igas_C2H6)
 
       end module gases_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90	(revision 1315)
@@ -4,5 +4,6 @@
      pctsrf_sic,sea_ice)
 
-  use ioipsl_getincom 
+!  use ioipsl_getincom 
+  use ioipsl_getincom_p
   use watercommon_h, only: T_h2O_ice_liq, RLFTT, rhowater, mx_eau_sol
   USE surfdat_h
@@ -50,4 +51,5 @@
       real albedoice
       save albedoice
+!$OMP THREADPRIVATE(albedoice)
 
       real snowlayer
@@ -59,4 +61,5 @@
       logical,save :: activerunoff ! enable simple runoff scheme?
       logical,save :: oceanalbvary ! ocean albedo varies with the diurnal cycle?
+!$OMP THREADPRIVATE(oceanbulkavg,activerunoff,oceanalbvary)
 
 !     Arguments
@@ -66,4 +69,5 @@
       real totalrunoff, tsea, oceanarea
       save oceanarea
+!$OMP THREADPRIVATE(runoff,oceanarea)
 
       real ptimestep
@@ -96,6 +100,8 @@
 
       integer, save :: ivap, iliq, iice
+!$OMP THREADPRIVATE(ivap,iliq,iice)
 
       logical, save :: firstcall
+!$OMP THREADPRIVATE(firstcall)
 
       data firstcall /.true./
@@ -108,5 +114,5 @@
          write(*,*)"Activate runnoff into oceans?"
          activerunoff=.false.
-         call getin("activerunoff",activerunoff)
+         call getin_p("activerunoff",activerunoff)
          write(*,*)" activerunoff = ",activerunoff
 	 
Index: /trunk/LMDZ.GENERIC/libf/phystd/inifis.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/inifis.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/inifis.F	(revision 1315)
@@ -50,5 +50,6 @@
       use datafile_mod, only: datadir
 ! to use  'getin'
-      USE ioipsl_getincom 
+!      USE ioipsl_getincom 
+      USE ioipsl_getincom_p
       IMPLICIT NONE
 !#include "dimensions.h"
@@ -79,4 +80,5 @@
       real psurf,pN2 ! added by RW for Gliese 581d N2+CO2
 
+!$OMP MASTER
       rad=prad
       daysec=pdaysec
@@ -89,8 +91,10 @@
       avocado = 6.02214179e23   ! added by RW
 
+!$OMP END MASTER
+!$OMP BARRIER
 
       ! read in 'ecritphy' (frequency of calls to physics, in dynamical steps)
       ! (also done in dyn3d/defrun_new but not in LMDZ.COMMON)
-      call getin("ecritphy",ecritphy)
+      call getin_p("ecritphy",ecritphy)
 
 ! --------------------------------------------------------------
@@ -98,10 +102,15 @@
 ! --------------------------------------------------------------
      
+!$OMP MASTER     
       ! check that 'callphys.def' file is around
       OPEN(99,file='callphys.def',status='old',form='formatted'
      &     ,iostat=ierr)
       CLOSE(99)
+      IF(ierr.EQ.0) iscallphys=.true. !iscallphys initialised as false in callkeys.h
+!$OMP END MASTER
+!$OMP BARRIER
       
-      IF(ierr.EQ.0) THEN
+!!!      IF(ierr.EQ.0) THEN
+      IF(iscallphys) THEN
          PRINT*
          PRINT*
@@ -112,10 +121,10 @@
          write(*,*) "Directory where external input files are:"
          ! default 'datadir' is set in "datadir_mod"
-         call getin("datadir",datadir) ! default path
+         call getin_p("datadir",datadir) ! default path
          write(*,*) " datadir = ",trim(datadir)
 
          write(*,*) "Run with or without tracer transport ?"
          tracer=.false. ! default value
-         call getin("tracer",tracer)
+         call getin_p("tracer",tracer)
          write(*,*) " tracer = ",tracer
 
@@ -123,5 +132,5 @@
      &      " due to tracer evaporation/condensation?"
          mass_redistrib=.false. ! default value
-         call getin("mass_redistrib",mass_redistrib)
+         call getin_p("mass_redistrib",mass_redistrib)
          write(*,*) " mass_redistrib = ",mass_redistrib
 
@@ -129,5 +138,5 @@
          write(*,*) "(if diurnal=false, diurnal averaged solar heating)"
          diurnal=.true. ! default value
-         call getin("diurnal",diurnal)
+         call getin_p("diurnal",diurnal)
          write(*,*) " diurnal = ",diurnal
 
@@ -136,25 +145,25 @@
      &   "set in 'start'"
          season=.true. ! default value
-         call getin("season",season)
+         call getin_p("season",season)
          write(*,*) " season = ",season
 
          write(*,*) "Tidally resonant rotation ?"
          tlocked=.false. ! default value
-         call getin("tlocked",tlocked)
+         call getin_p("tlocked",tlocked)
          write(*,*) "tlocked = ",tlocked
 
          write(*,*) "Saturn ring shadowing ?"
          rings_shadow = .false.
-         call getin("rings_shadow", rings_shadow)
+         call getin_p("rings_shadow", rings_shadow)
          write(*,*) "rings_shadow = ", rings_shadow
          
          write(*,*) "Compute latitude-dependent gravity field?"
          oblate = .false.
-         call getin("oblate", oblate)
+         call getin_p("oblate", oblate)
          write(*,*) "oblate = ", oblate
 
          write(*,*) "Flattening of the planet (a-b)/a "
          flatten = 0.0
-         call getin("flatten", flatten)
+         call getin_p("flatten", flatten)
          write(*,*) "flatten = ", flatten
          
@@ -162,15 +171,15 @@
          write(*,*) "Needed if oblate=.true.: J2"
          J2 = 0.0
-         call getin("J2", J2)
+         call getin_p("J2", J2)
          write(*,*) "J2 = ", J2
          
          write(*,*) "Needed if oblate=.true.: Planet mass (*1e24 kg)"
          MassPlanet = 0.0
-         call getin("MassPlanet", MassPlanet)
+         call getin_p("MassPlanet", MassPlanet)
          write(*,*) "MassPlanet = ", MassPlanet         
 
          write(*,*) "Needed if oblate=.true.: Planet mean radius (m)"
          Rmean = 0.0
-         call getin("Rmean", Rmean)
+         call getin_p("Rmean", Rmean)
          write(*,*) "Rmean = ", Rmean
          
@@ -184,40 +193,40 @@
          write(*,*) "Tidal resonance ratio ?"
          nres=0          ! default value
-         call getin("nres",nres)
+         call getin_p("nres",nres)
          write(*,*) "nres = ",nres
 
          write(*,*) "Write some extra output to the screen ?"
          lwrite=.false. ! default value
-         call getin("lwrite",lwrite)
+         call getin_p("lwrite",lwrite)
          write(*,*) " lwrite = ",lwrite
 
          write(*,*) "Save statistics in file stats.nc ?"
          callstats=.true. ! default value
-         call getin("callstats",callstats)
+         call getin_p("callstats",callstats)
          write(*,*) " callstats = ",callstats
 
          write(*,*) "Test energy conservation of model physics ?"
          enertest=.false. ! default value
-         call getin("enertest",enertest)
+         call getin_p("enertest",enertest)
          write(*,*) " enertest = ",enertest
 
          write(*,*) "Check to see if cpp values used match gases.def ?"
          check_cpp_match=.true. ! default value
-         call getin("check_cpp_match",check_cpp_match)
+         call getin_p("check_cpp_match",check_cpp_match)
          write(*,*) " check_cpp_match = ",check_cpp_match
 
          write(*,*) "call radiative transfer ?"
          callrad=.true. ! default value
-         call getin("callrad",callrad)
+         call getin_p("callrad",callrad)
          write(*,*) " callrad = ",callrad
 
          write(*,*) "call correlated-k radiative transfer ?"
          corrk=.true. ! default value
-         call getin("corrk",corrk)
+         call getin_p("corrk",corrk)
          write(*,*) " corrk = ",corrk
 
          write(*,*) "prohibit calculations outside corrk T grid?"
          strictboundcorrk=.true. ! default value
-         call getin("strictboundcorrk",strictboundcorrk)
+         call getin_p("strictboundcorrk",strictboundcorrk)
          write(*,*) "strictboundcorrk = ",strictboundcorrk
 
@@ -225,5 +234,5 @@
      &              "(matters only if callrad=T)"
          callgasvis=.false. ! default value
-         call getin("callgasvis",callgasvis)
+         call getin_p("callgasvis",callgasvis)
          write(*,*) " callgasvis = ",callgasvis
         
@@ -231,30 +240,30 @@
      &              "(matters only if callrad=T)"
          continuum=.true. ! default value
-         call getin("continuum",continuum)
+         call getin_p("continuum",continuum)
          write(*,*) " continuum = ",continuum
 
          write(*,*) "use analytic function for H2O continuum ?"
          H2Ocont_simple=.false. ! default value
-         call getin("H2Ocont_simple",H2Ocont_simple)
+         call getin_p("H2Ocont_simple",H2Ocont_simple)
          write(*,*) " H2Ocont_simple = ",H2Ocont_simple
  
          write(*,*) "call turbulent vertical diffusion ?"
          calldifv=.true. ! default value
-         call getin("calldifv",calldifv)
+         call getin_p("calldifv",calldifv)
          write(*,*) " calldifv = ",calldifv
 
          write(*,*) "use turbdiff instead of vdifc ?"
          UseTurbDiff=.true. ! default value
-         call getin("UseTurbDiff",UseTurbDiff)
+         call getin_p("UseTurbDiff",UseTurbDiff)
          write(*,*) " UseTurbDiff = ",UseTurbDiff
 
          write(*,*) "call convective adjustment ?"
          calladj=.true. ! default value
-         call getin("calladj",calladj)
+         call getin_p("calladj",calladj)
          write(*,*) " calladj = ",calladj
 
          write(*,*) "call CO2 condensation ?"
          co2cond=.false. ! default value
-         call getin("co2cond",co2cond)
+         call getin_p("co2cond",co2cond)
          write(*,*) " co2cond = ",co2cond
 ! Test of incompatibility
@@ -266,10 +275,10 @@
          write(*,*) "CO2 supersaturation level ?"
          co2supsat=1.0 ! default value
-         call getin("co2supsat",co2supsat)
+         call getin_p("co2supsat",co2supsat)
          write(*,*) " co2supsat = ",co2supsat
 
          write(*,*) "Radiative timescale for Newtonian cooling ?"
          tau_relax=30. ! default value
-         call getin("tau_relax",tau_relax)
+         call getin_p("tau_relax",tau_relax)
          write(*,*) " tau_relax = ",tau_relax
          tau_relax=tau_relax*24*3600 ! convert Earth days --> seconds
@@ -277,5 +286,5 @@
          write(*,*)"call thermal conduction in the soil ?"
          callsoil=.true. ! default value
-         call getin("callsoil",callsoil)
+         call getin_p("callsoil",callsoil)
          write(*,*) " callsoil = ",callsoil
          
@@ -283,40 +292,40 @@
      &             " physical timestep"
          iradia=1 ! default value
-         call getin("iradia",iradia)
+         call getin_p("iradia",iradia)
          write(*,*)" iradia = ",iradia
        
          write(*,*)"Rayleigh scattering ?"
          rayleigh=.false.
-         call getin("rayleigh",rayleigh)
+         call getin_p("rayleigh",rayleigh)
          write(*,*)" rayleigh = ",rayleigh
 
          write(*,*) "Use blackbody for stellar spectrum ?"
          stelbbody=.false. ! default value
-         call getin("stelbbody",stelbbody)
+         call getin_p("stelbbody",stelbbody)
          write(*,*) " stelbbody = ",stelbbody
 
          write(*,*) "Stellar blackbody temperature ?"
          stelTbb=5800.0 ! default value
-         call getin("stelTbb",stelTbb)
+         call getin_p("stelTbb",stelTbb)
          write(*,*) " stelTbb = ",stelTbb
 
          write(*,*)"Output mean OLR in 1D?"
          meanOLR=.false.
-         call getin("meanOLR",meanOLR)
+         call getin_p("meanOLR",meanOLR)
          write(*,*)" meanOLR = ",meanOLR
 
          write(*,*)"Output spectral OLR in 3D?"
          specOLR=.false.
-         call getin("specOLR",specOLR)
+         call getin_p("specOLR",specOLR)
          write(*,*)" specOLR = ",specOLR
 
          write(*,*)"Operate in kastprof mode?"
          kastprof=.false.
-         call getin("kastprof",kastprof)
+         call getin_p("kastprof",kastprof)
          write(*,*)" kastprof = ",kastprof
 
          write(*,*)"Uniform absorption in radiative transfer?"
          graybody=.false.
-         call getin("graybody",graybody)
+         call getin_p("graybody",graybody)
          write(*,*)" graybody = ",graybody
 
@@ -324,15 +333,15 @@
          write(*,*) "Use slab-ocean ?"
          ok_slab_ocean=.false.         ! default value
-         call getin("ok_slab_ocean",ok_slab_ocean)
+         call getin_p("ok_slab_ocean",ok_slab_ocean)
          write(*,*) "ok_slab_ocean = ",ok_slab_ocean
 
          write(*,*) "Use slab-sea-ice ?"
          ok_slab_sic=.true.         ! default value
-         call getin("ok_slab_sic",ok_slab_sic)
+         call getin_p("ok_slab_sic",ok_slab_sic)
          write(*,*) "ok_slab_sic = ",ok_slab_sic
 
          write(*,*) "Use heat transport for the ocean ?"
          ok_slab_heat_transp=.true.   ! default value
-         call getin("ok_slab_heat_transp",ok_slab_heat_transp)
+         call getin_p("ok_slab_heat_transp",ok_slab_heat_transp)
          write(*,*) "ok_slab_heat_transp = ",ok_slab_heat_transp
 
@@ -348,10 +357,10 @@
          write(*,*)"Stratospheric temperature for kastprof mode?"
          Tstrat=167.0
-         call getin("Tstrat",Tstrat)
+         call getin_p("Tstrat",Tstrat)
          write(*,*)" Tstrat = ",Tstrat
 
          write(*,*)"Remove lower boundary?"
          nosurf=.false.
-         call getin("nosurf",nosurf)
+         call getin_p("nosurf",nosurf)
          write(*,*)" nosurf = ",nosurf
 
@@ -366,10 +375,10 @@
      .             "... matters only if callsoil=F"
          intheat=0.
-         call getin("intheat",intheat)
+         call getin_p("intheat",intheat)
          write(*,*)" intheat = ",intheat
 
          write(*,*)"Use Newtonian cooling for radiative transfer?"
          newtonian=.false.
-         call getin("newtonian",newtonian)
+         call getin_p("newtonian",newtonian)
          write(*,*)" newtonian = ",newtonian
 
@@ -390,5 +399,5 @@
          write(*,*)"Test physics timescale in 1D?"
          testradtimes=.false.
-         call getin("testradtimes",testradtimes)
+         call getin_p("testradtimes",testradtimes)
          write(*,*)" testradtimes = ",testradtimes
 
@@ -402,15 +411,15 @@
          write(*,*)"Default planetary temperature?"
          tplanet=215.0
-         call getin("tplanet",tplanet)
+         call getin_p("tplanet",tplanet)
          write(*,*)" tplanet = ",tplanet
 
          write(*,*)"Which star?"
          startype=1 ! default value = Sol
-         call getin("startype",startype)
+         call getin_p("startype",startype)
          write(*,*)" startype = ",startype
 
          write(*,*)"Value of stellar flux at 1 AU?"
          Fat1AU=1356.0 ! default value = Sol today
-         call getin("Fat1AU",Fat1AU)
+         call getin_p("Fat1AU",Fat1AU)
          write(*,*)" Fat1AU = ",Fat1AU
 
@@ -420,15 +429,15 @@
          write(*,*)"Varying H2O cloud fraction?"
          CLFvarying=.false.     ! default value
-         call getin("CLFvarying",CLFvarying)
+         call getin_p("CLFvarying",CLFvarying)
          write(*,*)" CLFvarying = ",CLFvarying
 
          write(*,*)"Value of fixed H2O cloud fraction?"
          CLFfixval=1.0                ! default value
-         call getin("CLFfixval",CLFfixval)
+         call getin_p("CLFfixval",CLFfixval)
          write(*,*)" CLFfixval = ",CLFfixval
 
          write(*,*)"fixed radii for Cloud particles?"
          radfixed=.false. ! default value
-         call getin("radfixed",radfixed)
+         call getin_p("radfixed",radfixed)
          write(*,*)" radfixed = ",radfixed
 
@@ -439,40 +448,40 @@
 	 write(*,*)"Number mixing ratio of CO2 ice particles:"
          Nmix_co2=1.e6 ! default value
-         call getin("Nmix_co2",Nmix_co2)
+         call getin_p("Nmix_co2",Nmix_co2)
          write(*,*)" Nmix_co2 = ",Nmix_co2
 
 !         write(*,*)"Number of radiatively active aerosols:"
 !         naerkind=0. ! default value
-!         call getin("naerkind",naerkind)
+!         call getin_p("naerkind",naerkind)
 !         write(*,*)" naerkind = ",naerkind
 
          write(*,*)"Opacity of dust (if used):"
          dusttau=0. ! default value
-         call getin("dusttau",dusttau)
+         call getin_p("dusttau",dusttau)
          write(*,*)" dusttau = ",dusttau
 
          write(*,*)"Radiatively active CO2 aerosols?"
          aeroco2=.false.     ! default value
-         call getin("aeroco2",aeroco2)
+         call getin_p("aeroco2",aeroco2)
          write(*,*)" aeroco2 = ",aeroco2
 
          write(*,*)"Fixed CO2 aerosol distribution?"
          aerofixco2=.false.     ! default value
-         call getin("aerofixco2",aerofixco2)
+         call getin_p("aerofixco2",aerofixco2)
          write(*,*)" aerofixco2 = ",aerofixco2
 
          write(*,*)"Radiatively active water ice?"
          aeroh2o=.false.     ! default value
-         call getin("aeroh2o",aeroh2o)
+         call getin_p("aeroh2o",aeroh2o)
          write(*,*)" aeroh2o = ",aeroh2o
 
          write(*,*)"Fixed H2O aerosol distribution?"
          aerofixh2o=.false.     ! default value
-         call getin("aerofixh2o",aerofixh2o)
+         call getin_p("aerofixh2o",aerofixh2o)
          write(*,*)" aerofixh2o = ",aerofixh2o
 
          write(*,*)"Radiatively active sulfuric acid aersols?"
          aeroh2so4=.false.     ! default value
-         call getin("aeroh2so4",aeroh2so4)
+         call getin_p("aeroh2so4",aeroh2so4)
          write(*,*)" aeroh2so4 = ",aeroh2so4
 	 
@@ -481,5 +490,5 @@
 	 write(*,*)"Radiatively active two-layer aersols?"
          aeroback2lay=.false.     ! default value
-         call getin("aeroback2lay",aeroback2lay)
+         call getin_p("aeroback2lay",aeroback2lay)
          write(*,*)" aeroback2lay = ",aeroback2lay
 
@@ -487,5 +496,5 @@
      &              "in the tropospheric layer (visible)"
          obs_tau_col_tropo=8.D0
-         call getin("obs_tau_col_tropo",obs_tau_col_tropo)
+         call getin_p("obs_tau_col_tropo",obs_tau_col_tropo)
          write(*,*)" obs_tau_col_tropo = ",obs_tau_col_tropo
 
@@ -493,25 +502,25 @@
      &              "in the stratospheric layer (visible)"
          obs_tau_col_strato=0.08D0
-         call getin("obs_tau_col_strato",obs_tau_col_strato)
+         call getin_p("obs_tau_col_strato",obs_tau_col_strato)
          write(*,*)" obs_tau_col_strato = ",obs_tau_col_strato
 
          write(*,*)"TWOLAY AEROSOL: pres_bottom_tropo? in pa"
          pres_bottom_tropo=66000.0
-         call getin("pres_bottom_tropo",pres_bottom_tropo)
+         call getin_p("pres_bottom_tropo",pres_bottom_tropo)
          write(*,*)" pres_bottom_tropo = ",pres_bottom_tropo
 
          write(*,*)"TWOLAY AEROSOL: pres_top_tropo? in pa"
          pres_top_tropo=18000.0
-         call getin("pres_top_tropo",pres_top_tropo)
+         call getin_p("pres_top_tropo",pres_top_tropo)
          write(*,*)" pres_top_tropo = ",pres_top_tropo
 
          write(*,*)"TWOLAY AEROSOL: pres_bottom_strato? in pa"
          pres_bottom_strato=2000.0
-         call getin("pres_bottom_strato",pres_bottom_strato)
+         call getin_p("pres_bottom_strato",pres_bottom_strato)
          write(*,*)" pres_bottom_strato = ",pres_bottom_strato
 
          write(*,*)"TWOLAY AEROSOL: pres_top_strato? in pa"
          pres_top_strato=100.0
-         call getin("pres_top_strato",pres_top_strato)
+         call getin_p("pres_top_strato",pres_top_strato)
          write(*,*)" pres_top_strato = ",pres_top_strato
 
@@ -519,5 +528,5 @@
      &              "tropospheric layer, in meters"
          size_tropo=2.e-6
-         call getin("size_tropo",size_tropo)
+         call getin_p("size_tropo",size_tropo)
          write(*,*)" size_tropo = ",size_tropo
 
@@ -525,5 +534,5 @@
      &              "stratospheric layer, in meters"
          size_strato=1.e-7
-         call getin("size_strato",size_strato)
+         call getin_p("size_strato",size_strato)
          write(*,*)" size_strato = ",size_strato
 
@@ -532,5 +541,5 @@
          write(*,*)"Cloud pressure level (with kastprof only):"
          cloudlvl=0. ! default value
-         call getin("cloudlvl",cloudlvl)
+         call getin_p("cloudlvl",cloudlvl)
          write(*,*)" cloudlvl = ",cloudlvl
 
@@ -538,15 +547,15 @@
          Tstrat=167.0
          varactive=.false.
-         call getin("varactive",varactive)
+         call getin_p("varactive",varactive)
          write(*,*)" varactive = ",varactive
 
          write(*,*)"Is the variable gas species distribution set?"
          varfixed=.false.
-         call getin("varfixed",varfixed)
+         call getin_p("varfixed",varfixed)
          write(*,*)" varfixed = ",varfixed
 
          write(*,*)"What is the saturation % of the variable species?"
          satval=0.8
-         call getin("satval",satval)
+         call getin_p("satval",satval)
          write(*,*)" satval = ",satval
 
@@ -561,10 +570,10 @@
          write(*,*) "Gravitationnal sedimentation ?"
          sedimentation=.false. ! default value
-         call getin("sedimentation",sedimentation)
+         call getin_p("sedimentation",sedimentation)
          write(*,*) " sedimentation = ",sedimentation
 
          write(*,*) "Compute water cycle ?"
          water=.false. ! default value
-         call getin("water",water)
+         call getin_p("water",water)
          write(*,*) " water = ",water
          
@@ -578,5 +587,5 @@
          write(*,*) "Include water condensation ?"
          watercond=.false. ! default value
-         call getin("watercond",watercond)
+         call getin_p("watercond",watercond)
          write(*,*) " watercond = ",watercond
 
@@ -590,40 +599,40 @@
          write(*,*) "Include water precipitation ?"
          waterrain=.false. ! default value
-         call getin("waterrain",waterrain)
+         call getin_p("waterrain",waterrain)
          write(*,*) " waterrain = ",waterrain
 
          write(*,*) "Include surface hydrology ?"
          hydrology=.false. ! default value
-         call getin("hydrology",hydrology)
+         call getin_p("hydrology",hydrology)
          write(*,*) " hydrology = ",hydrology
 
          write(*,*) "Evolve surface water sources ?"
          sourceevol=.false. ! default value
-         call getin("sourceevol",sourceevol)
+         call getin_p("sourceevol",sourceevol)
          write(*,*) " sourceevol = ",sourceevol
 
          write(*,*) "Ice evolution timestep ?"
          icetstep=100.0 ! default value
-         call getin("icetstep",icetstep)
+         call getin_p("icetstep",icetstep)
          write(*,*) " icetstep = ",icetstep
 
          write(*,*) "Snow albedo ?"
          albedosnow=0.5         ! default value
-         call getin("albedosnow",albedosnow)
+         call getin_p("albedosnow",albedosnow)
          write(*,*) " albedosnow = ",albedosnow
 
          write(*,*) "Maximum ice thickness ?"
          maxicethick=2.0         ! default value
-         call getin("maxicethick",maxicethick)
+         call getin_p("maxicethick",maxicethick)
          write(*,*) " maxicethick = ",maxicethick
 
          write(*,*) "Freezing point of seawater ?"
          Tsaldiff=-1.8          ! default value
-         call getin("Tsaldiff",Tsaldiff)
+         call getin_p("Tsaldiff",Tsaldiff)
          write(*,*) " Tsaldiff = ",Tsaldiff
 
          write(*,*) "Does user want to force cpp and mugaz?"
          force_cpp=.false. ! default value
-         call getin("force_cpp",force_cpp)
+         call getin_p("force_cpp",force_cpp)
          write(*,*) " force_cpp = ",force_cpp
 
@@ -631,5 +640,5 @@
            mugaz = -99999.
            PRINT *,'MEAN MOLECULAR MASS in g mol-1 ?'
-           call getin("mugaz",mugaz)
+           call getin_p("mugaz",mugaz)
            IF (mugaz.eq.-99999.) THEN
                PRINT *, "mugaz must be set if force_cpp = T"
@@ -640,5 +649,5 @@
            cpp = -99999.
            PRINT *,'SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?'
-           call getin("cpp",cpp)
+           call getin_p("cpp",cpp)
            IF (cpp.eq.-99999.) THEN
                PRINT *, "cpp must be set if force_cpp = T"
@@ -702,5 +711,8 @@
       ENDDO
 
+!$OMP MASTER
       pi=2.*asin(1.) ! NB: pi is a common in comcstfi.h
+!$OMP END MASTER
+!$OMP BARRIER
 
       ! allocate "comsoil_h" arrays
Index: /trunk/LMDZ.GENERIC/libf/phystd/iniphysiq.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/iniphysiq.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/iniphysiq.F90	(revision 1315)
@@ -60,6 +60,6 @@
 ENDIF
 
-!$OMP PARALLEL PRIVATE(ibegin,iend) 
-!$OMP+         SHARED(parea,pcu,pcv,plon,plat)
+!$OMP PARALLEL PRIVATE(ibegin,iend) & 
+	!$OMP SHARED(parea,pcu,pcv,plon,plat)
       
 offset=klon_mpi_begin-1
Index: /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2H2.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2H2.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2H2.F90	(revision 1315)
@@ -43,5 +43,5 @@
       logical firstcall
 
-      save wn_arr, temp_arr, abs_arr
+      save wn_arr, temp_arr, abs_arr !read by master
 
       character*100 dt_file
@@ -72,4 +72,5 @@
          dt_file=TRIM(datadir)//'/continuum_data/H2-H2_norm_2011.cia'
 
+!$OMP MASTER
          open(33,file=dt_file,form='formatted',status='old',iostat=ios)
          if (ios.ne.0) then        ! file not found
@@ -102,4 +103,6 @@
          endif
          close(33)
+!$OMP END MASTER
+!$OMP BARRIER
 
          print*,'interpolateH2H2: At wavenumber ',wn,' cm^-1'
Index: /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2He.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2He.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2He.F90	(revision 1315)
@@ -45,5 +45,5 @@
       logical firstcall
 
-      save wn_arr, temp_arr, abs_arr
+      save wn_arr, temp_arr, abs_arr !read by master
 
       character*100 dt_file
@@ -73,5 +73,6 @@
 !     1.1 Open the ASCII files
          dt_file=TRIM(datadir)//'/continuum_data/H2-He_norm_2011.cia'
-
+	 
+!$OMP MASTER
          open(33,file=dt_file,form='formatted',status='old',iostat=ios)
          if (ios.ne.0) then        ! file not found
@@ -104,4 +105,6 @@
          endif
          close(33)
+!$OMP END MASTER
+!$OMP BARRIER
 
          print*,'interpolateH2He: At wavenumber ',wn,' cm^-1'
Index: /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2Ocont_CKD.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2Ocont_CKD.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/interpolateH2Ocont_CKD.F90	(revision 1315)
@@ -43,5 +43,5 @@
       logical firstcall
 
-      save wn_arr, temp_arr, abs_arrS, abs_arrF
+      save wn_arr, temp_arr, abs_arrS, abs_arrF !read by master
 
       character*100 dt_file
@@ -57,4 +57,5 @@
 !     1.1 Open the ASCII files
 
+!$OMP MASTER
          ! nu array
          dt_file=TRIM(datadir)//'/continuum_data/H2O_CONT_NU.dat'
@@ -129,4 +130,6 @@
          print*,'   H2O pressure ',presS,' Pa'
          print*,'   air pressure ',presF,' Pa'
+!$OMP END MASTER
+!$OMP BARRIER
 	 
       endif
Index: /trunk/LMDZ.GENERIC/libf/phystd/interpolateN2H2.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/interpolateN2H2.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/interpolateN2H2.F90	(revision 1315)
@@ -44,5 +44,5 @@
   logical firstcall
 
-  save wn_arr, temp_arr, abs_arr
+  save wn_arr, temp_arr, abs_arr !read by master
 
   character*100 dt_file
@@ -72,4 +72,5 @@
      dt_file=TRIM(datadir)//'/continuum_data/N2-H2_2011.cia'
 
+!$OMP MASTER
      open(33,file=dt_file,form='formatted',status='old',iostat=ios)
      if (ios.ne.0) then        ! file not found
@@ -102,4 +103,6 @@
      endif
      close(33)
+!$OMP END MASTER
+!$OMP BARRIER
 
      print*,'interpolateN2H2: At wavenumber ',wn,' cm^-1'
Index: /trunk/LMDZ.GENERIC/libf/phystd/interpolateN2N2.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/interpolateN2N2.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/interpolateN2N2.F90	(revision 1315)
@@ -43,5 +43,5 @@
   logical firstcall
 
-  save wn_arr, temp_arr, abs_arr
+  save wn_arr, temp_arr, abs_arr !read by master
 
   character*100 dt_file
@@ -70,4 +70,5 @@
      dt_file=TRIM(datadir)//'/continuum_data/N2-N2_2011.cia'
 
+!$OMP MASTER
      open(33,file=dt_file,form='formatted',status='old',iostat=ios)
      if (ios.ne.0) then        ! file not found
@@ -100,4 +101,6 @@
      endif
      close(33)
+!$OMP END MASTER
+!$OMP BARRIER
 
      print*,'interpolateN2N2: At wavenumber ',wn,' cm^-1'
Index: /trunk/LMDZ.GENERIC/libf/phystd/iostart.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/iostart.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/iostart.F90	(revision 1315)
@@ -5,4 +5,5 @@
     INTEGER,SAVE :: nid_start ! NetCDF file identifier for startfi.nc file
     INTEGER,SAVE :: nid_restart ! NetCDF file identifier for restartfi.nc file
+!$OMP THREADPRIVATE(nid_start,nid_restart)
     
     ! restartfi.nc file dimension identifiers: (see open_restartphy())
@@ -16,4 +17,5 @@
     INTEGER,SAVE :: idim8 ! "ocean_layers" dimension
     INTEGER,SAVE :: timeindex ! current time index (for time-dependent fields)
+!$OMP THREADPRIVATE(idim1,idim2,idim3,idim4,idim5,idim6,idim7,timeindex)
     INTEGER,PARAMETER :: length=100 ! size of tab_cntrl array
     
@@ -473,4 +475,5 @@
     INTEGER                     :: ierr
     LOGICAL,SAVE :: already_created=.false.
+!$OMP THREADPRIVATE(already_created)
     
     IF (is_master) THEN
@@ -956,4 +959,5 @@
      INTEGER :: idim1d
      logical,save :: firsttime=.true.
+!$OMP THREADPRIVATE(firsttime)
          
     IF (is_master) THEN
Index: /trunk/LMDZ.GENERIC/libf/phystd/largescale.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/largescale.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/largescale.F90	(revision 1315)
@@ -4,5 +4,6 @@
 
 !     to use  'getin'
-      use ioipsl_getincom 
+!      use ioipsl_getincom 
+      use ioipsl_getincom_p
       use watercommon_h, only : RLVTT, RCPD, RVTMP2,  &
           T_h2O_ice_clouds,T_h2O_ice_liq,Psat_waterDP,Lcpdqsat_waterDP
@@ -47,4 +48,5 @@
 !     Options du programme
       REAL, SAVE :: ratqs   ! determine largeur de la distribution de vapeur
+!$OMP THREADPRIVATE(ratqs)
 
 !     Variables locales
@@ -69,4 +71,5 @@
       DOUBLE PRECISION zx_q(ngrid)
       LOGICAL,SAVE :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
 
 
@@ -75,5 +78,5 @@
 	 write(*,*) "value for ratqs? "
          ratqs=0.2 ! default value
-         call getin("ratqs",ratqs)
+         call getin_p("ratqs",ratqs)
          write(*,*) " ratqs = ",ratqs
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/mass_redistribution.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/mass_redistribution.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/mass_redistribution.F90	(revision 1315)
@@ -102,4 +102,5 @@
 !   local saved variables
       LOGICAL, SAVE :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
 
 !----------------------------------------------------------------------
Index: /trunk/LMDZ.GENERIC/libf/phystd/mod_grid_phy_lmdz.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/mod_grid_phy_lmdz.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/mod_grid_phy_lmdz.F90	(revision 1315)
@@ -12,4 +12,5 @@
   INTEGER,SAVE :: nbp_lev  ! == llm
   INTEGER,SAVE :: klon_glo
+!$OMP THREADPRIVATE(nbp_lon,nbp_lat,nbp_lev,klon_glo)
 
   INTERFACE grid1dTo2d_glo
Index: /trunk/LMDZ.GENERIC/libf/phystd/mod_phys_lmdz_mpi_data.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/mod_phys_lmdz_mpi_data.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/mod_phys_lmdz_mpi_data.F90	(revision 1315)
@@ -16,4 +16,6 @@
   INTEGER,SAVE :: klon_mpi_end
   INTEGER,SAVE :: klon_mpi
+!!$OMP THREADPRIVATE(ii_begin,ii_end,jj_begin,jj_end,jj_nb,ij_begin,&
+!	!$OMP ij_end,ij_nb,klon_mpi_begin,klon_mpi_end,klon_mpi)
   
   INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_nb
@@ -31,4 +33,7 @@
   INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_begin
   INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_end 
+!!$OMP THREADPRIVATE(jj_para_nb,jj_para_begin,jj_para_end,ii_para_begin,ii_para_end,&
+!	!$OMP ij_para_nb,ij_para_begin,ij_para_end,klon_mpi_para_nb,klon_mpi_para_begin,&
+!	!$OMP klon_mpi_para_end)
 
   
@@ -38,4 +43,5 @@
   LOGICAL,SAVE :: is_mpi_root
   LOGICAL,SAVE :: is_using_mpi
+!!$OMP THREADPRIVATE(mpi_rank,mpi_size,mpi_root,is_mpi_root,is_using_mpi)
   
   
@@ -43,4 +49,5 @@
   LOGICAL,SAVE :: is_south_pole
   INTEGER,SAVE :: COMM_LMDZ_PHY
+!!$OMP THREADPRIVATE(is_north_pole,is_south_pole,COMM_LMDZ_PHY)
 
 CONTAINS
Index: /trunk/LMDZ.GENERIC/libf/phystd/mod_phys_lmdz_para.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/mod_phys_lmdz_para.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/mod_phys_lmdz_para.F90	(revision 1315)
@@ -13,4 +13,5 @@
   
 !$OMP THREADPRIVATE(klon_loc,is_master)
+!$OMP THREADPRIVATE(is_sequential,is_parallel)
   
 CONTAINS
Index: /trunk/LMDZ.GENERIC/libf/phystd/moistadj.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/moistadj.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/moistadj.F90	(revision 1315)
@@ -77,6 +77,8 @@
       INTEGER,SAVE :: i_h2o=0  ! water vapour
       INTEGER,SAVE :: i_ice=0  ! water ice
+!$OMP THREADPRIVATE(i_h2o,i_ice)
 
       LOGICAL,SAVE :: firstcall=.TRUE.
+!$OMP THREADPRIVATE(firstcall)
 
       IF (firstcall) THEN
Index: /trunk/LMDZ.GENERIC/libf/phystd/newsedim.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/newsedim.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/newsedim.F	(revision 1315)
@@ -44,4 +44,5 @@
 
       LOGICAL,SAVE :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
 
 c    Traceurs :
@@ -62,4 +63,5 @@
 c     local and saved variable
       real,save :: a,b
+!$OMP THREADPRIVATE(a,b)
 
 c    ** un petit test de coherence
Index: /trunk/LMDZ.GENERIC/libf/phystd/newstart.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/newstart.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/newstart.F	(revision 1315)
@@ -23,5 +23,6 @@
       use datafile_mod, only: datadir
 ! to use  'getin'
-      USE ioipsl_getincom, only: getin
+!      USE ioipsl_getincom, only: getin
+      USE ioipsl_getincom_p, only: getin_p
       use control_mod, only: day_step, iphysiq, anneeref
       use phyredem, only: physdem0, physdem1
@@ -481,5 +482,5 @@
 !    First get the correct value of datadir, if not already done:
         ! default 'datadir' is set in "datafile_mod"
-        call getin("datadir",datadir)
+        call getin_p("datadir",datadir)
         write(*,*) 'Available surface data files are:'
         filestring='ls '//trim(datadir)//' | grep .nc'
Index: /trunk/LMDZ.GENERIC/libf/phystd/newtrelax.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/newtrelax.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/newtrelax.F90	(revision 1315)
@@ -38,4 +38,5 @@
   real Trelax_V, Trelax_H
   real,allocatable,dimension(:,:),save :: Trelax
+!$OMP THREADPRIVATE(Trelax)
 
   real T_trop ! relaxation temperature at tropopause (K)
Index: /trunk/LMDZ.GENERIC/libf/phystd/ocean_slab_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/ocean_slab_mod.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/ocean_slab_mod.F90	(revision 1315)
@@ -26,7 +26,7 @@
   
   !LOGICAL, PRIVATE, SAVE  :: ok_slab_sic,ok_slab_heaT_h2O_ice_liqBS
-  !$OMP THREADPRIVATE(ok_slab_sic,ok_slab_heaT_h2O_ice_liqBS)
+  !!$OMP THREADPRIVATE(ok_slab_sic,ok_slab_heaT_h2O_ice_liqBS)
   !INTEGER, PRIVATE, SAVE                           :: slab_ekman, slab_cadj
-  !$OMP THREADPRIVATE(slab_ekman,slab_cadj)
+  !!$OMP THREADPRIVATE(slab_ekman,slab_cadj)
   INTEGER, PRIVATE, SAVE                           :: lmt_pas, julien, idayvrai
   !$OMP THREADPRIVATE(lmt_pas,julien,idayvrai)
Index: /trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1315)
@@ -188,7 +188,9 @@
       real, dimension(:,:),allocatable,save ::  tsoil  ! sub-surface temperatures (K)
       real, dimension(:),allocatable,save :: albedo ! Surface albedo
+!$OMP THREADPRIVATE(tsurf,tsoil,albedo)
 
       real,dimension(:),allocatable,save :: albedo0 ! Surface albedo
       real,dimension(:),allocatable,save :: rnat ! added by BC
+!$OMP THREADPRIVATE(albedo0,rnat)
 
       real,dimension(:),allocatable,save :: emis ! Thermal IR surface emissivity
@@ -200,6 +202,8 @@
       real,dimension(:,:),allocatable,save :: qsurf ! tracer on surface (e.g. kg.m-2)
       real,dimension(:,:),allocatable,save :: q2 ! Turbulent Kinetic Energy 
+!$OMP THREADPRIVATE(emis,dtrad,fluxrad_sky,fluxrad,capcal,fluxgrd,qsurf,q2)
 
       save day_ini, icount
+!$OMP THREADPRIVATE(day_ini,icount)
 
 ! Local variables :
@@ -227,4 +231,6 @@
       real,dimension(:,:),allocatable,save :: zdtsw ! (K/s)
       real,dimension(:),allocatable,save :: sensibFlux ! turbulent flux given by the atm to the surface
+!$OMP THREADPRIVATE(fluxsurf_lw,fluxsurf_sw,fluxtop_lw,fluxabs_sw,fluxtop_dn,fluxdyn,OLR_nu,OSR_nu,&
+	!$OMP zdtlw,zdtsw,sensibFlux)
 
       real zls                       ! solar longitude (rad)
@@ -298,4 +304,5 @@
       real zdtdyn(ngrid,nlayer)
       real,allocatable,dimension(:,:),save :: ztprevious
+!$OMP THREADPRIVATE(ztprevious)
       real reff(ngrid,nlayer) ! effective dust radius (used if doubleq=T)
       real qtot1,qtot2            ! total aerosol mass
@@ -312,4 +319,5 @@
 !     reinstated by RW for diagnostic
       real,allocatable,dimension(:),save :: tau_col
+!$OMP THREADPRIVATE(tau_col)
       
 !     included by RW to reduce insanity of code
@@ -344,4 +352,5 @@
       real dEtot, dEtots, AtmToSurf_TurbFlux
       real,save :: dEtotSW, dEtotsSW, dEtotLW, dEtotsLW
+!$OMP THREADPRIVATE(dEtotSW, dEtotsSW, dEtotLW, dEtotsLW)
       real dEzRadsw(ngrid,nlayer),dEzRadlw(ngrid,nlayer),dEzdiff(ngrid,nlayer)
       real dEdiffs(ngrid),dEdiff(ngrid)
@@ -360,4 +369,5 @@
 !     included by BC for hydrology
       real,allocatable,save :: hice(:)
+ !$OMP THREADPRIVATE(hice)     
 
 !     included by RW to test water conservation (by routine)
@@ -367,4 +377,5 @@
       logical watertest
       save watertest
+!$OMP THREADPRIVATE(watertest)
 
 !     included by RW for RH diagnostic
@@ -394,4 +405,5 @@
       real,allocatable,dimension(:,:),save :: cloudfrac
       real,allocatable,dimension(:),save :: totcloudfrac
+!$OMP THREADPRIVATE(cloudfrac,totcloudfrac)
 
 !     included by RW for vdifc water conservation test
@@ -402,4 +414,5 @@
 !      double precision qsurf_hist(ngrid,nq)
       real,allocatable,dimension(:,:),save :: qsurf_hist
+!$OMP THREADPRIVATE(qsurf_hist)
 
 !     included by RW for temp convadj conservation test
@@ -416,4 +429,5 @@
       real,allocatable,dimension(:,:,:),save :: reffrad ! aerosol effective radius (m)
       real,allocatable,dimension(:,:,:),save :: nueffrad ! aerosol effective radius variance
+!$OMP THREADPRIVATE(reffrad,nueffrad)
 !      real :: nueffrad_dummy(ngrid,nlayer,naerkind) !! AS. This is temporary. Check below why.
       real :: reffh2oliq(ngrid,nlayer) ! liquid water particles effective radius (m)
@@ -429,4 +443,5 @@
       integer num_run
       logical,save :: ice_update
+!$OMP THREADPRIVATE(ice_initial,ice_min,ice_update)
 
 !     included by MS to compute the daily average of rings shadowing
@@ -447,4 +462,5 @@
       real, dimension(:),allocatable,save :: zmasq
       integer, dimension(:),allocatable,save ::knindex 
+!$OMP THREADPRIVATE(pctsrf_sic,tslab,tsea_ice,sea_ice,zmasq,knindex)
 
       real :: tsurf2(ngrid)
@@ -630,4 +646,5 @@
          ice_update=.false.
          if(sourceevol)then
+!$OMP MASTER
             open(128,file='num_run',form='formatted', &
                      status="old",iostat=ierr)
@@ -639,4 +656,6 @@
             read(128,*) num_run 
             close(128)
+!$OMP END MASTER
+!$OMP BARRIER
         
             if(num_run.ne.0.and.mod(num_run,2).eq.0)then
@@ -2196,6 +2215,10 @@
 
         ! deallocate gas variables
+!$OMP BARRIER
+!$OMP MASTER
         IF ( ALLOCATED( gnom ) ) DEALLOCATE( gnom )
         IF ( ALLOCATED( gfrac ) ) DEALLOCATE( gfrac )  ! both allocated in su_gases.F90
+!$OMP END MASTER
+!$OMP BARRIER
 
         ! deallocate saved arrays
@@ -2216,4 +2239,5 @@
         IF ( ALLOCATED(q2)) DEALLOCATE(q2)
         IF ( ALLOCATED(ztprevious)) DEALLOCATE(ztprevious)
+	IF ( ALLOCATED(hice)) DEALLOCATE(hice)
         IF ( ALLOCATED(cloudfrac)) DEALLOCATE(cloudfrac)
         IF ( ALLOCATED(totcloudfrac)) DEALLOCATE(totcloudfrac)
@@ -2236,4 +2260,10 @@
         IF ( ALLOCATED(zdtsw)) DEALLOCATE(zdtsw)
         IF ( ALLOCATED(tau_col)) DEALLOCATE(tau_col)
+	IF ( ALLOCATED(pctsrf_sic)) DEALLOCATE(pctsrf_sic)
+        IF ( ALLOCATED(tslab)) DEALLOCATE(tslab)
+        IF ( ALLOCATED(tsea_ice)) DEALLOCATE(tsea_ice)
+        IF ( ALLOCATED(sea_ice)) DEALLOCATE(sea_ice)
+        IF ( ALLOCATED(zmasq)) DEALLOCATE(zmasq)
+        IF ( ALLOCATED(knindex)) DEALLOCATE(knindex)
 
         !! this is defined in comsaison_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/planete_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/planete_mod.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/planete_mod.F90	(revision 1315)
@@ -17,7 +17,7 @@
   REAL :: p_elips
   
-  REAL :: preff ! reference surface pressure (Pa)
-  REAL,ALLOCATABLE :: ap(:) ! hybrid coordinate at layer interface
-  REAL,ALLOCATABLE :: bp(:) ! hybrid coordinate at layer interface
+  REAL :: preff ! reference surface pressure (Pa)	!read by master
+  REAL,ALLOCATABLE :: ap(:) ! hybrid coordinate at layer interface	!read by master
+  REAL,ALLOCATABLE :: bp(:) ! hybrid coordinate at layer interface 	!read by master
   
   CONTAINS
@@ -31,4 +31,5 @@
   real,intent(in) :: bp_dyn(nlayer+1) ! hybrid coordinate at interfaces
   
+!$OMP MASTER
   allocate(ap(nlayer+1))
   allocate(bp(nlayer+1))
@@ -37,4 +38,6 @@
   ap(:)=ap_dyn(:)
   bp(:)=bp_dyn(:)
+!$OMP END MASTER
+!$OMP BARRIER
   
   end subroutine ini_planete_mod
Index: /trunk/LMDZ.GENERIC/libf/phystd/radcommon_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/radcommon_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/radcommon_h.F90	(revision 1315)
@@ -61,14 +61,19 @@
 ! gIR      :  mean assymetry factor
 
-      REAL*8 BWNI(L_NSPECTI+1), WNOI(L_NSPECTI), DWNI(L_NSPECTI), WAVEI(L_NSPECTI)
-      REAL*8 BWNV(L_NSPECTV+1), WNOV(L_NSPECTV), DWNV(L_NSPECTV), WAVEV(L_NSPECTV)
+      REAL*8 BWNI(L_NSPECTI+1), WNOI(L_NSPECTI), DWNI(L_NSPECTI), WAVEI(L_NSPECTI) !BWNI read by master in setspi
+      REAL*8 BWNV(L_NSPECTV+1), WNOV(L_NSPECTV), DWNV(L_NSPECTV), WAVEV(L_NSPECTV) !BWNV read by master in setspv
       REAL*8 STELLARF(L_NSPECTV), TAURAY(L_NSPECTV), TAURAYVAR(L_NSPECTV)
+!$OMP THREADPRIVATE(WNOI,DWNI,WAVEI,&
+	!$OMP WNOV,DWNV,WAVEV,&
+	!$OMP STELLARF,TAURAY,TAURAYVAR)
 
       REAL*8 blami(L_NSPECTI+1)
       REAL*8 blamv(L_NSPECTV+1) ! these are needed by suaer.F90
+!$OMP THREADPRIVATE(blami,blamv)
 
       !! AS: introduced to avoid doing same computations again for continuum
       INTEGER, DIMENSION(:,:,:), ALLOCATABLE :: indi
       INTEGER, DIMENSION(:,:,:), ALLOCATABLE :: indv
+!$OMP THREADPRIVATE(indi,indv)
 
       !!! ALLOCATABLE STUFF SO THAT DIMENSIONS ARE READ in *.dat FILES -- AS 12/2011  
@@ -79,4 +84,6 @@
       real*8 pgasmin, pgasmax
       real*8 tgasmin, tgasmax
+!$OMP THREADPRIVATE(gasi,gasv,&  !wrefvar,pgasref,tgasref,pfgasref read by master in sugas_corrk
+	!$OMP FZEROI,FZEROV)     !pgasmin,pgasmax,tgasmin,tgasmax read by master in sugas_corrk
 
       real QVISsQREF(L_NSPECTV,naerkind,nsizemax)
@@ -86,4 +93,5 @@
       real omegair(L_NSPECTI,naerkind,nsizemax)
       real gir(L_NSPECTI,naerkind,nsizemax)
+!$OMP THREADPRIVATE(QVISsQREF,omegavis,gvis,QIRsQREF,omegair,gir)
 
 
@@ -102,4 +110,5 @@
 
       DOUBLE PRECISION :: radiustab(naerkind,2,nsizemax)
+!$OMP THREADPRIVATE(lamrefir,lamrefvis,radiustab) !nsize read by suaer_corrk
 
 ! Extinction coefficient at reference wavelengths;
@@ -121,4 +130,6 @@
 
       real*8 gweight(L_NGAUSS)
+!$OMP THREADPRIVATE(QREFvis,QREFir,omegaREFvis,omegaREFir,& 	! gweight read by master in sugas_corrk
+		!$OMP tstellar,planckir,PTOP,TAUREF)
 
 !     If the gas optical depth (top to the surface) is less than
@@ -137,4 +148,5 @@
       real*8 glat_ig
       save glat_ig
+!$OMP THREADPRIVATE(Cmk,glat_ig)
 
       ! extinction of incoming sunlight (Saturn's rings, eclipses, etc...)
@@ -143,4 +155,5 @@
       !Latitude-dependent gravity
       REAL, DIMENSION(:), ALLOCATABLE :: glat
+!$OMP THREADPRIVATE(glat,eclipse)
 
       end module radcommon_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90	(revision 1315)
@@ -12,4 +12,5 @@
       real, save ::  Nmix_h2o
       real, save ::  Nmix_h2o_ice
+!$OMP THREADPRIVATE(rad_h2o,rad_h2o_ice,Nmix_h2o,Nmix_h2o_ice)
       real, parameter ::  coef_chaud=0.13
       real, parameter ::  coef_froid=0.09
@@ -32,5 +33,6 @@
 !==================================================================
  ! to use  'getin'
-      use ioipsl_getincom 
+!      use ioipsl_getincom 
+      use ioipsl_getincom_p
       use radinc_h, only: naerkind
       use aerosol_mod
@@ -49,4 +51,5 @@
 
       logical, save :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
       integer :: iaer   
       
@@ -99,10 +102,10 @@
 	    write(*,*)"radius of H2O water particles:"
             rad_h2o=13. ! default value
-            call getin("rad_h2o",rad_h2o)
+            call getin_p("rad_h2o",rad_h2o)
             write(*,*)" rad_h2o = ",rad_h2o
 
 	    write(*,*)"radius of H2O ice particles:"
             rad_h2o_ice=35. ! default value
-            call getin("rad_h2o_ice",rad_h2o_ice)
+            call getin_p("rad_h2o_ice",rad_h2o_ice)
             write(*,*)" rad_h2o_ice = ",rad_h2o_ice
 
@@ -111,10 +114,10 @@
             write(*,*)"Number mixing ratio of H2O water particles:"
             Nmix_h2o=1.e6 ! default value
-            call getin("Nmix_h2o",Nmix_h2o)
+            call getin_p("Nmix_h2o",Nmix_h2o)
             write(*,*)" Nmix_h2o = ",Nmix_h2o
 
             write(*,*)"Number mixing ratio of H2O ice particles:"
             Nmix_h2o_ice=Nmix_h2o ! default value
-            call getin("Nmix_h2o_ice",Nmix_h2o_ice)
+            call getin_p("Nmix_h2o_ice",Nmix_h2o_ice)
             write(*,*)" Nmix_h2o_ice = ",Nmix_h2o_ice
 	 endif
Index: /trunk/LMDZ.GENERIC/libf/phystd/radinc_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/radinc_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/radinc_h.F90	(revision 1315)
@@ -63,5 +63,5 @@
       ! These are set in sugas_corrk
       ! [uses allocatable arrays] -- AS 12/2011
-      integer :: L_NPREF, L_NTREF, L_REFVAR, L_PINT
+      integer :: L_NPREF, L_NTREF, L_REFVAR, L_PINT   !L_NPREF, L_NTREF, L_REFVAR, L_PINT read by master in sugas_corrk
 
       integer, parameter :: L_NGAUSS  = 17
@@ -92,7 +92,9 @@
       character (len=100) :: corrkdir
       save corrkdir
+!$OMP THREADPRIVATE(corrkdir)
 
       character (len=100) :: banddir
       save banddir
+!$OMP THREADPRIVATE(banddir)
 
       end module radinc_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/rain.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/rain.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/rain.F90	(revision 1315)
@@ -2,5 +2,7 @@
 
 
-  use ioipsl_getincom, only: getin
+! to use  'getin'
+!  use ioipsl_getincom 
+  use ioipsl_getincom_p
   use watercommon_h, only: T_h2O_ice_liq,T_h2O_ice_clouds, RLVTT, RCPD, RCPV, RV, RVTMP2,Psat_water,Tsat_water,rhowater
   use radii_mod, only: h2o_cloudrad
@@ -63,8 +65,10 @@
       REAL,PARAMETER :: Kboucher=1.19E8
       REAL,SAVE :: c1
+!$OMP THREADPRIVATE(precip_scheme,rainthreshold,cloud_sat,precip_timescale,Cboucher,c1)
 
       INTEGER,PARAMETER :: ninter=5
 
       logical,save :: evap_prec ! Does the rain evaporate?
+!$OMP THREADPRIVATE(evap_prec)
 
 !     for simple scheme
@@ -93,6 +97,8 @@
       INTEGER, SAVE :: i_vap=0  ! water vapour
       INTEGER, SAVE :: i_ice=0  ! water ice
+!$OMP THREADPRIVATE(i_vap,i_ice)
 
       LOGICAL,SAVE :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
 
 !     Online functions
@@ -115,5 +121,5 @@
          write(*,*) "Precipitation scheme to use?"
          precip_scheme=1 ! default value
-         call getin("precip_scheme",precip_scheme)
+         call getin_p("precip_scheme",precip_scheme)
          write(*,*) " precip_scheme = ",precip_scheme
 
@@ -121,5 +127,5 @@
 	    write(*,*) "rainthreshold in simple scheme?"
             rainthreshold=0. ! default value
-            call getin("rainthreshold",rainthreshold)
+            call getin_p("rainthreshold",rainthreshold)
             write(*,*) " rainthreshold = ",rainthreshold
 
@@ -127,9 +133,9 @@
 	    write(*,*) "cloud water saturation level in non simple scheme?"
             cloud_sat=2.6e-4   ! default value
-            call getin("cloud_sat",cloud_sat)
+            call getin_p("cloud_sat",cloud_sat)
             write(*,*) " cloud_sat = ",cloud_sat
 	    write(*,*) "precipitation timescale in non simple scheme?"
             precip_timescale=3600.  ! default value
-            call getin("precip_timescale",precip_timescale)
+            call getin_p("precip_timescale",precip_timescale)
             write(*,*) " precip_timescale = ",precip_timescale
 
@@ -137,5 +143,5 @@
 	    write(*,*) "multiplicative constant in Boucher 95 precip scheme"
             Cboucher=1.   ! default value
-            call getin("Cboucher",Cboucher)
+            call getin_p("Cboucher",Cboucher)
             write(*,*) " Cboucher = ",Cboucher	
 	    c1=1.00*1.097/rhowater*Cboucher*Kboucher  
@@ -145,5 +151,5 @@
          write(*,*) "re-evaporate precipitations?"
          evap_prec=.true. ! default value
-         call getin("evap_prec",evap_prec)
+         call getin_p("evap_prec",evap_prec)
          write(*,*) " evap_prec = ",evap_prec
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/setspi.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/setspi.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/setspi.F90	(revision 1315)
@@ -92,4 +92,5 @@
       endif
     
+!$OMP MASTER    
       nb=0
       ierr=0
@@ -121,4 +122,6 @@
       BWNI(L_NSPECTI)  =lastband(1)
       BWNI(L_NSPECTI+1)=lastband(2)
+!$OMP END MASTER
+!$OMP BARRIER
 
       print*,''
Index: /trunk/LMDZ.GENERIC/libf/phystd/setspv.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/setspv.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/setspv.F90	(revision 1315)
@@ -69,5 +69,6 @@
          call abort
       endif
-    
+	
+!$OMP MASTER        
       nb=0
       ierr=0
@@ -98,5 +99,6 @@
       BWNV(L_NSPECTV)  =lastband(1)
       BWNV(L_NSPECTV+1)=lastband(2)
-
+!$OMP END MASTER
+!$OMP BARRIER
 
       print*,'setspv: VI band limits:'
Index: /trunk/LMDZ.GENERIC/libf/phystd/soil.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/soil.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/soil.F	(revision 1315)
@@ -45,4 +45,5 @@
       real,dimension(:,:),save,allocatable :: beta ! beta_k coefficients
       real,save :: mu
+!$OMP THREADPRIVATE(mthermdiff,thermdiff,coefq,coefd,alph,beta,mu)
             
 ! local variables:
Index: /trunk/LMDZ.GENERIC/libf/phystd/stokes.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/stokes.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/stokes.F90	(revision 1315)
@@ -33,8 +33,10 @@
       real a,b,molrad,visc
       save a,b
+!$OMP THREADPRIVATE(a,b)
   
       LOGICAL firstcall
       SAVE firstcall
       DATA firstcall/.true./
+!$OMP THREADPRIVATE(firstcall)
 
       if (firstcall) then
Index: /trunk/LMDZ.GENERIC/libf/phystd/su_gases.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/su_gases.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/su_gases.F90	(revision 1315)
@@ -20,4 +20,5 @@
   !==================================================================
 
+!$OMP MASTER
   ! load gas names from file 'gases.def'
   open(90,file='gases.def',status='old',form='formatted',iostat=ierr)
@@ -122,4 +123,6 @@
   endif
   close(90)
+!$OMP END MASTER
+!$OMP BARRIER
 
 end subroutine su_gases
Index: /trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/suaer_corrk.F90	(revision 1315)
@@ -46,6 +46,6 @@
 #include "callkeys.h"
 !     Optical properties (read in external ASCII files)
-      INTEGER          :: nwvl  ! Number of wavelengths in
-                                ! the domain (VIS or IR)
+      INTEGER,SAVE      :: nwvl  ! Number of wavelengths in
+                                ! the domain (VIS or IR), read by master
 
 !      REAL             :: solsir ! visible to infrared ratio
@@ -53,12 +53,12 @@
 
       REAL, DIMENSION(:),&
-      ALLOCATABLE, SAVE :: wvl  ! Wavelength axis
+      ALLOCATABLE, SAVE :: wvl  ! Wavelength axis, read by master
       REAL, DIMENSION(:),&
-      ALLOCATABLE, SAVE :: radiusdyn ! Particle size axis
+      ALLOCATABLE, SAVE :: radiusdyn ! Particle size axis, read by master
 
       REAL, DIMENSION(:,:),&
-      ALLOCATABLE, SAVE :: ep,& ! Extinction coefficient Qext
-      omeg,&                    ! Single Scattering Albedo
-      gfactor                   ! Assymetry Factor
+      ALLOCATABLE, SAVE :: ep,& ! Extinction coefficient Qext, read by master
+      omeg,&                    ! Single Scattering Albedo, read by master
+      gfactor                   ! Assymetry Factor, read by master
 
 !     Local variables:
@@ -98,4 +98,5 @@
 
       CHARACTER(LEN=30), DIMENSION(naerkind,2), SAVE :: file_id
+!$OMP THREADPRIVATE(file_id)
 !---- Please indicate the names of the optical property files below
 !     Please also choose the reference wavelengths of each aerosol
@@ -203,4 +204,5 @@
 !     1.1 Open the ASCII file
 
+!$OMP MASTER
             INQUIRE(FILE=TRIM(datadir)//&
          '/'//TRIM(file_id(iaer,idomain)),&
@@ -339,4 +341,6 @@
       endif
 
+!$OMP END MASTER
+!$OMP BARRIER
 
 
@@ -432,9 +436,13 @@
 !========================================================================
 
-      DEALLOCATE(wvl)           ! wvl
-      DEALLOCATE(radiusdyn)     ! radiusdyn
-      DEALLOCATE(ep)            ! ep 
-      DEALLOCATE(omeg)          ! omeg 
-      DEALLOCATE(gfactor)       ! g
+!$OMP BARRIER
+!$OMP MASTER
+      IF (ALLOCATED(wvl)) DEALLOCATE(wvl)                 ! wvl
+      IF (ALLOCATED(radiusdyn)) DEALLOCATE(radiusdyn)     ! radiusdyn
+      IF (ALLOCATED(ep)) DEALLOCATE(ep)                   ! ep 
+      IF (ALLOCATED(omeg)) DEALLOCATE(omeg)          	  ! omeg 
+      IF (ALLOCATED(gfactor)) DEALLOCATE(gfactor)         ! g
+!$OMP END MASTER
+!$OMP BARRIER
 
       END DO                    ! Loop on iaer
Index: /trunk/LMDZ.GENERIC/libf/phystd/sugas_corrk.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/sugas_corrk.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/sugas_corrk.F90	(revision 1315)
@@ -28,5 +28,6 @@
 
       use gases_h
-      use ioipsl_getincom 
+!      use ioipsl_getincom
+      use ioipsl_getincom_p 
       implicit none
 
@@ -45,6 +46,6 @@
 
       ! ALLOCATABLE ARRAYS -- AS 12/2011
-      REAL*8, DIMENSION(:,:,:,:,:), ALLOCATABLE :: gasi8, gasv8
-      character*20,allocatable,DIMENSION(:) :: gastype ! for check with gnom
+      REAL*8, DIMENSION(:,:,:,:,:), ALLOCATABLE,SAVE :: gasi8, gasv8 	!read by master
+      character*20,allocatable,DIMENSION(:),SAVE :: gastype ! for check with gnom, read by master
 
       real*8 x, xi(4), yi(4), ans, p
@@ -76,4 +77,5 @@
       endif
 
+!$OMP MASTER
       ! check that database matches varactive toggle
       open(111,file=TRIM(file_path),form='formatted')
@@ -261,4 +263,6 @@
       tgasmin = tgasref(1)
       tgasmax = tgasref(L_NTREF)
+!$OMP END MASTER
+!$OMP BARRIER
 
 !-----------------------------------------------------------------------
@@ -302,5 +306,5 @@
          write(*,*)"graybody: constant absorption coefficient in visible:"
          kappa_VI=-100000.
-         call getin("kappa_VI",kappa_VI)
+         call getin_p("kappa_VI",kappa_VI)
          write(*,*)" kappa_VI = ",kappa_VI
 	 kappa_VI=kappa_VI*1.e4* mugaz * 1.672621e-27	 ! conversion from m^2/kg to cm^2/molecule         
@@ -309,5 +313,5 @@
          write(*,*)"graybody: constant absorption coefficient in InfraRed:"
          kappa_IR=-100000.
-         call getin("kappa_IR",kappa_IR)
+         call getin_p("kappa_IR",kappa_IR)
          write(*,*)" kappa_IR = ",kappa_IR	 
          kappa_IR=kappa_IR*1.e4* mugaz * 1.672621e-27	 ! conversion from m^2/kg to cm^2/molecule 
@@ -320,4 +324,5 @@
       End if
 
+!$OMP MASTER         
 !      print*,corrkdir(1:4)
       ! VISIBLE
@@ -361,10 +366,15 @@
          gasv8(1:L_NTREF,1:L_NPREF,1:L_REFVAR,1:L_NSPECTV,1:L_NGAUSS)=0.0
       endif
+!$OMP END MASTER
+!$OMP BARRIER
 
       ! INFRA-RED
       if ((corrkdir(1:4).eq.'null'))then       !.or.(TRIM(corrkdir).eq.'null_LowTeffStar')) then
          print*,'Infrared corrk gaseous absorption is set to zero if graybody=F'
+!$OMP MASTER         
          gasi8(1:L_NTREF,1:L_NPREF,1:L_REFVAR,1:L_NSPECTI,1:L_NGAUSS)=0.0
-      else  
+!$OMP END MASTER
+!$OMP BARRIER
+      else 
          file_id='/corrk_data/'//trim(adjustl(banddir))//'/corrk_gcm_IR.dat' 
          file_path=TRIM(datadir)//TRIM(file_id)
@@ -379,7 +389,10 @@
          endif
          
+!$OMP MASTER          	        
          open(111,file=TRIM(file_path),form='formatted')
          read(111,*) gasi8
          close(111)
+!$OMP END MASTER
+!$OMP BARRIER
      
          ! 'fzero' is a currently unused feature that allows optimisation
@@ -423,4 +436,5 @@
       endif
 
+!$OMP MASTER         	     
       if(nIR_limit.eq.0) then
          gasi8(1:L_NTREF,1:L_NPREF,1:L_REFVAR,1:L_NSPECTI,1:L_NGAUSS)=   &
@@ -465,4 +479,6 @@
          end do
       end do
+!$OMP END MASTER
+!$OMP BARRIER
 
 !     Interpolate the values:  first the longwave
@@ -653,8 +669,12 @@
 
 !     Deallocate local arrays
+!$OMP BARRIER
+!$OMP MASTER
       IF( ALLOCATED( gasi8 ) ) DEALLOCATE( gasi8 )
       IF( ALLOCATED( gasv8 ) ) DEALLOCATE( gasv8 )
       IF( ALLOCATED( pgasref ) ) DEALLOCATE( pgasref )
       IF( ALLOCATED( gastype ) ) DEALLOCATE( gastype )
+!$OMP END MASTER
+!$OMP BARRIER
 
       return
Index: /trunk/LMDZ.GENERIC/libf/phystd/surfdat_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/surfdat_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/surfdat_h.F90	(revision 1315)
@@ -5,12 +5,16 @@
 
        real,allocatable,dimension(:) :: albedodat ! albedo of bare ground
+!$OMP THREADPRIVATE(albedodat)
        ! Ehouarn: moved inertiedat to comsoil.h
        !      real inertiedat, ! thermal inertia
        real,allocatable,dimension(:) :: phisfi ! geopotential at ground level
+!$OMP THREADPRIVATE(phisfi)
        real,dimension(2) :: albedice
        real,dimension(2) :: emisice ! ice emissivity; 1:Northern hemisphere 2:Southern hemisphere
        real emissiv
        real,dimension(2) :: iceradius, dtemisice
+!$OMP THREADPRIVATE(albedice,emisice,emissiv,iceradius,dtemisice)
        real,allocatable,dimension(:) :: zmea,zstd,zsig,zgam,zthe
+!$OMP THREADPRIVATE(zmea,zstd,zsig,zgam,zthe)
 
        real,allocatable,dimension(:) :: dryness  !"Dryness coefficient" for grnd water ice sublimation
@@ -18,4 +22,5 @@
 
        logical,allocatable,dimension(:) :: watercaptag !! was in watercap.h
+!$OMP THREADPRIVATE(dryness,watercaptag)
 
        end module surfdat_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/tracer_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/tracer_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/tracer_h.F90	(revision 1315)
@@ -19,4 +19,6 @@
       real rho_co2     ! CO2 ice density (kg.m-3)
       real ref_r0        ! for computing reff=ref_r0*r0 (in log.n. distribution)
+!$OMP THREADPRIVATE(noms,mmol,radius,rho_q,qext,alpha_lift,alpha_devil,qextrhor, &
+	!$OMP varian,r3n_q,rho_dust,rho_ice,rho_co2,ref_r0)
 
 ! tracer indexes: these are initialized in initracer and should be 0 if the
@@ -47,4 +49,7 @@
       integer :: igcm_ar_n2 ! for simulations using co2 +neutral gaz
       integer :: igcm_co2_ice ! CO2 ice 
+!$OMP THREADPRIVATE(igcm_dustbin,igcm_dust_mass,igcm_dust_number,igcm_h2o_vap,igcm_h2o_ice, &
+	!$OMP igcm_co2,igcm_co,igcm_o,igcm_o1d,igcm_o2,igcm_o3,igcm_h,igcm_h2,igcm_oh,	    &
+	!$OMP igcm_ho2,igcm_h2o2,igcm_n2,igcm_ar,igcm_ar_n2,igcm_co2_ice)
 
        end module tracer_h
Index: /trunk/LMDZ.GENERIC/libf/phystd/turbdiff.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/turbdiff.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/turbdiff.F90	(revision 1315)
@@ -107,4 +107,5 @@
 
       LOGICAL,SAVE :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall)
       
 !     Tracers
@@ -124,4 +125,5 @@
 
       integer, save :: ivap, iliq, iliq_surf,iice_surf ! also make liq for clarity on surface...
+!$OMP THREADPRIVATE(ivap,iliq,iliq_surf,iice_surf)
 
       real, parameter :: karman=0.4
Index: /trunk/LMDZ.GENERIC/libf/phystd/vdif_cd.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/vdif_cd.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/vdif_cd.F	(revision 1315)
@@ -55,4 +55,5 @@
       DATA firstcal/.true./
       SAVE b,c,d,karman,c2b,c3bc,c3b,firstcal,umin2
+!$OMP THREADPRIVATE(b,c,d,karman,c2b,c3bc,c3b,firstcal,umin2)
 
 c-----------------------------------------------------------------------
Index: /trunk/LMDZ.GENERIC/libf/phystd/vdifc.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/vdifc.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/vdifc.F	(revision 1315)
@@ -96,4 +96,5 @@
       LOGICAL firstcall
       SAVE firstcall
+!$OMP THREADPRIVATE(firstcall)
       
       LOGICAL lastcall
@@ -105,4 +106,5 @@
 !     REAL acond,bcond
 !     SAVE acond,bcond
+!!$OMP THREADPRIVATE(acond,bcond)
 !     DATA latcond,tcond1mb/5.9e5,136.27/
 
@@ -132,4 +134,5 @@
       integer ivap, iice ! also make liq for clarity on surface...
       save ivap, iice
+!$OMP THREADPRIVATE(ivap,iice)
 
       real, parameter :: karman=0.4
Index: /trunk/LMDZ.GENERIC/libf/phystd/watercommon_h.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/watercommon_h.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/watercommon_h.F90	(revision 1315)
@@ -19,4 +19,5 @@
 
       real, save :: epsi, RCPD, RCPV, RV, RVTMP2
+!$OMP THREADPRIVATE(epsi,RCPD,RCPV,RV,RVTMP2)
       
       contains
Index: /trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F	(revision 1315)
@@ -68,4 +68,5 @@
 
       real*4,save :: date
+!$OMP THREADPRIVATE(date)
 
       REAL phis(ip1jmp1)
@@ -78,7 +79,9 @@
       integer,save :: zitau=0
       character(len=20),save :: firstnom='1234567890'
+!$OMP THREADPRIVATE(zitau,firstnom)
 
 ! Ajouts
       integer, save :: ntime=0
+!$OMP THREADPRIVATE(ntime)
       integer :: idim,varid
       integer :: nid
@@ -95,4 +98,5 @@
       character(len=120),save :: nom_def(n_nom_def_max)
       logical,save :: firstcall=.true.
+!$OMP THREADPRIVATE(firstcall) 	!diagfi_def,n_nom_def,nom_def read in diagfi.def
       
 #ifndef MESOSCALE
@@ -128,4 +132,5 @@
          firstcall=.false.
 
+!$OMP MASTER
   !      Open diagfi.def definition file if there is one:
          open(99,file="diagfi.def",status='old',form='formatted',
@@ -151,4 +156,6 @@
             diagfi_def=.false.
          endif
+!$OMP END MASTER
+!$OMP BARRIER
       END IF ! of IF (firstcall)
 
Index: /trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90	(revision 1315)
@@ -46,4 +46,5 @@
 character(len=20),save :: firstname="1234567890"
 integer,save :: zitau=0
+!$OMP THREADPRIVATE(date,isample,ntime,firstname,zitau)
 
 character(len=30) :: filename="diagsoil.nc"
Index: /trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F	(revision 1315)
@@ -91,7 +91,9 @@
       data firstnom /'1234567890'/
       data zitau /0/
+!$OMP THREADPRIVATE(firstnom,zitau,date)
 
 ! Ajouts
       integer, save :: ntime=0
+!$OMP THREADPRIVATE(ntime)
       integer :: idim,varid
       integer :: nid
Index: /trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F	(revision 1315)
@@ -91,7 +91,9 @@
       data firstnom /'1234567890'/
       data zitau /0/
+!$OMP THREADPRIVATE(firstnom,zitau,date)
 
 ! Ajouts
       integer, save :: ntime=0
+!$OMP THREADPRIVATE(ntime)
       integer :: idim,varid
       integer :: nid
Index: /trunk/LMDZ.GENERIC/libf/phystd/wstats.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/wstats.F90	(revision 1314)
+++ /trunk/LMDZ.GENERIC/libf/phystd/wstats.F90	(revision 1315)
@@ -22,4 +22,5 @@
 character (len=50) :: namebis
 character (len=50), save :: firstvar
+!$OMP THREADPRIVATE(firstvar)
 integer :: ierr,varid,nbdim,nid
 integer :: meanid,sdid
@@ -30,4 +31,5 @@
 
 integer, save :: step=0
+!$OMP THREADPRIVATE(firstcall,indx,step)
 
 ! Added to work in parallel mode
