Index: codes/icosagcm/trunk/src/disvert.f90
===================================================================
--- codes/icosagcm/trunk/src/disvert.f90	(revision 165)
+++ codes/icosagcm/trunk/src/disvert.f90	(revision 166)
@@ -10,4 +10,5 @@
   INTEGER, SAVE :: caldyn_eta
   INTEGER, PARAMETER :: eta_mass=1, eta_lag=2
+  LOGICAL,SAVE :: ap_bp_present
 
 CONTAINS
@@ -22,10 +23,30 @@
   USE mpipara
   IMPLICIT NONE
-    CHARACTER(LEN=255) :: disvert_type = 'std'
+    CHARACTER(len=255) :: def
     INTEGER :: l
 
-    CALL getin("disvert",disvert_type)
-    
-    SELECT CASE (TRIM(disvert_type))
+    def='eta_mass'
+    CALL getin('caldyn_eta',def)
+    SELECT CASE(TRIM(def))
+    CASE('eta_mass')
+       caldyn_eta=eta_mass
+    CASE('eta_lag')
+       caldyn_eta=eta_lag
+    CASE DEFAULT
+       IF (is_mpi_root) PRINT *,'Bad selector for variable caldyn_eta : <', TRIM(def),'> options are <eta_mass>, <eta_lag>'
+       STOP
+    END SELECT
+    IF (is_mpi_root) PRINT *, 'caldyn_eta=',TRIM(def), caldyn_eta, eta_lag, eta_mass
+
+    def='std'
+    ap_bp_present=.TRUE.
+    CALL getin("disvert",def)
+    SELECT CASE (TRIM(def))
+      CASE('none')
+         IF(caldyn_eta/=eta_lag) THEN
+            IF(is_mpi_root) PRINT *,'disvert_type=none must be used with caldyn_eta=eta_lag'
+            STOP
+         END IF
+         ap_bp_present=.FALSE.
       CASE('std')
     
@@ -64,32 +85,34 @@
         
       CASE default
-        IF (is_mpi_root) PRINT*,'Bad selector for variable disvert : <', TRIM(disvert_type),"> options are <std>, <ncar>, <ncarl30>" 
+        IF (is_mpi_root) PRINT*,'Bad selector for variable disvert : <', TRIM(def),"> options are <std>, <ncar>, <ncarl30>" 
         STOP
         
     END SELECT
 
-    ! Convert from pressure coordinate to mass coordinate
-    ! pk = ap(k) + bp(k)*ps(ij) = ptop + g*( mass_ak(k) + mass_bk(k)*ms(ij) )
-    ptop = ap(llm+1)
-    ALLOCATE(mass_al(llm+1))
-    ALLOCATE(mass_bl(llm+1))
-    ALLOCATE(mass_ak(llm))
-    ALLOCATE(mass_bk(llm))
-    ALLOCATE(mass_dak(llm))
-    ALLOCATE(mass_dbk(llm))
-
-    ! FIXME : leave ps for the moment ; change ps to ms later
-    DO l=1,llm+1
-!       mass_al(l) = (ap(l)-ptop)/g
-!       mass_bl(l) = bp(l)/g
-       mass_al(l) = (ap(l)-ptop)
-       mass_bl(l) = bp(l)
-    END DO
-    DO l=1,llm
-       mass_ak(l) = .5*(mass_al(l)+mass_al(l+1))
-       mass_bk(l) = .5*(mass_bl(l)+mass_bl(l+1))
-       mass_dak(l) = mass_al(l)-mass_al(l+1)  ! >0
-       mass_dbk(l) = mass_bl(l)-mass_bl(l+1)  ! >0
-    END DO
+    IF(ap_bp_present) THEN
+       ! Convert from pressure coordinate to mass coordinate
+       ! pk = ap(k) + bp(k)*ps(ij) = ptop + g*( mass_ak(k) + mass_bk(k)*ms(ij) )
+       ptop = ap(llm+1)
+       ALLOCATE(mass_al(llm+1))
+       ALLOCATE(mass_bl(llm+1))
+       ALLOCATE(mass_ak(llm))
+       ALLOCATE(mass_bk(llm))
+       ALLOCATE(mass_dak(llm))
+       ALLOCATE(mass_dbk(llm))
+
+       ! FIXME : leave ps for the moment ; change ps to ms later
+       DO l=1,llm+1
+          !       mass_al(l) = (ap(l)-ptop)/g
+          !       mass_bl(l) = bp(l)/g
+          mass_al(l) = (ap(l)-ptop)
+          mass_bl(l) = bp(l)
+       END DO
+       DO l=1,llm
+          mass_ak(l) = .5*(mass_al(l)+mass_al(l+1))
+          mass_bk(l) = .5*(mass_bl(l)+mass_bl(l+1))
+          mass_dak(l) = mass_al(l)-mass_al(l+1)  ! >0
+          mass_dbk(l) = mass_bl(l)-mass_bl(l+1)  ! >0
+       END DO
+    END IF
 
   END SUBROUTINE init_disvert  
@@ -147,4 +170,5 @@
     INTEGER :: l
     
+    IF(ap_bp_present) THEN
     status = NF90_CREATE('apbp.nc', NF90_CLOBBER, ncid)
     status = NF90_DEF_DIM(ncid,'lev',llm,lev)
@@ -204,5 +228,6 @@
     status=NF90_PUT_VAR(ncid,P0id, Preff)
    
-   status=NF90_CLOSE(ncid)
+    status=NF90_CLOSE(ncid)
+  END IF
   END SUBROUTINE write_apbp
 
Index: codes/icosagcm/trunk/src/pression.f90
===================================================================
--- codes/icosagcm/trunk/src/pression.f90	(revision 165)
+++ codes/icosagcm/trunk/src/pression.f90	(revision 166)
@@ -32,4 +32,5 @@
     INTEGER :: i,j,ij,l
 
+    IF(ap_bp_present) THEN
     DO    l    = 1, llm+1
       DO j=jj_begin-offset,jj_end+offset
@@ -40,5 +41,5 @@
       ENDDO
     ENDDO
-    
+    END IF
   END SUBROUTINE compute_pression
 
