Index: LMDZ5/branches/testing/libf/phydev/physiq.F90
===================================================================
--- LMDZ5/branches/testing/libf/phydev/physiq.F90	(revision 1707)
+++ LMDZ5/branches/testing/libf/phydev/physiq.F90	(revision 1795)
@@ -75,4 +75,5 @@
 integer,save :: iwrite_phys ! output every iwrite_phys physics step
 !$OMP THREADPRIVATE(iwrite_phys)
+integer :: iwrite_phys_omp ! intermediate variable to read iwrite_phys
 real :: t_ops ! frequency of the IOIPSL operations (eg average over...)
 real :: t_wrt ! frequency of the IOIPSL outputs
@@ -86,6 +87,11 @@
 ! Initialize outputs:
   itau0=0
-  iwrite_phys=1 !default: output every physics timestep
-  call getin("iwrite_phys",iwrite_phys)
+!$OMP MASTER
+  iwrite_phys_omp=1 !default: output every physics timestep
+  ! NB: getin() is not threadsafe; only one thread should call it.
+  call getin("iwrite_phys",iwrite_phys_omp)
+!$OMP END MASTER
+!$OMP BARRIER
+  iwrite_phys=iwrite_phys_omp
   t_ops=pdtphys*iwrite_phys ! frequency of the IOIPSL operation
   t_wrt=pdtphys*iwrite_phys ! frequency of the outputs in the file
