NAME:
  hstmodstar
 PURPOSE: (one line)
  Calculate chi-square value for trailed star fit
 DESCRIPTION:
  Chi-sq function for Powell or Ameoba fitting and showmodel.
 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  hstmodstar, vals
 INPUTS:
  vals - array of parameters to fit, It is a three element vector = [x,y,flux]
           The common block includes the fit keywords that controls which
           variables are included in vals.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  return the chisq for the model computed from vals
 COMMON BLOCKS:
  com_hststarfit:  Used for communication of data
 SIDE EFFECTS:
  Uses HST PSF images (hstpsf.pro) which may cause the memory and disk PSF
     caches to be populated.

 RESTRICTIONS:
 PROCEDURE:

 MODIFICATION HISTORY:
  2011/03/24, MWB, cloned from hst15 routine of the same name.
  2011/05/07, MWB, internal restructuring to keep more intermediate
                      results including full arrays of everything
  2014/07/03, MWB, cloned from chimodplch
  2014/07/08, MWB, cloned from chimod.pro
  2016/12/21, MWB, added option for flux input as a magnitude
  2020/06/24, MWB, generalized version