Index: trunk/LMDZ.MARS/libf/aeronomars/inichim_newstart.F90
===================================================================
--- trunk/LMDZ.MARS/libf/aeronomars/inichim_newstart.F90	(revision 1917)
+++ trunk/LMDZ.MARS/libf/aeronomars/inichim_newstart.F90	(revision 1918)
@@ -5,4 +5,5 @@
       USE vertical_layers_mod, ONLY: aps,bps
       USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev
+      USE datafile_mod, ONLY: datadir
       implicit none
 
@@ -36,5 +37,4 @@
 
       include "callkeys.h"
-      include "datafile.h"
 
 ! inputs :
@@ -454,9 +454,9 @@
 ! 2.1 open initialization files
 
-      open(210, iostat=ierr,file=trim(datafile)//'/atmosfera_LMD_may.dat')
+      open(210, iostat=ierr,file=trim(datadir)//'/atmosfera_LMD_may.dat')
       if (ierr /= 0) then
          write(*,*)'Error : cannot open file atmosfera_LMD_may.dat '
          write(*,*)'(in aeronomars/inichim_newstart.F)'
-         write(*,*)'It should be in :', trim(datafile),'/'
+         write(*,*)'It should be in :', trim(datadir),'/'
          write(*,*)'1) You can change this path in callphys.def with'
          write(*,*)'   datadir=/path/to/datafiles/'
@@ -466,9 +466,9 @@
          stop
       end if
-      open(220, iostat=ierr,file=trim(datafile)//'/atmosfera_LMD_min.dat')
+      open(220, iostat=ierr,file=trim(datadir)//'/atmosfera_LMD_min.dat')
       if (ierr /= 0) then
          write(*,*)'Error : cannot open file atmosfera_LMD_min.dat '
          write(*,*)'(in aeronomars/inichim_newstart.F)'
-         write(*,*)'It should be in :', trim(datafile),'/'
+         write(*,*)'It should be in :', trim(datadir),'/'
          write(*,*)'1) You can change this path in callphys.def with'
          write(*,*)'   datadir=/path/to/datafiles/'
@@ -479,11 +479,11 @@
       end if
       if(flagnitro) then
-         open(230, iostat=ierr,file=trim(datafile)//'/atmosfera_LMD_nitr.dat')
+         open(230, iostat=ierr,file=trim(datadir)//'/atmosfera_LMD_nitr.dat')
          if (ierr.ne.0) then
             write(*,*)'Error : cannot open file atmosfera_LMD_nitr.dat '
             write(*,*)'(in aeronomars/inichim_newstart.F)'
-            write(*,*)'It should be in :', datafile
-            write(*,*)'1) You can change this directory address in '
-            write(*,*)'   file phymars/datafile.h'
+            write(*,*)'It should be in :', trim(datadir),'/'
+            write(*,*)'1) You can change this path in callphys.def with'
+            write(*,*)'   datadir=/path/to/datafiles/'
             write(*,*)'2) If necessary atmosfera_LMD_nitr.dat (and others)'
             write(*,*)'   can be obtained online on:'
Index: trunk/LMDZ.MARS/libf/aeronomars/param_read.F
===================================================================
--- trunk/LMDZ.MARS/libf/aeronomars/param_read.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/aeronomars/param_read.F	(revision 1918)
@@ -14,10 +14,8 @@
      .    fluxtop,ct1,ct2,p1,p2
 
+      use datafile_mod, only: datadir
+      
       implicit none
 
-
-c     common variables and constants
-      include 'datafile.h'
- 
  
 c     local variables
@@ -34,11 +32,11 @@
       !Tabulated column amount
       open(210, status = 'old',
-c    $file=trim(datafile)//'/EUVDAT/coln.dat',iostat=ierr)
-     $file=trim(datafile)//'/EUVDAT/param_v5/coln.dat',iostat=ierr)
+c    $file=trim(datadir)//'/EUVDAT/coln.dat',iostat=ierr)
+     $file=trim(datadir)//'/EUVDAT/param_v5/coln.dat',iostat=ierr)
 
       IF (ierr.NE.0) THEN 
        write(*,*)'cant find directory EUVDAT containing param_v5 subdir'
        write(*,*)'(in aeronomars/param_read.F)'
-       write(*,*)'It should be in :', trim(datafile),'/'
+       write(*,*)'It should be in :', trim(datadir),'/'
        write(*,*)'1) You can change this directory address in '
        write(*,*)'   callphys.def with datadir=/path/to/dir'
@@ -50,30 +48,30 @@
  
       !Tabulated photoabsorption coefficients
-      open(220,file=trim(datafile)//'/EUVDAT/param_v5/j2_an.dat')
-      open(230,file=trim(datafile)//'/EUVDAT/param_v5/j3_an.dat')
-      open(240,file=trim(datafile)//'/EUVDAT/param_v5/j1_an.dat')
-      open(250,file=trim(datafile)//'/EUVDAT/param_v5/j2_bn.dat')
-      open(260,file=trim(datafile)//'/EUVDAT/param_v5/j2_cn.dat')
-      open(300,file=trim(datafile)//'/EUVDAT//param_v5/j2_dn.dat')
-      open(270,file=trim(datafile)//'/EUVDAT//param_v5/j1_bn.dat')
-      open(280,file=trim(datafile)//'/EUVDAT//param_v5/j1_cn.dat')
-      open(290,file=trim(datafile)//'/EUVDAT//param_v5/j1_dn.dat')
-      open(150,file=trim(datafile)//'/EUVDAT//param_v5/j4n.dat')
-      open(160,file=trim(datafile)//'/EUVDAT//param_v5/j5n.dat')
-      open(170,file=trim(datafile)//'/EUVDAT//param_v5/j6n.dat')
-      open(180,file=trim(datafile)//'/EUVDAT//param_v5/j7n.dat')
-      open(390,file=trim(datafile)//'/EUVDAT//param_v5/j8_an.dat')
-      open(400,file=trim(datafile)//'/EUVDAT//param_v5/j8_bn.dat')
-      open(410,file=trim(datafile)//'/EUVDAT//param_v5/j9n.dat')
-      open(420,file=trim(datafile)//'/EUVDAT//param_v5/j10_an.dat')
-      open(430,file=trim(datafile)//'/EUVDAT//param_v5/j10_bn.dat')
-      open(440,file=trim(datafile)//'/EUVDAT//param_v5/j10_cn.dat')
-      open(450,file=trim(datafile)//'/EUVDAT//param_v5/j11_an.dat')
-      open(460,file=trim(datafile)//'/EUVDAT//param_v5/j11_bn.dat')
-      open(470,file=trim(datafile)//'/EUVDAT//param_v5/j11_cn.dat')
-      open(480,file=trim(datafile)//'/EUVDAT//param_v5/j12n.dat')
-      open(490,file=trim(datafile)//'/EUVDAT//param_v5/j13_an.dat')
-      open(500,file=trim(datafile)//'/EUVDAT//param_v5/j13_bn.dat')
-      open(510,file=trim(datafile)//'/EUVDAT//param_v5/j13_cn.dat')
+      open(220,file=trim(datadir)//'/EUVDAT/param_v5/j2_an.dat')
+      open(230,file=trim(datadir)//'/EUVDAT/param_v5/j3_an.dat')
+      open(240,file=trim(datadir)//'/EUVDAT/param_v5/j1_an.dat')
+      open(250,file=trim(datadir)//'/EUVDAT/param_v5/j2_bn.dat')
+      open(260,file=trim(datadir)//'/EUVDAT/param_v5/j2_cn.dat')
+      open(300,file=trim(datadir)//'/EUVDAT//param_v5/j2_dn.dat')
+      open(270,file=trim(datadir)//'/EUVDAT//param_v5/j1_bn.dat')
+      open(280,file=trim(datadir)//'/EUVDAT//param_v5/j1_cn.dat')
+      open(290,file=trim(datadir)//'/EUVDAT//param_v5/j1_dn.dat')
+      open(150,file=trim(datadir)//'/EUVDAT//param_v5/j4n.dat')
+      open(160,file=trim(datadir)//'/EUVDAT//param_v5/j5n.dat')
+      open(170,file=trim(datadir)//'/EUVDAT//param_v5/j6n.dat')
+      open(180,file=trim(datadir)//'/EUVDAT//param_v5/j7n.dat')
+      open(390,file=trim(datadir)//'/EUVDAT//param_v5/j8_an.dat')
+      open(400,file=trim(datadir)//'/EUVDAT//param_v5/j8_bn.dat')
+      open(410,file=trim(datadir)//'/EUVDAT//param_v5/j9n.dat')
+      open(420,file=trim(datadir)//'/EUVDAT//param_v5/j10_an.dat')
+      open(430,file=trim(datadir)//'/EUVDAT//param_v5/j10_bn.dat')
+      open(440,file=trim(datadir)//'/EUVDAT//param_v5/j10_cn.dat')
+      open(450,file=trim(datadir)//'/EUVDAT//param_v5/j11_an.dat')
+      open(460,file=trim(datadir)//'/EUVDAT//param_v5/j11_bn.dat')
+      open(470,file=trim(datadir)//'/EUVDAT//param_v5/j11_cn.dat')
+      open(480,file=trim(datadir)//'/EUVDAT//param_v5/j12n.dat')
+      open(490,file=trim(datadir)//'/EUVDAT//param_v5/j13_an.dat')
+      open(500,file=trim(datadir)//'/EUVDAT//param_v5/j13_bn.dat')
+      open(510,file=trim(datadir)//'/EUVDAT//param_v5/j13_cn.dat')
 
       
@@ -228,5 +226,5 @@
 
       !Parameters for the variation of the solar flux with 11 years cycle
-      open(100,file=trim(datafile)//'/EUVDAT/param_v5/varflujo.dat')
+      open(100,file=trim(datadir)//'/EUVDAT/param_v5/varflujo.dat')
       read(100,*)
       do i=1,24
@@ -266,5 +264,5 @@
 c     CO2, O2, NO
 
-      open(120,file=trim(datafile)//'/EUVDAT/param_v5/efdis_inter.dat')
+      open(120,file=trim(datadir)//'/EUVDAT/param_v5/efdis_inter.dat')
       read(120,*)
 !      do i=1,21
Index: trunk/LMDZ.MARS/libf/aeronomars/param_read_e107.F
===================================================================
--- trunk/LMDZ.MARS/libf/aeronomars/param_read_e107.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/aeronomars/param_read_e107.F	(revision 1918)
@@ -16,9 +16,10 @@
      .    fluxtop,ct1,ct2,p1,p2
 
+      use datafile_mod, only: datadir
+
       implicit none
 
 
 c     common variables and constants
-      include 'datafile.h'
       include "callkeys.h"
  
@@ -39,11 +40,11 @@
       !Tabulated column amount
       open(210, status = 'old',
-c    $file=trim(datafile)//'/EUVDAT/coln.dat',iostat=ierr)
-     $file=trim(datafile)//'/EUVDAT/param_v6/coln.dat',iostat=ierr)
+c    $file=trim(datadir)//'/EUVDAT/coln.dat',iostat=ierr)
+     $file=trim(datadir)//'/EUVDAT/param_v6/coln.dat',iostat=ierr)
 
       IF (ierr.NE.0) THEN 
        write(*,*)'cant find directory EUVDAT containing param_v6 subdir'
        write(*,*)'(in aeronomars/param_read.F)'
-       write(*,*)'It should be in :', trim(datafile),'/'
+       write(*,*)'It should be in :', trim(datadir),'/'
        write(*,*)'1) You can change this directory address in '
        write(*,*)'   callphys.def with datadir=/path/to/dir'
@@ -55,30 +56,30 @@
  
       !Tabulated photoabsorption coefficients
-      open(220,file=trim(datafile)//'/EUVDAT/param_v6/trans2_an.dat')
-      open(230,file=trim(datafile)//'/EUVDAT/param_v6/trans3_an.dat')
-      open(240,file=trim(datafile)//'/EUVDAT/param_v6/trans1_an.dat')
-      open(250,file=trim(datafile)//'/EUVDAT/param_v6/trans2_bn.dat')
-      open(260,file=trim(datafile)//'/EUVDAT/param_v6/trans2_cn.dat')
-      open(300,file=trim(datafile)//'/EUVDAT/param_v6/trans2_dn.dat')
-      open(270,file=trim(datafile)//'/EUVDAT/param_v6/trans1_bn.dat')
-      open(280,file=trim(datafile)//'/EUVDAT/param_v6/trans1_cn.dat')
-      open(290,file=trim(datafile)//'/EUVDAT/param_v6/trans1_dn.dat')
-      open(150,file=trim(datafile)//'/EUVDAT/param_v6/trans4n.dat')
-      open(160,file=trim(datafile)//'/EUVDAT/param_v6/trans5n.dat')
-      open(170,file=trim(datafile)//'/EUVDAT/param_v6/trans6n.dat')
-      open(180,file=trim(datafile)//'/EUVDAT/param_v6/trans7n.dat')
-      open(390,file=trim(datafile)//'/EUVDAT/param_v6/trans8_an.dat')
-      open(400,file=trim(datafile)//'/EUVDAT/param_v6/trans8_bn.dat')
-      open(410,file=trim(datafile)//'/EUVDAT/param_v6/trans9n.dat')
-      open(420,file=trim(datafile)//'/EUVDAT/param_v6/trans10_an.dat')
-      open(430,file=trim(datafile)//'/EUVDAT/param_v6/trans10_bn.dat')
-      open(440,file=trim(datafile)//'/EUVDAT/param_v6/trans10_cn.dat')
-      open(450,file=trim(datafile)//'/EUVDAT/param_v6/trans11_an.dat')
-      open(460,file=trim(datafile)//'/EUVDAT/param_v6/trans11_bn.dat')
-      open(470,file=trim(datafile)//'/EUVDAT/param_v6/trans11_cn.dat')
-      open(480,file=trim(datafile)//'/EUVDAT/param_v6/trans12n.dat')
-      open(490,file=trim(datafile)//'/EUVDAT/param_v6/trans13_an.dat')
-      open(500,file=trim(datafile)//'/EUVDAT/param_v6/trans13_bn.dat')
-      open(510,file=trim(datafile)//'/EUVDAT/param_v6/trans13_cn.dat')
+      open(220,file=trim(datadir)//'/EUVDAT/param_v6/trans2_an.dat')
+      open(230,file=trim(datadir)//'/EUVDAT/param_v6/trans3_an.dat')
+      open(240,file=trim(datadir)//'/EUVDAT/param_v6/trans1_an.dat')
+      open(250,file=trim(datadir)//'/EUVDAT/param_v6/trans2_bn.dat')
+      open(260,file=trim(datadir)//'/EUVDAT/param_v6/trans2_cn.dat')
+      open(300,file=trim(datadir)//'/EUVDAT/param_v6/trans2_dn.dat')
+      open(270,file=trim(datadir)//'/EUVDAT/param_v6/trans1_bn.dat')
+      open(280,file=trim(datadir)//'/EUVDAT/param_v6/trans1_cn.dat')
+      open(290,file=trim(datadir)//'/EUVDAT/param_v6/trans1_dn.dat')
+      open(150,file=trim(datadir)//'/EUVDAT/param_v6/trans4n.dat')
+      open(160,file=trim(datadir)//'/EUVDAT/param_v6/trans5n.dat')
+      open(170,file=trim(datadir)//'/EUVDAT/param_v6/trans6n.dat')
+      open(180,file=trim(datadir)//'/EUVDAT/param_v6/trans7n.dat')
+      open(390,file=trim(datadir)//'/EUVDAT/param_v6/trans8_an.dat')
+      open(400,file=trim(datadir)//'/EUVDAT/param_v6/trans8_bn.dat')
+      open(410,file=trim(datadir)//'/EUVDAT/param_v6/trans9n.dat')
+      open(420,file=trim(datadir)//'/EUVDAT/param_v6/trans10_an.dat')
+      open(430,file=trim(datadir)//'/EUVDAT/param_v6/trans10_bn.dat')
+      open(440,file=trim(datadir)//'/EUVDAT/param_v6/trans10_cn.dat')
+      open(450,file=trim(datadir)//'/EUVDAT/param_v6/trans11_an.dat')
+      open(460,file=trim(datadir)//'/EUVDAT/param_v6/trans11_bn.dat')
+      open(470,file=trim(datadir)//'/EUVDAT/param_v6/trans11_cn.dat')
+      open(480,file=trim(datadir)//'/EUVDAT/param_v6/trans12n.dat')
+      open(490,file=trim(datadir)//'/EUVDAT/param_v6/trans13_an.dat')
+      open(500,file=trim(datadir)//'/EUVDAT/param_v6/trans13_bn.dat')
+      open(510,file=trim(datadir)//'/EUVDAT/param_v6/trans13_cn.dat')
 
       
@@ -233,5 +234,5 @@
 
       !Parameters for the variation of the solar flux with 11 years cycle
-      open(620,file=trim(datafile)//'/EUVDAT/param_v6/fit_js_e107.dat')
+      open(620,file=trim(datadir)//'/EUVDAT/param_v6/fit_js_e107.dat')
       do i=1,ninter
          read(620,*)
@@ -274,5 +275,5 @@
       endif
       
-      open(640,file=trim(datafile)//'/EUVDAT/param_v6/'//filename)
+      open(640,file=trim(datadir)//'/EUVDAT/param_v6/'//filename)
       read(640,*)
       do i=1,669
@@ -316,5 +317,5 @@
 c     CO2, O2, NO
 
-!      open(120,file=trim(datafile)//'/EUVDAT/param_v5/efdis_inter.dat')
+!      open(120,file=trim(datadir)//'/EUVDAT/param_v5/efdis_inter.dat')
 !      read(120,*)
 !!      do i=1,21
@@ -375,5 +376,5 @@
          
       !4 possible channels for CO2 ionization
-      open(130,file=trim(datafile)//'/EUVDAT'//
+      open(130,file=trim(datadir)//'/EUVDAT'//
      $     '/co2ion_branchingratio_schunkandnagy2000_param.dat')
       do inter=1,16
@@ -408,5 +409,5 @@
 
       !2 possible channels for O2 ionization
-      open(131,file=trim(datafile)//'/EUVDAT'//
+      open(131,file=trim(datadir)//'/EUVDAT'//
      $     '/o2ion_branchingratio_schunkandnagy2000_param.dat')
       do inter=1,23
@@ -430,5 +431,5 @@
 
       !2 channels for N2 ionization
-      open(132,file=trim(datafile)//'/EUVDAT'//
+      open(132,file=trim(datadir)//'/EUVDAT'//
      $     '/n2ion_branchingratio_schunkandnagy2000_param.dat')
       do inter=1,15
@@ -453,5 +454,5 @@
      
       !3 channels for CO ionization
-       open(133,file=trim(datafile)//'/EUVDAT'//
+       open(133,file=trim(datadir)//'/EUVDAT'//
      $     '/coion_branchingratio_schunkandnagy2000_param.dat')
       do inter=1,16
Index: trunk/LMDZ.MARS/libf/aeronomars/read_phototable.F90
===================================================================
--- trunk/LMDZ.MARS/libf/aeronomars/read_phototable.F90	(revision 1917)
+++ trunk/LMDZ.MARS/libf/aeronomars/read_phototable.F90	(revision 1918)
@@ -21,10 +21,10 @@
 !***********************************************************************
 
-      use ioipsl_getincom 
+      use ioipsl_getincom, only: getin
+      use datafile_mod, only: datadir
 
       implicit none
 
-#include "chimiedata.h"
-#include "datafile.h"
+      include "chimiedata.h"
 
 !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
@@ -50,9 +50,9 @@
 
       open(fic, form = 'formatted', status = 'old',                &
-           file =trim(datafile)//"/"//trim(phototable),iostat=ierr)
+           file =trim(datadir)//"/"//trim(phototable),iostat=ierr)
 
       if (ierr /= 0) THEN
         write(*,*)'Error : cannot open photolysis lookup table ', trim(phototable)
-        write(*,*)'It should be in :',trim(datafile),'/'
+        write(*,*)'It should be in :',trim(datadir),'/'
         write(*,*)'1) You can change this directory in callphys.def'
         write(*,*)'   with:'
Index: trunk/LMDZ.MARS/libf/dynlonlat_phylonlat/phymars/datareadnc.F
===================================================================
--- trunk/LMDZ.MARS/libf/dynlonlat_phylonlat/phymars/datareadnc.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/dynlonlat_phylonlat/phymars/datareadnc.F	(revision 1918)
@@ -45,12 +45,12 @@
        use ioipsl_getincom 
       USE comconst_mod, ONLY: g,pi
+      use datafile_mod, only: datadir
 
       implicit none
 
-#include "dimensions.h"
-#include "paramet.h"
-#include "comgeom.h"
-#include "netcdf.inc"
-#include "datafile.h"
+      include "dimensions.h"
+      include "paramet.h"
+      include "comgeom.h"
+      include "netcdf.inc"
 
 c=======================================================================
@@ -113,13 +113,13 @@
       write(*,*) 'datareadnc: opening file surface.nc'
 
-      datafile="/u/lmdz/WWW/planets/mars/datadir" ! default path to surface.nc
-      call getin("datadir",datafile) ! but users may specify another path
+      datadir="/u/lmdz/WWW/planets/mars/datadir" ! default path to surface.nc
+      call getin("datadir",datadir) ! but users may specify another path
       
-      ierr = NF_OPEN (trim(datafile)//'/surface.nc',
+      ierr = NF_OPEN (trim(datadir)//'/surface.nc',
      &  NF_NOWRITE,unit)
       IF (ierr.NE.NF_NOERR) THEN
         write(*,*)'Error : cannot open file surface.nc '
         write(*,*)'(in phymars/datareadnc.F)'
-        write(*,*)'It should be in :',trim(datafile),'/'
+        write(*,*)'It should be in :',trim(datadir),'/'
         write(*,*)'1) You can set this path in the 
      & callphys.def file:'
@@ -210,5 +210,5 @@
       if (ierr.ne.nf_noerr) then
         write(*,*) 'datareadnc error, cannot find ',trim(string(k))
-        write(*,*) ' in file ',trim(datafile),'/surface.nc'
+        write(*,*) ' in file ',trim(datadir),'/surface.nc'
         stop
       endif
Index: trunk/LMDZ.MARS/libf/dynlonlat_phylonlat/phymars/newstart.F
===================================================================
--- trunk/LMDZ.MARS/libf/dynlonlat_phylonlat/phymars/newstart.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/dynlonlat_phylonlat/phymars/newstart.F	(revision 1918)
@@ -51,5 +51,4 @@
 #include "clesph0.h"
 #include "netcdf.inc"
-#include "datafile.h"
 c=======================================================================
 c   Declarations
@@ -1680,11 +1679,13 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       subroutine load_MONS_data(MONS_Hdn,MONS_d21)
+      
+      use datafile_mod, only:datadir
+      
       implicit none
       ! routine to load Benedicte Diez MONS dataset, fill in date in southern
       ! polar region, and interpolate the result onto the GCM grid
-#include"dimensions.h"
-#include"paramet.h"
-#include"datafile.h"
-#include"comgeom.h"
+      include"dimensions.h"
+      include"paramet.h"
+      include"comgeom.h"
       ! arguments:
       real,intent(out) :: MONS_Hdn(iip1,jjp1) ! Hdn: %WEH=Mass fraction of H2O
@@ -1715,12 +1716,13 @@
 
       ! Open MONS datafile:
-      open(42,file=trim(datafile)//"/"//trim(filename),
+      open(42,file=trim(datadir)//"/"//trim(filename),
      &     status="old",iostat=ierr)
       if (ierr/=0) then
         write(*,*) "Error in load_MONS_data:"
         write(*,*) "Failed opening file ",
-     &             trim(datafile)//"/"//trim(filename)
-        write(*,*)'1) You can change the path to the file in '
-        write(*,*)'   file phymars/datafile.h'
+     &             trim(datadir)//"/"//trim(filename)
+        write(*,*)'1) You can change this directory address in ',
+     &            'callfis.def with'
+        write(*,*)'   datadir=/path/to/datafiles'
         write(*,*)'2) If necessary ',trim(filename),
      &                 ' (and other datafiles)'
Index: trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/datareadnc.F
===================================================================
--- trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/datareadnc.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/datareadnc.F	(revision 1918)
@@ -42,15 +42,14 @@
 c=======================================================================
 
-! to use  'getin'
-       use ioipsl_getincom 
+      use ioipsl_getincom, only: getin
       USE comconst_mod, ONLY: g,pi
+      use datafile_mod, only: datadir
 
       implicit none
 
-#include "dimensions.h"
-#include "paramet.h"
-#include "comgeom.h"
-#include "netcdf.inc"
-#include "datafile.h"
+      include "dimensions.h"
+      include "paramet.h"
+      include "comgeom.h"
+      include "netcdf.inc"
 
 c=======================================================================
@@ -113,13 +112,13 @@
       write(*,*) 'datareadnc: opening file surface.nc'
 
-      datafile="/u/lmdz/WWW/planets/mars/datadir" ! default path to surface.nc
-      call getin("datadir",datafile) ! but users may specify another path
+      datadir="/u/lmdz/WWW/planets/mars/datadir" ! default path to surface.nc
+      call getin("datadir",datadir) ! but users may specify another path
       
-      ierr = NF_OPEN (trim(datafile)//'/surface.nc',
+      ierr = NF_OPEN (trim(datadir)//'/surface.nc',
      &  NF_NOWRITE,unit)
       IF (ierr.NE.NF_NOERR) THEN
         write(*,*)'Error : cannot open file surface.nc '
         write(*,*)'(in phymars/datareadnc.F)'
-        write(*,*)'It should be in :',trim(datafile),'/'
+        write(*,*)'It should be in :',trim(datadir),'/'
         write(*,*)'1) You can set this path in the 
      & callphys.def file:'
@@ -210,5 +209,5 @@
       if (ierr.ne.nf_noerr) then
         write(*,*) 'datareadnc error, cannot find ',trim(string(k))
-        write(*,*) ' in file ',trim(datafile),'/surface.nc'
+        write(*,*) ' in file ',trim(datadir),'/surface.nc'
         stop
       endif
Index: trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F
===================================================================
--- trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F	(revision 1918)
@@ -53,5 +53,4 @@
       include "clesph0.h"
       include "netcdf.inc"
-      include "datafile.h"
 c=======================================================================
 c   Declarations
@@ -1662,11 +1661,13 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       subroutine load_MONS_data(MONS_Hdn,MONS_d21)
+      
+      use datafile_mod, only:datadir
+      
       implicit none
       ! routine to load Benedicte Diez MONS dataset, fill in date in southern
       ! polar region, and interpolate the result onto the GCM grid
-#include"dimensions.h"
-#include"paramet.h"
-#include"datafile.h"
-#include"comgeom.h"
+      include"dimensions.h"
+      include"paramet.h"
+      include"comgeom.h"
       ! arguments:
       real,intent(out) :: MONS_Hdn(iip1,jjp1) ! Hdn: %WEH=Mass fraction of H2O
@@ -1697,12 +1698,13 @@
 
       ! Open MONS datafile:
-      open(42,file=trim(datafile)//"/"//trim(filename),
+      open(42,file=trim(datadir)//"/"//trim(filename),
      &     status="old",iostat=ierr)
       if (ierr/=0) then
         write(*,*) "Error in load_MONS_data:"
         write(*,*) "Failed opening file ",
-     &             trim(datafile)//"/"//trim(filename)
-        write(*,*)'1) You can change the path to the file in '
-        write(*,*)'   file phymars/datafile.h'
+     &             trim(datadir)//"/"//trim(filename)
+        write(*,*)'1) You can change this directory address in ',
+     &            'callfis.def with'
+        write(*,*)'   datadir=/path/to/datafiles'
         write(*,*)'2) If necessary ',trim(filename),
      &                 ' (and other datafiles)'
Index: trunk/LMDZ.MARS/libf/phymars/albedocaps.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/albedocaps.F90	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/albedocaps.F90	(revision 1918)
@@ -90,9 +90,9 @@
 use geometry_mod, only: latitude, longitude ! in radians
 use surfdat_h, only: albedice, TESice_Ncoef, TESice_Scoef
+use datafile_mod, only: datadir
 use netcdf, only: nf90_open, NF90_NOWRITE, NF90_NOERR, &
                   nf90_strerror, nf90_inq_varid, nf90_get_var, nf90_close
                   
 implicit none
-include"datafile.h"
 
 ! arguments:
@@ -151,9 +151,8 @@
 if (firstcall) then
 ! Load TES albedoes for Northern Hemisphere
-  ! Note: datafile() is defined in "datafile.h"
-  ierr=nf90_open(trim(datafile)//"/npsc_albedo.nc",NF90_NOWRITE,nid)
+  ierr=nf90_open(trim(datadir)//"/npsc_albedo.nc",NF90_NOWRITE,nid)
   IF (ierr.NE.NF90_NOERR) THEN
     write(*,*)'Problem opening npsc_albedo.nc (phymars/albedocaps.F90)'
-    write(*,*)'It should be in :',trim(datafile),'/'
+    write(*,*)'It should be in :',trim(datadir),'/'
     write(*,*)'1) You can change this directory address in callfis.def with'
     write(*,*)'   datadir=/path/to/datafiles'
@@ -163,5 +162,5 @@
     CALL ABORT
   ELSE
-    write(*,*) "albedocaps: using file ",trim(datafile)//"/npsc_albedo.nc"
+    write(*,*) "albedocaps: using file ",trim(datadir)//"/npsc_albedo.nc"
   ENDIF
   
@@ -225,8 +224,8 @@
 
 ! Load albedoes for Southern Hemisphere
-  ierr=nf90_open(trim(datafile)//"/spsc_albedo.nc",NF90_NOWRITE,nid)
+  ierr=nf90_open(trim(datadir)//"/spsc_albedo.nc",NF90_NOWRITE,nid)
   IF (ierr.NE.NF90_NOERR) THEN
     write(*,*)'Problem opening spsc_albedo.nc (phymars/albedocaps.F90)'
-    write(*,*)'It should be in :',trim(datafile),'/'
+    write(*,*)'It should be in :',trim(datadir),'/'
     write(*,*)'1) You can change this directory address in callfis.def with'
     write(*,*)'   datadir=/path/to/datafiles'
@@ -236,5 +235,5 @@
     CALL ABORT
   ELSE
-    write(*,*) "albedocaps: using file ",trim(datafile)//"/spsc_albedo.nc"
+    write(*,*) "albedocaps: using file ",trim(datadir)//"/spsc_albedo.nc"
   ENDIF
 
Index: trunk/LMDZ.MARS/libf/phymars/callradite_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/callradite_mod.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/callradite_mod.F	(revision 1918)
@@ -11,5 +11,5 @@
      &     nuice,co2ice,clearsky,totcloudfrac)
 
-      use aeropacity_mod
+      use aeropacity_mod, only: aeropacity
       use dimradmars_mod, only: ndomainsz, nflev, nsun, nir
       use dimradmars_mod, only: naerkind, name_iaer,
@@ -59,5 +59,5 @@
 c   The names of the corresponding ASCII files have to be set in
 c   this subroutine (file_id variable), and files must be in the
-c   directory specified in datafile.h. Please make sure that the
+c   directory specified in datafile_mod. Please make sure that the
 c   ASCII files are correctly written, and that the range
 c   of particle sizes is consistent with what you would expect.
Index: trunk/LMDZ.MARS/libf/phymars/co2cloud.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/co2cloud.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/co2cloud.F	(revision 1918)
@@ -19,7 +19,7 @@
      &     rho_ice_co2,r3n_q,rho_ice,nuice_sed
       USE newsedim_mod, ONLY: newsedim
+      USE datafile_mod, ONLY: datadir
       IMPLICIT NONE
 
-      include "datafile.h"
       include "callkeys.h"
       include "microphys.h"
@@ -248,13 +248,13 @@
 
 c   read the Qext values 
-        INQUIRE(FILE=datafile(1:LEN_TRIM(datafile))//
+        INQUIRE(FILE=TRIM(datadir)//
      &       '/optprop_co2ice_1mic.dat', EXIST=file_ok)
         IF (.not. file_ok) THEN 
            write(*,*) 'file optprop_co2ice_1mic.dat should be in '
-     &          ,datafile
+     &          ,trim(datadir)
            STOP
         endif
-!        open(newunit=uQext,file=trim(datafile)//
-        open(unit=uQext,file=trim(datafile)//
+!        open(newunit=uQext,file=trim(datadir)//
+        open(unit=uQext,file=trim(datadir)//
      &       '/optprop_co2ice_1mic.dat'
      &       ,FORM='formatted')
Index: trunk/LMDZ.MARS/libf/phymars/comorbit.h
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/comorbit.h	(revision 1917)
+++ 	(revision )
@@ -1,12 +1,0 @@
-c-----------------------------------------------------------------------
-c INCLUDE 'comorbit.h'
-
-      COMMON/comorbit/aphelie,periheli,year_day,
-     $       peri_day,timeperi,obliquit,
-     $       e_elips,p_elips,unitastr,pi
-
-      REAL aphelie,periheli,year_day,
-     $  peri_day,timeperi,obliquit,
-     $  e_elips,p_elips,unitastr,pi
-
-c-----------------------------------------------------------------------
Index: trunk/LMDZ.MARS/libf/phymars/conf_phys.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/conf_phys.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/conf_phys.F	(revision 1918)
@@ -41,12 +41,11 @@
       use time_phylmdz_mod, only: ecritphy,day_step,iphysiq,ecritstart,
      &                            daysec,dtphys
-      use planete_h
       use dimradmars_mod, only: naerkind, name_iaer,
      &                      ini_scatterers,tauvis
+      use datafile_mod, only: datadir
 
       IMPLICIT NONE
-#include "callkeys.h"
-#include "datafile.h"
-#include "microphys.h"
+      include "callkeys.h"
+      include "microphys.h"
 
       INTEGER,INTENT(IN) :: ngrid,nlayer,nq
@@ -85,7 +84,7 @@
 
          write(*,*) "Directory where external input files are:"
-         datafile="/u/lmdz/WWW/planets/mars/datadir"
-         call getin("datadir",datafile) ! default path
-         write(*,*) " datafile = ",trim(datafile)
+         ! default path is set in datafile_mod
+         call getin("datadir",datadir) 
+         write(*,*) " datadir = ",trim(datadir)
 
          write(*,*) "Run with or without tracer transport ?"
Index: trunk/LMDZ.MARS/libf/phymars/datafile.h
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/datafile.h	(revision 1917)
+++ 	(revision )
@@ -1,8 +1,0 @@
-!-----------------------------------------------------------------------
-! INCLUDE datafile.h
-
-!  Address of the directory containing tables of data needed by the GCM    
-      COMMON/datadirectory/datafile
-      character (len=300) :: datafile
-! NB: default value for 'datafile' is set in conf_phys.F
-!-----------------------------------------------------------------------
Index: trunk/LMDZ.MARS/libf/phymars/datafile_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/datafile_mod.F90	(revision 1918)
+++ trunk/LMDZ.MARS/libf/phymars/datafile_mod.F90	(revision 1918)
@@ -0,0 +1,11 @@
+!-----------------------------------------------------------------------
+module datafile_mod
+
+implicit none 
+
+! root path to directory containing tables
+! and datasets needed by the GCM
+character(len=300),save :: datadir="/u/lmdz/WWW/planets/mars/datadir" 
+
+end module datafile_mod
+!-----------------------------------------------------------------------
Index: trunk/LMDZ.MARS/libf/phymars/improvedCO2clouds.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/improvedCO2clouds.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/improvedCO2clouds.F	(revision 1918)
@@ -13,4 +13,5 @@
      &                      rho_ice_co2
       use conc_mod, only: mmean
+      use datafile_mod, only: datadir
 
       implicit none
@@ -55,5 +56,4 @@
       include "callkeys.h"
       include "microphys.h"
-      include "datafile.h"
 c------------------------------------------------------------------
 c     Arguments:
@@ -247,14 +247,14 @@
            ! Initialisation of the flux: it is constant and is it saved
            !We must interpolate the table to the GCM pressures
-           INQUIRE(FILE=datafile(1:LEN_TRIM(datafile))//
+           INQUIRE(FILE=TRIM(datadir)//
      &       '/Meteo_flux_Plane.dat', EXIST=file_ok)
            IF (.not. file_ok) THEN 
               write(*,*) 'file Meteo_flux_Plane.dat should be in '
-     &             ,datafile
+     &             ,trim(datadir)
               STOP
            endif
 !used Variables
-!           open(newunit=uMeteor,file=trim(datafile)//
-           open(unit=uMeteor,file=trim(datafile)//
+!           open(newunit=uMeteor,file=trim(datadir)//
+           open(unit=uMeteor,file=trim(datadir)//
      &          '/Meteo_flux_Plane.dat'
      &          ,FORM='formatted')
Index: trunk/LMDZ.MARS/libf/phymars/nir_leedat.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/nir_leedat.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/nir_leedat.F	(revision 1918)
@@ -7,7 +7,8 @@
 c***********************************************************************
 
+      use datafile_mod, only: datadir
+
       implicit none                                  
                                                 
-      include 'datafile.h'
       include 'nirdata.h'
                                                 
@@ -20,5 +21,5 @@
 c***********************************************************************
 
-      open(43,file=trim(datafile)//'/NIRcorrection_feb2011.dat',
+      open(43,file=trim(datadir)//'/NIRcorrection_feb2011.dat',
      $       status='old')         
       do ind=1,9
Index: trunk/LMDZ.MARS/libf/phymars/nlte_calc.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/nlte_calc.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/nlte_calc.F	(revision 1918)
@@ -31,5 +31,4 @@
       implicit none
 
-      include 'datafile.h'
       include 'nlte_paramdef.h'
       include 'nlte_commons.h'
@@ -228,5 +227,4 @@
       implicit none
 
-      include 'datafile.h'
       include 'nlte_paramdef.h'
       include 'nlte_commons.h'
@@ -793,5 +791,4 @@
       implicit none
 
-      include 'datafile.h'
       include 'nlte_paramdef.h'
       include 'nlte_commons.h'
@@ -1318,5 +1315,4 @@
       implicit none
 
-      include 'datafile.h'
       include 'nlte_paramdef.h'
       include 'nlte_commons.h'
@@ -1585,5 +1581,4 @@
       implicit none
 
-      include 'datafile.h'
       include 'nlte_paramdef.h'
       include 'nlte_commons.h'
Index: trunk/LMDZ.MARS/libf/phymars/nlte_setup.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/nlte_setup.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/nlte_setup.F	(revision 1918)
@@ -17,7 +17,8 @@
 c***********************************************************************
 
+      use datafile_mod, only: datadir
+      
       implicit none
 
-      include   'datafile.h'
       include	'nlte_paramdef.h'
       include	'nlte_commons.h'
@@ -49,8 +50,8 @@
          write (isotcode,132) indexisot(k)
          open (lun1,
-     $        file=trim(datafile)//'/NLTEDAT/enelow'
+     $        file=trim(datadir)//'/NLTEDAT/enelow'
      $        //isotcode//'.dat',status='old')
          open (lun2,
-     $        file=trim(datafile)//'/NLTEDAT/deltanu'
+     $        file=trim(datadir)//'/NLTEDAT/deltanu'
      $        //isotcode//'.dat',status='old')
          read (lun1,*)
@@ -71,5 +72,5 @@
 c     *** Old LeeESCTVCISO_dlvr11 ***
 
-      open( 11, file=trim(datafile)//
+      open( 11, file=trim(datadir)//
      $     '/NLTEDAT/parametp_Tstar_IAA1204.dat' )
       read (11, *)
@@ -80,5 +81,5 @@
       close (11)
 
-      open( 12, file=trim(datafile)//
+      open( 12, file=trim(datadir)//
      $     '/NLTEDAT/parametp_VC_IAA1204.dat' )
       read (12, *)
@@ -104,7 +105,8 @@
 c***********************************************************************
 
+      use datafile_mod, only: datadir
+
       implicit none
 
-      include 'datafile.h'
       include	'nlte_paramdef.h'
       include	'nlte_commons.h'
@@ -119,5 +121,5 @@
                                 ! Banda fundamental 
                                 !
-      hisfile = trim(datafile)//
+      hisfile = trim(datadir)//
      $     '/NLTEDAT/hid26-1.dat'
       ihist = 1
@@ -127,15 +129,15 @@
                                 ! First Hot bands	
                                 !     
-      hisfile = trim(datafile)//
+      hisfile = trim(datadir)//
      $     '/NLTEDAT/hid26-2.dat'
       ihist = 2
       call rhist_03 (ihist)
 
-      hisfile = trim(datafile)//
+      hisfile = trim(datadir)//
      $     '/NLTEDAT/hid26-3.dat'
       ihist = 3
       call rhist_03 (ihist)
 
-      hisfile = trim(datafile)//
+      hisfile = trim(datadir)//
      $     '/NLTEDAT/hid26-4.dat'
       ihist = 4
Index: trunk/LMDZ.MARS/libf/phymars/read_dust_scenario.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/read_dust_scenario.F90	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/read_dust_scenario.F90	(revision 1918)
@@ -5,7 +5,7 @@
 use netcdf
 use geometry_mod, only: latitude, longitude ! in radians
+use datafile_mod, only: datadir
 implicit none
 
-include "datafile.h"
 include "callkeys.h"
 
@@ -92,10 +92,8 @@
    endif
    
-   ! Note: datafile() is defined in "datafile.h"
-   !ierr=NF_OPEN(trim(datafile)//"/"//trim(filename),NF_NOWRITE,nid)
-   ierr=nf90_open(trim(datafile)//"/"//trim(filename),NF90_NOWRITE,nid)
+   ierr=nf90_open(trim(datadir)//"/"//trim(filename),NF90_NOWRITE,nid)
    IF (ierr.NE.nf90_noerr) THEN
      write(*,*)'Problem opening ',trim(filename),' (in phymars/read_dust_scenario.F90)'
-     write(*,*)'It should be in :',trim(datafile),'/'
+     write(*,*)'It should be in :',trim(datadir),'/'
      write(*,*)'1) You can change this directory address in callfis.def with'
      write(*,*)'   datadir=/path/to/datafiles'
Index: trunk/LMDZ.MARS/libf/phymars/suaer.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/suaer.F90	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/suaer.F90	(revision 1918)
@@ -11,4 +11,5 @@
                     omegaREFvis, omegaREFir, &
                     nsize
+use datafile_mod, only: datadir
 IMPLICIT NONE
 !==================================================================
@@ -43,6 +44,5 @@
 ! Includes:
 
-#include "callkeys.h"
-#include "datafile.h"
+include "callkeys.h"
 
 ! Optical properties (read in external ASCII files)
@@ -188,16 +188,16 @@
 !       1.1 Open the ASCII file
 
-INQUIRE(FILE=datafile(1:LEN_TRIM(datafile))//&
-  '/'//file_id(iaer,idomain)(1:LEN_TRIM(file_id(iaer,idomain))),&
+INQUIRE(FILE=TRIM(datadir)//&
+  '/'//TRIM(file_id(iaer,idomain)),&
   EXIST=file_ok)
 IF(.NOT.file_ok) THEN
   write(*,*)'Problem opening ',&
-    file_id(iaer,idomain)(1:LEN_TRIM(file_id(iaer,idomain)))
+    TRIM(file_id(iaer,idomain))
   write(*,*)'It should be in: ',&
-    datafile(1:LEN_TRIM(datafile))
-  write(*,*)'1) You can change this directory address in '
-  write(*,*)' file phymars/datafile.h'
+    TRIM(datadir)
+  write(*,*)'1) You can change this directory address in callfis.def with'
+  write(*,*)'   datadir=/path/to/datafiles'
   write(*,*)'2) If ',&
-    file_id(iaer,idomain)(1:LEN_TRIM(file_id(iaer,idomain))),&
+    TRIM(file_id(iaer,idomain)),&
     ' is a LMD reference datafile, it'
   write(*,*)' can be obtained online on:'
@@ -210,6 +210,6 @@
 ENDIF
 OPEN(UNIT=file_unit,&
-  FILE=datafile(1:LEN_TRIM(datafile))//&
-  '/'//file_id(iaer,idomain)(1:LEN_TRIM(file_id(iaer,idomain))),&
+  FILE=TRIM(datadir)//&
+  '/'//TRIM(file_id(iaer,idomain)),&
   FORM='formatted')
 
@@ -222,6 +222,6 @@
   if (read_ok.ne.0) then
     write(*,*)' readoptprop: Error reading file',&
-    trim(datafile(1:LEN_TRIM(datafile))//&
-    '/'//file_id(iaer,idomain)(1:LEN_TRIM(file_id(iaer,idomain))))
+    TRIM(datadir)//&
+    '/'//TRIM(file_id(iaer,idomain))
     call abort
   endif
@@ -236,6 +236,6 @@
           trim(scanline)
           write(*,*)'   of file',&
-          trim(datafile(1:LEN_TRIM(datafile))//&
-          '/'//file_id(iaer,idomain)(1:LEN_TRIM(file_id(iaer,idomain))))
+          TRIM(datadir)//&
+          '/'//TRIM(file_id(iaer,idomain))
           call abort
         endif
@@ -247,6 +247,6 @@
           trim(scanline)
           write(*,*)'   of file',&
-          trim(datafile(1:LEN_TRIM(datafile))//&
-          '/'//file_id(iaer,idomain)(1:LEN_TRIM(file_id(iaer,idomain))))
+          TRIM(datadir)//&
+          '/'//TRIM(file_id(iaer,idomain))
           call abort
         endif
Index: trunk/LMDZ.MARS/libf/phymars/surfini.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/surfini.F	(revision 1917)
+++ trunk/LMDZ.MARS/libf/phymars/surfini.F	(revision 1918)
@@ -1,5 +1,5 @@
       SUBROUTINE surfini(ngrid,piceco2,qsurf,psolaralb)
-   ! to use  'getin'
-      USE ioipsl_getincom
+
+      USE ioipsl_getincom, only: getin
       use netcdf
       use tracer_mod, only: nqmx, noms
@@ -14,4 +14,5 @@
       USE comcstfi_h
       use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat
+      use datafile_mod, only: datadir
       IMPLICIT NONE
 c=======================================================================
@@ -23,6 +24,5 @@
 c   Declarations:
 c   -------------
-#include "callkeys.h"
-#include "datafile.h"
+      include "callkeys.h"
 
       integer,intent(in) :: ngrid ! number of atmospheric columns
@@ -173,5 +173,5 @@
 
            
-         zedatafile = trim(datafile)
+         zedatafile = trim(datadir)
  
         
