Index: sansmodels/src/sans/models/LamellarPSModel.py
===================================================================
--- sansmodels/src/sans/models/LamellarPSModel.py	(revision 9bd69098b443a3cbda08a1efa070cd1e2ead30ce)
+++ sansmodels/src/sans/models/LamellarPSModel.py	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -35,5 +35,4 @@
          spacing         = 400.0 [A]
          delta           = 30.0 [A]
-         sigma           = 0.15 
          contrast        = 5.3e-006 [1/A²]
          n_plates        = 20.0 
@@ -66,5 +65,4 @@
 		*Parameters: spacing = repeat spacing,
 		delta = bilayer thickness,
-		sigma = variation in bilayer thickness
 		contrast = SLD_solvent - SLD_bilayer
 		n_plate = # of Lamellar plates
@@ -78,5 +76,4 @@
         self.details['spacing'] = ['[A]', None, None]
         self.details['delta'] = ['[A]', None, None]
-        self.details['sigma'] = ['', None, None]
         self.details['contrast'] = ['[1/A²]', None, None]
         self.details['n_plates'] = ['', None, None]
@@ -85,5 +82,5 @@
 
 		## fittable parameters
-        self.fixed=['spacing.width']
+        self.fixed=['delta.width', 'spacing.width']
         
         ## parameters with orientation
Index: sansmodels/src/sans/models/c_extensions/ellipsoid.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/ellipsoid.h	(revision 1ed3834d2e968f8ff632d0b368f55ac28174df7a)
+++ sansmodels/src/sans/models/c_extensions/ellipsoid.h	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -28,6 +28,6 @@
  //		</text>
  //[FIXED]= <text> axis_phi.width; axis_theta.width;radius_a.width;
- //radius_b.width; length.width; r_minor.width
- //, r_ratio.width</text>
+ //radius_b.width; length.width; r_minor.width;
+ //r_ratio.width</text>
  //[ORIENTATION_PARAMS]=  axis_phi.width; axis_theta.width;axis_phi; axis_theta
 
Index: sansmodels/src/sans/models/c_extensions/lamellar.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellar.c	(revision 0cfeff4e034165c71daccb019e3c4b607b334051)
+++ sansmodels/src/sans/models/c_extensions/lamellar.c	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -6,5 +6,5 @@
 #include "lamellar.h"
 #include <math.h>
-#include "libCylinder.h"
+//#include "libCylinder.h"
 #include <stdio.h>
 #include <stdlib.h>
Index: sansmodels/src/sans/models/c_extensions/lamellar.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellar.h	(revision 975ec8e8211549489759b5a5ffe3b60607de065b)
+++ sansmodels/src/sans/models/c_extensions/lamellar.h	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -36,6 +36,6 @@
 } LamellarParameters;
 
-
-
+/// kernel
+double lamellar_kernel(double dp[], double q);
 /// 1D scattering function
 double lamellar_analytical_1D(LamellarParameters *pars, double q);
Index: sansmodels/src/sans/models/c_extensions/lamellarPS.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellarPS.c	(revision b4679dee5e210d6a4a960aa3eada337f6dbac554)
+++ sansmodels/src/sans/models/c_extensions/lamellarPS.c	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -10,4 +10,64 @@
 #include <stdlib.h>
 
