C
C   Quick implementation of the Sherpa beta1D model as a user model
C
C   Unlike the "ascfit" usermodel version we just need to provide a
C   routine that will evaluate the model. The user_model.c file
C   contains routines that handle the S-Lang interface.
C
C   Both *.c and *.f files need editing if you want to add your own model(s).
C 

C
C   Evaluate the actual model
C   
      subroutine evaluate_beta1d(r0, beta, xpos, ampl,
     :     x, y, nelem)

      implicit none

      integer nelem

      double precision r0, beta, xpos, ampl;

      double precision x(nelem), y(nelem)

      double precision powterm, r02;
      integer i;

C
C Evaluates:
C   f(x) = A (1+[(x-xpos)/r_o]^2)^(-3*beta+1/2)
C
      powterm = 0.5 - 3.0 * beta
      r02 = r0 * r0

      do i = 1, nelem, 1

         y(i) = ampl *
     :        (1.0 + (x(i)-xpos)*(x(i)-xpos)/r02)**powterm

      end do
      end
