db = pList[0];
kd = abs(pList[1]);
df = dList[0];

if (kd == 0.0) {kd = 1.0};

ka = 1.0/kd;

if (ka == 0.0) {ka = 1.0};

for( i = 0; i < xyCount; i++ )
   {
    lti = xList[i];
    pti = aList[i];

    q   = 1.0 + 
    2.0*ka*lti + 2.0*ka*pti - 2.0*lti*pti*ka*ka + ka*ka*lti*lti + ka*ka*pti*pti;

    dd  = db - df;
    top = 0.5*(dd + dd*ka*lti + dd*ka*pti - dd*sqrt(q));
    bot = ka*pti;
    di  = top/bot;

    yList[i] = di;
   }

sMax = 1.1*vMax( xList, xyCount );

if (reportFlag)
   {
    for( i = 0; i < xyCount; i++ )
       {
        (void) fprintf( "%8.2f %8.2f % .3e % .3e\n", 
                        xList[i], aList[i], dList[i], yList[i] );
       }

    char outName[80];

    (void) sprintf( outName, "gnu/fit%.0f.gnu", id );

    fd = dOpen( outName, "w" );

    (void) fprintf( fd, "pti  = %e\n", aList[0] );
    (void) fprintf( fd, "db   = %e\n", db );
    (void) fprintf( fd, "df   = %e\n", df );
    (void) fprintf( fd, "dd   = %e\n", dd );
    (void) fprintf( fd, "ka   = %e\n", ka );

    (void) fprintf( fd, "set title \"ID: %.0f Ass: ", id );

    (void) fprintf( fd, assStr );

    (void) fprintf( fd,
                    " S-Free: %.3fppm S-Delta: %.3f +/- %.3fppm",
                    sFree, sSign*db, eList[0] );

    (void) fprintf( fd, " Kd: %.3e M +/- %.2f%%", kd*1.0e-6, 100*eList[1]/kd );
    (void) fprintf( fd, "\n" );

    top = 0.5*(dd + dd*ka*lti + dd*ka*pti - dd*sqrt(q));

    (void) fprintf( fd, "s(x) = (0.5*(dd +dd*ka*x + dd*ka*pti - dd*sqrt(1.0+2.0*ka*x+2.0*ka*pti-2.0*x*pti*ka*ka+ka*ka*x*x+ka*ka*pti*pti)))/(ka*pti)\n" );

    (void) fprintf( fd, "set xlabel \"Concentration uM\"\n" );
/*
    (void) fprintf( fd, "set xrange [1:%f]\n", sMax );
    (void) fprintf( fd, "set logscale x\n" );
*/
    (void) fprintf( fd, "set xrange [0:%f]\n", sMax );
    (void) fprintf( fd, "set term postscript\n" );
    (void) fprintf( fd, "set output \"plot/fit%.0f.ps\"\n", id );

    (void) fprintf( fd, "plot \"txt/fit%.0f.txt\" w errorbars,", id );
    (void) fprintf( fd, " s(x) title \"Model\" w lines\n" );

    (void) dClose( fd );
   };
