FORTRAN Generation
(/./ftp/cats/J/A_A/604/A108)

Conversion of standardized ReadMe file for file /./ftp/cats/J/A_A/604/A108 into FORTRAN code for loading all data files into arrays.

Note that special values are assigned to unknown or unspecified numbers (also called NULL numbers); when necessary, the coordinate components making up the right ascension and declination are converted into floating-point numbers representing these angles in degrees.



      program load_ReadMe
C=============================================================================
C  F77-compliant program generated by readme2f_1.81 (2015-09-23), on 2024-Apr-20
C=============================================================================
*  This code was generated from the ReadMe file documenting a catalogue
*  according to the "Standard for Documentation of Astronomical Catalogues"
*  currently in use by the Astronomical Data Centers (CDS, ADC, A&A)
*  (see full documentation at URL http://vizier.u-strasbg.fr/doc/catstd.htx)
*  Please report problems or questions to   
C=============================================================================

      implicit none
*  Unspecified or NULL values, generally corresponding to blank columns,
*  are assigned one of the following special values:
*     rNULL__    for unknown or NULL floating-point values
*     iNULL__    for unknown or NULL   integer      values
      real*4     rNULL__
      integer*4  iNULL__
      parameter  (rNULL__=--2147483648.)  	! NULL real number
      parameter  (iNULL__=(-2147483647-1))	! NULL int  number
      integer    idig			! testing NULL number

C=============================================================================
Cat. J/A+A/604/A108          UniDAM results                            (Mints+, 2017)
*================================================================================
*A Unified tool to estimate Distances, Ages and Masses (UniDAM) from
*spectrophotometric data.
*    Mints A., Hekker S.
*    <Astron. Astrophys. 604, A108 (2017)>
*    =2017A&A...604A.108M        (SIMBAD/NED BibCode)
C=============================================================================

C  Internal variables

      integer*4 i__

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'unidam.dat'	! Parameters for the main catalogue (UniDAM)

      integer*4 nr__
      parameter (nr__=3847557)	! Number of records
      character*1015 ar__   	! Full-size record

C  J2000.0 position composed of: RAdeg DEdeg
      character*18  Survey     (nr__) ! Input survey designation (survey)
      character*45  ID         (nr__) ! Unique ID of the star from the input
*                                      data (id)
      real*8        GLON       (nr__) ! (deg) Galactic longitude (l)
      real*4        GLAT       (nr__) ! (deg) Galactic latitude (b)
      real*8        RAdeg      (nr__) ! (deg) Right Ascension J2000.0 (raj2000)
      real*8        DEdeg      (nr__) ! (deg) Declination J2000.0 (dej2000)
      integer*4     USPDFPri   (nr__) ! [0/7] Priority order of a given USPDF
*                                      (starting from 0) (uspdf_priority)
      integer*4     USPDFpts   (nr__) ! Number of models used for UPSDF
*                                      (uspdf_points)
      integer*4     Stage      (nr__) ! [1/3] Stage number (I, II or III)
*                                      (stage) (1)
      real*4        USPDFW     (nr__) ! [0.030/1.000] Weight of a given USPDF
*                                      (uspdf_weight)
      integer*4     TUSPDF     (nr__) ! [1/8] Number of USPDF with weight >0.03
*                                      (total_uspdfs)
      character*1   Qual       (nr__) ! Quality flag (quality) (2)
      real*4        Pbest      (nr__) ! [0/1] Probability for a best-fitting model
*                                      (p_best)
      real*4        Psed       (nr__) ! [0/1] p-value from chi-squared SED fit
*                                      (p_sed)
      real*4        logAgeMean (nr__) ! ([yr]) Mean value for logarithm of age (ageMean)
      real*4        e_logAgeMean(nr__) ! ([yr]) Variance for logarithm of age (age_err)
      real*4        logAgeMode (nr__) ! ([yr]) Mode value for logarithm of age (ageMode)
      real*4        logAgeMed  (nr__) ! ([yr]) Median value for logarithm of age (ageMed)
      real*4        e1_logAge  (nr__) ! ([yr]) Lower boundary of 1-sigma range for
*                                      logarithm of age (age_low_1sigma)
      real*4        E1_logAge_1(nr__) ! ([yr]) Upper boundary of 1-sigma range for
*                                      logarithm of age (age_up_1sigma)
      real*4        e3_logAge  (nr__) ! ([yr]) Lower boundary of 3-sigma range for
*                                      logarithm of age (age_low_3sigma)
      real*4        E3_logAge_1(nr__) ! ([yr]) Upper boundary of 3-sigma range for
*                                      logarithm of age (age_up_3sigma)
      character*1   logAgeFit  (nr__) ! ([yr]) Fitting function for logarithm of age
*                                      (ageFit) (3)
      real*8        logAgePar1 (nr__) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_1) (4)
      real*4        logAgePar2 (nr__) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_2) (4)
      real*4        logAgePar3 (nr__) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_3) (4)
      real*4        logAgePar4 (nr__) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_4) (4)
      real*4        logAgePar5 (nr__) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_5) (4)
      real*4        MassMean   (nr__) ! (Msun) Mean value for mass (mass_mean)
      real*4        e_MassMean (nr__) ! (Msun) Variance for mass (mass_err)
      real*4        MassMode   (nr__) ! (Msun) Mode value for mass (mass_mode)
      real*4        MassMed    (nr__) ! (Msun) Median value for mass (mass_median)
      real*4        e1_Mass    (nr__) ! (Msun) Lower boundary of 1-sigma range for mass
*                                      (mass_low_1sigma)
      real*4        E1_Mass_1  (nr__) ! (Msun) Upper boundary of 1-sigma range for mass
*                                      (mass_up_1sigma)
      real*4        e3_Mass    (nr__) ! (Msun) Lower boundary of 3-sigma range for mass
*                                      (mass_low_3sigma)
      real*4        E3_Mass_1  (nr__) ! (Msun) Upper boundary of 3-sigma range for mass
*                                      (mass_up_3sigma)
      character*1   MassFit    (nr__) ! (Msun) Fitting function for mass
*                                      (mass_fit) (3)
      real*4        MassPar1   (nr__) ! (Msun) First fit parameter for mass
*                                      (mass_par_1) (4)
      real*4        MassPar2   (nr__) ! (Msun) First fit parameter for mass
*                                      (mass_par_2) (4)
      real*4        MassPar3   (nr__) ! (Msun) First fit parameter for mass
*                                      (mass_par_3) (4)
      real*4        MassPar4   (nr__) ! (Msun) First fit parameter for mass
*                                      (mass_par_4) (4)
      real*4        MassPar5   (nr__) ! (Msun) First fit parameter for mass
*                                      (mass_par_5) (4)
      real*8        DMMean     (nr__) ! (mag) Mean value for distance modulus
*                                      (distance_modulus_mean)
      real*4        e_DMMean   (nr__) ! (mag) Variance for distance modulus
*                                      (distance_modulus_err)
      real*8        DMMode     (nr__) ! (mag) Mode value for distance modulus
*                                      (distance_modulus_mode)
      real*8        DMMed      (nr__) ! (mag) Median value for distance modulus
*                                      (distance_modulus_median)
      real*8        e1_DM      (nr__) ! (mag) Lower boundary of 1-sigma range for
*                                      distance modulus
*                                      (distance_modulus_low_1sigma)
      real*8        E1_DM_1    (nr__) ! (mag) Upper boundary of 1-sigma range for
*                                      distance modulus
*                                      (distance_modulus_up_1sigma)
      real*8        e3_DM      (nr__) ! (mag) Lower boundary of 3-sigma range for
*                                      distance modulus
*                                      (distance_modulus_low_3sigma)
      real*8        E3_DM_1    (nr__) ! (mag) Upper boundary of 3-sigma range for
*                                      distance modulus
*                                      (distance_modulus_up_3sigma)
      character*1   DMFit      (nr__) ! (mag) Fitting function for distance modulus
*                                      (distance_modulusFit) (3)
      real*8        DMPar1     (nr__) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_1) (4)
      real*4        DMPar2     (nr__) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_2) (4)
      real*4        DMPar3     (nr__) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_3) (4)
      real*8        DMPar4     (nr__) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_4) (4)
      real*8        DMPar5     (nr__) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_5) (4)
      real*4        ExtMean    (nr__) ! (mag) Mean value for extinction in 2MASS K-band
*                                      (extinction_mean)
      real*4        e_ExtMean  (nr__) ! (mag) Variance for extinction in 2MASS K-band
*                                      (extinction_err)
      real*4        ExtMode    (nr__) ! (mag) Mode value for extinction in 2MASS K-band
*                                      (extinction_mode)
      real*4        ExtMed     (nr__) ! (mag) Median value for extinction in 2MASS K-band
*                                      (extinction_median)
      real*4        e1_Ext     (nr__) ! (mag) Lower boundary of 1-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_low_1sigma)
      real*4        E1_Ext_1   (nr__) ! (mag) Upper boundary of 1-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_up_1sigma)
      real*4        e3_Ext     (nr__) ! (mag) Lower boundary of 3-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_low_3sigma)
      real*4        E3_Ext_1   (nr__) ! (mag) Upper boundary of 3-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_up_3sigma)
      character*1   ExtFit     (nr__) ! (mag) Fitting function for extinction in
*                                      2MASS K-band (extinction_fit) (3)
      real*8        ExtPar1    (nr__) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_1) (4)
      real*4        ExtPar2    (nr__) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_2) (4)
      real*4        ExtPar3    (nr__) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_3) (4)
      real*4        ExtPar4    (nr__) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_4) (4)
      real*4        ExtPar5    (nr__) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_5) (4)
      real*8        DistMean   (nr__) ! (kpc) Mean value for distance (Distmean)
      real*4        e_DistMean (nr__) ! (kpc) Variance for distance (distance_err)
      real*8        DistMod    (nr__) ! (kpc) Mode value for distance (distanceMode)
      real*8        DistMed    (nr__) ! (kpc) Median value for distance (distanceMed)
      real*8        e1_Dist    (nr__) ! (kpc) Lower boundary of 1-sigma range for
*                                      distance (distance_low_1sigma)
      real*8        E1_Dist_1  (nr__) ! (kpc) Upper boundary of 1-sigma range for
*                                      distance (distance_up_1sigma)
      real*4        e3_Dist    (nr__) ! (kpc) Lower boundary of 3-sigma range for
*                                      distance (distance_low_3sigma)
      real*4        E3_Dist_1  (nr__) ! (kpc) Upper boundary of 3-sigma range for
*                                      distance (distance_up_3sigma)
      character*1   DistFit    (nr__) ! (kpc) Fitting function for distance
*                                      (distanceFit) (3)
      real*4        DistPar1   (nr__) ! (kpc) First fit parameter for distance
*                                      (Distpar_1) (4)
      real*4        DistPar2   (nr__) ! (kpc) First fit parameter for distance
*                                      (Distpar_2) (4)
      real*4        DistPar3   (nr__) ! (kpc) First fit parameter for distance
*                                      (Distpar_3) (4)
      real*4        DistPar4   (nr__) ! (kpc) First fit parameter for distance
*                                      (Distpar_4) (4)
      real*8        DistPar5   (nr__) ! (kpc) First fit parameter for distance
*                                      (Distpar_5) (4)
      real*4        plxMean    (nr__) ! (mas) Mean value for parallax (plx_mean)
      real*4        e_plxMean  (nr__) ! (mas) Variance for parallax (parallax_err)
      real*4        plxMode    (nr__) ! (mas) Mode value for parallax (parallax_mode)
      real*4        plxMed     (nr__) ! (mas) Median value for parallax (parallax_median)
      real*4        e1_plx     (nr__) ! (mas) Lower boundary of 1-sigma range for
*                                      parallax (parallax_low_1sigma)
      real*4        E1_plx_1   (nr__) ! (mas) Upper boundary of 1-sigma range for
*                                      parallax (parallax_up_1sigma)
      real*4        e3_plx     (nr__) ! (mas) Lower boundary of 3-sigma range for
*                                      parallax (parallax_low_3sigma)
      real*4        E3_plx_1   (nr__) ! (mas) Upper boundary of 3-sigma range for
*                                      parallax (parallax_up_3sigma)
      character*1   plxFit     (nr__) ! (mas) Fitting function for parallax
*                                      (parallax_fit) (3)
      real*4        plxPar1    (nr__) ! (mas) First fit parameter for parallax
