If you have a model that will be used frequently, you may want to include it among the standard models so that it will be listed after the model ? command. To do so, you first must create a subroutine that calculates the model spectrum given an input array of energy bins and an array of parameter values. The spectrum for an additive model should be in terms of photons/cm^2/s (not photons/cm^2/s/keV), while for a multiplicative model it is the multiplicative factor for that bin.
The five arguments in the calling sequence are EAR(0:NE), NE, PARAM(*), WORKSP(*), and PHOTAR(NE). EAR(0:NE) are input and are the boundaries for the NE energy bins. These are set by the response matrices of the detectors in use, so you should not make any assumptions about the values of EAR. PARAM(*) are input and are the values of the model parameters. WORKSP(*) is an array whose use is obscure and probably should not be messed with. PHOTAR(NE) is the output array and should not be assumed to have any particular values on input. When you have created your model subroutine, move it to the XSPEC localfunctions subdirectory (local/spectral/xspec/src/functions).
To set the default parameters and tell XSPEC that your model exists, you must edit the file lmodel.dat in the localmodel subdirectory (local/spectral/xspec/src/model). The file lmodel.dat.EXAMPLE can be used as a template. The first line for each model gives the model name, the number of parameters, the low and high energies for which the model is valid, and the name of the subroutine in the functions subdirectory. There then should be one succeeding line for each parameter. Each line contains the parameter name, a default starting value, the hard minimum, the soft minimum, the soft maximum, the hard maximum, and the initial delta.