!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer, 
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms 
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer 
!version 3 or (at your option) any later version that should be found at: 
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html 
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software; 
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec), 
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
***s/r vspng_main_tr - Equivalent to vspng_main for TRAJECTORY
*                      (F_pip ONLY)
*
#include "model_macros_f.h"
*

      subroutine vspng_main_tr 3,2
*
      implicit none
*
*author
*     M.Tanguay
*
*revision
* v3_03 - Tanguay M.        - initial MPI version
* v3_11 - Tanguay M.        - AIXport+Opti+OpenMP for TLM-ADJ
*
*object
*     see id section
*
*arguments
*     none
*
*implicits
#include "glb_ld.cdk"
#include "vt1m.cdk"
#include "vspng.cdk"
#include "schm.cdk"
*
*modules
      integer  vmmlod,vmmuld,vmmget
      external vmmlod,vmmuld,vmmget
*
      integer pnerr, pnlod, pnlkey1(2)
*     __________________________________________________
*
      if (Vspng_nk.lt.1) return
*
      pnlkey1(1) = VMM_KEY(pipt1m)
      pnlod=1
      if (.not. Schm_hydro_L) then
         pnlkey1(pnlod+1) = VMM_KEY(qpt1m)
         pnlod=pnlod+1
      endif
*
*     - - - - - - - - - - - - - - -
      pnerr = vmmlod(pnlkey1,pnlod)
*     - - - - - - - - - - - - - - -
      pnerr = VMM_GET_VAR(pipt1m)
      qpt1m_ = 0
      if (.not. Schm_hydro_L) then
         pnerr = VMM_GET_VAR(qpt1m)
      endif
*
      if (G_lam) then
         call vspng_drv_lam_tr (pipt1m,qpt1m,LDIST_DIM,G_nk)
      else
         call vspng_drv_tr (pipt1m,qpt1m,LDIST_DIM,G_nk)
      endif
*
      pnerr = vmmuld(-1,0)
*    
      return
      end