*                                      (plx_par_1) (4)
      real*4        plxPar2    (nr__) ! (mas) First fit parameter for parallax
*                                      (plx_par_2) (4)
      real*4        plxPar3    (nr__) ! (mas) First fit parameter for parallax
*                                      (plx_par_3) (4)
      real*4        plxPar4    (nr__) ! (mas) First fit parameter for parallax
*                                      (plx_par_4) (4)
      real*4        plxPar5    (nr__) ! (mas) First fit parameter for parallax
*                                      (plx_par_5) (4)
      real*4        DM_AgeSlope(nr__) ! Slope of the distance modulus-log(Age)
*                                      relation (dm_age_slope)
      real*4        DM_AgeInter(nr__) ! Intercept of the distance modulus-log(Age)
*                                      relation (dm_age_intercept)
      real*4        DM_AgeSct  (nr__) ! Scatter of the distance modulus-log(Age)
*                                      relation (dm_age_scatter)
      real*4        DM_AgeMad  (nr__) ! MAD of the distance modulus-log(Age)
*                                      relation (dm_age_mad)
      real*4        Age_DMSlope(nr__) ! Slope of the log(Age)-distance modulus
*                                      relation (age_dm_slope)
      real*4        Age_DMInter(nr__) ! Intercept of the log(Age)-distance modulus
*                                      relation (age_dm_intercept)
      real*4        Age_DMSct  (nr__) ! Scatter of the log(Age)-distance modulus
*                                      relation (age_dm_scatter)
      real*4        Age_DMMad  (nr__) ! MAD of the log(Age)-distance modulus
*                                      relation (age_dm_mad)
      real*4        DM_MassSlope(nr__) ! Slope of the distance modulus-log(Mass)
*                                      relation (dm_mass_slope)
      real*4        DM_MassInter(nr__) ! Intercept of the distance modulus-log(Mass)
*                                      relation (dm_mass_intercept)
      real*4        DM_MassSct (nr__) ! Scatter of the distance modulus-log(Mass)
*                                      relation (dm_mass_scatter)
      real*4        DM_MassMad (nr__) ! MAD of the distance modulus-log(Mass)
*                                      relation (dm_mass_mad)
      real*4        DM_smooth  (nr__) ! (mag) [0/7] Smoothing parameter for PDF for
*                                      distance modulus
*                                      (distance_modulus_smooth) (5)
      real*4        Ext_smooth (nr__) ! (mag) [0/7] Smoothing parameter for PDF for
*                                      extinction in 2MASS k-band
*                                      (extinction_smooth) (5)
*Note (1): Evolutionary stage as follows:
*     I = Pre-core-helium burning;
*    II = Core-helium burning stars;
*   III = Asymptotic giant branch stars (post-core-helium burning).
*Note (2): Quality flag (see section 6.1) as follows:
*     1 = single PDF
*     A = highest-weight USPDF has power of 0.9 or more
*     B = 1st and 2nd priority USPDFs together have power of 0.9 or more
*     C = 1st, 2nd, and 3rd priority USPDFs together have power of 0.9 or more
*     D = 1st, 2nd, and 3rd priority USPDFs together have power of less than 0.9
*     L = low power USPDF (between 0.03 and 0.1)
*     E = USPDF has psed<0.1 (possibly bad photometry)
*     X = highest weight USPDF has pbest<0.1 (likely off the model grid)
*     N = USPDF has less than 10 models (unreliable result)
*Note (3): A character indicating which fitting function was chosen as follows:
*     G = Gaussian
*     S = Skewed Gaussian
*     T = Truncated Gaussian
*     L = Modified truncated exponential distribution (MTED)
*     P = Truncated Student's t-distribution
*     E = Fit failed for all five above functions
*     N = There was not enough data for a fit
*Note (4): *Par* columns are parameters for a chosen fitting function.
*     The first two values are location and shape for the chosen best
*     fitting function. For a Gaussian function, by definition, location
*     parameter is equal to the mean value and shape parameter to the variance.
*     If the chosen function is a skewed Gaussian then the third value is the
*     skew value. If the chosen function is a truncated Gaussian or MTED, then
*     third and fourth values are lower and upper limits. If the chosen function
*     is Student's t-distribution then the third value is the number of degrees
*     of freedom and the fourth and fifth values are lower and upper limits.
*Note (5): Gaussian smoothing coefficients for distance modulus and extinction
*     PDFs, see section 4.1

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'apogee12.dat'	! Parameters for APOGEE DR12 (APOGEE_dr12)

      integer*4 nr__1
      parameter (nr__1=180703)	! Number of records
      character*1015 ar__1  	! Full-size record

C  J2000.0 position composed of: RAdeg DEdeg
      character*18  Survey_1   (nr__1) ! Input survey designation (survey)
      character*45  ID_1       (nr__1) ! Unique ID of the star from the input
*                                      data (id)
      real*8        GLON_1     (nr__1) ! (deg) Galactic longitude (l)
      real*4        GLAT_1     (nr__1) ! (deg) Galactic latitude (b)
      real*8        RAdeg_1    (nr__1) ! (deg) Right Ascension J2000.0 (raj2000)
      real*8        DEdeg_1    (nr__1) ! (deg) Declination J2000.0 (dej2000)
      integer*4     USPDFPri_1 (nr__1) ! [0/7] Priority order of a given USPDF
*                                      (starting from 0) (uspdf_priority)
      integer*4     USPDFpts_1 (nr__1) ! Number of models used for UPSDF
*                                      (uspdf_points)
      integer*4     Stage_1    (nr__1) ! [1/3] Stage number (I, II or III)
*                                      (stage) (1)
      real*4        USPDFW_1   (nr__1) ! [0.030/1.000] Weight of a given USPDF
*                                      (uspdf_weight)
      integer*4     TUSPDF_1   (nr__1) ! [1/8] Number of USPDF with weight >0.03
*                                      (total_uspdfs)
      character*1   Qual_1     (nr__1) ! Quality flag (quality) (2)
      real*4        Pbest_1    (nr__1) ! [0/1] Probability for a best-fitting model
*                                      (p_best)
      real*4        Psed_1     (nr__1) ! [0/1] p-value from chi-squared SED fit
*                                      (p_sed)
      real*4        logAgeMean_1(nr__1) ! ([yr]) Mean value for logarithm of age (ageMean)
      real*4        e_logAgeMean_1(nr__1) ! ([yr]) Variance for logarithm of age (age_err)
      real*4        logAgeMode_1(nr__1) ! ([yr]) Mode value for logarithm of age (ageMode)
      real*4        logAgeMed_1(nr__1) ! ([yr]) Median value for logarithm of age (ageMed)
      real*4        e1_logAge_2(nr__1) ! ([yr]) Lower boundary of 1-sigma range for
*                                      logarithm of age (age_low_1sigma)
      real*4        E1_logAge_3(nr__1) ! ([yr]) Upper boundary of 1-sigma range for
*                                      logarithm of age (age_up_1sigma)
      real*4        e3_logAge_2(nr__1) ! ([yr]) Lower boundary of 3-sigma range for
*                                      logarithm of age (age_low_3sigma)
      real*4        E3_logAge_3(nr__1) ! ([yr]) Upper boundary of 3-sigma range for
*                                      logarithm of age (age_up_3sigma)
      character*1   logAgeFit_1(nr__1) ! ([yr]) Fitting function for logarithm of age
*                                      (ageFit) (3)
      real*8        logAgePar1_1(nr__1) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_1) (4)
      real*4        logAgePar2_1(nr__1) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_2) (4)
      real*4        logAgePar3_1(nr__1) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_3) (4)
      real*4        logAgePar4_1(nr__1) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_4) (4)
      real*4        logAgePar5_1(nr__1) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_5) (4)
      real*4        MassMean_1 (nr__1) ! (Msun) Mean value for mass (mass_mean)
      real*4        e_MassMean_1(nr__1) ! (Msun) Variance for mass (mass_err)
      real*4        MassMode_1 (nr__1) ! (Msun) Mode value for mass (mass_mode)
      real*4        MassMed_1  (nr__1) ! (Msun) Median value for mass (mass_median)
      real*4        e1_Mass_2  (nr__1) ! (Msun) Lower boundary of 1-sigma range for mass
*                                      (mass_low_1sigma)
      real*4        E1_Mass_3  (nr__1) ! (Msun) Upper boundary of 1-sigma range for mass
*                                      (mass_up_1sigma)
      real*4        e3_Mass_2  (nr__1) ! (Msun) Lower boundary of 3-sigma range for mass
*                                      (mass_low_3sigma)
      real*4        E3_Mass_3  (nr__1) ! (Msun) Upper boundary of 3-sigma range for mass
*                                      (mass_up_3sigma)
      character*1   MassFit_1  (nr__1) ! (Msun) Fitting function for mass
*                                      (mass_fit) (3)
      real*4        MassPar1_1 (nr__1) ! (Msun) First fit parameter for mass
*                                      (mass_par_1) (4)
      real*4        MassPar2_1 (nr__1) ! (Msun) First fit parameter for mass
*                                      (mass_par_2) (4)
      real*4        MassPar3_1 (nr__1) ! (Msun) First fit parameter for mass
*                                      (mass_par_3) (4)
      real*4        MassPar4_1 (nr__1) ! (Msun) First fit parameter for mass
*                                      (mass_par_4) (4)
      real*4        MassPar5_1 (nr__1) ! (Msun) First fit parameter for mass
*                                      (mass_par_5) (4)
      real*8        DMMean_1   (nr__1) ! (mag) Mean value for distance modulus
*                                      (distance_modulus_mean)
      real*4        e_DMMean_1 (nr__1) ! (mag) Variance for distance modulus
*                                      (distance_modulus_err)
      real*8        DMMode_1   (nr__1) ! (mag) Mode value for distance modulus
*                                      (distance_modulus_mode)
      real*8        DMMed_1    (nr__1) ! (mag) Median value for distance modulus
*                                      (distance_modulus_median)
      real*8        e1_DM_2    (nr__1) ! (mag) Lower boundary of 1-sigma range for
*                                      distance modulus
*                                      (distance_modulus_low_1sigma)
      real*8        E1_DM_3    (nr__1) ! (mag) Upper boundary of 1-sigma range for
*                                      distance modulus
*                                      (distance_modulus_up_1sigma)
      real*8        e3_DM_2    (nr__1) ! (mag) Lower boundary of 3-sigma range for
*                                      distance modulus
*                                      (distance_modulus_low_3sigma)
      real*8        E3_DM_3    (nr__1) ! (mag) Upper boundary of 3-sigma range for
*                                      distance modulus
*                                      (distance_modulus_up_3sigma)
      character*1   DMFit_1    (nr__1) ! (mag) Fitting function for distance modulus
*                                      (distance_modulusFit) (3)
      real*8        DMPar1_1   (nr__1) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_1) (4)
      real*4        DMPar2_1   (nr__1) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_2) (4)
      real*4        DMPar3_1   (nr__1) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_3) (4)
      real*8        DMPar4_1   (nr__1) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_4) (4)
      real*8        DMPar5_1   (nr__1) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_5) (4)
      real*4        ExtMean_1  (nr__1) ! (mag) Mean value for extinction in 2MASS K-band
*                                      (extinction_mean)
      real*4        e_ExtMean_1(nr__1) ! (mag) Variance for extinction in 2MASS K-band
*                                      (extinction_err)
      real*4        ExtMode_1  (nr__1) ! (mag) Mode value for extinction in 2MASS K-band
*                                      (extinction_mode)
      real*4        ExtMed_1   (nr__1) ! (mag) Median value for extinction in 2MASS K-band
*                                      (extinction_median)
      real*4        e1_Ext_2   (nr__1) ! (mag) Lower boundary of 1-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_low_1sigma)
      real*4        E1_Ext_3   (nr__1) ! (mag) Upper boundary of 1-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_up_1sigma)
      real*4        e3_Ext_2   (nr__1) ! (mag) Lower boundary of 3-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_low_3sigma)
      real*4        E3_Ext_3   (nr__1) ! (mag) Upper boundary of 3-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_up_3sigma)
      character*1   ExtFit_1   (nr__1) ! (mag) Fitting function for extinction in
