SUBROUTINE GP_SPVTL( &
 ! - INPUT --------------------------------------------------------------
 & LDLADNMI,KST,KEND,&
 & PSPT0,PSPT0L,PSPT0M,PSPT9,&
 ! - OUTPUT -------------------------------------------------------------
 & PRE0,PRE0L,PRE0M,PRE9,&
 ! - INPUT-TRAJECTORY ---------------------------------------------------
 & PSPT5L,PSPT5M,PRE5,PRE95)

USE PARKIND1 , ONLY : JPIM     ,JPRB
USE YOMCT0   , ONLY : LTWOTL   ,LPC_FULL  ,LNHDYN
USE YOMDIM   , ONLY : NFLEVG   ,NPROMA
USE YOMDYN   , ONLY : NCURRENT_ITER
USE YOMHOOK  , ONLY : LHOOK    ,DR_HOOK
USE YOMSIMPHL, ONLY : LSIMPH

!------------------------------------------------------------------------------
!**** *GP_SPVTL* - 

! Purpose
! -------

! Interface
! ---------
!   abbreviation "prehyds" means "hydrostatic surface pressure".

!   INPUT:
!   ------
!   LDLADNMI           : .T.: adiabatic NMI
!   KST                : start of work
!   KEND               : depth of work
!   PSPT0,PSPT0L,PSPT0M: log(prehyds) and derivatives at t.
!   PSPT9              : log(prehyds) at t-dt.

!   OUTPUT:
!   -------
!   PRE0,PRE0L,PRE0M   : prehyds and derivatives at t.
!   PRE9               : prehyds at t-dt.

!   INPUT-TRAJECTORY:
!   -----------------
!   PSPT5L,PSPT5M      : cf. PSPT0L,PSPT0M.
!   PRE5               : cf. PRE0.
!   PRE95              : cf. PRE9.

! Externals
! ---------

! Method
! ------

! Reference
! ---------
       
! Author
! ------
!   27-Jun-2002 C. Fischer (METEO-FRANCE)

! Modifications
! -------------
!   01-Oct-2003 M. Hamrud  CY28 Cleaning
!      Dec 2003 K. Yessad  multiplication by GM has moved in GPMPFC_GMVS.
!   09-Jun-2004 J. Masek   NH cleaning (LFULLIMP)
!   01-Jul-2004 K. Yessad  Make clearer the tests for PC scheme.
!   K. Yessad (Dec 2008): remove dummy CDLOCK
! End Modifications
!------------------------------------------------------------------------------

IMPLICIT NONE

LOGICAL           ,INTENT(IN)    :: LDLADNMI 
INTEGER(KIND=JPIM),INTENT(IN)    :: KST 
INTEGER(KIND=JPIM),INTENT(IN)    :: KEND 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSPT0(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSPT0L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSPT0M(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSPT9(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE0(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE0L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE0M(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE9(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSPT5L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSPT5M(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRE5(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRE95(NPROMA,0:NFLEVG) 

!     ------------------------------------------------------------------

INTEGER(KIND=JPIM) :: JROF
LOGICAL :: LLPRE9
REAL(KIND=JPRB) :: ZHOOK_HANDLE

!     ------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('GP_SPVTL',0,ZHOOK_HANDLE)
!     ------------------------------------------------------------------

IF (.NOT.((LSIMPH.AND..NOT.LDLADNMI).OR.LNHDYN)) THEN
  LLPRE9=.FALSE.
ELSE
  IF (LTWOTL) THEN
    LLPRE9=(NCURRENT_ITER > 0 .AND. LPC_FULL)
  ELSE
    LLPRE9=(NCURRENT_ITER == 0).OR.(NCURRENT_ITER > 0 .AND. LPC_FULL)
  ENDIF
ENDIF

DO JROF=KST,KEND
  PRE0 (JROF,NFLEVG)=PRE5 (JROF,NFLEVG)*PSPT0(JROF)
  PRE0L(JROF       )=PSPT5L(JROF)*PRE0(JROF,NFLEVG) &
   & + PRE5(JROF,NFLEVG)*PSPT0L(JROF)
  PRE0M(JROF       )=PSPT5M(JROF)*PRE0(JROF,NFLEVG) &
   & + PRE5(JROF,NFLEVG)*PSPT0M(JROF)
ENDDO
IF (LLPRE9) THEN
  DO JROF=KST,KEND
    PRE9 (JROF,NFLEVG)=PRE95(JROF,NFLEVG)*PSPT9(JROF)
  ENDDO
ENDIF

!     ------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('GP_SPVTL',1,ZHOOK_HANDLE)
END SUBROUTINE GP_SPVTL
