
      subroutine psdmatc (func,dtq,a,t,elem1,elem2)

C
C Author: Zuheir Altamimi (zuheir.altamimi@ign.fr), IGN France
C
C Last updated: December 02, 2021
C
C
C Compute the two terms of the Matrix C (see pdf file ITRF2020-PSD-model-eqs-IGN.pdf)
C of the parametric models LOG or EXP
C
C IN:
C func: type of the parametric model LOG or EXP
C dtq : time difference (t - t_Earthquake) in decimal year (but see note below)
C a   : amplitude of the parametric model
C t   : relaxation time
C
C OUT :
C elem1, elem2: the two elements of matrix C
C
C Units: - mm for "a" and decimal year for "t"
C
C Note: Time unit is decimal year. It is advised to compute "dtq" by:
C (MJD - MJD_Earthquake)/365.25 where MJD is the modified julian day.
C

      implicit none

      doubleprecision dtq,a,t,te,elem1,elem2
      character*3 func

      elem1 = 0.d0
      elem2 = 0.d0

      te = dtq/t

      if (func.eq.'EXP') then
       elem1 = 1.d0 - dexp(-te)
       elem2 = - ( a*dtq*dexp(-te) ) / ( t**2 )
       return
      end if

      if (func.eq.'LOG') then
       elem1 = dlog ( 1.0d0 + te  )

       elem2 = -  (a*dtq) / ( (t**2)*(1.d0 + te ) )
       return
      end if

      end