*                                      2MASS K-band (extinction_fit) (3)
      real*8        ExtPar1_1  (nr__1) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_1) (4)
      real*4        ExtPar2_1  (nr__1) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_2) (4)
      real*4        ExtPar3_1  (nr__1) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_3) (4)
      real*4        ExtPar4_1  (nr__1) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_4) (4)
      real*4        ExtPar5_1  (nr__1) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_5) (4)
      real*8        DistMean_1 (nr__1) ! (kpc) Mean value for distance (Distmean)
      real*4        e_DistMean_1(nr__1) ! (kpc) Variance for distance (distance_err)
      real*8        DistMod_1  (nr__1) ! (kpc) Mode value for distance (distanceMode)
      real*8        DistMed_1  (nr__1) ! (kpc) Median value for distance (distanceMed)
      real*8        e1_Dist_2  (nr__1) ! (kpc) Lower boundary of 1-sigma range for
*                                      distance (distance_low_1sigma)
      real*8        E1_Dist_3  (nr__1) ! (kpc) Upper boundary of 1-sigma range for
*                                      distance (distance_up_1sigma)
      real*4        e3_Dist_2  (nr__1) ! (kpc) Lower boundary of 3-sigma range for
*                                      distance (distance_low_3sigma)
      real*4        E3_Dist_3  (nr__1) ! (kpc) Upper boundary of 3-sigma range for
*                                      distance (distance_up_3sigma)
      character*1   DistFit_1  (nr__1) ! (kpc) Fitting function for distance
*                                      (distanceFit) (3)
      real*4        DistPar1_1 (nr__1) ! (kpc) First fit parameter for distance
*                                      (Distpar_1) (4)
      real*4        DistPar2_1 (nr__1) ! (kpc) First fit parameter for distance
*                                      (Distpar_2) (4)
      real*4        DistPar3_1 (nr__1) ! (kpc) First fit parameter for distance
*                                      (Distpar_3) (4)
      real*4        DistPar4_1 (nr__1) ! (kpc) First fit parameter for distance
*                                      (Distpar_4) (4)
      real*8        DistPar5_1 (nr__1) ! (kpc) First fit parameter for distance
*                                      (Distpar_5) (4)
      real*4        plxMean_1  (nr__1) ! (mas) Mean value for parallax (plx_mean)
      real*4        e_plxMean_1(nr__1) ! (mas) Variance for parallax (parallax_err)
      real*4        plxMode_1  (nr__1) ! (mas) Mode value for parallax (parallax_mode)
      real*4        plxMed_1   (nr__1) ! (mas) Median value for parallax (parallax_median)
      real*4        e1_plx_2   (nr__1) ! (mas) Lower boundary of 1-sigma range for
*                                      parallax (parallax_low_1sigma)
      real*4        E1_plx_3   (nr__1) ! (mas) Upper boundary of 1-sigma range for
*                                      parallax (parallax_up_1sigma)
      real*4        e3_plx_2   (nr__1) ! (mas) Lower boundary of 3-sigma range for
*                                      parallax (parallax_low_3sigma)
      real*4        E3_plx_3   (nr__1) ! (mas) Upper boundary of 3-sigma range for
*                                      parallax (parallax_up_3sigma)
      character*1   plxFit_1   (nr__1) ! (mas) Fitting function for parallax
*                                      (parallax_fit) (3)
      real*4        plxPar1_1  (nr__1) ! (mas) First fit parameter for parallax
*                                      (plx_par_1) (4)
      real*4        plxPar2_1  (nr__1) ! (mas) First fit parameter for parallax
*                                      (plx_par_2) (4)
      real*4        plxPar3_1  (nr__1) ! (mas) First fit parameter for parallax
*                                      (plx_par_3) (4)
      real*4        plxPar4_1  (nr__1) ! (mas) First fit parameter for parallax
*                                      (plx_par_4) (4)
      real*4        plxPar5_1  (nr__1) ! (mas) First fit parameter for parallax
*                                      (plx_par_5) (4)
      real*4        DM_AgeSlope_1(nr__1) ! Slope of the distance modulus-log(Age)
*                                      relation (dm_age_slope)
      real*4        DM_AgeInter_1(nr__1) ! Intercept of the distance modulus-log(Age)
*                                      relation (dm_age_intercept)
      real*4        DM_AgeSct_1(nr__1) ! Scatter of the distance modulus-log(Age)
*                                      relation (dm_age_scatter)
      real*4        DM_AgeMad_1(nr__1) ! MAD of the distance modulus-log(Age)
*                                      relation (dm_age_mad)
      real*4        Age_DMSlope_1(nr__1) ! Slope of the log(Age)-distance modulus
*                                      relation (age_dm_slope)
      real*4        Age_DMInter_1(nr__1) ! Intercept of the log(Age)-distance modulus
*                                      relation (age_dm_intercept)
      real*4        Age_DMSct_1(nr__1) ! Scatter of the log(Age)-distance modulus
*                                      relation (age_dm_scatter)
      real*4        Age_DMMad_1(nr__1) ! MAD of the log(Age)-distance modulus
*                                      relation (age_dm_mad)
      real*4        DM_MassSlope_1(nr__1) ! Slope of the distance modulus-log(Mass)
*                                      relation (dm_mass_slope)
      real*4        DM_MassInter_1(nr__1) ! Intercept of the distance modulus-log(Mass)
*                                      relation (dm_mass_intercept)
      real*4        DM_MassSct_1(nr__1) ! Scatter of the distance modulus-log(Mass)
*                                      relation (dm_mass_scatter)
      real*4        DM_MassMad_1(nr__1) ! MAD of the distance modulus-log(Mass)
*                                      relation (dm_mass_mad)
      real*4        DM_smooth_1(nr__1) ! (mag) [0/7] Smoothing parameter for PDF for
*                                      distance modulus
*                                      (distance_modulus_smooth) (5)
      real*4        Ext_smooth_1(nr__1) ! (mag) [0/7] Smoothing parameter for PDF for
*                                      extinction in 2MASS k-band
*                                      (extinction_smooth) (5)
*Note (1): Evolutionary stage as follows:
*     I = Pre-core-helium burning;
*    II = Core-helium burning stars;
*   III = Asymptotic giant branch stars (post-core-helium burning).
*Note (2): Quality flag (see section 6.1) as follows:
*     1 = single PDF
*     A = highest-weight USPDF has power of 0.9 or more
*     B = 1st and 2nd priority USPDFs together have power of 0.9 or more
*     C = 1st, 2nd, and 3rd priority USPDFs together have power of 0.9 or more
*     D = 1st, 2nd, and 3rd priority USPDFs together have power of less than 0.9
*     L = low power USPDF (between 0.03 and 0.1)
*     E = USPDF has psed<0.1 (possibly bad photometry)
*     X = highest weight USPDF has pbest<0.1 (likely off the model grid)
*     N = USPDF has less than 10 models (unreliable result)
*Note (3): A character indicating which fitting function was chosen as follows:
*     G = Gaussian
*     S = Skewed Gaussian
*     T = Truncated Gaussian
*     L = Modified truncated exponential distribution (MTED)
*     P = Truncated Student's t-distribution
*     E = Fit failed for all five above functions
*     N = There was not enough data for a fit
*Note (4): *Par* columns are parameters for a chosen fitting function.
*     The first two values are location and shape for the chosen best
*     fitting function. For a Gaussian function, by definition, location
*     parameter is equal to the mean value and shape parameter to the variance.
*     If the chosen function is a skewed Gaussian then the third value is the
*     skew value. If the chosen function is a truncated Gaussian or MTED, then
*     third and fourth values are lower and upper limits. If the chosen function
*     is Student's t-distribution then the third value is the number of degrees
*     of freedom and the fourth and fifth values are lower and upper limits.
*Note (5): Gaussian smoothing coefficients for distance modulus and extinction
*     PDFs, see section 4.1

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'apokas14.dat'	! Parameters for APOKASC (APOKASC_2014)

      integer*4 nr__2
      parameter (nr__2=3626)	! Number of records
      character*1015 ar__2  	! Full-size record

C  J2000.0 position composed of: RAdeg DEdeg
      character*18  Survey_2   (nr__2) ! Input survey designation (survey)
      character*45  ID_2       (nr__2) ! Unique ID of the star from the input
*                                      data (id)
      real*8        GLON_2     (nr__2) ! (deg) Galactic longitude (l)
      real*4        GLAT_2     (nr__2) ! (deg) Galactic latitude (b)
      real*8        RAdeg_2    (nr__2) ! (deg) Right Ascension J2000.0 (raj2000)
      real*8        DEdeg_2    (nr__2) ! (deg) Declination J2000.0 (dej2000)
      integer*4     USPDFPri_2 (nr__2) ! [0/7] Priority order of a given USPDF
*                                      (starting from 0) (uspdf_priority)
      integer*4     USPDFpts_2 (nr__2) ! Number of models used for UPSDF
*                                      (uspdf_points)
      integer*4     Stage_2    (nr__2) ! [1/3] Stage number (I, II or III)
*                                      (stage) (1)
      real*4        USPDFW_2   (nr__2) ! [0.030/1.000] Weight of a given USPDF
*                                      (uspdf_weight)
      integer*4     TUSPDF_2   (nr__2) ! [1/8] Number of USPDF with weight >0.03
*                                      (total_uspdfs)
      character*1   Qual_2     (nr__2) ! Quality flag (quality) (2)
      real*4        Pbest_2    (nr__2) ! [0/1] Probability for a best-fitting model
*                                      (p_best)
      real*4        Psed_2     (nr__2) ! [0/1] p-value from chi-squared SED fit
*                                      (p_sed)
      real*4        logAgeMean_2(nr__2) ! ([yr]) Mean value for logarithm of age (ageMean)
      real*4        e_logAgeMean_2(nr__2) ! ([yr]) Variance for logarithm of age (age_err)
      real*4        logAgeMode_2(nr__2) ! ([yr]) Mode value for logarithm of age (ageMode)
      real*4        logAgeMed_2(nr__2) ! ([yr]) Median value for logarithm of age (ageMed)
      real*4        e1_logAge_4(nr__2) ! ([yr]) Lower boundary of 1-sigma range for
*                                      logarithm of age (age_low_1sigma)
      real*4        E1_logAge_5(nr__2) ! ([yr]) Upper boundary of 1-sigma range for
*                                      logarithm of age (age_up_1sigma)
      real*4        e3_logAge_4(nr__2) ! ([yr]) Lower boundary of 3-sigma range for
*                                      logarithm of age (age_low_3sigma)
      real*4        E3_logAge_5(nr__2) ! ([yr]) Upper boundary of 3-sigma range for
*                                      logarithm of age (age_up_3sigma)
      character*1   logAgeFit_2(nr__2) ! ([yr]) Fitting function for logarithm of age
*                                      (ageFit) (3)
      real*8        logAgePar1_2(nr__2) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_1) (4)
      real*4        logAgePar2_2(nr__2) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_2) (4)
      real*4        logAgePar3_2(nr__2) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_3) (4)
      real*4        logAgePar4_2(nr__2) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_4) (4)
      real*4        logAgePar5_2(nr__2) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_5) (4)
      real*4        MassMean_2 (nr__2) ! (Msun) Mean value for mass (mass_mean)
      real*4        e_MassMean_2(nr__2) ! (Msun) Variance for mass (mass_err)
      real*4        MassMode_2 (nr__2) ! (Msun) Mode value for mass (mass_mode)
      real*4        MassMed_2  (nr__2) ! (Msun) Median value for mass (mass_median)
      real*4        e1_Mass_4  (nr__2) ! (Msun) Lower boundary of 1-sigma range for mass
*                                      (mass_low_1sigma)
      real*4        E1_Mass_5  (nr__2) ! (Msun) Upper boundary of 1-sigma range for mass
*                                      (mass_up_1sigma)
      real*4        e3_Mass_4  (nr__2) ! (Msun) Lower boundary of 3-sigma range for mass
*                                      (mass_low_3sigma)
      real*4        E3_Mass_5  (nr__2) ! (Msun) Upper boundary of 3-sigma range for mass
*                                      (mass_up_3sigma)
      character*1   MassFit_2  (nr__2) ! (Msun) Fitting function for mass
*                                      (mass_fit) (3)
      real*4        MassPar1_2 (nr__2) ! (Msun) First fit parameter for mass
*                                      (mass_par_1) (4)
      real*4        MassPar2_2 (nr__2) ! (Msun) First fit parameter for mass
