NAME: 
  disphase
 PURPOSE: 
  Apply distance and phase angle correction to observed magnitudes.
 DESCRIPTION:
  Apply standard asteroidal-law corrections to observed magnitudes
     given the distance, phase angle, and the G coefficient.  Magnitudes
     are corrected to 1 AU from Sun and Earth and to 0 degrees phase angle.
  The default of this routine is to use equation A4 from Bowell etal. in
     Asteroids II (see page 550) and called the Lumme and Bowell model.
     An option is provided to compute the IAU standard correction from
     equation A5 found on page 551.

  According to the Bowell chapter, these expressions are valid only
     for 0<=G<=1 and phase angle less than 120 degrees.  However, the
     chapter also claims the expressions are useful outside this range.

  Note that the computation blows up in single precision if G < -0.85.  If
     the input value for G is out of range then the returned magnitude is
     set to -99.99.  This prevents getting back a value of NaN for hmag.
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  disphase,mag,r,d,phang,g,hmag
 INPUTS:
     These first four inputs are scalars or vectors.  If vector, it is
       generally expected (but not enforced) that they be the same length.
       Mixing some of these as scalars with vectors that have the same
       length should work.

     mag   - Observed magnitude.
     r     - Sun-object distance in AU.
     d     - Earth-object distance in AU.
     phang - Phase angle of observation in degrees.

     g     - IAU standard G value (phase angle coefficient), if this is
                a scalar value (either for Lumme and Bowell or IAU).  If
                this is a vector, it is assumed to be a two-element vector
                for the Muinonen HG1G2 system and this formalism will be
                used regardless of the value of the IAU keyword.
                   G1 = g[0]
                   G2 = g[1]

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     H2MAG - Flag, if set reverses the sense of the calculations and takes
                H as the input magnitude and then computes the apparent
                magnitude for the output.
     IAU   - Flag, if set will force the use of the lower accuracy IAU
                standard calculation.  The default is to use the
                Lumme and Bowell model.
 OUTPUTS:
     hmag  - Magnitude corrected for distance and phase angle.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
   2008/04/12, MWB, slight change to deal with bogus values for G
   2016/01/06, MWB, added H2MAG keyword option
   2016/01/13, MWB, added IAU keyword option
   2024/10/29, MWB, added G1G2 system option, some clarifications in
                      expected input variable structure added to info.