C LAST UPDATE: 
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C**************************
C**     LDM_RESTRP       **
C**************************
C
CD-Routine: Restore Saved Refineable Parameters - LDM_RESTRP
C Restore the refineable LDM parameters saved by the last call to LDM_SAVERP.
CD-end
CD-Fortran:
      SUBROUTINE LDM_RESTRP (IPACK, IPLATE)
CD-end
      INCLUDE 'implicit_none.finc'
C
C Purpose: Restore refineable parameter values saved by last LDM_SAVERP call
C
C Author:  John W. Campbell, September 1993
C
C Arguments:
C
      INTEGER IPACK
      INTEGER IPLATE
C
CD-Parameters:
C IPACK  i  (R)  Pack number
C IPLATE i  (R)  Plate number
CD-end
C
C====== GLOBALS:
C
      INCLUDE 'ldm_data.finc'
      INCLUDE 'save_refpars.finc'
C
C====== LOCALS:
C
      INTEGER I
      INTEGER KERR
      REAL VAL(2)
      CHARACTER*2 ERRSTR

C     INTEGER I                  !Temp/loop variable
C     INTEGER KERR               !Error flag
C     REAL VAL(2)                !Values array
C     CHARACTER*2 ERRSTR         !Error string (dummy)
C
C-------------------------------------------------------------------------------
C
      CALL LDM_SET_A (SAV_A, KERR, ERRSTR)
      CH_A = SV_CH_A
      CALL LDM_SET_B (SAV_B, KERR, ERRSTR)
      CH_B = SV_CH_B
      CALL LDM_SET_C (SAV_C, KERR, ERRSTR)
      CH_C = SV_CH_C
      CALL LDM_SET_ALPHA (SAV_ALPHA, KERR, ERRSTR)
      CH_ALPHA = SV_CH_ALPHA
      CALL LDM_SET_BETA (SAV_BETA, KERR, ERRSTR)
      CH_BETA = SV_CH_BETA
      CALL LDM_SET_GAMMA (SAV_GAMMA, KERR, ERRSTR)
      CH_GAMMA = SV_CH_GAMMA
      CALL LDM_SET_PHIX (IPACK, SAV_PHIX, KERR, ERRSTR)
      CH_PHIX(IPACK) = SV_CH_PHIX
      CALL LDM_SET_PHIY (IPACK, SAV_PHIY, KERR, ERRSTR)
      CH_PHIY(IPACK) = SV_CH_PHIY
      CALL LDM_SET_PHIZ (IPACK, SAV_PHIZ, KERR, ERRSTR)
      CH_PHIZ(IPACK) = SV_CH_PHIZ
      CALL LDM_SET_CTOF (IPACK, IPLATE, SAV_CTOF, KERR, ERRSTR)
      CH_CTOF(IPACK,IPLATE) = SV_CH_CTOF
      CALL LDM_SET_XC (IPACK, IPLATE, SAV_XC, KERR, ERRSTR)
      CH_XC(IPACK,IPLATE) = SV_CH_XC
      CALL LDM_SET_YC (IPACK, IPLATE, SAV_YC, KERR, ERRSTR)
      CH_YC(IPACK,IPLATE) = SV_CH_YC
      CALL LDM_SET_WC (IPACK, IPLATE, SAV_WC, KERR, ERRSTR)
      CH_WC(IPACK,IPLATE) = SV_CH_WC
      CALL LDM_SET_YSCAL (IPACK, IPLATE, SAV_YSCAL, KERR, ERRSTR)
      CH_YSCAL(IPACK,IPLATE) = SV_CH_YSCAL
      CALL LDM_SET_TWIST (IPACK, IPLATE, SAV_TWIST, KERR, ERRSTR)
      CH_TWIST(IPACK,IPLATE) = SV_CH_TWIST
      CALL LDM_SET_TILT (IPACK, IPLATE, SAV_TILT, KERR, ERRSTR)
      CH_TILT(IPACK,IPLATE) = SV_CH_TILT
      CALL LDM_SET_BULGE (IPACK, IPLATE, SAV_BULGE, KERR, ERRSTR)
      CH_BULGE(IPACK,IPLATE) = SV_CH_BULGE
      CALL LDM_SET_ROFF (IPACK, IPLATE, SAV_ROFF, KERR, ERRSTR)
      CH_ROFF(IPACK,IPLATE) = SV_CH_ROFF
      CALL LDM_SET_TOFF (IPACK, IPLATE, SAV_TOFF, KERR, ERRSTR)
      CH_TOFF(IPACK,IPLATE) = SV_CH_TOFF
      CALL LDM_SET_SPDXY (IPACK, IPLATE, SAV_SPDXY, KERR, ERRSTR)
      CH_SPDXY(IPACK,IPLATE) = SV_CH_SPDXY
      DO 120 I = 1, LDM_MAXSPD
         VAL(1) = SAV_SPDX(I)
         CALL LDM_SET_SPDX (I, IPACK, IPLATE, VAL, KERR, ERRSTR)
         VAL(1) = SAV_SPDY(I)
         CALL LDM_SET_SPDY (I, IPACK, IPLATE, VAL, KERR, ERRSTR)
         CH_SPDX(IPACK,IPLATE,I) = SV_CH_SPDX(I)
         CH_SPDY(IPACK,IPLATE,I) = SV_CH_SPDY(I)
120   CONTINUE
      RETURN
      END