*                                      (mass_par_2) (4)
      real*4        MassPar3_2 (nr__2) ! (Msun) First fit parameter for mass
*                                      (mass_par_3) (4)
      real*4        MassPar4_2 (nr__2) ! (Msun) First fit parameter for mass
*                                      (mass_par_4) (4)
      real*4        MassPar5_2 (nr__2) ! (Msun) First fit parameter for mass
*                                      (mass_par_5) (4)
      real*8        DMMean_2   (nr__2) ! (mag) Mean value for distance modulus
*                                      (distance_modulus_mean)
      real*4        e_DMMean_2 (nr__2) ! (mag) Variance for distance modulus
*                                      (distance_modulus_err)
      real*8        DMMode_2   (nr__2) ! (mag) Mode value for distance modulus
*                                      (distance_modulus_mode)
      real*8        DMMed_2    (nr__2) ! (mag) Median value for distance modulus
*                                      (distance_modulus_median)
      real*8        e1_DM_4    (nr__2) ! (mag) Lower boundary of 1-sigma range for
*                                      distance modulus
*                                      (distance_modulus_low_1sigma)
      real*8        E1_DM_5    (nr__2) ! (mag) Upper boundary of 1-sigma range for
*                                      distance modulus
*                                      (distance_modulus_up_1sigma)
      real*8        e3_DM_4    (nr__2) ! (mag) Lower boundary of 3-sigma range for
*                                      distance modulus
*                                      (distance_modulus_low_3sigma)
      real*8        E3_DM_5    (nr__2) ! (mag) Upper boundary of 3-sigma range for
*                                      distance modulus
*                                      (distance_modulus_up_3sigma)
      character*1   DMFit_2    (nr__2) ! (mag) Fitting function for distance modulus
*                                      (distance_modulusFit) (3)
      real*8        DMPar1_2   (nr__2) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_1) (4)
      real*4        DMPar2_2   (nr__2) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_2) (4)
      real*4        DMPar3_2   (nr__2) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_3) (4)
      real*8        DMPar4_2   (nr__2) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_4) (4)
      real*8        DMPar5_2   (nr__2) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_5) (4)
      real*4        ExtMean_2  (nr__2) ! (mag) Mean value for extinction in 2MASS K-band
*                                      (extinction_mean)
      real*4        e_ExtMean_2(nr__2) ! (mag) Variance for extinction in 2MASS K-band
*                                      (extinction_err)
      real*4        ExtMode_2  (nr__2) ! (mag) Mode value for extinction in 2MASS K-band
*                                      (extinction_mode)
      real*4        ExtMed_2   (nr__2) ! (mag) Median value for extinction in 2MASS K-band
*                                      (extinction_median)
      real*4        e1_Ext_4   (nr__2) ! (mag) Lower boundary of 1-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_low_1sigma)
      real*4        E1_Ext_5   (nr__2) ! (mag) Upper boundary of 1-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_up_1sigma)
      real*4        e3_Ext_4   (nr__2) ! (mag) Lower boundary of 3-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_low_3sigma)
      real*4        E3_Ext_5   (nr__2) ! (mag) Upper boundary of 3-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_up_3sigma)
      character*1   ExtFit_2   (nr__2) ! (mag) Fitting function for extinction in
*                                      2MASS K-band (extinction_fit) (3)
      real*8        ExtPar1_2  (nr__2) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_1) (4)
      real*4        ExtPar2_2  (nr__2) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_2) (4)
      real*4        ExtPar3_2  (nr__2) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_3) (4)
      real*4        ExtPar4_2  (nr__2) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_4) (4)
      real*4        ExtPar5_2  (nr__2) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_5) (4)
      real*8        DistMean_2 (nr__2) ! (kpc) Mean value for distance (Distmean)
      real*4        e_DistMean_2(nr__2) ! (kpc) Variance for distance (distance_err)
      real*8        DistMod_2  (nr__2) ! (kpc) Mode value for distance (distanceMode)
      real*8        DistMed_2  (nr__2) ! (kpc) Median value for distance (distanceMed)
      real*8        e1_Dist_4  (nr__2) ! (kpc) Lower boundary of 1-sigma range for
*                                      distance (distance_low_1sigma)
      real*8        E1_Dist_5  (nr__2) ! (kpc) Upper boundary of 1-sigma range for
*                                      distance (distance_up_1sigma)
      real*4        e3_Dist_4  (nr__2) ! (kpc) Lower boundary of 3-sigma range for
*                                      distance (distance_low_3sigma)
      real*4        E3_Dist_5  (nr__2) ! (kpc) Upper boundary of 3-sigma range for
*                                      distance (distance_up_3sigma)
      character*1   DistFit_2  (nr__2) ! (kpc) Fitting function for distance
*                                      (distanceFit) (3)
      real*4        DistPar1_2 (nr__2) ! (kpc) First fit parameter for distance
*                                      (Distpar_1) (4)
      real*4        DistPar2_2 (nr__2) ! (kpc) First fit parameter for distance
*                                      (Distpar_2) (4)
      real*4        DistPar3_2 (nr__2) ! (kpc) First fit parameter for distance
*                                      (Distpar_3) (4)
      real*4        DistPar4_2 (nr__2) ! (kpc) First fit parameter for distance
*                                      (Distpar_4) (4)
      real*8        DistPar5_2 (nr__2) ! (kpc) First fit parameter for distance
*                                      (Distpar_5) (4)
      real*4        plxMean_2  (nr__2) ! (mas) Mean value for parallax (plx_mean)
      real*4        e_plxMean_2(nr__2) ! (mas) Variance for parallax (parallax_err)
      real*4        plxMode_2  (nr__2) ! (mas) Mode value for parallax (parallax_mode)
      real*4        plxMed_2   (nr__2) ! (mas) Median value for parallax (parallax_median)
      real*4        e1_plx_4   (nr__2) ! (mas) Lower boundary of 1-sigma range for
*                                      parallax (parallax_low_1sigma)
      real*4        E1_plx_5   (nr__2) ! (mas) Upper boundary of 1-sigma range for
*                                      parallax (parallax_up_1sigma)
      real*4        e3_plx_4   (nr__2) ! (mas) Lower boundary of 3-sigma range for
*                                      parallax (parallax_low_3sigma)
      real*4        E3_plx_5   (nr__2) ! (mas) Upper boundary of 3-sigma range for
*                                      parallax (parallax_up_3sigma)
      character*1   plxFit_2   (nr__2) ! (mas) Fitting function for parallax
*                                      (parallax_fit) (3)
      real*4        plxPar1_2  (nr__2) ! (mas) First fit parameter for parallax
*                                      (plx_par_1) (4)
      real*4        plxPar2_2  (nr__2) ! (mas) First fit parameter for parallax
*                                      (plx_par_2) (4)
      real*4        plxPar3_2  (nr__2) ! (mas) First fit parameter for parallax
*                                      (plx_par_3) (4)
      real*4        plxPar4_2  (nr__2) ! (mas) First fit parameter for parallax
*                                      (plx_par_4) (4)
      real*4        plxPar5_2  (nr__2) ! (mas) First fit parameter for parallax
*                                      (plx_par_5) (4)
      real*4        DM_AgeSlope_2(nr__2) ! Slope of the distance modulus-log(Age)
*                                      relation (dm_age_slope)
      real*4        DM_AgeInter_2(nr__2) ! Intercept of the distance modulus-log(Age)
*                                      relation (dm_age_intercept)
      real*4        DM_AgeSct_2(nr__2) ! Scatter of the distance modulus-log(Age)
*                                      relation (dm_age_scatter)
      real*4        DM_AgeMad_2(nr__2) ! MAD of the distance modulus-log(Age)
*                                      relation (dm_age_mad)
      real*4        Age_DMSlope_2(nr__2) ! Slope of the log(Age)-distance modulus
*                                      relation (age_dm_slope)
      real*4        Age_DMInter_2(nr__2) ! Intercept of the log(Age)-distance modulus
*                                      relation (age_dm_intercept)
      real*4        Age_DMSct_2(nr__2) ! Scatter of the log(Age)-distance modulus
*                                      relation (age_dm_scatter)
      real*4        Age_DMMad_2(nr__2) ! MAD of the log(Age)-distance modulus
*                                      relation (age_dm_mad)
      real*4        DM_MassSlope_2(nr__2) ! Slope of the distance modulus-log(Mass)
*                                      relation (dm_mass_slope)
      real*4        DM_MassInter_2(nr__2) ! Intercept of the distance modulus-log(Mass)
*                                      relation (dm_mass_intercept)
      real*4        DM_MassSct_2(nr__2) ! Scatter of the distance modulus-log(Mass)
*                                      relation (dm_mass_scatter)
      real*4        DM_MassMad_2(nr__2) ! MAD of the distance modulus-log(Mass)
*                                      relation (dm_mass_mad)
      real*4        DM_smooth_2(nr__2) ! (mag) [0/7] Smoothing parameter for PDF for
*                                      distance modulus
*                                      (distance_modulus_smooth) (5)
      real*4        Ext_smooth_2(nr__2) ! (mag) [0/7] Smoothing parameter for PDF for
*                                      extinction in 2MASS k-band
*                                      (extinction_smooth) (5)
*Note (1): Evolutionary stage as follows:
*     I = Pre-core-helium burning;
*    II = Core-helium burning stars;
*   III = Asymptotic giant branch stars (post-core-helium burning).
*Note (2): Quality flag (see section 6.1) as follows:
*     1 = single PDF
*     A = highest-weight USPDF has power of 0.9 or more
*     B = 1st and 2nd priority USPDFs together have power of 0.9 or more
*     C = 1st, 2nd, and 3rd priority USPDFs together have power of 0.9 or more
*     D = 1st, 2nd, and 3rd priority USPDFs together have power of less than 0.9
*     L = low power USPDF (between 0.03 and 0.1)
*     E = USPDF has psed<0.1 (possibly bad photometry)
*     X = highest weight USPDF has pbest<0.1 (likely off the model grid)
*     N = USPDF has less than 10 models (unreliable result)
*Note (3): A character indicating which fitting function was chosen as follows:
*     G = Gaussian
*     S = Skewed Gaussian
*     T = Truncated Gaussian
*     L = Modified truncated exponential distribution (MTED)
*     P = Truncated Student's t-distribution
*     E = Fit failed for all five above functions
*     N = There was not enough data for a fit
*Note (4): *Par* columns are parameters for a chosen fitting function.
*     The first two values are location and shape for the chosen best
*     fitting function. For a Gaussian function, by definition, location
*     parameter is equal to the mean value and shape parameter to the variance.
*     If the chosen function is a skewed Gaussian then the third value is the
*     skew value. If the chosen function is a truncated Gaussian or MTED, then
*     third and fourth values are lower and upper limits. If the chosen function
*     is Student's t-distribution then the third value is the number of degrees
*     of freedom and the fourth and fifth values are lower and upper limits.
*Note (5): Gaussian smoothing coefficients for distance modulus and extinction
*     PDFs, see section 4.1

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'rave_dr5.dat'	! Parameters for RAVE DR5 (RAVE_DR5)

      integer*4 nr__3
      parameter (nr__3=851808)	! Number of records
      character*1015 ar__3  	! Full-size record

C  J2000.0 position composed of: RAdeg DEdeg
      character*18  Survey_3   (nr__3) ! Input survey designation (survey)
      character*45  ID_3       (nr__3) ! Unique ID of the star from the input
*                                      data (id)
      real*8        GLON_3     (nr__3) ! (deg) Galactic longitude (l)
      real*4        GLAT_3     (nr__3) ! (deg) Galactic latitude (b)
      real*8        RAdeg_3    (nr__3) ! (deg) Right Ascension J2000.0 (raj2000)
      real*8        DEdeg_3    (nr__3) ! (deg) Declination J2000.0 (dej2000)
      integer*4     USPDFPri_3 (nr__3) ! [0/7] Priority order of a given USPDF
*                                      (starting from 0) (uspdf_priority)
      integer*4     USPDFpts_3 (nr__3) ! Number of models used for UPSDF
*                                      (uspdf_points)
      integer*4     Stage_3    (nr__3) ! [1/3] Stage number (I, II or III)
*                                      (stage) (1)
      real*4        USPDFW_3   (nr__3) ! [0.030/1.000] Weight of a given USPDF
