Index: smodels/models/lib/librefl.c
===================================================================
--- sasmodels/models/lib/librefl.c	(revision 7ef3589faa2fb7c01cdac628103676f15b126214)
+++ 	(revision )
@@ -1,340 +1,0 @@
-typedef struct {
-        double re;
-        double im;
-} complex;
-
-complex cassign(real, imag);
-complex cplx_add(x,y);
-complex rcmult(x,y);
-complex cplx_sub(x,y);
-complex cplx_mult(x,y);
-complex cplx_div(x,y);
-complex cplx_exp(b);
-
-double err_mod_func(double n_sub, double ind, double nu);
-double linearfunc(double n_sub, double ind, double nu);
-double power_r(double n_sub, double ind, double nu);
-double exp_r(double n_sub, double ind, double nu);
-double exp_l(double n_sub, double ind, double nu);
-double intersldfunc(int fun_type, double n_sub, double i, double nu, double sld_l, double sld_r);
-double interfunc(int fun_type, double n_sub, double i, double sld_l, double sld_r);
-
-complex cassign(real, imag)
-	double real, imag;
-{
-	complex x;
-	x.re = real;
-	x.im = imag;
-	return x;
-}
-
-
-complex cplx_add(x,y)
-	complex x,y;
-{
-	complex z;
-	z.re = x.re + y.re;
-	z.im = x.im + y.im;
-	return z;
-}
-
-complex rcmult(x,y)
-	double x;
-    complex y;
-{
-	complex z;
-	z.re = x*y.re;
-	z.im = x*y.im;
-	return z;
-}
-
-complex cplx_sub(x,y)
-	complex x,y;
-{
-	complex z;
-	z.re = x.re - y.re;
-	z.im = x.im - y.im;
-	return z;
-}
-
-
-complex cplx_mult(x,y)
-	complex x,y;
-{
-	complex z;
-	z.re = x.re*y.re - x.im*y.im;
-	z.im = x.re*y.im + x.im*y.re;
-	return z;
-}
-
-complex cplx_div(x,y)
-	complex x,y;
-{
-	complex z;
-	z.re = (x.re*y.re + x.im*y.im)/(y.re*y.re + y.im*y.im);
-	z.im = (x.im*y.re - x.re*y.im)/(y.re*y.re + y.im*y.im);
-	return z;
-}
-
-complex cplx_exp(b)
-	complex b;
-{
-	complex z;
-	double br,bi;
-	br=b.re;
-	bi=b.im;
-	z.re = exp(br)*cos(bi);
-	z.im = exp(br)*sin(bi);
-	return z;
-}
-
-
-complex cplx_sqrt(z)    //see Schaum`s Math Handbook p. 22, 6.6 and 6.10
-	complex z;
-{
-	complex c;
-	double zr,zi,x,y,r,w;
-
-	zr=z.re;
-	zi=z.im;
-
-	if (zr==0.0 && zi==0.0)
-	{
-    c.re=0.0;
-	c.im=0.0;
-    return c;
-	}
-	else
-	{
-		x=fabs(zr);
-		y=fabs(zi);
-		if (x>y)
-		{
-			r=y/x;
-			w=sqrt(x)*sqrt(0.5*(1.0+sqrt(1.0+r*r)));
-		}
-		else
-		{
-			r=x/y;
-			w=sqrt(y)*sqrt(0.5*(r+sqrt(1.0+r*r)));
-		}
-		if (zr >=0.0)
-		{
-			c.re=w;
-			c.im=zi/(2.0*w);
-		}
-		else
-		{
-			c.im=(zi >= 0) ? w : -w;
-			c.re=zi/(2.0*c.im);
-		}
-		return c;
-	}
-}
-
-complex cplx_cos(b)
-	complex b;
-{
-	complex zero,two,z,i,bi,negbi;
-	zero = cassign(0.0,0.0);
-	two = cassign(2.0,0.0);
-	i = cassign(0.0,1.0);
-	bi = cplx_mult(b,i);
-	negbi = cplx_sub(zero,bi);
-	z = cplx_div(cplx_add(cplx_exp(bi),cplx_exp(negbi)),two);
-	return z;
-}
-
-// normalized and modified erf
-//   |
-// 1 +                __  - - - -
-//   |             _
-//	 |            _
-//   |        __
-// 0 + - - -
-//   |-------------+------------+--
-//   0           center       n_sub    --->
-//                                     ind
-//
-// n_sub = total no. of bins(or sublayers)
-// ind = x position: 0 to max
-// nu = max x to integration
-double err_mod_func(double n_sub, double ind, double nu)
-{
-  double center, func;
-  if (nu == 0.0)
-		nu = 1e-14;
-	if (n_sub == 0.0)
-		n_sub = 1.0;
-
-
-	//ind = (n_sub-1.0)/2.0-1.0 +ind;
-	center = n_sub/2.0;
-	// transform it so that min(ind) = 0
-	ind -= center;
-	// normalize by max limit
-	ind /= center;
-	// divide by sqrt(2) to get Gaussian func
-	nu /= sqrt(2.0);
-	ind *= nu;
-	// re-scale and normalize it so that max(erf)=1, min(erf)=0
-	func = erf(ind)/erf(nu)/2.0;
-	// shift it by +0.5 in y-direction so that min(erf) = 0
-	func += 0.5;
-
-	return func;
-}
-double linearfunc(double n_sub, double ind, double nu)
-{
-  double bin_size, func;
-	if (n_sub == 0.0)
-		n_sub = 1.0;
-
-	bin_size = 1.0/n_sub;  //size of each sub-layer
-	// rescale
-	ind *= bin_size;
-	func = ind;
-
-	return func;
-}
-// use the right hand side from the center of power func
-double power_r(double n_sub, double ind, double nu)
-{
-  double bin_size,func;
-	if (nu == 0.0)
-		nu = 1e-14;
-	if (n_sub == 0.0)
-		n_sub = 1.0;
-
-	bin_size = 1.0/n_sub;  //size of each sub-layer
-	// rescale
-	ind *= bin_size;
-	func = pow(ind, nu);
-
-	return func;
-}
-// use the left hand side from the center of power func
-double power_l(double n_sub, double ind, double nu)
-{
-  double bin_size, func;
-	if (nu == 0.0)
-		nu = 1e-14;
-	if (n_sub == 0.0)
-		n_sub = 1.0;
-
-	bin_size = 1.0/n_sub;  //size of each sub-layer
-	// rescale
-	ind *= bin_size;
-	func = 1.0-pow((1.0-ind),nu);
-
-	return func;
-}
-// use 1-exp func from x=0 to x=1
-double exp_r(double n_sub, double ind, double nu)
-{
-  double bin_size, func;
-	if (nu == 0.0)
-		nu = 1e-14;
-	if (n_sub == 0.0)
-		n_sub = 1.0;
-
-	bin_size = 1.0/n_sub;  //size of each sub-layer
-	// rescale
-	ind *= bin_size;
-	// modify func so that func(0) =0 and func(max)=1
-	func = 1.0-exp(-nu*ind);
-	// normalize by its max
-	func /= (1.0-exp(-nu));
-
-	return func;
-}
-
-// use the left hand side mirror image of exp func
-double exp_l(double n_sub, double ind, double nu)
-{
-  double bin_size, func;
-	if (nu == 0.0)
-		nu = 1e-14;
-	if (n_sub == 0.0)
-		n_sub = 1.0;
-
-	bin_size = 1.0/n_sub;  //size of each sub-layer
-	// rescale
-	ind *= bin_size;
-	// modify func
-	func = exp(-nu*(1.0-ind))-exp(-nu);
-	// normalize by its max
-	func /= (1.0-exp(-nu));
-
-	return func;
-}
-
-// To select function called
-// At nu = 0 (singular point), call line function
-double intersldfunc(int fun_type, double n_sub, double i, double nu, double sld_l, double sld_r)
-{
-	double sld_i, func;
-	// this condition protects an error from the singular point
-	if (nu == 0.0){
-		nu = 1e-13;
-	}
-	// select func
-	switch(fun_type){
-		case 1 :
-			func = power_r(n_sub, i, nu);
-			break;
-		case 2 :
-			func = power_l(n_sub, i, nu);
-			break;
-		case 3 :
-			func = exp_r(n_sub, i, nu);
-			break;
-		case 4 :
-			func = exp_l(n_sub, i, nu);
-			break;
-		case 5 :
-			func = linearfunc(n_sub, i, nu);
-			break;
-		default:
-			func = err_mod_func(n_sub, i, nu);
-			break;
-	}
-	// compute sld
-	if (sld_r>sld_l){
-		sld_i = (sld_r-sld_l)*func+sld_l; //sld_cal(sld[i],sld[i+1],n_sub,dz,thick);
-	}
-	else if (sld_r<sld_l){
-		func = 1.0-func;
-		sld_i = (sld_l-sld_r)*func+sld_r; //sld_cal(sld[i],sld[i+1],n_sub,dz,thick);
-	}
-	else{
-		sld_i = sld_r;
-	}
-	return sld_i;
-}
-
-
-// used by refl.c
-double interfunc(int fun_type, double n_sub, double i, double sld_l, double sld_r)
-{
-	double sld_i, func;
-	switch(fun_type){
-		case 0 :
-			func = err_mod_func(n_sub, i, 2.5);
-			break;
-		default:
-			func = linearfunc(n_sub, i, 1.0);
-			break;
-	}
-	if (sld_r>sld_l){
-		sld_i = (sld_r-sld_l)*func+sld_l; //sld_cal(sld[i],sld[i+1],n_sub,dz,thick);
-	}
-	else if (sld_r<sld_l){
-		func = 1.0-func;
-		sld_i = (sld_l-sld_r)*func+sld_r; //sld_cal(sld[i],sld[i+1],n_sub,dz,thick);
-	}
-	else{
-		sld_i = sld_r;
-	}
-	return sld_i;
-}
Index: smodels/models/spherical_sld.c
===================================================================
--- sasmodels/models/spherical_sld.c	(revision 4a82d4dd41f712a03b7f365ffe63e370cf57b792)
+++ 	(revision )
@@ -1,332 +1,0 @@
-double form_volume(double radius);
-
-double Iq(double q,
-    int n_shells, double thick_inter_0, int func_inter_0, double sld_core_0, double sld_solv,
-    double sld_flat_1, double sld_flat_2, double sld_flat_3, double sld_flat_4, double sld_flat_5,
-    double sld_flat_6, double sld_flat_7, double sld_flat_8, double sld_flat_9, double sld_flat_10,
-    double thick_inter_1, double thick_inter_2, double thick_inter_3, double thick_inter_4, double thick_inter_5,
-    double thick_inter_6, double thick_inter_7, double thick_inter_8, double thick_inter_9, double thick_inter_10,
-    double thick_flat_1, double thick_flat_2, double thick_flat_3, double thick_flat_4, double thick_flat_5,
-    double thick_flat_6, double thick_flat_7, double thick_flat_8, double thick_flat_9, double thick_flat_10,
-    int func_inter_1, int func_inter_2, int func_inter_3, int func_inter_4, int func_inter_5,
-    int func_inter_6, int func_inter_7, int func_inter_8, int func_inter_9, int func_inter_10,
-    double nu_inter_1, double nu_inter_2,double nu_inter_3, double nu_inter_4, double nu_inter_5,
-    double nu_inter_6, double nu_inter_7, double nu_inter_8, double nu_inter_9, double nu_inter_10,
-    int npts_inter, double nu_inter_0, double rad_core_0);
-
-double Iqxy(double qx, double qy,
-    int n_shells, double thick_inter_0, int func_inter_0, double sld_core_0, double sld_solv,
-    double sld_flat_1, double sld_flat_2, double sld_flat_3, double sld_flat_4, double sld_flat_5,
-    double sld_flat_6, double sld_flat_7, double sld_flat_8, double sld_flat_9, double sld_flat_10,
-    double thick_inter_1, double thick_inter_2, double thick_inter_3, double thick_inter_4, double thick_inter_5,
-    double thick_inter_6, double thick_inter_7, double thick_inter_8, double thick_inter_9, double thick_inter_10,
-    double thick_flat_1, double thick_flat_2, double thick_flat_3, double thick_flat_4, double thick_flat_5,
-    double thick_flat_6, double thick_flat_7, double thick_flat_8, double thick_flat_9, double thick_flat_10,
-    int func_inter_1, int func_inter_2, int func_inter_3, int func_inter_4, int func_inter_5,
-    int func_inter_6, int func_inter_7, int func_inter_8, int func_inter_9, int func_inter_10,
-    double nu_inter_1, double nu_inter_2,double nu_inter_3, double nu_inter_4, double nu_inter_5,
-    double nu_inter_6, double nu_inter_7, double nu_inter_8, double nu_inter_9, double nu_inter_10,
-    int npts_inter, double nu_inter_0, double rad_core_0);
-
-//TODO: Check what is for volume for this model
-
-double form_volume(double radius)
-{
-    //This is normalized for each shell. It is spehere but for each shell
-    double vol = 4.0*M_PI/3.0*pow(radius,3);
-    return vol;
-}
-
-
-static double sphere_sld_kernel(double dp[], double q) {
-  int n = dp[0];
-  int i,j,k;
-
-  double scale = dp[1];
-  double thick_inter_core = dp[2];
-  double sld_core = dp[4];
-  double sld_solv = dp[5];
-  double background = dp[6];
-  double npts = dp[57]; //number of sub_layers in each interface
-  double nsl=npts;//21.0; //nsl = Num_sub_layer:  MUST ODD number in double //no other number works now
-  int n_s;
-
-  double sld_i,sld_f,dz,bes,fun,f,vol,qr,r,contr,f2;
-  double sign,slope=0.0;
-  double pi;
-
-  //int* fun_type;
-  //double* sld;
-  //double* thick_inter;
-  //double* thick;
-  //double* fun_coef;
-
-  double total_thick=0.0;
-
-  //fun_type = (int*)malloc((n+2)*sizeof(int));
-  //sld = (double*)malloc((n+2)*sizeof(double));
-  //thick_inter = (double*)malloc((n+2)*sizeof(double));
-  //thick = (double*)malloc((n+2)*sizeof(double));
-  //fun_coef = (double*)malloc((n+2)*sizeof(double));
-
-  //TODO: Solution to avoid mallocs but probablyu can be done better
-  int fun_type[12];
-  double sld[12];
-  double thick_inter[12];
-  double thick[12];
-  double fun_coef[12];
-
-  fun_type[0] = dp[3];
-  fun_coef[0] = fabs(dp[58]);
-  for (i =1; i<=n; i++){
-    sld[i] = dp[i+6];
-    thick_inter[i]= dp[i+16];
-    thick[i] = dp[i+26];
-    fun_type[i] = dp[i+36];
-    fun_coef[i] = fabs(dp[i+46]);
-    total_thick += thick[i] + thick_inter[i];
-  }
-  sld[0] = sld_core;
-  sld[n+1] = sld_solv;
-  thick[0] = dp[59];
-  thick[n+1] = total_thick/5.0;
-  thick_inter[0] = thick_inter_core;
-  thick_inter[n+1] = 0.0;
-  fun_coef[n+1] = 0.0;
-
-  pi = 4.0*atan(1.0);
-  f = 0.0;
-  r = 0.0;
-  vol = 0.0;
-  //vol_pre = 0.0;
-  //vol_sub = 0.0;
-  sld_f = sld_core;
-
-  //floor_nsl = floor(nsl/2.0);
-
-  dz = 0.0;
-  // iteration for # of shells + core + solvent
-  for (i=0;i<=n+1; i++){
-    //iteration for N sub-layers
-    //if (fabs(thick[i]) <= 1e-24){
-    //   continue;
-    //}
-    // iteration for flat and interface
-    for (j=0;j<2;j++){
-      // iteration for sub_shells in the interface
-      // starts from #1 sub-layer
-      for (n_s=1;n_s<=nsl; n_s++){
-        // for solvent, it doesn't have an interface
-        if (i==n+1 && j==1)
-          break;
-        // for flat layers
-        if (j==0){
-          dz = thick[i];
-          sld_i = sld[i];
-          slope = 0.0;
-        }
-        // for interfacial sub_shells
-        else{
-          dz = thick_inter[i]/nsl;
-          // find sld_i at the outer boundary of sub-layer #n_s
-          sld_i = intersldfunc(fun_type[i],nsl, n_s, fun_coef[i], sld[i], sld[i+1]);
-          // calculate slope
-          slope= (sld_i -sld_f)/dz;
-        }
-        contr = sld_f-slope*r;
-        // iteration for the left and right boundary of the shells(or sub_shells)
-        for (k=0; k<2; k++){
-          // At r=0, the contribution to I is zero, so skip it.
-          if ( i == 0 && j == 0 && k == 0){
-            continue;
-          }
-          // On the top of slovent there is no interface; skip it.
-          if (i == n+1 && k == 1){
-            continue;
-          }
-          // At the right side (outer) boundary
-          if ( k == 1){
-            sign = 1.0;
-            r += dz;
-          }
-          // At the left side (inner) boundary
-          else{
-            sign = -1.0;
-          }
-          qr = q * r;
-          fun = 0.0;
-          if(qr == 0.0){
-            // sigular point
-            bes = sign * 1.0;
-          }
-          else{
-            // for flat sub-layer
-            bes = sign *  3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-            // with linear slope
-            if (fabs(slope) > 0.0 ){
-              fun = sign * 3.0 * r * (2.0*qr*sin(qr)-((qr*qr)-2.0)*cos(qr))/(qr * qr * qr * qr);
-            }
-          }
-          // update total volume
-          vol = 4.0 * pi / 3.0 * r * r * r;
-          // we won't do the following volume correction for now.
-          // substrate empty area of volume
-          //if (k == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && fun_type[i]==0){
-          //  vol_sub += (vol_pre - vol);
-          //}
-          f += vol * (bes * contr + fun * slope);
-        }
-        // remember this sld as sld_f
-        sld_f =sld_i;
-        // no sub-layer iteration (n_s loop) for the flat layer
-        if (j==0)
-          break;
-      }
-    }
-  }
-  //vol += vol_sub;
-  f2 = f * f / vol * 1.0e8;
-  f2 *= scale;
-  f2 += background;
-  //free(fun_type);
-  //free(sld);
-  //free(thick_inter);
-  //free(thick);
-  //free(fun_coef);
-
-  return (f2);
-}
-
-
-/**
- * Function to evaluate 1D SphereSLD function
- * @param q: q-value
- * @return: function value
- */
-double Iq(double q,
-    int n_shells, double thick_inter_0, int func_inter_0, double sld_core_0, double sld_solv,
-    double sld_flat_1, double sld_flat_2, double sld_flat_3, double sld_flat_4, double sld_flat_5,
-    double sld_flat_6, double sld_flat_7, double sld_flat_8, double sld_flat_9, double sld_flat_10,
-    double thick_inter_1, double thick_inter_2, double thick_inter_3, double thick_inter_4, double thick_inter_5,
-    double thick_inter_6, double thick_inter_7, double thick_inter_8, double thick_inter_9, double thick_inter_10,
-    double thick_flat_1, double thick_flat_2, double thick_flat_3, double thick_flat_4, double thick_flat_5,
-    double thick_flat_6, double thick_flat_7, double thick_flat_8, double thick_flat_9, double thick_flat_10,
-    int func_inter_1, int func_inter_2, int func_inter_3, int func_inter_4, int func_inter_5,
-    int func_inter_6, int func_inter_7, int func_inter_8, int func_inter_9, int func_inter_10,
-    double nu_inter_1, double nu_inter_2,double nu_inter_3, double nu_inter_4, double nu_inter_5,
-    double nu_inter_6, double nu_inter_7, double nu_inter_8, double nu_inter_9, double nu_inter_10,
-    int npts_inter, double nu_inter_0, double rad_core_0) {
-
-    //printf("Number of points %d\n",npts_inter);
-    double intensity;
-    //TODO: Remove this container at later stage. It is only kept to minimize stupid errors now
-    double dp[60];
-    dp[0] = n_shells;
-    //This is scale will also have to be removed at some stage
-    dp[1] = 1.0;
-    dp[2] = thick_inter_0;
-    dp[3] = func_inter_0;
-    dp[4] = sld_core_0;
-    dp[5] = sld_solv;
-    dp[6] = 0.0;
-
-    dp[7] = sld_flat_1;
-    dp[8] = sld_flat_2;
-    dp[9] = sld_flat_3;
-    dp[10] = sld_flat_4;
-    dp[11] = sld_flat_5;
-    dp[12] = sld_flat_6;
-    dp[13] = sld_flat_7;
-    dp[14] = sld_flat_8;
-    dp[15] = sld_flat_9;
-    dp[16] = sld_flat_10;
-
-    dp[17] = thick_inter_1;
-    dp[18] = thick_inter_2;
-    dp[19] = thick_inter_3;
-    dp[20] = thick_inter_4;
-    dp[21] = thick_inter_5;
-    dp[22] = thick_inter_6;
-    dp[23] = thick_inter_7;
-    dp[24] = thick_inter_8;
-    dp[25] = thick_inter_9;
-    dp[26] = thick_inter_10;
-
-    dp[27] = thick_flat_1;
-    dp[28] = thick_flat_2;
-    dp[29] = thick_flat_3;
-    dp[30] = thick_flat_4;
-    dp[31] = thick_flat_5;
-    dp[32] = thick_flat_6;
-    dp[33] = thick_flat_7;
-    dp[34] = thick_flat_8;
-    dp[35] = thick_flat_9;
-    dp[36] = thick_flat_10;
-
-    dp[37] = func_inter_1;
-    dp[38] = func_inter_2;
-    dp[39] = func_inter_3;
-    dp[40] = func_inter_4;
-    dp[41] = func_inter_5;
-    dp[42] = func_inter_6;
-    dp[43] = func_inter_7;
-    dp[44] = func_inter_8;
-    dp[45] = func_inter_9;
-    dp[46] = func_inter_10;
-
-    dp[47] = nu_inter_1;
-    dp[48] = nu_inter_2;
-    dp[49] = nu_inter_3;
-    dp[50] = nu_inter_4;
-    dp[51] = nu_inter_5;
-    dp[52] = nu_inter_6;
-    dp[53] = nu_inter_7;
-    dp[54] = nu_inter_8;
-    dp[55] = nu_inter_9;
-    dp[56] = nu_inter_10;
-
-    dp[57] = npts_inter;
-    dp[58] = nu_inter_0;
-    dp[59] = rad_core_0;
-
-    intensity = sphere_sld_kernel(dp,q);
-    //printf("%10d\n",intensity);
-    return intensity;
-}
-
-/**
- * Function to evaluate 2D SphereSLD function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double Iqxy(double qx, double qy,
-    int n_shells, double thick_inter_0, int func_inter_0, double sld_core_0, double sld_solv,
-    double sld_flat_1, double sld_flat_2, double sld_flat_3, double sld_flat_4, double sld_flat_5,
-    double sld_flat_6, double sld_flat_7, double sld_flat_8, double sld_flat_9, double sld_flat_10,
-    double thick_inter_1, double thick_inter_2, double thick_inter_3, double thick_inter_4, double thick_inter_5,
-    double thick_inter_6, double thick_inter_7, double thick_inter_8, double thick_inter_9, double thick_inter_10,
-    double thick_flat_1, double thick_flat_2, double thick_flat_3, double thick_flat_4, double thick_flat_5,
-    double thick_flat_6, double thick_flat_7, double thick_flat_8, double thick_flat_9, double thick_flat_10,
-    int func_inter_1, int func_inter_2, int func_inter_3, int func_inter_4, int func_inter_5,
-    int func_inter_6, int func_inter_7, int func_inter_8, int func_inter_9, int func_inter_10,
-    double nu_inter_1, double nu_inter_2,double nu_inter_3, double nu_inter_4, double nu_inter_5,
-    double nu_inter_6, double nu_inter_7, double nu_inter_8, double nu_inter_9, double nu_inter_10,
-    int npts_inter, double nu_inter_0, double rad_core_0) {
-
-    double q = sqrt(qx*qx + qy*qy);
-    return Iq(q, n_shells, thick_inter_0, func_inter_0, sld_core_0, sld_solv,
-    sld_flat_1, sld_flat_2, sld_flat_3, sld_flat_4, sld_flat_5,
-    sld_flat_6, sld_flat_7, sld_flat_8, sld_flat_9, sld_flat_10,
-    thick_inter_1, thick_inter_2, thick_inter_3, thick_inter_4, thick_inter_5,
-    thick_inter_6, thick_inter_7, thick_inter_8, thick_inter_9, thick_inter_10,
-    thick_flat_1, thick_flat_2, thick_flat_3, thick_flat_4, thick_flat_5,
-    thick_flat_6, thick_flat_7, thick_flat_8, thick_flat_9, thick_flat_10,
-    func_inter_1, func_inter_2, func_inter_3, func_inter_4, func_inter_5,
-    func_inter_6, func_inter_7, func_inter_8, func_inter_9, func_inter_10,
-    nu_inter_1, nu_inter_2, nu_inter_3, nu_inter_4, nu_inter_5,
-    nu_inter_6, nu_inter_7, nu_inter_8, nu_inter_9, nu_inter_10,
-    npts_inter, nu_inter_0, rad_core_0);
-
-}
-
Index: smodels/models/spherical_sld.py
===================================================================
--- sasmodels/models/spherical_sld.py	(revision 4a82d4dd41f712a03b7f365ffe63e370cf57b792)
+++ 	(revision )
@@ -1,302 +1,0 @@
-r"""
-This model calculates an empirical functional form for SAS data using SpericalSLD profile
-
-Similarly to the OnionExpShellModel, this model provides the form factor, P(q), for a multi-shell sphere,
-where the interface between the each neighboring shells can be described by one of a number of functions
-including error, power-law, and exponential functions. This model is to calculate the scattering intensity
-by building a continuous custom SLD profile against the radius of the particle. The SLD profile is composed
-of a flat core, a flat solvent, a number (up to 9 ) flat shells, and the interfacial layers between
-the adjacent flat shells (or core, and solvent) (see below).
-Unlike the OnionExpShellModel (using an analytical integration),
-the interfacial layers here are sub-divided and numerically integrated assuming each of the sub-layers are described
-by a line function. The number of the sub-layer can be given by users by setting the integer values of npts_inter
-in the GUI. The form factor is normalized by the total volume of the sphere.
-
-Definition
-----------
-
-The scattering intensity $I(q)$ in 1D is calculated as:
-
-.. math::
-
-    P(q) = \frac{f^2}{V_\text{particle}}
-    f = f_\text{core} + \sum_{\text{inter}_i=0}^N f_text{inter}_i +
-    \sum_{\text{flat}_i=0}^N f_text{flat}_i +f_\text{solvent}
-
-where, for a spherically symmetric particle with a particle density \rho(r)
-
-
-The scaling of the second power law region (coefficent C) is then automatically scaled to
-match the first by following formula
-
-.. math::
-    C = \frac{A}{qc^{-m1} qc^{-m2}}
-
-.. note::
-    Be sure to enter the power law exponents as positive values!
-
-For 2D data the scattering intensity is calculated in the same way as 1D,
-where the $q$ vector is defined as
-
-.. math::
-
-    q = \sqrt{q_x^2 + q_y^2}
-
-
-.. figure:: img/two_power_law_1d.jpg
-
-    1D plot using the default values (w/500 data point).
-
-References
-----------
-L A Feigin and D I Svergun, Structure Analysis by Small-Angle X-Ray and Neutron Scattering, Plenum Press, New York, (1987)
-
-"""
-
-from numpy import inf
-
-name = "spherical_sld"
-title = "Sperical SLD intensity calculation"
-description = """
-            I(q) =
-               background = Incoherent background [1/cm]
-        """
-category = "shere-based"
-
-
-# pylint: disable=bad-whitespace, line-too-long
-#            ["name", "units", default, [lower, upper], "type", "description"],
-parameters = [["n_shells",       "",         1, [0, 9], "", "number of shells"],
-              ["thick_inter_0",       "Ang",         50, [-inf, inf], "", "intern layer thickness"],
-              ["func_inter_0",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["sld_core_0",       "1/Ang^2",         2.07E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_solv",     "1/Ang^2",    1E-6,[-inf, inf], "","sld function solvent"],
-              ["sld_flat_1",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_2",       "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_3",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_4",       "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_5",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_6",       "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_7",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_8",       "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_9",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"],
-              ["sld_flat_10",      "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"],
-              ["thick_inter_1",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_2",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_3",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_4",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_5",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_6",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_7",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_8",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_9",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_inter_10",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ["thick_flat_1",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_2",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_3",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_4",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_5",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_6",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_7",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_8",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_9",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["thick_flat_10",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"],
-              ["func_inter_1",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_2",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_3",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_4",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_5",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_6",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_7",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_8",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_9",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["func_inter_10",       "",        0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"],
-              ["nu_inter_1",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_2",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_3",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_4",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_5",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_6",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_7",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_8",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_9",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["nu_inter_10",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["npts_inter",  "",         35, [0, inf], "", "number of points in each sublayer"],
-              ["nu_inter_0",       "",         2.5, [-inf, inf], "", "steepness parameter"],
-              ["rad_core_0",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"],
-              ]
-# pylint: enable=bad-whitespace, line-too-long
-source = ["lib/librefl.c", "spherical_sld.c"]
-
-
-#TODO: Not clear if dispersion function is needed
-#def _set_dispersion(self):
-#        """
-#        Setting dispersion for all shells
-#        """
-#        ##set dispersion from model
-#        for name , value in self.model.dispersion.iteritems():
-#
-#            nshell = -1
-#            if name.split('_')[0] == 'thick':
-#                while nshell < 1:
-#                    nshell += 1
-#                    if name.split('_')[1] == 'inter%s' % str(nshell):
-#                        self.dispersion[name] = value
-#                    else:
-#                        continue
-#            else:
-#                self.dispersion[name] = value
-
-
-def ER(radius):
-        """
-        Calculate the effective radius for P(q)*S(q)
-        Tale different radius values from corresponding shells
-
-        :return: the value of the effective radius
-        """
-
-        return radius
-
-demo = dict(scale=1, background=0.0,
-        n_shells=10,
-        sld_solv=1E-6,
-        npts_inter=35,
-        func_inter_0=0,
-        nu_inter_0=2.5,
-        rad_core_0=50.0,
-        sld_core_0=2.07E-6,
-        thick_inter_0=50,
-        func_inter_1=0,
-        nu_inter_1=2.5,
-        thick_inter_1=50,
-        sld_flat_1=4E-6,
-        thick_flat_1=100,
-        func_inter_2=0,
-        nu_inter_2=2.5,
-        thick_inter_2=50,
-        sld_flat_2=3.5E-6,
-        thick_flat_2=100,
-        func_inter_3=0,
-        nu_inter_3=2.5,
-        thick_inter_3=50,
-        sld_flat_3=4E-6,
-        thick_flat_3=100,
-        func_inter_4=0,
-        nu_inter_4=2.5,
-        thick_inter_4=50,
-        sld_flat_4=3.5E-6,
-        thick_flat_4=100,
-        func_inter_5=0,
-        nu_inter_5=2.5,
-        thick_inter_5=50,
-        sld_flat_5=4E-6,
-        thick_flat_5=100,
-        func_inter_6=0,
-        nu_inter_6=2.5,
-        thick_inter_6=50,
-        sld_flat_6=3.5E-6,
-        thick_flat_6=100,
-        func_inter_7=0,
-        nu_inter_7=2.5,
-        thick_inter_7=50,
-        sld_flat_7=4E-6,
-        thick_flat_7=100,
-        func_inter_8=0,
-        nu_inter_8=2.5,
-        thick_inter_8=50,
-        sld_flat_8=3.5E-6,
-        thick_flat_8=100,
-        func_inter_9=0,
-        nu_inter_9=2.5,
-        thick_inter_9=50,
-        sld_flat_9=4E-6,
-        thick_flat_9=100,
-        func_inter_10=0,
-        nu_inter_10=2.5,
-        thick_inter_10=50,
-        sld_flat_10=3.5E-6,
-        thick_flat_10=100
-        )
-
-oldname = "SphereSLDModel"
-oldpars = dict(
-        scale="scale",
-        background="background",
-        n_shells="n_shells",
-        npts_inter='npts_inter',
-        sld_solv='sld_solv',
-        func_inter_0='func_inter0',
-        nu_inter_0='nu_inter0',
-        rad_core_0='rad_core0',
-        sld_core_0='sld_core0',
-        thick_inter_0='thick_inter0',
-        func_inter_1='func_inter1',
-        nu_inter_1='nu_inter1',
-        thick_inter_1='thick_inter1',
-        sld_flat_1='sld_flat1',
-        thick_flat_1='thick_flat1',
-        func_inter_2='func_inter2',
-        nu_inter_2='nu_inter2',
-        thick_inter_2='thick_inter2',
-        sld_flat_2='sld_flat2',
-        thick_flat_2='thick_flat2',
-        func_inter_3='func_inter3',
-        nu_inter_3='nu_inter3',
-        thick_inter_3='thick_inter3',
-        sld_flat_3='sld_flat3',
-        thick_flat_3='thick_flat3',
-        func_inter_4='func_inter4',
-        nu_inter_4='nu_inter4',
-        thick_inter_4='thick_inter4',
-        sld_flat_4='sld_flat4',
-        thick_flat_4='thick_flat4',
-        func_inter_5='func_inter5',
-        nu_inter_5='nu_inter5',
-        thick_inter_5='thick_inter5',
-        sld_flat_5='sld_flat5',
-        thick_flat_5='thick_flat5',
-        func_inter_6='func_inter6',
-        nu_inter_6='nu_inter6',
-        thick_inter_6='thick_inter6',
-        sld_flat_6='sld_flat6',
-        thick_flat_6='thick_flat6',
-        func_inter_7='func_inter7',
-        nu_inter_7='nu_inter7',
-        thick_inter_7='thick_inter7',
-        sld_flat_7='sld_flat7',
-        thick_flat_7='thick_flat7',
-        func_inter_8='func_inter8',
-        nu_inter_8='nu_inter8',
-        thick_inter_8='thick_inter8',
-        sld_flat_8='sld_flat8',
-        thick_flat_8='thick_flat8',
-        func_inter_9='func_inter9',
-        nu_inter_9='nu_inter9',
-        thick_inter_9='thick_inter9',
-        sld_flat_9='sld_flat9',
-        thick_flat_9='thick_flat9',
-        func_inter_10='func_inter10',
-        nu_inter_10='nu_inter10',
-        thick_inter_10='thick_inter10',
-        sld_flat_10='sld_flat10',
-        thick_flat_10='thick_flat10')
-
-tests = [
-    # Accuracy tests based on content in test/utest_extra_models.py
-    [{'npts_iter':35,
-        'sld_solv':1E-6,
-        'func_inter_1':0.0,
-        'nu_inter':2.5,
-        'thick_inter_1':50,
-        'sld_flat_1':4E-6,
-        'thick_flat_1':100,
-        'func_inter_0':0.0,
-        'nu_inter_0':2.5,
-        'rad_core_0':50.0,
-        'sld_core_0':2.07E-6,
-        'thick_inter_0':50,
-        'background': 0.0,
-    }, 0.001, 1000],
-]
