Index: sansmodels/src/sans/models/c_models/c_models.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/c_models.cpp	(revision 96656e3ad6cdb9f8256e2118c60bac29635136af)
+++ sansmodels/src/sans/models/c_models/c_models.cpp	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
@@ -124,4 +124,23 @@
 }
 
+
+/**
+ * Delete a rectangle dispersion model object
+ */
+void del_rectangle_dispersion(void *ptr){
+	RectangleDispersion * disp = static_cast<RectangleDispersion *>(ptr);
+	delete disp;
+	return;
+}
+
+/**
+ * Create a rectangle dispersion model as a python object
+ */
+PyObject * new_rectangle_dispersion(PyObject *, PyObject *args) {
+	RectangleDispersion *disp = new RectangleDispersion();
+	return PyCObject_FromVoidPtr(disp, del_rectangle_dispersion);
+}
+
+
 /**
  * Delete a schulz dispersion model object
@@ -203,4 +222,6 @@
 	{"new_gaussian_model",   (PyCFunction)new_gaussian_dispersion, METH_VARARGS,
 		  "Create a new GaussianDispersion object"},
+	{"new_rectangle_model",   (PyCFunction)new_rectangle_dispersion, METH_VARARGS,
+		  "Create a new RectangleDispersion object"},
     {"new_lognormal_model",   (PyCFunction)new_lognormal_dispersion, METH_VARARGS,
 		  "Create a new LogNormalDispersion object"},
Index: sansmodels/src/sans/models/c_models/dispersion_visitor.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/dispersion_visitor.cpp	(revision 1d78e4bf33d7dd5aa6967f5064d35bc916a4f2ee)
+++ sansmodels/src/sans/models/c_models/dispersion_visitor.cpp	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
@@ -25,4 +25,16 @@
 
 	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "gaussian"));
+    PyDict_SetItemString(dict, "npts",  Py_BuildValue("i", disp->npts));
+    PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width));
+    PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas));
+#endif
+}
+
+void DispersionVisitor:: rectangle_to_dict(void* dispersion, void* dictionary) {
+#ifndef __MODELS_STANDALONE__
+	RectangleDispersion * disp = (RectangleDispersion*)dispersion;
+	PyObject * dict = (PyObject*)dictionary;
+
+	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "rectangle"));
     PyDict_SetItemString(dict, "npts",  Py_BuildValue("i", disp->npts));
     PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width));
@@ -86,4 +98,15 @@
 }
 
+void DispersionVisitor:: rectangle_from_dict(void* dispersion, void* dictionary) {
+#ifndef __MODELS_STANDALONE__
+	RectangleDispersion * disp = (RectangleDispersion*)dispersion;
+	PyObject * dict = (PyObject*)dictionary;
+
+	disp->npts    = PyInt_AsLong( PyDict_GetItemString(dict, "npts") );
+	disp->width   = PyFloat_AsDouble( PyDict_GetItemString(dict, "width") );
+	disp->nsigmas = PyFloat_AsDouble( PyDict_GetItemString(dict, "nsigmas") );
+#endif
+}
+
 void DispersionVisitor:: lognormal_from_dict(void* dispersion, void* dictionary) {
 #ifndef __MODELS_STANDALONE__
Index: sansmodels/src/sans/models/c_models/dispersion_visitor.hh
===================================================================
--- sansmodels/src/sans/models/c_models/dispersion_visitor.hh	(revision eba988511d86410985b5a1c35ce70dd3968132a8)
+++ sansmodels/src/sans/models/c_models/dispersion_visitor.hh	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
@@ -19,4 +19,5 @@
 	void dispersion_to_dict(void *, void *);
 	void gaussian_to_dict(void *, void *);
+	void rectangle_to_dict(void *, void *);
 	void lognormal_to_dict(void *, void *);
 	void schulz_to_dict(void*, void *);
@@ -25,4 +26,5 @@
 	void dispersion_from_dict(void*, void *);
 	void gaussian_from_dict(void*, void *);
+	void rectangle_from_dict(void*, void *);
 	void lognormal_from_dict(void*, void *);
 	void schulz_from_dict(void*, void *);
Index: sansmodels/src/sans/models/c_models/parameters.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/parameters.cpp	(revision 1d78e4bf33d7dd5aa6967f5064d35bc916a4f2ee)
+++ sansmodels/src/sans/models/c_models/parameters.cpp	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
@@ -98,5 +98,5 @@
 	double vary, expo_value;
     vary = x-mean;
-    expo_value = -vary*vary/(2*sigma*sigma);
+    expo_value = -vary*vary/(2.0*sigma*sigma);
     //return 1.0;
     return exp(expo_value);
@@ -130,4 +130,66 @@
 			  && ((*par).has_max==false || val<(*par).max)  ) {
 				double _w = gaussian_weight(value, width, val);
+				weights.insert(weights.end(), WeightPoint(val, _w));
+			}
+		}
+	}
+}
+
+
+/**
+ * Flat dispersion
+ */
+
+RectangleDispersion :: RectangleDispersion() {
+	npts  = 21;
+	width = 0.0;
+	nsigmas = 1.0;
+};
+
+void RectangleDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
+	visitor->rectangle_to_dict(from, to);
+}
+void RectangleDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
+	visitor->rectangle_from_dict(from, to);
+}
+
+double rectangle_weight(double mean, double sigma, double x) {
+	double vary, expo_value;
+    double sig = fabs(sigma);
+    if (x>= (mean-sig) && x<(mean+sig)){
+    	return 1.0;
+    }
+    else{
+    	return 0.0;
+    }
+}
+
+/**
+ * Flat dispersion
+ * @param mean: mean value
+ * @param sigma: half width of top hat function
+ * @param x: value at which the Flat is evaluated
+ * @return: value of the Flat
+ */
+void RectangleDispersion :: operator() (void *param, vector<WeightPoint> &weights){
+	// Check against zero width
+	if (width<=0) {
+		width = 0.0;
+		npts  = 1;
+		nsigmas = 1.0;
+	}
+
+	Parameter* par = (Parameter*)param;
+	double value = (*par)();
+
+	if (npts<2) {
+		weights.insert(weights.end(), WeightPoint(value, 1.0));
+	} else {
+		for(int i=0; i<npts; i++) {
+			// We cover n(nsigmas) times sigmas on each side of the mean
+			double val = value + width * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);
+			if ( ((*par).has_min==false || val>(*par).min)
+			  && ((*par).has_max==false || val<(*par).max)  ) {
+				double _w = rectangle_weight(value, width, val);
 				weights.insert(weights.end(), WeightPoint(val, _w));
 			}
Index: sansmodels/src/sans/models/c_models/parameters.hh
===================================================================
--- sansmodels/src/sans/models/c_models/parameters.hh	(revision 1d78e4bf33d7dd5aa6967f5064d35bc916a4f2ee)
+++ sansmodels/src/sans/models/c_models/parameters.hh	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
@@ -71,4 +71,18 @@
 
 	GaussianDispersion();
+	void operator()(void *, vector<WeightPoint>&);
+	void accept_as_source(DispersionVisitor*, void*, void*);
+	void accept_as_destination(DispersionVisitor*, void*, void*);
+};
+
+/**
+ * Flat dispersion model
+ */
+class RectangleDispersion: public DispersionModel {
+public:
+	/// Number of sigmas on each side of the mean
+	double nsigmas;
+
+	RectangleDispersion();
 	void operator()(void *, vector<WeightPoint>&);
 	void accept_as_source(DispersionVisitor*, void*, void*);
Index: sansmodels/src/sans/models/dispersion_models.py
===================================================================
--- sansmodels/src/sans/models/dispersion_models.py	(revision 79ac6f8cbc71c9a7e133d2e2e0ef6f2ffe0427eb)
+++ sansmodels/src/sans/models/dispersion_models.py	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
@@ -78,4 +78,20 @@
         message += "  Solution: Use an ArrayDispersion object"
         raise "RuntimeError", message
+        
+class RectangleDispersion(DispersionModel):
+    """
+    Python bridge class for a dispersion model based 
+    on a Gaussian distribution.
+    """
+    def __init__(self):
+        self.cdisp = c_models.new_rectangle_model()
+        
+    def set_weights(self, values, weights):
+        """
+            Set the weights of an array dispersion
+        """
+        message = "set_weights is not available for GaussianDispersion.\n"
+        message += "  Solution: Use an ArrayDispersion object"
+        raise "RuntimeError", message 
     
 class SchulzDispersion(DispersionModel):
@@ -133,9 +149,11 @@
         """
         if len(values) != len(weights):
-            raise ValueError, "ArrayDispersion.set_weights: given arrays are of different lengths"
+            raise ValueError, "ArrayDispersion.set_weights: \
+            given arrays are of different lengths"
         
         c_models.set_dispersion_weights(self.cdisp, values, weights)
- 
-models = {"gaussian":GaussianDispersion, "array":ArrayDispersion,
-          "schulz":SchulzDispersion, "lognormal":LogNormalDispersion}       
         
+models = {"gaussian":GaussianDispersion,  "rectangula":RectangleDispersion,
+          "array":ArrayDispersion, "schulz":SchulzDispersion, 
+          "lognormal":LogNormalDispersion}       
+        