*                                      (uspdf_weight)
      integer*4     TUSPDF_3   (nr__3) ! [1/8] Number of USPDF with weight >0.03
*                                      (total_uspdfs)
      character*1   Qual_3     (nr__3) ! Quality flag (quality) (2)
      real*4        Pbest_3    (nr__3) ! [0/1] Probability for a best-fitting model
*                                      (p_best)
      real*4        Psed_3     (nr__3) ! [0/1] p-value from chi-squared SED fit
*                                      (p_sed)
      real*4        logAgeMean_3(nr__3) ! ([yr]) Mean value for logarithm of age (ageMean)
      real*4        e_logAgeMean_3(nr__3) ! ([yr]) Variance for logarithm of age (age_err)
      real*4        logAgeMode_3(nr__3) ! ([yr]) Mode value for logarithm of age (ageMode)
      real*4        logAgeMed_3(nr__3) ! ([yr]) Median value for logarithm of age (ageMed)
      real*4        e1_logAge_6(nr__3) ! ([yr]) Lower boundary of 1-sigma range for
*                                      logarithm of age (age_low_1sigma)
      real*4        E1_logAge_7(nr__3) ! ([yr]) Upper boundary of 1-sigma range for
*                                      logarithm of age (age_up_1sigma)
      real*4        e3_logAge_6(nr__3) ! ([yr]) Lower boundary of 3-sigma range for
*                                      logarithm of age (age_low_3sigma)
      real*4        E3_logAge_7(nr__3) ! ([yr]) Upper boundary of 3-sigma range for
*                                      logarithm of age (age_up_3sigma)
      character*1   logAgeFit_3(nr__3) ! ([yr]) Fitting function for logarithm of age
*                                      (ageFit) (3)
      real*8        logAgePar1_3(nr__3) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_1) (4)
      real*4        logAgePar2_3(nr__3) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_2) (4)
      real*4        logAgePar3_3(nr__3) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_3) (4)
      real*4        logAgePar4_3(nr__3) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_4) (4)
      real*4        logAgePar5_3(nr__3) ! ([yr]) First fit parameter for logarithm of age
*                                      (age_par_5) (4)
      real*4        MassMean_3 (nr__3) ! (Msun) Mean value for mass (mass_mean)
      real*4        e_MassMean_3(nr__3) ! (Msun) Variance for mass (mass_err)
      real*4        MassMode_3 (nr__3) ! (Msun) Mode value for mass (mass_mode)
      real*4        MassMed_3  (nr__3) ! (Msun) Median value for mass (mass_median)
      real*4        e1_Mass_6  (nr__3) ! (Msun) Lower boundary of 1-sigma range for mass
*                                      (mass_low_1sigma)
      real*4        E1_Mass_7  (nr__3) ! (Msun) Upper boundary of 1-sigma range for mass
*                                      (mass_up_1sigma)
      real*4        e3_Mass_6  (nr__3) ! (Msun) Lower boundary of 3-sigma range for mass
*                                      (mass_low_3sigma)
      real*4        E3_Mass_7  (nr__3) ! (Msun) Upper boundary of 3-sigma range for mass
*                                      (mass_up_3sigma)
      character*1   MassFit_3  (nr__3) ! (Msun) Fitting function for mass
*                                      (mass_fit) (3)
      real*4        MassPar1_3 (nr__3) ! (Msun) First fit parameter for mass
*                                      (mass_par_1) (4)
      real*4        MassPar2_3 (nr__3) ! (Msun) First fit parameter for mass
*                                      (mass_par_2) (4)
      real*4        MassPar3_3 (nr__3) ! (Msun) First fit parameter for mass
*                                      (mass_par_3) (4)
      real*4        MassPar4_3 (nr__3) ! (Msun) First fit parameter for mass
*                                      (mass_par_4) (4)
      real*4        MassPar5_3 (nr__3) ! (Msun) First fit parameter for mass
*                                      (mass_par_5) (4)
      real*8        DMMean_3   (nr__3) ! (mag) Mean value for distance modulus
*                                      (distance_modulus_mean)
      real*4        e_DMMean_3 (nr__3) ! (mag) Variance for distance modulus
*                                      (distance_modulus_err)
      real*8        DMMode_3   (nr__3) ! (mag) Mode value for distance modulus
*                                      (distance_modulus_mode)
      real*8        DMMed_3    (nr__3) ! (mag) Median value for distance modulus
*                                      (distance_modulus_median)
      real*8        e1_DM_6    (nr__3) ! (mag) Lower boundary of 1-sigma range for
*                                      distance modulus
*                                      (distance_modulus_low_1sigma)
      real*8        E1_DM_7    (nr__3) ! (mag) Upper boundary of 1-sigma range for
*                                      distance modulus
*                                      (distance_modulus_up_1sigma)
      real*8        e3_DM_6    (nr__3) ! (mag) Lower boundary of 3-sigma range for
*                                      distance modulus
*                                      (distance_modulus_low_3sigma)
      real*8        E3_DM_7    (nr__3) ! (mag) Upper boundary of 3-sigma range for
*                                      distance modulus
*                                      (distance_modulus_up_3sigma)
      character*1   DMFit_3    (nr__3) ! (mag) Fitting function for distance modulus
*                                      (distance_modulusFit) (3)
      real*8        DMPar1_3   (nr__3) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_1) (4)
      real*4        DMPar2_3   (nr__3) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_2) (4)
      real*4        DMPar3_3   (nr__3) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_3) (4)
      real*8        DMPar4_3   (nr__3) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_4) (4)
      real*8        DMPar5_3   (nr__3) ! (mag) First fit parameter for distance modulus
*                                      (distance_modulus_par_5) (4)
      real*4        ExtMean_3  (nr__3) ! (mag) Mean value for extinction in 2MASS K-band
*                                      (extinction_mean)
      real*4        e_ExtMean_3(nr__3) ! (mag) Variance for extinction in 2MASS K-band
*                                      (extinction_err)
      real*4        ExtMode_3  (nr__3) ! (mag) Mode value for extinction in 2MASS K-band
*                                      (extinction_mode)
      real*4        ExtMed_3   (nr__3) ! (mag) Median value for extinction in 2MASS K-band
*                                      (extinction_median)
      real*4        e1_Ext_6   (nr__3) ! (mag) Lower boundary of 1-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_low_1sigma)
      real*4        E1_Ext_7   (nr__3) ! (mag) Upper boundary of 1-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_up_1sigma)
      real*4        e3_Ext_6   (nr__3) ! (mag) Lower boundary of 3-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_low_3sigma)
      real*4        E3_Ext_7   (nr__3) ! (mag) Upper boundary of 3-sigma range for
*                                      extinction in 2MASS K-band
*                                      (extinction_up_3sigma)
      character*1   ExtFit_3   (nr__3) ! (mag) Fitting function for extinction in
*                                      2MASS K-band (extinction_fit) (3)
      real*8        ExtPar1_3  (nr__3) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_1) (4)
      real*4        ExtPar2_3  (nr__3) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_2) (4)
      real*4        ExtPar3_3  (nr__3) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_3) (4)
      real*4        ExtPar4_3  (nr__3) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_4) (4)
      real*4        ExtPar5_3  (nr__3) ! (mag) First fit parameter for extinction in
*                                      2MASS K-band (extinction_par_5) (4)
      real*8        DistMean_3 (nr__3) ! (kpc) Mean value for distance (Distmean)
      real*4        e_DistMean_3(nr__3) ! (kpc) Variance for distance (distance_err)
      real*8        DistMod_3  (nr__3) ! (kpc) Mode value for distance (distanceMode)
      real*8        DistMed_3  (nr__3) ! (kpc) Median value for distance (distanceMed)
      real*8        e1_Dist_6  (nr__3) ! (kpc) Lower boundary of 1-sigma range for
*                                      distance (distance_low_1sigma)
      real*8        E1_Dist_7  (nr__3) ! (kpc) Upper boundary of 1-sigma range for
*                                      distance (distance_up_1sigma)
      real*4        e3_Dist_6  (nr__3) ! (kpc) Lower boundary of 3-sigma range for
*                                      distance (distance_low_3sigma)
      real*4        E3_Dist_7  (nr__3) ! (kpc) Upper boundary of 3-sigma range for
*                                      distance (distance_up_3sigma)
      character*1   DistFit_3  (nr__3) ! (kpc) Fitting function for distance
*                                      (distanceFit) (3)
      real*4        DistPar1_3 (nr__3) ! (kpc) First fit parameter for distance
*                                      (Distpar_1) (4)
      real*4        DistPar2_3 (nr__3) ! (kpc) First fit parameter for distance
*                                      (Distpar_2) (4)
      real*4        DistPar3_3 (nr__3) ! (kpc) First fit parameter for distance
*                                      (Distpar_3) (4)
      real*4        DistPar4_3 (nr__3) ! (kpc) First fit parameter for distance
*                                      (Distpar_4) (4)
      real*8        DistPar5_3 (nr__3) ! (kpc) First fit parameter for distance
*                                      (Distpar_5) (4)
      real*4        plxMean_3  (nr__3) ! (mas) Mean value for parallax (plx_mean)
      real*4        e_plxMean_3(nr__3) ! (mas) Variance for parallax (parallax_err)
      real*4        plxMode_3  (nr__3) ! (mas) Mode value for parallax (parallax_mode)
      real*4        plxMed_3   (nr__3) ! (mas) Median value for parallax (parallax_median)
      real*4        e1_plx_6   (nr__3) ! (mas) Lower boundary of 1-sigma range for
*                                      parallax (parallax_low_1sigma)
      real*4        E1_plx_7   (nr__3) ! (mas) Upper boundary of 1-sigma range for
*                                      parallax (parallax_up_1sigma)
      real*4        e3_plx_6   (nr__3) ! (mas) Lower boundary of 3-sigma range for
*                                      parallax (parallax_low_3sigma)
      real*4        E3_plx_7   (nr__3) ! (mas) Upper boundary of 3-sigma range for
*                                      parallax (parallax_up_3sigma)
      character*1   plxFit_3   (nr__3) ! (mas) Fitting function for parallax
*                                      (parallax_fit) (3)
      real*4        plxPar1_3  (nr__3) ! (mas) First fit parameter for parallax
*                                      (plx_par_1) (4)
      real*4        plxPar2_3  (nr__3) ! (mas) First fit parameter for parallax
*                                      (plx_par_2) (4)
      real*4        plxPar3_3  (nr__3) ! (mas) First fit parameter for parallax
*                                      (plx_par_3) (4)
      real*4        plxPar4_3  (nr__3) ! (mas) First fit parameter for parallax
*                                      (plx_par_4) (4)
      real*4        plxPar5_3  (nr__3) ! (mas) First fit parameter for parallax
*                                      (plx_par_5) (4)
      real*4        DM_AgeSlope_3(nr__3) ! Slope of the distance modulus-log(Age)
*                                      relation (dm_age_slope)
      real*4        DM_AgeInter_3(nr__3) ! Intercept of the distance modulus-log(Age)
*                                      relation (dm_age_intercept)
      real*4        DM_AgeSct_3(nr__3) ! Scatter of the distance modulus-log(Age)
*                                      relation (dm_age_scatter)
      real*4        DM_AgeMad_3(nr__3) ! MAD of the distance modulus-log(Age)
*                                      relation (dm_age_mad)
      real*4        Age_DMSlope_3(nr__3) ! Slope of the log(Age)-distance modulus
*                                      relation (age_dm_slope)
      real*4        Age_DMInter_3(nr__3) ! Intercept of the log(Age)-distance modulus
*                                      relation (age_dm_intercept)
      real*4        Age_DMSct_3(nr__3) ! Scatter of the log(Age)-distance modulus
*                                      relation (age_dm_scatter)
      real*4        Age_DMMad_3(nr__3) ! MAD of the log(Age)-distance modulus
*                                      relation (age_dm_mad)
      real*4        DM_MassSlope_3(nr__3) ! Slope of the distance modulus-log(Mass)
*                                      relation (dm_mass_slope)
      real*4        DM_MassInter_3(nr__3) ! Intercept of the distance modulus-log(Mass)
*                                      relation (dm_mass_intercept)
      real*4        DM_MassSct_3(nr__3) ! Scatter of the distance modulus-log(Mass)
*                                      relation (dm_mass_scatter)
      real*4        DM_MassMad_3(nr__3) ! MAD of the distance modulus-log(Mass)
