SUBROUTINE GPMPFC_GMVS( &
 ! - INPUT -------------------------------------------------------------
 & KST,KEN,KFLAG,PGM,&
 ! - INPUT/OUTPUT ------------------------------------------------------
 & PSPT0L,PSPT0M,PSPT9L,PSPT9M)

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

!------------------------------------------------------------------------------
!**** *GPMPFC_GMVS* - Apply map factor to convert 
!                     reduced variables -> geographical variables if kflag=0
!                     or
!                     geographical variables -> reduced variables if kflag=1
!                     for GMVS variables.

! Purpose
! -------
!   Multiply or divide by map factor.

! Interface
! ---------

!   INPUT:
!   ------
!     KST       - start of work
!     KEN       - depth of work
!     KFLAG     - 0 -> multiply, 1-> divide
!     PGM       - map factor

!   INPUT/OUTPUT:
!   -------------
!     P.T0.     - timestep t for GMVS variables (log(prehyds))
!     P.T9.     - timestep t-dt for GMVS variables (log(prehyds))

! Method
! ------

! Externals  
! ---------
!   None

! Reference
! ---------
!   ECMWF Research Department documentation of the IFS

! Author
! ------
!      Dec-2003 K. YESSAD (METEO-FRANCE) after GPMPFC and GP_SPV.

! Modifications
! -------------
!   09-Jun-2004 J. Masek  NH cleaning (LPC_NOTR, LFULLIMP)
!   01-Jul-2004 K. Yessad  Make clearer the tests for PC scheme.
!   K. Yessad (Dec 2008): remove dummy CDLOCK
! End Modifications
!------------------------------------------------------------------------------

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KST 
INTEGER(KIND=JPIM),INTENT(IN)    :: KEN
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLAG
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGM(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT0L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT0M(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT9L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT9M(NPROMA) 

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

INTEGER(KIND=JPIM) :: JROF
LOGICAL :: LL9
REAL(KIND=JPRB) :: ZGM(NPROMA)
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

#include "abor1.intfb.h"

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

IF (LTWOTL) THEN
  LL9=(NCURRENT_ITER > 0 .AND. LPC_FULL)
ELSE
  LL9=(NCURRENT_ITER == 0).OR.(NCURRENT_ITER > 0 .AND. LPC_FULL)
ENDIF

IF(KFLAG == 0) THEN
  ZGM(KST:KEN) = PGM(KST:KEN)
ELSEIF(KFLAG == 1) THEN
  ZGM(KST:KEN) = 1.0_JPRB/PGM(KST:KEN)
ELSE
  CALL ABOR1('GPMPFC_GMVS: ILLEGAL KFLAG')
ENDIF

DO JROF=KST,KEN
  PSPT0L(JROF)=PSPT0L(JROF)*ZGM(JROF)
  PSPT0M(JROF)=PSPT0M(JROF)*ZGM(JROF)
ENDDO
IF (LL9) THEN
  DO JROF=KST,KEN
    PSPT9L(JROF)=PSPT9L(JROF)*ZGM(JROF)
    PSPT9M(JROF)=PSPT9M(JROF)*ZGM(JROF)
  ENDDO
ENDIF

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

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