+/*LamellarPS_kernel() was moved from libigor to get rid of polydipersity in del(thickness) that we provide from control panel.
+/*	LamellarPSX  :  calculates the form factor of a lamellar structure - with S(q) effects included
+-------
+------- resolution effects ARE NOT included, but only a CONSTANT default value, not the real q-dependent resolution!!
+
+	*/
+double
+LamellarPS_kernel(double dp[], double q)
+{
+	double scale,dd,del,contr,NN,Cp,bkg;		//local variables of coefficient wave
+	double inten, qval,Pq,Sq,alpha,temp,t1,t2,t3,dQ;
+	double Pi,Euler,dQDefault,fii;
+	int ii,NNint;
+	Euler = 0.5772156649;		// Euler's constant
+	dQDefault = 0.0;//0.0025;		//[=] 1/A, q-resolution, default value
+	dQ = dQDefault;
+
+	Pi = 4.0*atan(1.0);
+	qval = q;
+
+	scale = dp[0];
+	dd = dp[1];
+	del = dp[2];
+	contr = dp[3];
+	NN = trunc(dp[4]);		//be sure that NN is an integer
+	Cp = dp[5];
+	bkg = dp[6];
+
+	Pq = 2.0*contr*contr/qval/qval*(1.0-cos(qval*del));
+
+	NNint = (int)NN;		//cast to an integer for the loop
+	ii=0;
+	Sq = 0.0;
+	for(ii=1;ii<(NNint-1);ii+=1) {
+
+		fii = (double)ii;		//do I really need to do this?
+
+		temp = 0.0;
+		alpha = Cp/4.0/Pi/Pi*(log(Pi*ii) + Euler);
+		t1 = 2.0*dQ*dQ*dd*dd*alpha;
+		t2 = 2.0*qval*qval*dd*dd*alpha;
+		t3 = dQ*dQ*dd*dd*ii*ii;
+
+		temp = 1.0-ii/NN;
+		temp *= cos(dd*qval*ii/(1.0+t1));
+		temp *= exp(-1.0*(t2 + t3)/(2.0*(1.0+t1)) );
+		temp /= sqrt(1.0+t1);
+
+		Sq += temp;
+	}
+
+	Sq *= 2.0;
+	Sq += 1.0;
+
+	inten = 2.0*Pi*scale*Pq*Sq/(dd*qval*qval);
+
+	inten *= 1.0e8;		// 1/A to 1/cm
+
+    return(inten+bkg);
+}
 
 /**
@@ -18,5 +78,5 @@
  */
 double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q) {
-	double dp[8];
+	double dp[7];
 
 	// Fill paramater array
@@ -24,12 +84,11 @@
 	dp[1] = pars->spacing;
 	dp[2] = pars->delta;
-	dp[3] = pars->sigma;
-	dp[4] = pars->contrast;
-	dp[5] = pars->n_plates;
-	dp[6] = pars->caille;
-	dp[7] = pars->background;
+	dp[3] = pars->contrast;
+	dp[4] = pars->n_plates;
+	dp[5] = pars->caille;
+	dp[6] = pars->background;
 
 	// Call library function to evaluate model
-	return LamellarPS(dp, q);
+	return LamellarPS_kernel(dp, q);
 }
 /**
Index: sansmodels/src/sans/models/c_extensions/lamellarPS.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellarPS.h	(revision 96b593847bbd8eb6072269e750a93261a4f743b3)
+++ sansmodels/src/sans/models/c_extensions/lamellarPS.h	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -7,5 +7,5 @@
 /** Structure definition for concentrated lamellar form factor parameters
  * [PYTHONCLASS] = LamellarPSModel
- * [DISP_PARAMS] = spacing
+ * [DISP_PARAMS] = delta, spacing
    [DESCRIPTION] = <text>[Concentrated Lamellar Form Factor] Calculates the scattered
 	   intensity from a lyotropic lamellar phase.
@@ -21,5 +21,4 @@
 		*Parameters: spacing = repeat spacing,
 		delta = bilayer thickness,
-		sigma = variation in bilayer thickness
 		contrast = SLD_solvent - SLD_bilayer
 		n_plate = # of Lamellar plates
@@ -28,5 +27,5 @@
 		scale = scale factor
 </text>
-   [FIXED]= spacing.width
+   [FIXED]= <text>delta.width; spacing.width</text>
    [ORIENTATION_PARAMS]=
 
@@ -42,7 +41,4 @@
     //  [DEFAULT]=delta=30 [A]
     double delta;
-	/// polydispersity of the bilayer thickness  [A]
-    //  [DEFAULT]=sigma=0.15
-    double sigma;
     /// Contrast [1/A²]
     //  [DEFAULT]=contrast=5.3e-6 [1/A²]
@@ -60,6 +56,6 @@
 } LamellarPSParameters;
 
-
-
+/// kernel
+double LamellarPS_kernel(double dp[], double q);
 /// 1D scattering function
 double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q);
Index: sansmodels/src/sans/models/c_models/CLamellarPSModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLamellarPSModel.cpp	(revision 9bd69098b443a3cbda08a1efa070cd1e2ead30ce)
+++ sansmodels/src/sans/models/c_models/CLamellarPSModel.cpp	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -92,9 +92,11 @@
         PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000));
         PyDict_SetItemString(self->params,"delta",Py_BuildValue("d",30.000000));
-        PyDict_SetItemString(self->params,"sigma",Py_BuildValue("d",0.150000));
         PyDict_SetItemString(self->params,"contrast",Py_BuildValue("d",0.000005));
         // Initialize dispersion / averaging parameter dict
         DispersionVisitor* visitor = new DispersionVisitor();
         PyObject * disp_dict;
+        disp_dict = PyDict_New();
+        self->model->delta.dispersion->accept_as_source(visitor, self->model->delta.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "delta", disp_dict);
         disp_dict = PyDict_New();
         self->model->spacing.dispersion->accept_as_source(visitor, self->model->spacing.dispersion, disp_dict);
@@ -167,41 +169,5 @@
     return PyArray_Return(result); 
  }
-/**
- * Function to call to evaluate model
- * @param args: input numpy array  [q[],phi[]]
- * @return: numpy array object 
- */
-static PyObject * evaluateTwoDim( LamellarPSModel* model, 
-                              PyArrayObject *q, PyArrayObject *phi)
- {
-    PyArrayObject *result;
-    //check validity of input vectors
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE
-        || phi->nd != 1 || phi->descr->type_num != PyArray_DOUBLE
-        || phi->dimensions[0] != q->dimensions[0]){
-     
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        PyErr_SetString(PyExc_ValueError ,"wrong input"); 
-        return NULL;
-    }
-	result= (PyArrayObject *)PyArray_FromDims(q->nd,(int*)(q->dimensions), PyArray_DOUBLE);
-
-	if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	}
-	
-    for (int i = 0; i < q->dimensions[0]; i++) {
-      double q_value = *(double *)(q->data + i*q->strides[0]);
-      double phi_value = *(double *)(phi->data + i*phi->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      if (q_value == 0)
-          *result_value = 0.0;
-      else
-          *result_value = model->evaluate_rphi(q_value, phi_value);
-    }
-    return PyArray_Return(result); 
- }
+
  /**
  * Function to call to evaluate model
@@ -272,9 +238,10 @@
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
     self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
     self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
     // Read in dispersion parameters
     PyObject* disp_dict;
     DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "delta");
+    self->model->delta.dispersion->accept_as_destination(visitor, self->model->delta.dispersion, disp_dict);
     disp_dict = PyDict_GetItemString(self->dispersion, "spacing");
     self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict);
@@ -347,9 +314,10 @@
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
     self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
     self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
     // Read in dispersion parameters
     PyObject* disp_dict;
     DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "delta");
+    self->model->delta.dispersion->accept_as_destination(visitor, self->model->delta.dispersion, disp_dict);
     disp_dict = PyDict_GetItemString(self->dispersion, "spacing");
     self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict);
@@ -411,9 +379,10 @@
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
     self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
     self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
     // Read in dispersion parameters
     PyObject* disp_dict;
     DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "delta");
+    self->model->delta.dispersion->accept_as_destination(visitor, self->model->delta.dispersion, disp_dict);
     disp_dict = PyDict_GetItemString(self->dispersion, "spacing");
     self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict);
@@ -473,5 +442,7 @@
 	// Ugliness necessary to go from python to C
 	    // TODO: refactor this
-    if (!strcmp(par_name, "spacing")) {
+    if (!strcmp(par_name, "delta")) {
+        self->model->delta.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "spacing")) {
         self->model->spacing.dispersion = dispersion;
     } else {
Index: sansmodels/src/sans/models/c_models/lamellar.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellar.cpp	(revision 975ec8e8211549489759b5a5ffe3b60607de065b)
+++ sansmodels/src/sans/models/c_models/lamellar.cpp	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -28,5 +28,5 @@
 
 extern "C" {
-	#include "libCylinder.h"
+//	#include "libCylinder.h"
 	#include "lamellar.h"
 }
Index: sansmodels/src/sans/models/c_models/lamellarPS.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPS.cpp	(revision b4679dee5e210d6a4a960aa3eada337f6dbac554)
+++ sansmodels/src/sans/models/c_models/lamellarPS.cpp	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -39,6 +39,4 @@
 	delta     = Parameter(30.0);
 	delta.set_min(0.0);
-	sigma    = Parameter(0.15);
-	sigma.set_min(0.0);
 	contrast   = Parameter(5.3e-6);
 	n_plates     = Parameter(20.0);
@@ -55,5 +53,5 @@
  */
 double LamellarPSModel :: operator()(double q) {
-	double dp[8];
+	double dp[7];
 
 	// Fill parameter array for IGOR library
@@ -62,14 +60,15 @@
 	dp[1] = spacing();
 	dp[2] = delta();
-	dp[3] = sigma();
-	dp[4] = contrast();
-	dp[5] = n_plates();
-	dp[6] = caille();
-	dp[7] = 0.0;
+	dp[3] = contrast();
+	dp[4] = n_plates();
+	dp[5] = caille();
+	dp[6] = 0.0;
 
 
-	// Get the dispersion points for (delta) thickness
+	// Get the dispersion points for spacing and delta (thickness)
 	vector<WeightPoint> weights_spacing;
 	spacing.get_weights(weights_spacing);
+	vector<WeightPoint> weights_delta;
+	delta.get_weights(weights_delta);
 
 	// Perform the computation, with all weight points
@@ -80,8 +79,10 @@
 	for(int i=0; i< (int)weights_spacing.size(); i++) {
 		dp[1] = weights_spacing[i].value;
+		for(int j=0; j< (int)weights_spacing.size(); j++) {
+			dp[2] = weights_delta[i].value;
 
-		sum += weights_spacing[i].weight * LamellarPS(dp, q);
-		norm += weights_spacing[i].weight;
-
+			sum += weights_spacing[i].weight * weights_delta[j].weight * LamellarPS_kernel(dp, q);
+			norm += weights_spacing[i].weight * weights_delta[j].weight;
+		}
 	}
 	return sum/norm + background();
@@ -108,2 +109,3 @@
 	return (*this).operator()(q);
 }
+
Index: sansmodels/src/sans/models/c_models/models.hh
===================================================================
--- sansmodels/src/sans/models/c_models/models.hh	(revision 8e36cddc31aee946bb051c6a6d4eade849ca2ed4)
+++ sansmodels/src/sans/models/c_models/models.hh	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
@@ -20,4 +20,6 @@
 	#include "cylinder.h"
 	#include "parallelepiped.h"
+	#include "lamellarPS.h"
+	#include "lamellar.h"
 }
 
@@ -383,5 +385,4 @@
 	Parameter spacing;
 	Parameter delta;
-	Parameter sigma;
 	Parameter contrast;
 	Parameter n_plates;