*                                      relation (dm_mass_mad)
      real*4        DM_smooth_3(nr__3) ! (mag) [0/7] Smoothing parameter for PDF for
*                                      distance modulus
*                                      (distance_modulus_smooth) (5)
      real*4        Ext_smooth_3(nr__3) ! (mag) [0/7] Smoothing parameter for PDF for
*                                      extinction in 2MASS k-band
*                                      (extinction_smooth) (5)
*Note (1): Evolutionary stage as follows:
*     I = Pre-core-helium burning;
*    II = Core-helium burning stars;
*   III = Asymptotic giant branch stars (post-core-helium burning).
*Note (2): Quality flag (see section 6.1) as follows:
*     1 = single PDF
*     A = highest-weight USPDF has power of 0.9 or more
*     B = 1st and 2nd priority USPDFs together have power of 0.9 or more
*     C = 1st, 2nd, and 3rd priority USPDFs together have power of 0.9 or more
*     D = 1st, 2nd, and 3rd priority USPDFs together have power of less than 0.9
*     L = low power USPDF (between 0.03 and 0.1)
*     E = USPDF has psed<0.1 (possibly bad photometry)
*     X = highest weight USPDF has pbest<0.1 (likely off the model grid)
*     N = USPDF has less than 10 models (unreliable result)
*Note (3): A character indicating which fitting function was chosen as follows:
*     G = Gaussian
*     S = Skewed Gaussian
*     T = Truncated Gaussian
*     L = Modified truncated exponential distribution (MTED)
*     P = Truncated Student's t-distribution
*     E = Fit failed for all five above functions
*     N = There was not enough data for a fit
*Note (4): *Par* columns are parameters for a chosen fitting function.
*     The first two values are location and shape for the chosen best
*     fitting function. For a Gaussian function, by definition, location
*     parameter is equal to the mean value and shape parameter to the variance.
*     If the chosen function is a skewed Gaussian then the third value is the
*     skew value. If the chosen function is a truncated Gaussian or MTED, then
*     third and fourth values are lower and upper limits. If the chosen function
*     is Student's t-distribution then the third value is the number of degrees
*     of freedom and the fourth and fifth values are lower and upper limits.
*Note (5): Gaussian smoothing coefficients for distance modulus and extinction
*     PDFs, see section 4.1

C=============================================================================

C  Loading file 'unidam.dat'	! Parameters for the main catalogue (UniDAM)

C  Format for file interpretation

    1 format(
     +  A18,1X,A45,1X,F7.3,1X,E10.3,1X,F7.3,1X,F8.4,1X,I1,I7,1X,I1,1X,
     +  F5.3,1X,I1,1X,A1,1X,E10.3,1X,E10.3,1X,F6.3,1X,E10.3,1X,F6.3,
     +  1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,A1,1X,F9.3,1X,
     +  E10.3,1X,E10.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,E10.3,1X,F6.3,1X,
     +  F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,A1,1X,E10.3,1X,E10.3,
     +  1X,E10.3,1X,F6.3,1X,F6.3,1X,F8.4,1X,F5.3,1X,F7.3,1X,F7.3,1X,
     +  F7.3,1X,F7.3,1X,F7.3,1X,F7.3,1X,A1,1X,F7.3,1X,F5.3,1X,E10.3,
     +  1X,F7.3,1X,F7.3,1X,E10.3,1X,F5.3,1X,F6.3,1X,F6.3,1X,E10.3,1X,
     +  F6.3,1X,E10.3,1X,F6.3,1X,A1,1X,F8.4,1X,F5.3,1X,E10.3,1X,E10.3,
     +  1X,F6.3,1X,F11.3,1X,E10.3,1X,F11.3,1X,F11.3,1X,F11.3,1X,F11.3,
     +  1X,E10.3,1X,E10.3,1X,A1,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,F11.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,
     +  E10.3,1X,E10.3,1X,E10.3,1X,A1,1X,E10.3,1X,E10.3,1X,E10.3,1X,
     +  E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,E10.3,1X,F6.4,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,F5.3,1X,F5.3)

C  Effective file loading

      open(unit=1,status='old',file=
     +'unidam.dat')
      write(6,*) '....Loading file: unidam.dat'
      do i__=1,3847557
        read(1,'(A1015)')ar__
        read(ar__,1)
     +  Survey(i__),ID(i__),GLON(i__),GLAT(i__),RAdeg(i__),DEdeg(i__),
     +  USPDFPri(i__),USPDFpts(i__),Stage(i__),USPDFW(i__),
     +  TUSPDF(i__),Qual(i__),Pbest(i__),Psed(i__),logAgeMean(i__),
     +  e_logAgeMean(i__),logAgeMode(i__),logAgeMed(i__),
     +  e1_logAge(i__),E1_logAge_1(i__),e3_logAge(i__),
     +  E3_logAge_1(i__),logAgeFit(i__),logAgePar1(i__),
     +  logAgePar2(i__),logAgePar3(i__),logAgePar4(i__),
     +  logAgePar5(i__),MassMean(i__),e_MassMean(i__),MassMode(i__),
     +  MassMed(i__),e1_Mass(i__),E1_Mass_1(i__),e3_Mass(i__),
     +  E3_Mass_1(i__),MassFit(i__),MassPar1(i__),MassPar2(i__),
     +  MassPar3(i__),MassPar4(i__),MassPar5(i__),DMMean(i__),
     +  e_DMMean(i__),DMMode(i__),DMMed(i__),e1_DM(i__),E1_DM_1(i__),
     +  e3_DM(i__),E3_DM_1(i__),DMFit(i__),DMPar1(i__),DMPar2(i__),
     +  DMPar3(i__),DMPar4(i__),DMPar5(i__),ExtMean(i__),
     +  e_ExtMean(i__),ExtMode(i__),ExtMed(i__),e1_Ext(i__),
     +  E1_Ext_1(i__),e3_Ext(i__),E3_Ext_1(i__),ExtFit(i__),
     +  ExtPar1(i__),ExtPar2(i__),ExtPar3(i__),ExtPar4(i__),
     +  ExtPar5(i__),DistMean(i__),e_DistMean(i__),DistMod(i__),
     +  DistMed(i__),e1_Dist(i__),E1_Dist_1(i__),e3_Dist(i__),
     +  E3_Dist_1(i__),DistFit(i__),DistPar1(i__),DistPar2(i__),
     +  DistPar3(i__),DistPar4(i__),DistPar5(i__),plxMean(i__),
     +  e_plxMean(i__),plxMode(i__),plxMed(i__),e1_plx(i__),
     +  E1_plx_1(i__),e3_plx(i__),E3_plx_1(i__),plxFit(i__),
     +  plxPar1(i__),plxPar2(i__),plxPar3(i__),plxPar4(i__),
     +  plxPar5(i__),DM_AgeSlope(i__),DM_AgeInter(i__),DM_AgeSct(i__),
     +  DM_AgeMad(i__),Age_DMSlope(i__),Age_DMInter(i__),
     +  Age_DMSct(i__),Age_DMMad(i__),DM_MassSlope(i__),
     +  DM_MassInter(i__),DM_MassSct(i__),DM_MassMad(i__),
     +  DM_smooth(i__),Ext_smooth(i__)
c    ..............Just test output...........
        write(6,1)
     +  Survey(i__),ID(i__),GLON(i__),GLAT(i__),RAdeg(i__),DEdeg(i__),
     +  USPDFPri(i__),USPDFpts(i__),Stage(i__),USPDFW(i__),
     +  TUSPDF(i__),Qual(i__),Pbest(i__),Psed(i__),logAgeMean(i__),
     +  e_logAgeMean(i__),logAgeMode(i__),logAgeMed(i__),
     +  e1_logAge(i__),E1_logAge_1(i__),e3_logAge(i__),
     +  E3_logAge_1(i__),logAgeFit(i__),logAgePar1(i__),
     +  logAgePar2(i__),logAgePar3(i__),logAgePar4(i__),
     +  logAgePar5(i__),MassMean(i__),e_MassMean(i__),MassMode(i__),
     +  MassMed(i__),e1_Mass(i__),E1_Mass_1(i__),e3_Mass(i__),
     +  E3_Mass_1(i__),MassFit(i__),MassPar1(i__),MassPar2(i__),
     +  MassPar3(i__),MassPar4(i__),MassPar5(i__),DMMean(i__),
     +  e_DMMean(i__),DMMode(i__),DMMed(i__),e1_DM(i__),E1_DM_1(i__),
     +  e3_DM(i__),E3_DM_1(i__),DMFit(i__),DMPar1(i__),DMPar2(i__),
     +  DMPar3(i__),DMPar4(i__),DMPar5(i__),ExtMean(i__),
     +  e_ExtMean(i__),ExtMode(i__),ExtMed(i__),e1_Ext(i__),
     +  E1_Ext_1(i__),e3_Ext(i__),E3_Ext_1(i__),ExtFit(i__),
     +  ExtPar1(i__),ExtPar2(i__),ExtPar3(i__),ExtPar4(i__),
     +  ExtPar5(i__),DistMean(i__),e_DistMean(i__),DistMod(i__),
     +  DistMed(i__),e1_Dist(i__),E1_Dist_1(i__),e3_Dist(i__),
     +  E3_Dist_1(i__),DistFit(i__),DistPar1(i__),DistPar2(i__),
     +  DistPar3(i__),DistPar4(i__),DistPar5(i__),plxMean(i__),
     +  e_plxMean(i__),plxMode(i__),plxMed(i__),e1_plx(i__),
     +  E1_plx_1(i__),e3_plx(i__),E3_plx_1(i__),plxFit(i__),
     +  plxPar1(i__),plxPar2(i__),plxPar3(i__),plxPar4(i__),
     +  plxPar5(i__),DM_AgeSlope(i__),DM_AgeInter(i__),DM_AgeSct(i__),
     +  DM_AgeMad(i__),Age_DMSlope(i__),Age_DMInter(i__),
     +  Age_DMSct(i__),Age_DMMad(i__),DM_MassSlope(i__),
     +  DM_MassInter(i__),DM_MassSct(i__),DM_MassMad(i__),
     +  DM_smooth(i__),Ext_smooth(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================

C  Loading file 'apogee12.dat'	! Parameters for APOGEE DR12 (APOGEE_dr12)

C  Format for file interpretation

    2 format(
     +  A18,1X,A45,1X,F7.3,1X,E10.3,1X,F7.3,1X,F8.4,1X,I1,I7,1X,I1,1X,
     +  F5.3,1X,I1,1X,A1,1X,E10.3,1X,E10.3,1X,F6.3,1X,E10.3,1X,F6.3,
     +  1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,A1,1X,F9.3,1X,
     +  E10.3,1X,E10.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,E10.3,1X,F6.3,1X,
     +  F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,A1,1X,E10.3,1X,E10.3,
     +  1X,E10.3,1X,F6.3,1X,F6.3,1X,F8.4,1X,F5.3,1X,F7.3,1X,F7.3,1X,
     +  F7.3,1X,F7.3,1X,F7.3,1X,F7.3,1X,A1,1X,F7.3,1X,F5.3,1X,E10.3,
     +  1X,F7.3,1X,F7.3,1X,E10.3,1X,F5.3,1X,F6.3,1X,F6.3,1X,E10.3,1X,
     +  F6.3,1X,E10.3,1X,F6.3,1X,A1,1X,F8.4,1X,F5.3,1X,E10.3,1X,E10.3,
     +  1X,F6.3,1X,F11.3,1X,E10.3,1X,F11.3,1X,F11.3,1X,F11.3,1X,F11.3,
     +  1X,E10.3,1X,E10.3,1X,A1,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,F11.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,
     +  E10.3,1X,E10.3,1X,E10.3,1X,A1,1X,E10.3,1X,E10.3,1X,E10.3,1X,
     +  E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,E10.3,1X,F6.4,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,F5.3,1X,F5.3)

C  Effective file loading

      open(unit=1,status='old',file=
     +'apogee12.dat')
      write(6,*) '....Loading file: apogee12.dat'
      do i__=1,180703
        read(1,'(A1015)')ar__1
        read(ar__1,2)
     +  Survey_1(i__),ID_1(i__),GLON_1(i__),GLAT_1(i__),RAdeg_1(i__),
     +  DEdeg_1(i__),USPDFPri_1(i__),USPDFpts_1(i__),Stage_1(i__),
     +  USPDFW_1(i__),TUSPDF_1(i__),Qual_1(i__),Pbest_1(i__),
     +  Psed_1(i__),logAgeMean_1(i__),e_logAgeMean_1(i__),
     +  logAgeMode_1(i__),logAgeMed_1(i__),e1_logAge_2(i__),
     +  E1_logAge_3(i__),e3_logAge_2(i__),E3_logAge_3(i__),
     +  logAgeFit_1(i__),logAgePar1_1(i__),logAgePar2_1(i__),
     +  logAgePar3_1(i__),logAgePar4_1(i__),logAgePar5_1(i__),
     +  MassMean_1(i__),e_MassMean_1(i__),MassMode_1(i__),
     +  MassMed_1(i__),e1_Mass_2(i__),E1_Mass_3(i__),e3_Mass_2(i__),
     +  E3_Mass_3(i__),MassFit_1(i__),MassPar1_1(i__),MassPar2_1(i__),
     +  MassPar3_1(i__),MassPar4_1(i__),MassPar5_1(i__),DMMean_1(i__),
     +  e_DMMean_1(i__),DMMode_1(i__),DMMed_1(i__),e1_DM_2(i__),
     +  E1_DM_3(i__),e3_DM_2(i__),E3_DM_3(i__),DMFit_1(i__),
     +  DMPar1_1(i__),DMPar2_1(i__),DMPar3_1(i__),DMPar4_1(i__),
     +  DMPar5_1(i__),ExtMean_1(i__),e_ExtMean_1(i__),ExtMode_1(i__),
     +  ExtMed_1(i__),e1_Ext_2(i__),E1_Ext_3(i__),e3_Ext_2(i__),
     +  E3_Ext_3(i__),ExtFit_1(i__),ExtPar1_1(i__),ExtPar2_1(i__),
     +  ExtPar3_1(i__),ExtPar4_1(i__),ExtPar5_1(i__),DistMean_1(i__),
     +  e_DistMean_1(i__),DistMod_1(i__),DistMed_1(i__),
     +  e1_Dist_2(i__),E1_Dist_3(i__),e3_Dist_2(i__),E3_Dist_3(i__),
     +  DistFit_1(i__),DistPar1_1(i__),DistPar2_1(i__),
     +  DistPar3_1(i__),DistPar4_1(i__),DistPar5_1(i__),
     +  plxMean_1(i__),e_plxMean_1(i__),plxMode_1(i__),plxMed_1(i__),
     +  e1_plx_2(i__),E1_plx_3(i__),e3_plx_2(i__),E3_plx_3(i__),
     +  plxFit_1(i__),plxPar1_1(i__),plxPar2_1(i__),plxPar3_1(i__),
     +  plxPar4_1(i__),plxPar5_1(i__),DM_AgeSlope_1(i__),
     +  DM_AgeInter_1(i__),DM_AgeSct_1(i__),DM_AgeMad_1(i__),
     +  Age_DMSlope_1(i__),Age_DMInter_1(i__),Age_DMSct_1(i__),
     +  Age_DMMad_1(i__),DM_MassSlope_1(i__),DM_MassInter_1(i__),
     +  DM_MassSct_1(i__),DM_MassMad_1(i__),DM_smooth_1(i__),
     +  Ext_smooth_1(i__)
c    ..............Just test output...........
        write(6,2)
     +  Survey_1(i__),ID_1(i__),GLON_1(i__),GLAT_1(i__),RAdeg_1(i__),
     +  DEdeg_1(i__),USPDFPri_1(i__),USPDFpts_1(i__),Stage_1(i__),
     +  USPDFW_1(i__),TUSPDF_1(i__),Qual_1(i__),Pbest_1(i__),
     +  Psed_1(i__),logAgeMean_1(i__),e_logAgeMean_1(i__),
     +  logAgeMode_1(i__),logAgeMed_1(i__),e1_logAge_2(i__),
     +  E1_logAge_3(i__),e3_logAge_2(i__),E3_logAge_3(i__),
     +  logAgeFit_1(i__),logAgePar1_1(i__),logAgePar2_1(i__),
     +  logAgePar3_1(i__),logAgePar4_1(i__),logAgePar5_1(i__),
     +  MassMean_1(i__),e_MassMean_1(i__),MassMode_1(i__),
     +  MassMed_1(i__),e1_Mass_2(i__),E1_Mass_3(i__),e3_Mass_2(i__),
     +  E3_Mass_3(i__),MassFit_1(i__),MassPar1_1(i__),MassPar2_1(i__),
     +  MassPar3_1(i__),MassPar4_1(i__),MassPar5_1(i__),DMMean_1(i__),
     +  e_DMMean_1(i__),DMMode_1(i__),DMMed_1(i__),e1_DM_2(i__),
     +  E1_DM_3(i__),e3_DM_2(i__),E3_DM_3(i__),DMFit_1(i__),
     +  DMPar1_1(i__),DMPar2_1(i__),DMPar3_1(i__),DMPar4_1(i__),
     +  DMPar5_1(i__),ExtMean_1(i__),e_ExtMean_1(i__),ExtMode_1(i__),
     +  ExtMed_1(i__),e1_Ext_2(i__),E1_Ext_3(i__),e3_Ext_2(i__),
     +  E3_Ext_3(i__),ExtFit_1(i__),ExtPar1_1(i__),ExtPar2_1(i__),
     +  ExtPar3_1(i__),ExtPar4_1(i__),ExtPar5_1(i__),DistMean_1(i__),
     +  e_DistMean_1(i__),DistMod_1(i__),DistMed_1(i__),
     +  e1_Dist_2(i__),E1_Dist_3(i__),e3_Dist_2(i__),E3_Dist_3(i__),
     +  DistFit_1(i__),DistPar1_1(i__),DistPar2_1(i__),
     +  DistPar3_1(i__),DistPar4_1(i__),DistPar5_1(i__),
     +  plxMean_1(i__),e_plxMean_1(i__),plxMode_1(i__),plxMed_1(i__),
     +  e1_plx_2(i__),E1_plx_3(i__),e3_plx_2(i__),E3_plx_3(i__),
     +  plxFit_1(i__),plxPar1_1(i__),plxPar2_1(i__),plxPar3_1(i__),
     +  plxPar4_1(i__),plxPar5_1(i__),DM_AgeSlope_1(i__),
     +  DM_AgeInter_1(i__),DM_AgeSct_1(i__),DM_AgeMad_1(i__),
     +  Age_DMSlope_1(i__),Age_DMInter_1(i__),Age_DMSct_1(i__),
     +  Age_DMMad_1(i__),DM_MassSlope_1(i__),DM_MassInter_1(i__),
     +  DM_MassSct_1(i__),DM_MassMad_1(i__),DM_smooth_1(i__),
     +  Ext_smooth_1(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================

C  Loading file 'apokas14.dat'	! Parameters for APOKASC (APOKASC_2014)

C  Format for file interpretation

    3 format(
     +  A18,1X,A45,1X,F7.3,1X,E10.3,1X,F7.3,1X,F8.4,1X,I1,I7,1X,I1,1X,
     +  F5.3,1X,I1,1X,A1,1X,E10.3,1X,E10.3,1X,F6.3,1X,E10.3,1X,F6.3,
     +  1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,A1,1X,F9.3,1X,
     +  E10.3,1X,E10.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,E10.3,1X,F6.3,1X,
     +  F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,A1,1X,E10.3,1X,E10.3,
     +  1X,E10.3,1X,F6.3,1X,F6.3,1X,F8.4,1X,F5.3,1X,F7.3,1X,F7.3,1X,
     +  F7.3,1X,F7.3,1X,F7.3,1X,F7.3,1X,A1,1X,F7.3,1X,F5.3,1X,E10.3,
     +  1X,F7.3,1X,F7.3,1X,E10.3,1X,F5.3,1X,F6.3,1X,F6.3,1X,E10.3,1X,
     +  F6.3,1X,E10.3,1X,F6.3,1X,A1,1X,F8.4,1X,F5.3,1X,E10.3,1X,E10.3,
     +  1X,F6.3,1X,F11.3,1X,E10.3,1X,F11.3,1X,F11.3,1X,F11.3,1X,F11.3,
     +  1X,E10.3,1X,E10.3,1X,A1,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,F11.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,
     +  E10.3,1X,E10.3,1X,E10.3,1X,A1,1X,E10.3,1X,E10.3,1X,E10.3,1X,
     +  E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,E10.3,1X,F6.4,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,F5.3,1X,F5.3)

C  Effective file loading

      open(unit=1,status='old',file=
     +'apokas14.dat')
      write(6,*) '....Loading file: apokas14.dat'
      do i__=1,3626
        read(1,'(A1015)')ar__2
        read(ar__2,3)
     +  Survey_2(i__),ID_2(i__),GLON_2(i__),GLAT_2(i__),RAdeg_2(i__),
     +  DEdeg_2(i__),USPDFPri_2(i__),USPDFpts_2(i__),Stage_2(i__),
     +  USPDFW_2(i__),TUSPDF_2(i__),Qual_2(i__),Pbest_2(i__),
     +  Psed_2(i__),logAgeMean_2(i__),e_logAgeMean_2(i__),
     +  logAgeMode_2(i__),logAgeMed_2(i__),e1_logAge_4(i__),
     +  E1_logAge_5(i__),e3_logAge_4(i__),E3_logAge_5(i__),
     +  logAgeFit_2(i__),logAgePar1_2(i__),logAgePar2_2(i__),
     +  logAgePar3_2(i__),logAgePar4_2(i__),logAgePar5_2(i__),
     +  MassMean_2(i__),e_MassMean_2(i__),MassMode_2(i__),
     +  MassMed_2(i__),e1_Mass_4(i__),E1_Mass_5(i__),e3_Mass_4(i__),
     +  E3_Mass_5(i__),MassFit_2(i__),MassPar1_2(i__),MassPar2_2(i__),
     +  MassPar3_2(i__),MassPar4_2(i__),MassPar5_2(i__),DMMean_2(i__),
     +  e_DMMean_2(i__),DMMode_2(i__),DMMed_2(i__),e1_DM_4(i__),
     +  E1_DM_5(i__),e3_DM_4(i__),E3_DM_5(i__),DMFit_2(i__),
     +  DMPar1_2(i__),DMPar2_2(i__),DMPar3_2(i__),DMPar4_2(i__),
     +  DMPar5_2(i__),ExtMean_2(i__),e_ExtMean_2(i__),ExtMode_2(i__),
     +  ExtMed_2(i__),e1_Ext_4(i__),E1_Ext_5(i__),e3_Ext_4(i__),
     +  E3_Ext_5(i__),ExtFit_2(i__),ExtPar1_2(i__),ExtPar2_2(i__),
     +  ExtPar3_2(i__),ExtPar4_2(i__),ExtPar5_2(i__),DistMean_2(i__),
     +  e_DistMean_2(i__),DistMod_2(i__),DistMed_2(i__),
     +  e1_Dist_4(i__),E1_Dist_5(i__),e3_Dist_4(i__),E3_Dist_5(i__),
     +  DistFit_2(i__),DistPar1_2(i__),DistPar2_2(i__),
     +  DistPar3_2(i__),DistPar4_2(i__),DistPar5_2(i__),
     +  plxMean_2(i__),e_plxMean_2(i__),plxMode_2(i__),plxMed_2(i__),
     +  e1_plx_4(i__),E1_plx_5(i__),e3_plx_4(i__),E3_plx_5(i__),
     +  plxFit_2(i__),plxPar1_2(i__),plxPar2_2(i__),plxPar3_2(i__),
     +  plxPar4_2(i__),plxPar5_2(i__),DM_AgeSlope_2(i__),
     +  DM_AgeInter_2(i__),DM_AgeSct_2(i__),DM_AgeMad_2(i__),
     +  Age_DMSlope_2(i__),Age_DMInter_2(i__),Age_DMSct_2(i__),
     +  Age_DMMad_2(i__),DM_MassSlope_2(i__),DM_MassInter_2(i__),
     +  DM_MassSct_2(i__),DM_MassMad_2(i__),DM_smooth_2(i__),
     +  Ext_smooth_2(i__)
c    ..............Just test output...........
        write(6,3)
     +  Survey_2(i__),ID_2(i__),GLON_2(i__),GLAT_2(i__),RAdeg_2(i__),
     +  DEdeg_2(i__),USPDFPri_2(i__),USPDFpts_2(i__),Stage_2(i__),
     +  USPDFW_2(i__),TUSPDF_2(i__),Qual_2(i__),Pbest_2(i__),
     +  Psed_2(i__),logAgeMean_2(i__),e_logAgeMean_2(i__),
     +  logAgeMode_2(i__),logAgeMed_2(i__),e1_logAge_4(i__),
     +  E1_logAge_5(i__),e3_logAge_4(i__),E3_logAge_5(i__),
     +  logAgeFit_2(i__),logAgePar1_2(i__),logAgePar2_2(i__),
     +  logAgePar3_2(i__),logAgePar4_2(i__),logAgePar5_2(i__),
     +  MassMean_2(i__),e_MassMean_2(i__),MassMode_2(i__),
     +  MassMed_2(i__),e1_Mass_4(i__),E1_Mass_5(i__),e3_Mass_4(i__),
     +  E3_Mass_5(i__),MassFit_2(i__),MassPar1_2(i__),MassPar2_2(i__),
     +  MassPar3_2(i__),MassPar4_2(i__),MassPar5_2(i__),DMMean_2(i__),
     +  e_DMMean_2(i__),DMMode_2(i__),DMMed_2(i__),e1_DM_4(i__),
     +  E1_DM_5(i__),e3_DM_4(i__),E3_DM_5(i__),DMFit_2(i__),
     +  DMPar1_2(i__),DMPar2_2(i__),DMPar3_2(i__),DMPar4_2(i__),
     +  DMPar5_2(i__),ExtMean_2(i__),e_ExtMean_2(i__),ExtMode_2(i__),
     +  ExtMed_2(i__),e1_Ext_4(i__),E1_Ext_5(i__),e3_Ext_4(i__),
     +  E3_Ext_5(i__),ExtFit_2(i__),ExtPar1_2(i__),ExtPar2_2(i__),
     +  ExtPar3_2(i__),ExtPar4_2(i__),ExtPar5_2(i__),DistMean_2(i__),
     +  e_DistMean_2(i__),DistMod_2(i__),DistMed_2(i__),
     +  e1_Dist_4(i__),E1_Dist_5(i__),e3_Dist_4(i__),E3_Dist_5(i__),
     +  DistFit_2(i__),DistPar1_2(i__),DistPar2_2(i__),
     +  DistPar3_2(i__),DistPar4_2(i__),DistPar5_2(i__),
     +  plxMean_2(i__),e_plxMean_2(i__),plxMode_2(i__),plxMed_2(i__),
     +  e1_plx_4(i__),E1_plx_5(i__),e3_plx_4(i__),E3_plx_5(i__),
     +  plxFit_2(i__),plxPar1_2(i__),plxPar2_2(i__),plxPar3_2(i__),
     +  plxPar4_2(i__),plxPar5_2(i__),DM_AgeSlope_2(i__),
     +  DM_AgeInter_2(i__),DM_AgeSct_2(i__),DM_AgeMad_2(i__),
     +  Age_DMSlope_2(i__),Age_DMInter_2(i__),Age_DMSct_2(i__),
     +  Age_DMMad_2(i__),DM_MassSlope_2(i__),DM_MassInter_2(i__),
     +  DM_MassSct_2(i__),DM_MassMad_2(i__),DM_smooth_2(i__),
     +  Ext_smooth_2(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================

C  Loading file 'rave_dr5.dat'	! Parameters for RAVE DR5 (RAVE_DR5)

C  Format for file interpretation

    4 format(
     +  A18,1X,A45,1X,F7.3,1X,E10.3,1X,F7.3,1X,F8.4,1X,I1,I7,1X,I1,1X,
     +  F5.3,1X,I1,1X,A1,1X,E10.3,1X,E10.3,1X,F6.3,1X,E10.3,1X,F6.3,
     +  1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,A1,1X,F9.3,1X,
     +  E10.3,1X,E10.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,E10.3,1X,F6.3,1X,
     +  F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,F6.3,1X,A1,1X,E10.3,1X,E10.3,
     +  1X,E10.3,1X,F6.3,1X,F6.3,1X,F8.4,1X,F5.3,1X,F7.3,1X,F7.3,1X,
     +  F7.3,1X,F7.3,1X,F7.3,1X,F7.3,1X,A1,1X,F7.3,1X,F5.3,1X,E10.3,
     +  1X,F7.3,1X,F7.3,1X,E10.3,1X,F5.3,1X,F6.3,1X,F6.3,1X,E10.3,1X,
     +  F6.3,1X,E10.3,1X,F6.3,1X,A1,1X,F8.4,1X,F5.3,1X,E10.3,1X,E10.3,
     +  1X,F6.3,1X,F11.3,1X,E10.3,1X,F11.3,1X,F11.3,1X,F11.3,1X,F11.3,
     +  1X,E10.3,1X,E10.3,1X,A1,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,F11.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,
     +  E10.3,1X,E10.3,1X,E10.3,1X,A1,1X,E10.3,1X,E10.3,1X,E10.3,1X,
     +  E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,E10.3,1X,F6.4,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,1X,E10.3,
     +  1X,F5.3,1X,F5.3)

C  Effective file loading

      open(unit=1,status='old',file=
     +'rave_dr5.dat')
      write(6,*) '....Loading file: rave_dr5.dat'
      do i__=1,851808
        read(1,'(A1015)')ar__3
        read(ar__3,4)
     +  Survey_3(i__),ID_3(i__),GLON_3(i__),GLAT_3(i__),RAdeg_3(i__),
     +  DEdeg_3(i__),USPDFPri_3(i__),USPDFpts_3(i__),Stage_3(i__),
     +  USPDFW_3(i__),TUSPDF_3(i__),Qual_3(i__),Pbest_3(i__),
     +  Psed_3(i__),logAgeMean_3(i__),e_logAgeMean_3(i__),
     +  logAgeMode_3(i__),logAgeMed_3(i__),e1_logAge_6(i__),
     +  E1_logAge_7(i__),e3_logAge_6(i__),E3_logAge_7(i__),
     +  logAgeFit_3(i__),logAgePar1_3(i__),logAgePar2_3(i__),
     +  logAgePar3_3(i__),logAgePar4_3(i__),logAgePar5_3(i__),
     +  MassMean_3(i__),e_MassMean_3(i__),MassMode_3(i__),
     +  MassMed_3(i__),e1_Mass_6(i__),E1_Mass_7(i__),e3_Mass_6(i__),
     +  E3_Mass_7(i__),MassFit_3(i__),MassPar1_3(i__),MassPar2_3(i__),
     +  MassPar3_3(i__),MassPar4_3(i__),MassPar5_3(i__),DMMean_3(i__),
     +  e_DMMean_3(i__),DMMode_3(i__),DMMed_3(i__),e1_DM_6(i__),
     +  E1_DM_7(i__),e3_DM_6(i__),E3_DM_7(i__),DMFit_3(i__),
     +  DMPar1_3(i__),DMPar2_3(i__),DMPar3_3(i__),DMPar4_3(i__),
     +  DMPar5_3(i__),ExtMean_3(i__),e_ExtMean_3(i__),ExtMode_3(i__),
     +  ExtMed_3(i__),e1_Ext_6(i__),E1_Ext_7(i__),e3_Ext_6(i__),
     +  E3_Ext_7(i__),ExtFit_3(i__),ExtPar1_3(i__),ExtPar2_3(i__),
     +  ExtPar3_3(i__),ExtPar4_3(i__),ExtPar5_3(i__),DistMean_3(i__),
     +  e_DistMean_3(i__),DistMod_3(i__),DistMed_3(i__),
     +  e1_Dist_6(i__),E1_Dist_7(i__),e3_Dist_6(i__),E3_Dist_7(i__),
     +  DistFit_3(i__),DistPar1_3(i__),DistPar2_3(i__),
     +  DistPar3_3(i__),DistPar4_3(i__),DistPar5_3(i__),
     +  plxMean_3(i__),e_plxMean_3(i__),plxMode_3(i__),plxMed_3(i__),
     +  e1_plx_6(i__),E1_plx_7(i__),e3_plx_6(i__),E3_plx_7(i__),
     +  plxFit_3(i__),plxPar1_3(i__),plxPar2_3(i__),plxPar3_3(i__),
     +  plxPar4_3(i__),plxPar5_3(i__),DM_AgeSlope_3(i__),
     +  DM_AgeInter_3(i__),DM_AgeSct_3(i__),DM_AgeMad_3(i__),
     +  Age_DMSlope_3(i__),Age_DMInter_3(i__),Age_DMSct_3(i__),
     +  Age_DMMad_3(i__),DM_MassSlope_3(i__),DM_MassInter_3(i__),
     +  DM_MassSct_3(i__),DM_MassMad_3(i__),DM_smooth_3(i__),
     +  Ext_smooth_3(i__)
c    ..............Just test output...........
        write(6,4)
     +  Survey_3(i__),ID_3(i__),GLON_3(i__),GLAT_3(i__),RAdeg_3(i__),
     +  DEdeg_3(i__),USPDFPri_3(i__),USPDFpts_3(i__),Stage_3(i__),
     +  USPDFW_3(i__),TUSPDF_3(i__),Qual_3(i__),Pbest_3(i__),
     +  Psed_3(i__),logAgeMean_3(i__),e_logAgeMean_3(i__),
     +  logAgeMode_3(i__),logAgeMed_3(i__),e1_logAge_6(i__),
     +  E1_logAge_7(i__),e3_logAge_6(i__),E3_logAge_7(i__),
     +  logAgeFit_3(i__),logAgePar1_3(i__),logAgePar2_3(i__),
     +  logAgePar3_3(i__),logAgePar4_3(i__),logAgePar5_3(i__),
     +  MassMean_3(i__),e_MassMean_3(i__),MassMode_3(i__),
     +  MassMed_3(i__),e1_Mass_6(i__),E1_Mass_7(i__),e3_Mass_6(i__),
     +  E3_Mass_7(i__),MassFit_3(i__),MassPar1_3(i__),MassPar2_3(i__),
     +  MassPar3_3(i__),MassPar4_3(i__),MassPar5_3(i__),DMMean_3(i__),
     +  e_DMMean_3(i__),DMMode_3(i__),DMMed_3(i__),e1_DM_6(i__),
     +  E1_DM_7(i__),e3_DM_6(i__),E3_DM_7(i__),DMFit_3(i__),
     +  DMPar1_3(i__),DMPar2_3(i__),DMPar3_3(i__),DMPar4_3(i__),
     +  DMPar5_3(i__),ExtMean_3(i__),e_ExtMean_3(i__),ExtMode_3(i__),
     +  ExtMed_3(i__),e1_Ext_6(i__),E1_Ext_7(i__),e3_Ext_6(i__),
     +  E3_Ext_7(i__),ExtFit_3(i__),ExtPar1_3(i__),ExtPar2_3(i__),
     +  ExtPar3_3(i__),ExtPar4_3(i__),ExtPar5_3(i__),DistMean_3(i__),
     +  e_DistMean_3(i__),DistMod_3(i__),DistMed_3(i__),
     +  e1_Dist_6(i__),E1_Dist_7(i__),e3_Dist_6(i__),E3_Dist_7(i__),
     +  DistFit_3(i__),DistPar1_3(i__),DistPar2_3(i__),
     +  DistPar3_3(i__),DistPar4_3(i__),DistPar5_3(i__),
     +  plxMean_3(i__),e_plxMean_3(i__),plxMode_3(i__),plxMed_3(i__),
     +  e1_plx_6(i__),E1_plx_7(i__),e3_plx_6(i__),E3_plx_7(i__),
     +  plxFit_3(i__),plxPar1_3(i__),plxPar2_3(i__),plxPar3_3(i__),
     +  plxPar4_3(i__),plxPar5_3(i__),DM_AgeSlope_3(i__),
     +  DM_AgeInter_3(i__),DM_AgeSct_3(i__),DM_AgeMad_3(i__),
     +  Age_DMSlope_3(i__),Age_DMInter_3(i__),Age_DMSct_3(i__),
     +  Age_DMMad_3(i__),DM_MassSlope_3(i__),DM_MassInter_3(i__),
     +  DM_MassSct_3(i__),DM_MassMad_3(i__),DM_smooth_3(i__),
     +  Ext_smooth_3(i__)
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================
      stop
      end