Index: sansmodels/src/sans/models/c_extensions/CGaussian.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/CGaussian.c	(revision 2e2452bdc9bc0fb591e01a0c03d516a0730dcf96)
+++ 	(revision )
@@ -1,290 +1,0 @@
-/** CGaussian
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY gaussian.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- * @author   M.Doucet / UTK
- */
- 
-#include <Python.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-
-#include "gaussian.h"
-
-/// Error object for raised exceptions
-static PyObject * CGaussianError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Log for unit testing
-    PyObject * log;
-    /// Model parameters
-	GaussianParameters model_pars;
-} CGaussian;
-
-
-static void
-CGaussian_dealloc(CGaussian* self)
-{
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CGaussian_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CGaussian *self;
-    
-    self = (CGaussian *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CGaussian_init(CGaussian *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
-        PyDict_SetItemString(self->params,"sigma",Py_BuildValue("d",1.000000));
-        PyDict_SetItemString(self->params,"center",Py_BuildValue("d",0.000000));
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static PyMemberDef CGaussian_members[] = {
-    {"params", T_OBJECT, offsetof(CGaussian, params), 0,
-     "Parameters"},
-    {"log", T_OBJECT, offsetof(CGaussian, log), 0,
-     "Log"},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CGaussian_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CGaussian *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	// Reader parameter dictionary
-    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model_pars.sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model_pars.center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CGaussianError, 
-	    	"CGaussian.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CGaussianError, 
-	    		"CGaussian.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CGaussian_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CGaussian_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",gaussian_analytical_2D(&(self->model_pars),q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CGaussian_readDouble(pars);		
-		
-		return Py_BuildValue("d",gaussian_analytical_1D(&(self->model_pars),q_value));
-	}	
-}
-
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CGaussian *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	// Reader parameter dictionary
-    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model_pars.sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model_pars.center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CGaussianError, 
-	    	"CGaussian.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CGaussianError, 
-	    		"CGaussian.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CGaussian_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CGaussian_readDouble(PyList_GET_ITEM(pars,1));
-		return Py_BuildValue("d",gaussian_analytical_2DXY(&(self->model_pars),qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CGaussian_readDouble(pars);		
-		
-		return Py_BuildValue("d",gaussian_analytical_1D(&(self->model_pars),qx_value));
-	}	
-}
-
-static PyObject * reset(CGaussian *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-
-static PyMethodDef CGaussian_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    //{"numerical_1D",      (PyCFunction)numerical_1D     , METH_VARARGS,
-    //  "Evaluate the 1D model at a given Q"},
-   {NULL}
-};
-
-static PyTypeObject CGaussianType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CGaussian",             /*tp_name*/
-    sizeof(CGaussian),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CGaussian_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CGaussian objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CGaussian_methods,             /* tp_methods */
-    CGaussian_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CGaussian_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CGaussian_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL}
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCGaussian(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CGaussianType) < 0)
-        return;
-
-    Py_INCREF(&CGaussianType);
-    PyModule_AddObject(module, "CGaussian", (PyObject *)&CGaussianType);
-    
-    d = PyModule_GetDict(module);
-    CGaussianError = PyErr_NewException("CGaussian.error", NULL, NULL);
-    PyDict_SetItemString(d, "CGaussianError", CGaussianError);
-}
-
Index: sansmodels/src/sans/models/c_extensions/CLogNormal.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/CLogNormal.c	(revision 2e2452bdc9bc0fb591e01a0c03d516a0730dcf96)
+++ 	(revision )
@@ -1,290 +1,0 @@
-/** CLogNormal
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY logNormal.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- * @author   M.Doucet / UTK
- */
- 
-#include <Python.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-
-#include "logNormal.h"
-
-/// Error object for raised exceptions
-static PyObject * CLogNormalError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Log for unit testing
-    PyObject * log;
-    /// Model parameters
-	LogNormalParameters model_pars;
-} CLogNormal;
-
-
-static void
-CLogNormal_dealloc(CLogNormal* self)
-{
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLogNormal_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLogNormal *self;
-    
-    self = (CLogNormal *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLogNormal_init(CLogNormal *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
-        PyDict_SetItemString(self->params,"sigma",Py_BuildValue("d",1.000000));
-        PyDict_SetItemString(self->params,"center",Py_BuildValue("d",0.000000));
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static PyMemberDef CLogNormal_members[] = {
-    {"params", T_OBJECT, offsetof(CLogNormal, params), 0,
-     "Parameters"},
-    {"log", T_OBJECT, offsetof(CLogNormal, log), 0,
-     "Log"},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLogNormal_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLogNormal *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	// Reader parameter dictionary
-    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model_pars.sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model_pars.center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLogNormalError, 
-	    	"CLogNormal.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLogNormalError, 
-	    		"CLogNormal.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLogNormal_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLogNormal_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",logNormal_analytical_2D(&(self->model_pars),q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLogNormal_readDouble(pars);		
-		
-		return Py_BuildValue("d",logNormal_analytical_1D(&(self->model_pars),q_value));
-	}	
-}
-
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLogNormal *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	// Reader parameter dictionary
-    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model_pars.sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model_pars.center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLogNormalError, 
-	    	"CLogNormal.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLogNormalError, 
-	    		"CLogNormal.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLogNormal_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLogNormal_readDouble(PyList_GET_ITEM(pars,1));
-		return Py_BuildValue("d",logNormal_analytical_2DXY(&(self->model_pars),qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLogNormal_readDouble(pars);		
-		
-		return Py_BuildValue("d",logNormal_analytical_1D(&(self->model_pars),qx_value));
-	}	
-}
-
-static PyObject * reset(CLogNormal *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-
-static PyMethodDef CLogNormal_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    //{"numerical_1D",      (PyCFunction)numerical_1D     , METH_VARARGS,
-    //  "Evaluate the 1D model at a given Q"},
-   {NULL}
-};
-
-static PyTypeObject CLogNormalType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLogNormal",             /*tp_name*/
-    sizeof(CLogNormal),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLogNormal_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLogNormal objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLogNormal_methods,             /* tp_methods */
-    CLogNormal_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLogNormal_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLogNormal_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL}
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLogNormal(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLogNormalType) < 0)
-        return;
-
-    Py_INCREF(&CLogNormalType);
-    PyModule_AddObject(module, "CLogNormal", (PyObject *)&CLogNormalType);
-    
-    d = PyModule_GetDict(module);
-    CLogNormalError = PyErr_NewException("CLogNormal.error", NULL, NULL);
-    PyDict_SetItemString(d, "CLogNormalError", CLogNormalError);
-}
-
Index: sansmodels/src/sans/models/c_extensions/CLorentzian.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/CLorentzian.c	(revision 2e2452bdc9bc0fb591e01a0c03d516a0730dcf96)
+++ 	(revision )
@@ -1,290 +1,0 @@
-/** CLorentzian
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY lorentzian.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- * @author   M.Doucet / UTK
- */
- 
-#include <Python.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-
-#include "lorentzian.h"
-
-/// Error object for raised exceptions
-static PyObject * CLorentzianError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Log for unit testing
-    PyObject * log;
-    /// Model parameters
-	LorentzianParameters model_pars;
-} CLorentzian;
-
-
-static void
-CLorentzian_dealloc(CLorentzian* self)
-{
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLorentzian_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLorentzian *self;
-    
-    self = (CLorentzian *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLorentzian_init(CLorentzian *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
-        PyDict_SetItemString(self->params,"center",Py_BuildValue("d",0.000000));
-        PyDict_SetItemString(self->params,"gamma",Py_BuildValue("d",1.000000));
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static PyMemberDef CLorentzian_members[] = {
-    {"params", T_OBJECT, offsetof(CLorentzian, params), 0,
-     "Parameters"},
-    {"log", T_OBJECT, offsetof(CLorentzian, log), 0,
-     "Log"},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLorentzian_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLorentzian *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	// Reader parameter dictionary
-    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model_pars.center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    self->model_pars.gamma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "gamma") );
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLorentzianError, 
-	    	"CLorentzian.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLorentzianError, 
-	    		"CLorentzian.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLorentzian_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLorentzian_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",lorentzian_analytical_2D(&(self->model_pars),q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLorentzian_readDouble(pars);		
-		
-		return Py_BuildValue("d",lorentzian_analytical_1D(&(self->model_pars),q_value));
-	}	
-}
-
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLorentzian *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	// Reader parameter dictionary
-    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model_pars.center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    self->model_pars.gamma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "gamma") );
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLorentzianError, 
-	    	"CLorentzian.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLorentzianError, 
-	    		"CLorentzian.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLorentzian_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLorentzian_readDouble(PyList_GET_ITEM(pars,1));
-		return Py_BuildValue("d",lorentzian_analytical_2DXY(&(self->model_pars),qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLorentzian_readDouble(pars);		
-		
-		return Py_BuildValue("d",lorentzian_analytical_1D(&(self->model_pars),qx_value));
-	}	
-}
-
-static PyObject * reset(CLorentzian *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-
-static PyMethodDef CLorentzian_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    //{"numerical_1D",      (PyCFunction)numerical_1D     , METH_VARARGS,
-    //  "Evaluate the 1D model at a given Q"},
-   {NULL}
-};
-
-static PyTypeObject CLorentzianType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLorentzian",             /*tp_name*/
-    sizeof(CLorentzian),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLorentzian_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLorentzian objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLorentzian_methods,             /* tp_methods */
-    CLorentzian_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLorentzian_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLorentzian_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL}
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLorentzian(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLorentzianType) < 0)
-        return;
-
-    Py_INCREF(&CLorentzianType);
-    PyModule_AddObject(module, "CLorentzian", (PyObject *)&CLorentzianType);
-    
-    d = PyModule_GetDict(module);
-    CLorentzianError = PyErr_NewException("CLorentzian.error", NULL, NULL);
-    PyDict_SetItemString(d, "CLorentzianError", CLorentzianError);
-}
-
Index: sansmodels/src/sans/models/c_extensions/CSchulz.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/CSchulz.c	(revision 2e2452bdc9bc0fb591e01a0c03d516a0730dcf96)
+++ 	(revision )
@@ -1,290 +1,0 @@
-/** CSchulz
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY schulz.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- * @author   M.Doucet / UTK
- */
- 
-#include <Python.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-
-#include "schulz.h"
-
-/// Error object for raised exceptions
-static PyObject * CSchulzError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Log for unit testing
-    PyObject * log;
-    /// Model parameters
-	SchulzParameters model_pars;
-} CSchulz;
-
-
-static void
-CSchulz_dealloc(CSchulz* self)
-{
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CSchulz_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CSchulz *self;
-    
-    self = (CSchulz *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CSchulz_init(CSchulz *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
-        PyDict_SetItemString(self->params,"sigma",Py_BuildValue("d",1.000000));
-        PyDict_SetItemString(self->params,"center",Py_BuildValue("d",0.000000));
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static PyMemberDef CSchulz_members[] = {
-    {"params", T_OBJECT, offsetof(CSchulz, params), 0,
-     "Parameters"},
-    {"log", T_OBJECT, offsetof(CSchulz, log), 0,
-     "Log"},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CSchulz_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CSchulz *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	// Reader parameter dictionary
-    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model_pars.sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model_pars.center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSchulzError, 
-	    	"CSchulz.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSchulzError, 
-	    		"CSchulz.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CSchulz_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CSchulz_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",schulz_analytical_2D(&(self->model_pars),q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CSchulz_readDouble(pars);		
-		
-		return Py_BuildValue("d",schulz_analytical_1D(&(self->model_pars),q_value));
-	}	
-}
-
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CSchulz *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	// Reader parameter dictionary
-    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model_pars.sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model_pars.center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSchulzError, 
-	    	"CSchulz.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSchulzError, 
-	    		"CSchulz.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CSchulz_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CSchulz_readDouble(PyList_GET_ITEM(pars,1));
-		return Py_BuildValue("d",schulz_analytical_2DXY(&(self->model_pars),qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CSchulz_readDouble(pars);		
-		
-		return Py_BuildValue("d",schulz_analytical_1D(&(self->model_pars),qx_value));
-	}	
-}
-
-static PyObject * reset(CSchulz *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-
-static PyMethodDef CSchulz_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    //{"numerical_1D",      (PyCFunction)numerical_1D     , METH_VARARGS,
-    //  "Evaluate the 1D model at a given Q"},
-   {NULL}
-};
-
-static PyTypeObject CSchulzType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CSchulz",             /*tp_name*/
-    sizeof(CSchulz),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CSchulz_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CSchulz objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CSchulz_methods,             /* tp_methods */
-    CSchulz_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CSchulz_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CSchulz_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL}
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCSchulz(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CSchulzType) < 0)
-        return;
-
-    Py_INCREF(&CSchulzType);
-    PyModule_AddObject(module, "CSchulz", (PyObject *)&CSchulzType);
-    
-    d = PyModule_GetDict(module);
-    CSchulzError = PyErr_NewException("CSchulz.error", NULL, NULL);
-    PyDict_SetItemString(d, "CSchulzError", CSchulzError);
-}
-
Index: sansmodels/src/sans/models/c_extensions/DiamCyl.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/DiamCyl.h	(revision e369627df1a0b85dc6129d8e7ee7ed8fe1db27e9)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#if !defined(DiamCyl_h)
-#define DiamCyl_h
-
-/**
-* To calculate the 2nd virial coefficient
-* [PYTHONCLASS] = DiamCylFunc
-* [DISP_PARAMS] = radius, length
-  [DESCRIPTION] =<text>To calculate the 2nd virial coefficient for
-  the non-spherical object, then find the
-  radius of sphere that has this value of
-  virial coefficient.
- 				</text>
-	[FIXED]= <text>
-				radius.width; length.width
-			</text>
-**/
-
-typedef struct {
-    ///	Radius [A]
-    //  [DEFAULT]=radius=20.0 A
-    double radius;
-
-    /// Length [A]
-    //  [DEFAULT]=length= 400 A
-    double length;
-
-} DiamCyldParameters;
-
-
-
-/// 1D scattering function
-//double DiamCyld_analytical_1D(DiamCyldParameters *pars, double q);
-
-/// 2D scattering function
-//double DiamCyld_analytical_2D(DiamCyldParameters *pars, double q, double phi);
-//double DiamCyld_analytical_2DXY(DiamCyldParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/DiamEllip.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/DiamEllip.h	(revision e369627df1a0b85dc6129d8e7ee7ed8fe1db27e9)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#if !defined(DiamEllip_h)
-#define DiamEllip_h
-
-/**
- * To calculate the 2nd virial coefficient
-* [PYTHONCLASS] = DiamEllipFunc
-* [DISP_PARAMS] = radius_a, radius_b
-  [DESCRIPTION] =<text>To calculate the 2nd virial coefficient for
-                            the non-spherical object, then find the
-                            radius of sphere that has this value of
-                            virial coefficient:
-                              radius_a = polar radius,
-                              radius_b = equatorial radius;
-                                 radius_a > radius_b: Prolate spheroid,
-                                 radius_a < radius_b: Oblate spheroid.
- 				</text>
-	[FIXED]= <text>
-				radius_a.width;radius_b.width
-			</text>
-
- **/
-typedef struct {
-    ///	Polar radius [A]
-    //  [DEFAULT]=radius_a=20.0 A
-    double radius_a;
-
-    /// Equatorial radius [A]
-    //  [DEFAULT]=radius_b= 400 A
-    double radius_b;
-
-} DiamEllipsParameters;
-
-
-
-/// 1D scattering function
-//double DiamEllips_analytical_1D(DiamEllipsParameters *pars, double q);
-
-/// 2D scattering function
-//double DiamEllips_analytical_2D(DiamEllipsParameters *pars, double q, double phi);
-//double DiamEllips_analytical_2DXY(DiamEllipsParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/Hardsphere.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/Hardsphere.h	(revision e369627df1a0b85dc6129d8e7ee7ed8fe1db27e9)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#if !defined(Hardsphere_h)
-#define Hardsphere_h
-
-/**
- * Structure definition for HardsphereStructure (factor) parameters
- */
- //[PYTHONCLASS] = HardsphereStructure
- //[DISP_PARAMS] = effect_radius
- //[DESCRIPTION] =<text>Structure factor for interacting particles:                   .
- //
- //  The interparticle potential is
- //
- //                     U(r)= inf   , r < 2R
- //                         = 0     , r >= 2R
- //
- //						R: effective radius of the Hardsphere particle
- //						V:The volume fraction
- //
- //    Ref: Percus., J. K.,etc., J. Phy.
- //     Rev. 1958, 110, 1.
- //	 </text>
- //[FIXED]= effect_radius.width
-
-
-typedef struct {
-    /// effect radius of hardsphere [A]
-    //  [DEFAULT]=effect_radius=50.0 [A]
-    double effect_radius;
-
-    ///	Volume fraction
-    //  [DEFAULT]=volfraction= 0.2
-    double volfraction;
-} HardsphereParameters;
-
-
-
-/// 1D scattering function
-//double Hardsphere_analytical_1D(HardsphereParameters *pars, double q);
-
-/// 2D scattering function
-//double Hardsphere_analytical_2D(HardsphereParameters *pars, double q, double phi);
-//double Hardsphere_analytical_2DXY(HardsphereParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/HayterMSA.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/HayterMSA.h	(revision e369627df1a0b85dc6129d8e7ee7ed8fe1db27e9)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#if !defined(HayterMSA_h)
-#define HayterMSA_h
-
-/**
- * Structure definition for screened Coulomb interaction
- */
- //[PYTHONCLASS] = HayterMSAStructure
- //[DISP_PARAMS] = effect_radius
- //[DESCRIPTION] =<text>To calculate the structure factor (the Fourier transform of the
- //                     pair correlation function g(r)) for a system of
- //                     charged, spheroidal objects in a dielectric
- //						medium.
- //                     When combined with an appropriate form
- //                     factor, this allows for inclusion of
- //                     the interparticle interference effects
- //                     due to screened coulomb repulsion between
- //                     charged particles.
- //						(Note: charge > 0 required.)
- //
- //                     Ref: JP Hansen and JB Hayter, Molecular
- //                           Physics 46, 651-656 (1982).
- //
- //				</text>
- //[FIXED]= effect_radius.width
-
-typedef struct {
-    ///	effetitve radius of particle [A]
-    //  [DEFAULT]=effect_radius=20.75 [A]
-    double effect_radius;
-
-    /// charge
-    //  [DEFAULT]=charge= 19
-    double charge;
-
-    /// Volume fraction
-    //  [DEFAULT]=volfraction= 0.0192
-    double volfraction;
-
-	///	Temperature [K]
-    //  [DEFAULT]=temperature= 318.16 [K]
-    double temperature;
-
-	///	Monovalent salt concentration [M]
-    //  [DEFAULT]=saltconc= 0 [M]
-    double saltconc;
-
-    ///	Dielectric constant of solvent
-    //  [DEFAULT]=dielectconst= 71.08
-    double dielectconst;
-} HayterMSAParameters;
-
-/// 1D scattering function
-//double HayterMSA_analytical_1D(HayterMSAParameters *pars, double q);
-
-/// 2D scattering function
-//double HayterMSA_analytical_2D(HayterMSAParameters *pars, double q, double phi);
-//double HayterMSA_analytical_2DXY(HayterMSAParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/Make.mm
===================================================================
--- sansmodels/src/sans/models/c_extensions/Make.mm	(revision 533550cf5488b652b4bb2c711d3c248b98bb7abb)
+++ 	(revision )
@@ -1,86 +1,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#                               Michael A.G. Aivazis
-#                        California Institute of Technology
-#                        (C) 1998-2004  All Rights Reserved
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-include local.def
-
-PROJECT = sans
-PACKAGE = libsansmodels
-
-PROJ_SAR = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SAR)
-PROJ_DLL = $(BLD_BINDIR)/$(PACKAGE).$(EXT_SO)
-PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
-PROJ_CLEAN += $(PROJ_SAR) $(PROJ_DLL)
-
-PROJ_SRCS = \
-	core_shell.c \
-	core_shell_cylinder.c \
-	cylinder.c \
-	ellipsoid.c \
-	elliptical_cylinder.c \
-	gaussian.c \
-	lorentzian.c \
-	sphere.c \
-
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# build the library
-
-all: $(PROJ_SAR) export
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-ifeq (Win32, ${findstring Win32, $(PLATFORM_ID)})
-
-# build the shared object
-$(PROJ_SAR): product_dirs $(PROJ_OBJS)
-	$(CXX) $(LCXXFLAGS) -o $(PROJ_DLL) \
-	-Wl,--out-implib=$(PROJ_SAR) $(PROJ_OBJS)
-
-# export
-export:: export-headers export-libraries export-binaries
-
-else
-
-# build the shared object
-$(PROJ_SAR): product_dirs $(PROJ_OBJS)
-	$(CXX) $(LCXXFLAGS) -o $(PROJ_SAR) $(PROJ_OBJS)
-
-
-# export
-export:: export-headers export-libraries 
-
-endif
-
-EXPORT_HEADERS = \
-	core_shell.h \
-	core_shell_cylinder.h \
-	cylinder.h \
-	ellipsoid.h \
-	elliptical_cylinder.h \
-	gaussian.h \
-	lorentzian.h \
-	sphere.h \
-
-
-EXPORT_LIBS = $(PROJ_SAR)
-EXPORT_BINS = $(PROJ_DLL)
-
-
-
-#include doxygen/default.def
-#docs: export-doxygen-docs
-
-
-# version
-# $Id: Make.mm 1444 2007-11-16 16:46:15Z linjiao $
-
-#
-# End of file
Index: sansmodels/src/sans/models/c_extensions/README.txt
===================================================================
--- sansmodels/src/sans/models/c_extensions/README.txt	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
+++ 	(revision )
@@ -1,21 +1,0 @@
-NOTE ABOUT THE SANS MODELS REFACTOR [Oct 14, 2008]
-
-This is the code that was used to produce the first version of the
-SANS models. This code should be refactored to eliminate all the code 
-in c_extensions and merge it with the C++ code in c_models.
-
-- Some of the C code that was used to port the IGOR code is still used.
-  For instance, the functions defined in cylinder.c is used in c_models/cylinder.cpp.
-
-- As of writing, the C functions are used in the McVine code to implement
-  a simulated SANS instrument.
-  
-- The script c_extensions/WrapperGenerator.py is the original script 
-  that was used to generate the python C extensions for our models.
-  For instance, CCylinderModel.c was created with WrapperGenerator.py run
-  on cylinder.h.
- 
-- See c_models/README.txt for more details about the new c_models.
-
- 
-  
Index: sansmodels/src/sans/models/c_extensions/SquareWell.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/SquareWell.h	(revision e369627df1a0b85dc6129d8e7ee7ed8fe1db27e9)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#if !defined(SquareWell_h)
-#define SquareWell_h
-
-/**Structure definition for SquareWell parameters
-*/
-//   [PYTHONCLASS] = SquareWellStructure
-//   [DISP_PARAMS] = effect_radius
-//   [DESCRIPTION] = <text> Structure Factor for interacting particles:             .
-//
-//  The interaction potential is
-//
-//		U(r)= inf   , r < 2R
-//			= -d    , 2R <= r <=2Rw
-//			= 0     , r >= 2Rw
-//
-//		R: effective radius (A)of the particle
-//		v: volume fraction
-//		d: well depth
-//		w: well width; multiples of the
-//		particle diameter
-//
-//		Ref: Sharma, R. V.; Sharma,
-//      K. C., Physica, 1977, 89A, 213.
-//   			</text>
-//   [FIXED]= effect_radius.width
-//[ORIENTATION_PARAMS]= <text> </text>
-
-
-typedef struct {
-    ///	effective radius of particle [A]
-    //  [DEFAULT]=effect_radius=50.0 [A]
-    double effect_radius;
-
-    /// Volume fraction
-    //  [DEFAULT]=volfraction= 0.040
-    double volfraction;
-
-    ///	Well depth [kT]
-    //  [DEFAULT]=welldepth= 1.50 [kT]
-    double welldepth;
-
-    ///	Well width
-    //  [DEFAULT]=wellwidth= 1.20
-    double wellwidth;
-
-} SquareWellParameters;
-
-
-
-/// 1D scattering function
-//double SquareWell_analytical_1D(SquareWellParameters *pars, double q);
-
-/// 2D scattering function
-//double SquareWell_analytical_2D(SquareWellParameters *pars, double q, double phi);
-//double SquareWell_analytical_2DXY(SquareWellParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/StickyHS.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/StickyHS.h	(revision e369627df1a0b85dc6129d8e7ee7ed8fe1db27e9)
+++ 	(revision )
@@ -1,54 +1,0 @@
-#if !defined(StickyHS_h)
-#define StickyHS_h
-
-/**
- * Structure definition for StickyHS_struct (struncture factor) parameters
- */
- //[PYTHONCLASS] = StickyHSStructure
- //[DISP_PARAMS] = effect_radius
- //[DESCRIPTION] =<text> Structure Factor for interacting particles:                               .
- //
- //  The interaction potential is
- //
- //                     U(r)= inf , r < 2R
- //                         = -Uo  , 2R < r < 2R + w
- //                         = 0   , r >= 2R +w
- //
- //						R: effective radius of the hardsphere
- //                     stickiness = [exp(Uo/kT)]/(12*perturb)
- //                     perturb = w/(w+ 2R) , 0.01 =< w <= 0.1
- //                     w: The width of the square well ,w > 0
- //						v: The volume fraction , v > 0
- //
- //                     Ref: Menon, S. V. G.,et.al., J. Chem.
- //                      Phys., 1991, 95(12), 9186-9190.
- //				</text>
- //[FIXED]= effect_radius.width
-typedef struct {
-    /// effect radius of hardsphere [A]
-    //  [DEFAULT]=effect_radius=50.0 [A]
-    double effect_radius;
-
-    ///	Volume fraction
-    //  [DEFAULT]=volfraction= 0.1
-    double volfraction;
-
-	/// Perturbation Parameter ( between 0.01 - 0.1)
-    //  [DEFAULT]=perturb=0.05
-    double perturb;
-
-    ///	Stickiness
-    //  [DEFAULT]=stickiness= 0.2
-    double stickiness;
-} StickyHSParameters;
-
-
-
-/// 1D scattering function
-//double StickyHS_analytical_1D(StickyHSParameters *pars, double q);
-
-/// 2D scattering function
-//double StickyHS_analytical_2D(StickyHSParameters *pars, double q, double phi);
-//double StickyHS_analytical_2DXY(StickyHSParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/WrapperGenerator.py
===================================================================
--- sansmodels/src/sans/models/c_extensions/WrapperGenerator.py	(revision 59b9b67578f11772d51a4d61028e0dfc7097df5a)
+++ 	(revision )
@@ -1,374 +1,0 @@
-#!/usr/bin/env python
-""" WrapperGenerator class to generate model code automatically.
-"""
-
-import os, sys
-import re
-
-class WrapperGenerator:
-    """ Python wrapper generator for C models
-    
-        The developer must provide a header file describing 
-        the new model.
-        
-        To provide the name of the Python class to be
-        generated, the .h file must contain the following 
-        string in the comments:
-        
-        // [PYTHONCLASS] = my_model
-        
-        where my_model must be replaced by the name of the
-        class that you want to import from sans.models.
-        (example: [PYTHONCLASS] = MyModel
-          will create a class MyModel in sans.models.MyModel.
-          It will also create a class CMyModel in 
-          sans_extension.c_models.)
-          
-        Also in comments, each parameter of the params 
-        dictionary must be declared with a default value
-        in the following way:
-        
-        // [DEFAULT]=param_name=default_value
-        
-        (example:
-            //  [DEFAULT]=radius=20.0
-        )
-          
-        See cylinder.h for an example.
-        
-        
-        A .c file corresponding to the .h file should also
-        be provided (example: my_model.h, my_model.c).
-    
-        The .h file should define two function definitions. For example,
-        cylinder.h defines the following:
-        
-            /// 1D scattering function
-            double cylinder_analytical_1D(CylinderParameters *pars, double q);
-            
-            /// 2D scattering function
-            double cylinder_analytical_2D(CylinderParameters *pars, double q, double phi);
-            
-        The .c file implements those functions.
-        
-        @author: Mathieu Doucet / UTK
-        @contact: mathieu.doucet@nist.gov
-    """
-    
-    def __init__(self, filename):
-        """ Initialization """
-        
-        ## Name of .h file to generate wrapper from
-        self.file = filename
-        
-        # Info read from file
-        
-        ## Name of python class to write
-        self.pythonClass = None
-        ## Parser in struct section
-        self.inStruct = False
-        ## Name of struct for the c object
-        self.structName = None
-        ## Dictionary of parameters
-        self.params = {}
-        ## ModelCalculation module flag
-        self.modelCalcFlag = False
-        ## List of default parameters (text)
-        self.default_list = ""
-        ##description
-        self.description=''
-        ## Dictionary of units
-        self.details = ""
-        
-    def __repr__(self):
-        """ Simple output for printing """
-        
-        rep  = "Python class: %s\n" % self.pythonClass
-        rep += "  struc name: %s\n" % self.structName
-        rep += "  params:     %s\n" % self.params
-        rep += "  description: %s\n"% self.description
-        return rep
-        
-    def read(self):
-        """ Reads in the .h file to catch parameters of the wrapper """
-        
-        # Check if the file is there
-        if not os.path.isfile(self.file):
-            raise ValueError, "File %s is not a regular file" % self.file
-        
-        # Read file
-        f = open(self.file,'r')
-        buf = f.read()
-       
-        self.default_list = "List of default parameters:\n"
-        #lines = string.split(buf,'\n')
-        lines = buf.split('\n')
-        self.details  = "## Parameter details [units, min, max]\n"
-        self.details += "        self.details = {}\n"
-        # Catch Description
-        key = "[DESCRIPTION]"
-        find_description= 0
-        temp=""
-        for line in lines:
-            if line.count(key)>0 :
-                
-                try:
-                    find_description= 1
-                    index = line.index(key)
-                    toks = line[index:].split("=",1 )
-                    temp=toks[1].lstrip().rstrip()
-                    text='text'
-                    key2="<%s>"%text.lower()
-                    if re.match(key2,temp)!=None:
-                        #index2 = line.index(key2)
-                        #temp = temp[index2:]
-                        toks2=temp.split(key2,1)
-                        self.description=toks2[1]
-                        text='text'
-                        key2="</%s>"%text.lower()
-                        if re.search(key2,toks2[1])!=None:
-                            temp=toks2[1].split(key2,1)
-                            self.description=temp[0]
-                            break
-                        #print self.description
-                    else:
-                        self.description=temp
-                        break
-                except:
-                     raise ValueError, "Could not parse file %s" % self.file
-            elif find_description==1:
-                text='text'
-                key2="</%s>"%text.lower()
-                #print "second line",line,key2,re.search(key2,line)
-                if re.search(key2,line)!=None:
-                    tok=line.split(key2,1)
-                    temp=tok[0].split("//",1)
-                    self.description+=tok[1].lstrip().rstrip()
-                    break
-                else:
-                    #if re.search("*",line)!=None:
-                    #    temp=line.split("*",1)
-                    #    self.description+='\n'+temp[1].lstrip().rstrip()
-                    if re.search("//",line)!=None:
-                        temp=line.split("//",1)
-                        self.description+='\n\t\t'+temp[1].lstrip().rstrip()
-                        
-                    else:
-                        self.description+='\n\t\t'+line.lstrip().rstrip()
-                    
-                
-        for line in lines:
-            
-            # Catch class name
-            key = "[PYTHONCLASS]"
-            if line.count(key)>0:
-                try:
-                    index = line.index(key)
-                    #toks = string.split( line[index:], "=" )
-                    toks = line[index:].split("=" )
-                    self.pythonClass = toks[1].lstrip().rstrip()
-                except:
-                    raise ValueError, "Could not parse file %s" % self.file
-                
-            # Catch struct name
-            if line.count("typedef struct")>0:
-                # We are entering a struct block
-                self.inStruct = True
-            
-            if self.inStruct and line.count("}")>0:
-                # We are exiting a struct block
-                self.inStruct = False
-    
-                # Catch the name of the struct
-                index = line.index("}")
-                #toks = string.split(line[index+1:],";")
-                toks = line[index+1:].split(";")
-                # Catch pointer definition
-                #toks2 = string.split(toks[0],',')
-                toks2 = toks[0].split(',')
-                self.structName = toks2[0].lstrip().rstrip()
-          
-            # Catch struct content
-            key = "[DEFAULT]"
-            if self.inStruct and line.count(key)>0:
-                # Found a new parameter
-                try:
-                    index = line.index(key)
-                    toks = line[index:].split("=")
-                    toks2 = toks[2].split()
-                    val = float(toks2[0])
-                    self.params[toks[1]] = val
-                    #self.pythonClass = toks[1].lstrip().rstrip()
-                    units = ""
-                    if len(toks2) >= 2:
-                        units = toks2[1]
-                    self.default_list += "         %-15s = %s %s\n" % \
-                        (toks[1], val, units)
-                    
-                    # Check for min and max
-                    min = "None"
-                    max = "None"
-                    if len(toks2) == 4:
-                        min = toks2[2]
-                        max = toks2[3]
-                    
-                    self.details += "        self.details['%s'] = ['%s', %s, %s]\n" % \
-                        (toks[1].lstrip().rstrip(), units.lstrip().rstrip(), min, max)
-                except:
-                    raise ValueError, "Could not parse input file %s \n  %s" % \
-                        (self.file, sys.exc_value)
-                
-                
-            # Catch need for numerical calculations
-            key = "CalcParameters calcPars"
-            if line.count(key)>0:
-                self.modelCalcFlag = True
-            
-                
-                
-    def write_c_wrapper(self):
-        """ Writes the C file to create the python extension class 
-            The file is written in C[PYTHONCLASS].c
-        """
-        
-        file = open("C"+self.pythonClass+'.c', 'w')
-        template = open("classTemplate.txt", 'r')
-        
-        tmp_buf = template.read()
-        #tmp_lines = string.split(tmp_buf,'\n')
-        tmp_lines = tmp_buf.split('\n')
-        
-        for tmp_line in tmp_lines:
-            
-            # Catch class name
-            newline = self.replaceToken(tmp_line, 
-                                        "[PYTHONCLASS]", 'C'+self.pythonClass)
-            ##catch description
-            #newline = self.replaceToken(tmp_line, 
-            #                            "[DESCRIPTION]", self.description)
-            # Catch class name
-            newline = self.replaceToken(newline, 
-                                        "[MODELSTRUCT]", self.structName)
-            
-            # Dictionary initialization
-            param_str = "// Initialize parameter dictionary\n"
-            for par in self.params:
-                param_str += "        PyDict_SetItemString(self->params,\"%s\",Py_BuildValue(\"d\",%f));\n" % \
-                    (par, self.params[par])
-                
-            newline = self.replaceToken(newline,
-                                        "[INITDICTIONARY]", param_str)
-            
-            # Read dictionary
-            param_str = "// Reader parameter dictionary\n"
-            for par in self.params:
-                param_str += "    self->model_pars.%s = PyFloat_AsDouble( PyDict_GetItemString(self->params, \"%s\") );\n" % \
-                    (par, par)
-                
-            newline = self.replaceToken(newline, "[READDICTIONARY]", param_str)
-                
-            # Name of .c file
-            #toks = string.split(self.file,'.')
-            toks = self.file.split('.')
-            newline = self.replaceToken(newline, "[C_FILENAME]", toks[0])
-            
-            # Include file
-            newline = self.replaceToken(newline, 
-                                        "[INCLUDE_FILE]", self.file)           
-                
-            # Numerical calcs dealloc
-            dealloc_str = "\n"
-            if self.modelCalcFlag:
-                dealloc_str = "    modelcalculations_dealloc(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline, 
-                                        "[NUMERICAL_DEALLOC]", dealloc_str)     
-                
-            # Numerical calcs init
-            init_str = "\n"
-            if self.modelCalcFlag:
-                init_str = "        modelcalculations_init(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline, 
-                                        "[NUMERICAL_INIT]", init_str)     
-                
-            # Numerical calcs reset
-            reset_str = "\n"
-            if self.modelCalcFlag:
-                reset_str = "modelcalculations_reset(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline, 
-                                        "[NUMERICAL_RESET]", reset_str)     
-                
-            # Write new line to the wrapper .c file
-            file.write(newline+'\n')
-            
-            
-        file.close()
-        
-    def write_python_wrapper(self):
-        """ Writes the python file to create the python extension class 
-            The file is written in ../[PYTHONCLASS].py
-        """
-        
-        file = open("../"+self.pythonClass+'.py', 'w')
-        template = open("modelTemplate.txt", 'r')
-        
-        tmp_buf = template.read()
-        tmp_lines = tmp_buf.split('\n')
-        
-        for tmp_line in tmp_lines:
-            
-            # Catch class name
-            newline = self.replaceToken(tmp_line, 
-                                        "[CPYTHONCLASS]", 'C'+self.pythonClass)
-            
-            # Catch class name
-            newline = self.replaceToken(newline, 
-                                        "[PYTHONCLASS]", self.pythonClass)
-            
-            # Include file
-            newline = self.replaceToken(newline, 
-                                        "[INCLUDE_FILE]", self.file)    
-                   
-            # Include file
-            newline = self.replaceToken(newline, 
-                                        "[DEFAULT_LIST]", self.default_list)
-            # Model Description
-            newline = self.replaceToken(newline, 
-                                        "[DESCRIPTION]", self.description)
-            # Parameter details
-            newline = self.replaceToken(newline, 
-                                        "[PAR_DETAILS]", self.details)
-            #print"write",tmp_line 
-            # Write new line to the wrapper .c file
-            file.write(newline+'\n')
-           
-        file.close()
-        
-        
-    def replaceToken(self, line, key, value): #pylint: disable-msg=R0201
-        """ Replace a token in the template file 
-            @param line: line of text to inspect
-            @param key: token to look for
-            @param value: string value to replace the token with
-            @return: new string value
-        """
-        lenkey = len(key)
-        newline = line
-        while newline.count(key)>0:
-            index = newline.index(key)
-            newline = newline[:index]+value+newline[index+lenkey:]
-        return newline
-        
-        
-# main
-if __name__ == '__main__':
-    if len(sys.argv)>1:
-        print "Will look for file %s" % sys.argv[1]
-        app = WrapperGenerator(sys.argv[1])
-    else:
-        app = WrapperGenerator("test.h")
-    app.read()
-    app.write_c_wrapper()
-    app.write_python_wrapper()
-    print app
-   
-# End of file        
Index: sansmodels/src/sans/models/c_extensions/barbell.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/barbell.c	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/*
- * Scattering model for a BarBell
- */
-#include "barbell.h"
-#include <math.h>
-#include "GaussWeights.h"
-#include "libCylinder.h"
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @return: function value
- */
-double barbell_analytical_1D(BarBellParameters *pars, double q) {
-	double dp[7];
-	double result;
-
-	dp[0] = pars->scale;
-	dp[1] = pars->rad_bar;
-	dp[2] = pars->len_bar;
-	dp[3] = pars->rad_bell;
-	dp[4] = pars->sld_barbell;
-	dp[5] = pars->sld_solv;
-	dp[6] = pars->background;
-
-	result = Barbell(dp, q);
-	// Make Sure it never goes to inf/nan.
-	if ( result == INFINITY || result == NAN){
-		result = pars->background;
-	}
-	return result;
-}
-
-
-double bar2d_kernel(double dp[], double q, double alpha) {
-	int j;
-	double Pi;
-	double scale,contr,bkg,sldc,slds;
-	double len,rad,hDist,endRad;
-	int nordj=76;
-	double zi=alpha,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	double arg1,arg2,inner,be;
-
-
-	scale = dp[0];
-	rad = dp[1];
-	len = dp[2];
-	endRad = dp[3];
-	sldc = dp[4];
-	slds = dp[5];
-	bkg = dp[6];
-
-	hDist = sqrt(fabs(endRad*endRad-rad*rad));		//by definition for this model
-
-	contr = sldc-slds;
-
-	Pi = 4.0*atan(1.0);
-	vaj = -1.0*hDist/endRad;
-	vbj = 1.0;		//endpoints of inner integral
-
-	summj=0.0;
-
-	for(j=0;j<nordj;j++) {
-		//20 gauss points for the inner integral
-		zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
-		yyy = Gauss76Wt[j] * Dumb_kernel(dp,q,zij,zi);		//uses the same Kernel as the Dumbbell, here L>0
-		summj += yyy;
-	}
-	//now calculate the value of the inner integral
-	inner = (vbj-vaj)/2.0*summj;
-	inner *= 4.0*Pi*endRad*endRad*endRad;
-
-	//now calculate outer integrand
-	arg1 = q*len/2.0*cos(zi);
-	arg2 = q*rad*sin(zi);
-	yyy = inner;
-
-	if(arg2 == 0) {
-		be = 0.5;
-	} else {
-		be = NR_BessJ1(arg2)/arg2;
-	}
-
-	if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
-		yyy += Pi*rad*rad*len*2.0*be;
-	} else {
-		yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-	}
-	yyy *= yyy;   //sin(zi);
-	answer = yyy;
-
-
-	answer /= Pi*rad*rad*len + 2.0*Pi*(2.0*endRad*endRad*endRad/3.0+endRad*endRad*hDist-hDist*hDist*hDist/3.0);		//divide by volume
-	answer *= 1.0e8;		//convert to cm^-1
-	answer *= contr*contr;
-	answer *= scale;
-	answer += bkg;
-
-	return answer;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @return: function value
- */
-double barbell_analytical_2DXY(BarBellParameters *pars, double qx, double qy){
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-	return barbell_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-double barbell_analytical_2D(BarBellParameters *pars, double q, double phi) {
-	return barbell_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double barbell_analytical_2D_scaled(BarBellParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z;
-	double q_z;
-	double alpha, cos_val;
-	double answer;
-	double dp[7];
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->theta * pi/180.0;
-  double phi = pars->phi * pi/180.0;
-
-	dp[0] = pars->scale;
-	dp[1] = pars->rad_bar;
-	dp[2] = pars->len_bar;
-	dp[3] = pars->rad_bell;
-	dp[4] = pars->sld_barbell;
-	dp[5] = pars->sld_solv;
-	dp[6] = pars->background;
-
-	//double Pi = 4.0*atan(1.0);
-    // Cylinder orientation
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-
-    // q vector
-    q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-     	return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-	alpha = acos( cos_val );
-
-	// Call the IGOR library function to get the kernel
-	answer = bar2d_kernel(dp, q, alpha)/sin(alpha);
-
-
-	return answer;
-
-}
Index: sansmodels/src/sans/models/c_extensions/barbell.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/barbell.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,79 +1,0 @@
-#if !defined(barbell_h)
-#define barbell_h
-
-/**
- * Structure definition for BarBell parameters
- */
- //[PYTHONCLASS] = BarBellModel
- //[DISP_PARAMS] = rad_bar,len_bar,rad_bell,phi,  theta
- //[DESCRIPTION] =<text>Calculates the scattering from a barbell-shaped cylinder. That is
- //				a sphereocylinder with spherical end caps
- //				that have a radius larger than that of
- //				the cylinder and the center of the end cap
- //				radius lies outside of the cylinder.
- //				Note: As the length of cylinder(bar) -->0,
- //				it becomes a dumbbell.
- //				And when rad_bar = rad_bell,
- //				it is a spherocylinder.
- //				It must be that rad_bar <(=) rad_bell.
- //				[Parameters];
- //				scale: volume fraction of spheres,
- //				background:incoherent background,
- //				rad_bar: radius of the cylindrical bar,
- //				len_bar: length of the cylindrical bar,
- //				rad_bell: radius of the spherical bell,
- //				sld_barbell: SLD of the barbell,
- //				sld_solv: SLD of the solvent.
- //		</text>
- //[FIXED]=  rad_bar.width;len_bar;rad_bell;phi.width; theta.width
- //[ORIENTATION_PARAMS]= <text> phi; theta; phi.width; theta.width</text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	rad_bar [A]
-    //  [DEFAULT]=rad_bar=20.0 [A]
-    double rad_bar;
-
-    ///	length of the bar [A]
-    //  [DEFAULT]=len_bar=400.0 [A]
-    double len_bar;
-
-    ///	Radius of sphere [A]
-    //  [DEFAULT]=rad_bell=40.0 [A]
-    double rad_bell;
-
-    ///	sld_barbell [1/A^(2)]
-    //  [DEFAULT]=sld_barbell= 1.0e-6 [1/A^(2)]
-    double sld_barbell;
-
-    ///	sld_solv [1/A^(2)]
-    //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)]
-    double sld_solv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-
-    /// Angle of the main axis against z-axis in detector plane [deg]
-    //  [DEFAULT]=theta=0.0 [deg]
-    double theta;
-    /// Azimuthal angle around z-axis in detector plane [deg]
-    //  [DEFAULT]=phi=0.0 [deg]
-    double phi;
-
-} BarBellParameters;
-
-
-
-/// 1D scattering function
-double barbell_analytical_1D(BarBellParameters *pars, double q);
-
-/// 2D scattering function
-double barbell_analytical_2D(BarBellParameters *pars, double q, double phi);
-double barbell_analytical_2DXY(BarBellParameters *pars, double qx, double qy);
-double barbell_analytical_2D_scaled(BarBellParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/bcc.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/bcc.c	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Scattering model for a BC_ParaCrystal
- */
-#include "bcc.h"
-#include "libSphere.h"
-#include <math.h>
-#include <stdio.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the BCC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-double bcc_analytical_1D(BCParameters *pars, double q) {
-	double dp[7];
-	double result;
-
-	dp[0] = pars->scale;
-	dp[1] = pars->dnn;
-	dp[2] = pars->d_factor;
-	dp[3] = pars->radius;
-	dp[4] = pars->sldSph;
-	dp[5] = pars->sldSolv;
-	dp[6] = pars->background;
-
-	result = BCC_ParaCrystal(dp, q);
-	// This FIXES a singualrity the kernel in libigor.
-	if ( result == INFINITY || result == NAN){
-		result = pars->background;
-	}
-	return result;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BCC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-double bc_analytical_2DXY(BCParameters *pars, double qx, double qy){
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-	return bc_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-double bc_analytical_2D(BCParameters *pars, double q, double phi) {
-	return bc_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BCCCrystalModel
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double bc_analytical_2D_scaled(BCParameters *pars, double q, double q_x, double q_y) {
-	double b3_x, b3_y, b3_z, b1_x, b1_y;
-	double q_z;
-	double alpha, cos_val_b3, cos_val_b2, cos_val_b1;
-	double a1_dot_q, a2_dot_q,a3_dot_q;
-	double answer;
-	double Pi = 4.0*atan(1.0);
-	double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2;
-
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->theta * pi/180.0;
-  double phi = pars->phi * pi/180.0;
-  double psi = pars->psi * pi/180.0;
-
-  double dp[5];
-	dp[0] = 1.0;
-	dp[1] = pars->radius;
-	dp[2] = pars->sldSph;
-	dp[3] = pars->sldSolv;
-	dp[4] = 0.0;
-
-	aa = pars->dnn;
-	Da = pars->d_factor*aa;
-	qDa_2 = pow(q*Da,2.0);
-
-	//the occupied volume of the lattice
-	latticeScale = 2.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa/sqrt(3.0/4.0),3.0);
-	// q vector
-	q_z = 0.0; // for SANS; assuming qz is negligible
-	/// Angles here are respect to detector coordinate
-	///  instead of against q coordinate(PRB 36(46), 3(6), 1754(3854))
-    // b3 axis orientation
-    b3_x = sin(theta) * cos(phi);//negative sign here???
-    b3_y = sin(theta) * sin(phi);
-    b3_z = cos(theta);
-    cos_val_b3 =  b3_x*q_x + b3_y*q_y + b3_z*q_z;
-
-    alpha = acos(cos_val_b3);
-    // b1 axis orientation
-    b1_x = sin(psi);
-    b1_y = cos(psi);
-	cos_val_b1 = (b1_x*q_x + b1_y*q_y);
-    // b2 axis orientation
-	cos_val_b2 = sin(acos(cos_val_b1));
-	// alpha corrections
-	cos_val_b2 *= sin(alpha);
-	cos_val_b1 *= sin(alpha);
-
-    // Compute the angle btw vector q and the a3 axis
-    a3_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b1-cos_val_b3);
-
-    // a1 axis
-    a1_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b2-cos_val_b1);
-
-    // a2 axis
-    a2_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b1-cos_val_b2);
-
-    // The following test should always pass
-    if (fabs(cos_val_b3)>1.0) {
-    	printf("bcc_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-    // Get Fkq and Fkq_2
-    Fkq = exp(-0.5*pow(Da/aa,2.0)*(a1_dot_q*a1_dot_q+a2_dot_q*a2_dot_q+a3_dot_q*a3_dot_q));
-    Fkq_2 = Fkq*Fkq;
-    // Call Zq=Z1*Z2*Z3
-    Zq = (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a1_dot_q)+Fkq_2);
-    Zq *= (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a2_dot_q)+Fkq_2);
-    Zq *= (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a3_dot_q)+Fkq_2);
-
-	// Use SphereForm directly from libigor
-	answer = SphereForm(dp,q)*Zq;
-
-	//consider scales
-	answer *= latticeScale * pars->scale;
-
-	// This FIXES a singualrity the kernel in libigor.
-	if ( answer == INFINITY || answer == NAN){
-		answer = 0.0;
-	}
-
-	// add background
-	answer += pars->background;
-
-	return answer;
-}
Index: sansmodels/src/sans/models/c_extensions/bcc.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/bcc.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,81 +1,0 @@
-#if !defined(bcc_h)
-#define bcc_h
-
-/**
- * Structure definition for BCC_ParaCrystal parameters
- */
- //[PYTHONCLASS] = BCCrystalModel
- //[DISP_PARAMS] = radius,phi, psi, theta
- //[DESCRIPTION] =<text>P(q)=(scale/Vp)*V_lattice*P(q)*Z(q)+bkg where scale is the volume
- //					 fraction of sphere,
- //				Vp = volume of the primary particle,
- //				V_lattice = volume correction for
- //					for the crystal structure,
- //				P(q)= form factor of the sphere (normalized),
- //				Z(q)= paracrystalline structure factor
- //					for a face centered cubic structure.
- //				[Body Centered Cubic ParaCrystal Model]
- //				Parameters;
- //				scale: volume fraction of spheres
- //				bkg:background, R: radius of sphere
- //				dnn: Nearest neighbor distance
- //				d_factor: Paracrystal distortion factor
- //				radius: radius of the spheres
- //				sldSph: SLD of the sphere
- //				sldSolv: SLD of the solvent
- //
- //		</text>
- //[FIXED]=  radius.width;phi.width;psi.width; theta.width
- //[ORIENTATION_PARAMS]= <text> phi;psi; theta; phi.width;psi.width; theta.width</text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	Nearest neighbor distance [A]
-    //  [DEFAULT]=dnn=220.0 [A]
-    double dnn;
-
-    ///	Paracrystal distortion factor g
-    //  [DEFAULT]=d_factor=0.06
-    double d_factor;
-
-    ///	Radius of sphere [A]
-    //  [DEFAULT]=radius=40.0 [A]
-    double radius;
-
-    ///	sldSph [1/A^(2)]
-    //  [DEFAULT]=sldSph= 3.0e-6 [1/A^(2)]
-    double sldSph;
-
-    ///	sldSolv [1/A^(2)]
-    //  [DEFAULT]=sldSolv= 6.3e-6 [1/A^(2)]
-    double sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-    /// Orientation of the a1 axis w/respect incoming beam [deg]
-    //  [DEFAULT]=theta=0.0 [deg]
-    double theta;
-    /// Orientation of the a2 in the plane of the detector [deg]
-    //  [DEFAULT]=phi=0.0 [deg]
-    double phi;
-    /// Orientation of the a3 in the plane of the detector [deg]
-    //  [DEFAULT]=psi=0.0 [deg]
-    double psi;
-
-} BCParameters;
-
-
-
-/// 1D scattering function
-double bc_analytical_1D(BCParameters *pars, double q);
-
-/// 2D scattering function
-double bc_analytical_2D(BCParameters *pars, double q, double phi);
-double bc_analytical_2DXY(BCParameters *pars, double qx, double qy);
-double bc_analytical_2D_scaled(BCParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/binaryHS.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/binaryHS.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-#if !defined(binaryHS_h)
-#define binaryHS_h
-
-/**
- * Structure definition for binary hard sphere parameters
-
-	[PYTHONCLASS] = BinaryHSModel
-	[DISP_PARAMS] = l_radius,s_radius
-	[DESCRIPTION] =<text> Model parameters: l_radius : large radius of binary hard sphere
-			s_radius : small radius of binary hard sphere
-			vol_frac_ls : volume fraction of large spheres
-			vol_frac_ss : volume fraction of small spheres
-			ls_sld: large sphere  scattering length density
-			ss_sld: small sphere scattering length density
-			solvent_sld: solvent scattering length density
-			background: incoherent background
-               </text>
-	[FIXED]= l_radius.width;s_radius.width
-	[ORIENTATION_PARAMS]= <text> </text>
- */
-typedef struct {
-
-	///	large radius of the binary hard sphere [A]
-    //  [DEFAULT]=l_radius= 100.0 [A]
-    double l_radius;
-
-    ///	small radius of the binary hard sphere [A]
-    //  [DEFAULT]=s_radius= 25.0 [A]
-    double s_radius;
-
-	///	volume fraction of large spheres
-    //  [DEFAULT]=vol_frac_ls= 0.1
-    double vol_frac_ls;
-
-	///	volume fraction of small spheres
-    //  [DEFAULT]=vol_frac_ss= 0.2
-    double vol_frac_ss;
-
-	///	large sphere scattering length density [1/A^(2)]
-    //  [DEFAULT]=ls_sld= 3.5e-6 [1/A^(2)]
-    double ls_sld;
-
-	///	lsmall sphere scattering length density [1/A^(2)]
-    //  [DEFAULT]=ss_sld= 5e-7 [1/A^(2)]
-    double ss_sld;
-
-    ///	solvent scattering length density [1/A^(2)]
-    //  [DEFAULT]=solvent_sld= 6.36e-6 [1/A^(2)]
-    double solvent_sld;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.001 [1/cm]
-	double background;
-
-} BinaryHSParameters;
-
-
-
-/// 1D scattering function
-//double binaryHS_analytical_1D(BinaryHSParameters *pars, double q);
-
-/// 2D scattering function
-//double binaryHS_analytical_2D(BinaryHSParameters *pars, double q, double phi);
-//double binaryHS_analytical_2DXY(BinaryHSParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/capcyl.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/capcyl.c	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,179 +1,0 @@
-/*
- * Scattering model for a Capped Cylinder
- */
-#include "capcyl.h"
-#include <math.h>
-#include "GaussWeights.h"
-#include "libCylinder.h"
-#include <stdio.h>
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the CappedCylinder
- * @param q: q-value
- * @return: function value
- */
-double capcyl_analytical_1D(CapCylParameters *pars, double q) {
-	double dp[7];
-	double result;
-
-	dp[0] = pars->scale;
-	dp[1] = pars->rad_cyl;
-	dp[2] = pars->len_cyl;
-	dp[3] = pars->rad_cap;
-	dp[4] = pars->sld_capcyl;
-	dp[5] = pars->sld_solv;
-	dp[6] = pars->background;
-
-	result = CappedCylinder(dp, q);
-	// Make Sure it never goes to inf/nan.
-	if ( result == INFINITY || result == NAN){
-		result = pars->background;
-	}
-	return result;
-}
-
-
-double capcyl2d_kernel(double dp[], double q, double alpha) {
-	int j;
-	double Pi;
-	double scale,contr,bkg,sldc,slds;
-	double len,rad,hDist,endRad;
-	int nordj=76;
-	double zi=alpha,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	double arg1,arg2,inner,be;
-
-
-	scale = dp[0];
-	rad = dp[1];
-	len = dp[2];
-	endRad = dp[3];
-	sldc = dp[4];
-	slds = dp[5];
-	bkg = dp[6];
-
-	hDist = -1.0*sqrt(fabs(endRad*endRad-rad*rad));		//by definition for this model
-
-	contr = sldc-slds;
-
-	Pi = 4.0*atan(1.0);
-	vaj = -1.0*hDist/endRad;
-	vbj = 1.0;		//endpoints of inner integral
-
-	summj=0.0;
-
-	for(j=0;j<nordj;j++) {
-		//20 gauss points for the inner integral
-		zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
-		yyy = Gauss76Wt[j] * ConvLens_kernel(dp,q,zij,zi);		//uses the same Kernel as the Dumbbell, here L>0
-		summj += yyy;
-	}
-	//now calculate the value of the inner integral
-	inner = (vbj-vaj)/2.0*summj;
-	inner *= 4.0*Pi*endRad*endRad*endRad;
-
-	//now calculate outer integrand
-	arg1 = q*len/2.0*cos(zi);
-	arg2 = q*rad*sin(zi);
-	yyy = inner;
-
-	if(arg2 == 0) {
-		be = 0.5;
-	} else {
-		be = NR_BessJ1(arg2)/arg2;
-	}
-
-	if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
-		yyy += Pi*rad*rad*len*2.0*be;
-	} else {
-		yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-	}
-	yyy *= yyy;   //sin(zi);
-	answer = yyy;
-
-
-	answer /= Pi*rad*rad*len + 2.0*Pi*(2.0*endRad*endRad*endRad/3.0+endRad*endRad*hDist-hDist*hDist*hDist/3.0);		//divide by volume
-	answer *= 1.0e8;		//convert to cm^-1
-	answer *= contr*contr;
-	answer *= scale;
-	answer += bkg;
-
-	return answer;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @return: function value
- */
-double capcyl_analytical_2DXY(CapCylParameters *pars, double qx, double qy){
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-	return capcyl_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-double capcyl_analytical_2D(CapCylParameters *pars, double q, double phi) {
-	return capcyl_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double capcyl_analytical_2D_scaled(CapCylParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z;
-	double q_z;
-	double alpha, cos_val;
-	double answer;
-	double dp[7];
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->theta * pi/180.0;
-  double phi = pars->phi * pi/180.0;
-
-	dp[0] = pars->scale;
-	dp[1] = pars->rad_cyl;
-	dp[2] = pars->len_cyl;
-	dp[3] = pars->rad_cap;
-	dp[4] = pars->sld_capcyl;
-	dp[5] = pars->sld_solv;
-	dp[6] = pars->background;
-
-
-	//double Pi = 4.0*atan(1.0);
-    // Cylinder orientation
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-
-    // q vector
-    q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-	alpha = acos( cos_val );
-
-	// Call the IGOR library function to get the kernel
-	answer = capcyl2d_kernel(dp, q, alpha)/sin(alpha);
-
-
-	return answer;
-
-}
Index: sansmodels/src/sans/models/c_extensions/capcyl.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/capcyl.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,77 +1,0 @@
-#if !defined(capcyl_h)
-#define capcyl_h
-
-/**
- * Structure definition for CappedCylinder parameters
- */
- //[PYTHONCLASS] = CappedCylinderModel
- //[DISP_PARAMS] = rad_cyl,len_cyl,rad_cap,phi,  theta
- //[DESCRIPTION] =<text>Calculates the scattering from a cylinder with spherical section end-caps.
- //				That is, a sphereocylinder
- //				with end caps that have a radius larger than
- //				that of the cylinder and the center of the
- //				end cap radius lies within the cylinder.
- //				Note: As the length of cylinder -->0,
- //				it becomes a ConvexLens.
- //				It must be that rad_cyl <(=) rad_cap.
- //				[Parameters];
- //				scale: volume fraction of spheres,
- //				background:incoherent background,
- //				rad_cyl: radius of the cylinder,
- //				len_cyl: length of the cylinder,
- //				rad_cap: radius of the semi-spherical cap,
- //				sld_capcyl: SLD of the capped cylinder,
- //				sld_solv: SLD of the solvent.
- //		</text>
- //[FIXED]=  rad_cyl.width;len_cyl;rad_cap;phi.width; theta.width
- //[ORIENTATION_PARAMS]= <text> phi; theta; phi.width; theta.width</text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	rad_cyl [A]
-    //  [DEFAULT]=rad_cyl=20.0 [A]
-    double rad_cyl;
-
-    ///	length of the cylinder
-    //  [DEFAULT]=len_cyl=400.0 [A]
-    double len_cyl;
-
-    ///	Radius of sphere [A]
-    //  [DEFAULT]=rad_cap=40.0 [A]
-    double rad_cap;
-
-    ///	sld_capcyl [1/A^(2)]
-    //  [DEFAULT]=sld_capcyl= 1.0e-6 [1/A^(2)]
-    double sld_capcyl;
-
-    ///	sld_solv [1/A^(2)]
-    //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)]
-    double sld_solv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-
-    /// Angle of the main axis against z-axis in detector plane [deg]
-    //  [DEFAULT]=theta=0.0 [deg]
-    double theta;
-    /// Azimuthal angle around z-axis in detector plane [deg]
-    //  [DEFAULT]=phi=0.0 [deg]
-    double phi;
-
-} CapCylParameters;
-
-
-
-/// 1D scattering function
-double capcyl_analytical_1D(CapCylParameters *pars, double q);
-
-/// 2D scattering function
-double capcyl_analytical_2D(CapCylParameters *pars, double q, double phi);
-double capcyl_analytical_2DXY(CapCylParameters *pars, double qx, double qy);
-double capcyl_analytical_2D_scaled(CapCylParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/core_shell.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/core_shell.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#if !defined(core_shell_h)
-#define core_shell_h
-
-/**
- * Structure definition for core-shell parameters
- */
- //[PYTHONCLASS] = CoreShellModel
- //[DISP_PARAMS] = radius, thickness
- //[DESCRIPTION] =<text>Form factor for a monodisperse spherical particle with particle
- //    with a core-shell structure:
- //
- //    The form factor is normalized by the
- //    total particle volume.
- //
- //		radius: core radius, thickness: shell thickness
- //
- //     Ref: Guinier, A. and G. Fournet,
- //     John Wiley and Sons, New York, 1955.
- //				</text>
- //[FIXED]= <text> thickness.width;radius.width</text>
-
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    ///	Core Radius [A] 60.0
-    //  [DEFAULT]=radius=60.0 [A]
-    double radius;
-    /// Shell Thickness [A] 10.0
-    //  [DEFAULT]=thickness=10 [A]
-    double thickness;
-    ///	Core SLD [1/A^(2)] 1.0e-6
-    //  [DEFAULT]=core_sld=1.0e-6 [1/A^(2)]
-    double core_sld;
-	/// Shell SLD [1/A^(2)] 2.0e-6
-	//  [DEFAULT]=shell_sld=2.0e-6 [1/A^(2)]
-	double shell_sld;
-	/// Solvent SLD [1/A^(2)] 3.0e-6
-	//  [DEFAULT]=solvent_sld=3.0e-6 [1/A^(2)]
-	double solvent_sld;
-	/// Incoherent Background [1/cm] 0.000
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-} CoreShellParameters;
-
-
-
-/// 1D scattering function
-//double core_shell_analytical_1D(CoreShellParameters *pars, double q);
-
-/// 2D scattering function
-//double core_shell_analytical_2D(CoreShellParameters *pars, double q, double phi);
-//double core_shell_analytical_2DXY(CoreShellParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/core_shell_cylinder.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/core_shell_cylinder.c	(revision 36f482f3eade66de79d414fd552db5f89239033d)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/**
- * Scattering model for a core-shell cylinder
- * @author: Mathieu Doucet / UTK
- */
-
-#include "core_shell_cylinder.h"
-#include "libCylinder.h"
-#include <math.h>
-#include <stdio.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @return: function value
- */
-double core_shell_cylinder_analytical_1D(CoreShellCylinderParameters *pars, double q) {
-	double dp[8];
-
-	dp[0] = pars->scale;
-	dp[1] = pars->radius;
-	dp[2] = pars->thickness;
-	dp[3] = pars->length;
-	dp[4] = pars->core_sld;
-	dp[5] = pars->shell_sld;
-	dp[6] = pars->solvent_sld;
-	dp[7] = pars->background;
-
-	return CoreShellCylinder(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @return: function value
- */
-double core_shell_cylinder_analytical_2DXY(CoreShellCylinderParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return core_shell_cylinder_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double core_shell_cylinder_analytical_2D(CoreShellCylinderParameters *pars, double q, double phi) {
-    return core_shell_cylinder_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double core_shell_cylinder_analytical_2D_scaled(CoreShellCylinderParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z;
-	double q_z;
-	double alpha, vol, cos_val;
-	double answer;
-	//convert angle degree to radian
-	double pi = 4.0*atan(1.0);
-	double theta = pars->axis_theta * pi/180.0;
-	double phi = pars->axis_phi * pi/180.0;
-
-    // Cylinder orientation
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-
-    // q vector
-    q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("core_shell_cylinder_analytical_2D: Unexpected error: cos(alpha)=%g\n", cos_val);
-     	return 0;
-    }
-
-	alpha = acos( cos_val );
-
-	// Call the IGOR library function to get the kernel
-	answer = CoreShellCylKernel(q, pars->radius, pars->thickness,
-								pars->core_sld,pars->shell_sld,
-								pars->solvent_sld, pars->length/2.0, alpha) / fabs(sin(alpha));
-
-	//normalize by cylinder volume
-	vol=pi*(pars->radius+pars->thickness)
-			*(pars->radius+pars->thickness)
-			*(pars->length+2.0*pars->thickness);
-	answer /= vol;
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
Index: sansmodels/src/sans/models/c_extensions/core_shell_cylinder.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/core_shell_cylinder.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,91 +1,0 @@
-#if !defined(core_shell_cylinder_h)
-#define core_shell_cylinder_h
-
-/**
- * Structure definition for core-shell cylinder parameters
- */
- //[PYTHONCLASS] = CoreShellCylinderModel
- //[DISP_PARAMS] = radius, thickness, length, axis_theta, axis_phi
- //[DESCRIPTION] = <text>P(q,alpha)= scale/Vs*f(q)^(2) + bkg,  where: f(q)= 2(core_sld
-//			- solvant_sld)* Vc*sin[qLcos(alpha/2)]
-//			/[qLcos(alpha/2)]*J1(qRsin(alpha))
- //			/[qRsin(alpha)]+2(shell_sld-solvent_sld)
- //			*Vs*sin[q(L+T)cos(alpha/2)][[q(L+T)
- //			*cos(alpha/2)]*J1(q(R+T)sin(alpha))
- //			/q(R+T)sin(alpha)]
- //
- //			alpha:is the angle between the axis of
- //          the cylinder and the q-vector
- //			Vs: the volume of the outer shell
- //			Vc: the volume of the core
- //			L: the length of the core
- //    		shell_sld: the scattering length density
- //			of the shell
- //			solvent_sld: the scattering length density
- //			of the solvent
- //			bkg: the background
- //			T: the thickness
- //    		R+T: is the outer radius
- // 		L+2T: The total length of the outershell
- //			J1: the first order Bessel function
- // 		theta: axis_theta of the cylinder
- // 		phi: the axis_phi of the cylinder...
- //		</text>
- //[FIXED]= <text> axis_phi.width; axis_theta.width; length.width;radius.width; thickness.width</text>
- //[ORIENTATION_PARAMS]= axis_phi; axis_theta;axis_phi.width; axis_theta.width
-
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-
-    /// Core radius [A]
-    //  [DEFAULT]=radius=20.0 [A]
-    double radius;
-
-    /// Shell thickness [A]
-    //  [DEFAULT]=thickness=10.0 [A]
-    double thickness;
-
-    /// Core length [A]
-    //  [DEFAULT]=length=400.0 [A]
-    double length;
-
-    /// Core SLD [1/A^(2)]
-    //  [DEFAULT]=core_sld=1.0e-6 [1/A^(2)]
-    double core_sld;
-
-    /// Shell SLD [1/A^(2)]
-    //  [DEFAULT]=shell_sld=4.0e-6 [1/A^(2)]
-    double shell_sld;
-
-    /// Solvent SLD [1/A^(2)]
-    //  [DEFAULT]=solvent_sld=1.0e-6 [1/A^(2)]
-    double solvent_sld;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-
-    /// Orientation of the long axis of the core-shell cylinder w/respect incoming beam [deg]
-    //  [DEFAULT]=axis_theta=90.0 [deg]
-    double axis_theta;
-
-    /// Orientation of the long axis of the core-shell cylinder in the plane of the detector [deg]
-    //  [DEFAULT]=axis_phi=0.0 [deg]
-    double axis_phi;
-
-} CoreShellCylinderParameters;
-
-
-
-/// 1D scattering function
-double core_shell_cylinder_analytical_1D(CoreShellCylinderParameters *pars, double q);
-
-/// 2D scattering function
-double core_shell_cylinder_analytical_2D(CoreShellCylinderParameters *pars, double q, double phi);
-double core_shell_cylinder_analytical_2DXY(CoreShellCylinderParameters *pars, double qx, double qy);
-double core_shell_cylinder_analytical_2D_scaled(CoreShellCylinderParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/corefourshell.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/corefourshell.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#if !defined(corefourshell_h)
-#define corefourshell_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = CoreFourShellModel
- //[DISP_PARAMS] = rad_core0, thick_shell1,thick_shell2,thick_shell3,thick_shell4
- //[DESCRIPTION] =<text> Calculates the scattering intensity from a core-4 shell structure.
- // 			scale = scale factor * volume fraction
- //				rad_core0: the radius of the core
- //				sld_core0: the SLD of the core
- //				thick_shelli: the thickness of the i'th shell from the core
- //				sld_shelli: the SLD of the i'th shell from the core
- //				sld_solv: the SLD of the solvent
- //				background: incoherent background
- //		</text>
- //[FIXED]=<text>  thick_shell4.width; thick_shell1.width;thick_shell2.width;thick_shell3.width;rad_core0.width </text>
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	Radius of the core0 [A]
-    //  [DEFAULT]=rad_core0=60. [A]
-    double rad_core0;
-
-    ///	sld of core0 [1/A^(2)]
-    //  [DEFAULT]=sld_core0= 6.4e-6 [1/A^(2)]
-    double sld_core0;
-
-    ///	thickness of the shell1 [A]
-     //  [DEFAULT]=thick_shell1=10.0 [A]
-    double thick_shell1;
-
-     ///	sld of shell1 [1/A^(2)]
-     //  [DEFAULT]=sld_shell1= 1.0e-6 [1/A^(2)]
-     double sld_shell1;
-
-     ///	thickness of the shell2 [A]
-      //  [DEFAULT]=thick_shell2=10.0 [A]
-     double thick_shell2;
-
-      ///	sld of shell2 [1/A^(2)]
-      //  [DEFAULT]=sld_shell2= 2.0e-6 [1/A^(2)]
-      double sld_shell2;
-
-      ///	thickness of the shell3 [A]
-       //  [DEFAULT]=thick_shell3=10.0 [A]
-      double thick_shell3;
-
-       ///	sld of shell3 [1/A^(2)]
-       //  [DEFAULT]=sld_shell3= 3.0e-6 [1/A^(2)]
-       double sld_shell3;
-
-       ///	thickness of the shell4 [A]
-        //  [DEFAULT]=thick_shell4=10.0 [A]
-       double thick_shell4;
-
-        ///	sld of shell4 [1/A^(2)]
-        //  [DEFAULT]=sld_shell4= 4.0e-6 [1/A^(2)]
-        double sld_shell4;
-
-    ///	sld_solv[1/A^(2)]
-    //  [DEFAULT]=sld_solv= 6.4e-6 [1/A^(2)]
-    double sld_solv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.001 [1/cm]
-	double background;
-} CoreFourShellParameters;
-
-
-
-/// 1D scattering function
-//double corefourshell_analytical_1D(CoreFourShellParameters *pars, double q);
-
-/// 2D scattering function
-//double corefourshell_analytical_2D(CoreFourShellParameters *pars, double q, double phi);
-//double corefourshell_analytical_2DXY(CoreFourShellParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/csparallelepiped.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/csparallelepiped.c	(revision 36f482f3eade66de79d414fd552db5f89239033d)
+++ 	(revision )
@@ -1,243 +1,0 @@
-/**
- * Scattering model for a csparallelepiped
- */
-
-#include "csparallelepiped.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the CSparallelepiped
- * @param q: q-value
- * @return: function value
- */
-double csparallelepiped_analytical_1D(CSParallelepipedParameters *pars, double q) {
-	double dp[13];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->shortA;
-	dp[2] = pars->midB;
-	dp[3] = pars->longC;
-	dp[4] = pars->rimA;
-	dp[5] = pars->rimB;
-	dp[6] = pars->rimC;
-	dp[7] = pars->sld_rimA;
-	dp[8] = pars->sld_rimB;
-	dp[9] = pars->sld_rimC;
-	dp[10] = pars->sld_pcore;
-	dp[11] = pars->sld_solv;
-	dp[12] = pars->background;
-
-	// Call library function to evaluate model
-	//ToDo: Correct this 1d model, CSParallelepiped in libigor (2D corrected).
-	return CSParallelepiped(dp, q);
-}
-
-
-double cspkernel(double dp[],double q, double ala, double alb, double alc){
-    // mu passed in is really mu*sqrt(1-sig^2)
-    double argA,argB,argC,argtA,argtB,argtC,tmp1,tmp2,tmp3,tmpt1,tmpt2,tmpt3;			//local variables
-
-	double aa,bb,cc, ta,tb,tc;
-	double Vin,Vot,V1,V2,V3;
-	double rhoA,rhoB,rhoC, rhoP, rhosolv;
-	double dr0, drA,drB, drC;
-	double retVal;
-
-	aa = dp[1];
-	bb = dp[2];
-	cc = dp[3];
-	ta = dp[4];
-	tb = dp[5];
-	tc = dp[6];
-	rhoA=dp[7];
-	rhoB=dp[8];
-	rhoC=dp[9];
-	rhoP=dp[10];
-	rhosolv=dp[11];
-	dr0=rhoP-rhosolv;
-	drA=rhoA-rhosolv;
-	drB=rhoB-rhosolv;
-	drC=rhoC-rhosolv;
-	Vin=(aa*bb*cc);
-	Vot=(aa*bb*cc+2.0*ta*bb*cc+2.0*aa*tb*cc+2.0*aa*bb*tc);
-	V1=(2.0*ta*bb*cc);   //  incorrect V1 (aa*bb*cc+2*ta*bb*cc)
-	V2=(2.0*aa*tb*cc);  // incorrect V2(aa*bb*cc+2*aa*tb*cc)
-	V3=(2.0*aa*bb*tc);
-	//aa = aa/bb;
-	ta=(aa+2.0*ta);///bb;
-	tb=(aa+2.0*tb);///bb;
-	tc=(aa+2.0*tc);
-    //handle arg=0 separately, as sin(t)/t -> 1 as t->0
-    argA = q*aa*ala/2.0;
-    argB = q*bb*alb/2.0;
-    argC = q*cc*alc/2.0;
-    argtA = q*ta*ala/2.0;
-	argtB = q*tb*alb/2.0;
-	argtC = q*tc*alc/2.0;
-
-    if(argA==0.0) {
-		tmp1 = 1.0;
-	} else {
-		tmp1 = sin(argA)/argA;
-    }
-    if (argB==0.0) {
-		tmp2 = 1.0;
-	} else {
-		tmp2 = sin(argB)/argB;
-    }
-
-    if (argC==0.0) {
-		tmp3 = 1.0;
-	} else {
-		tmp3 = sin(argC)/argC;
-    }
-    if(argtA==0.0) {
-		tmpt1 = 1.0;
-	} else {
-		tmpt1 = sin(argtA)/argtA;
-    }
-    if (argtB==0.0) {
-		tmpt2 = 1.0;
-	} else {
-		tmpt2 = sin(argtB)/argtB;
-    }
-    if (argtC==0.0) {
-		tmpt3 = 1.0;
-	} else {
-		tmpt3 = sin(argtC)*sin(argtC)/argtC/argtC;
-    }
-    // This expression is different from NIST/IGOR package (I strongly believe the IGOR is wrong!!!). 10/15/2010.
-    retVal =( dr0*tmp1*tmp2*tmp3*Vin + drA*(tmpt1-tmp1)*tmp2*tmp3*V1+ drB*tmp1*(tmpt2-tmp2)*tmp3*V2 + drC*tmp1*tmp2*(tmpt3-tmp3)*V3)*
-				( dr0*tmp1*tmp2*tmp3*Vin + drA*(tmpt1-tmp1)*tmp2*tmp3*V1+ drB*tmp1*(tmpt2-tmp2)*tmp3*V2 + drC*tmp1*tmp2*(tmpt3-tmp3)*V3);   //  correct FF : square of sum of phase factors
-    //retVal *= (tmp3*tmp3);
-    retVal /= Vot;
-
-    return (retVal);
-
-}//Function cspkernel()
-
-
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the CSparallelepiped
- * @param q: q-value
- * @return: function value
- */
-double csparallelepiped_analytical_2DXY(CSParallelepipedParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return csparallelepiped_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the CSParallelepiped
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double csparallelepiped_analytical_2D(CSParallelepipedParameters *pars, double q, double phi) {
-    return csparallelepiped_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the CSparallelepiped
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double csparallelepiped_analytical_2D_scaled(CSParallelepipedParameters *pars, double q, double q_x, double q_y) {
-	double dp[13];
-  double cparallel_x, cparallel_y, cparallel_z, bparallel_x, bparallel_y, parallel_x, parallel_y;
-  double q_z;
-  double alpha, cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC;
-
-  double answer;
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->parallel_theta * pi/180.0;
-  double phi = pars->parallel_phi * pi/180.0;
-  double psi = pars->parallel_psi* pi/180.0;
-
-	// Fill paramater array
-	dp[0] = 1.0;
-	dp[1] = pars->shortA;
-	dp[2] = pars->midB;
-	dp[3] = pars->longC;
-	dp[4] = pars->rimA;
-	dp[5] = pars->rimB;
-	dp[6] = pars->rimC;
-	dp[7] = pars->sld_rimA;
-	dp[8] = pars->sld_rimB;
-	dp[9] = pars->sld_rimC;
-	dp[10] = pars->sld_pcore;
-	dp[11] = pars->sld_solv;
-	dp[12] = 0.0;
-
-
-	edgeA = pars->shortA;
-	edgeB = pars->midB;
-	edgeC = pars->longC;
-
-
-    // parallelepiped c axis orientation
-    cparallel_x = sin(theta) * cos(phi);
-    cparallel_y = sin(theta) * sin(phi);
-    cparallel_z = cos(theta);
-
-    // q vector
-    q_z = 0.0;
-
-    // Compute the angle btw vector q and the
-    // axis of the parallelepiped
-    cos_val_c = cparallel_x*q_x + cparallel_y*q_y + cparallel_z*q_z;
-    alpha = acos(cos_val_c);
-
-    // parallelepiped a axis orientation
-    parallel_x = sin(psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)*sin(pars->parallel_psi);
-    parallel_y = cos(psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)*cos(pars->parallel_psi);
-
-    cos_val_a = parallel_x*q_x + parallel_y*q_y;
-
-
-
-    // parallelepiped b axis orientation
-    bparallel_x = sqrt(1.0-sin(theta)*cos(phi))*cos(psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)* cos(pars->parallel_psi);
-    bparallel_y = sqrt(1.0-sin(theta)*cos(phi))*sin(psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)* sin(pars->parallel_psi);
-    // axis of the parallelepiped
-    cos_val_b = sin(acos(cos_val_a)) ;
-
-
-
-    // The following test should always pass
-    if (fabs(cos_val_c)>1.0) {
-    	printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-	// Call the IGOR library function to get the kernel
-	answer = cspkernel( dp,q, sin(alpha)*cos_val_a,sin(alpha)*cos_val_b,cos_val_c);
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
-
Index: sansmodels/src/sans/models/c_extensions/csparallelepiped.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/csparallelepiped.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
-	TODO: Add 2D model
-*/
-
-#if !defined(csparallelepiped_h)
-#define csparallelepiped_h
-/** Structure definition for CSParallelepiped parameters
- * [PYTHONCLASS] = CSParallelepipedModel
- * [DISP_PARAMS] = shortA, midB, longC,parallel_phi,parallel_psi, parallel_theta
-   [DESCRIPTION] = <text> Form factor for a rectangular Shell. Below are the Parameters.
-		scale: scale factor
-		shortA: length of short edge  [A]
-		midB: length of another short edge [A]
-		longC: length of long edge  of the parallelepiped [A]
-		rimA: length of short edge  [A]
-		rimB: length of another short edge [A]
-		rimC: length of long edge  of the parallelepiped [A]
-		sld_rimA: sld of rimA [1/A^(2)]
-		sld_rimB: sld of rimB [1/A^(2)]
-		sld_rimC: sld of rimC [1/A^(2)]
-		sld_core: Pipe_sld [1/A^(2)]
-		sld_solv: solvent_sld [1/A^(2)]
-		background: incoherent Background [1/cm]
-		</text>
-	[FIXED]= <text>shortA.width; midB.width; longC.width;parallel_phi.width;parallel_psi.width; parallel_theta.width</text>
-	[ORIENTATION_PARAMS]= <text>parallel_phi;parallel_psi; parallel_theta; parallel_phi.width;parallel_psi.width; parallel_theta.width</text>
-
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    ///  Length of short edge of the parallelepiped [A]
-    //  [DEFAULT]=shortA=35 [A]
-    double shortA;
-	/// Length of mid edge of the parallelepiped [A]
-    //  [DEFAULT]=midB=75 [A]
-    double midB;
-	/// Length of long edge of the parallelepiped [A]
-    //  [DEFAULT]=longC=400 [A]
-    double longC;
-    ///  Thickness of rimA [A]
-    //  [DEFAULT]=rimA=10 [A]
-    double rimA;
-	/// Thickness of rimB [A] [A]
-    //  [DEFAULT]=rimB=10 [A]
-    double rimB;
-	/// Thickness of rimC [A] [A]
-    //  [DEFAULT]=rimC=10 [A]
-    double rimC;
-    /// SLD_rimA [1/A^(2)]
-    //  [DEFAULT]=sld_rimA=2e-6 [1/A^(2)]
-    double sld_rimA;
-    /// SLD_rimB [1/A^(2)]
-    //  [DEFAULT]=sld_rimB=4e-6 [1/A^(2)]
-    double sld_rimB;
-    /// SLD_rimC [1/A^(2)]
-    //  [DEFAULT]=sld_rimC=2e-6 [1/A^(2)]
-    double sld_rimC;
-    /// SLD_pcore [1/A^(2)]
-    //  [DEFAULT]=sld_pcore=1e-6 [1/A^(2)]
-    double sld_pcore;
-    /// sld_solv [1/A^(2)]
-    //  [DEFAULT]=sld_solv=6e-6 [1/A^(2)]
-    double sld_solv;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.06 [1/cm]
-	double background;
-    /// Orientation of the parallelepiped axis w/respect incoming beam [deg]
-    //  [DEFAULT]=parallel_theta=0.0 [deg]
-    double parallel_theta;
-    /// Orientation of the longitudinal axis of the parallelepiped in the plane of the detector [deg]
-    //  [DEFAULT]=parallel_phi=0.0 [deg]
-    double parallel_phi;
-    /// Orientation of the cross-sectional minor axis of the parallelepiped in the plane of the detector [deg]
-    //  [DEFAULT]=parallel_psi=0.0 [deg]
-    double parallel_psi;
-
-
-} CSParallelepipedParameters;
-
-
-
-/// 1D scattering function
-double csparallelepiped_analytical_1D(CSParallelepipedParameters *pars, double q);
-
-/// 2D scattering function
-double csparallelepiped_analytical_2D(CSParallelepipedParameters *pars, double q, double phi);
-double csparallelepiped_analytical_2DXY(CSParallelepipedParameters *pars, double qx, double qy);
-double csparallelepiped_analytical_2D_scaled(CSParallelepipedParameters *pars, double q, double q_x, double q_y);
-#endif
Index: sansmodels/src/sans/models/c_extensions/cylinder.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/cylinder.c	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/**
- * Scattering model for a cylinder
- * @author: Mathieu Doucet / UTK
- */
-
-#include "cylinder.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @return: function value
- */
-double cylinder_analytical_1D(CylinderParameters *pars, double q) {
-	double dp[6];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->radius;
-	dp[2] = pars->length;
-	dp[3] = pars->sldCyl;
-	dp[4] = pars->sldSolv;
-	dp[5] = pars->background;
-
-	// Call library function to evaluate model
-	return CylinderForm(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @return: function value
- */
-double cylinder_analytical_2DXY(CylinderParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return cylinder_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double cylinder_analytical_2D(CylinderParameters *pars, double q, double phi) {
-    return cylinder_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double cylinder_analytical_2D_scaled(CylinderParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z;
-	double q_z;
-	double alpha, vol, cos_val;
-	double answer;
-	//convert angle degree to radian
-	double pi = 4.0*atan(1.0);
-	double theta = pars->cyl_theta * pi/180.0;
-	double phi = pars->cyl_phi * pi/180.0;
-
-    // Cylinder orientation
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-
-    // q vector
-    q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-	alpha = acos( cos_val );
-
-	// Call the IGOR library function to get the kernel
-	answer = CylKernel(q, pars->radius, pars->length/2.0, alpha) / sin(alpha);
-
-	// Multiply by contrast^2
-	answer *= (pars->sldCyl - pars->sldSolv)*(pars->sldCyl - pars->sldSolv);
-
-	//normalize by cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-    vol = acos(-1.0) * pars->radius * pars->radius * pars->length;
-	answer *= vol;
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
-
Index: sansmodels/src/sans/models/c_extensions/cylinder.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/cylinder.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#if !defined(cylinder_h)
-#define cylinder_h
-/** Structure definition for cylinder parameters
- * [PYTHONCLASS] = CylinderModel
- * [DISP_PARAMS] = radius, length, cyl_theta, cyl_phi
-   [DESCRIPTION] = <text> f(q)= 2*(sldCyl - sldSolv)*V*sin(qLcos(alpha/2))
-				/[qLcos(alpha/2)]*J1(qRsin(alpha/2))/[qRsin(alpha)]
-
-		P(q,alpha)= scale/V*f(q)^(2)+bkg
-		V: Volume of the cylinder
-		R: Radius of the cylinder
-		L: Length of the cylinder
-		J1: The bessel function
-		alpha: angle betweenthe axis of the
-		cylinder and the q-vector for 1D
-		:the ouput is P(q)=scale/V*integral
-		from pi/2 to zero of...
-		f(q)^(2)*sin(alpha)*dalpha+ bkg
-		</text>
-	[FIXED]= <text>cyl_phi.width; cyl_theta.width; length.width;radius.width</text>
-	[ORIENTATION_PARAMS]= <text>cyl_phi; cyl_theta; cyl_phi.width; cyl_theta.width</text>
-
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Radius of the cylinder [A]
-    //  [DEFAULT]=radius=20.0 [A]
-    double radius;
-    /// Length of the cylinder [A]
-    //  [DEFAULT]=length=400.0 [A]
-    double length;
-    /// Contrast [1/A^(2)]
-    //  [DEFAULT]=sldCyl=4.0e-6 [1/A^(2)]
-    double sldCyl;
-    /// sldCyl [1/A^(2)]
-    //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-    double sldSolv;
-	/// Incoherent Background [1/cm] 0.00
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-    /// Orientation of the cylinder axis w/respect incoming beam [deg]
-    //  [DEFAULT]=cyl_theta=60.0 [deg]
-    double cyl_theta;
-    /// Orientation of the cylinder in the plane of the detector [deg]
-    //  [DEFAULT]=cyl_phi=60.0 [deg]
-    double cyl_phi;
-
-} CylinderParameters;
-
-
-
-/// 1D scattering function
-double cylinder_analytical_1D(CylinderParameters *pars, double q);
-
-/// 2D scattering function
-double cylinder_analytical_2D(CylinderParameters *pars, double q, double phi);
-double cylinder_analytical_2DXY(CylinderParameters *pars, double qx, double qy);
-double cylinder_analytical_2D_scaled(CylinderParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/disperser.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/disperser.c	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,470 +1,0 @@
-/** 
- * Disperser
- * 
- * Python class that takes a model and averages its output
- * for a distribution of its parameters.
- * 
- * The parameters to be varied are specified at instantiation time.
- * The distributions are Gaussian, with std deviations specified for
- * each parameter at instantiation time.
- * 
- * @author   M.Doucet / UTK 
- */
- 
-#include <Python.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-
-/// Error object for raised exceptions
-static PyObject * DisperserError = NULL;
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Dictionary of parameters for this class
-    PyObject * params;
-    /// Model object to disperse
-    PyObject * model;
-    /// Array of original values
-    double * centers;
-    /// Number of parameters to disperse
-    int n_pars;
-    /// Coordinate system flag
-    int cylindrical;
-} Disperser;
-
-// Function definitions
-double disperseParam(Disperser *self, int iPar, PyObject * pars);
-double Disperser_readDouble(PyObject *p);
-
-/**
- * Function to deallocate memory for the object
- */
-static void
-Disperser_dealloc(Disperser * self) {
-    free(self->centers);
-    self->ob_type->tp_free((PyObject*)self);
-}
-
-/**
- * Function to create a new Disperser object
- */
-static PyObject *
-Disperser_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    Disperser *self;
-    
-    self = (Disperser *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-/**
- * Initialization of the object (__init__)
- */
-static int
-Disperser_init(Disperser *self, PyObject *args, PyObject *kwds)
-{
-	PyObject * model;
-	PyObject * paramList;
-	PyObject * sigmaList;
-	
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        
-		// Get input
-		if ( !PyArg_ParseTuple(args,"OOO",&model, &paramList, &sigmaList) ) {
-		    PyErr_SetString(DisperserError, 
-		    	"Disperser: could not parse to initialize. Need Disperser(model, paramList, sigmaList)");
-			return -1;
-		}
-
-		// Check that the lists are of the right type
-		if( PyList_Check(paramList)!=1 || PyList_Check(sigmaList)!=1 ) {
-			PyErr_SetString(DisperserError,
-				"Disperser: bad input parameters; did not find lists.");
-			return -1;
-		}
-		
-		// Check that the list lengths are compatible
-		if( PyList_GET_SIZE(paramList) != PyList_GET_SIZE(sigmaList) ) {
-			PyErr_SetString(DisperserError,
-				"Disperser: supplied lists are not of the same length.");
-			return -1;
-		} 
-		
-		// Set the data members
-		self->model = model;
-		
-		// Number of parameters to disperse
-		// Let run() find out since values can change
-		self->n_pars = 0;
-
-		// Set default coordinate system as cartesian
-		self->cylindrical = 0;
-
-        // Initialize parameter dictionary
-        // Store the list of parameter names (strings)
-        PyDict_SetItemString(self->params,"paramList", paramList);
-        
-        // Store the list of std deviations (floats)
-        PyDict_SetItemString(self->params,"sigmaList", sigmaList);
-        
-        // Set the default number of points to average over
-        PyDict_SetItemString(self->params,"n_pts",Py_BuildValue("i",25));
-    }
-    return 0;
-}
-
-/**
- * List of member to make public
- * Only the parameters and the model are available to python users
- */
-static PyMemberDef Disperser_members[] = {
-    {"params", T_OBJECT, offsetof(Disperser, params), 0,
-     "Parameters"},
-    {"model", T_OBJECT, offsetof(Disperser, model), 0,
-     "Model to disperse"},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
- *	TODO: THIS SHOULD REALLY BE ELSEWHERE!
- *   @param p PyObject
- *   @return double
- */
-double Disperser_readDouble(PyObject *p) {
-	double value = 0.0;
-	
-    if (PyFloat_Check(p)==1) {
-        value = (double)(((PyFloatObject *)(p))->ob_fval);
-        //Py_DECREF(p);
-        return value;
-    } else if (PyInt_Check(p)==1) {
-        value = (double)(((PyIntObject *)(p))->ob_ival);
-    	//Py_DECREF(p);
-        return value;
-    } else if (PyLong_Check(p)==1) {
-        value = (double)PyLong_AsLong(p);
-    	//Py_DECREF(p);
-        return value;
-    } else {
-    	//Py_DECREF(p);    	
-        return 0.0;
-    }
-}
-
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [qx,qy]
- * @return: function value
- */
-static PyObject * runXY(Disperser *self, PyObject *args) {
-	PyObject* pars;
-	int n_pts;
-	int i;
-	double value;
-	PyObject * result;
-	PyObject * temp;
-	
-	// Get parameters
-	
-	// Check that the lists are of the right type
-	if( PyList_Check(PyDict_GetItemString(self->params, "paramList"))!=1 
-		|| PyList_Check(PyDict_GetItemString(self->params, "sigmaList"))!=1 ) {
-		PyErr_SetString(DisperserError,
-			"Disperser: bad input parameters; did not find lists.");
-		return NULL;
-	}
-
-	// Reader parameter dictionary
-    n_pts = PyInt_AsLong( PyDict_GetItemString(self->params, "n_pts") );
-    
-	// Check that the list lengths are compatible
-	if( PyList_GET_SIZE(PyDict_GetItemString(self->params, "paramList")) 
-		!= PyList_GET_SIZE(PyDict_GetItemString(self->params, "sigmaList")) ) {
-		PyErr_SetString(DisperserError,
-			"Disperser: supplied lists are not of the same length.");
-		return NULL;
-	} 
-
-    // Number of parameters to disperse
-    self->n_pars = PyList_GET_SIZE(PyDict_GetItemString(self->params, "paramList"));
-    
-    // Allocate memory for centers
-    free(self->centers);
-    self->centers = (double *)malloc(self->n_pars * sizeof(double));
-	if(self->centers==NULL) {
-	    PyErr_SetString(DisperserError, 
-	    	"Disperser.run could not allocate memory.");
-		return NULL;
-	}
-    
-    // Store initial values of those parameters    
-    for( i=0; i<self->n_pars; i++ ) {
-    	result = PyObject_CallMethod(self->model, "getParam", "(O)", 
-    		PyList_GetItem( PyDict_GetItemString(self->params, "paramList"), i ));
-    		
-    	if( result == NULL ) {
-		    PyErr_SetString(DisperserError, 
-		    	"Disperser.run could not get current parameter values.");
-    		return NULL;
-    	} else {
-    		self->centers[i] = Disperser_readDouble(result);
-    		Py_DECREF(result);
-    	}; 
-    }
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(DisperserError, 
-	    	"Disperser.run expects a q value.");
-		return NULL;
-	}    
-        
-    // Evaluate or calculate average
-    if( self->n_pars > 0 ) {
-		value = disperseParam(self, 0, pars);
-    } else {
-    	 if (self->cylindrical==1) {
-    	 	result = PyObject_CallMethod(self->model, "run", "(O)",pars);
-    	 } else {
-    	 	result = PyObject_CallMethod(self->model, "runXY", "(O)",pars);
-    	 }
-    	 
-    	 if( result == NULL ) {
-		    PyErr_SetString(DisperserError, 
-		    	"Disperser.run failed.");
-    		return NULL; 	 	
-    	 } else {
-    		Py_DECREF(result);
-    	 	return result;
-    	 }
-    }
-    
-    // Put back the original model parameter values
-    for( i=0; i<self->n_pars; i++ ) {
-    	// Maybe we need to decref the double here?
-    	temp = Py_BuildValue("d", self->centers[i]);
-    	result = PyObject_CallMethod(self->model, "setParam", "(OO)", 
-    		PyList_GetItem( PyDict_GetItemString(self->params, "paramList"), i ),
-    		temp );
-    	Py_DECREF(temp);
-    		
-    	if( result == NULL ) {
-		    PyErr_SetString(DisperserError, 
-		    	"Disperser.run could not set back original parameter values.");
-    		return NULL;
-    	} else {
-    		Py_DECREF(result);
-    	}; 
-    }
-    
-	return Py_BuildValue("d",value);    	
-
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(Disperser *self, PyObject *args) {
-	PyObject * output;
-	self->cylindrical = 1;
-	output = runXY(self, args);
-	self->cylindrical = 0;
-	return output;
-}
-
-
-
-
-/**
- * Gaussian weight
- * @param mean: mean value of the Gaussian
- * @param sigma: standard deviation of the Gaussian
- * @param x: value at which the Gaussian is evaluated
- * @return: value of the Gaussian
- */
-double gaussian_weight(double mean, double sigma, double x) {
-	double vary, expo_value;
-    vary = x-mean;
-    expo_value = -vary*vary/(2*sigma*sigma);
-    //return 1.0;
-    return exp(expo_value);
-}
-
-/**
- * @param iPar: ID of parameter to disperse
- * @param pars: input parameter to the evaluation function
- */
-double disperseParam(Disperser *self, int iPar, PyObject * pars) {
-	double sigma;
-	double min_value, max_value;
-	double step;
-	double prev_value;
-	double value_sum;
-	double gauss_sum;
-	double gauss_value;
-	double func_value;
-	double error_sys;
-	double value;
-	int i, n_pts;
-	PyObject *result;
-	PyObject *temp;
-	
-	step = 0.0;
-  n_pts = PyInt_AsLong( PyDict_GetItemString(self->params, "n_pts") );
-    
-	// If we exhausted the parameter array, simply evaluate
-    // the model
-    if( iPar < self->n_pars ) {
-            
-		// Average over Gaussian distribution (2 sigmas)
-        value_sum = 0.0;
-        gauss_sum = 0.0;
-            
-        // Get the standard deviation for this parameter
-        sigma = Disperser_readDouble(PyList_GetItem( PyDict_GetItemString(self->params, "sigmaList"), iPar ));
-            
-        // Average over 4 sigmas wide
-        min_value = self->centers[iPar] - 2*sigma;
-        max_value = self->centers[iPar] + 2*sigma;
-            
-        // Calculate step size
-        step = (max_value - min_value)/(n_pts-1);
-            
-        // If we are not changing the parameter, just return the 
-        // value of the function
-        if (step == 0.0) {
-            return disperseParam(self, iPar+1, pars);
-        }
-            
-        // Compute average
-        prev_value = 0.0;
-        error_sys  = 0.0;
-        for( i=0; i<n_pts; i++ ) {
-            // Set the parameter value           
-            value = min_value + (double)i*step;
-                
-            temp = Py_BuildValue("d", value);
-    		result = PyObject_CallMethod(self->model, "setParam", "(OO)",
-    			PyList_GetItem( PyDict_GetItemString(self->params, "paramList"), iPar ), 
-    				temp);
-    		Py_DECREF(temp);
-    			
-		    if( result == NULL ) {
-	  	 	 	printf("Could not set param %i\n", iPar);
-	    	 	// return a value that will create an NAN
-	    	 	return 0.0/(step-step);
-		    } else {
-		    	Py_DECREF(result);
-		    }
-                
-			gauss_value = gaussian_weight(self->centers[iPar], sigma, value);
-            func_value = disperseParam(self, iPar+1, pars);
-
-            value_sum += gauss_value * func_value;
-        	gauss_sum += gauss_value;	
-        }   
-        return value_sum/gauss_sum;
-        
-    } else {
-    	 if (self->cylindrical==1) {
-    	 	result = PyObject_CallMethod(self->model, "run", "(O)",pars);
-    	 } else {
-    	 	result = PyObject_CallMethod(self->model, "runXY", "(O)",pars);
-    	 }
-    	 if( result == NULL ) {
-    	 	printf("Model.run() could not return\n");
-    	 	// return a value that will create an NAN
-    	 	return 0.0/(step-step);
-    	 } else {
-    	 	value = Disperser_readDouble(result);    	 	
-    	 	Py_DECREF(result);
-    	 	return value;
-    	 }
-    }
-	
-}
-
-static PyMethodDef Disperser_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given input value"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given input value"},
-   {NULL}
-};
-
-static PyTypeObject DisperserType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "Disperser",             /*tp_name*/
-    sizeof(Disperser),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)Disperser_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "Disperser objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    Disperser_methods,             /* tp_methods */
-    Disperser_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)Disperser_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    Disperser_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL}
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addDisperser(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&DisperserType) < 0)
-        return;
-
-    Py_INCREF(&DisperserType);
-    PyModule_AddObject(module, "Disperser", (PyObject *)&DisperserType);
-    
-    d = PyModule_GetDict(module);
-    DisperserError = PyErr_NewException("Disperser.error", NULL, NULL);
-    PyDict_SetItemString(d, "DisperserError", DisperserError);
-}
-
Index: sansmodels/src/sans/models/c_extensions/ellipsoid.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/ellipsoid.c	(revision 74c9a3063aab59b8fd6dfdc3e053aa3db931b19c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/**
- * Scattering model for an ellipsoid
- * @author: Mathieu Doucet / UTK
- */
-
-#include "ellipsoid.h"
-#include "libCylinder.h"
-#include <math.h>
-#include <stdio.h>
-
-/**
- * Test kernel for validation
- *
- * @param q: q-value
- * @param r_small: small axis length
- * @param r_long: rotation axis length
- * @param angle: angle between rotation axis and q vector
- * @return: oriented kernel value
- */
-double kernel(double q, double r_small, double r_long, double angle) {
-	double length;
-	double sin_alpha;
-	double cos_alpha;
-	double sph_func;
-
-	sin_alpha = sin(angle);
-	cos_alpha = cos(angle);
-
-	// Modified length for phase
-	length = r_small*sqrt(sin_alpha*sin_alpha +
-			r_long*r_long/(r_small*r_small)*cos_alpha*cos_alpha);
-
-	// Spherical scattering ampliture, with modified length for ellipsoid
-	sph_func = 3.0*( sin(q*length) - q*length*cos(q*length) ) / (q*q*q*length*length*length);
-
-	return sph_func*sph_func;
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the ellipsoid
- * @param q: q-value
- * @return: function value
- */
-double ellipsoid_analytical_1D(EllipsoidParameters *pars, double q) {
-	double dp[6];
-
-	dp[0] = pars->scale;
-	dp[1] = pars->radius_a;
-	dp[2] = pars->radius_b;
-	dp[3] = pars->sldEll;
-	dp[4] = pars->sldSolv;
-	dp[5] = pars->background;
-
-	return EllipsoidForm(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the ellipsoid
- * @param q: q-value
- * @return: function value
- */
-double ellipsoid_analytical_2DXY(EllipsoidParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return ellipsoid_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double ellipsoid_analytical_2D(EllipsoidParameters *pars, double q, double phi) {
-    return ellipsoid_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the ellipsoid
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double ellipsoid_analytical_2D_scaled(EllipsoidParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z;
-	double q_z;
-	double alpha, vol, cos_val;
-	double answer;
-	//convert angle degree to radian
-	double pi = 4.0*atan(1.0);
-	double theta = pars->axis_theta * pi/180.0;
-	double phi = pars->axis_phi * pi/180.0;
-
-    // Ellipsoid orientation
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-
-    // q vector
-    q_z = 0.0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("ellipsoid_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-    // Angle between rotation axis and q vector
-	alpha = acos( cos_val );
-
-	// Call the IGOR library function to get the kernel
-	answer = EllipsoidKernel(q, pars->radius_b, pars->radius_a, cos_val);
-
-	// Multiply by contrast^2
-	answer *= (pars->sldEll - pars->sldSolv) * (pars->sldEll - pars->sldSolv);
-
-	//normalize by cylinder volume
-    vol = 4.0/3.0 * acos(-1.0) * pars->radius_b * pars->radius_b * pars->radius_a;
-	answer *= vol;
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
Index: sansmodels/src/sans/models/c_extensions/ellipsoid.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/ellipsoid.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,78 +1,0 @@
-#if !defined(ellipsoid_h)
-#define ellipsoid_h
-
-/**
- * Structure definition for ellipsoid parameters
- * The ellipsoid has axes radius_b, radius_b, radius_a.
- * Ref: Jan Skov Pedersen, Advances in Colloid and Interface Science, 70 (1997) 171-210
- */
- //[PYTHONCLASS] = EllipsoidModel
- //[DISP_PARAMS] = radius_a, radius_b, axis_theta, axis_phi
- //[DESCRIPTION] = <text>"P(q.alpha)= scale*f(q)^(2)+ bkg, where f(q)= 3*(sld_ell
- //		- sld_solvent)*V*[sin(q*r(Ra,Rb,alpha))
- //		-q*r*cos(qr(Ra,Rb,alpha))]
- //		/[qr(Ra,Rb,alpha)]^(3)"
- //
- //     r(Ra,Rb,alpha)= [Rb^(2)*(sin(alpha))^(2)
- //     + Ra^(2)*(cos(alpha))^(2)]^(1/2)
- //
- //		scatter_sld: SLD of the scatter
- //		solvent_sld: SLD of the solvent
- //     sldEll: SLD of ellipsoid
- //		sldSolv: SLD of solvent
- //		V: volune of the Eliipsoid
- //		Ra: radius along the rotation axis
- //		of the Ellipsoid
- //		Rb: radius perpendicular to the
- //		rotation axis of the ellipsoid
- //		</text>
- //[FIXED]= <text> axis_phi.width; axis_theta.width;radius_a.width;
- //radius_b.width; length.width; r_minor.width;
- //r_ratio.width</text>
- //[ORIENTATION_PARAMS]=  axis_phi.width; axis_theta.width;axis_phi; axis_theta
-
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-
-    ///	Rotation axis radius_a [A]
-    //  [DEFAULT]=radius_a=20.0 [A]
-    double radius_a;
-
-    /// Radius_b [A]
-    //  [DEFAULT]=radius_b=400 [A]
-    double radius_b;
-
-    ///	sldEll [1/A^(2)]
-    //  [DEFAULT]=sldEll=4.0e-6 [1/A^(2)]
-    double sldEll;
-
-    ///	sld of solvent [1/A^(2)]
-    //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-    double sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-
-    /// Orientation of the long axis of the ellipsoid w/respect incoming beam [deg]
-    //  [DEFAULT]=axis_theta=90.0 [deg]
-    double axis_theta;
-    /// Orientation of the long axis of the ellipsoid in the plane of the detector [deg]
-    //  [DEFAULT]=axis_phi=0.0 [deg]
-    double axis_phi;
-} EllipsoidParameters;
-
-
-
-/// 1D scattering function
-double ellipsoid_analytical_1D(EllipsoidParameters *pars, double q);
-
-/// 2D scattering function
-double ellipsoid_analytical_2D(EllipsoidParameters *pars, double q, double phi);
-double ellipsoid_analytical_2DXY(EllipsoidParameters *pars, double qx, double qy);
-double ellipsoid_analytical_2D_scaled(EllipsoidParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/elliptical_cylinder.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/elliptical_cylinder.c	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,171 +1,0 @@
-/**
- * Scattering model for a cylinder with elliptical cross-section
- */
-
-#include "elliptical_cylinder.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @return: function value
- */
-double elliptical_cylinder_analytical_1D(EllipticalCylinderParameters *pars, double q) {
-	double dp[7];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->r_minor;
-	dp[2] = pars->r_ratio;
-	dp[3] = pars->length;
-	dp[4] = pars->sldCyl;
-	dp[5] = pars->sldSolv;
-	dp[6] = pars->background;
-
-	// Call library function to evaluate model
-	return EllipCyl20(dp, q);
-}
-
-double elliptical_cylinder_kernel(EllipticalCylinderParameters *pars, double q, double alpha, double nu) {
-	double qr;
-	double qL;
-	double Be,Si;
-	double r_major;
-	double kernel;
-
-	r_major = pars->r_ratio * pars->r_minor;
-
-	qr = q*sin(alpha)*sqrt( r_major*r_major*sin(nu)*sin(nu) + pars->r_minor*pars->r_minor*cos(nu)*cos(nu) );
-	qL = q*pars->length*cos(alpha)/2.0;
-
-	if (qr==0){
-		Be = 0.5;
-	}else{
-		Be = NR_BessJ1(qr)/qr;
-	}
-	if (qL==0){
-		Si = 1.0;
-	}else{
-		Si = sin(qL)/qL;
-	}
-
-
-	kernel = 2.0*Be * Si;
-	return kernel*kernel;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @return: function value
- */
-double elliptical_cylinder_analytical_2DXY(EllipticalCylinderParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return elliptical_cylinder_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param theta: angle theta = angle wrt z axis
- * @param phi: angle phi = angle around y axis (starting from the x+-direction as phi = 0)
- * @return: function value
- */
-double elliptical_cylinder_analytical_2D(EllipticalCylinderParameters *pars, double q, double phi) {
-    return elliptical_cylinder_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double elliptical_cylinder_analytical_2D_scaled(EllipticalCylinderParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z;
-	double ell_x, ell_y;
-	double q_z;
-	double alpha, vol, cos_val;
-	double nu, cos_nu;
-	double answer;
-	//convert angle degree to radian
-	double pi = 4.0*atan(1.0);
-	double theta = pars->cyl_theta * pi/180.0;
-	double phi = pars->cyl_phi * pi/180.0;
-	double psi = pars->cyl_psi * pi/180.0;
-
-    //Cylinder orientation
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-
-    // q vector
-    q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-	alpha = acos( cos_val );
-
-    //ellipse orientation:
-	// the elliptical corss section was transformed and projected
-	// into the detector plane already through sin(alpha)and furthermore psi remains as same
-	// on the detector plane.
-	// So, all we need is to calculate the angle (nu) of the minor axis of the ellipse wrt
-	// the wave vector q.
-
-	//x- y- component on the detector plane.
-    ell_x =  cos(psi);
-    ell_y =  sin(psi);
-
-    // calculate the axis of the ellipse wrt q-coord.
-    cos_nu = ell_x*q_x + ell_y*q_y;
-    nu = acos(cos_nu);
-
-    // The following test should always pass
-    if (fabs(cos_nu)>1.0) {
-    	printf("cyl_ana_2D: Unexpected error: cos(nu)>1\n");
-     	return 0;
-    }
-
-	answer = elliptical_cylinder_kernel(pars, q, alpha,nu);
-
-	// Multiply by contrast^2
-	answer *= (pars->sldCyl - pars->sldSolv) * (pars->sldCyl - pars->sldSolv);
-
-	//normalize by cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-    vol = acos(-1.0) * pars->r_minor * pars->r_minor * pars->r_ratio * pars->length;
-	answer *= vol;
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
-
Index: sansmodels/src/sans/models/c_extensions/elliptical_cylinder.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/elliptical_cylinder.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#if !defined(ell_cylinder_h)
-#define ell_cylinder_h
-
-/** Structure definition for cylinder parameters
- * [PYTHONCLASS] = EllipticalCylinderModel
- * [DISP_PARAMS] = r_minor, r_ratio, length, cyl_theta, cyl_phi, cyl_psi
- * [DESCRIPTION] = <text> Model parameters: r_minor = the radius of minor axis of the cross section
-r_ratio = the ratio of (r_major /r_minor >= 1)
-length = the length of the cylinder
-sldCyl = SLD of the cylinder
-sldSolv = SLD of solvent -
-background = incoherent background
-  *</text>
- * [FIXED]= <text> cyl_phi.width;
- * cyl_theta.width; cyl_psi.width; length.width; r_minor.width; r_ratio.width
- *</text>
- * [ORIENTATION_PARAMS]= cyl_phi; cyl_theta; cyl_psi;  cyl_phi.width; cyl_theta.width; cyl_psi.width
- * */
-
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Minor radius [A]
-    //  [DEFAULT]=r_minor=20.0 [A]
-    double r_minor;
-    /// Ratio of major/minor radii
-    //  [DEFAULT]=r_ratio=1.5
-    double r_ratio;
-    /// Length of the cylinder [A]
-    //  [DEFAULT]=length=400.0 [A]
-    double length;
-    /// SLD of cylinder [1/A^(2)]
-    //  [DEFAULT]=sldCyl=4.0e-6 [1/A^(2)]
-    double sldCyl;
-    /// SLD of solvent [1/A^(2)]
-    //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-    double sldSolv;
-	/// Incoherent Background [1/cm] 0.000
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-    /// Orientation of the cylinder axis w/respect incoming beam [deg]
-    //  [DEFAULT]=cyl_theta=90.0 [deg]
-    double cyl_theta;
-    /// Orientation of the cylinder in the plane of the detector [deg]
-    //  [DEFAULT]=cyl_phi=0.0 [deg]
-    double cyl_phi;
-    /// Orientation of major radius of the cross-section w/respect vector q [deg]
-    //  [DEFAULT]=cyl_psi=0.0 [deg]
-    double cyl_psi;
-} EllipticalCylinderParameters;
-
-
-
-/// 1D scattering function
-double elliptical_cylinder_analytical_1D(EllipticalCylinderParameters *pars, double q);
-
-/// 2D scattering function
-double elliptical_cylinder_analytical_2D(EllipticalCylinderParameters *pars, double q, double phi);
-double elliptical_cylinder_analytical_2DXY(EllipticalCylinderParameters *pars, double qx, double qy);
-double elliptical_cylinder_analytical_2D_scaled(EllipticalCylinderParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/fcc.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/fcc.c	(revision 839f7e28c011deb396c95d09a5783cbe57a2083b)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Scattering model for a SC_ParaCrystal
- */
-#include "fcc.h"
-#include "libSphere.h"
-#include <math.h>
-#include <stdio.h>
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the FCC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-double fcc_analytical_1D(FCParameters *pars, double q) {
-	double dp[7];
-	double result;
-
-	dp[0] = pars->scale;
-	dp[1] = pars->dnn;
-	dp[2] = pars->d_factor;
-	dp[3] = pars->radius;
-	dp[4] = pars->sldSph;
-	dp[5] = pars->sldSolv;
-	dp[6] = pars->background;
-
-	result = FCC_ParaCrystal(dp, q);
-	// This FIXES a singualrity the kernel in libigor.
-	if ( result == INFINITY || result == NAN){
-		result = pars->background;
-	}
-	return result;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the FCC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-double fc_analytical_2DXY(FCParameters *pars, double qx, double qy){
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-	return fc_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-double fc_analytical_2D(FCParameters *pars, double q, double phi) {
-	return fc_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the FCCCrystalModel
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double fc_analytical_2D_scaled(FCParameters *pars, double q, double q_x, double q_y) {
-	double b3_x, b3_y, b3_z, b1_x, b1_y;
-	double q_z;
-	double alpha, cos_val_b3, cos_val_b2, cos_val_b1;
-	double a1_dot_q, a2_dot_q,a3_dot_q;
-	double answer;
-	double Pi = 4.0*atan(1.0);
-	double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2;
-
-	double dp[5];
-  //convert angle degree to radian
-  double theta = pars->theta * Pi/180.0;
-  double phi = pars->phi * Pi/180.0;
-  double psi = pars->psi * Pi/180.0;
-	dp[0] = 1.0;
-	dp[1] = pars->radius;
-	dp[2] = pars->sldSph;
-	dp[3] = pars->sldSolv;
-	dp[4] = 0.0;
-
-	aa = pars->dnn;
-	Da = pars->d_factor*aa;
-	qDa_2 = pow(q*Da,2.0);
-	//contrast = pars->sldSph - pars->sldSolv;
-
-	latticeScale = 4.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa*sqrt(2.0),3.0);
-	// q vector
-	q_z = 0.0; // for SANS; assuming qz is negligible
-	/// Angles here are respect to detector coordinate
-	///  instead of against q coordinate in PRB 36(46), 3(6), 1754(3854)
-    // b3 axis orientation
-    b3_x = sin(theta) * cos(phi);//negative sign here???
-    b3_y = sin(theta) * sin(phi);
-    b3_z = cos(theta);
-    cos_val_b3 =  b3_x*q_x + b3_y*q_y + b3_z*q_z;
-    alpha = acos(cos_val_b3);
-    // b1 axis orientation
-    b1_x = sin(psi);
-    b1_y = cos(psi);
-	cos_val_b1 = (b1_x*q_x + b1_y*q_y);
-    // b2 axis orientation
-	cos_val_b2 = sin(acos(cos_val_b1));
-	// alpha correction
-	cos_val_b2 *= sin(alpha);
-	cos_val_b1 *= sin(alpha);
-
-    // Compute the angle btw vector q and the a3 axis
-    a3_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b1);
-
-    // a1 axis
-    a1_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b3);
-
-    // a2 axis
-    a2_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b1);
-
-    // The following test should always pass
-    if (fabs(cos_val_b3)>1.0) {
-    	printf("fcc_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-    // Get Fkq and Fkq_2
-    Fkq = exp(-0.5*pow(Da/aa,2.0)*(a1_dot_q*a1_dot_q+a2_dot_q*a2_dot_q+a3_dot_q*a3_dot_q));
-    Fkq_2 = Fkq*Fkq;
-    // Call Zq=Z1*Z2*Z3
-    Zq = (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a1_dot_q)+Fkq_2);
-    Zq = Zq * (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a2_dot_q)+Fkq_2);
-    Zq = Zq * (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a3_dot_q)+Fkq_2);
-
-	// Use SphereForm directly from libigor
-	answer = SphereForm(dp,q)*Zq;
-
-	//consider scales
-	answer *= latticeScale * pars->scale;
-
-	// This FIXES a singualrity the kernel in libigor.
-	if ( answer == INFINITY || answer == NAN){
-		answer = 0.0;
-	}
-
-	// add background
-	answer += pars->background;
-
-	return answer;
-}
Index: sansmodels/src/sans/models/c_extensions/fcc.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/fcc.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,81 +1,0 @@
-#if !defined(fcc_h)
-#define fcc_h
-
-/**
- * Structure definition for FCC_ParaCrystal parameters
- */
- //[PYTHONCLASS] = FCCrystalModel
- //[DISP_PARAMS] = radius,phi, psi, theta
- //[DESCRIPTION] =<text>P(q)=(scale/Vp)*V_lattice*P(q)*Z(q)+bkg where scale is the volume
- //					 fraction of sphere,
- //				Vp = volume of the primary particle,
- //				V_lattice = volume correction for
- //					for the crystal structure,
- //				P(q)= form factor of the sphere (normalized),
- //				Z(q)= paracrystalline structure factor
- //					for a face centered cubic structure.
- //				[Face Centered Cubic ParaCrystal Model]
- //				Parameters;
- //				scale: volume fraction of spheres
- //				bkg:background, R: radius of sphere
- //				dnn: Nearest neighbor distance
- //				d_factor: Paracrystal distortion factor
- //				radius: radius of the spheres
- //				sldSph: SLD of the sphere
- //				sldSolv: SLD of the solvent
- //
- //		</text>
- //[FIXED]=  radius.width;phi.width;psi.width; theta.width
- //[ORIENTATION_PARAMS]= <text> phi;psi; theta; phi.width;psi.width; theta.width</text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	Nearest neighbor distance [A]
-    //  [DEFAULT]=dnn=220.0 [A]
-    double dnn;
-
-    ///	Paracrystal distortion factor g
-    //  [DEFAULT]=d_factor=0.06
-    double d_factor;
-
-    ///	Radius of sphere [A]
-    //  [DEFAULT]=radius=40.0 [A]
-    double radius;
-
-    ///	sldSph [1/A^(2)]
-    //  [DEFAULT]=sldSph= 3.0e-6 [1/A^(2)]
-    double sldSph;
-
-    ///	sldSolv [1/A^(2)]
-    //  [DEFAULT]=sldSolv= 6.3e-6 [1/A^(2)]
-    double sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-    /// Orientation of the a1 axis w/respect incoming beam [deg]
-    //  [DEFAULT]=theta=0.0 [deg]
-    double theta;
-    /// Orientation of the a2 in the plane of the detector [deg]
-    //  [DEFAULT]=phi=0.0 [deg]
-    double phi;
-    /// Orientation of the a3 in the plane of the detector [deg]
-    //  [DEFAULT]=psi=0.0 [deg]
-    double psi;
-
-} FCParameters;
-
-
-
-/// 1D scattering function
-double fc_analytical_1D(FCParameters *pars, double q);
-
-/// 2D scattering function
-double fc_analytical_2D(FCParameters *pars, double q, double phi);
-double fc_analytical_2DXY(FCParameters *pars, double qx, double qy);
-double fc_analytical_2D_scaled(FCParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/flexcyl_ellipX.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/flexcyl_ellipX.c	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/**
- * Scattering model for a flexible cylinder with an elliptical cross section
- */
-#include "flexcyl_ellipX.h"
-#include <math.h>
-#include "libCylinder.h"
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the flexible cylinder with an elliptical X
- * @param q: q-value
- * @return: function value
- */
-double flexcyl_ellipX_analytical_1D(FlexCylEXParameters *pars, double q) {
-	double dp[8];
-
-	dp[0] = pars->scale;
-	dp[1] = pars->length;
-	dp[2] = pars->kuhn_length;
-	dp[3] = pars->radius;
-	dp[4] = pars->axis_ratio;
-	dp[5] = pars->sldCyl;
-	dp[6] = pars->sldSolv;
-	dp[7] = pars->background;
-
-	return FlexCyl_Ellip(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the flexible cylinder with an elliptical X
- * @param q: q-value
- * @return: function value
- */
-double flexcyl_ellipX_analytical_2D(FlexCylEXParameters *pars, double q, double phi) {
-	return flexcyl_ellipX_analytical_1D(pars,q);
-}
-
-double flexcyl_ellipX_analytical_2DXY(FlexCylEXParameters *pars, double qx, double qy){
-	return flexcyl_ellipX_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
Index: sansmodels/src/sans/models/c_extensions/flexcyl_ellipX.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/flexcyl_ellipX.h	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#if !defined(flexcyl_ellipX_h)
-#define flexcyl_ellipX_h
-
-/** Structure definition for Flexible cylinder w/ EllipX parameters
- * [PYTHONCLASS] = FlexCylEllipXModel
- * [DISP_PARAMS] = length, kuhn_length, radius, axis_ratio
-   [DESCRIPTION] = <text> Note : scale and contrast=sldCyl-sldSolv are both multiplicative factors in the
-		model and are perfectly correlated. One or
-		both of these parameters must be held fixed
-		during model fitting.
-		</text>
-	[FIXED]= <text>length.width; kuhn_length.width; radius.width; axis_ratio.width</text>
-	[ORIENTATION_PARAMS]= <text></text>
-
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Length of the flexible cylinder [A]
-    //  [DEFAULT]=length=1000 [A]
-    double length;
-	/// Kuhn length of the flexible cylinder [A]
-    //  [DEFAULT]=kuhn_length=100 [A]
-    double kuhn_length;
-	/// Radius of the flexible cylinder [A]
-    //  [DEFAULT]=radius=20.0 [A]
-    double radius;
-    /// axis_ratio (major_radius/radius
-    //  [DEFAULT]=axis_ratio=1.5
-    double axis_ratio;
-    /// SLD of cylinder [1/A^(2)]
-    //  [DEFAULT]=sldCyl=1.0e-6 [1/A^(2)]
-    double sldCyl;
-    /// SLD of solvent [1/A^(2)]
-    //  [DEFAULT]=sldSolv=6.3e-6 [1/A^(2)]
-    double sldSolv;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.0001 [1/cm]
-	double background;
-} FlexCylEXParameters;
-
-
-
-/// 1D scattering function
-double flexcyl_ellipX_analytical_1D(FlexCylEXParameters *pars, double q);
-
-/// 2D scattering function
-double flexcyl_ellipX_analytical_2D(FlexCylEXParameters *pars, double q, double phi);
-double flexcyl_ellipX_analytical_2DXY(FlexCylEXParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/flexible_cylinder.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/flexible_cylinder.c	(revision f10063e8f3c53d2be93abaea9c0d3d4f3061d444)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/**
- * Scattering model for a parallelepiped
- * TODO: Add 2D analysis
- */
-
-#include "flexible_cylinder.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the flexible cylinder
- * @param q: q-value
- * @return: function value
- */
-double flexible_cylinder_analytical_1D(FlexibleCylinderParameters *pars, double q) {
-	double dp[7];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->length;
-	dp[2] = pars->kuhn_length;
-	dp[3] = pars->radius;
-	dp[4] = pars->sldCyl;
-	dp[5] = pars->sldSolv;
-	dp[6] = pars->background;
-
-	// Call library function to evaluate model
-	return FlexExclVolCyl(dp, q);
-}
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the flexible cylinder
- * @param q: q-value
- * @return: function value
- */
-double flexible_cylinder_analytical_2DXY(FlexibleCylinderParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return flexible_cylinder_analytical_1D(pars, q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the flexible cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double flexible_cylinder_analytical_2D(FlexibleCylinderParameters *pars, double q, double phi) {
-    return flexible_cylinder_analytical_1D(pars, q);
-}
-
-
Index: sansmodels/src/sans/models/c_extensions/flexible_cylinder.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/flexible_cylinder.h	(revision 19107f041632b1483d05fa84e824c99c8eea7038)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
-	TODO: Add 2D model
-*/
-
-#if !defined(flexible_cylinder_h)
-#define flexible_cylinder_h
-/** Structure definition for Flexible cylinder parameters
- * [PYTHONCLASS] = FlexibleCylinderModel
- * [DISP_PARAMS] = length, kuhn_length, radius
-   [DESCRIPTION] = <text> Note : scale and contrast=sldCyl-sldSolv are both multiplicative factors in the
-		model and are perfectly correlated. One or
-		both of these parameters must be held fixed
-		during model fitting.
-		</text>
-	[FIXED]= <text>length.width; kuhn_length.width; radius.width</text>
-	[ORIENTATION_PARAMS]= <text></text>
-
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Length of the flexible cylinder [A]
-    //  [DEFAULT]=length=1000 [A]
-    double length;
-	/// Kuhn length of the flexible cylinder [A]
-    //  [DEFAULT]=kuhn_length=100 [A]
-    double kuhn_length;
-	/// Radius of the flexible cylinder [A]
-    //  [DEFAULT]=radius=20.0 [A]
-    double radius;
-    /// SLD of cylinder [1/A^(2)]
-    //  [DEFAULT]=sldCyl=1.0e-6 [1/A^(2)]
-    double sldCyl;
-    /// SLD of solvent [1/A^(2)]
-    //  [DEFAULT]=sldSolv=6.3e-6 [1/A^(2)]
-    double sldSolv;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.0001 [1/cm]
-	double background;
-
-
-} FlexibleCylinderParameters;
-
-
-
-/// 1D scattering function
-double flexible_cylinder_analytical_1D(FlexibleCylinderParameters *pars, double q);
-
-/// 2D scattering function
-double flexible_cylinder_analytical_2D(FlexibleCylinderParameters *pars, double q, double phi);
-double flexible_cylinder_analytical_2DXY(FlexibleCylinderParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/fractal.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/fractal.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#if !defined(fractal_h)
-#define fractal_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = FractalModel
- //[DISP_PARAMS] = radius
- //[DESCRIPTION] =<text> The scattering intensity  I(x) = P(|x|)*S(|x|) + background, where
- //       p(x)= scale * V * delta^(2)* F(x*radius)^(2)
- //       F(x) = 3*[sin(x)-x cos(x)]/x**3
- //       where delta = sldBlock -sldSolv.
- //       scale        =  scale factor * Volume fraction
- //       radius       =  Block radius
- //       fractal_dim  =  Fractal dimension
- //       cor_length  =  Correlation Length
- //       sldBlock    =  SDL block
- //       sldSolv  =  SDL solvent
- //       background   =  background
- //		</text>
- //[FIXED]= <text> radius.width </text>
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 0.05
-    double scale;
-
-    ///	Radius of gyration [A]
-    //  [DEFAULT]=radius=5.0 [A]
-    double radius;
-
-    ///	Fractal dimension
-    //  [DEFAULT]=fractal_dim=2.0
-    double fractal_dim;
-
-    ///	Correlation Length [A]
-    //  [DEFAULT]=cor_length=100.0 [A]
-    double cor_length;
-
-    ///	SDL block [1/A^(2)]
-    //  [DEFAULT]=sldBlock=2.0e-6 [1/A^(2)]
-    double sldBlock;
-
-    ///	SDL solvent [1/A^(2)]
-    //  [DEFAULT]=sldSolv= 6.35e-6 [1/A^(2)]
-    double sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-} FractalParameters;
-
-
-
-/// 1D scattering function
-//double fractal_analytical_1D(FractalParameters *pars, double q);
-
-/// 2D scattering function
-//double fractal_analytical_2D(FractalParameters *pars, double q, double phi);
-//double fractal_analytical_2DXY(FractalParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/fuzzysphere.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/fuzzysphere.c	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/**
- * Scattering model for a fuzzy sphere
- */
-
-#include <math.h>
-#include "libSphere.h"
-#include "fuzzysphere.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-// scattering from a uniform sphere w/ fuzzy surface
-// Modified from FuzzySpheres in libigor/libSphere.c without polydispersion: JHC
-double fuzzysphere_kernel(double dp[], double q){
-	double pi,x,xr;
-	double radius,sldSph,sldSolv,scale,bkg,delrho,fuzziness,f2,bes,vol,f;		//my local names
-
-	pi = 4.0*atan(1.0);
-	x= q;
-	scale = dp[0];
-	radius = dp[1];
-	fuzziness = dp[2];
-	sldSph = dp[3];
-	sldSolv = dp[4];
-	bkg = dp[5];
-	delrho=sldSph-sldSolv;
-
-	xr = x*radius;
-	//handle xr==0 separately
-	if(xr == 0.0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(xr)-xr*cos(xr))/(xr*xr*xr);
-	}
-	vol = 4.0*pi/3.0*radius*radius*radius;
-	f = vol*bes*delrho;		// [=] A
-	f *= exp(-0.5*fuzziness*fuzziness*x*x);
-	// normalize to single particle volume, convert to 1/cm
-	f2 = f * f / vol * 1.0e8;		// [=] 1/cm
-
-	f2 *= scale;
-	f2 += bkg;
-
-    return(f2);	//scale, and add in the background
-}
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the fuzzysphere
- * @param q: q-value
- * @return: function value
- */
-double fuzzysphere_analytical_1D(FuzzySphereParameters *pars, double q) {
-	double dp[6];
-
-	dp[0] = pars->scale;
-	dp[1] = pars->radius;
-	dp[2] = pars->fuzziness;
-	dp[3] = pars->sldSph;
-	dp[4] = pars->sldSolv;
-	dp[5] = pars->background;
-
-	return fuzzysphere_kernel(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the fuzzysphere
- * @param q: q-value
- * @return: function value
- */
-double fuzzysphere_analytical_2D(FuzzySphereParameters *pars, double q, double phi) {
-	return fuzzysphere_analytical_1D(pars,q);
-}
-
-double sphere_analytical_2DXY(FuzzySphereParameters *pars, double qx, double qy){
-	return fuzzysphere_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
Index: sansmodels/src/sans/models/c_extensions/fuzzysphere.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/fuzzysphere.h	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#if !defined(fuzzysphere_h)
-#define fuzzysphere_h
-
-/**
- * Structure definition for FuzzySphere parameters
- */
- //[PYTHONCLASS] = FuzzySphereModel
- //[DISP_PARAMS] = radius, fuzziness
- //[DESCRIPTION] =<text>
- //				scale: scale factor times volume fraction,
- //					or just volume fraction for absolute scale data
- //				radius: radius of the solid sphere
- //				fuzziness = the STD of the height of fuzzy interfacial
- //				 thickness (ie., so-called interfacial roughness)
- //				sldSph: the SLD of the sphere
- //				sldSolv: the SLD of the solvent
- //				background: incoherent background
- //			Note: By definition, this function works only when fuzziness << radius.
- //		</text>
- //[FIXED]=  radius.width; fuzziness.width
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 0.01
-    double scale;
-
-    ///	Radius of sphere [A]
-    //  [DEFAULT]=radius=60.0 [A]
-    double radius;
-
-    ///	surface roughness [A]
-    //  [DEFAULT]=fuzziness= 10.0 [A]
-    double fuzziness;
-
-    ///	sldSph [1/A^(2)]
-    //  [DEFAULT]=sldSph= 1.0e-6 [1/A^(2)]
-    double sldSph;
-
-    ///	sldSolv [1/A^(2)]
-    //  [DEFAULT]=sldSolv= 3.0e-6 [1/A^(2)]
-    double sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.001 [1/cm]
-	double background;
-} FuzzySphereParameters;
-
-/// kernel
-double fuzzysphere_kernel(double dp[], double q);
-
-/// 1D scattering function
-double fuzzysphere_analytical_1D(FuzzySphereParameters *pars, double q);
-
-/// 2D scattering function
-double fuzzysphere_analytical_2D(FuzzySphereParameters *pars, double q, double phi);
-double fuzzysphere_analytical_2DXY(FuzzySphereParameters *pars, double qx, double qy);
-double fuzzysphere_analytical_2D_scaled(FuzzySphereParameters *pars, double q, double q_x, double q_y);
-#endif
Index: sansmodels/src/sans/models/c_extensions/gaussian.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/gaussian.c	(revision 59b9b67578f11772d51a4d61028e0dfc7097df5a)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/**
- * Gaussian function
- */
-
-#include "gaussian.h"
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D Gaussian function.
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x)=scale * 1/(sigma^2*2pi)e^(-(x-mu)^2/2sigma^2)
- * 
- * @param pars: parameters of the gaussian
- * @param x: x-value
- * @return: function value
- */
-double gaussian_analytical_1D(GaussianParameters *pars, double x) {
-	double sigma2 = pow(pars->sigma, 2);	
-	return pars->scale / sigma2 * exp( -pow((x-pars->center), 2) / (2*sigma2));
-}
-
-/**
- * Function to evaluate 2D Gaussian  function
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x,y) = Gaussian(x) * Gaussian(y)
- * 
- * where both Gaussians share the same parameters.
- * 
- * @param pars: parameters of the gaussian
- * @param x: x-value
- * @param y: y-value
- * @return: function value
- */
-double gaussian_analytical_2DXY(GaussianParameters *pars, double x, double y) {
-    return gaussian_analytical_1D(pars, x) * gaussian_analytical_1D(pars, y);
-} 
-
-/**
- * Function to evaluate 2D Gaussian  function
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x,y) = Gaussian(x) * Gaussian(y)
- * 
- * where both Gaussians share the same parameters.
- * 
- * @param pars: parameters of the gaussian
- * @param length: length of the (x,y) vector
- * @param phi: angle relative to x
- * @return: function value
- */
-double gaussian_analytical_2D(GaussianParameters *pars, double length, double phi) {
-    return gaussian_analytical_2DXY(pars, length*cos(phi), length*sin(phi));
-} 
Index: sansmodels/src/sans/models/c_extensions/gaussian.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/gaussian.h	(revision 59b9b67578f11772d51a4d61028e0dfc7097df5a)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#if !defined(gaussian_h)
-#define gaussian_h
-
-/** Structure definition for Gaussian parameters.
- * The Gaussian is normalized to the 'scale' parameter.
- *  
- * f(x)=scale * 1/(sigma^2*2pi)e^(-(x-mu)^2/2sigma^2)
- * 
- * [PYTHONCLASS] = Gaussian
- * [DESCRIPTION] = <text>f(x)=scale * 1/(sigma^2*2pi)e^(-(x-mu)^2/2sigma^2)</text>
- */
-typedef struct {
-    /// Scale factor 
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Standard deviation
-    //  [DEFAULT]=sigma=1 
-    double sigma;
-    /// Center of the Gaussian distribution
-    //  [DEFAULT]=center=0.0 
-    double center;
-} GaussianParameters;
-
-/// 1D scattering function
-double gaussian_analytical_1D(GaussianParameters *pars, double x);
-
-/// 2D scattering function
-double gaussian_analytical_2D(GaussianParameters *pars, double x, double phi);
-double gaussian_analytical_2DXY(GaussianParameters *pars, double x, double y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/hollow_cylinder.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/hollow_cylinder.c	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/**
- * Scattering model for a hollow cylinder
- * @author:gervaise alina / UTK
- */
-
-#include "hollow_cylinder.h"
-#include "libCylinder.h"
-#include <math.h>
-#include <stdio.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the hollow cylinder
- * @param q: q-value
- * @return: function value
- */
-double hollow_cylinder_analytical_1D(HollowCylinderParameters *pars, double q) {
-	double dp[7];
-
-	dp[0] = pars->scale;
-	dp[1] = pars->core_radius;
-	dp[2] = pars->radius;
-	dp[3] = pars->length;
-	dp[4] = pars->sldCyl;
-	dp[5] = pars->sldSolv;
-	dp[6] = pars->background;
-
-	return HollowCylinder(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the Hollow cylinder
- * @param q: q-value
- * @return: function value
- */
-double hollow_cylinder_analytical_2DXY(HollowCylinderParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return hollow_cylinder_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the hollow cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double hollow_cylinder_analytical_2D(HollowCylinderParameters *pars, double q, double phi) {
-    return hollow_cylinder_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the hollow cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double hollow_cylinder_analytical_2D_scaled(HollowCylinderParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z;
-	double q_z;
-	double  alpha,vol, cos_val;
-	double answer;
-	//convert angle degree to radian
-	double pi = 4.0*atan(1.0);
-	double theta = pars->axis_theta * pi/180.0;
-	double phi = pars->axis_phi * pi/180.0;
-
-    // Cylinder orientation
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-
-    // q vector
-    q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("core_shell_cylinder_analytical_2D: Unexpected error: cos(alpha)=%g\n", cos_val);
-     	return 0;
-    }
-
-	alpha = acos( cos_val );
-
-	// Call the IGOR library function to get the kernel
-	answer = HolCylKernel(q, pars->core_radius, pars->radius, pars->length, cos_val);
-
-	// Multiply by contrast^2
-	answer *= (pars->sldCyl - pars->sldSolv)*(pars->sldCyl - pars->sldSolv);
-
-	//normalize by cylinder volume
-	vol=pi*((pars->radius*pars->radius)-(pars->core_radius *pars->core_radius))
-			*(pars->length);
-	answer *= vol;
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
Index: sansmodels/src/sans/models/c_extensions/hollow_cylinder.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/hollow_cylinder.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,70 +1,0 @@
-#if !defined(hollow_cylinder_h)
-#define hollow_cylinder_h
-
-/**
- * Structure definition for hollow cylinder parameters
- */
- //[PYTHONCLASS] = HollowCylinderModel
- //[DISP_PARAMS] = core_radius, radius, length, axis_theta, axis_phi
- //[DESCRIPTION] = <text> P(q) = scale*<f*f>/Vol + bkg, where f is the scattering amplitude.
- //					core_radius = the radius of core
- //				radius = the radius of shell
- // 			length = the total length of the cylinder
- //				sldCyl = SLD of the shell
- //				sldSolv = SLD of the solvent
- //				background = incoherent background
- //	</text>
- //[FIXED]= <text> axis_phi.width; axis_theta.width; length.width;core_radius.width; radius</text>
- //[ORIENTATION_PARAMS]= axis_phi; axis_theta;axis_phi.width; axis_theta.width
-
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-
-    /// Core radius [A]
-    //  [DEFAULT]=core_radius=20.0 [A]
-    double core_radius;
-
-    /// Shell radius [A]
-    //  [DEFAULT]=radius=30.0 [A]
-    double radius;
-
-    /// Hollow cylinder length [A]
-    //  [DEFAULT]=length=400.0 [A]
-    double length;
-
-    /// SLD_cylinder  [1/A^(2)]
-    //  [DEFAULT]=sldCyl=6.3e-6 [1/A^(2)]
-    double sldCyl;
-
-    /// SLD_solvent  [1/A^(2)]
-    //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-    double sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.01 [1/cm]
-	double background;
-
-    /// Orientation of the long axis of the hollow cylinder w/respect incoming beam [deg]
-    //  [DEFAULT]=axis_theta=90.0 [deg]
-    double axis_theta;
-
-    /// Orientation of the long axis of the hollow cylinder in the plane of the detector [deg]
-    //  [DEFAULT]=axis_phi=0.0 [deg]
-    double axis_phi;
-
-} HollowCylinderParameters;
-
-
-
-/// 1D scattering function
-double hollow_cylinder_analytical_1D(HollowCylinderParameters *pars, double q);
-
-/// 2D scattering function
-double hollow_cylinder_analytical_2D(HollowCylinderParameters *pars, double q, double phi);
-double hollow_cylinder_analytical_2DXY(HollowCylinderParameters *pars, double qx, double qy);
-double hollow_cylinder_analytical_2D_scaled(HollowCylinderParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/lamellar.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellar.c	(revision c1c29b67c42e22e8ebe38ed7aacd5a53ec4f66bb)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/**
- * Scattering model for dilute lamellar model: polydipsersion in thickness (delta) included
- * @author: Gervaise B. Alina / UTK
- */
-
-#include "lamellar.h"
-#include <math.h>
-//#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-/*	LamellarFFX  :  calculates the form factor of a lamellar structure - no S(q) effects included
-						-NO polydispersion included
-*/
-double lamellar_kernel(double dp[], double q){
-	double scale,del,sld_bi,sld_sol,contr,bkg;		//local variables of coefficient wave
-	double inten, qval,Pq;
-	double Pi;
-
-
-	Pi = 4.0*atan(1.0);
-	scale = dp[0];
-	del = dp[1];
-	sld_bi = dp[2];
-	sld_sol = dp[3];
-	bkg = dp[4];
-	qval = q;
-	contr = sld_bi -sld_sol;
-
-	Pq = 2.0*contr*contr/qval/qval*(1.0-cos(qval*del));
-
-	inten = 2.0*Pi*scale*Pq/(qval*qval);		//this is now dimensionless...
-
-	inten /= del;			//normalize by the thickness (in A)
-
-	inten *= 1.0e8;		// 1/A to 1/cm
-
-	return(inten+bkg);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @return: function value
- */
-double lamellar_analytical_1D(LamellarParameters *pars, double q) {
-	double dp[5];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->bi_thick;
-	dp[2] = pars->sld_bi;
-	dp[3] = pars->sld_sol;
-	dp[4] = pars->background;
-
-
-	// Call library function to evaluate model
-	return lamellar_kernel(dp, q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @return: function value
- */
-
-
-double lamellar_analytical_2D(LamellarParameters *pars, double q, double phi){
-	return lamellar_analytical_1D(pars,q);
-}
-double lamellar_analytical_2DXY(LamellarParameters *pars, double qx, double qy){
-	return lamellar_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
-
Index: sansmodels/src/sans/models/c_extensions/lamellar.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellar.h	(revision 27972c1dfdd57a50946a99914051e1713c997e78)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#if !defined(lamellar_h)
-#define lamellar_h
-/** Structure definition for lamellar parameters
- * [PYTHONCLASS] = LamellarModel
- * [DISP_PARAMS] = bi_thick
-   [DESCRIPTION] = <text>[Dilute Lamellar Form Factor](from a lyotropic lamellar phase)
-		I(q)= 2*pi*P(q)/(delta *q^(2)), where
-		P(q)=2*(contrast/q)^(2)*(1-cos(q*delta))^(2))
-		bi_thick = bilayer thickness
-		sld_bi = SLD of bilayer
-		sld_sol = SLD of solvent
-		background = Incoherent background
-		scale = scale factor
-
- </text>
-[FIXED]= <text>bi_thick.width</text>
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// delta bilayer thickness [A]
-    //  [DEFAULT]=bi_thick=50.0 [A]
-    double bi_thick;
-    /// SLD of bilayer [1/A^(2)]
-    //  [DEFAULT]=sld_bi=1.0e-6 [1/A^(2)]
-    double sld_bi;
-    /// SLD of solvent [1/A^(2)]
-    //  [DEFAULT]=sld_sol=6.3e-6 [1/A^(2)]
-    double sld_sol;
-	/// Incoherent Background [1/cm] 0.00
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-
-
-} LamellarParameters;
-
-/// kernel
-double lamellar_kernel(double dp[], double q);
-/// 1D scattering function
-double lamellar_analytical_1D(LamellarParameters *pars, double q);
-
-/// 2D scattering function
-double lamellar_analytical_2D(LamellarParameters *pars, double q, double phi);
-double lamellar_analytical_2DXY(LamellarParameters *pars, double qx, double qy);
-double lamellar_analytical_2D_scaled(LamellarParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/lamellarFF_HG.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellarFF_HG.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#if !defined(lamellarFF_HG_h)
-#define lamellarFF_HG_h
-/** Structure definition for lamellar parameters
- * [PYTHONCLASS] = LamellarFFHGModel
- * [DISP_PARAMS] =  t_length, h_thickness
-   [DESCRIPTION] = <text> Parameters: t_length = tail length, h_thickness = head thickness,
-			scale = Scale factor,
-			background = incoherent Background
-			sld_tail = tail scattering length density ,
-			sld_solvent = solvent scattering length density.
-			NOTE: The total bilayer thickness
-			= 2(h_thickness+ t_length).
-
-	</text>
-	[FIXED]= t_length.width, h_thickness.width
-	[ORIENTATION_PARAMS]=
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// tail length [A]
-    //  [DEFAULT]=t_length=15.0 [A]
-    double t_length;
-    /// head thickness
-    //  [DEFAULT]=h_thickness=10.0 [A]
-    double h_thickness;
-	/// tail scrattering length density[1/A^(2)]
-    //  [DEFAULT]=sld_tail=4e-7 [1/A^(2)]
-    double sld_tail;
-    /// head group scrattering length density[1/A^(2)]
-    //  [DEFAULT]=sld_head=3e-6 [1/A^(2)]
-    double sld_head;
-	 /// solvent scrattering length density[1/A^(2)]
-    //  [DEFAULT]=sld_solvent=6e-6 [1/A^(2)]
-    double sld_solvent;
-	/// Incoherent Background [1/cm] 0.00
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-
-} LamellarFF_HGParameters;
-
-
-
-/// 1D scattering function
-//double lamellarFF_HG_analytical_1D(LamellarFF_HGParameters *pars, double q);
-
-/// 2D scattering function
-//double lamellarFF_HG_analytical_2D(LamellarFF_HGParameters *pars, double q, double phi);
-//double lamellarFF_HG_analytical_2DXY(LamellarFF_HGParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/lamellarPC.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellarPC.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#if !defined(lamellarPC_h)
-#define lamellarPC_h
-/** Structure definition for lamellar_paracrystal parameters
- * [PYTHONCLASS] = LamellarPCrystalModel
- * [DISP_PARAMS] =  thickness
-   [DESCRIPTION] = <text>[Lamellar ParaCrystal Model] Parameter Definitions: scale = scale factor,
-			background = incoherent background
-			thickness = lamellar thickness,
-			sld_layer = layer scattering length density ,
-			sld_solvent = solvent scattering length density.
-			Nlayers = no. of lamellar layers
-			spacing = spacing between layers
-			pd_spacing = polydispersity of spacing
-			Note: This model can be used for large
-				multilamellar vesicles.
-
-	</text>
-	[FIXED]= thickness.width;
-	[ORIENTATION_PARAMS]=
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// thickness
-    //  [DEFAULT]=thickness=33.0 [A]
-    double thickness;
-    /// Nlayers
-    //  [DEFAULT]=Nlayers=20.0
-    double Nlayers;
-    /// spacing
-    //  [DEFAULT]=spacing=250.0 [A]
-    double spacing;
-    /// poly-dispersity of spacing
-    //  [DEFAULT]=pd_spacing=0.0
-    double pd_spacing;
-    /// layer scrattering length density[1/A^(2)]
-    //  [DEFAULT]=sld_layer=1.0e-6 [1/A^(2)]
-    double sld_layer;
-	/// solvent scrattering length density[1/A^(2)]
-    //  [DEFAULT]=sld_solvent=6.34e-6 [1/A^(2)]
-    double sld_solvent;
-	/// Incoherent Background [1/cm] 0.00
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-
-} LamellarPCParameters;
-
-
-
-/// 1D scattering function
-//double lamellarPC_analytical_1D(LamellarPCParameters *pars, double q);
-
-/// 2D scattering function
-//double lamellarPC_analytical_2D(LamellarPCParameters *pars, double q, double phi);
-//double lamellarPC_analytical_2DXY(LamellarPCParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/lamellarPS.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellarPS.c	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/**
- * Scattering model for a lamellar
- * TODO: Add 2D analysis
- */
-
-#include "lamellarPS.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#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,sld_bi,sld_sol,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;		//[=] 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];
-	sld_bi = dp[3];
-	sld_sol = dp[4];
-	NN = trunc(dp[5]);		//be sure that NN is an integer
-	Cp = dp[6];
-	bkg = dp[7];
-
-	contr = sld_bi - sld_sol;
-
-	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);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @return: function value
- */
-double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q) {
-	double dp[8];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->spacing;
-	dp[2] = pars->delta;
-	dp[3] = pars->sld_bi;
-	dp[4] = pars->sld_sol;
-	dp[5] = pars->n_plates;
-	dp[6] = pars->caille;
-	dp[7] = pars->background;
-
-	// Call library function to evaluate model
-	return LamellarPS_kernel(dp, q);
-}
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @return: function value
- */
-double lamellarPS_analytical_2DXY(LamellarPSParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return lamellarPS_analytical_1D(pars, q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double lamellarPS_analytical_2D(LamellarPSParameters *pars, double q, double phi) {
-    return lamellarPS_analytical_1D(pars,q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-
-
Index: sansmodels/src/sans/models/c_extensions/lamellarPS.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellarPS.h	(revision f10063e8f3c53d2be93abaea9c0d3d4f3061d444)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
-	TODO: Add 2D model
-*/
-
-#if !defined(lamellarPS_h)
-#define lamellarPS_h
-/** Structure definition for concentrated lamellar form factor parameters
- * [PYTHONCLASS] = LamellarPSModel
- * [DISP_PARAMS] = delta, spacing
-   [DESCRIPTION] = <text>[Concentrated Lamellar Form Factor] Calculates the scattered
-	   intensity from a lyotropic lamellar phase.
-	   The intensity (form factor and structure
-	   factor)calculated is for lamellae of
-	   uniform scattering length density that
-	   are randomly distributed in solution
-	   (a powder average). The lamellae thickness
-		is polydisperse. The model can also
-		be applied to large, multi-lamellar vesicles.
-		No resolution smeared version is included
-		in the structure factor of this model.
-		*Parameters: spacing = repeat spacing,
-		delta = bilayer thickness,
-		sld_bi = SLD_bilayer
-		sld_sol = SLD_solvent
-		n_plate = # of Lamellar plates
-		caille = Caille parameter (<0.8 or <1)
-		background = incoherent bgd
-		scale = scale factor
-</text>
-   [FIXED]= <text>delta.width; spacing.width</text>
-   [ORIENTATION_PARAMS]=
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// repeat spacing of the lamellar [A]
-    //  [DEFAULT]=spacing=400 [A]
-    double spacing;
-	/// bilayer thicknes [A]
-    //  [DEFAULT]=delta=30 [A]
-    double delta;
-    /// SLD of bilayer [1/A^(2)]
-    //  [DEFAULT]=sld_bi=6.3e-6 [1/A^(2)]
-    double sld_bi;
-    /// SLD of solvent [1/A^(2)]
-    //  [DEFAULT]=sld_sol=1.0e-6 [1/A^(2)]
-    double sld_sol;
-	 /// Number of lamellar plates
-    //  [DEFAULT]=n_plates=20
-    double n_plates;
-    /// caille parameters
-    //  [DEFAULT]=caille=0.1
-    double caille;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-
-} LamellarPSParameters;
-
-/// kernel
-double LamellarPS_kernel(double dp[], double q);
-/// 1D scattering function
-double lamellarPS_analytical_1D(LamellarPSParameters *pars, double q);
-
-/// 2D scattering function
-double lamellarPS_analytical_2D(LamellarPSParameters *pars, double q, double phi);
-double lamellarPS_analytical_2DXY(LamellarPSParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/lamellarPS_HG.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/lamellarPS_HG.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
-	TODO: Add 2D model
-*/
-
-#if !defined(lamellarPS_HG_h)
-#define lamellarPS_HG_h
-/** Structure definition for concentrated lamellar form factor parameters
- * [PYTHONCLASS] = LamellarPSHGModel
- * [DISP_PARAMS] = deltaT,deltaH,spacing
-   [DESCRIPTION] = <text>[Concentrated Lamellar (head+tail) Form Factor]: Calculates the
-	   intensity from a lyotropic lamellar phase.
-	   The intensity (form factor and structure factor)
-		calculated is for lamellae of two-layer scattering
-		length density that are randomly distributed in
-		solution (a powder average). The scattering
-		length density of the tail region, headgroup
-		region, and solvent are taken to be different.
-		The model can also be applied to large,
-		multi-lamellar vesicles.
-		No resolution smeared version is included
-		in the structure factor of this model.
-		*Parameters: spacing = repeat spacing,
-		deltaT = tail length,
-		deltaH = headgroup thickness,
-		n_plates = # of Lamellar plates
-		caille = Caille parameter (<0.8 or <1)
-		background = incoherent bgd
-		scale = scale factor ...
-</text>
-   [FIXED]= deltaT.width;deltaH.width;spacing.width
-   [ORIENTATION_PARAMS]=
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// repeat spacing of the lamellar [A]
-    //  [DEFAULT]=spacing=40 [A]
-    double spacing;
-	///  tail thickness [A]
-    //  [DEFAULT]=deltaT=10 [A]
-    double deltaT;
-	///  head thickness [A]
-    //  [DEFAULT]=deltaH=2.0 [A]
-    double deltaH;
-    /// scattering density length of tails [1/A^(2)]
-    //  [DEFAULT]=sld_tail=0.4e-6 [1/A^(2)]
-    double sld_tail;
-	/// scattering density length of head [1/A^(2)]
-    //  [DEFAULT]=sld_head=2e-6 [1/A^(2)]
-    double sld_head;
-	/// scattering density length of solvent [1/A^(2)]
-    //  [DEFAULT]=sld_solvent=6e-6 [1/A^(2)]
-    double sld_solvent;
-	 /// Number of lamellar plates
-    //  [DEFAULT]=n_plates=30
-    double n_plates;
-    /// caille parameters
-    //  [DEFAULT]=caille=0.001
-    double caille;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.001 [1/cm]
-	double background;
-
-} LamellarPSHGParameters;
-
-
-
-/// 1D scattering function
-//double lamellarPS_HG_analytical_1D(LamellarPSHGParameters *pars, double q);
-
-/// 2D scattering function
-//double lamellarPS_HG_analytical_2D(LamellarPSHGParameters *pars, double q, double phi);
-//double lamellarPS_HG_analytical_2DXY(LamellarPSHGParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/libmultifunc/libfunc.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/libmultifunc/libfunc.c	(revision d6a3cf064d23657099766b45ac246410b01f81a3)
+++ 	(revision )
@@ -1,64 +1,0 @@
-// by jcho
-#include <math.h>
-#include "libmultifunc/libfunc.h"
-#include <stdio.h>
-
-//used in Si func
-int factorial(int i)
-{
-	int k, j;
-	if (i<2){
-		return 1;
-	}
-	k=1;
-	for(j=1;j<i;j++)
-	{
-		k=k*(j+1);
-	}
-	return k;
-}
-
-// Used in pearl nec model
-// Sine integral function: approximated within 1%!!!
-// integral of sin(x)/x up to namx term nmax=6 looks the best.
-double Si(double x)
-{
-	int i;
-	int nmax=6;
-	double out;
-	long double power;
-	double pi = 4.0*atan(1.0);
-	if (x >= pi*6.2/4.0){
-
-		double out_sin = 0.0;
-		double out_cos = 0.0;
-		out = pi/2.0;
-		for (i=0; i<nmax-2; i+=1){
-			out_cos += pow(-1.0, i) * (double)factorial(2*i) / pow(x, 2*i+1);
-			out_sin += pow(-1.0, i) * (double)factorial(2*i+1) / pow(x, 2*i+2);
-		}
-		out -= cos(x) * out_cos;
-		out -= sin(x) * out_sin;
-		return out;
-	}
-	out = 0.0;
-	for (i=0; i<nmax; i+=1)
-	{
-		if (i==0){
-			out += x;
-			continue;
-		}
-		power = pow(x,(2 * i + 1));
-		out += (double)pow(-1, i) * power / ((2.0 * (double)i + 1.0) * (double)factorial(2 * i + 1));
-		//printf ("Si=%g %g %d\n", x, out, i);
-	}
-	return out;
-}
-
-double sinc(double x)
-{
-	if (x==0.0){
-		return 1.0;
-	}
-	return sin(x)/x;
-}
Index: sansmodels/src/sans/models/c_extensions/libmultifunc/libfunc.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/libmultifunc/libfunc.h	(revision 463eb76eeb5025572fbf0fa55f22d9895dede70f)
+++ 	(revision )
@@ -1,10 +1,0 @@
-#if !defined(o_h)
-#define libfunc_h
-
-int factorial(int i);
-
-double Si(double x);
-
-double sinc(double x);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/libmultifunc/librefl.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/libmultifunc/librefl.c	(revision 8ff5cb3da7d659c05ad4b1db717b521b4257953b)
+++ 	(revision )
@@ -1,341 +1,0 @@
-// The original code, of which work was not DANSE funded,
-// was provided by J. Cho.
-// And modified to fit sansmodels/sansview: JC
-
-#include <math.h>
-#include "libmultifunc/librefl.h"
-#include <stdio.h>
-#include <stdlib.h>
-#if defined(_MSC_VER)
-#include "winFuncs.h"
-#endif
-
-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(n_sub, ind, nu)
-	double n_sub,nu, ind;
-{
-  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(n_sub, ind, nu)
-	double n_sub,nu, ind;
-{
-  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(n_sub, ind, nu)
-	double n_sub, nu, ind;
-{
-  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(n_sub, ind, nu)
-	double n_sub, nu, ind;
-{
-  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(n_sub, ind, nu)
-	double n_sub, nu, ind;
-{
-  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(n_sub, ind, nu)
-	double n_sub, nu, ind;
-{
-  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(fun_type, n_sub, i, nu, sld_l, sld_r)
-	double n_sub, nu, sld_l, sld_r,i;
-	int fun_type;
-{
-	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(fun_type, n_sub, i, sld_l, sld_r)
-	double n_sub, sld_l, sld_r, i;
-	int fun_type;
-{
-	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: sansmodels/src/sans/models/c_extensions/libmultifunc/librefl.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/libmultifunc/librefl.h	(revision 8ff5cb3da7d659c05ad4b1db717b521b4257953b)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#if !defined(librefl_h)
-#define librefl_h
-
-typedef struct {
-	double re;
-	double im;
-} complex;
-
-typedef struct {
-	complex a;
-	complex b;
-	complex c;
-	complex d;
-} matrix;
-
-complex cassign(double real, double imag);
-
-complex cplx_add(complex x,complex y);
-
-complex rcmult(double x,complex y);
-
-complex cplx_sub(complex x,complex y);
-
-complex cplx_mult(complex x,complex y);
-
-complex cplx_div(complex x,complex y);
-
-complex cplx_exp(complex b);
-
-complex cplx_sqrt(complex z);
-
-complex cplx_cos(complex b);
-
-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);
-double linePq(int fun_type, double thick, double sld_in, double sld_out,double r, double q);
-#endif
Index: sansmodels/src/sans/models/c_extensions/local.def
===================================================================
--- sansmodels/src/sans/models/c_extensions/local.def	(revision 533550cf5488b652b4bb2c711d3c248b98bb7abb)
+++ 	(revision )
@@ -1,32 +1,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#                               Michael A.G. Aivazis
-#                        California Institute of Technology
-#                        (C) 1998-2004  All Rights Reserved
-#
-# <LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-#
-# Local (project) definitions
-#
-
-# C++
-
-
-    PROJ_CXX_FLAGS += $(CXX_SOFLAGS)
-    PROJ_LCXX_FLAGS += $(LCXX_SARFLAGS)
-
-PROJ_CC_INCLUDES += $(BLD_INCDIR)/sans
-
-#PROJ_CXX_DEFINES += DEEPDEBUG
-#PROJ_CXX_DEFINES += DEBUG
-
-# version
-# $Id: local.def 1280 2007-06-25 07:01:00Z linjiao $
-
-# End of file
Index: sansmodels/src/sans/models/c_extensions/logNormal.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/logNormal.c	(revision 59b9b67578f11772d51a4d61028e0dfc7097df5a)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/**
- * log normal function
- */
-
-#include "logNormal.h"
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D Log normal function.
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x)=scale * 1/(sigma*math.sqrt(2pi))e^(-1/2*((math.log(x)-mu)/sigma)^2)
- * 
- * @param pars: parameters of the log normal 
- * @param x: x-value
- * @return: function value
- */
-double logNormal_analytical_1D(LogNormalParameters *pars, double x) {
-	double sigma2 = pow(pars->sigma, 2);	
-	return pars->scale / (x*sigma2) * exp( -pow((log(x) -pars->center), 2) / (2*sigma2));
-}
-
-/**
- * Function to evaluate 2D log normal  function
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x,y) = LogNormal(x) * Lognormal(y)
- * 
- * where both Gaussians share the same parameters.
- * 
- * @param pars: parameters of the log normal 
- * @param x: x-value
- * @param y: y-value
- * @return: function value
- */
-double logNormal_analytical_2DXY(LogNormalParameters *pars, double x, double y) {
-    return logNormal_analytical_1D(pars, x) * logNormal_analytical_1D(pars, y);
-} 
-
-/**
- * Function to evaluate 2D log normal  function
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x,y) = Lognormal(x) * Lognormal(y)
- * 
- * where both log normal s share the same parameters.
- * 
- * @param pars: parameters of the log normal
- * @param length: length of the (x,y) vector
- * @param phi: angle relative to x
- * @return: function value
- */
-double logNormal_analytical_2D(LogNormalParameters *pars, double length, double phi) {
-    return logNormal_analytical_2DXY(pars, length*cos(phi), length*sin(phi));
-} 
Index: sansmodels/src/sans/models/c_extensions/logNormal.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/logNormal.h	(revision 59b9b67578f11772d51a4d61028e0dfc7097df5a)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#if !defined(logNormal_h)
-#define logNormal_h
-
-/** Structure definition for Gaussian parameters.
- * The Log normal is normalized to the 'scale' parameter.
- *  
- * f(x)=scale * 1/(sigma*math.sqrt(2pi))e^(-1/2*((math.log(x)-mu)/sigma)^2)
- *
- * [PYTHONCLASS] = LogNormal
- * [DESCRIPTION] = <text>f(x)=scale * 1/(sigma*math.sqrt(2pi))e^(-1/2*((math.log(x)-mu)/sigma)^2)</text>
- */
-typedef struct {
-    /// Scale factor 
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Standard deviation
-    //  [DEFAULT]=sigma=1 
-    double sigma;
-    /// Center of the Log Normal distribution
-    //  [DEFAULT]=center=0.0 
-    double center;
-} LogNormalParameters;
-
-/// 1D scattering function
-double logNormal_analytical_1D(LogNormalParameters *pars, double x);
-
-/// 2D scattering function
-double logNormal_analytical_2D(LogNormalParameters *pars, double x, double phi);
-double logNormal_analytical_2DXY(LogNormalParameters *pars, double x, double y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/lorentzian.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/lorentzian.c	(revision 59b9b67578f11772d51a4d61028e0dfc7097df5a)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/**
- * Lorentzian function
- */
-
-#include "lorentzian.h"
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D Lorentzian function.
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x)=scale * 1/pi 0.5gamma / [ (x-x_0)^2 + (0.5gamma)^2 ]
- * 
- * @param pars: parameters of the Lorentzian
- * @param x: x-value
- * @return: function value
- */
-double lorentzian_analytical_1D(LorentzianParameters *pars, double x) {
-	double delta2 = pow( (x-pars->center), 2);
-	return pars->scale / acos(-1.0) * 0.5*pars->gamma /
-		(delta2 + 0.25*pars->gamma*pars->gamma);
-}
-
-/**
- * Function to evaluate 2D Lorentzian  function
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x,y) = Lorentzian(x) * Lorentzian(y)
- * 
- * where both Lorentzians share the same parameters.
- * 
- * @param pars: parameters of the Lorentzian
- * @param x: x-value
- * @param y: y-value
- * @return: function value
- */
-double lorentzian_analytical_2DXY(LorentzianParameters *pars, double x, double y) {
-    return lorentzian_analytical_1D(pars, x) * lorentzian_analytical_1D(pars, y);
-} 
-
-/**
- * Function to evaluate 2D Lorentzian  function
- * The function is normalized to the 'scale' parameter.
- * 
- * f(x,y) = Lorentzian(x) * Lorentzian(y)
- * 
- * where both Lorentzians share the same parameters.
- * 
- * @param pars: parameters of the Lorentzian
- * @param length: length of the (x,y) vector
- * @param phi: angle relative to x
- * @return: function value
- */
-double lorentzian_analytical_2D(LorentzianParameters *pars, double length, double phi) {
-    return lorentzian_analytical_2DXY(pars, length*cos(phi), length*sin(phi));
-} 
Index: sansmodels/src/sans/models/c_extensions/lorentzian.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/lorentzian.h	(revision 59b9b67578f11772d51a4d61028e0dfc7097df5a)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#if !defined(lorentzian_h)
-#define lorentzian_h
-
-/** Structure definition for Lorentzian parameters.
- * The Lorentzian is normalized to the 'scale' parameter.
- *  
- * f(x)=scale * 1/pi 0.5gamma / [ (x-x_0)^2 + (0.5gamma)^2 ]
- * 
- * [PYTHONCLASS] = Lorentzian
- * [DESCRIPTION] = <text>f(x)=scale * 1/pi 0.5gamma / [ (x-x_0)^2 + (0.5gamma)^2 ]</text>
- */
-typedef struct {
-    /// Scale factor 
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Width
-    //  [DEFAULT]=gamma=1.0
-    double gamma;
-    /// Center of the Lorentzian distribution
-    //  [DEFAULT]=center=0.0 
-    double center;
-} LorentzianParameters;
-
-/// 1D lorentzian function
-double lorentzian_analytical_1D(LorentzianParameters *pars, double x);
-
-/// 2D lorentzian function
-double lorentzian_analytical_2D(LorentzianParameters *pars, double x, double phi);
-double lorentzian_analytical_2DXY(LorentzianParameters *pars, double x, double y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/multishell.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/multishell.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-#if !defined(multishell_h)
-#define multishell_h
-
-/**
- * Structure definition for sphere parameters
-
-	[PYTHONCLASS] = MultiShellModel
-	[DISP_PARAMS] = core_radius, s_thickness, w_thickness
-	[DESCRIPTION] =<text> MultiShell (Sphere) Model (or Multilamellar Vesicles): Model parameters;
-				scale : scale factor
-				core_radius : Core radius of the multishell
-				s_thickness: shell thickness
-				w_thickness: water thickness
-				core_sld: core scattering length density
-				shell_sld: shell scattering length density
-				n_pairs:number of pairs of water/shell
-				background: incoherent background
-               </text>
-	[FIXED]=  core_radius.width; s_thickness.width; w_thickness.width
-	[ORIENTATION_PARAMS]= <text> </text>
- */
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	Core radius of the multishell [A]
-    //  [DEFAULT]=core_radius=60.0 [A]
-    double core_radius;
-
-	///	shell thickness [A]
-    //  [DEFAULT]=s_thickness= 10.0 [A]
-    double s_thickness;
-
-    ///	water thickness [A]
-    //  [DEFAULT]=w_thickness= 10.0 [A]
-    double w_thickness;
-
-	///	core scattering length density [1/A^(2)]
-    //  [DEFAULT]=core_sld= 6.4e-6 [1/A^(2)]
-    double core_sld;
-
-    ///	shell scattering length density [1/A^(2)]
-    //  [DEFAULT]=shell_sld= 4.0e-7 [1/A^(2)]
-    double shell_sld;
-
-	///	number of pairs of water and shell
-    //  [DEFAULT]=n_pairs= 2
-    double n_pairs;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-
-} MultiShellParameters;
-
-
-
-/// 1D scattering function
-//double multishell_analytical_1D(MultiShellParameters *pars, double q);
-
-/// 2D scattering function
-//double multishell_analytical_2D(MultiShellParameters *pars, double q, double phi);
-//double multishell_analytical_2DXY(MultiShellParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/onion.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/onion.c	(revision 3be94e82955b2189079385864429387ed6e7d30b)
+++ 	(revision )
@@ -1,267 +1,0 @@
-/**
- * Scattering model for a onion
- */
-
-#include <math.h>
-#include "onion.h"
-#include <stdio.h>
-#include <stdlib.h>
-// some details can be found in sld_cal.c
-double so_kernel(double dp[], double q) {
-	int n = dp[0];
-	double scale = dp[1];
-	double rad_core0 = dp[2];
-	double sld_core0 = dp[3];
-	double sld_solv = dp[4];
-	double background = dp[5];
-	int i,j;
-  double bes,fun,alpha,f,vol,vol_pre,vol_sub,qr,r,contr,f2;
-  double sign;
-  double pi;
-  double r0 = 0.0;
-
-  double *sld_out;
-  double *slope;
-  double *sld_in;
-  double *thick;
-  double *A;
-  int *fun_type;
-
-  sld_out = (double*)malloc((n+2)*sizeof(double));
-  slope = (double*)malloc((n+2)*sizeof(double));
-  sld_in = (double*)malloc((n+2)*sizeof(double));
-  thick = (double*)malloc((n+2)*sizeof(double));
-  A = (double*)malloc((n+2)*sizeof(double));
-  fun_type = (int*)malloc((n+2)*sizeof(int));
-
-	for (i =1; i<=n; i++){
-		sld_out[i] = dp[i+5];
-		sld_in[i] = dp[i+15];
-		A[i] = dp[i+25];
-		thick[i] = dp[i+35];
-		fun_type[i] = dp[i+45];
-	}
-	sld_out[0] = sld_core0;
-	sld_out[n+1] = sld_solv;
-	sld_in[0] = sld_core0;
-	sld_in[n+1] = sld_solv;
-	thick[0] = rad_core0;
-	thick[n+1] = 1e+10;
-	A[0] = 0.0;
-	A[n+1] = 0.0;
-	fun_type[0] = 0;
-	fun_type[n+1] = 0;
-
-
-    pi = 4.0*atan(1.0);
-    f = 0.0;
-    r = 0.0;
-    vol = 0.0;
-    vol_pre = 0.0;
-    vol_sub = 0.0;
-
-    for (i =0; i<= n+1; i++){
-    	if (thick[i] == 0.0){
-    		continue;
-    	}
-    	if (fun_type[i]== 0 ){
-    		slope[i] = 0.0;
-    		A[i] = 0.0;
-    	}
-    	vol_pre = vol;
-        switch(fun_type[i]){
-            case 2 :
-					r0 = r;
-					if (A[i] == 0.0){
-						slope[i] = 0.0;
-					}
-					else{
-						slope[i] = (sld_out[i]-sld_in[i])/(exp(A[i])-1.0);
-					}
-                    for (j=0; j<2; j++){
-                        if ( i == 0 && j == 0){
-                            continue;
-                            }
-                        if (i == n+1 && j == 1){
-                            continue;
-                            }
-                        if ( j == 1){
-                            sign = 1.0;
-                            r += thick[i];
-                            }
-                        else{
-                            sign = -1.0;
-                       		}
-                        qr = q * r;
-                        alpha = A[i] * r/thick[i];
-                        fun = 0.0;
-                        if(qr == 0.0){
-                            fun = sign * 1.0;
-                            bes = sign * 1.0;
-                            }
-                        else{
-                            if (fabs(A[i]) > 0.0 ){
-                                fun = 3.0 * ((alpha*alpha - qr * qr) * sin(qr) - 2.0 * alpha * qr * cos(qr))/ ((alpha * alpha + qr * qr) * (alpha * alpha + qr * qr) * qr);
-                                fun = fun - 3.0 * (alpha * sin(qr) - qr * cos(qr)) / ((alpha * alpha + qr * qr) * qr);
-                                fun = - sign *fun;
-                                bes = sign * 3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-                                }
-                            else {
-                                fun = sign * 3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-                                bes = sign * 3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-                                }
-                            }
-                        contr = slope[i]*exp(A[i]*(r-r0)/thick[i]);
-
-                        vol = 4.0 * pi / 3.0 * r * r * r;
-                        //if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && A[i]==0.0){
-                        //	vol_sub += (vol_pre - vol);
-                        //}
-                        f += vol * (contr * (fun) + (sld_in[i]-slope[i]) * bes);
-                        }
-                        break;
-            default :
-						if (fun_type[i]==0){
-							slope[i] = 0.0;
-						}
-						else{
-							slope[i]= (sld_out[i] -sld_in[i])/thick[i];
-						}
-                        contr = sld_in[i]-slope[i]*r;
-                        for (j=0; j<2; j++){
-                            if ( i == 0 && j == 0){
-                                continue;
-                                }
-                            if (i == n+1 && j == 1){
-                                continue;
-                                }
-                            if ( j == 1){
-                            	sign = 1.0;
-                                r += thick[i];
-                                }
-                            else{
-                            	sign = -1.0;
-								}
-
-                            qr = q * r;
-                            fun = 0.0;
-                            if(qr == 0.0){
-                                bes = sign * 1.0;
-                                }
-                            else{
-                                bes = sign *  3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-                                if (fabs(slope[i]) > 0.0 ){
-                                    fun = sign * 3.0 * r * (2.0*qr*sin(qr)-((qr*qr)-2.0)*cos(qr))/(qr * qr * qr * qr);
-                                    }
-                                }
-                            vol = 4.0 * pi / 3.0 * r * r * r;
-                            //if (j == 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[i]);
-                            }
-                            break;
-				}
-
-        }
-    //vol += vol_sub;
-    f2 = f * f / vol * 1.0e8;
-	f2 *= scale;
-	f2 += background;
-
-  free(sld_out);
-  free(slope);
-  free(sld_in);
-  free(thick);
-  free(A);
-  free(fun_type);
-
-    return (f2);
-}
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @return: function value
- */
-double onion_analytical_1D(OnionParameters *pars, double q) {
-	double dp[56];
-
-	dp[0] = pars->n_shells;
-	dp[1] = pars->scale;
-	dp[2] = pars->rad_core0;
-	dp[3] = pars->sld_core0;
-	dp[4] = pars->sld_solv;
-	dp[5] = pars->background;
-
-	dp[6] = pars->sld_out_shell1;
-	dp[7] = pars->sld_out_shell2;
-	dp[8] = pars->sld_out_shell3;
-	dp[9] = pars->sld_out_shell4;
-	dp[10] = pars->sld_out_shell5;
-	dp[11] = pars->sld_out_shell6;
-	dp[12] = pars->sld_out_shell7;
-	dp[13] = pars->sld_out_shell8;
-	dp[14] = pars->sld_out_shell9;
-	dp[15] = pars->sld_out_shell10;
-
-	dp[16] = pars->sld_in_shell1;
-	dp[17] = pars->sld_in_shell2;
-	dp[18] = pars->sld_in_shell3;
-	dp[19] = pars->sld_in_shell4;
-	dp[20] = pars->sld_in_shell5;
-	dp[21] = pars->sld_in_shell6;
-	dp[22] = pars->sld_in_shell7;
-	dp[23] = pars->sld_in_shell8;
-	dp[24] = pars->sld_in_shell9;
-	dp[25] = pars->sld_in_shell10;
-
-	dp[26] = pars->A_shell1;
-	dp[27] = pars->A_shell2;
-	dp[28] = pars->A_shell3;
-	dp[29] = pars->A_shell4;
-	dp[30] = pars->A_shell5;
-	dp[31] = pars->A_shell6;
-	dp[32] = pars->A_shell7;
-	dp[33] = pars->A_shell8;
-	dp[34] = pars->A_shell9;
-	dp[35] = pars->A_shell10;
-
-	dp[36] = pars->thick_shell1;
-	dp[37] = pars->thick_shell2;
-	dp[38] = pars->thick_shell3;
-	dp[39] = pars->thick_shell4;
-	dp[40] = pars->thick_shell5;
-	dp[41] = pars->thick_shell6;
-	dp[42] = pars->thick_shell7;
-	dp[43] = pars->thick_shell8;
-	dp[44] = pars->thick_shell9;
-	dp[45] = pars->thick_shell10;
-
-	dp[46] = pars->func_shell1;
-	dp[47] = pars->func_shell2;
-	dp[48] = pars->func_shell3;
-	dp[49] = pars->func_shell4;
-	dp[50] = pars->func_shell5;
-	dp[51] = pars->func_shell6;
-	dp[52] = pars->func_shell7;
-	dp[53] = pars->func_shell8;
-	dp[54] = pars->func_shell9;
-	dp[55] = pars->func_shell10;
-
-	return so_kernel(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @return: function value
- */
-double onion_analytical_2D(OnionParameters *pars, double q, double phi) {
-	return onion_analytical_1D(pars,q);
-}
-
-double onion_analytical_2DXY(OnionParameters *pars, double qx, double qy){
-	return onion_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
Index: sansmodels/src/sans/models/c_extensions/onion.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/onion.h	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ 	(revision )
@@ -1,171 +1,0 @@
-#if !defined(o_h)
-#define onion_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = OnionModel
- //[DISP_PARAMS] = rad_core0, thick_shell1,thick_shell2,thick_shell3,thick_shell4, thick_shell5,thick_shell6,thick_shell7,thick_shell8,thick_shell9,thick_shell10
- //[DESCRIPTION] =<text>Form factor of mutishells normalized by the volume. Here each shell is described
- //						 by an exponential function;
- //							I)
- //							For A_shell != 0,
- //							f(r) = B*exp(A_shell*(r-r_in)/thick_shell)+C
- //                         where
- //								B=(sld_out-sld_in)/(exp(A_shell)-1)
- //								C=sld_in-B.
- //							Note that in the above case,
- //								the function becomes a linear function
- //								as A_shell --> 0+ or 0-.
- //							II)
- //							For the exact point of A_shell == 0,
- //							f(r) = sld_in ,i.e., it crosses over flat function
- //							Note that the 'sld_out' becaomes NULL in this case.
- //
- //				background:background,
- //				rad_core0: radius of sphere(core)
- //				thick_shell#:the thickness of the shell#
- //				sld_core0: the SLD of the sphere
- //				sld_solv: the SLD of the solvent
- //				sld_shell: the SLD of the shell#
- //				A_shell#: the coefficient in the exponential function
- //		</text>
- //[FIXED]=  <text>rad_core0.width;thick_shell1.width;thick_shell2.width;thick_shell3.width;thick_shell4.width;thick_shell5.width;thick_shell6.width;thick_shell7.width;thick_shell8.width;thick_shell9.width;thick_shell10.width</text>
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-	/// number of shells
-	//  [DEFAULT]=n_shells=1
-	int n_shells;
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-	double scale;
-    ///	Radius of sphere [A]
-    //  [DEFAULT]=rad_core0=200.0 [A]
-	double rad_core0;
-	///	sld_core [1/A^(2)]
-	//  [DEFAULT]=sld_core0= 1.0e-6 [1/A^(2)]
-	double sld_core0;
-	///	sld_solv [1/A^(2)]
-	//  [DEFAULT]=sld_solv= 6.4e-6 [1/A^(2)]
-	double sld_solv;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-
-    //  [DEFAULT]=sld_out_shell1=2.0e-06 [1/A^(2)]
-    double sld_out_shell1;
-    //  [DEFAULT]=sld_out_shell2=2.5e-06 [1/A^(2)]
-    double sld_out_shell2;
-    //  [DEFAULT]=sld_out_shell3=3.0e-06 [1/A^(2)]
-    double sld_out_shell3;
-    //  [DEFAULT]=sld_out_shell4=3.5e-06 [1/A^(2)]
-    double sld_out_shell4;
-    //  [DEFAULT]=sld_out_shell5=4.0e-06 [1/A^(2)]
-    double sld_out_shell5;
-    //  [DEFAULT]=sld_out_shell6=4.5e-06 [1/A^(2)]
-    double sld_out_shell6;
-    //  [DEFAULT]=sld_out_shell7=5.0e-06 [1/A^(2)]
-    double sld_out_shell7;
-    //  [DEFAULT]=sld_out_shell8=5.5e-06 [1/A^(2)]
-    double sld_out_shell8;
-    //  [DEFAULT]=sld_out_shell9=6.0e-06 [1/A^(2)]
-    double sld_out_shell9;
-    //  [DEFAULT]=sld_out_shell10=6.2e-06 [1/A^(2)]
-    double sld_out_shell10;
-
-    //  [DEFAULT]=sld_in_shell1=1.7e-06 [1/A^(2)]
-    double sld_in_shell1;
-    //  [DEFAULT]=sld_in_shell2=2.2e-06 [1/A^(2)]
-    double sld_in_shell2;
-    //  [DEFAULT]=sld_in_shell3=2.7e-06 [1/A^(2)]
-    double sld_in_shell3;
-    //  [DEFAULT]=sld_in_shell4=3.2e-06 [1/A^(2)]
-    double sld_in_shell4;
-    //  [DEFAULT]=sld_in_shell5=3.7e-06 [1/A^(2)]
-    double sld_in_shell5;
-    //  [DEFAULT]=sld_in_shell6=4.2e-06 [1/A^(2)]
-    double sld_in_shell6;
-    //  [DEFAULT]=sld_in_shell7=4.7e-06 [1/A^(2)]
-    double sld_in_shell7;
-    //  [DEFAULT]=sld_in_shell8=5.2e-06 [1/A^(2)]
-    double sld_in_shell8;
-    //  [DEFAULT]=sld_in_shell9=5.7e-06 [1/A^(2)]
-    double sld_in_shell9;
-    //  [DEFAULT]=sld_in_shell10=6.0e-06 [1/A^(2)]
-    double sld_in_shell10;
-
-    //  [DEFAULT]=A_shell1=1.0
-    double A_shell1;
-    //  [DEFAULT]=A_shell2=1.0
-    double A_shell2;
-    //  [DEFAULT]=A_shell3=1.0
-    double A_shell3;
-    //  [DEFAULT]=A_shell4=1.0
-    double A_shell4;
-    //  [DEFAULT]=A_shell5=1.0
-    double A_shell5;
-    //  [DEFAULT]=A_shell6=1.0
-    double A_shell6;
-    //  [DEFAULT]=A_shell7=1.0
-    double A_shell7;
-    //  [DEFAULT]=A_shell8=1.0
-    double A_shell8;
-    //  [DEFAULT]=A_shell9=1.0
-    double A_shell9;
-    //  [DEFAULT]=A_shell10=1.0
-    double A_shell10;
-
-    //  [DEFAULT]=thick_shell1=50.0 [A]
-    double thick_shell1;
-    //  [DEFAULT]=thick_shell2=50.0 [A]
-    double thick_shell2;
-    //  [DEFAULT]=thick_shell3=50.0 [A]
-    double thick_shell3;
-    //  [DEFAULT]=thick_shell4=50.0 [A]
-    double thick_shell4;
-    //  [DEFAULT]=thick_shell5=50.0 [A]
-    double thick_shell5;
-    //  [DEFAULT]=thick_shell6=50.0 [A]
-    double thick_shell6;
-    //  [DEFAULT]=thick_shell7=50.0 [A]
-    double thick_shell7;
-    //  [DEFAULT]=thick_shell8=50.0 [A]
-    double thick_shell8;
-    //  [DEFAULT]=thick_shell9=50.0 [A]
-    double thick_shell9;
-    //  [DEFAULT]=thick_shell10=50.0 [A]
-    double thick_shell10;
-
-    //  [DEFAULT]=func_shell1=2
-    int func_shell1;
-    //  [DEFAULT]=func_shell2=2
-    int func_shell2;
-    //  [DEFAULT]=func_shell3=2
-    int func_shell3;
-    //  [DEFAULT]=func_shell4=2
-    int func_shell4;
-    //  [DEFAULT]=func_shell5=2
-    int func_shell5;
-    //  [DEFAULT]=func_shell6=2
-    int func_shell6;
-    //  [DEFAULT]=func_shell7=2
-    int func_shell7;
-    //  [DEFAULT]=func_shell8=2
-    int func_shell8;
-    //  [DEFAULT]=func_shell9=2
-    int func_shell9;
-    //  [DEFAULT]=func_shell10=2
-    int func_shell10;
-} OnionParameters;
-
-double so_kernel(double dq[], double q);
-
-/// 1D scattering function
-double onion_analytical_1D(OnionParameters *pars, double q);
-
-/// 2D scattering function
-double onion_analytical_2D(OnionParameters *pars, double q, double phi);
-double onion_analytical_2DXY(OnionParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/parallelepiped.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/parallelepiped.c	(revision 74c9a3063aab59b8fd6dfdc3e053aa3db931b19c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/**
- * Scattering model for a parallelepiped
- * TODO: Add 2D analysis
- */
-
-#include "parallelepiped.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the parallelepiped
- * @param q: q-value
- * @return: function value
- */
-double parallelepiped_analytical_1D(ParallelepipedParameters *pars, double q) {
-	double dp[7];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->short_a;
-	dp[2] = pars->short_b;
-	dp[3] = pars->long_c;
-	dp[4] = pars->sldPipe;
-	dp[5] = pars->sldSolv;
-	dp[6] = pars->background;
-
-	// Call library function to evaluate model
-	return Parallelepiped(dp, q);
-}
-
-
-double pkernel(double a, double b,double c, double ala, double alb, double alc){
-    // mu passed in is really mu*sqrt(1-sig^2)
-    double argA,argB,argC,tmp1,tmp2,tmp3;			//local variables
-
-    //handle arg=0 separately, as sin(t)/t -> 1 as t->0
-    argA = a*ala/2.0;
-    argB = b*alb/2.0;
-    argC = c*alc/2.0;
-    if(argA==0.0) {
-		tmp1 = 1.0;
-	} else {
-		tmp1 = sin(argA)*sin(argA)/argA/argA;
-    }
-    if (argB==0.0) {
-		tmp2 = 1.0;
-	} else {
-		tmp2 = sin(argB)*sin(argB)/argB/argB;
-    }
-
-    if (argC==0.0) {
-		tmp3 = 1.0;
-	} else {
-		tmp3 = sin(argC)*sin(argC)/argC/argC;
-    }
-
-    return (tmp1*tmp2*tmp3);
-
-}//Function pkernel()
-
-
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the parallelepiped
- * @param q: q-value
- * @return: function value
- */
-double parallelepiped_analytical_2DXY(ParallelepipedParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return parallelepiped_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the Parallelepiped
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double parallelepiped_analytical_2D(ParallelepipedParameters *pars, double q, double phi) {
-    return parallelepiped_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the parallelepiped
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double parallelepiped_analytical_2D_scaled(ParallelepipedParameters *pars, double q, double q_x, double q_y) {
-	double cparallel_x, cparallel_y, cparallel_z, bparallel_x, bparallel_y, parallel_x, parallel_y;
-	double q_z;
-	double alpha, vol, cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC;
-
-	double answer;
-	double pi = 4.0*atan(1.0);
-
-  //convert angle degree to radian
-  double theta = pars->parallel_theta * pi/180.0;
-  double phi = pars->parallel_phi * pi/180.0;
-  double psi = pars->parallel_psi * pi/180.0;
-
-	edgeA = pars->short_a;
-	edgeB = pars->short_b;
-	edgeC = pars->long_c;
-
-
-    // parallelepiped c axis orientation
-    cparallel_x = sin(theta) * cos(phi);
-    cparallel_y = sin(theta) * sin(phi);
-    cparallel_z = cos(theta);
-
-    // q vector
-    q_z = 0.0;
-
-    // Compute the angle btw vector q and the
-    // axis of the parallelepiped
-    cos_val_c = cparallel_x*q_x + cparallel_y*q_y + cparallel_z*q_z;
-    alpha = acos(cos_val_c);
-
-    // parallelepiped a axis orientation
-    parallel_x = sin(psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)*sin(pars->parallel_psi);
-    parallel_y = cos(psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)*cos(pars->parallel_psi);
-
-    cos_val_a = parallel_x*q_x + parallel_y*q_y;
-
-
-
-    // parallelepiped b axis orientation
-    bparallel_x = sqrt(1.0-sin(theta)*cos(phi))*cos(psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)* cos(pars->parallel_psi);
-    bparallel_y = sqrt(1.0-sin(theta)*cos(phi))*sin(psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)* sin(pars->parallel_psi);
-    // axis of the parallelepiped
-    cos_val_b = sin(acos(cos_val_a)) ;
-
-
-
-    // The following test should always pass
-    if (fabs(cos_val_c)>1.0) {
-    	printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-	// Call the IGOR library function to get the kernel
-	answer = pkernel( q*edgeA, q*edgeB, q*edgeC, sin(alpha)*cos_val_a,sin(alpha)*cos_val_b,cos_val_c);
-
-	// Multiply by contrast^2
-	answer *= (pars->sldPipe - pars->sldSolv) * (pars->sldPipe - pars->sldSolv);
-
-	//normalize by cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vparallel
-    vol = edgeA* edgeB * edgeC;
-	answer *= vol;
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
-
Index: sansmodels/src/sans/models/c_extensions/parallelepiped.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/parallelepiped.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
-	TODO: Add 2D model
-*/
-
-#if !defined(parallelepiped_h)
-#define parallelepiped_h
-/** Structure definition for Parallelepiped parameters
- * [PYTHONCLASS] = ParallelepipedModel
- * [DISP_PARAMS] = short_a, short_b, long_c,parallel_phi,parallel_psi, parallel_theta
-   [DESCRIPTION] = <text> Form factor for a rectangular solid with uniform scattering length density.
-
-		scale:Scale factor
-		short_a: length of short edge  [A]
-		short_b: length of another short edge [A]
-		long_c: length of long edge  of the parallelepiped [A]
-		sldPipe: Pipe_sld
-		sldSolv: solvent_sld
-		background:Incoherent Background [1/cm]
-		</text>
-	[FIXED]= <text>short_a.width; short_b.width; long_c.width;parallel_phi.width;parallel_psi.width; parallel_theta.width</text>
-	[ORIENTATION_PARAMS]= <text>parallel_phi;parallel_psi; parallel_theta; parallel_phi.width;parallel_psi.width; parallel_theta.width</text>
-
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    ///  Length of short edge of the parallelepiped [A]
-    //  [DEFAULT]=short_a=35 [A]
-    double short_a;
-	/// Length of short edge edge of the parallelepiped [A]
-    //  [DEFAULT]=short_b=75 [A]
-    double short_b;
-	/// Length of long edge of the parallelepiped [A]
-    //  [DEFAULT]=long_c=400 [A]
-    double long_c;
-    /// SLD_Pipe [1/A^(2)]
-    //  [DEFAULT]=sldPipe=6.3e-6 [1/A^(2)]
-    double sldPipe;
-    /// sldSolv [1/A^(2)]
-    //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-    double sldSolv;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-    /// Orientation of the parallelepiped axis w/respect incoming beam [deg]
-    //  [DEFAULT]=parallel_theta=0.0 [deg]
-    double parallel_theta;
-    /// Orientation of the longitudinal axis of the parallelepiped in the plane of the detector [deg]
-    //  [DEFAULT]=parallel_phi=0.0 [deg]
-    double parallel_phi;
-    /// Orientation of the cross-sectional minor axis of the parallelepiped in the plane of the detector [deg]
-    //  [DEFAULT]=parallel_psi=0.0 [deg]
-    double parallel_psi;
-
-
-} ParallelepipedParameters;
-
-
-
-/// 1D scattering function
-double parallelepiped_analytical_1D(ParallelepipedParameters *pars, double q);
-
-/// 2D scattering function
-double parallelepiped_analytical_2D(ParallelepipedParameters *pars, double q, double phi);
-double parallelepiped_analytical_2DXY(ParallelepipedParameters *pars, double qx, double qy);
-double parallelepiped_analytical_2D_scaled(ParallelepipedParameters *pars, double q, double q_x, double q_y);
-#endif
Index: sansmodels/src/sans/models/c_extensions/pearlnecklace.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/pearlnecklace.c	(revision 890ac7f156aa123d3a2d72d1e43ca2a08af66966)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/**
- * pearl necklace model
- */
-#include <math.h>
-#include "pearlnecklace.h"
-#include "libmultifunc/libfunc.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-double pearl_necklace_kernel(double dp[], double q) {
-	// fit parameters
-	double scale = dp[0];
-	double radius = dp[1];
-	double edge_separation = dp[2];
-	double thick_string = dp[3];
-	double num_pearls = dp[4];
-	double sld_pearl = dp[5];
-	double sld_string = dp[6];
-	double sld_solv = dp[7];
-	double background = dp[8];
-
-	//relative slds
-	double contrast_pearl = sld_pearl - sld_solv;
-	double contrast_string = sld_string - sld_solv;
-
-	// number of string segments
-	double num_strings = num_pearls - 1.0;
-
-	//Pi
-	double pi = 4.0*atan(1.0);
-
-	// each volumes
-	double string_vol = edge_separation * pi * pow((thick_string / 2.0), 2);
-	double pearl_vol = 4.0 /3.0 * pi * pow(radius, 3);
-
-	//total volume
-	double tot_vol;
-  //each masses
-  double m_r= contrast_string * string_vol;
-  double m_s= contrast_pearl * pearl_vol;
-  double psi;
-  double gamma;
-  double beta;
-  //form factors
-  double sss; //pearls
-  double srr; //strings
-  double srs; //cross
-  double A_s;
-  double srr_1;
-  double srr_2;
-  double srr_3;
-  double form_factor;
-
-  tot_vol = num_strings * string_vol;
-	tot_vol += num_pearls * pearl_vol;
-
-	//sine functions of a pearl
-	psi = sin(q*radius);
-	psi -= q * radius * cos(q * radius);
-	psi /= pow((q * radius), 3);
-	psi *= 3.0;
-
-	// Note take only 20 terms in Si series: 10 terms may be enough though.
-	gamma = Si(q* edge_separation);
-	gamma /= (q* edge_separation);
-	beta = Si(q * (edge_separation + radius));
-	beta -= Si(q * radius);
-	beta /= (q* edge_separation);
-
-	// center to center distance between the neighboring pearls
-	A_s = edge_separation + 2.0 * radius;
-
-	// form factor for num_pearls
-	sss = 1.0 - pow(sinc(q*A_s), num_pearls );
-	sss /= pow((1.0-sinc(q*A_s)), 2);
-	sss *= -sinc(q*A_s);
-	sss -= num_pearls/2.0;
-	sss += num_pearls/(1.0-sinc(q*A_s));
-	sss *= 2.0 * pow((m_s*psi), 2);
-
-	// form factor for num_strings (like thin rods)
-	srr_1 = -pow(sinc(q*edge_separation/2.0), 2);
-
-	srr_1 += 2.0 * gamma;
-	srr_1 *= num_strings;
-	srr_2 = 2.0/(1.0-sinc(q*A_s));
-	srr_2 *= num_strings;
-	srr_2 *= pow(beta, 2);
-	srr_3 = 1.0 - pow(sinc(q*A_s), num_strings);
-	srr_3 /= pow((1.0-sinc(q*A_s)), 2);
-	srr_3 *= pow(beta, 2);
-	srr_3 *= -2.0;
-
-	// total srr
-	srr = srr_1 + srr_2 + srr_3;
-	srr *= pow(m_r, 2);
-
-	// form factor for correlations
-	srs = 1.0;
-	srs -= pow(sinc(q*A_s), num_strings);
-	srs /= pow((1.0-sinc(q*A_s)), 2);
-	srs *= -sinc(q*A_s);
-	srs += (num_strings/(1.0-sinc(q*A_s)));
-	srs *= 4.0;
-	srs *= (m_r * m_s * beta * psi);
-
-	form_factor = sss + srr + srs;
-	form_factor /= (tot_vol * 1.0e-8); // norm by volume and A^-1 to cm^-1
-
-	// scale and background
-	form_factor *= scale;
-	form_factor += background;
-    return (form_factor);
-}
-
-/**
- * Function to evaluate pearlnecklace function
- * @param pars: parameters of pearlnecklace
- * @param q: q-value
- * @return: function value
- */
-
-double pearl_necklace_analytical_1D(PeralNecklaceParameters *pars, double q) {
-	double dp[9];
-
-	dp[0] = pars->scale;
-	dp[1] = pars->radius;
-	dp[2] = pars->edge_separation;
-	dp[3] = pars->thick_string;
-	dp[4] = pars->num_pearls;
-	dp[5] = pars->sld_pearl;
-	dp[6] = pars->sld_string;
-	dp[7] = pars->sld_solv;
-	dp[8] = pars->background;
-
-	return pearl_necklace_kernel(dp, q);
-}
-
-/**
- * Function to evaluate pearl_necklace function
- * @param pars: parameters of PeralNecklace
- * @param q: q-value
- * @return: function value
- */
-double pearl_necklace_analytical_2D(PeralNecklaceParameters *pars, double q, double phi) {
-	return pearl_necklace_analytical_1D(pars,q);
-}
-
-double pearl_necklace_analytical_2DXY(PeralNecklaceParameters *pars, double qx, double qy){
-	return pearl_necklace_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
-
Index: sansmodels/src/sans/models/c_extensions/pearlnecklace.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/pearlnecklace.h	(revision 9cc3da6768743c3979f378fe701132b85e3c4b49)
+++ 	(revision )
@@ -1,66 +1,0 @@
-#if !defined(o_h)
-#define pearl_necklace_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = PearlNecklaceModel
- //[DISP_PARAMS] = radius, edge_separation
- //[DESCRIPTION] =<text>Calculate form factor for Pearl Necklace Model
-//				[Macromol. Symp. 2004, 211, 25-42]
- //				Parameters:
- //				background:background
- //				scale: scale factor
- //				sld_pearl: the SLD of the pearl spheres
- //	            sld_string: the SLD of the strings
- //				sld_solv: the SLD of the solvent
- //				num_pearls: number of the pearls
- //				radius: the radius of a pearl
- //				edge_separation: the length of string segment; surface to surface
- //				thick_string: thickness (ie, diameter) of the string
- //		</text>
- //[FIXED]=  <text>radius.width; edge_separation.width</text>
- //[NON_FITTABLE_PARAMS]= <text></text>
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-	double scale;
-    ///	radius [A]
-    //  [DEFAULT]=radius=80.0 [A]
-	double radius;
-	///	edge_separation
-	//  [DEFAULT]=edge_separation= 350 [A]
-	double edge_separation;
-	///	thick_string [A]
-	//  [DEFAULT]=thick_string= 2.5 [A]
-	double thick_string;
-	///	num_pearls
-	//  [DEFAULT]=num_pearls= 3
-	double num_pearls;
-	///	sld_pearl
-	//  [DEFAULT]=sld_pearl= 1.0e-06 [1/A^(2)]
-	double sld_pearl;
-	///	sld_string
-	//  [DEFAULT]=sld_string= 1.0e-06 [1/A^(2)]
-	double sld_string;
-	///	sld_solv
-	//  [DEFAULT]=sld_solv= 6.3e-06 [1/A^(2)]
-	double sld_solv;
-	/// Background
-	//  [DEFAULT]=background=0
-	double background;
-
-}PeralNecklaceParameters;
-
-double pearl_necklace_kernel(double dq[], double q);
-
-/// 1D scattering function
-double pearl_necklace_analytical_1D(PeralNecklaceParameters *pars, double q);
-
-/// 2D scattering function
-double pearl_necklace_analytical_2D(PeralNecklaceParameters *pars, double q, double phi);
-double pearl_necklace_analytical_2DXY(PeralNecklaceParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/polygausscoil.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/polygausscoil.h	(revision e369627df1a0b85dc6129d8e7ee7ed8fe1db27e9)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#if !defined(polygausscoil_h)
-#define polygausscoil_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = Poly_GaussCoil
- //[DISP_PARAMS] = rg
- //[DESCRIPTION] =<text>I(q)=(scale)*2*[(1+U*x)^(-1/U)+x-1]/[(1+U)*x^2] + background
- //				where x = [rg^2*q^2]
- //					and the polydispersity is
- //					U = [M_w/M_n]-1.
- //				scale = scale factor * volume fraction
- //				rg = radius of gyration
- //				poly_m = polydispersity of molecular weight
- //				background = incoherent background
- //		</text>
- //[FIXED]=
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	Radius of gyration [A]
-    //  [DEFAULT]=rg=60.0 [A]
-    double rg;
-
-    ///	polydispersity of molecular weight
-    //  [DEFAULT]=poly_m= 2.0 [Mw/Mn]
-    double poly_m;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.001 [1/cm]
-	double background;
-} PolyGaussCoilParameters;
-
-
-
-/// 1D scattering function
-//double polygausscoil_analytical_1D(PolyGaussCoilParameters *pars, double q);
-
-/// 2D scattering function
-//double polygausscoil_analytical_2D(PolyGaussCoilParameters *pars, double q, double phi);
-//double polygausscoil_analytical_2DXY(PolyGaussCoilParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/refl.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/refl.c	(revision 8ff5cb3da7d659c05ad4b1db717b521b4257953b)
+++ 	(revision )
@@ -1,215 +1,0 @@
-/**
- *  model for NR
- */
-// The original code, of which work was not DANSE funded,
-// was provided by J. Cho.
-#include <math.h>
-#include "refl.h"
-#include "libmultifunc/librefl.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-#define lamda 4.62
-
-
-double re_kernel(double dp[], double q) {
-	int n = dp[0];
-	int i,j;
-
-	double scale = dp[1];
-	double thick_inter_sub = dp[2];
-	double sld_sub = dp[4];
-	double sld_super = dp[5];
-	double background = dp[6];
-
-  double total_thick=0.0;
-  double nsl=21.0; //nsl = Num_sub_layer:
-  int n_s;
-  double sld_i,dz,phi,R,ko2;
-  double fun;
-  double pi;
-
-  double* sld;
-  double* thick_inter;
-  double* thick;
-  int*fun_type;
-  complex  phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,two,n_sub,n_sup,knp1,Xnp1;
-
-  sld = (double*)malloc((n+2)*sizeof(double));
-  thick_inter = (double*)malloc((n+2)*sizeof(double));
-  thick = (double*)malloc((n+2)*sizeof(double));
-  fun_type = (int*)malloc((n+2)*sizeof(int));
-
-  fun_type[0] = dp[3];
-	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];
-		total_thick += thick[i] + thick_inter[i];
-	}
-	sld[0] = sld_sub;
-	sld[n+1] = sld_super;
-
-	thick[0] = total_thick/5.0;
-	thick[n+1] = total_thick/5.0;
-	thick_inter[0] = thick_inter_sub;
-	thick_inter[n+1] = 0.0;
-
-	pi = 4.0*atan(1.0);
-  	Xn = cassign(0.0,0.0);
-  	one = cassign(1.0,0.0);
-	two = cassign(0.0,-2.0);
-
-	//Checking if floor is available.
-	//no imaginary sld inputs in this function yet
-    n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi),0.0);
-    n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi),0.0);
-    ko2 = pow(2.0*pi/lamda,2.0);
-
-    phi = asin(lamda*q/(4.0*pi));
-    phi1 = cplx_div(rcmult(phi,one),n_sup);
-    alpha = cplx_mult(n_sup,cplx_cos(phi1));
-	alpha2 = cplx_mult(alpha,alpha);
-
-    nnp1=n_sub;
-    knp1=cplx_sqrt(rcmult(ko2,cplx_sub(cplx_mult(nnp1,nnp1),alpha2)));  //nnp1*ko*sin(phinp1)
-    Xnp1=cassign(0.0,0.0);
-    dz = 0.0;
-    // iteration for # of layers +sub from the top
-    for (i=1;i<=n+1; i++){
-    	if (fun_type[i-1]==1)
-    		fun = 5;
-    	else
-			fun = 0;
-		//iteration for 9 sub-layers
-		for (j=0;j<2;j++){
-			for (n_s=0;n_s<nsl; n_s++){
-				if (j==1){
-					if (i==n+1)
-						break;
-					dz = thick[i];
-					sld_i = sld[i];
-				}
-				else{
-					dz = thick_inter[i-1]/nsl;//nsl;
-					if (sld[i-1] == sld[i]){
-						sld_i = sld[i];
-					}
-					else{
-						sld_i = intersldfunc(fun,nsl, n_s+0.5, 2.5, sld[i-1], sld[i]);
-					}
-				}
-				nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),0.0);
-				nn2=cplx_mult(nn,nn);
-
-				kn=cplx_sqrt(rcmult(ko2,cplx_sub(nn2,alpha2)));        //nn*ko*sin(phin)
-				an=cplx_exp(rcmult(dz,cplx_mult(two,kn)));
-
-				fnm=cplx_sub(kn,knp1);
-				fnp=cplx_add(kn,knp1);
-				rn=cplx_div(fnm,fnp);
-				Xn=cplx_mult(an,cplx_div(cplx_add(rn,Xnp1),cplx_add(one,cplx_mult(rn,Xnp1))));    //Xn=an*((rn+Xnp1*anp1)/(1+rn*Xnp1*anp1))
-
-				Xnp1=Xn;
-				knp1=kn;
-
-				if (j==1)
-					break;
-			}
-		}
-    }
-    R=pow(Xn.re,2.0)+pow(Xn.im,2.0);
-    // This temperarily fixes the total reflection for Rfunction and linear.
-    // ToDo: Show why it happens that Xn.re=0 and Xn.im >1!
-    if (Xn.im == 0.0){
-    	R=1.0;
-    }
-    R *= scale;
-    R += background;
-
-    free(sld);
-    free(thick_inter);
-    free(thick);
-    free(fun_type);
-
-    return R;
-
-}
-/**
- * Function to evaluate NR function
- * @param pars: parameters
- * @param q: q-value
- * @return: function value
- */
-double refl_analytical_1D(ReflParameters *pars, double q) {
-	double dp[47];
-
-	dp[0] = pars->n_layers;
-	dp[1] = pars->scale;
-	dp[2] = pars->thick_inter0;
-	dp[3] = pars->func_inter0;
-	dp[4] = pars->sld_bottom0;
-	dp[5] = pars->sld_medium;
-	dp[6] = pars->background;
-
-	dp[7] = pars->sld_flat1;
-	dp[8] = pars->sld_flat2;
-	dp[9] = pars->sld_flat3;
-	dp[10] = pars->sld_flat4;
-	dp[11] = pars->sld_flat5;
-	dp[12] = pars->sld_flat6;
-	dp[13] = pars->sld_flat7;
-	dp[14] = pars->sld_flat8;
-	dp[15] = pars->sld_flat9;
-	dp[16] = pars->sld_flat10;
-
-	dp[17] = pars->thick_inter1;
-	dp[18] = pars->thick_inter2;
-	dp[19] = pars->thick_inter3;
-	dp[20] = pars->thick_inter4;
-	dp[21] = pars->thick_inter5;
-	dp[22] = pars->thick_inter6;
-	dp[23] = pars->thick_inter7;
-	dp[24] = pars->thick_inter8;
-	dp[25] = pars->thick_inter9;
-	dp[26] = pars->thick_inter10;
-
-	dp[27] = pars->thick_flat1;
-	dp[28] = pars->thick_flat2;
-	dp[29] = pars->thick_flat3;
-	dp[30] = pars->thick_flat4;
-	dp[31] = pars->thick_flat5;
-	dp[32] = pars->thick_flat6;
-	dp[33] = pars->thick_flat7;
-	dp[34] = pars->thick_flat8;
-	dp[35] = pars->thick_flat9;
-	dp[36] = pars->thick_flat10;
-
-	dp[37] = pars->func_inter1;
-	dp[38] = pars->func_inter2;
-	dp[39] = pars->func_inter3;
-	dp[40] = pars->func_inter4;
-	dp[41] = pars->func_inter5;
-	dp[42] = pars->func_inter6;
-	dp[43] = pars->func_inter7;
-	dp[44] = pars->func_inter8;
-	dp[45] = pars->func_inter9;
-	dp[46] = pars->func_inter10;
-
-	return re_kernel(dp, q);
-}
-
-/**
- * Function to evaluate NR function
- * @param pars: parameters of NR
- * @param q: q-value
- * @return: function value
- */
-double refl_analytical_2D(ReflParameters *pars, double q, double phi) {
-	return refl_analytical_1D(pars,q);
-}
-
-double refl_analytical_2DXY(ReflParameters *pars, double qx, double qy){
-	return refl_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
Index: sansmodels/src/sans/models/c_extensions/refl.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/refl.h	(revision 0164899a491d20467a714225f7ea955c852265f3)
+++ 	(revision )
@@ -1,152 +1,0 @@
-// The original code, of which work was not DANSE funded,
-// was provided by J. Cho.
-#if !defined(o_h)
-#define refl_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = ReflModel
- //[DISP_PARAMS] = thick_inter0
- //[DESCRIPTION] =<text>Calculate neutron reflectivity using the Parratt iterative formula
- //				Parameters:
- //				background:background
- //				scale: scale factor
- //				sld_bottom0: the SLD of the substrate
- //				sld_medium: the SLD of the incident medium
- //					or superstrate
- //				sld_flatN: the SLD of the flat region of
- //					the N'th layer
- //				thick_flatN: the thickness of the flat
- //					region of the N'th layer
- //				func_interN: the function used to describe
- //					the interface of the N'th layer
- //				thick_interN: the thickness of the interface
- //					of the N'th layer
- //				Note: the layer number starts to increase
- //					from the bottom (substrate) to the top.
- //		</text>
- //[FIXED]=  <text></text>
- //[NON_FITTABLE_PARAMS]= <text>n_layers;func_inter0;func_inter1;func_inter2;func_inter3;func_inter4;func_inter5;func_inter5;func_inter7;func_inter8;func_inter9;func_inter10 </text>
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-	/// number of layers
-	//  [DEFAULT]=n_layers=1
-	int n_layers;
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-	double scale;
-    ///	thick_inter0 [A]
-    //  [DEFAULT]=thick_inter0=1.0 [A]
-	double thick_inter0;
-	///	func_inter0
-	//  [DEFAULT]=func_inter0= 0
-	double func_inter0;
-	///	sld_bottom0 [1/A^(2)]
-	//  [DEFAULT]=sld_bottom0= 2.07e-6 [1/A^(2)]
-	double sld_bottom0;
-	///	sld_medium [1/A^(2)]
-	//  [DEFAULT]=sld_medium= 1.0e-6 [1/A^(2)]
-	double sld_medium;
-	/// Background
-	//  [DEFAULT]=background=0
-	double background;
-
-    //  [DEFAULT]=sld_flat1=4.0e-06 [1/A^(2)]
-    double sld_flat1;
-    //  [DEFAULT]=sld_flat2=3.5e-06 [1/A^(2)]
-    double sld_flat2;
-    //  [DEFAULT]=sld_flat3=4.0e-06 [1/A^(2)]
-    double sld_flat3;
-    //  [DEFAULT]=sld_flat4=3.5e-06 [1/A^(2)]
-    double sld_flat4;
-    //  [DEFAULT]=sld_flat5=4.0e-06 [1/A^(2)]
-    double sld_flat5;
-    //  [DEFAULT]=sld_flat6=3.5e-06 [1/A^(2)]
-    double sld_flat6;
-    //  [DEFAULT]=sld_flat7=4.0e-06 [1/A^(2)]
-    double sld_flat7;
-    //  [DEFAULT]=sld_flat8=3.5e-06 [1/A^(2)]
-    double sld_flat8;
-    //  [DEFAULT]=sld_flat9=4.0e-06 [1/A^(2)]
-    double sld_flat9;
-    //  [DEFAULT]=sld_flat10=3.5e-06 [1/A^(2)]
-    double sld_flat10;
-
-    //  [DEFAULT]=thick_inter1=1 [A]
-    double thick_inter1;
-    //  [DEFAULT]=thick_inter2=1 [A]
-    double thick_inter2;
-    //  [DEFAULT]=thick_inter3=1 [A]
-    double thick_inter3;
-    //  [DEFAULT]=thick_inter4=1 [A]
-    double thick_inter4;
-    //  [DEFAULT]=thick_inter5=1 [A]
-    double thick_inter5;
-    //  [DEFAULT]=thick_inter6=1 [A]
-    double thick_inter6;
-    //  [DEFAULT]=thick_inter7=1 [A]
-    double thick_inter7;
-    //  [DEFAULT]=thick_inter8=1 [A]
-    double thick_inter8;
-    //  [DEFAULT]=thick_inter9=1 [A]
-    double thick_inter9;
-    //  [DEFAULT]=thick_inter10=1 [A]
-    double thick_inter10;
-
-    //  [DEFAULT]=thick_flat1=10 [A]
-    double thick_flat1;
-    //  [DEFAULT]=thick_flat2=100 [A]
-    double thick_flat2;
-    //  [DEFAULT]=thick_flat3=100 [A]
-    double thick_flat3;
-    //  [DEFAULT]=thick_flat4=100 [A]
-    double thick_flat4;
-    //  [DEFAULT]=thick_flat5=100 [A]
-    double thick_flat5;
-    //  [DEFAULT]=thick_flat6=100 [A]
-    double thick_flat6;
-    //  [DEFAULT]=thick_flat7=100 [A]
-    double thick_flat7;
-    //  [DEFAULT]=thick_flat8=100 [A]
-    double thick_flat8;
-    //  [DEFAULT]=thick_flat9=100 [A]
-    double thick_flat9;
-    //  [DEFAULT]=thick_flat10=100 [A]
-    double thick_flat10;
-
-    //  [DEFAULT]=func_inter1=0
-    double func_inter1;
-    //  [DEFAULT]=func_inter2=0
-    double func_inter2;
-    //  [DEFAULT]=func_inter3=0
-    double func_inter3;
-    //  [DEFAULT]=func_inter4=0
-    double func_inter4;
-    //  [DEFAULT]=func_inter5=0
-    double func_inter5;
-    //  [DEFAULT]=func_inter6=0
-    double func_inter6;
-    //  [DEFAULT]=func_inter7=0
-    double func_inter7;
-    //  [DEFAULT]=func_inter8=0
-    double func_inter8;
-    //  [DEFAULT]=func_inter9=0
-    double func_inter9;
-    //  [DEFAULT]=func_inter10=0
-    double func_inter10;
-
-
-} ReflParameters;
-
-double re_kernel(double dq[], double q);
-
-/// 1D scattering function
-double refl_analytical_1D(ReflParameters *pars, double q);
-
-/// 2D scattering function
-double refl_analytical_2D(ReflParameters *pars, double q, double phi);
-double refl_analytical_2DXY(ReflParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/refl_adv.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/refl_adv.c	(revision 8ff5cb3da7d659c05ad4b1db717b521b4257953b)
+++ 	(revision )
@@ -1,268 +1,0 @@
-// The original code, of which work was not DANSE funded,
-// was provided by J. Cho.
-/**
- * NR model Parratt method
- */
-#include <math.h>
-#include "refl_adv.h"
-#include "libmultifunc/librefl.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-#define lamda 4.62
-
-
-double re_adv_kernel(double dp[], double q) {
-	int n = dp[0];
-	int i,j;
-	double nsl;
-
-	double scale = dp[1];
-	double thick_inter_sub = dp[2];
-	double sld_sub = dp[4];
-	double sld_super = dp[5];
-	double background = dp[6];
-	double npts = dp[69]; //number of sub_layers in each interface
-
-	double total_thick=0.0;
-
-  int n_s;
-  double sld_i,sldim_i,dz,phi,R,ko2;
-  double pi;
-
-  int* fun_type;
-  double* sld;
-  double* sld_im;
-  double* thick_inter;
-  double* thick;
-  double* fun_coef;
-  complex  phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,two,n_sub,n_sup,knp1,Xnp1;
-
-  fun_type = (int*)malloc((n+2)*sizeof(int));
-  sld = (double*)malloc((n+2)*sizeof(double));
-  sld_im = (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));
-
-  fun_type[0] = dp[3];
-	fun_coef[0] = fabs(dp[70]);
-	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];
-		sld_im[i] = dp[i+46];
-		fun_coef[i] = fabs(dp[i+56]);
-		//printf("type_func2 =%g\n",fun_coef[i]);
-
-		total_thick += thick[i] + thick_inter[i];
-	}
-	sld[0] = sld_sub;
-	sld[n+1] = sld_super;
-	sld_im[0] = fabs(dp[1+66]);
-	sld_im[n+1] = fabs(dp[2+66]);
-	thick[0] = total_thick/5.0;
-	thick[n+1] = total_thick/5.0;
-	thick_inter[0] = thick_inter_sub;
-	thick_inter[n+1] = 0.0;
-	fun_coef[n+1] = 0.0;
-
-	nsl=npts;//21.0; //nsl = Num_sub_layer:  MUST ODD number in double //no other number works now
-
-	pi = 4.0*atan(1.0);
-    one = cassign(1.0,0.0);
-	Xn = cassign(0.0,0.0);
-	two = cassign(0.0,-2.0);
-
-	//Checking if floor is available.
-	//no imaginary sld inputs in this function yet
-    n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sld_im[0]);
-    n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sld_im[n+1]);
-    ko2 = pow(2.0*pi/lamda,2.0);
-
-    phi = asin(lamda*q/(4.0*pi));
-    phi1 = cplx_div(rcmult(phi,one),n_sup);
-    alpha = cplx_mult(n_sup,cplx_cos(phi1));
-	alpha2 = cplx_mult(alpha,alpha);
-
-    nnp1=n_sub;
-    knp1=cplx_sqrt(rcmult(ko2,cplx_sub(cplx_mult(nnp1,nnp1),alpha2)));  //nnp1*ko*sin(phinp1)
-    Xnp1=cassign(0.0,0.0);
-    dz = 0.0;
-    // iteration for # of layers +sub from the top
-    for (i=1;i<=n+1; i++){
-    	//if (fun_coef[i]==0.0)
-    	//	// this condition protects an error in numerical multiplication
-    	//	fun_coef[i] = 1e-14;
-		//iteration for 9 sub-layers
-		for (j=0;j<2;j++){
-			for (n_s=0;n_s<nsl; n_s++){
-				// for flat layer
-				if (j==1){
-					if (i==n+1)
-						break;
-					dz = thick[i];
-					sld_i = sld[i];
-					sldim_i = sld_im[i];
-				}
-				// for interface
-				else{
-					dz = thick_inter[i-1]/nsl;
-					if (sld[i-1] == sld[i]){
-						sld_i = sld[i];
-					}
-					else{
-						sld_i = intersldfunc(fun_type[i-1],nsl, n_s+0.5, fun_coef[i-1], sld[i-1], sld[i]);
-					}
-					if (sld_im[i-1] == sld_im[i]){
-						sldim_i = sld_im[i];
-					}
-					else{
-						sldim_i = intersldfunc(fun_type[i-1],nsl, n_s+0.5, fun_coef[i-1], sld_im[i-1], sld_im[i]);
-					}
-				}
-				nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sldim_i);
-				nn2=cplx_mult(nn,nn);
-
-				kn=cplx_sqrt(rcmult(ko2,cplx_sub(nn2,alpha2)));        //nn*ko*sin(phin)
-				an=cplx_exp(rcmult(dz,cplx_mult(two,kn)));
-
-				fnm=cplx_sub(kn,knp1);
-				fnp=cplx_add(kn,knp1);
-				rn=cplx_div(fnm,fnp);
-				Xn=cplx_mult(an,cplx_div(cplx_add(rn,Xnp1),cplx_add(one,cplx_mult(rn,Xnp1))));    //Xn=an*((rn+Xnp1*anp1)/(1+rn*Xnp1*anp1))
-
-				Xnp1=Xn;
-				knp1=kn;
-				// no for-loop for flat layer
-				if (j==1)
-					break;
-			}
-		}
-    }
-    R=pow(Xn.re,2.0)+pow(Xn.im,2.0);
-    // This temperarily fixes the total reflection for Rfunction and linear.
-    // ToDo: Show why it happens that Xn.re=0 and Xn.im >1!
-    if (Xn.im == 0.0 || R > 1){
-    	R=1.0;
-    }
-    R *= scale;
-    R += background;
-
-    free(fun_type);
-    free(sld);
-    free(sld_im);
-    free(thick_inter);
-    free(thick);
-    free(fun_coef);
-
-    return R;
-
-}
-
-/**
- * Function to evaluate NR function
- * @param pars: parameters of refl
- * @param q: q-value
- * @return: function value
- */
-
-double refl_adv_analytical_1D(ReflAdvParameters *pars, double q) {
-	double dp[71];
-
-	dp[0] = pars->n_layers;
-	dp[1] = pars->scale;
-	dp[2] = pars->thick_inter0;
-	dp[3] = pars->func_inter0;
-	dp[4] = pars->sld_bottom0;
-	dp[5] = pars->sld_medium;
-	dp[6] = pars->background;
-
-	dp[7] = pars->sld_flat1;
-	dp[8] = pars->sld_flat2;
-	dp[9] = pars->sld_flat3;
-	dp[10] = pars->sld_flat4;
-	dp[11] = pars->sld_flat5;
-	dp[12] = pars->sld_flat6;
-	dp[13] = pars->sld_flat7;
-	dp[14] = pars->sld_flat8;
-	dp[15] = pars->sld_flat9;
-	dp[16] = pars->sld_flat10;
-
-	dp[17] = pars->thick_inter1;
-	dp[18] = pars->thick_inter2;
-	dp[19] = pars->thick_inter3;
-	dp[20] = pars->thick_inter4;
-	dp[21] = pars->thick_inter5;
-	dp[22] = pars->thick_inter6;
-	dp[23] = pars->thick_inter7;
-	dp[24] = pars->thick_inter8;
-	dp[25] = pars->thick_inter9;
-	dp[26] = pars->thick_inter10;
-
-	dp[27] = pars->thick_flat1;
-	dp[28] = pars->thick_flat2;
-	dp[29] = pars->thick_flat3;
-	dp[30] = pars->thick_flat4;
-	dp[31] = pars->thick_flat5;
-	dp[32] = pars->thick_flat6;
-	dp[33] = pars->thick_flat7;
-	dp[34] = pars->thick_flat8;
-	dp[35] = pars->thick_flat9;
-	dp[36] = pars->thick_flat10;
-
-	dp[37] = pars->func_inter1;
-	dp[38] = pars->func_inter2;
-	dp[39] = pars->func_inter3;
-	dp[40] = pars->func_inter4;
-	dp[41] = pars->func_inter5;
-	dp[42] = pars->func_inter6;
-	dp[43] = pars->func_inter7;
-	dp[44] = pars->func_inter8;
-	dp[45] = pars->func_inter9;
-	dp[46] = pars->func_inter10;
-
-	dp[47] = pars->sldIM_flat1;
-	dp[48] = pars->sldIM_flat2;
-	dp[49] = pars->sldIM_flat3;
-	dp[50] = pars->sldIM_flat4;
-	dp[51] = pars->sldIM_flat5;
-	dp[52] = pars->sldIM_flat6;
-	dp[53] = pars->sldIM_flat7;
-	dp[54] = pars->sldIM_flat8;
-	dp[55] = pars->sldIM_flat9;
-	dp[56] = pars->sldIM_flat10;
-
-	dp[57] = pars->nu_inter1;
-	dp[58] = pars->nu_inter2;
-	dp[59] = pars->nu_inter3;
-	dp[60] = pars->nu_inter4;
-	dp[61] = pars->nu_inter5;
-	dp[62] = pars->nu_inter6;
-	dp[63] = pars->nu_inter7;
-	dp[64] = pars->nu_inter8;
-	dp[65] = pars->nu_inter9;
-	dp[66] = pars->nu_inter10;
-
-	dp[67] = pars->sldIM_sub0;
-	dp[68] = pars->sldIM_medium;
-	dp[69] = pars->npts_inter;
-	dp[70] = pars->nu_inter0;
-
-	return re_adv_kernel(dp, q);
-}
-
-/**
- * Function to evaluate NR function
- * @param pars: parameters of NR
- * @param q: q-value
- * @return: function value
- */
-double refl_adv_analytical_2D(ReflAdvParameters *pars, double q, double phi) {
-	return refl_adv_analytical_1D(pars,q);
-}
-
-double refl_adv_analytical_2DXY(ReflAdvParameters *pars, double qx, double qy){
-	return refl_adv_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
Index: sansmodels/src/sans/models/c_extensions/refl_adv.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/refl_adv.h	(revision 96656e3ad6cdb9f8256e2118c60bac29635136af)
+++ 	(revision )
@@ -1,203 +1,0 @@
-// The original code, of which work was not DANSE funded,
-// was provided by J. Cho.
-#if !defined(o_h)
-#define refl_adv_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = ReflAdvModel
- //[DISP_PARAMS] = thick_inter0
- //[DESCRIPTION] =<text>Calculate neutron reflectivity using the Parratt iterative formula
- //				Parameters:
- //				background:background
- //				scale: scale factor
- //				sld_bottom0: the SLD of the substrate
- //				sld_medium: the SLD of the incident medium
- //					or superstrate
- //				sld_flatN: the SLD of the flat region of
- //					the N'th layer
- //				thick_flatN: the thickness of the flat
- //					region of the N'th layer
- //				func_interN: the function used to describe
- //					the interface of the N'th layer
- //				nu_interN: the coefficient for the func_interN
- //				thick_interN: the thickness of the interface
- //					of the N'th layer
- //				Note: the layer number starts to increase
- //					from the bottom (substrate) to the top.
- //		</text>
- //[FIXED]=  <text></text>
- //[NON_FITTABLE_PARAMS]= <text>n_layers;func_inter0;func_inter1;func_inter2;func_inter3;func_inter4;func_inter5;func_inter5;func_inter7;func_inter8;func_inter9;func_inter10 </text>
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-	/// number of layers
-	//  [DEFAULT]=n_layers=1
-	int n_layers;
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-	double scale;
-    ///	thick_inter0 [A]
-    //  [DEFAULT]=thick_inter0=50.0 [A]
-	double thick_inter0;
-	///	func_inter0
-	//  [DEFAULT]=func_inter0= 0
-	double func_inter0;
-	///	sld_bottom0 [1/A^(2)]
-	//  [DEFAULT]=sld_bottom0= 2.07e-6 [1/A^(2)]
-	double sld_bottom0;
-	///	sld_medium [1/A^(2)]
-	//  [DEFAULT]=sld_medium= 1.0e-6 [1/A^(2)]
-	double sld_medium;
-	/// Background
-	//  [DEFAULT]=background=0
-	double background;
-
-    //  [DEFAULT]=sld_flat1=4.0e-06 [1/A^(2)]
-    double sld_flat1;
-    //  [DEFAULT]=sld_flat2=3.5e-06 [1/A^(2)]
-    double sld_flat2;
-    //  [DEFAULT]=sld_flat3=4.0e-06 [1/A^(2)]
-    double sld_flat3;
-    //  [DEFAULT]=sld_flat4=3.5e-06 [1/A^(2)]
-    double sld_flat4;
-    //  [DEFAULT]=sld_flat5=4.0e-06 [1/A^(2)]
-    double sld_flat5;
-    //  [DEFAULT]=sld_flat6=3.5e-06 [1/A^(2)]
-    double sld_flat6;
-    //  [DEFAULT]=sld_flat7=4.0e-06 [1/A^(2)]
-    double sld_flat7;
-    //  [DEFAULT]=sld_flat8=3.5e-06 [1/A^(2)]
-    double sld_flat8;
-    //  [DEFAULT]=sld_flat9=4.0e-06 [1/A^(2)]
-    double sld_flat9;
-    //  [DEFAULT]=sld_flat10=3.5e-06 [1/A^(2)]
-    double sld_flat10;
-
-    //  [DEFAULT]=thick_inter1=50 [A]
-    double thick_inter1;
-    //  [DEFAULT]=thick_inter2=50 [A]
-    double thick_inter2;
-    //  [DEFAULT]=thick_inter3=50 [A]
-    double thick_inter3;
-    //  [DEFAULT]=thick_inter4=50 [A]
-    double thick_inter4;
-    //  [DEFAULT]=thick_inter5=50 [A]
-    double thick_inter5;
-    //  [DEFAULT]=thick_inter6=50 [A]
-    double thick_inter6;
-    //  [DEFAULT]=thick_inter7=50 [A]
-    double thick_inter7;
-    //  [DEFAULT]=thick_inter8=50 [A]
-    double thick_inter8;
-    //  [DEFAULT]=thick_inter9=50 [A]
-    double thick_inter9;
-    //  [DEFAULT]=thick_inter10=50 [A]
-    double thick_inter10;
-
-    //  [DEFAULT]=thick_flat1=100 [A]
-    double thick_flat1;
-    //  [DEFAULT]=thick_flat2=100 [A]
-    double thick_flat2;
-    //  [DEFAULT]=thick_flat3=100 [A]
-    double thick_flat3;
-    //  [DEFAULT]=thick_flat4=100 [A]
-    double thick_flat4;
-    //  [DEFAULT]=thick_flat5=100 [A]
-    double thick_flat5;
-    //  [DEFAULT]=thick_flat6=100 [A]
-    double thick_flat6;
-    //  [DEFAULT]=thick_flat7=100 [A]
-    double thick_flat7;
-    //  [DEFAULT]=thick_flat8=100 [A]
-    double thick_flat8;
-    //  [DEFAULT]=thick_flat9=100 [A]
-    double thick_flat9;
-    //  [DEFAULT]=thick_flat10=100 [A]
-    double thick_flat10;
-
-    //  [DEFAULT]=func_inter1=0
-    double func_inter1;
-    //  [DEFAULT]=func_inter2=0
-    double func_inter2;
-    //  [DEFAULT]=func_inter3=0
-    double func_inter3;
-    //  [DEFAULT]=func_inter4=0
-    double func_inter4;
-    //  [DEFAULT]=func_inter5=0
-    double func_inter5;
-    //  [DEFAULT]=func_inter6=0
-    double func_inter6;
-    //  [DEFAULT]=func_inter7=0
-    double func_inter7;
-    //  [DEFAULT]=func_inter8=0
-    double func_inter8;
-    //  [DEFAULT]=func_inter9=0
-    double func_inter9;
-    //  [DEFAULT]=func_inter10=0
-    double func_inter10;
-
-    //  [DEFAULT]=sldIM_flat1=0 [1/A^(2)]
-    double sldIM_flat1;
-    //  [DEFAULT]=sldIM_flat2=0 [1/A^(2)]
-    double sldIM_flat2;
-    //  [DEFAULT]=sldIM_flat3=0 [1/A^(2)]
-    double sldIM_flat3;
-    //  [DEFAULT]=sldIM_flat4=0 [1/A^(2)]
-    double sldIM_flat4;
-    //  [DEFAULT]=sldIM_flat5=0 [1/A^(2)]
-    double sldIM_flat5;
-    //  [DEFAULT]=sldIM_flat6=0 [1/A^(2)]
-    double sldIM_flat6;
-    //  [DEFAULT]=sldIM_flat7=0 [1/A^(2)]
-    double sldIM_flat7;
-    //  [DEFAULT]=sldIM_flat8=0 [1/A^(2)]
-    double sldIM_flat8;
-    //  [DEFAULT]=sldIM_flat9=0 [1/A^(2)]
-    double sldIM_flat9;
-    //  [DEFAULT]=sldIM_flat10=0 [1/A^(2)]
-    double sldIM_flat10;
-
-    //  [DEFAULT]=nu_inter1=2.5
-    double nu_inter1;
-    //  [DEFAULT]=nu_inter2=2.5
-    double nu_inter2;
-    //  [DEFAULT]=nu_inter3=2.5
-    double nu_inter3;
-    //  [DEFAULT]=nu_inter4=2.5
-    double nu_inter4;
-    //  [DEFAULT]=nu_inter5=2.5
-    double nu_inter5;
-    //  [DEFAULT]=nu_inter6=2.5
-    double nu_inter6;
-    //  [DEFAULT]=nu_inter7=2.5
-    double nu_inter7;
-    //  [DEFAULT]=nu_inter8=2.5
-    double nu_inter8;
-    //  [DEFAULT]=nu_inter9=2.5
-    double nu_inter9;
-    //  [DEFAULT]=nu_inter10=2.5
-    double nu_inter10;
-
-
-    //  [DEFAULT]=sldIM_sub0=0
-    double sldIM_sub0;
-    //  [DEFAULT]=sldIM_medium=0
-    double sldIM_medium;
-    //  [DEFAULT]=npts_inter=21.0
-    double npts_inter;
-    //  [DEFAULT]=nu_inter0=2.5
-    double nu_inter0;
-} ReflAdvParameters;
-
-double re_adv_kernel(double dq[], double q);
-
-/// 1D scattering function
-double refl_adv_analytical_1D(ReflAdvParameters *pars, double q);
-
-/// 2D scattering function
-double refl_adv_analytical_2D(ReflAdvParameters *pars, double q, double phi);
-double refl_adv_analytical_2DXY(ReflAdvParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/rpa.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/rpa.c	(revision 839f7e28c011deb396c95d09a5783cbe57a2083b)
+++ 	(revision )
@@ -1,463 +1,0 @@
-/**
- * Scattering model for multiblock copolymer
- * The below rpa_kernel is modified to fit on 'C'
- * originated from a IgorProcedure by B. HAMMOUDA, NIST, JULY 1998,
- * and it was tried to keep it as original as possible: JHCho (10/05/10)
- */
-#include <math.h>
-#include "rpa.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-double rpa_kernel(double dp[], double q) {
-	int lCASE = dp[0];
-
-	double Na,Nb,Nc,Nd,Nab,Nac,Nad,Nbc,Nbd,Ncd;
-	double Phia,Phib,Phic,Phid,Phiab,Phiac,Phiad;
-	double Phibc,Phibd,Phicd;
-	double va,vb,vc,vd,vab,vac,vad,vbc,vbd,vcd;
-	double m;
-	double ba,bb,bc,bd;
-	double Xa,Xb,Xc,Xd;
-	double Paa,S0aa,Pab,S0ab,Pac,S0ac,Pad,S0ad;
-	double S0ba,Pbb,S0bb,Pbc,S0bc,Pbd,S0bd;
-	double S0ca,S0cb,Pcc,S0cc,Pcd,S0cd;
-	double S0da,S0db,S0dc,Pdd,S0dd;
-	double Kaa,Kab,Kac,Kad,Kba,Kbb,Kbc,Kbd;
-	double Kca,Kcb,Kcc,Kcd,Kda,Kdb,Kdc,Kdd;
-	double Zaa,Zab,Zac,Zba,Zbb,Zbc,Zca,Zcb,Zcc;
-	double DenT,T11,T12,T13,T21,T22,T23,T31,T32,T33;
-	double Y1,Y2,Y3,X11,X12,X13,X21,X22,X23,X31,X32,X33;
-	double ZZ,DenQ1,DenQ2,DenQ3,DenQ,Q11,Q12,Q13,Q21,Q22,Q23,Q31,Q32,Q33;
-	double N11,N12,N13,N21,N22,N23,N31,N32,N33;
-	double M11,M12,M13,M21,M22,M23,M31,M32,M33;
-	double S11,S12,S13,S14,S21,S22,S23,S24;
-	double S31,S32,S33,S34,S41,S42,S43,S44;
-	double La,Lb,Lc,Ld,Lad,Lbd,Lcd,Nav,Intg;
-	double scale, background;
-
-	int ii=13;	//dp[ii<13] = fittable, else fixed
-
-	Na=1000.0;
-	Nb=1000.0;
-	Nc=1000.0;
-	Nd=1000.0;	//DEGREE OF POLYMERIZATION
-	Phia=0.25;
-	Phib=0.25;
-	Phic=0.25;
-	Phid=0.25 ;	//VOL FRACTION
-	Kab=-0.0004;
-	Kac=-0.0004;
-	Kad=-0.0004;	//CHI PARAM
-	Kbc=-0.0004;
-	Kbd=-0.0004;
-	Kcd=-0.0004;
-	La=1.0e-12;
-	Lb=1.0e-12;
-	Lc=1.0e-12;
-	Ld=0.0e-12; 	//SCATT. LENGTH
-	va=100.0;
-	vb=100.0;
-	vc=100.0;
-	vd=100.0	;	//SPECIFIC VOLUME
-	ba=5.0;
-	bb=5.0;
-	bc=5.0;
-	bd=5.0;		//SEGMENT LENGTH
-
-	//lCASE was shifted to N-1 from the original code
-	if (lCASE <= 1){
-		Phia=0.0000001;
-		Phib=0.0000001;
-		Phic=0.5;
-		Phid=0.5;
-		Nc=dp[ii+8];
-		Phic=dp[ii+9];
-		vc=dp[ii+10];
-		Lc=dp[ii+11];
-		bc=dp[3];
-		Nd=dp[ii+12];
-		Phid=dp[ii+13];
-		vd=dp[ii+14];
-		Ld=dp[ii+15];
-		bd=dp[4];
-		Kcd=dp[10];
-		scale=dp[11];
-		background=dp[12];
-	}
-	else if ((lCASE > 1) && (lCASE <= 4)){
-		Phia=0.0000001;
-		Phib=0.333333;
-		Phic=0.333333;
-		Phid=0.333333;
-		Nb=dp[ii+4];
-		Phib=dp[ii+5];
-		vb=dp[ii+6];
-		Lb=dp[ii+7];
-		bb=dp[2];
-		Nc=dp[ii+8];
-		Phic=dp[ii+9];
-		vc=dp[ii+10];
-		Lc=dp[ii+11];
-		bc=dp[3];
-		Nd=dp[ii+12];
-		Phid=dp[ii+13];
-		vd=dp[ii+14];
-		Ld=dp[ii+15];
-		bd=dp[4];
-		Kbc=dp[8];
-		Kbd=dp[9];
-		Kcd=dp[10];
-		scale=dp[11];
-		background=dp[12];
-	}
-	else {
-		Phia=0.25;
-		Phib=0.25;
-		Phic=0.25;
-		Phid=0.25;
-		Na=dp[ii+0];
-		Phia=dp[ii+1];
-		va=dp[ii+2];
-		La=dp[ii+3];
-		ba=dp[1];
-		Nb=dp[ii+4];
-		Phib=dp[ii+5];
-		vb=dp[ii+6];
-		Lb=dp[ii+7];
-		bb=dp[2];
-		Nc=dp[ii+8];
-		Phic=dp[ii+9];
-		vc=dp[ii+10];
-		Lc=dp[ii+11];
-		bc=dp[3];
-		Nd=dp[ii+12];
-		Phid=dp[ii+13];
-		vd=dp[ii+14];
-		Ld=dp[ii+15];
-		bd=dp[4];
-		Kab=dp[5];
-		Kac=dp[6];
-		Kad=dp[7];
-		Kbc=dp[8];
-		Kbd=dp[9];
-		Kcd=dp[10];
-		scale=dp[11];
-		background=dp[12];
-	}
-
-	Nab=pow((Na*Nb),(0.5));
-	Nac=pow((Na*Nc),(0.5));
-	Nad=pow((Na*Nd),(0.5));
-	Nbc=pow((Nb*Nc),(0.5));
-	Nbd=pow((Nb*Nd),(0.5));
-	Ncd=pow((Nc*Nd),(0.5));
-
-	vab=pow((va*vb),(0.5));
-	vac=pow((va*vc),(0.5));
-	vad=pow((va*vd),(0.5));
-	vbc=pow((vb*vc),(0.5));
-	vbd=pow((vb*vd),(0.5));
-	vcd=pow((vc*vd),(0.5));
-
-	Phiab=pow((Phia*Phib),(0.5));
-	Phiac=pow((Phia*Phic),(0.5));
-	Phiad=pow((Phia*Phid),(0.5));
-	Phibc=pow((Phib*Phic),(0.5));
-	Phibd=pow((Phib*Phid),(0.5));
-	Phicd=pow((Phic*Phid),(0.5));
-
-	Xa=q*q*ba*ba*Na/6.0;
-	Xb=q*q*bb*bb*Nb/6.0;
-	Xc=q*q*bc*bb*Nc/6.0;
-	Xd=q*q*bd*bb*Nd/6.0;
-
-	Paa=2.0*(exp(-Xa)-1.0+Xa)/pow(Xa,2.0);
-	S0aa=Na*Phia*va*Paa;
-	Pab=((1.0-exp(-Xa))/Xa)*((1.0-exp(-Xb))/Xb);
-	S0ab=(Phiab*vab*Nab)*Pab;
-	Pac=((1.0-exp(-Xa))/Xa)*exp(-Xb)*((1.0-exp(-Xc))/Xc);
-	S0ac=(Phiac*vac*Nac)*Pac;
-	Pad=((1.0-exp(-Xa))/Xa)*exp(-Xb-Xc)*((1.0-exp(-Xd))/Xd);
-	S0ad=(Phiad*vad*Nad)*Pad;
-
-	S0ba=S0ab;
-	Pbb=2.0*(exp(-Xb)-1.0+Xb)/pow(Xb,2.0);
-	S0bb=Nb*Phib*vb*Pbb;
-	Pbc=((1.0-exp(-Xb))/Xb)*((1.0-exp(-Xc))/Xc);
-	S0bc=(Phibc*vbc*Nbc)*Pbc;
-	Pbd=((1.0-exp(-Xb))/Xb)*exp(-Xc)*((1.0-exp(-Xd))/Xd);
-	S0bd=(Phibd*vbd*Nbd)*Pbd;
-
-	S0ca=S0ac;
-	S0cb=S0bc;
-	Pcc=2.0*(exp(-Xc)-1.0+Xc)/pow(Xc,2.0);
-	S0cc=Nc*Phic*vc*Pcc;
-	Pcd=((1.0-exp(-Xc))/Xc)*((1.0-exp(-Xd))/Xd);
-	S0cd=(Phicd*vcd*Ncd)*Pcd;
-
-	S0da=S0ad;
-	S0db=S0bd;
-	S0dc=S0cd;
-	Pdd=2.0*(exp(-Xd)-1.0+Xd)/pow(Xd,2.0);
-	S0dd=Nd*Phid*vd*Pdd;
-	//lCASE was shifted to N-1 from the original code
-	switch(lCASE){
-		case 0:
-			S0aa=0.000001;
-			S0ab=0.000002;
-			S0ac=0.000003;
-			S0ad=0.000004;
-			S0bb=0.000005;
-			S0bc=0.000006;
-			S0bd=0.000007;
-			S0cd=0.000008;
-			break;
-		case 1:
-			S0aa=0.000001;
-			S0ab=0.000002;
-			S0ac=0.000003;
-			S0ad=0.000004;
-			S0bb=0.000005;
-			S0bc=0.000006;
-			S0bd=0.000007;
-			break;
-		case 2:
-			S0aa=0.000001;
-			S0ab=0.000002;
-			S0ac=0.000003;
-			S0ad=0.000004;
-			S0bc=0.000005;
-			S0bd=0.000006;
-			S0cd=0.000007;
-			break;
-		case 3:
-			S0aa=0.000001;
-			S0ab=0.000002;
-			S0ac=0.000003;
-			S0ad=0.000004;
-			S0bc=0.000005;
-			S0bd=0.000006;
-			break;
-		case 4:
-			S0aa=0.000001;
-			S0ab=0.000002;
-			S0ac=0.000003;
-			S0ad=0.000004;
-			break;
-		case 5:
-			S0ab=0.000001;
-			S0ac=0.000002;
-			S0ad=0.000003;
-			S0bc=0.000004;
-			S0bd=0.000005;
-			S0cd=0.000006;
-			break;
-		case 6:
-			S0ab=0.000001;
-			S0ac=0.000002;
-			S0ad=0.000003;
-			S0bc=0.000004;
-			S0bd=0.000005;
-			break;
-		case 7:
-			S0ab=0.000001;
-			S0ac=0.000002;
-			S0ad=0.000003;
-			break;
-		case 8:
-			S0ac=0.000001;
-			S0ad=0.000002;
-			S0bc=0.000003;
-			S0bd=0.000004;
-			break;
-		default : //case 9:
-			break;
-	}
-	S0ba=S0ab;
-	S0ca=S0ac;
-	S0cb=S0bc;
-	S0da=S0ad;
-	S0db=S0bd;
-	S0dc=S0cd;
-
-	Kaa=0.0;
-	Kbb=0.0;
-	Kcc=0.0;
-	Kdd=0.0;
-
-	Kba=Kab;
-	Kca=Kac;
-	Kcb=Kbc;
-	Kda=Kad;
-	Kdb=Kbd;
-	Kdc=Kcd;
-
-	Zaa=Kaa-Kad-Kad;
-	Zab=Kab-Kad-Kbd;
-	Zac=Kac-Kad-Kcd;
-	Zba=Kba-Kbd-Kad;
-	Zbb=Kbb-Kbd-Kbd;
-	Zbc=Kbc-Kbd-Kcd;
-	Zca=Kca-Kcd-Kad;
-	Zcb=Kcb-Kcd-Kbd;
-	Zcc=Kcc-Kcd-Kcd;
-
-	DenT=(-(S0ac*S0bb*S0ca) + S0ab*S0bc*S0ca + S0ac*S0ba*S0cb - S0aa*S0bc*S0cb - S0ab*S0ba*S0cc + S0aa*S0bb*S0cc);
-
-	T11= (-(S0bc*S0cb) + S0bb*S0cc)/DenT;
-	T12= (S0ac*S0cb - S0ab*S0cc)/DenT;
-	T13= (-(S0ac*S0bb) + S0ab*S0bc)/DenT;
-	T21= (S0bc*S0ca - S0ba*S0cc)/DenT;
-	T22= (-(S0ac*S0ca) + S0aa*S0cc)/DenT;
-	T23= (S0ac*S0ba - S0aa*S0bc)/DenT;
-	T31= (-(S0bb*S0ca) + S0ba*S0cb)/DenT;
-	T32= (S0ab*S0ca - S0aa*S0cb)/DenT;
-	T33= (-(S0ab*S0ba) + S0aa*S0bb)/DenT;
-
-	Y1=T11*S0ad+T12*S0bd+T13*S0cd+1.0;
-	Y2=T21*S0ad+T22*S0bd+T23*S0cd+1.0;
-	Y3=T31*S0ad+T32*S0bd+T33*S0cd+1.0;
-
-	X11=Y1*Y1;
-	X12=Y1*Y2;
-	X13=Y1*Y3;
-	X21=Y2*Y1;
-	X22=Y2*Y2;
-	X23=Y2*Y3;
-	X31=Y3*Y1;
-	X32=Y3*Y2;
-	X33=Y3*Y3;
-
-	ZZ=S0ad*(T11*S0ad+T12*S0bd+T13*S0cd)+S0bd*(T21*S0ad+T22*S0bd+T23*S0cd)+S0cd*(T31*S0ad+T32*S0bd+T33*S0cd);
-
-	m=1.0/(S0dd-ZZ);
-
-	N11=m*X11+Zaa;
-	N12=m*X12+Zab;
-	N13=m*X13+Zac;
-	N21=m*X21+Zba;
-	N22=m*X22+Zbb;
-	N23=m*X23+Zbc;
-	N31=m*X31+Zca;
-	N32=m*X32+Zcb;
-	N33=m*X33+Zcc;
-
-	M11= N11*S0aa + N12*S0ab + N13*S0ac;
-	M12= N11*S0ab + N12*S0bb + N13*S0bc;
-	M13= N11*S0ac + N12*S0bc + N13*S0cc;
-	M21= N21*S0aa + N22*S0ab + N23*S0ac;
-	M22= N21*S0ab + N22*S0bb + N23*S0bc;
-	M23= N21*S0ac + N22*S0bc + N23*S0cc;
-	M31= N31*S0aa + N32*S0ab + N33*S0ac;
-	M32= N31*S0ab + N32*S0bb + N33*S0bc;
-	M33= N31*S0ac + N32*S0bc + N33*S0cc;
-
-	DenQ1=1.0+M11-M12*M21+M22+M11*M22-M13*M31-M13*M22*M31;
-	DenQ2=	M12*M23*M31+M13*M21*M32-M23*M32-M11*M23*M32+M33+M11*M33;
-	DenQ3=	-M12*M21*M33+M22*M33+M11*M22*M33;
-	DenQ=DenQ1+DenQ2+DenQ3;
-
-	Q11= (1.0 + M22-M23*M32 + M33 + M22*M33)/DenQ;
-	Q12= (-M12 + M13*M32 - M12*M33)/DenQ;
-	Q13= (-M13 - M13*M22 + M12*M23)/DenQ;
-	Q21= (-M21 + M23*M31 - M21*M33)/DenQ;
-	Q22= (1.0 + M11 - M13*M31 + M33 + M11*M33)/DenQ;
-	Q23= (M13*M21 - M23 - M11*M23)/DenQ;
-	Q31= (-M31 - M22*M31 + M21*M32)/DenQ;
-	Q32= (M12*M31 - M32 - M11*M32)/DenQ;
-	Q33= (1.0 + M11 - M12*M21 + M22 + M11*M22)/DenQ;
-
-	S11= Q11*S0aa + Q21*S0ab + Q31*S0ac;
-	S12= Q12*S0aa + Q22*S0ab + Q32*S0ac;
-	S13= Q13*S0aa + Q23*S0ab + Q33*S0ac;
-	S14=-S11-S12-S13;
-	S21= Q11*S0ba + Q21*S0bb + Q31*S0bc;
-	S22= Q12*S0ba + Q22*S0bb + Q32*S0bc;
-	S23= Q13*S0ba + Q23*S0bb + Q33*S0bc;
-	S24=-S21-S22-S23;
-	S31= Q11*S0ca + Q21*S0cb + Q31*S0cc;
-	S32= Q12*S0ca + Q22*S0cb + Q32*S0cc;
-	S33= Q13*S0ca + Q23*S0cb + Q33*S0cc;
-	S34=-S31-S32-S33;
-	S41=S14;
-	S42=S24;
-	S43=S34;
-	S44=S11+S22+S33+2.0*S12+2.0*S13+2.0*S23;
-
-	Nav=6.022045e+23;
-	Lad=(La/va-Ld/vd)*sqrt(Nav);
-	Lbd=(Lb/vb-Ld/vd)*sqrt(Nav);
-	Lcd=(Lc/vc-Ld/vd)*sqrt(Nav);
-
-	Intg=pow(Lad,2.0)*S11+pow(Lbd,2.0)*S22+pow(Lcd,2.0)*S33+2.0*Lad*Lbd*S12+2.0*Lbd*Lcd*S23+2.0*Lad*Lcd*S13;
-
-	Intg *= scale;
-	Intg += background;
-
-    return Intg;
-
-}
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @return: function value
- */
-double rpa_analytical_1D(RPAParameters *pars, double q) {
-	double dp[29];
-	//Fittable parameters
-	dp[0] = pars->lcase_n;
-
-	dp[1] = pars->ba;
-	dp[2] = pars->bb;
-	dp[3] = pars->bc;
-	dp[4] = pars->bd;
-
-	dp[5] = pars->Kab;
-	dp[6] = pars->Kac;
-	dp[7] = pars->Kad;
-	dp[8] = pars->Kbc;
-	dp[9] = pars->Kbd;
-	dp[10] = pars->Kcd;
-
-	dp[11] = pars->scale;
-	dp[12] = pars->background;
-
-	//Fixed parameters
-	dp[13] = pars->Na;
-	dp[14] = pars->Phia;
-	dp[15] = pars->va;
-	dp[16] = pars->La;
-
-	dp[17] = pars->Nb;
-	dp[18] = pars->Phib;
-	dp[19] = pars->vb;
-	dp[20] = pars->Lb;
-
-	dp[21] = pars->Nc;
-	dp[22] = pars->Phic;
-	dp[23] = pars->vc;
-	dp[24] = pars->Lc;
-
-	dp[25] = pars->Nd;
-	dp[26] = pars->Phid;
-	dp[27] = pars->vd;
-	dp[28] = pars->Ld;
-
-	return rpa_kernel(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @return: function value
- */
-double rpa_analytical_2D(RPAParameters *pars, double q, double phi) {
-	return rpa_analytical_1D(pars,q);
-}
-
-double rpa_analytical_2DXY(RPAParameters *pars, double qx, double qy){
-	return rpa_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
Index: sansmodels/src/sans/models/c_extensions/rpa.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/rpa.h	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ 	(revision )
@@ -1,138 +1,0 @@
-#if !defined(o_h)
-#define rpa_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = RPAModel
- //[DISP_PARAMS] = background
- //[DESCRIPTION] =<text>  THIS FORMALISM APPLIES TO MULTICOMPONENT POLYMER MIXTURES IN THE
- //							HOMOGENEOUS (MIXED) PHASE REGION ONLY.;
- //							CASE 0: C/D BINARY MIXTURE OF HOMOPOLYMERS
- //							CASE 1: C-D DIBLOCK COPOLYMER
- //							CASE 2: B/C/D TERNARY MIXTURE OF HOMOPOLYMERS
- //							CASE 3: B/C-D MIXTURE OF HOMOPOLYMER B AND
- //								DIBLOCK COPOLYMER C-D
- //							CASE 4: B-C-D TRIBLOCK COPOLYMER
- //							CASE 5: A/B/C/D QUATERNARY MIXTURE OF HOMOPOLYMERS
- //							CASE 6: A/B/C-D MIXTURE OF TWO HOMOPOLYMERS A/B
- //								AND A DIBLOCK C-D
- //							CASE 7: A/B-C-D MIXTURE OF A HOMOPOLYMER A AND A
- //								TRIBLOCK B-C-D
- //							CASE 8: A-B/C-D MIXTURE OF TWO DIBLOCK COPOLYMERS
- //								A-B AND C-D
- //							CASE 9: A-B-C-D FOUR-BLOCK COPOLYMER
- //							See details in the model function help
- //		</text>
- //[FIXED]=  <text></text>
- //[NON_FITTABLE_PARAMS]= <text> lcase_n; Na; Phia; va; La; Nb; Phib; vb; Lb;Nc; Phic; vc; Lc;Nd; Phid; vd; Ld; </text>
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-	/// The Case number
-	//  [DEFAULT]=lcase_n=0
-	int lcase_n;
-
-    /// Segment Length ba
-    //  [DEFAULT]=ba= 5.0
-	double ba;
-	/// Segment Length bb
-    //  [DEFAULT]=bb=5.0
-	double bb;
-	/// Segment Length bc
-	//  [DEFAULT]=bc= 5.0
-	double bc;
-	/// Segment Length bd
-	//  [DEFAULT]=bd= 5.0
-	double bd;
-
-	/// Chi Param ab
-	//  [DEFAULT]=Kab=-0.0004
-	double Kab;
-	/// Chi Param ac
-	//  [DEFAULT]=Kac=-0.0004
-    double Kac;
-    /// Chi Param ad
-    //  [DEFAULT]=Kad=-0.0004
-    double Kad;
-    /// Chi Param bc
-    //  [DEFAULT]=Kbc=-0.0004
-    double Kbc;
-    /// Chi Param bd
-    //  [DEFAULT]=Kbd=-0.0004
-    double Kbd;
-    /// Chi Param cd
-    //  [DEFAULT]=Kcd=-0.0004
-    double Kcd;
-
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-    double background;
-
-    /// Degree OF POLYMERIZATION of a
-    //  [DEFAULT]=Na=1000.0
-    double Na;
-    /// Volume Fraction of a
-    //  [DEFAULT]=Phia=0.25
-    double Phia;
-    /// Specific Volume of a
-    //  [DEFAULT]=va=100.0
-    double va;
-    /// Scattering Length of a
-    //  [DEFAULT]=La=1.0e-012
-    double La;
-
-    /// Degree OF POLYMERIZATION of b
-    //  [DEFAULT]=Nb=1000.0
-    double Nb;
-    /// Volume Fraction of b
-    //  [DEFAULT]=Phib=0.25
-    double Phib;
-    /// Specific Volume of b
-    //  [DEFAULT]=vb=100.0
-    double vb;
-    /// Scattering Length of b
-    //  [DEFAULT]=Lb=1.0e-012
-    double Lb;
-
-    /// Degree OF POLYMERIZATION of c
-    //  [DEFAULT]=Nc=1000.0
-    double Nc;
-    /// Volume Fraction of c
-    //  [DEFAULT]=Phic=0.25
-    double Phic;
-    /// Specific Volume of c
-    //  [DEFAULT]=vc=100.0
-    double vc;
-    /// Scattering Length of c
-    //  [DEFAULT]=Lc=1.0e-012
-    double Lc;
-
-    /// Degree OF POLYMERIZATION of d
-    //  [DEFAULT]=Nd=1000.0
-    double Nd;
-    /// Volume Fraction of d
-    //  [DEFAULT]=Phid=0.25
-    double Phid;
-    /// Specific Volume of d
-    //  [DEFAULT]=vd=100.0
-    double vd;
-    /// Scattering Length of d
-    //  [DEFAULT]=Ld=0.0e-012
-    double Ld;
-
-} RPAParameters;
-
-double rpa_kernel(double dq[], double q);
-
-/// 1D scattering function
-double rpa_analytical_1D(RPAParameters *pars, double q);
-
-/// 2D scattering function
-double rpa_analytical_2D(RPAParameters *pars, double q, double phi);
-double rpa_analytical_2DXY(RPAParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/sc.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/sc.c	(revision 36f482f3eade66de79d414fd552db5f89239033d)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/*
- * Scattering model for a SC_ParaCrystal
- */
-#include "sc.h"
-#include "libSphere.h"
-#include <math.h>
-#include <stdio.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the SC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-double sc_analytical_1D(SCParameters *pars, double q) {
-	double dp[7];
-	double result;
-
-	dp[0] = pars->scale;
-	dp[1] = pars->dnn;
-	dp[2] = pars->d_factor;
-	dp[3] = pars->radius;
-	dp[4] = pars->sldSph;
-	dp[5] = pars->sldSolv;
-	dp[6] = pars->background;
-
-	result = SC_ParaCrystal(dp, q);
-	// This FIXES a singualrity the kernel in libigor.
-	if ( result == INFINITY || result == NAN){
-		result = pars->background;
-	}
-	return result;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-double sc_analytical_2DXY(SCParameters *pars, double qx, double qy){
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-	return sc_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-double sc_analytical_2D(SCParameters *pars, double q, double phi) {
-	return sc_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SCCrystalModel
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double sc_analytical_2D_scaled(SCParameters *pars, double q, double q_x, double q_y) {
-	double a3_x, a3_y, a3_z, a2_x, a2_y, a1_x, a1_y;
-	double q_z;
-	double alpha, cos_val_a3, cos_val_a2, cos_val_a1;
-	double a1_dot_q, a2_dot_q,a3_dot_q;
-	double answer;
-	double Pi = 4.0*atan(1.0);
-	double aa, Da, qDa_2, latticeScale, Zq;
-
-	double dp[5];
-  //convert angle degree to radian
-  double theta = pars->theta * Pi/180.0;
-  double phi = pars->phi * Pi/180.0;
-  double psi = pars->psi * Pi/180.0;
-	dp[0] = 1.0;
-	dp[1] = pars->radius;
-	dp[2] = pars->sldSph;
-	dp[3] = pars->sldSolv;
-	dp[4] = 0.0;
-
-
-	aa = pars->dnn;
-	Da = pars->d_factor*aa;
-	qDa_2 = pow(q*Da,2.0);
-
-	latticeScale = (4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa,3.0);
-	/// Angles here are respect to detector coordinate instead of against q coordinate(PRB 36, 3, 1754)
-    // a3 axis orientation
-    a3_x = sin(theta) * cos(phi);//negative sign here???
-    a3_y = sin(theta) * sin(phi);
-    a3_z = cos(theta);
-
-    // q vector
-    q_z = 0.0;
-
-    // Compute the angle btw vector q and the a3 axis
-    cos_val_a3 = a3_x*q_x + a3_y*q_y + a3_z*q_z;
-    alpha = acos(cos_val_a3);
-    //alpha = acos(cos_val_a3);
-    a3_dot_q = aa*q*cos_val_a3;
-    // a1 axis orientation
-    a1_x = sin(psi);
-    a1_y = cos(psi);
-
-    cos_val_a1 = a1_x*q_x + a1_y*q_y;
-    a1_dot_q = aa*q*cos_val_a1*sin(alpha);
-
-    // a2 axis orientation
-    a2_x = sqrt(1.0-sin(theta)*cos(phi))*cos(psi);
-    a2_y = sqrt(1.0-sin(theta)*cos(phi))*sin(psi);
-    // a2 axis
-    cos_val_a2 =  sin(acos(cos_val_a1));//a2_x*q_x + a2_y*q_y;
-    a2_dot_q = aa*q*cos_val_a2*sin(alpha);
-
-    // The following test should always pass
-    if (fabs(cos_val_a3)>1.0) {
-    	printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-    // Call Zq=Z1*Z2*Z3
-    Zq = (1.0-exp(-qDa_2))/(1.0-2.0*exp(-0.5*qDa_2)*cos(a1_dot_q)+exp(-qDa_2));
-    Zq = Zq * (1.0-exp(-qDa_2))/(1.0-2.0*exp(-0.5*qDa_2)*cos(a2_dot_q)+exp(-qDa_2));
-    Zq = Zq * (1.0-exp(-qDa_2))/(1.0-2.0*exp(-0.5*qDa_2)*cos(a3_dot_q)+exp(-qDa_2));
-
-	// Use SphereForm directly from libigor
-	answer = SphereForm(dp,q)*Zq;
-
-	//consider scales
-	answer *= latticeScale * pars->scale;
-
-	// This FIXES a singualrity the kernel in libigor.
-	if ( answer == INFINITY || answer == NAN){
-		answer = 0.0;
-	}
-
-	// add background
-	answer += pars->background;
-
-	return answer;
-}
Index: sansmodels/src/sans/models/c_extensions/sc.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/sc.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,81 +1,0 @@
-#if !defined(sc_h)
-#define sc_h
-
-/**
- * Structure definition for SC_ParaCrystal parameters
- */
- //[PYTHONCLASS] = SCCrystalModel
- //[DISP_PARAMS] = radius,phi, psi, theta
- //[DESCRIPTION] =<text>P(q)=(scale/Vp)*V_lattice*P(q)*Z(q)+bkg where scale is the volume
- //					 fraction of sphere,
- //				Vp = volume of the primary particle,
- //				V_lattice = volume correction for
- //					for the crystal structure,
- //				P(q)= form factor of the sphere (normalized),
- //				Z(q)= paracrystalline structure factor
- //					for a simple cubic structure.
- //				[Simple Cubic ParaCrystal Model]
- //				Parameters;
- //				scale: volume fraction of spheres
- //				bkg:background, R: radius of sphere
- //				dnn: Nearest neighbor distance
- //				d_factor: Paracrystal distortion factor
- //				radius: radius of the spheres
- //				sldSph: SLD of the sphere
- //				sldSolv: SLD of the solvent
- //
- //		</text>
- //[FIXED]=  radius.width;phi.width;psi.width; theta.width
- //[ORIENTATION_PARAMS]= <text> phi;psi; theta; phi.width;psi.width; theta.width</text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	Nearest neighbor distance [A]
-    //  [DEFAULT]=dnn=220.0 [A]
-    double dnn;
-
-    ///	Paracrystal distortion factor g
-    //  [DEFAULT]=d_factor=0.06
-    double d_factor;
-
-    ///	Radius of sphere [A]
-    //  [DEFAULT]=radius=40.0 [A]
-    double radius;
-
-    ///	sldSph [1/A^(2)]
-    //  [DEFAULT]=sldSph= 3.0e-6 [1/A^(2)]
-    double sldSph;
-
-    ///	sldSolv [1/A^(2)]
-    //  [DEFAULT]=sldSolv= 6.3e-6 [1/A^(2)]
-    double sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-    /// Orientation of the a1 axis w/respect incoming beam [deg]
-    //  [DEFAULT]=theta=0.0 [deg]
-    double theta;
-    /// Orientation of the a2 in the plane of the detector [deg]
-    //  [DEFAULT]=phi=0.0 [deg]
-    double phi;
-    /// Orientation of the a3 in the plane of the detector [deg]
-    //  [DEFAULT]=psi=0.0 [deg]
-    double psi;
-
-} SCParameters;
-
-
-
-/// 1D scattering function
-double sc_analytical_1D(SCParameters *pars, double q);
-
-/// 2D scattering function
-double sc_analytical_2D(SCParameters *pars, double q, double phi);
-double sc_analytical_2DXY(SCParameters *pars, double qx, double qy);
-double sc_analytical_2D_scaled(SCParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/schulz.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/schulz.c	(revision 2c63e80ef62befde3fa23ebbed7e0649985d92b5)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/**
- * Schulz function
- */
-
-#include "schulz.h"
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#if defined(_MSC_VER)
-#include "gamma_win.h"
-#endif
-
-/**
- * Function to evaluate 1D Schulz function.
- * The function is normalized to the 'scale' parameter.
- *
- * f(x)=scale * math.pow(z+1, z+1)*math.pow((R), z)*
- *					math.exp(-R*(z+1))/(center*gamma(z+1)
- *		z= math.pow[(1/(sigma/center),2]-1
- *		R= x/center
- * @param pars: parameters of the schulz
- * @param x: x-value
- * @return: function value
- */
-double schulz_analytical_1D(SchulzParameters *pars, double x) {
-	double z = pow(pars->center/ pars->sigma, 2)-1;
-	double R= x/pars->center;
-	double zz= z+1;
-	double expo;
-	expo = log(pars->scale)+zz*log(zz)+z*log(R)-R*zz-log(pars->center)-lgamma(zz);
-
-	return exp(expo);//pars->scale * pow(zz,zz) * pow(R,z) * exp(-1*R*zz)/((pars->center) * tgamma(zz)) ;
-}
-
-/**
- * Function to evaluate 2D schulz function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = Schulz(x) * Schulz(y)
- *
- * where both Shulzs share the same parameters.
- *
- * @param pars: parameters of the schulz
- * @param x: x-value
- * @param y: y-value
- * @return: function value
- */
-double schulz_analytical_2DXY(SchulzParameters *pars, double x, double y) {
-    return schulz_analytical_1D(pars, x) * schulz_analytical_1D(pars, y);
-}
-
-/**
- * Function to evaluate 2D Schulz  function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = Schulz(x) * Schulz(y)
- *
- * where both Gaussians share the same parameters.
- *
- * @param pars: parameters of the gaussian
- * @param length: length of the (x,y) vector
- * @param phi: angle relative to x
- * @return: function value
- */
-double schulz_analytical_2D(SchulzParameters *pars, double length, double phi) {
-    return schulz_analytical_2DXY(pars, length*cos(phi), length*sin(phi));
-}
Index: sansmodels/src/sans/models/c_extensions/schulz.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/schulz.h	(revision 59b9b67578f11772d51a4d61028e0dfc7097df5a)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#if !defined(schulz_h)
-#define schulz_h
-
-/** Structure definition for Schulz parameters.
- * The Schulz is normalized to the 'scale' parameter.
- *  
- * f(x)=scale * math.pow(z+1, z+1)*math.pow((R), z)*
- *					math.exp(-R*(z+1))/(center*gamma(z+1)
- *		z= math.pow[(1/(sigma/center),2]-1
- *		R= x/center
- * 
- * [PYTHONCLASS] = Schulz
- * [DESCRIPTION] = <text> f(x)=scale * math.pow(z+1, z+1)*math.pow((R), z)*
- 					math.exp(-R*(z+1))/(center*gamma(z+1)
- 		            z= math.pow[(1/(sigma/center),2]-1
- 					R= x/center</text>
- */
-typedef struct {
-    /// Scale factor 
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Standard deviation
-    //  [DEFAULT]=sigma=1 
-    double sigma;
-    /// Center of the Schulz distribution
-    //  [DEFAULT]=center=0.0 
-    double center;
-} SchulzParameters;
-
-/// 1D scattering function
-double schulz_analytical_1D(SchulzParameters *pars, double x);
-
-/// 2D scattering function
-double schulz_analytical_2D(SchulzParameters *pars, double x, double phi);
-double schulz_analytical_2DXY(SchulzParameters *pars, double x, double y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/sld_cal.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/sld_cal.c	(revision 890ac7f156aa123d3a2d72d1e43ca2a08af66966)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/**
- * SLD Calculator
- * @author: Jae Hie Cho / UTK
- */
-
-#include "sld_cal.h"
-#include "libmultifunc/librefl.h"
-#include <math.h>
-
-
-/**
- * Function to calculate sld
- * @param pars: parameters
- * @param x: independent param-value
- * @return: sld value
- */
-double sld_cal_analytical_1D(SLDCalParameters *pars, double x) {
-	double fun, nsl, n_s, fun_coef, sld_l, sld_r, sld_out;
-	int fun_type;
-
-	fun = pars->fun_type;
-	nsl = pars->npts_inter;
-	n_s = pars->shell_num;
-	fun_coef = pars->nu_inter;
-	sld_l = pars-> sld_left;
-	sld_r = pars-> sld_right;
-
-	fun_type = floor(fun);
-
-	sld_out = intersldfunc(fun_type, nsl, n_s, fun_coef, sld_l, sld_r);
-
-	return sld_out;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @return: function value
- */
-double sld_cal_analytical_2D(SLDCalParameters *pars, double x, double phi) {
-	return sld_cal_analytical_1D(pars,x);
-}
-
-double sld_cal_analytical_2DXY(SLDCalParameters *pars, double xx, double xy){
-	return sld_cal_analytical_1D(pars,sqrt(xx*xx+xy*xy));
-}
Index: sansmodels/src/sans/models/c_extensions/sld_cal.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/sld_cal.h	(revision 0164899a491d20467a714225f7ea955c852265f3)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#if !defined(sld_cal_h)
-#define sld_cal_h
-
-/**
- * To calculate the sld value
-* [PYTHONCLASS] = SLDCalFunc
-* [DISP_PARAMS] = npts_inter
-  [DESCRIPTION] =<text>To calculate sld values
- 				</text>
-	[FIXED]= <text>
-			</text>
-
- **/
-typedef struct {
-    ///	fun_type
-    //  [DEFAULT]=fun_type=0
-    double fun_type;
-
-    /// npts_inter
-    //  [DEFAULT]=npts_inter= 21
-    double npts_inter;
-
-    /// shell_num
-    //  [DEFAULT]=shell_num= 0
-    double shell_num;
-
-    /// nu_inter
-    //  [DEFAULT]=nu_inter= 2.5
-    double nu_inter;
-
-    /// sld_left [1/A^(2)]
-    //  [DEFAULT]=sld_left= 0 [1/A^(2)]
-    double sld_left;
-
-    /// sld_right [1/A^(2)]
-    //  [DEFAULT]=sld_right= 0 [1/A^(2)]
-    double sld_right;
-
-} SLDCalParameters;
-
-
-
-/// 1D function
-double sld_cal_analytical_1D(SLDCalParameters *pars, double q);
-
-/// 2D function
-double sld_cal_analytical_2D(SLDCalParameters *pars, double q, double phi);
-double sld_cal_analytical_2DXY(SLDCalParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/sphere.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/sphere.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#if !defined(sphere_h)
-#define sphere_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = SphereModel
- //[DISP_PARAMS] = radius
- //[DESCRIPTION] =<text>P(q)=(scale/V)*[3V(sldSph-sldSolv)*(sin(qR)-qRcos(qR))
- //						/(qR)^3]^(2)+bkg
- //
- //				bkg:background, R: radius of sphere
- //				V:The volume of the scatter
- //				sldSph: the SLD of the sphere
- //				sldSolv: the SLD of the solvent
- //
- //		</text>
- //[FIXED]=  radius.width
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	Radius of sphere [A]
-    //  [DEFAULT]=radius=60.0 [A]
-    double radius;
-
-    ///	sldSph [1/A^(2)]
-    //  [DEFAULT]=sldSph= 2.0e-6 [1/A^(2)]
-    double sldSph;
-
-    ///	sldSolv [1/A^(2)]
-    //  [DEFAULT]=sldSolv= 1.0e-6 [1/A^(2)]
-    double sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-} SphereParameters;
-
-
-
-/// 1D scattering function
-//double sphere_analytical_1D(SphereParameters *pars, double q);
-
-/// 2D scattering function
-//double sphere_analytical_2D(SphereParameters *pars, double q, double phi);
-//double sphere_analytical_2DXY(SphereParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/spheresld.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/spheresld.c	(revision 839f7e28c011deb396c95d09a5783cbe57a2083b)
+++ 	(revision )
@@ -1,258 +1,0 @@
-/**
- * spheresld model
- */
-#include <math.h>
-#include "spheresld.h"
-#include "libmultifunc/librefl.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-#define lamda 4.62
-
-
-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,vol_pre,vol_sub,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));
-
-	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 spheresld function
- * @param pars: parameters of spheresld
- * @param q: q-value
- * @return: function value
- */
-
-double sphere_sld_analytical_1D(SphereSLDParameters *pars, double q) {
-	double dp[60];
-
-	dp[0] = pars->n_shells;
-	dp[1] = pars->scale;
-	dp[2] = pars->thick_inter0;
-	dp[3] = pars->func_inter0;
-	dp[4] = pars->sld_core0;
-	dp[5] = pars->sld_solv;
-	dp[6] = pars->background;
-
-	dp[7] = pars->sld_flat1;
-	dp[8] = pars->sld_flat2;
-	dp[9] = pars->sld_flat3;
-	dp[10] = pars->sld_flat4;
-	dp[11] = pars->sld_flat5;
-	dp[12] = pars->sld_flat6;
-	dp[13] = pars->sld_flat7;
-	dp[14] = pars->sld_flat8;
-	dp[15] = pars->sld_flat9;
-	dp[16] = pars->sld_flat10;
-
-	dp[17] = pars->thick_inter1;
-	dp[18] = pars->thick_inter2;
-	dp[19] = pars->thick_inter3;
-	dp[20] = pars->thick_inter4;
-	dp[21] = pars->thick_inter5;
-	dp[22] = pars->thick_inter6;
-	dp[23] = pars->thick_inter7;
-	dp[24] = pars->thick_inter8;
-	dp[25] = pars->thick_inter9;
-	dp[26] = pars->thick_inter10;
-
-	dp[27] = pars->thick_flat1;
-	dp[28] = pars->thick_flat2;
-	dp[29] = pars->thick_flat3;
-	dp[30] = pars->thick_flat4;
-	dp[31] = pars->thick_flat5;
-	dp[32] = pars->thick_flat6;
-	dp[33] = pars->thick_flat7;
-	dp[34] = pars->thick_flat8;
-	dp[35] = pars->thick_flat9;
-	dp[36] = pars->thick_flat10;
-
-	dp[37] = pars->func_inter1;
-	dp[38] = pars->func_inter2;
-	dp[39] = pars->func_inter3;
-	dp[40] = pars->func_inter4;
-	dp[41] = pars->func_inter5;
-	dp[42] = pars->func_inter6;
-	dp[43] = pars->func_inter7;
-	dp[44] = pars->func_inter8;
-	dp[45] = pars->func_inter9;
-	dp[46] = pars->func_inter10;
-
-	dp[47] = pars->nu_inter1;
-	dp[48] = pars->nu_inter2;
-	dp[49] = pars->nu_inter3;
-	dp[50] = pars->nu_inter4;
-	dp[51] = pars->nu_inter5;
-	dp[52] = pars->nu_inter6;
-	dp[53] = pars->nu_inter7;
-	dp[54] = pars->nu_inter8;
-	dp[55] = pars->nu_inter9;
-	dp[56] = pars->nu_inter10;
-
-	dp[57] = pars->npts_inter;
-	dp[58] = pars->nu_inter0;
-	dp[59] = pars->rad_core0;
-
-	return sphere_sld_kernel(dp, q);
-}
-
-/**
- * Function to evaluate spheresld function
- * @param pars: parameters of spheresld
- * @param q: q-value
- * @return: function value
- */
-double sphere_sld_analytical_2D(SphereSLDParameters *pars, double q, double phi) {
-	return sphere_sld_analytical_1D(pars,q);
-}
-
-double sphere_sld_analytical_2DXY(SphereSLDParameters *pars, double qx, double qy){
-	return sphere_sld_analytical_1D(pars,sqrt(qx*qx+qy*qy));
-}
Index: sansmodels/src/sans/models/c_extensions/spheresld.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/spheresld.h	(revision 7a8faf89408cbad719663a9f4b3e2f655c3dd0cb)
+++ 	(revision )
@@ -1,177 +1,0 @@
-#if !defined(o_h)
-#define sphere_sld_h
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = SphereSLDModel
- //[DISP_PARAMS] = rad_core0, thick_inter0
- //[DESCRIPTION] =<text>Calculate neutron reflectivity using the Parratt iterative formula
- //				Parameters:
- //				background:background
- //				scale: scale factor
- //				sld_core0: the SLD of the substrate
- //				sld_solv: the SLD of the incident medium
- //					or superstrate
- //				sld_flatN: the SLD of the flat region of
- //					the N'th layer
- //				thick_flatN: the thickness of the flat
- //					region of the N'th layer
- //				func_interN: the function used to describe
- //					the interface of the N'th layer
- //				nu_interN: the coefficient for the func_interN
- //				thick_interN: the thickness of the interface
- //					of the N'th layer
- //				Note: the layer number starts to increase
- //					from the bottom (substrate) to the top.
- //		</text>
- //[FIXED]=  <text>rad_core0.width; thick_inter0.width</text>
- //[NON_FITTABLE_PARAMS]= <text>n_shells;func_inter0;func_inter1;func_inter2;func_inter3;func_inter4;func_inter5;func_inter5;func_inter7;func_inter8;func_inter9;func_inter10 </text>
- //[ORIENTATION_PARAMS]= <text> </text>
-
-typedef struct {
-	/// number of shells
-	//  [DEFAULT]=n_shells=1
-	int n_shells;
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-	double scale;
-    ///	thick_inter0 [A]
-    //  [DEFAULT]=thick_inter0=50.0 [A]
-	double thick_inter0;
-	///	func_inter0
-	//  [DEFAULT]=func_inter0= 0
-	double func_inter0;
-	///	sld_core0 [1/A^(2)]
-	//  [DEFAULT]=sld_core0= 2.07e-6 [1/A^(2)]
-	double sld_core0;
-	///	sld_solv [1/A^(2)]
-	//  [DEFAULT]=sld_solv= 1.0e-6 [1/A^(2)]
-	double sld_solv;
-	/// Background
-	//  [DEFAULT]=background=0
-	double background;
-
-    //  [DEFAULT]=sld_flat1=4.0e-06 [1/A^(2)]
-    double sld_flat1;
-    //  [DEFAULT]=sld_flat2=3.5e-06 [1/A^(2)]
-    double sld_flat2;
-    //  [DEFAULT]=sld_flat3=4.0e-06 [1/A^(2)]
-    double sld_flat3;
-    //  [DEFAULT]=sld_flat4=3.5e-06 [1/A^(2)]
-    double sld_flat4;
-    //  [DEFAULT]=sld_flat5=4.0e-06 [1/A^(2)]
-    double sld_flat5;
-    //  [DEFAULT]=sld_flat6=3.5e-06 [1/A^(2)]
-    double sld_flat6;
-    //  [DEFAULT]=sld_flat7=4.0e-06 [1/A^(2)]
-    double sld_flat7;
-    //  [DEFAULT]=sld_flat8=3.5e-06 [1/A^(2)]
-    double sld_flat8;
-    //  [DEFAULT]=sld_flat9=4.0e-06 [1/A^(2)]
-    double sld_flat9;
-    //  [DEFAULT]=sld_flat10=3.5e-06 [1/A^(2)]
-    double sld_flat10;
-
-    //  [DEFAULT]=thick_inter1=50.0 [A]
-    double thick_inter1;
-    //  [DEFAULT]=thick_inter2=50.0 [A]
-    double thick_inter2;
-    //  [DEFAULT]=thick_inter3=50.0 [A]
-    double thick_inter3;
-    //  [DEFAULT]=thick_inter4=50.0 [A]
-    double thick_inter4;
-    //  [DEFAULT]=thick_inter5=50.0 [A]
-    double thick_inter5;
-    //  [DEFAULT]=thick_inter6=50.0 [A]
-    double thick_inter6;
-    //  [DEFAULT]=thick_inter7=50.0 [A]
-    double thick_inter7;
-    //  [DEFAULT]=thick_inter8=50.0 [A]
-    double thick_inter8;
-    //  [DEFAULT]=thick_inter9=50.0 [A]
-    double thick_inter9;
-    //  [DEFAULT]=thick_inter10=50.0 [A]
-    double thick_inter10;
-
-    //  [DEFAULT]=thick_flat1=100 [A]
-    double thick_flat1;
-    //  [DEFAULT]=thick_flat2=100 [A]
-    double thick_flat2;
-    //  [DEFAULT]=thick_flat3=100 [A]
-    double thick_flat3;
-    //  [DEFAULT]=thick_flat4=100 [A]
-    double thick_flat4;
-    //  [DEFAULT]=thick_flat5=100 [A]
-    double thick_flat5;
-    //  [DEFAULT]=thick_flat6=100 [A]
-    double thick_flat6;
-    //  [DEFAULT]=thick_flat7=100 [A]
-    double thick_flat7;
-    //  [DEFAULT]=thick_flat8=100 [A]
-    double thick_flat8;
-    //  [DEFAULT]=thick_flat9=100 [A]
-    double thick_flat9;
-    //  [DEFAULT]=thick_flat10=100 [A]
-    double thick_flat10;
-
-    //  [DEFAULT]=func_inter1=0
-    double func_inter1;
-    //  [DEFAULT]=func_inter2=0
-    double func_inter2;
-    //  [DEFAULT]=func_inter3=0
-    double func_inter3;
-    //  [DEFAULT]=func_inter4=0
-    double func_inter4;
-    //  [DEFAULT]=func_inter5=0
-    double func_inter5;
-    //  [DEFAULT]=func_inter6=0
-    double func_inter6;
-    //  [DEFAULT]=func_inter7=0
-    double func_inter7;
-    //  [DEFAULT]=func_inter8=0
-    double func_inter8;
-    //  [DEFAULT]=func_inter9=0
-    double func_inter9;
-    //  [DEFAULT]=func_inter10=0
-    double func_inter10;
-
-    //  [DEFAULT]=nu_inter1=2.5
-    double nu_inter1;
-    //  [DEFAULT]=nu_inter2=2.5
-    double nu_inter2;
-    //  [DEFAULT]=nu_inter3=2.5
-    double nu_inter3;
-    //  [DEFAULT]=nu_inter4=2.5
-    double nu_inter4;
-    //  [DEFAULT]=nu_inter5=2.5
-    double nu_inter5;
-    //  [DEFAULT]=nu_inter6=2.5
-    double nu_inter6;
-    //  [DEFAULT]=nu_inter7=2.5
-    double nu_inter7;
-    //  [DEFAULT]=nu_inter8=2.5
-    double nu_inter8;
-    //  [DEFAULT]=nu_inter9=2.5
-    double nu_inter9;
-    //  [DEFAULT]=nu_inter10=2.5
-    double nu_inter10;
-
-    //  [DEFAULT]=npts_inter=35.0
-    double npts_inter;
-    //  [DEFAULT]=nu_inter0=2.5
-    double nu_inter0;
-    //  [DEFAULT]=rad_core0=50.0 [A]
-    double rad_core0;
-} SphereSLDParameters;
-
-double sphere_sld_kernel(double dq[], double q);
-
-/// 1D scattering function
-double sphere_sld_analytical_1D(SphereSLDParameters *pars, double q);
-
-/// 2D scattering function
-double sphere_sld_analytical_2D(SphereSLDParameters *pars, double q, double phi);
-double sphere_sld_analytical_2DXY(SphereSLDParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/spheroid.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/spheroid.c	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/**
- * Scattering model for a prolate
- * @author: UTK
- */
-
-#include "spheroid.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @return: function value
- */
-double spheroid_analytical_1D(SpheroidParameters *pars, double q) {
-	double dp[9];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->equat_core;
-	dp[2] = pars->polar_core;
-	dp[3] = pars->equat_shell;
-	dp[4] = pars->polar_shell;
-	dp[5] = pars->sld_core;
-	dp[6] = pars->sld_shell;
-	dp[7] = pars->sld_solvent;
-	dp[8] = pars->background;
-
-	// Call library function to evaluate model
-	return OblateForm(dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @return: function value
- */
-double spheroid_analytical_2DXY(SpheroidParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return spheroid_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double spheroid_analytical_2D(SpheroidParameters *pars, double q, double phi) {
-    return spheroid_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double spheroid_analytical_2D_scaled(SpheroidParameters *pars, double q, double q_x, double q_y) {
-
-	double cyl_x, cyl_y, cyl_z;
-	double q_z;
-	double alpha, vol, cos_val;
-	double answer;
-	double Pi = 4.0*atan(1.0);
-	double sldcs,sldss;
-
-	//convert angle degree to radian
-	double theta = pars->axis_theta * Pi/180.0;
-	double phi = pars->axis_phi * Pi/180.0;
-
-
-    // ellipsoid orientation, the axis of the rotation is consistent with the ploar axis.
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-    //del sld
-    sldcs = pars->sld_core - pars->sld_shell;
-    sldss = pars->sld_shell- pars->sld_solvent;
-
-    // q vector
-    q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-	alpha = acos( cos_val );
-
-	// Call the IGOR library function to get the kernel: MUST use gfn4 not gf2 because of the def of params.
-	answer = gfn4(cos_val,pars->equat_core,pars->polar_core,pars->equat_shell,pars->polar_shell,sldcs,sldss,q);
-	//It seems that it should be normalized somehow. How???
-
-	//normalize by cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-    vol = 4.0*Pi/3.0*pars->equat_shell*pars->equat_shell*pars->polar_shell;
-	answer /= vol;
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
-
-
Index: sansmodels/src/sans/models/c_extensions/spheroid.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/spheroid.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,80 +1,0 @@
-#if !defined(spheroid_h)
-#define spheroid_h
-/** Structure definition for oblate parameters
- * [PYTHONCLASS] = CoreShellEllipsoidModel
- * [DISP_PARAMS] = equat_core, polar_core, equat_shell,polar_shell,axis_phi, axis_theta
-   [DESCRIPTION] = <text>[SpheroidCoreShellModel] Calculates the form factor for an spheroid
-			ellipsoid particle with a core_shell structure.
-			The form factor is averaged over all possible
-			orientations of the ellipsoid such that P(q)
-			= scale*<f^2>/Vol + bkg, where f is the
-			single particle scattering amplitude.
-			[Parameters]:
-			equat_core = equatorial radius of core,
-			polar_core = polar radius of core,
-			equat_shell = equatorial radius of shell,
-			polar_shell = polar radius (revolution axis) of shell,
-			sld_core = SLD_core
-			sld_shell = SLD_shell
-			sld_solvent = SLD_solvent
-			background = Incoherent bkg
-			scale =scale
-			Note:It is the users' responsibility to ensure
-			that shell radii are larger than core radii.
-			oblate: polar radius < equatorial radius
-			prolate :  polar radius > equatorial radius
-			</text>
-
-   [FIXED] = <text>equat_core.width;polar_core.width; equat_shell.width; polar_shell.width; axis_phi.width; axis_theta.width</text>
-   [ORIENTATION_PARAMS]= <text>axis_phi; axis_theta; axis_phi.width; axis_theta.width</text>
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// Equatorial radius of core [A]
-    //  [DEFAULT]=equat_core=200.0 [A]
-    double equat_core;
-	/// Polar radius of core [A]
-    //  [DEFAULT]=polar_core=20.0 [A]
-    double polar_core;
-	/// equatorial radius of shell [A]
-    //  [DEFAULT]=equat_shell=250.0 [A]
-    double equat_shell;
-	/// polar radius of shell [A]
-    //  [DEFAULT]=polar_shell=30.0 [A]
-    double polar_shell;
-    ///  Core scattering length density [1/A^(2)]
-    //  [DEFAULT]=sld_core=2.0e-6 [1/A^(2)]
-    double sld_core;
-    ///  Shell scattering length density [1/A^(2)]
-    //  [DEFAULT]=sld_shell=1.0e-6 [1/A^(2)]
-    double sld_shell;
-	/// Solvent scattering length density  [1/A^(2)]
-    //  [DEFAULT]=sld_solvent=6.3e-6 [1/A^(2)]
-    double sld_solvent;
-	/// Incoherent Background [1/cm] 0.001
-	//  [DEFAULT]=background=0.001 [1/cm]
-	double background;
-	//Disable for now
-    /// Orientation of the oblate axis w/respect incoming beam [deg]
-    //  [DEFAULT]=axis_theta=0.0 [deg]
-    double axis_theta;
-    /// Orientation of the oblate in the plane of the detector [deg]
-    //  [DEFAULT]=axis_phi=0.0 [deg]
-    double axis_phi;
-
-} SpheroidParameters;
-
-
-
-/// 1D scattering function
-double spheroid_analytical_1D(SpheroidParameters *pars, double q);
-
-/// 2D scattering function
-double spheroid_analytical_2D(SpheroidParameters *pars, double q, double phi);
-double spheroid_analytical_2DXY(SpheroidParameters *pars, double qx, double qy);
-double spheroid_analytical_2D_scaled(SpheroidParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/stacked_disks.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/stacked_disks.c	(revision 3c102d483d76eaaef80c6c9f1e39089cfbd6799b)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/**
- * Scattering model for a stacked disk
- * TODO: Add 2D analysis
- */
-
-#include "stacked_disks.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the staked disks
- * @param q: q-value
- * @return: function value
- */
-double stacked_disks_analytical_1D(StackedDisksParameters *pars, double q) {
-	double dp[10];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->radius;
-	dp[2] = pars->core_thick;
-	dp[3] = pars->layer_thick;
-	dp[4] = pars->core_sld;
-	dp[5] = pars->layer_sld;
-	dp[6] = pars->solvent_sld;
-	dp[7] = pars->n_stacking;
-	dp[8] = pars->sigma_d;
-	dp[9] = pars->background;
-
-	// Call library function to evaluate model
-	return StackedDiscs(dp, q);
-}
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the staked disks
- * @param q: q-value
- * @return: function value
- */
-double stacked_disks_analytical_2DXY(StackedDisksParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return stacked_disks_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the staked disks
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double stacked_disks_analytical_2D(StackedDisksParameters *pars, double q, double phi) {
-    return stacked_disks_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the staked disks
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double stacked_disks_analytical_2D_scaled(StackedDisksParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z;
-	double q_z;
-	double alpha, vol, cos_val;
-	double d, dum, halfheight;
-	double answer;
-
-
-
-    // parallelepiped orientation
-    cyl_x = sin(pars->axis_theta) * cos(pars->axis_phi);
-    cyl_y = sin(pars->axis_theta) * sin(pars->axis_phi);
-    cyl_z = cos(pars->axis_theta);
-
-    // q vector
-    q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the parallelepiped
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from Stackdisc_kern
-	alpha = acos( cos_val );
-
-	// Call the IGOR library function to get the kernel
-	d = 2 * pars->layer_thick + pars->core_thick;
-	halfheight = pars->core_thick/2.0;
-	dum =alpha ;
-	answer = Stackdisc_kern(q, pars->radius, pars->core_sld,pars->layer_sld,
-		pars->solvent_sld, halfheight, pars->layer_thick, dum, pars->sigma_d, d, pars->n_stacking)/sin(alpha);
-
-	// Multiply by contrast^2
-	//answer *= pars->contrast*pars->contrast;
-
-	//normalize by staked disks volume
-    vol = acos(-1.0) * pars->radius * pars->radius * d * pars->n_stacking;
-	answer /= vol;
-
-	//convert to [cm-1]
-	answer *= 1.0e8;
-
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
-
-
Index: sansmodels/src/sans/models/c_extensions/stacked_disks.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/stacked_disks.h	(revision 27972c1dfdd57a50946a99914051e1713c997e78)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
-	TODO: Add 2D model
-*/
-
-#if !defined(stacked_disks_h)
-#define stacked_disks_h
-/** Structure definition for stacked disks parameters
- * [PYTHONCLASS] = StackedDisksModel
- * [DISP_PARAMS] = core_thick, layer_thick, radius, axis_theta, axis_phi
-   [DESCRIPTION] = <text> One layer of disk consists of a core, a top layer, and a bottom layer.
-		radius =  the radius of the disk
-		core_thick = thickness of the core
-		layer_thick = thickness of a layer
-		core_sld = the SLD of the core
-		layer_sld = the SLD of the layers
-		n_stacking = the number of the disks
-		sigma_d =  Gaussian STD of d-spacing
-		solvent_sld = the SLD of the solvent
-		</text>
-	[FIXED]= <text>core_thick.width;layer_thick.width; radius.width; axis_theta.width; axis_phi.width</text>
-	[ORIENTATION_PARAMS]= <text>axis_phi; axis_theta; axis_phi.width; axis_theta.width</text>
-
-
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=0.01
-    double scale;
-	/// radius of the staked disk [A]
-    //  [DEFAULT]=radius=3000 [A]
-    double radius;
-    /// Thickness of the core disk [A]
-    //  [DEFAULT]=core_thick=10.0 [A]
-    double core_thick;
-	/// Thickness of the staked disk [A]
-    //  [DEFAULT]=layer_thick=15.0 [A]
-    double layer_thick;
-	/// Core scattering length density[1/A^(2)]
-    //  [DEFAULT]=core_sld=4e-6 [1/A^(2)]
-    double core_sld;
-	/// layer scattering length density[1/A^(2)]
-    //  [DEFAULT]=layer_sld=-4e-7 [1/A^(2)]
-    double layer_sld;
-	/// solvent scattering length density[1/A^(2)]
-    //  [DEFAULT]=solvent_sld=5.0e-6 [1/A^(2)]
-    double solvent_sld;
-    /// number of stacking
-    //  [DEFAULT]=n_stacking=1
-	double n_stacking;
-    /// GSD of disks sigma_d
-    //  [DEFAULT]=sigma_d=0
-    double sigma_d;
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0.001 [1/cm]
-	double background;
-    /// Orientation of the staked disk axis w/respect incoming beam [rad]
-    //  [DEFAULT]=axis_theta=0.0 [rad]
-    double axis_theta;
-    /// Orientation of the  staked disk in the plane of the detector [rad]
-    //  [DEFAULT]=axis_phi=0.0 [rad]
-    double axis_phi;
-
-
-} StackedDisksParameters;
-
-
-
-/// 1D scattering function
-double stacked_disks_analytical_1D(StackedDisksParameters *pars, double q);
-
-/// 2D scattering function
-double stacked_disks_analytical_2D(StackedDisksParameters *pars, double q, double phi);
-double stacked_disks_analytical_2DXY(StackedDisksParameters *pars, double qx, double qy);
-double stacked_disks_analytical_2D_scaled(StackedDisksParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/triaxial_ellipsoid.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/triaxial_ellipsoid.c	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,156 +1,0 @@
-/**
- * Scattering model for a cylinder
- * @author: Mathieu Doucet / UTK
- */
-
-#include "triaxial_ellipsoid.h"
-#include <math.h>
-#include "libCylinder.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @return: function value
- */
-double triaxial_ellipsoid_analytical_1D(TriaxialEllipsoidParameters *pars, double q) {
-	double dp[7];
-
-	// Fill paramater array
-	dp[0] = pars->scale;
-	dp[1] = pars->semi_axisA;
-	dp[2] = pars->semi_axisB;
-	dp[3] = pars->semi_axisC;
-	dp[4] = pars->sldEll;
-	dp[5] = pars->sldSolv;
-	dp[6] = pars->background;
-
-	// Call library function to evaluate model
-	return TriaxialEllipsoid(dp, q);
-}
-
-double triaxial_ellipsoid_kernel(TriaxialEllipsoidParameters *pars, double q, double alpha, double nu) {
-	double t,a,b,c;
-	double kernel;
-
-	a = pars->semi_axisA ;
-	b = pars->semi_axisB ;
-	c = pars->semi_axisC ;
-
-	t = q * sqrt(a*a*cos(nu)*cos(nu)+b*b*sin(nu)*sin(nu)*sin(alpha)*sin(alpha)+c*c*cos(alpha)*cos(alpha));
-	if (t==0.0){
-		kernel  = 1.0;
-	}else{
-		kernel  = 3.0*(sin(t)-t*cos(t))/(t*t*t);
-	}
-	return kernel*kernel;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @return: function value
- */
-double triaxial_ellipsoid_analytical_2DXY(TriaxialEllipsoidParameters *pars, double qx, double qy) {
-	double q;
-	q = sqrt(qx*qx+qy*qy);
-    return triaxial_ellipsoid_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double triaxial_ellipsoid_analytical_2D(TriaxialEllipsoidParameters *pars, double q, double phi) {
-    return triaxial_ellipsoid_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-double triaxial_ellipsoid_analytical_2D_scaled(TriaxialEllipsoidParameters *pars, double q, double q_x, double q_y) {
-	double cyl_x, cyl_y, cyl_z, ell_x, ell_y;
-	double q_z;
-	double cos_nu,nu;
-	double alpha, vol, cos_val;
-	double answer;
-    double pi = 4.0*atan(1.0);
-
-	//convert angle degree to radian
-	double theta = pars->axis_theta * pi/180.0;
-	double phi = pars->axis_phi * pi/180.0;
-	double psi = pars->axis_psi * pi/180.0;
-
-    // Cylinder orientation
-    cyl_x = sin(theta) * cos(phi);
-    cyl_y = sin(theta) * sin(phi);
-    cyl_z = cos(theta);
-
-    // q vector
-    q_z = 0.0;
-
-	//dx = 1.0;
-	//dy = 1.0;
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-    	printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-     	return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-	alpha = acos( cos_val );
-
-    //ellipse orientation:
-	// the elliptical corss section was transformed and projected
-	// into the detector plane already through sin(alpha)and furthermore psi remains as same
-	// on the detector plane.
-	// So, all we need is to calculate the angle (nu) of the minor axis of the ellipse wrt
-	// the wave vector q.
-
-	//x- y- component on the detector plane.
-    ell_x =  cos(psi);
-    ell_y =  sin(psi);
-
-    // calculate the axis of the ellipse wrt q-coord.
-    cos_nu = ell_x*q_x + ell_y*q_y;
-    nu = acos(cos_nu);
-
-	// Call the IGOR library function to get the kernel
-	answer = triaxial_ellipsoid_kernel(pars, q, alpha, nu);
-
-	// Multiply by contrast^2
-	answer *= (pars->sldEll- pars->sldSolv)*(pars->sldEll- pars->sldSolv);
-
-	//normalize by cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-    vol = 4.0* pi/3.0  * pars->semi_axisA * pars->semi_axisB * pars->semi_axisC;
-	answer *= vol;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= pars->scale;
-
-	// add in the background
-	answer += pars->background;
-
-	return answer;
-}
Index: sansmodels/src/sans/models/c_extensions/triaxial_ellipsoid.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/triaxial_ellipsoid.h	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#if !defined(triaxial_ellipsoid_h)
-#define triaxial_ellipsoid_h
-/** Structure definition for cylinder parameters
- * [PYTHONCLASS] = TriaxialEllipsoidModel
- * [DISP_PARAMS] = semi_axisA, semi_axisB, semi_axisC,axis_theta, axis_phi, axis_psi
-	[DESCRIPTION] = <text>Note: During fitting ensure that the inequality A<B<C is not
-	violated. Otherwise the calculation will
-	not be correct.
-	</text>
-	[FIXED]= <text>axis_psi.width; axis_phi.width; axis_theta.width; semi_axisA.width; semi_axisB.width; semi_axisC.width </text>
-	[ORIENTATION_PARAMS]= <text>axis_psi; axis_phi; axis_theta; axis_psi.width; axis_phi.width; axis_theta.width</text>
- **/
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale=1.0
-    double scale;
-    /// semi -axis A of the triaxial_ellipsoid [A]
-    //  [DEFAULT]=semi_axisA= 35.0 [A]
-    double semi_axisA;
-    /// semi -axis B of the triaxial_ellipsoid [A]
-    //  [DEFAULT]=semi_axisB=100.0 [A]
-    double semi_axisB;
-	/// semi -axis C of the triaxial_ellipsoid [A]
-    //  [DEFAULT]=semi_axisC=400.0 [A]
-    double semi_axisC;
-    /// sldEll [1/A^(2)]
-    //  [DEFAULT]=sldEll=1.0e-6 [1/A^(2)]
-    double sldEll;
-    /// sldSolv [1/A^(2)]
-    //  [DEFAULT]=sldSolv=6.3e-6 [1/A^(2)]
-    double sldSolv;
-	/// Incoherent Background [1/cm] 0.00
-	//  [DEFAULT]=background=0.0 [1/cm]
-	double background;
-    /// Orientation of the triaxial_ellipsoid axis w/respect incoming beam [deg]
-    //  [DEFAULT]=axis_theta=57.325 [deg]
-    double axis_theta;
-    /// Orientation of the triaxial_ellipsoid in the plane of the detector [deg]
-    //  [DEFAULT]=axis_phi=57.325 [deg]
-    double axis_phi;
-    /// Orientation of the cross section of the triaxial_ellipsoid in the plane of the detector [deg]
-    //  [DEFAULT]=axis_psi=0.0 [deg]
-    double axis_psi;
-
-} TriaxialEllipsoidParameters;
-
-
-
-/// 1D scattering function
-double triaxial_ellipsoid_analytical_1D(TriaxialEllipsoidParameters *pars, double q);
-
-/// 2D scattering function
-double triaxial_ellipsoid_analytical_2D(TriaxialEllipsoidParameters *pars, double q, double phi);
-double triaxial_ellipsoid_analytical_2DXY(TriaxialEllipsoidParameters *pars, double qx, double qy);
-double triaxial_ellipsoid_analytical_2D_scaled(TriaxialEllipsoidParameters *pars, double q, double q_x, double q_y);
-
-#endif
Index: sansmodels/src/sans/models/c_extensions/vesicle.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/vesicle.h	(revision 2399b2aa02ce10301917e5d3d2e5923f497c877c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-#if !defined(vesicle_h)
-#define vesicle_h
-
-/**
- * Structure definition for vesicle parameters
-[PYTHONCLASS] = VesicleModel
-[DISP_PARAMS] = radius,thickness
-[DESCRIPTION] =<text>Model parameters:    radius : the core radius of the vesicle
-		thickness: the shell thickness
-		core_sld: the core SLD
-		shell_sld: the shell SLD
-		background: incoherent background
-		scale : scale factor
-</text>
-[FIXED]=  radius.width; thickness.width
-[ORIENTATION_PARAMS]= <text> </text>
- */
-typedef struct {
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    double scale;
-
-    ///	Core radius of the vesicle [A]
-    //  [DEFAULT]=radius= 100.0 [A]
-    double radius;
-
-	///	shell thickness [A]
-    //  [DEFAULT]=thickness= 30.0 [A]
-    double thickness;
-
-	///	core scattering length density [1/A^(2)]
-    //  [DEFAULT]=core_sld= 6.36e-6 [1/A^(2)]
-    double core_sld;
-
-    ///	shell scattering length density [1/A^(2)]
-    //  [DEFAULT]=shell_sld= 5.0e-7 [1/A^(2)]
-    double shell_sld;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	double background;
-
-} VesicleParameters;
-
-
-
-/// 1D scattering function
-//double vesicle_analytical_1D(VesicleParameters *pars, double q);
-
-/// 2D scattering function
-//double vesicle_analytical_2D(VesicleParameters *pars, double q, double phi);
-//double vesicle_analytical_2DXY(VesicleParameters *pars, double qx, double qy);
-
-#endif
Index: sansmodels/src/sans/models/c_models/CBCCrystalModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CBCCrystalModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,620 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CBCCrystalModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY bcc.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "bcc.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CBCCrystalModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    BCCrystalModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CBCCrystalModel;
-
-
-static void
-CBCCrystalModel_dealloc(CBCCrystalModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CBCCrystalModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CBCCrystalModel *self;
-    
-    self = (CBCCrystalModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CBCCrystalModel_init(CBCCrystalModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new BCCrystalModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"dnn",Py_BuildValue("d",220.000000000000));
-        PyDict_SetItemString(self->params,"sldSph",Py_BuildValue("d",0.000003000000));
-        PyDict_SetItemString(self->params,"d_factor",Py_BuildValue("d",0.060000000000));
-        PyDict_SetItemString(self->params,"psi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",40.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000006300000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->phi.dispersion->accept_as_source(visitor, self->model->phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->psi.dispersion->accept_as_source(visitor, self->model->psi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "psi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->theta.dispersion->accept_as_source(visitor, self->model->theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "theta", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CBCCrystalModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CBCCrystalModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CBCCrystalModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CBCCrystalModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CBCCrystalModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(BCCrystalModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( BCCrystalModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CBCCrystalModelError, 
-                   "CBCCrystalModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CBCCrystalModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBCCrystalModelError, 
-	    	"CBCCrystalModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CBCCrystalModelError, 
-                   "CBCCrystalModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CBCCrystalModelError, 
-	    		"CBCCrystalModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CBCCrystalModelError, 
-                   "CBCCrystalModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CBCCrystalModelError, 
-                   "CBCCrystalModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CBCCrystalModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBCCrystalModelError, 
-	    	"CBCCrystalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CBCCrystalModelError, 
-	    		"CBCCrystalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CBCCrystalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CBCCrystalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CBCCrystalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CBCCrystalModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CBCCrystalModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBCCrystalModelError, 
-	    	"CBCCrystalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CBCCrystalModelError, 
-	    		"CBCCrystalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CBCCrystalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CBCCrystalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CBCCrystalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CBCCrystalModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CBCCrystalModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CBCCrystalModelError,
-	    	"CBCCrystalModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "phi")) {
-        self->model->phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "psi")) {
-        self->model->psi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "theta")) {
-        self->model->theta.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CBCCrystalModelError,
-	    	"CBCCrystalModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CBCCrystalModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CBCCrystalModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CBCCrystalModel",             /*tp_name*/
-    sizeof(CBCCrystalModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CBCCrystalModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CBCCrystalModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CBCCrystalModel_methods,             /* tp_methods */
-    CBCCrystalModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CBCCrystalModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CBCCrystalModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCBCCrystalModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CBCCrystalModelType) < 0)
-        return;
-
-    Py_INCREF(&CBCCrystalModelType);
-    PyModule_AddObject(module, "CBCCrystalModel", (PyObject *)&CBCCrystalModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CBCCrystalModel.error";
-    CBCCrystalModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CBCCrystalModelError", CBCCrystalModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CBarBellModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CBarBellModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,628 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CBarBellModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY barbell.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "barbell.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CBarBellModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    BarBellModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CBarBellModel;
-
-
-static void
-CBarBellModel_dealloc(CBarBellModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CBarBellModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CBarBellModel *self;
-    
-    self = (CBarBellModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CBarBellModel_init(CBarBellModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new BarBellModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sld_barbell",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"len_bar",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"rad_bell",Py_BuildValue("d",40.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"rad_bar",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006300000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->rad_bar.dispersion->accept_as_source(visitor, self->model->rad_bar.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rad_bar", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->len_bar.dispersion->accept_as_source(visitor, self->model->len_bar.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "len_bar", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->rad_bell.dispersion->accept_as_source(visitor, self->model->rad_bell.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rad_bell", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->phi.dispersion->accept_as_source(visitor, self->model->phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->theta.dispersion->accept_as_source(visitor, self->model->theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "theta", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CBarBellModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CBarBellModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CBarBellModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CBarBellModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CBarBellModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(BarBellModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( BarBellModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CBarBellModelError, 
-                   "CBarBellModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CBarBellModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_barbell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_barbell") );
-    self->model->len_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_bar") );
-    self->model->rad_bell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bell") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->rad_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bar") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bar");
-    self->model->rad_bar.dispersion->accept_as_destination(visitor, self->model->rad_bar.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "len_bar");
-    self->model->len_bar.dispersion->accept_as_destination(visitor, self->model->len_bar.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bell");
-    self->model->rad_bell.dispersion->accept_as_destination(visitor, self->model->rad_bell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBarBellModelError, 
-	    	"CBarBellModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CBarBellModelError, 
-                   "CBarBellModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CBarBellModelError, 
-	    		"CBarBellModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CBarBellModelError, 
-                   "CBarBellModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CBarBellModelError, 
-                   "CBarBellModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CBarBellModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_barbell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_barbell") );
-    self->model->len_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_bar") );
-    self->model->rad_bell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bell") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->rad_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bar") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bar");
-    self->model->rad_bar.dispersion->accept_as_destination(visitor, self->model->rad_bar.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "len_bar");
-    self->model->len_bar.dispersion->accept_as_destination(visitor, self->model->len_bar.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bell");
-    self->model->rad_bell.dispersion->accept_as_destination(visitor, self->model->rad_bell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBarBellModelError, 
-	    	"CBarBellModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CBarBellModelError, 
-	    		"CBarBellModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CBarBellModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CBarBellModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CBarBellModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CBarBellModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_barbell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_barbell") );
-    self->model->len_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_bar") );
-    self->model->rad_bell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bell") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->rad_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bar") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bar");
-    self->model->rad_bar.dispersion->accept_as_destination(visitor, self->model->rad_bar.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "len_bar");
-    self->model->len_bar.dispersion->accept_as_destination(visitor, self->model->len_bar.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bell");
-    self->model->rad_bell.dispersion->accept_as_destination(visitor, self->model->rad_bell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CBarBellModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_barbell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_barbell") );
-    self->model->len_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_bar") );
-    self->model->rad_bell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bell") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->rad_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bar") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bar");
-    self->model->rad_bar.dispersion->accept_as_destination(visitor, self->model->rad_bar.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "len_bar");
-    self->model->len_bar.dispersion->accept_as_destination(visitor, self->model->len_bar.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bell");
-    self->model->rad_bell.dispersion->accept_as_destination(visitor, self->model->rad_bell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBarBellModelError, 
-	    	"CBarBellModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CBarBellModelError, 
-	    		"CBarBellModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CBarBellModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CBarBellModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CBarBellModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CBarBellModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CBarBellModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CBarBellModelError,
-	    	"CBarBellModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "rad_bar")) {
-        self->model->rad_bar.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "len_bar")) {
-        self->model->len_bar.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "rad_bell")) {
-        self->model->rad_bell.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "phi")) {
-        self->model->phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "theta")) {
-        self->model->theta.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CBarBellModelError,
-	    	"CBarBellModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CBarBellModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CBarBellModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CBarBellModel",             /*tp_name*/
-    sizeof(CBarBellModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CBarBellModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CBarBellModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CBarBellModel_methods,             /* tp_methods */
-    CBarBellModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CBarBellModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CBarBellModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCBarBellModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CBarBellModelType) < 0)
-        return;
-
-    Py_INCREF(&CBarBellModelType);
-    PyModule_AddObject(module, "CBarBellModel", (PyObject *)&CBarBellModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CBarBellModel.error";
-    CBarBellModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CBarBellModelError", CBarBellModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CBinaryHSModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CBinaryHSModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,584 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CBinaryHSModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY binaryHS.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "binaryHS.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CBinaryHSModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    BinaryHSModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CBinaryHSModel;
-
-
-static void
-CBinaryHSModel_dealloc(CBinaryHSModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CBinaryHSModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CBinaryHSModel *self;
-    
-    self = (CBinaryHSModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CBinaryHSModel_init(CBinaryHSModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new BinaryHSModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"vol_frac_ls",Py_BuildValue("d",0.100000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000));
-        PyDict_SetItemString(self->params,"vol_frac_ss",Py_BuildValue("d",0.200000000000));
-        PyDict_SetItemString(self->params,"solvent_sld",Py_BuildValue("d",0.000006360000));
-        PyDict_SetItemString(self->params,"ls_sld",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"ss_sld",Py_BuildValue("d",0.000000500000));
-        PyDict_SetItemString(self->params,"s_radius",Py_BuildValue("d",25.000000000000));
-        PyDict_SetItemString(self->params,"l_radius",Py_BuildValue("d",100.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->l_radius.dispersion->accept_as_source(visitor, self->model->l_radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "l_radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->s_radius.dispersion->accept_as_source(visitor, self->model->s_radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "s_radius", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CBinaryHSModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CBinaryHSModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CBinaryHSModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CBinaryHSModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CBinaryHSModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(BinaryHSModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( BinaryHSModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CBinaryHSModelError, 
-                   "CBinaryHSModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CBinaryHSModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->vol_frac_ls = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vol_frac_ls") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->vol_frac_ss = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vol_frac_ss") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->ls_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ls_sld") );
-    self->model->ss_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ss_sld") );
-    self->model->s_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_radius") );
-    self->model->l_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "l_radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "l_radius");
-    self->model->l_radius.dispersion->accept_as_destination(visitor, self->model->l_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "s_radius");
-    self->model->s_radius.dispersion->accept_as_destination(visitor, self->model->s_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBinaryHSModelError, 
-	    	"CBinaryHSModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CBinaryHSModelError, 
-                   "CBinaryHSModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CBinaryHSModelError, 
-	    		"CBinaryHSModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CBinaryHSModelError, 
-                   "CBinaryHSModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CBinaryHSModelError, 
-                   "CBinaryHSModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CBinaryHSModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->vol_frac_ls = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vol_frac_ls") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->vol_frac_ss = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vol_frac_ss") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->ls_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ls_sld") );
-    self->model->ss_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ss_sld") );
-    self->model->s_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_radius") );
-    self->model->l_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "l_radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "l_radius");
-    self->model->l_radius.dispersion->accept_as_destination(visitor, self->model->l_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "s_radius");
-    self->model->s_radius.dispersion->accept_as_destination(visitor, self->model->s_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBinaryHSModelError, 
-	    	"CBinaryHSModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CBinaryHSModelError, 
-	    		"CBinaryHSModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CBinaryHSModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CBinaryHSModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CBinaryHSModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CBinaryHSModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->vol_frac_ls = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vol_frac_ls") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->vol_frac_ss = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vol_frac_ss") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->ls_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ls_sld") );
-    self->model->ss_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ss_sld") );
-    self->model->s_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_radius") );
-    self->model->l_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "l_radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "l_radius");
-    self->model->l_radius.dispersion->accept_as_destination(visitor, self->model->l_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "s_radius");
-    self->model->s_radius.dispersion->accept_as_destination(visitor, self->model->s_radius.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CBinaryHSModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->vol_frac_ls = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vol_frac_ls") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->vol_frac_ss = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vol_frac_ss") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->ls_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ls_sld") );
-    self->model->ss_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ss_sld") );
-    self->model->s_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_radius") );
-    self->model->l_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "l_radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "l_radius");
-    self->model->l_radius.dispersion->accept_as_destination(visitor, self->model->l_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "s_radius");
-    self->model->s_radius.dispersion->accept_as_destination(visitor, self->model->s_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CBinaryHSModelError, 
-	    	"CBinaryHSModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CBinaryHSModelError, 
-	    		"CBinaryHSModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CBinaryHSModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CBinaryHSModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CBinaryHSModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CBinaryHSModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CBinaryHSModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CBinaryHSModelError,
-	    	"CBinaryHSModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "l_radius")) {
-        self->model->l_radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "s_radius")) {
-        self->model->s_radius.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CBinaryHSModelError,
-	    	"CBinaryHSModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CBinaryHSModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CBinaryHSModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CBinaryHSModel",             /*tp_name*/
-    sizeof(CBinaryHSModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CBinaryHSModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CBinaryHSModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CBinaryHSModel_methods,             /* tp_methods */
-    CBinaryHSModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CBinaryHSModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CBinaryHSModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCBinaryHSModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CBinaryHSModelType) < 0)
-        return;
-
-    Py_INCREF(&CBinaryHSModelType);
-    PyModule_AddObject(module, "CBinaryHSModel", (PyObject *)&CBinaryHSModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CBinaryHSModel.error";
-    CBinaryHSModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CBinaryHSModelError", CBinaryHSModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CCSParallelepipedModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCSParallelepipedModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,676 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CCSParallelepipedModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY csparallelepiped.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "csparallelepiped.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CCSParallelepipedModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    CSParallelepipedModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CCSParallelepipedModel;
-
-
-static void
-CCSParallelepipedModel_dealloc(CCSParallelepipedModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CCSParallelepipedModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CCSParallelepipedModel *self;
-    
-    self = (CCSParallelepipedModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CCSParallelepipedModel_init(CCSParallelepipedModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new CSParallelepipedModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"sld_rimB",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_rimC",Py_BuildValue("d",0.000002000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.060000000000));
-        PyDict_SetItemString(self->params,"parallel_psi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"midB",Py_BuildValue("d",75.000000000000));
-        PyDict_SetItemString(self->params,"parallel_theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"parallel_phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_pcore",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"sld_rimA",Py_BuildValue("d",0.000002000000));
-        PyDict_SetItemString(self->params,"shortA",Py_BuildValue("d",35.000000000000));
-        PyDict_SetItemString(self->params,"rimB",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"rimC",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"longC",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006000000));
-        PyDict_SetItemString(self->params,"rimA",Py_BuildValue("d",10.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->shortA.dispersion->accept_as_source(visitor, self->model->shortA.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "shortA", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->midB.dispersion->accept_as_source(visitor, self->model->midB.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "midB", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->longC.dispersion->accept_as_source(visitor, self->model->longC.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "longC", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->parallel_phi.dispersion->accept_as_source(visitor, self->model->parallel_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "parallel_phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->parallel_psi.dispersion->accept_as_source(visitor, self->model->parallel_psi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "parallel_psi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->parallel_theta.dispersion->accept_as_source(visitor, self->model->parallel_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "parallel_theta", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CCSParallelepipedModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CCSParallelepipedModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CCSParallelepipedModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CCSParallelepipedModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CCSParallelepipedModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(CSParallelepipedModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( CSParallelepipedModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CCSParallelepipedModelError, 
-                   "CCSParallelepipedModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CCSParallelepipedModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sld_rimB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimB") );
-    self->model->sld_rimC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimC") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") );
-    self->model->midB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "midB") );
-    self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") );
-    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") );
-    self->model->sld_pcore = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_pcore") );
-    self->model->sld_rimA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimA") );
-    self->model->shortA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shortA") );
-    self->model->rimB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimB") );
-    self->model->rimC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimC") );
-    self->model->longC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longC") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->rimA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimA") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "shortA");
-    self->model->shortA.dispersion->accept_as_destination(visitor, self->model->shortA.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "midB");
-    self->model->midB.dispersion->accept_as_destination(visitor, self->model->midB.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "longC");
-    self->model->longC.dispersion->accept_as_destination(visitor, self->model->longC.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi");
-    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi");
-    self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta");
-    self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCSParallelepipedModelError, 
-	    	"CCSParallelepipedModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CCSParallelepipedModelError, 
-                   "CCSParallelepipedModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CCSParallelepipedModelError, 
-	    		"CCSParallelepipedModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CCSParallelepipedModelError, 
-                   "CCSParallelepipedModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CCSParallelepipedModelError, 
-                   "CCSParallelepipedModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CCSParallelepipedModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sld_rimB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimB") );
-    self->model->sld_rimC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimC") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") );
-    self->model->midB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "midB") );
-    self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") );
-    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") );
-    self->model->sld_pcore = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_pcore") );
-    self->model->sld_rimA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimA") );
-    self->model->shortA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shortA") );
-    self->model->rimB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimB") );
-    self->model->rimC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimC") );
-    self->model->longC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longC") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->rimA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimA") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "shortA");
-    self->model->shortA.dispersion->accept_as_destination(visitor, self->model->shortA.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "midB");
-    self->model->midB.dispersion->accept_as_destination(visitor, self->model->midB.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "longC");
-    self->model->longC.dispersion->accept_as_destination(visitor, self->model->longC.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi");
-    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi");
-    self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta");
-    self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCSParallelepipedModelError, 
-	    	"CCSParallelepipedModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCSParallelepipedModelError, 
-	    		"CCSParallelepipedModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CCSParallelepipedModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CCSParallelepipedModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CCSParallelepipedModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CCSParallelepipedModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sld_rimB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimB") );
-    self->model->sld_rimC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimC") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") );
-    self->model->midB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "midB") );
-    self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") );
-    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") );
-    self->model->sld_pcore = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_pcore") );
-    self->model->sld_rimA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimA") );
-    self->model->shortA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shortA") );
-    self->model->rimB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimB") );
-    self->model->rimC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimC") );
-    self->model->longC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longC") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->rimA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimA") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "shortA");
-    self->model->shortA.dispersion->accept_as_destination(visitor, self->model->shortA.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "midB");
-    self->model->midB.dispersion->accept_as_destination(visitor, self->model->midB.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "longC");
-    self->model->longC.dispersion->accept_as_destination(visitor, self->model->longC.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi");
-    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi");
-    self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta");
-    self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CCSParallelepipedModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sld_rimB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimB") );
-    self->model->sld_rimC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimC") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") );
-    self->model->midB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "midB") );
-    self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") );
-    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") );
-    self->model->sld_pcore = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_pcore") );
-    self->model->sld_rimA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_rimA") );
-    self->model->shortA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shortA") );
-    self->model->rimB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimB") );
-    self->model->rimC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimC") );
-    self->model->longC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longC") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->rimA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rimA") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "shortA");
-    self->model->shortA.dispersion->accept_as_destination(visitor, self->model->shortA.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "midB");
-    self->model->midB.dispersion->accept_as_destination(visitor, self->model->midB.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "longC");
-    self->model->longC.dispersion->accept_as_destination(visitor, self->model->longC.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi");
-    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi");
-    self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta");
-    self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCSParallelepipedModelError, 
-	    	"CCSParallelepipedModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCSParallelepipedModelError, 
-	    		"CCSParallelepipedModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CCSParallelepipedModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CCSParallelepipedModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CCSParallelepipedModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CCSParallelepipedModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CCSParallelepipedModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CCSParallelepipedModelError,
-	    	"CCSParallelepipedModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "shortA")) {
-        self->model->shortA.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "midB")) {
-        self->model->midB.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "longC")) {
-        self->model->longC.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "parallel_phi")) {
-        self->model->parallel_phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "parallel_psi")) {
-        self->model->parallel_psi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "parallel_theta")) {
-        self->model->parallel_theta.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CCSParallelepipedModelError,
-	    	"CCSParallelepipedModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CCSParallelepipedModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CCSParallelepipedModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CCSParallelepipedModel",             /*tp_name*/
-    sizeof(CCSParallelepipedModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CCSParallelepipedModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CCSParallelepipedModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CCSParallelepipedModel_methods,             /* tp_methods */
-    CCSParallelepipedModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CCSParallelepipedModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CCSParallelepipedModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCCSParallelepipedModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CCSParallelepipedModelType) < 0)
-        return;
-
-    Py_INCREF(&CCSParallelepipedModelType);
-    PyModule_AddObject(module, "CCSParallelepipedModel", (PyObject *)&CCSParallelepipedModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CCSParallelepipedModel.error";
-    CCSParallelepipedModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CCSParallelepipedModelError", CCSParallelepipedModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CCappedCylinderModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCappedCylinderModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,628 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CCappedCylinderModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY capcyl.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "capcyl.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CCappedCylinderModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    CappedCylinderModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CCappedCylinderModel;
-
-
-static void
-CCappedCylinderModel_dealloc(CCappedCylinderModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CCappedCylinderModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CCappedCylinderModel *self;
-    
-    self = (CCappedCylinderModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CCappedCylinderModel_init(CCappedCylinderModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new CappedCylinderModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"len_cyl",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"sld_capcyl",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"rad_cap",Py_BuildValue("d",40.000000000000));
-        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006300000));
-        PyDict_SetItemString(self->params,"rad_cyl",Py_BuildValue("d",20.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->rad_cyl.dispersion->accept_as_source(visitor, self->model->rad_cyl.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rad_cyl", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->len_cyl.dispersion->accept_as_source(visitor, self->model->len_cyl.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "len_cyl", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->rad_cap.dispersion->accept_as_source(visitor, self->model->rad_cap.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rad_cap", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->phi.dispersion->accept_as_source(visitor, self->model->phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->theta.dispersion->accept_as_source(visitor, self->model->theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "theta", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CCappedCylinderModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CCappedCylinderModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CCappedCylinderModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CCappedCylinderModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CCappedCylinderModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(CappedCylinderModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( CappedCylinderModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CCappedCylinderModelError, 
-                   "CCappedCylinderModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CCappedCylinderModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->len_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_cyl") );
-    self->model->sld_capcyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_capcyl") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->rad_cap = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cap") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->rad_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cyl") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cyl");
-    self->model->rad_cyl.dispersion->accept_as_destination(visitor, self->model->rad_cyl.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "len_cyl");
-    self->model->len_cyl.dispersion->accept_as_destination(visitor, self->model->len_cyl.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cap");
-    self->model->rad_cap.dispersion->accept_as_destination(visitor, self->model->rad_cap.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCappedCylinderModelError, 
-	    	"CCappedCylinderModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CCappedCylinderModelError, 
-                   "CCappedCylinderModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CCappedCylinderModelError, 
-	    		"CCappedCylinderModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CCappedCylinderModelError, 
-                   "CCappedCylinderModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CCappedCylinderModelError, 
-                   "CCappedCylinderModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CCappedCylinderModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->len_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_cyl") );
-    self->model->sld_capcyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_capcyl") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->rad_cap = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cap") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->rad_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cyl") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cyl");
-    self->model->rad_cyl.dispersion->accept_as_destination(visitor, self->model->rad_cyl.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "len_cyl");
-    self->model->len_cyl.dispersion->accept_as_destination(visitor, self->model->len_cyl.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cap");
-    self->model->rad_cap.dispersion->accept_as_destination(visitor, self->model->rad_cap.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCappedCylinderModelError, 
-	    	"CCappedCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCappedCylinderModelError, 
-	    		"CCappedCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CCappedCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CCappedCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CCappedCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CCappedCylinderModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->len_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_cyl") );
-    self->model->sld_capcyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_capcyl") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->rad_cap = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cap") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->rad_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cyl") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cyl");
-    self->model->rad_cyl.dispersion->accept_as_destination(visitor, self->model->rad_cyl.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "len_cyl");
-    self->model->len_cyl.dispersion->accept_as_destination(visitor, self->model->len_cyl.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cap");
-    self->model->rad_cap.dispersion->accept_as_destination(visitor, self->model->rad_cap.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CCappedCylinderModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->len_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_cyl") );
-    self->model->sld_capcyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_capcyl") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->rad_cap = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cap") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->rad_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cyl") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cyl");
-    self->model->rad_cyl.dispersion->accept_as_destination(visitor, self->model->rad_cyl.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "len_cyl");
-    self->model->len_cyl.dispersion->accept_as_destination(visitor, self->model->len_cyl.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cap");
-    self->model->rad_cap.dispersion->accept_as_destination(visitor, self->model->rad_cap.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCappedCylinderModelError, 
-	    	"CCappedCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCappedCylinderModelError, 
-	    		"CCappedCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CCappedCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CCappedCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CCappedCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CCappedCylinderModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CCappedCylinderModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CCappedCylinderModelError,
-	    	"CCappedCylinderModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "rad_cyl")) {
-        self->model->rad_cyl.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "len_cyl")) {
-        self->model->len_cyl.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "rad_cap")) {
-        self->model->rad_cap.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "phi")) {
-        self->model->phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "theta")) {
-        self->model->theta.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CCappedCylinderModelError,
-	    	"CCappedCylinderModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CCappedCylinderModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CCappedCylinderModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CCappedCylinderModel",             /*tp_name*/
-    sizeof(CCappedCylinderModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CCappedCylinderModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CCappedCylinderModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CCappedCylinderModel_methods,             /* tp_methods */
-    CCappedCylinderModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CCappedCylinderModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CCappedCylinderModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCCappedCylinderModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CCappedCylinderModelType) < 0)
-        return;
-
-    Py_INCREF(&CCappedCylinderModelType);
-    PyModule_AddObject(module, "CCappedCylinderModel", (PyObject *)&CCappedCylinderModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CCappedCylinderModel.error";
-    CCappedCylinderModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CCappedCylinderModelError", CCappedCylinderModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CCoreFourShellModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCoreFourShellModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,648 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CCoreFourShellModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY corefourshell.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "corefourshell.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CCoreFourShellModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    CoreFourShellModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CCoreFourShellModel;
-
-
-static void
-CCoreFourShellModel_dealloc(CCoreFourShellModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CCoreFourShellModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CCoreFourShellModel *self;
-    
-    self = (CCoreFourShellModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CCoreFourShellModel_init(CCoreFourShellModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new CoreFourShellModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"thick_shell4",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"sld_shell4",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sld_shell2",Py_BuildValue("d",0.000002000000));
-        PyDict_SetItemString(self->params,"thick_shell1",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"thick_shell2",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"sld_shell1",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"thick_shell3",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"sld_core0",Py_BuildValue("d",0.000006400000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000));
-        PyDict_SetItemString(self->params,"rad_core0",Py_BuildValue("d",60.000000000000));
-        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006400000));
-        PyDict_SetItemString(self->params,"sld_shell3",Py_BuildValue("d",0.000003000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->rad_core0.dispersion->accept_as_source(visitor, self->model->rad_core0.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rad_core0", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell1.dispersion->accept_as_source(visitor, self->model->thick_shell1.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell1", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell2.dispersion->accept_as_source(visitor, self->model->thick_shell2.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell2", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell3.dispersion->accept_as_source(visitor, self->model->thick_shell3.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell3", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell4.dispersion->accept_as_source(visitor, self->model->thick_shell4.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell4", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CCoreFourShellModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CCoreFourShellModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CCoreFourShellModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CCoreFourShellModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CCoreFourShellModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(CoreFourShellModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( CoreFourShellModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CCoreFourShellModelError, 
-                   "CCoreFourShellModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CCoreFourShellModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell4") );
-    self->model->sld_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell4") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell2") );
-    self->model->thick_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell1") );
-    self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
-    self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
-    self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell2");
-    self->model->thick_shell2.dispersion->accept_as_destination(visitor, self->model->thick_shell2.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell3");
-    self->model->thick_shell3.dispersion->accept_as_destination(visitor, self->model->thick_shell3.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell4");
-    self->model->thick_shell4.dispersion->accept_as_destination(visitor, self->model->thick_shell4.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreFourShellModelError, 
-	    	"CCoreFourShellModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CCoreFourShellModelError, 
-                   "CCoreFourShellModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CCoreFourShellModelError, 
-	    		"CCoreFourShellModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CCoreFourShellModelError, 
-                   "CCoreFourShellModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CCoreFourShellModelError, 
-                   "CCoreFourShellModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CCoreFourShellModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell4") );
-    self->model->sld_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell4") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell2") );
-    self->model->thick_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell1") );
-    self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
-    self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
-    self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell2");
-    self->model->thick_shell2.dispersion->accept_as_destination(visitor, self->model->thick_shell2.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell3");
-    self->model->thick_shell3.dispersion->accept_as_destination(visitor, self->model->thick_shell3.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell4");
-    self->model->thick_shell4.dispersion->accept_as_destination(visitor, self->model->thick_shell4.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreFourShellModelError, 
-	    	"CCoreFourShellModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCoreFourShellModelError, 
-	    		"CCoreFourShellModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CCoreFourShellModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CCoreFourShellModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CCoreFourShellModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CCoreFourShellModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell4") );
-    self->model->sld_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell4") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell2") );
-    self->model->thick_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell1") );
-    self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
-    self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
-    self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell2");
-    self->model->thick_shell2.dispersion->accept_as_destination(visitor, self->model->thick_shell2.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell3");
-    self->model->thick_shell3.dispersion->accept_as_destination(visitor, self->model->thick_shell3.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell4");
-    self->model->thick_shell4.dispersion->accept_as_destination(visitor, self->model->thick_shell4.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CCoreFourShellModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell4") );
-    self->model->sld_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell4") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell2") );
-    self->model->thick_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell1") );
-    self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
-    self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
-    self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell2");
-    self->model->thick_shell2.dispersion->accept_as_destination(visitor, self->model->thick_shell2.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell3");
-    self->model->thick_shell3.dispersion->accept_as_destination(visitor, self->model->thick_shell3.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell4");
-    self->model->thick_shell4.dispersion->accept_as_destination(visitor, self->model->thick_shell4.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreFourShellModelError, 
-	    	"CCoreFourShellModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCoreFourShellModelError, 
-	    		"CCoreFourShellModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CCoreFourShellModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CCoreFourShellModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CCoreFourShellModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CCoreFourShellModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CCoreFourShellModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CCoreFourShellModelError,
-	    	"CCoreFourShellModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "rad_core0")) {
-        self->model->rad_core0.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell1")) {
-        self->model->thick_shell1.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell2")) {
-        self->model->thick_shell2.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell3")) {
-        self->model->thick_shell3.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell4")) {
-        self->model->thick_shell4.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CCoreFourShellModelError,
-	    	"CCoreFourShellModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CCoreFourShellModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CCoreFourShellModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CCoreFourShellModel",             /*tp_name*/
-    sizeof(CCoreFourShellModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CCoreFourShellModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CCoreFourShellModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CCoreFourShellModel_methods,             /* tp_methods */
-    CCoreFourShellModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CCoreFourShellModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CCoreFourShellModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCCoreFourShellModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CCoreFourShellModelType) < 0)
-        return;
-
-    Py_INCREF(&CCoreFourShellModelType);
-    PyModule_AddObject(module, "CCoreFourShellModel", (PyObject *)&CCoreFourShellModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CCoreFourShellModel.error";
-    CCoreFourShellModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CCoreFourShellModelError", CCoreFourShellModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CCoreShellCylinderModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCoreShellCylinderModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,633 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CCoreShellCylinderModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY core_shell_cylinder.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "core_shell_cylinder.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CCoreShellCylinderModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    CoreShellCylinderModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CCoreShellCylinderModel;
-
-
-static void
-CCoreShellCylinderModel_dealloc(CCoreShellCylinderModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CCoreShellCylinderModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CCoreShellCylinderModel *self;
-    
-    self = (CCoreShellCylinderModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CCoreShellCylinderModel_init(CCoreShellCylinderModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new CoreShellCylinderModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"axis_theta",Py_BuildValue("d",90.000000000000));
-        PyDict_SetItemString(self->params,"solvent_sld",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"thickness",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"axis_phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"length",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"core_sld",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"shell_sld",Py_BuildValue("d",0.000004000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thickness.dispersion->accept_as_source(visitor, self->model->thickness.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thickness", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->length.dispersion->accept_as_source(visitor, self->model->length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CCoreShellCylinderModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CCoreShellCylinderModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CCoreShellCylinderModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CCoreShellCylinderModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CCoreShellCylinderModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(CoreShellCylinderModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( CoreShellCylinderModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CCoreShellCylinderModelError, 
-                   "CCoreShellCylinderModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CCoreShellCylinderModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellCylinderModelError, 
-	    	"CCoreShellCylinderModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CCoreShellCylinderModelError, 
-                   "CCoreShellCylinderModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CCoreShellCylinderModelError, 
-	    		"CCoreShellCylinderModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CCoreShellCylinderModelError, 
-                   "CCoreShellCylinderModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CCoreShellCylinderModelError, 
-                   "CCoreShellCylinderModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CCoreShellCylinderModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellCylinderModelError, 
-	    	"CCoreShellCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCoreShellCylinderModelError, 
-	    		"CCoreShellCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CCoreShellCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CCoreShellCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CCoreShellCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CCoreShellCylinderModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CCoreShellCylinderModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellCylinderModelError, 
-	    	"CCoreShellCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCoreShellCylinderModelError, 
-	    		"CCoreShellCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CCoreShellCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CCoreShellCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CCoreShellCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CCoreShellCylinderModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CCoreShellCylinderModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CCoreShellCylinderModelError,
-	    	"CCoreShellCylinderModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thickness")) {
-        self->model->thickness.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "length")) {
-        self->model->length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_theta")) {
-        self->model->axis_theta.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_phi")) {
-        self->model->axis_phi.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CCoreShellCylinderModelError,
-	    	"CCoreShellCylinderModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CCoreShellCylinderModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CCoreShellCylinderModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CCoreShellCylinderModel",             /*tp_name*/
-    sizeof(CCoreShellCylinderModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CCoreShellCylinderModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CCoreShellCylinderModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CCoreShellCylinderModel_methods,             /* tp_methods */
-    CCoreShellCylinderModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CCoreShellCylinderModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CCoreShellCylinderModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCCoreShellCylinderModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CCoreShellCylinderModelType) < 0)
-        return;
-
-    Py_INCREF(&CCoreShellCylinderModelType);
-    PyModule_AddObject(module, "CCoreShellCylinderModel", (PyObject *)&CCoreShellCylinderModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CCoreShellCylinderModel.error";
-    CCoreShellCylinderModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CCoreShellCylinderModelError", CCoreShellCylinderModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CCoreShellEllipsoidModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCoreShellEllipsoidModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,651 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CCoreShellEllipsoidModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY spheroid.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "spheroid.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CCoreShellEllipsoidModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    CoreShellEllipsoidModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CCoreShellEllipsoidModel;
-
-
-static void
-CCoreShellEllipsoidModel_dealloc(CCoreShellEllipsoidModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CCoreShellEllipsoidModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CCoreShellEllipsoidModel *self;
-    
-    self = (CCoreShellEllipsoidModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CCoreShellEllipsoidModel_init(CCoreShellEllipsoidModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new CoreShellEllipsoidModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sld_core",Py_BuildValue("d",0.000002000000));
-        PyDict_SetItemString(self->params,"axis_theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"polar_shell",Py_BuildValue("d",30.000000000000));
-        PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006300000));
-        PyDict_SetItemString(self->params,"equat_shell",Py_BuildValue("d",250.000000000000));
-        PyDict_SetItemString(self->params,"axis_phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000));
-        PyDict_SetItemString(self->params,"equat_core",Py_BuildValue("d",200.000000000000));
-        PyDict_SetItemString(self->params,"polar_core",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"sld_shell",Py_BuildValue("d",0.000001000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->equat_core.dispersion->accept_as_source(visitor, self->model->equat_core.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "equat_core", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->polar_core.dispersion->accept_as_source(visitor, self->model->polar_core.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "polar_core", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->equat_shell.dispersion->accept_as_source(visitor, self->model->equat_shell.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "equat_shell", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->polar_shell.dispersion->accept_as_source(visitor, self->model->polar_shell.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "polar_shell", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CCoreShellEllipsoidModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CCoreShellEllipsoidModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CCoreShellEllipsoidModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CCoreShellEllipsoidModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CCoreShellEllipsoidModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(CoreShellEllipsoidModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( CoreShellEllipsoidModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CCoreShellEllipsoidModelError, 
-                   "CCoreShellEllipsoidModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CCoreShellEllipsoidModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->polar_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_shell") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->equat_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_shell") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->equat_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_core") );
-    self->model->polar_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_core") );
-    self->model->sld_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "equat_core");
-    self->model->equat_core.dispersion->accept_as_destination(visitor, self->model->equat_core.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "polar_core");
-    self->model->polar_core.dispersion->accept_as_destination(visitor, self->model->polar_core.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "equat_shell");
-    self->model->equat_shell.dispersion->accept_as_destination(visitor, self->model->equat_shell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "polar_shell");
-    self->model->polar_shell.dispersion->accept_as_destination(visitor, self->model->polar_shell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellEllipsoidModelError, 
-	    	"CCoreShellEllipsoidModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CCoreShellEllipsoidModelError, 
-                   "CCoreShellEllipsoidModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CCoreShellEllipsoidModelError, 
-	    		"CCoreShellEllipsoidModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CCoreShellEllipsoidModelError, 
-                   "CCoreShellEllipsoidModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CCoreShellEllipsoidModelError, 
-                   "CCoreShellEllipsoidModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CCoreShellEllipsoidModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->polar_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_shell") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->equat_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_shell") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->equat_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_core") );
-    self->model->polar_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_core") );
-    self->model->sld_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "equat_core");
-    self->model->equat_core.dispersion->accept_as_destination(visitor, self->model->equat_core.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "polar_core");
-    self->model->polar_core.dispersion->accept_as_destination(visitor, self->model->polar_core.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "equat_shell");
-    self->model->equat_shell.dispersion->accept_as_destination(visitor, self->model->equat_shell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "polar_shell");
-    self->model->polar_shell.dispersion->accept_as_destination(visitor, self->model->polar_shell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellEllipsoidModelError, 
-	    	"CCoreShellEllipsoidModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCoreShellEllipsoidModelError, 
-	    		"CCoreShellEllipsoidModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CCoreShellEllipsoidModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CCoreShellEllipsoidModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CCoreShellEllipsoidModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CCoreShellEllipsoidModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->polar_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_shell") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->equat_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_shell") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->equat_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_core") );
-    self->model->polar_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_core") );
-    self->model->sld_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "equat_core");
-    self->model->equat_core.dispersion->accept_as_destination(visitor, self->model->equat_core.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "polar_core");
-    self->model->polar_core.dispersion->accept_as_destination(visitor, self->model->polar_core.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "equat_shell");
-    self->model->equat_shell.dispersion->accept_as_destination(visitor, self->model->equat_shell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "polar_shell");
-    self->model->polar_shell.dispersion->accept_as_destination(visitor, self->model->polar_shell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CCoreShellEllipsoidModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->polar_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_shell") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->equat_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_shell") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->equat_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "equat_core") );
-    self->model->polar_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "polar_core") );
-    self->model->sld_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "equat_core");
-    self->model->equat_core.dispersion->accept_as_destination(visitor, self->model->equat_core.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "polar_core");
-    self->model->polar_core.dispersion->accept_as_destination(visitor, self->model->polar_core.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "equat_shell");
-    self->model->equat_shell.dispersion->accept_as_destination(visitor, self->model->equat_shell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "polar_shell");
-    self->model->polar_shell.dispersion->accept_as_destination(visitor, self->model->polar_shell.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellEllipsoidModelError, 
-	    	"CCoreShellEllipsoidModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCoreShellEllipsoidModelError, 
-	    		"CCoreShellEllipsoidModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CCoreShellEllipsoidModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CCoreShellEllipsoidModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CCoreShellEllipsoidModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CCoreShellEllipsoidModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CCoreShellEllipsoidModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CCoreShellEllipsoidModelError,
-	    	"CCoreShellEllipsoidModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "equat_core")) {
-        self->model->equat_core.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "polar_core")) {
-        self->model->polar_core.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "equat_shell")) {
-        self->model->equat_shell.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "polar_shell")) {
-        self->model->polar_shell.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_phi")) {
-        self->model->axis_phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_theta")) {
-        self->model->axis_theta.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CCoreShellEllipsoidModelError,
-	    	"CCoreShellEllipsoidModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CCoreShellEllipsoidModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CCoreShellEllipsoidModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CCoreShellEllipsoidModel",             /*tp_name*/
-    sizeof(CCoreShellEllipsoidModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CCoreShellEllipsoidModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CCoreShellEllipsoidModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CCoreShellEllipsoidModel_methods,             /* tp_methods */
-    CCoreShellEllipsoidModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CCoreShellEllipsoidModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CCoreShellEllipsoidModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCCoreShellEllipsoidModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CCoreShellEllipsoidModelType) < 0)
-        return;
-
-    Py_INCREF(&CCoreShellEllipsoidModelType);
-    PyModule_AddObject(module, "CCoreShellEllipsoidModel", (PyObject *)&CCoreShellEllipsoidModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CCoreShellEllipsoidModel.error";
-    CCoreShellEllipsoidModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CCoreShellEllipsoidModelError", CCoreShellEllipsoidModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CCoreShellModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCoreShellModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,579 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CCoreShellModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY core_shell.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "core_shell.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CCoreShellModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    CoreShellModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CCoreShellModel;
-
-
-static void
-CCoreShellModel_dealloc(CCoreShellModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CCoreShellModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CCoreShellModel *self;
-    
-    self = (CCoreShellModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CCoreShellModel_init(CCoreShellModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new CoreShellModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"core_sld",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"thickness",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"solvent_sld",Py_BuildValue("d",0.000003000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",60.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"shell_sld",Py_BuildValue("d",0.000002000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thickness.dispersion->accept_as_source(visitor, self->model->thickness.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thickness", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CCoreShellModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CCoreShellModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CCoreShellModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CCoreShellModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CCoreShellModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(CoreShellModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( CoreShellModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CCoreShellModelError, 
-                   "CCoreShellModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CCoreShellModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellModelError, 
-	    	"CCoreShellModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CCoreShellModelError, 
-                   "CCoreShellModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CCoreShellModelError, 
-	    		"CCoreShellModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CCoreShellModelError, 
-                   "CCoreShellModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CCoreShellModelError, 
-                   "CCoreShellModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CCoreShellModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellModelError, 
-	    	"CCoreShellModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCoreShellModelError, 
-	    		"CCoreShellModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CCoreShellModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CCoreShellModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CCoreShellModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CCoreShellModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CCoreShellModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCoreShellModelError, 
-	    	"CCoreShellModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCoreShellModelError, 
-	    		"CCoreShellModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CCoreShellModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CCoreShellModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CCoreShellModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CCoreShellModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CCoreShellModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CCoreShellModelError,
-	    	"CCoreShellModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thickness")) {
-        self->model->thickness.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CCoreShellModelError,
-	    	"CCoreShellModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CCoreShellModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CCoreShellModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CCoreShellModel",             /*tp_name*/
-    sizeof(CCoreShellModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CCoreShellModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CCoreShellModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CCoreShellModel_methods,             /* tp_methods */
-    CCoreShellModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CCoreShellModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CCoreShellModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCCoreShellModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CCoreShellModelType) < 0)
-        return;
-
-    Py_INCREF(&CCoreShellModelType);
-    PyModule_AddObject(module, "CCoreShellModel", (PyObject *)&CCoreShellModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CCoreShellModel.error";
-    CCoreShellModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CCoreShellModelError", CCoreShellModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CCylinderModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCylinderModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,610 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CCylinderModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY cylinder.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "cylinder.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CCylinderModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    CylinderModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CCylinderModel;
-
-
-static void
-CCylinderModel_dealloc(CCylinderModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CCylinderModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CCylinderModel *self;
-    
-    self = (CCylinderModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CCylinderModel_init(CCylinderModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new CylinderModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sldCyl",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"cyl_theta",Py_BuildValue("d",60.000000000000));
-        PyDict_SetItemString(self->params,"length",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"cyl_phi",Py_BuildValue("d",60.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->length.dispersion->accept_as_source(visitor, self->model->length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->cyl_theta.dispersion->accept_as_source(visitor, self->model->cyl_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "cyl_theta", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->cyl_phi.dispersion->accept_as_source(visitor, self->model->cyl_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "cyl_phi", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CCylinderModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CCylinderModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CCylinderModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CCylinderModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CCylinderModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(CylinderModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( CylinderModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CCylinderModelError, 
-                   "CCylinderModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CCylinderModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta");
-    self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi");
-    self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCylinderModelError, 
-	    	"CCylinderModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CCylinderModelError, 
-                   "CCylinderModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CCylinderModelError, 
-	    		"CCylinderModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CCylinderModelError, 
-                   "CCylinderModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CCylinderModelError, 
-                   "CCylinderModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CCylinderModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta");
-    self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi");
-    self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCylinderModelError, 
-	    	"CCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCylinderModelError, 
-	    		"CCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CCylinderModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta");
-    self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi");
-    self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CCylinderModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta");
-    self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi");
-    self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CCylinderModelError, 
-	    	"CCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CCylinderModelError, 
-	    		"CCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CCylinderModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CCylinderModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CCylinderModelError,
-	    	"CCylinderModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "length")) {
-        self->model->length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "cyl_theta")) {
-        self->model->cyl_theta.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "cyl_phi")) {
-        self->model->cyl_phi.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CCylinderModelError,
-	    	"CCylinderModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CCylinderModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CCylinderModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CCylinderModel",             /*tp_name*/
-    sizeof(CCylinderModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CCylinderModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CCylinderModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CCylinderModel_methods,             /* tp_methods */
-    CCylinderModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CCylinderModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CCylinderModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCCylinderModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CCylinderModelType) < 0)
-        return;
-
-    Py_INCREF(&CCylinderModelType);
-    PyModule_AddObject(module, "CCylinderModel", (PyObject *)&CCylinderModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CCylinderModel.error";
-    CCylinderModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CCylinderModelError", CCylinderModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CDiamCylFunc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CDiamCylFunc.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,554 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CDiamCylFunc
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY DiamCyl.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "DiamCyl.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CDiamCylFuncError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    DiamCylFunc * model;
-    /// Log for unit testing
-    PyObject * log;
-} CDiamCylFunc;
-
-
-static void
-CDiamCylFunc_dealloc(CDiamCylFunc* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CDiamCylFunc_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CDiamCylFunc *self;
-    
-    self = (CDiamCylFunc *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CDiamCylFunc_init(CDiamCylFunc *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new DiamCylFunc();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"length",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",20.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->length.dispersion->accept_as_source(visitor, self->model->length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "length", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CDiamCylFunc_members[] = {
-    {name_params, T_OBJECT, offsetof(CDiamCylFunc, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CDiamCylFunc, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CDiamCylFunc, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CDiamCylFunc_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(DiamCylFunc* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( DiamCylFunc* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CDiamCylFuncError, 
-                   "CDiamCylFunc.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CDiamCylFunc *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CDiamCylFuncError, 
-	    	"CDiamCylFunc.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CDiamCylFuncError, 
-                   "CDiamCylFunc.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CDiamCylFuncError, 
-	    		"CDiamCylFunc.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CDiamCylFuncError, 
-                   "CDiamCylFunc.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CDiamCylFuncError, 
-                   "CDiamCylFunc.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CDiamCylFunc *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CDiamCylFuncError, 
-	    	"CDiamCylFunc.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CDiamCylFuncError, 
-	    		"CDiamCylFunc.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CDiamCylFunc_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CDiamCylFunc_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CDiamCylFunc_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CDiamCylFunc *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CDiamCylFunc *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CDiamCylFuncError, 
-	    	"CDiamCylFunc.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CDiamCylFuncError, 
-	    		"CDiamCylFunc.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CDiamCylFunc_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CDiamCylFunc_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CDiamCylFunc_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CDiamCylFunc *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CDiamCylFunc *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CDiamCylFuncError,
-	    	"CDiamCylFunc.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "length")) {
-        self->model->length.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CDiamCylFuncError,
-	    	"CDiamCylFunc.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CDiamCylFunc_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CDiamCylFuncType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CDiamCylFunc",             /*tp_name*/
-    sizeof(CDiamCylFunc),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CDiamCylFunc_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CDiamCylFunc objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CDiamCylFunc_methods,             /* tp_methods */
-    CDiamCylFunc_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CDiamCylFunc_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CDiamCylFunc_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCDiamCylFunc(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CDiamCylFuncType) < 0)
-        return;
-
-    Py_INCREF(&CDiamCylFuncType);
-    PyModule_AddObject(module, "CDiamCylFunc", (PyObject *)&CDiamCylFuncType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CDiamCylFunc.error";
-    CDiamCylFuncError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CDiamCylFuncError", CDiamCylFuncError);
-}
-
Index: sansmodels/src/sans/models/c_models/CDiamEllipFunc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CDiamEllipFunc.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,554 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CDiamEllipFunc
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY DiamEllip.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "DiamEllip.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CDiamEllipFuncError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    DiamEllipFunc * model;
-    /// Log for unit testing
-    PyObject * log;
-} CDiamEllipFunc;
-
-
-static void
-CDiamEllipFunc_dealloc(CDiamEllipFunc* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CDiamEllipFunc_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CDiamEllipFunc *self;
-    
-    self = (CDiamEllipFunc *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CDiamEllipFunc_init(CDiamEllipFunc *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new DiamEllipFunc();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"radius_b",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"radius_a",Py_BuildValue("d",20.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius_a.dispersion->accept_as_source(visitor, self->model->radius_a.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius_a", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->radius_b.dispersion->accept_as_source(visitor, self->model->radius_b.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius_b", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CDiamEllipFunc_members[] = {
-    {name_params, T_OBJECT, offsetof(CDiamEllipFunc, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CDiamEllipFunc, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CDiamEllipFunc, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CDiamEllipFunc_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(DiamEllipFunc* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( DiamEllipFunc* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CDiamEllipFuncError, 
-                   "CDiamEllipFunc.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CDiamEllipFunc *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") );
-    self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_a");
-    self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_b");
-    self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CDiamEllipFuncError, 
-	    	"CDiamEllipFunc.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CDiamEllipFuncError, 
-                   "CDiamEllipFunc.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CDiamEllipFuncError, 
-	    		"CDiamEllipFunc.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CDiamEllipFuncError, 
-                   "CDiamEllipFunc.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CDiamEllipFuncError, 
-                   "CDiamEllipFunc.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CDiamEllipFunc *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") );
-    self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_a");
-    self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_b");
-    self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CDiamEllipFuncError, 
-	    	"CDiamEllipFunc.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CDiamEllipFuncError, 
-	    		"CDiamEllipFunc.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CDiamEllipFunc_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CDiamEllipFunc_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CDiamEllipFunc_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CDiamEllipFunc *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") );
-    self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_a");
-    self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_b");
-    self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CDiamEllipFunc *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") );
-    self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_a");
-    self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_b");
-    self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CDiamEllipFuncError, 
-	    	"CDiamEllipFunc.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CDiamEllipFuncError, 
-	    		"CDiamEllipFunc.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CDiamEllipFunc_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CDiamEllipFunc_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CDiamEllipFunc_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CDiamEllipFunc *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CDiamEllipFunc *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CDiamEllipFuncError,
-	    	"CDiamEllipFunc.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius_a")) {
-        self->model->radius_a.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "radius_b")) {
-        self->model->radius_b.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CDiamEllipFuncError,
-	    	"CDiamEllipFunc.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CDiamEllipFunc_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CDiamEllipFuncType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CDiamEllipFunc",             /*tp_name*/
-    sizeof(CDiamEllipFunc),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CDiamEllipFunc_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CDiamEllipFunc objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CDiamEllipFunc_methods,             /* tp_methods */
-    CDiamEllipFunc_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CDiamEllipFunc_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CDiamEllipFunc_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCDiamEllipFunc(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CDiamEllipFuncType) < 0)
-        return;
-
-    Py_INCREF(&CDiamEllipFuncType);
-    PyModule_AddObject(module, "CDiamEllipFunc", (PyObject *)&CDiamEllipFuncType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CDiamEllipFunc.error";
-    CDiamEllipFuncError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CDiamEllipFuncError", CDiamEllipFuncError);
-}
-
Index: sansmodels/src/sans/models/c_models/CEllipsoidModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CEllipsoidModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,610 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CEllipsoidModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY ellipsoid.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "ellipsoid.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CEllipsoidModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    EllipsoidModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CEllipsoidModel;
-
-
-static void
-CEllipsoidModel_dealloc(CEllipsoidModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CEllipsoidModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CEllipsoidModel *self;
-    
-    self = (CEllipsoidModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CEllipsoidModel_init(CEllipsoidModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new EllipsoidModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"axis_theta",Py_BuildValue("d",90.000000000000));
-        PyDict_SetItemString(self->params,"radius_b",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"radius_a",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"axis_phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldEll",Py_BuildValue("d",0.000004000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius_a.dispersion->accept_as_source(visitor, self->model->radius_a.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius_a", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->radius_b.dispersion->accept_as_source(visitor, self->model->radius_b.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius_b", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CEllipsoidModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CEllipsoidModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CEllipsoidModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CEllipsoidModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CEllipsoidModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(EllipsoidModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( EllipsoidModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CEllipsoidModelError, 
-                   "CEllipsoidModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CEllipsoidModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") );
-    self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldEll = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldEll") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_a");
-    self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_b");
-    self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CEllipsoidModelError, 
-	    	"CEllipsoidModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CEllipsoidModelError, 
-                   "CEllipsoidModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CEllipsoidModelError, 
-	    		"CEllipsoidModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CEllipsoidModelError, 
-                   "CEllipsoidModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CEllipsoidModelError, 
-                   "CEllipsoidModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CEllipsoidModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") );
-    self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldEll = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldEll") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_a");
-    self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_b");
-    self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CEllipsoidModelError, 
-	    	"CEllipsoidModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CEllipsoidModelError, 
-	    		"CEllipsoidModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CEllipsoidModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CEllipsoidModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CEllipsoidModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CEllipsoidModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") );
-    self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldEll = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldEll") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_a");
-    self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_b");
-    self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CEllipsoidModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->radius_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_b") );
-    self->model->radius_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius_a") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldEll = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldEll") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_a");
-    self->model->radius_a.dispersion->accept_as_destination(visitor, self->model->radius_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius_b");
-    self->model->radius_b.dispersion->accept_as_destination(visitor, self->model->radius_b.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CEllipsoidModelError, 
-	    	"CEllipsoidModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CEllipsoidModelError, 
-	    		"CEllipsoidModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CEllipsoidModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CEllipsoidModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CEllipsoidModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CEllipsoidModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CEllipsoidModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CEllipsoidModelError,
-	    	"CEllipsoidModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius_a")) {
-        self->model->radius_a.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "radius_b")) {
-        self->model->radius_b.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_theta")) {
-        self->model->axis_theta.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_phi")) {
-        self->model->axis_phi.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CEllipsoidModelError,
-	    	"CEllipsoidModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CEllipsoidModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CEllipsoidModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CEllipsoidModel",             /*tp_name*/
-    sizeof(CEllipsoidModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CEllipsoidModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CEllipsoidModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CEllipsoidModel_methods,             /* tp_methods */
-    CEllipsoidModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CEllipsoidModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CEllipsoidModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCEllipsoidModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CEllipsoidModelType) < 0)
-        return;
-
-    Py_INCREF(&CEllipsoidModelType);
-    PyModule_AddObject(module, "CEllipsoidModel", (PyObject *)&CEllipsoidModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CEllipsoidModel.error";
-    CEllipsoidModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CEllipsoidModelError", CEllipsoidModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CEllipticalCylinderModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CEllipticalCylinderModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,646 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CEllipticalCylinderModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY elliptical_cylinder.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "elliptical_cylinder.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CEllipticalCylinderModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    EllipticalCylinderModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CEllipticalCylinderModel;
-
-
-static void
-CEllipticalCylinderModel_dealloc(CEllipticalCylinderModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CEllipticalCylinderModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CEllipticalCylinderModel *self;
-    
-    self = (CEllipticalCylinderModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CEllipticalCylinderModel_init(CEllipticalCylinderModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new EllipticalCylinderModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sldCyl",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"cyl_psi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"length",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"r_minor",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"cyl_theta",Py_BuildValue("d",90.000000000000));
-        PyDict_SetItemString(self->params,"r_ratio",Py_BuildValue("d",1.500000000000));
-        PyDict_SetItemString(self->params,"cyl_phi",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->r_minor.dispersion->accept_as_source(visitor, self->model->r_minor.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "r_minor", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->r_ratio.dispersion->accept_as_source(visitor, self->model->r_ratio.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "r_ratio", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->length.dispersion->accept_as_source(visitor, self->model->length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->cyl_theta.dispersion->accept_as_source(visitor, self->model->cyl_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "cyl_theta", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->cyl_phi.dispersion->accept_as_source(visitor, self->model->cyl_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "cyl_phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->cyl_psi.dispersion->accept_as_source(visitor, self->model->cyl_psi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "cyl_psi", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CEllipticalCylinderModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CEllipticalCylinderModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CEllipticalCylinderModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CEllipticalCylinderModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CEllipticalCylinderModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(EllipticalCylinderModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( EllipticalCylinderModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CEllipticalCylinderModelError, 
-                   "CEllipticalCylinderModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CEllipticalCylinderModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->cyl_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_psi") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->r_minor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_minor") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") );
-    self->model->r_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_ratio") );
-    self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "r_minor");
-    self->model->r_minor.dispersion->accept_as_destination(visitor, self->model->r_minor.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "r_ratio");
-    self->model->r_ratio.dispersion->accept_as_destination(visitor, self->model->r_ratio.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta");
-    self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi");
-    self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_psi");
-    self->model->cyl_psi.dispersion->accept_as_destination(visitor, self->model->cyl_psi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CEllipticalCylinderModelError, 
-	    	"CEllipticalCylinderModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CEllipticalCylinderModelError, 
-                   "CEllipticalCylinderModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CEllipticalCylinderModelError, 
-	    		"CEllipticalCylinderModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CEllipticalCylinderModelError, 
-                   "CEllipticalCylinderModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CEllipticalCylinderModelError, 
-                   "CEllipticalCylinderModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CEllipticalCylinderModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->cyl_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_psi") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->r_minor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_minor") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") );
-    self->model->r_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_ratio") );
-    self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "r_minor");
-    self->model->r_minor.dispersion->accept_as_destination(visitor, self->model->r_minor.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "r_ratio");
-    self->model->r_ratio.dispersion->accept_as_destination(visitor, self->model->r_ratio.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta");
-    self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi");
-    self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_psi");
-    self->model->cyl_psi.dispersion->accept_as_destination(visitor, self->model->cyl_psi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CEllipticalCylinderModelError, 
-	    	"CEllipticalCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CEllipticalCylinderModelError, 
-	    		"CEllipticalCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CEllipticalCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CEllipticalCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CEllipticalCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CEllipticalCylinderModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->cyl_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_psi") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->r_minor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_minor") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") );
-    self->model->r_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_ratio") );
-    self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "r_minor");
-    self->model->r_minor.dispersion->accept_as_destination(visitor, self->model->r_minor.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "r_ratio");
-    self->model->r_ratio.dispersion->accept_as_destination(visitor, self->model->r_ratio.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta");
-    self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi");
-    self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_psi");
-    self->model->cyl_psi.dispersion->accept_as_destination(visitor, self->model->cyl_psi.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CEllipticalCylinderModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->cyl_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_psi") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->r_minor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_minor") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->cyl_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_theta") );
-    self->model->r_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "r_ratio") );
-    self->model->cyl_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cyl_phi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "r_minor");
-    self->model->r_minor.dispersion->accept_as_destination(visitor, self->model->r_minor.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "r_ratio");
-    self->model->r_ratio.dispersion->accept_as_destination(visitor, self->model->r_ratio.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_theta");
-    self->model->cyl_theta.dispersion->accept_as_destination(visitor, self->model->cyl_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_phi");
-    self->model->cyl_phi.dispersion->accept_as_destination(visitor, self->model->cyl_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "cyl_psi");
-    self->model->cyl_psi.dispersion->accept_as_destination(visitor, self->model->cyl_psi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CEllipticalCylinderModelError, 
-	    	"CEllipticalCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CEllipticalCylinderModelError, 
-	    		"CEllipticalCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CEllipticalCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CEllipticalCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CEllipticalCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CEllipticalCylinderModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CEllipticalCylinderModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CEllipticalCylinderModelError,
-	    	"CEllipticalCylinderModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "r_minor")) {
-        self->model->r_minor.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "r_ratio")) {
-        self->model->r_ratio.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "length")) {
-        self->model->length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "cyl_theta")) {
-        self->model->cyl_theta.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "cyl_phi")) {
-        self->model->cyl_phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "cyl_psi")) {
-        self->model->cyl_psi.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CEllipticalCylinderModelError,
-	    	"CEllipticalCylinderModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CEllipticalCylinderModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CEllipticalCylinderModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CEllipticalCylinderModel",             /*tp_name*/
-    sizeof(CEllipticalCylinderModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CEllipticalCylinderModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CEllipticalCylinderModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CEllipticalCylinderModel_methods,             /* tp_methods */
-    CEllipticalCylinderModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CEllipticalCylinderModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CEllipticalCylinderModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCEllipticalCylinderModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CEllipticalCylinderModelType) < 0)
-        return;
-
-    Py_INCREF(&CEllipticalCylinderModelType);
-    PyModule_AddObject(module, "CEllipticalCylinderModel", (PyObject *)&CEllipticalCylinderModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CEllipticalCylinderModel.error";
-    CEllipticalCylinderModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CEllipticalCylinderModelError", CEllipticalCylinderModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CFCCrystalModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CFCCrystalModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,620 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CFCCrystalModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY fcc.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "fcc.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CFCCrystalModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    FCCrystalModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CFCCrystalModel;
-
-
-static void
-CFCCrystalModel_dealloc(CFCCrystalModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CFCCrystalModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CFCCrystalModel *self;
-    
-    self = (CFCCrystalModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CFCCrystalModel_init(CFCCrystalModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new FCCrystalModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"dnn",Py_BuildValue("d",220.000000000000));
-        PyDict_SetItemString(self->params,"sldSph",Py_BuildValue("d",0.000003000000));
-        PyDict_SetItemString(self->params,"d_factor",Py_BuildValue("d",0.060000000000));
-        PyDict_SetItemString(self->params,"psi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",40.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000006300000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->phi.dispersion->accept_as_source(visitor, self->model->phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->psi.dispersion->accept_as_source(visitor, self->model->psi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "psi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->theta.dispersion->accept_as_source(visitor, self->model->theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "theta", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CFCCrystalModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CFCCrystalModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CFCCrystalModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CFCCrystalModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CFCCrystalModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(FCCrystalModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( FCCrystalModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CFCCrystalModelError, 
-                   "CFCCrystalModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CFCCrystalModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFCCrystalModelError, 
-	    	"CFCCrystalModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CFCCrystalModelError, 
-                   "CFCCrystalModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CFCCrystalModelError, 
-	    		"CFCCrystalModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CFCCrystalModelError, 
-                   "CFCCrystalModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CFCCrystalModelError, 
-                   "CFCCrystalModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CFCCrystalModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFCCrystalModelError, 
-	    	"CFCCrystalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFCCrystalModelError, 
-	    		"CFCCrystalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CFCCrystalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CFCCrystalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CFCCrystalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CFCCrystalModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CFCCrystalModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFCCrystalModelError, 
-	    	"CFCCrystalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFCCrystalModelError, 
-	    		"CFCCrystalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CFCCrystalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CFCCrystalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CFCCrystalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CFCCrystalModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CFCCrystalModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CFCCrystalModelError,
-	    	"CFCCrystalModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "phi")) {
-        self->model->phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "psi")) {
-        self->model->psi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "theta")) {
-        self->model->theta.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CFCCrystalModelError,
-	    	"CFCCrystalModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CFCCrystalModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CFCCrystalModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CFCCrystalModel",             /*tp_name*/
-    sizeof(CFCCrystalModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CFCCrystalModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CFCCrystalModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CFCCrystalModel_methods,             /* tp_methods */
-    CFCCrystalModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CFCCrystalModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CFCCrystalModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCFCCrystalModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CFCCrystalModelType) < 0)
-        return;
-
-    Py_INCREF(&CFCCrystalModelType);
-    PyModule_AddObject(module, "CFCCrystalModel", (PyObject *)&CFCCrystalModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CFCCrystalModel.error";
-    CFCCrystalModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CFCCrystalModelError", CFCCrystalModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CFlexCylEllipXModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CFlexCylEllipXModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,610 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CFlexCylEllipXModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY flexcyl_ellipX.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "flexcyl_ellipX.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CFlexCylEllipXModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    FlexCylEllipXModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CFlexCylEllipXModel;
-
-
-static void
-CFlexCylEllipXModel_dealloc(CFlexCylEllipXModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CFlexCylEllipXModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CFlexCylEllipXModel *self;
-    
-    self = (CFlexCylEllipXModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CFlexCylEllipXModel_init(CFlexCylEllipXModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new FlexCylEllipXModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sldCyl",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"axis_ratio",Py_BuildValue("d",1.500000000000));
-        PyDict_SetItemString(self->params,"length",Py_BuildValue("d",1000.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000100000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000006300000));
-        PyDict_SetItemString(self->params,"kuhn_length",Py_BuildValue("d",100.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->length.dispersion->accept_as_source(visitor, self->model->length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->kuhn_length.dispersion->accept_as_source(visitor, self->model->kuhn_length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "kuhn_length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_ratio.dispersion->accept_as_source(visitor, self->model->axis_ratio.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_ratio", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CFlexCylEllipXModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CFlexCylEllipXModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CFlexCylEllipXModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CFlexCylEllipXModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CFlexCylEllipXModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(FlexCylEllipXModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( FlexCylEllipXModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CFlexCylEllipXModelError, 
-                   "CFlexCylEllipXModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CFlexCylEllipXModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->axis_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_ratio") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length");
-    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_ratio");
-    self->model->axis_ratio.dispersion->accept_as_destination(visitor, self->model->axis_ratio.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFlexCylEllipXModelError, 
-	    	"CFlexCylEllipXModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CFlexCylEllipXModelError, 
-                   "CFlexCylEllipXModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CFlexCylEllipXModelError, 
-	    		"CFlexCylEllipXModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CFlexCylEllipXModelError, 
-                   "CFlexCylEllipXModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CFlexCylEllipXModelError, 
-                   "CFlexCylEllipXModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CFlexCylEllipXModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->axis_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_ratio") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length");
-    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_ratio");
-    self->model->axis_ratio.dispersion->accept_as_destination(visitor, self->model->axis_ratio.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFlexCylEllipXModelError, 
-	    	"CFlexCylEllipXModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFlexCylEllipXModelError, 
-	    		"CFlexCylEllipXModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CFlexCylEllipXModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CFlexCylEllipXModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CFlexCylEllipXModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CFlexCylEllipXModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->axis_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_ratio") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length");
-    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_ratio");
-    self->model->axis_ratio.dispersion->accept_as_destination(visitor, self->model->axis_ratio.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CFlexCylEllipXModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->axis_ratio = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_ratio") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length");
-    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_ratio");
-    self->model->axis_ratio.dispersion->accept_as_destination(visitor, self->model->axis_ratio.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFlexCylEllipXModelError, 
-	    	"CFlexCylEllipXModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFlexCylEllipXModelError, 
-	    		"CFlexCylEllipXModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CFlexCylEllipXModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CFlexCylEllipXModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CFlexCylEllipXModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CFlexCylEllipXModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CFlexCylEllipXModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CFlexCylEllipXModelError,
-	    	"CFlexCylEllipXModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "length")) {
-        self->model->length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "kuhn_length")) {
-        self->model->kuhn_length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_ratio")) {
-        self->model->axis_ratio.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CFlexCylEllipXModelError,
-	    	"CFlexCylEllipXModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CFlexCylEllipXModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CFlexCylEllipXModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CFlexCylEllipXModel",             /*tp_name*/
-    sizeof(CFlexCylEllipXModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CFlexCylEllipXModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CFlexCylEllipXModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CFlexCylEllipXModel_methods,             /* tp_methods */
-    CFlexCylEllipXModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CFlexCylEllipXModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CFlexCylEllipXModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCFlexCylEllipXModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CFlexCylEllipXModelType) < 0)
-        return;
-
-    Py_INCREF(&CFlexCylEllipXModelType);
-    PyModule_AddObject(module, "CFlexCylEllipXModel", (PyObject *)&CFlexCylEllipXModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CFlexCylEllipXModel.error";
-    CFlexCylEllipXModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CFlexCylEllipXModelError", CFlexCylEllipXModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CFlexibleCylinderModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CFlexibleCylinderModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,592 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CFlexibleCylinderModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY flexible_cylinder.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "flexible_cylinder.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CFlexibleCylinderModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    FlexibleCylinderModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CFlexibleCylinderModel;
-
-
-static void
-CFlexibleCylinderModel_dealloc(CFlexibleCylinderModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CFlexibleCylinderModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CFlexibleCylinderModel *self;
-    
-    self = (CFlexibleCylinderModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CFlexibleCylinderModel_init(CFlexibleCylinderModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new FlexibleCylinderModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sldCyl",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"length",Py_BuildValue("d",1000.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000006300000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000100000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"kuhn_length",Py_BuildValue("d",100.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->length.dispersion->accept_as_source(visitor, self->model->length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->kuhn_length.dispersion->accept_as_source(visitor, self->model->kuhn_length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "kuhn_length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CFlexibleCylinderModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CFlexibleCylinderModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CFlexibleCylinderModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CFlexibleCylinderModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CFlexibleCylinderModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(FlexibleCylinderModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( FlexibleCylinderModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CFlexibleCylinderModelError, 
-                   "CFlexibleCylinderModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CFlexibleCylinderModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length");
-    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFlexibleCylinderModelError, 
-	    	"CFlexibleCylinderModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CFlexibleCylinderModelError, 
-                   "CFlexibleCylinderModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CFlexibleCylinderModelError, 
-	    		"CFlexibleCylinderModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CFlexibleCylinderModelError, 
-                   "CFlexibleCylinderModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CFlexibleCylinderModelError, 
-                   "CFlexibleCylinderModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CFlexibleCylinderModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length");
-    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFlexibleCylinderModelError, 
-	    	"CFlexibleCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFlexibleCylinderModelError, 
-	    		"CFlexibleCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CFlexibleCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CFlexibleCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CFlexibleCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CFlexibleCylinderModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length");
-    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CFlexibleCylinderModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->kuhn_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "kuhn_length") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "kuhn_length");
-    self->model->kuhn_length.dispersion->accept_as_destination(visitor, self->model->kuhn_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFlexibleCylinderModelError, 
-	    	"CFlexibleCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFlexibleCylinderModelError, 
-	    		"CFlexibleCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CFlexibleCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CFlexibleCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CFlexibleCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CFlexibleCylinderModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CFlexibleCylinderModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CFlexibleCylinderModelError,
-	    	"CFlexibleCylinderModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "length")) {
-        self->model->length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "kuhn_length")) {
-        self->model->kuhn_length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CFlexibleCylinderModelError,
-	    	"CFlexibleCylinderModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CFlexibleCylinderModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CFlexibleCylinderModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CFlexibleCylinderModel",             /*tp_name*/
-    sizeof(CFlexibleCylinderModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CFlexibleCylinderModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CFlexibleCylinderModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CFlexibleCylinderModel_methods,             /* tp_methods */
-    CFlexibleCylinderModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CFlexibleCylinderModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CFlexibleCylinderModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCFlexibleCylinderModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CFlexibleCylinderModelType) < 0)
-        return;
-
-    Py_INCREF(&CFlexibleCylinderModelType);
-    PyModule_AddObject(module, "CFlexibleCylinderModel", (PyObject *)&CFlexibleCylinderModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CFlexibleCylinderModel.error";
-    CFlexibleCylinderModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CFlexibleCylinderModelError", CFlexibleCylinderModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CFractalModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CFractalModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,566 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CFractalModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY fractal.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "fractal.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CFractalModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    FractalModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CFractalModel;
-
-
-static void
-CFractalModel_dealloc(CFractalModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CFractalModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CFractalModel *self;
-    
-    self = (CFractalModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CFractalModel_init(CFractalModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new FractalModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",0.050000000000));
-        PyDict_SetItemString(self->params,"fractal_dim",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000006350000));
-        PyDict_SetItemString(self->params,"cor_length",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",5.000000000000));
-        PyDict_SetItemString(self->params,"sldBlock",Py_BuildValue("d",0.000002000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CFractalModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CFractalModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CFractalModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CFractalModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CFractalModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(FractalModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( FractalModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CFractalModelError, 
-                   "CFractalModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CFractalModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->fractal_dim = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fractal_dim") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->cor_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cor_length") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->sldBlock = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldBlock") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFractalModelError, 
-	    	"CFractalModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CFractalModelError, 
-                   "CFractalModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CFractalModelError, 
-	    		"CFractalModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CFractalModelError, 
-                   "CFractalModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CFractalModelError, 
-                   "CFractalModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CFractalModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->fractal_dim = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fractal_dim") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->cor_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cor_length") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->sldBlock = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldBlock") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFractalModelError, 
-	    	"CFractalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFractalModelError, 
-	    		"CFractalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CFractalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CFractalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CFractalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CFractalModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->fractal_dim = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fractal_dim") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->cor_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cor_length") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->sldBlock = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldBlock") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CFractalModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->fractal_dim = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fractal_dim") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->cor_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "cor_length") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->sldBlock = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldBlock") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFractalModelError, 
-	    	"CFractalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFractalModelError, 
-	    		"CFractalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CFractalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CFractalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CFractalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CFractalModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CFractalModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CFractalModelError,
-	    	"CFractalModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CFractalModelError,
-	    	"CFractalModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CFractalModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CFractalModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CFractalModel",             /*tp_name*/
-    sizeof(CFractalModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CFractalModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CFractalModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CFractalModel_methods,             /* tp_methods */
-    CFractalModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CFractalModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CFractalModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCFractalModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CFractalModelType) < 0)
-        return;
-
-    Py_INCREF(&CFractalModelType);
-    PyModule_AddObject(module, "CFractalModel", (PyObject *)&CFractalModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CFractalModel.error";
-    CFractalModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CFractalModelError", CFractalModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CFuzzySphereModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CFuzzySphereModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,574 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CFuzzySphereModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY fuzzysphere.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "fuzzysphere.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CFuzzySphereModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    FuzzySphereModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CFuzzySphereModel;
-
-
-static void
-CFuzzySphereModel_dealloc(CFuzzySphereModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CFuzzySphereModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CFuzzySphereModel *self;
-    
-    self = (CFuzzySphereModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CFuzzySphereModel_init(CFuzzySphereModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new FuzzySphereModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",0.010000000000));
-        PyDict_SetItemString(self->params,"sldSph",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",60.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000003000000));
-        PyDict_SetItemString(self->params,"fuzziness",Py_BuildValue("d",10.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->fuzziness.dispersion->accept_as_source(visitor, self->model->fuzziness.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "fuzziness", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CFuzzySphereModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CFuzzySphereModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CFuzzySphereModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CFuzzySphereModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CFuzzySphereModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(FuzzySphereModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( FuzzySphereModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CFuzzySphereModelError, 
-                   "CFuzzySphereModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CFuzzySphereModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->fuzziness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fuzziness") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "fuzziness");
-    self->model->fuzziness.dispersion->accept_as_destination(visitor, self->model->fuzziness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFuzzySphereModelError, 
-	    	"CFuzzySphereModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CFuzzySphereModelError, 
-                   "CFuzzySphereModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CFuzzySphereModelError, 
-	    		"CFuzzySphereModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CFuzzySphereModelError, 
-                   "CFuzzySphereModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CFuzzySphereModelError, 
-                   "CFuzzySphereModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CFuzzySphereModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->fuzziness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fuzziness") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "fuzziness");
-    self->model->fuzziness.dispersion->accept_as_destination(visitor, self->model->fuzziness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFuzzySphereModelError, 
-	    	"CFuzzySphereModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFuzzySphereModelError, 
-	    		"CFuzzySphereModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CFuzzySphereModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CFuzzySphereModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CFuzzySphereModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CFuzzySphereModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->fuzziness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fuzziness") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "fuzziness");
-    self->model->fuzziness.dispersion->accept_as_destination(visitor, self->model->fuzziness.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CFuzzySphereModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->fuzziness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fuzziness") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "fuzziness");
-    self->model->fuzziness.dispersion->accept_as_destination(visitor, self->model->fuzziness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CFuzzySphereModelError, 
-	    	"CFuzzySphereModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CFuzzySphereModelError, 
-	    		"CFuzzySphereModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CFuzzySphereModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CFuzzySphereModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CFuzzySphereModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CFuzzySphereModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CFuzzySphereModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CFuzzySphereModelError,
-	    	"CFuzzySphereModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "fuzziness")) {
-        self->model->fuzziness.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CFuzzySphereModelError,
-	    	"CFuzzySphereModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CFuzzySphereModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CFuzzySphereModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CFuzzySphereModel",             /*tp_name*/
-    sizeof(CFuzzySphereModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CFuzzySphereModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CFuzzySphereModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CFuzzySphereModel_methods,             /* tp_methods */
-    CFuzzySphereModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CFuzzySphereModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CFuzzySphereModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCFuzzySphereModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CFuzzySphereModelType) < 0)
-        return;
-
-    Py_INCREF(&CFuzzySphereModelType);
-    PyModule_AddObject(module, "CFuzzySphereModel", (PyObject *)&CFuzzySphereModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CFuzzySphereModel.error";
-    CFuzzySphereModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CFuzzySphereModelError", CFuzzySphereModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CGaussian.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CGaussian.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,533 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CGaussian
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY gaussian.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "gaussian.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CGaussianError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    Gaussian * model;
-    /// Log for unit testing
-    PyObject * log;
-} CGaussian;
-
-
-static void
-CGaussian_dealloc(CGaussian* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CGaussian_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CGaussian *self;
-    
-    self = (CGaussian *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CGaussian_init(CGaussian *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new Gaussian();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sigma",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"center",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CGaussian_members[] = {
-    {name_params, T_OBJECT, offsetof(CGaussian, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CGaussian, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CGaussian, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CGaussian_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(Gaussian* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( Gaussian* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CGaussianError, 
-                   "CGaussian.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CGaussian *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CGaussianError, 
-	    	"CGaussian.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CGaussianError, 
-                   "CGaussian.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CGaussianError, 
-	    		"CGaussian.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CGaussianError, 
-                   "CGaussian.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CGaussianError, 
-                   "CGaussian.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CGaussian *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CGaussianError, 
-	    	"CGaussian.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CGaussianError, 
-	    		"CGaussian.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CGaussian_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CGaussian_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CGaussian_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CGaussian *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CGaussian *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CGaussianError, 
-	    	"CGaussian.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CGaussianError, 
-	    		"CGaussian.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CGaussian_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CGaussian_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CGaussian_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CGaussian *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CGaussian *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CGaussianError,
-	    	"CGaussian.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
- {
-	    PyErr_SetString(CGaussianError,
-	    	"CGaussian.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CGaussian_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CGaussianType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CGaussian",             /*tp_name*/
-    sizeof(CGaussian),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CGaussian_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CGaussian objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CGaussian_methods,             /* tp_methods */
-    CGaussian_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CGaussian_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CGaussian_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCGaussian(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CGaussianType) < 0)
-        return;
-
-    Py_INCREF(&CGaussianType);
-    PyModule_AddObject(module, "CGaussian", (PyObject *)&CGaussianType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CGaussian.error";
-    CGaussianError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CGaussianError", CGaussianError);
-}
-
Index: sansmodels/src/sans/models/c_models/CHardsphereStructure.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CHardsphereStructure.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,541 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CHardsphereStructure
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY Hardsphere.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "Hardsphere.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CHardsphereStructureError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    HardsphereStructure * model;
-    /// Log for unit testing
-    PyObject * log;
-} CHardsphereStructure;
-
-
-static void
-CHardsphereStructure_dealloc(CHardsphereStructure* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CHardsphereStructure_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CHardsphereStructure *self;
-    
-    self = (CHardsphereStructure *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CHardsphereStructure_init(CHardsphereStructure *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new HardsphereStructure();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"effect_radius",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"volfraction",Py_BuildValue("d",0.200000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->effect_radius.dispersion->accept_as_source(visitor, self->model->effect_radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "effect_radius", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CHardsphereStructure_members[] = {
-    {name_params, T_OBJECT, offsetof(CHardsphereStructure, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CHardsphereStructure, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CHardsphereStructure, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CHardsphereStructure_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(HardsphereStructure* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( HardsphereStructure* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CHardsphereStructureError, 
-                   "CHardsphereStructure.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CHardsphereStructure *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHardsphereStructureError, 
-	    	"CHardsphereStructure.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CHardsphereStructureError, 
-                   "CHardsphereStructure.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CHardsphereStructureError, 
-	    		"CHardsphereStructure.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CHardsphereStructureError, 
-                   "CHardsphereStructure.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CHardsphereStructureError, 
-                   "CHardsphereStructure.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CHardsphereStructure *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHardsphereStructureError, 
-	    	"CHardsphereStructure.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CHardsphereStructureError, 
-	    		"CHardsphereStructure.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CHardsphereStructure_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CHardsphereStructure_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CHardsphereStructure_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CHardsphereStructure *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CHardsphereStructure *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHardsphereStructureError, 
-	    	"CHardsphereStructure.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CHardsphereStructureError, 
-	    		"CHardsphereStructure.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CHardsphereStructure_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CHardsphereStructure_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CHardsphereStructure_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CHardsphereStructure *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CHardsphereStructure *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CHardsphereStructureError,
-	    	"CHardsphereStructure.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "effect_radius")) {
-        self->model->effect_radius.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CHardsphereStructureError,
-	    	"CHardsphereStructure.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CHardsphereStructure_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CHardsphereStructureType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CHardsphereStructure",             /*tp_name*/
-    sizeof(CHardsphereStructure),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CHardsphereStructure_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CHardsphereStructure objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CHardsphereStructure_methods,             /* tp_methods */
-    CHardsphereStructure_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CHardsphereStructure_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CHardsphereStructure_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCHardsphereStructure(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CHardsphereStructureType) < 0)
-        return;
-
-    Py_INCREF(&CHardsphereStructureType);
-    PyModule_AddObject(module, "CHardsphereStructure", (PyObject *)&CHardsphereStructureType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CHardsphereStructure.error";
-    CHardsphereStructureError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CHardsphereStructureError", CHardsphereStructureError);
-}
-
Index: sansmodels/src/sans/models/c_models/CHayterMSAStructure.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CHayterMSAStructure.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,561 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CHayterMSAStructure
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY HayterMSA.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "HayterMSA.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CHayterMSAStructureError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    HayterMSAStructure * model;
-    /// Log for unit testing
-    PyObject * log;
-} CHayterMSAStructure;
-
-
-static void
-CHayterMSAStructure_dealloc(CHayterMSAStructure* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CHayterMSAStructure_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CHayterMSAStructure *self;
-    
-    self = (CHayterMSAStructure *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CHayterMSAStructure_init(CHayterMSAStructure *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new HayterMSAStructure();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"temperature",Py_BuildValue("d",318.160000000000));
-        PyDict_SetItemString(self->params,"saltconc",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"dielectconst",Py_BuildValue("d",71.080000000000));
-        PyDict_SetItemString(self->params,"volfraction",Py_BuildValue("d",0.019200000000));
-        PyDict_SetItemString(self->params,"charge",Py_BuildValue("d",19.000000000000));
-        PyDict_SetItemString(self->params,"effect_radius",Py_BuildValue("d",20.750000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->effect_radius.dispersion->accept_as_source(visitor, self->model->effect_radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "effect_radius", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CHayterMSAStructure_members[] = {
-    {name_params, T_OBJECT, offsetof(CHayterMSAStructure, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CHayterMSAStructure, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CHayterMSAStructure, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CHayterMSAStructure_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(HayterMSAStructure* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( HayterMSAStructure* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CHayterMSAStructureError, 
-                   "CHayterMSAStructure.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CHayterMSAStructure *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->temperature = PyFloat_AsDouble( PyDict_GetItemString(self->params, "temperature") );
-    self->model->saltconc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "saltconc") );
-    self->model->dielectconst = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dielectconst") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->charge = PyFloat_AsDouble( PyDict_GetItemString(self->params, "charge") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHayterMSAStructureError, 
-	    	"CHayterMSAStructure.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CHayterMSAStructureError, 
-                   "CHayterMSAStructure.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CHayterMSAStructureError, 
-	    		"CHayterMSAStructure.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CHayterMSAStructureError, 
-                   "CHayterMSAStructure.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CHayterMSAStructureError, 
-                   "CHayterMSAStructure.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CHayterMSAStructure *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->temperature = PyFloat_AsDouble( PyDict_GetItemString(self->params, "temperature") );
-    self->model->saltconc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "saltconc") );
-    self->model->dielectconst = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dielectconst") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->charge = PyFloat_AsDouble( PyDict_GetItemString(self->params, "charge") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHayterMSAStructureError, 
-	    	"CHayterMSAStructure.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CHayterMSAStructureError, 
-	    		"CHayterMSAStructure.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CHayterMSAStructure_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CHayterMSAStructure_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CHayterMSAStructure_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CHayterMSAStructure *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->temperature = PyFloat_AsDouble( PyDict_GetItemString(self->params, "temperature") );
-    self->model->saltconc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "saltconc") );
-    self->model->dielectconst = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dielectconst") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->charge = PyFloat_AsDouble( PyDict_GetItemString(self->params, "charge") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CHayterMSAStructure *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->temperature = PyFloat_AsDouble( PyDict_GetItemString(self->params, "temperature") );
-    self->model->saltconc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "saltconc") );
-    self->model->dielectconst = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dielectconst") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->charge = PyFloat_AsDouble( PyDict_GetItemString(self->params, "charge") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHayterMSAStructureError, 
-	    	"CHayterMSAStructure.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CHayterMSAStructureError, 
-	    		"CHayterMSAStructure.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CHayterMSAStructure_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CHayterMSAStructure_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CHayterMSAStructure_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CHayterMSAStructure *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CHayterMSAStructure *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CHayterMSAStructureError,
-	    	"CHayterMSAStructure.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "effect_radius")) {
-        self->model->effect_radius.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CHayterMSAStructureError,
-	    	"CHayterMSAStructure.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CHayterMSAStructure_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CHayterMSAStructureType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CHayterMSAStructure",             /*tp_name*/
-    sizeof(CHayterMSAStructure),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CHayterMSAStructure_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CHayterMSAStructure objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CHayterMSAStructure_methods,             /* tp_methods */
-    CHayterMSAStructure_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CHayterMSAStructure_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CHayterMSAStructure_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCHayterMSAStructure(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CHayterMSAStructureType) < 0)
-        return;
-
-    Py_INCREF(&CHayterMSAStructureType);
-    PyModule_AddObject(module, "CHayterMSAStructure", (PyObject *)&CHayterMSAStructureType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CHayterMSAStructure.error";
-    CHayterMSAStructureError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CHayterMSAStructureError", CHayterMSAStructureError);
-}
-
Index: sansmodels/src/sans/models/c_models/CHollowCylinderModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CHollowCylinderModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,628 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CHollowCylinderModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY hollow_cylinder.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "hollow_cylinder.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CHollowCylinderModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    HollowCylinderModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CHollowCylinderModel;
-
-
-static void
-CHollowCylinderModel_dealloc(CHollowCylinderModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CHollowCylinderModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CHollowCylinderModel *self;
-    
-    self = (CHollowCylinderModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CHollowCylinderModel_init(CHollowCylinderModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new HollowCylinderModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sldCyl",Py_BuildValue("d",0.000006300000));
-        PyDict_SetItemString(self->params,"core_radius",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"axis_theta",Py_BuildValue("d",90.000000000000));
-        PyDict_SetItemString(self->params,"length",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"axis_phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.010000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",30.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->core_radius.dispersion->accept_as_source(visitor, self->model->core_radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "core_radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->length.dispersion->accept_as_source(visitor, self->model->length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CHollowCylinderModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CHollowCylinderModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CHollowCylinderModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CHollowCylinderModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CHollowCylinderModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(HollowCylinderModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( HollowCylinderModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CHollowCylinderModelError, 
-                   "CHollowCylinderModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CHollowCylinderModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius");
-    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHollowCylinderModelError, 
-	    	"CHollowCylinderModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CHollowCylinderModelError, 
-                   "CHollowCylinderModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CHollowCylinderModelError, 
-	    		"CHollowCylinderModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CHollowCylinderModelError, 
-                   "CHollowCylinderModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CHollowCylinderModelError, 
-                   "CHollowCylinderModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CHollowCylinderModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius");
-    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHollowCylinderModelError, 
-	    	"CHollowCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CHollowCylinderModelError, 
-	    		"CHollowCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CHollowCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CHollowCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CHollowCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CHollowCylinderModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius");
-    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CHollowCylinderModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldCyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldCyl") );
-    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius");
-    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "length");
-    self->model->length.dispersion->accept_as_destination(visitor, self->model->length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CHollowCylinderModelError, 
-	    	"CHollowCylinderModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CHollowCylinderModelError, 
-	    		"CHollowCylinderModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CHollowCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CHollowCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CHollowCylinderModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CHollowCylinderModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CHollowCylinderModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CHollowCylinderModelError,
-	    	"CHollowCylinderModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "core_radius")) {
-        self->model->core_radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "length")) {
-        self->model->length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_theta")) {
-        self->model->axis_theta.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_phi")) {
-        self->model->axis_phi.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CHollowCylinderModelError,
-	    	"CHollowCylinderModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CHollowCylinderModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CHollowCylinderModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CHollowCylinderModel",             /*tp_name*/
-    sizeof(CHollowCylinderModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CHollowCylinderModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CHollowCylinderModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CHollowCylinderModel_methods,             /* tp_methods */
-    CHollowCylinderModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CHollowCylinderModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CHollowCylinderModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCHollowCylinderModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CHollowCylinderModelType) < 0)
-        return;
-
-    Py_INCREF(&CHollowCylinderModelType);
-    PyModule_AddObject(module, "CHollowCylinderModel", (PyObject *)&CHollowCylinderModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CHollowCylinderModel.error";
-    CHollowCylinderModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CHollowCylinderModelError", CHollowCylinderModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CLamellarFFHGModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLamellarFFHGModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,579 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CLamellarFFHGModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY lamellarFF_HG.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "lamellarFF_HG.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CLamellarFFHGModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    LamellarFFHGModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CLamellarFFHGModel;
-
-
-static void
-CLamellarFFHGModel_dealloc(CLamellarFFHGModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLamellarFFHGModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLamellarFFHGModel *self;
-    
-    self = (CLamellarFFHGModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLamellarFFHGModel_init(CLamellarFFHGModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new LamellarFFHGModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"h_thickness",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"sld_tail",Py_BuildValue("d",0.000000400000));
-        PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006000000));
-        PyDict_SetItemString(self->params,"t_length",Py_BuildValue("d",15.000000000000));
-        PyDict_SetItemString(self->params,"sld_head",Py_BuildValue("d",0.000003000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->t_length.dispersion->accept_as_source(visitor, self->model->t_length.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "t_length", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->h_thickness.dispersion->accept_as_source(visitor, self->model->h_thickness.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "h_thickness", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CLamellarFFHGModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CLamellarFFHGModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CLamellarFFHGModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CLamellarFFHGModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLamellarFFHGModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(LamellarFFHGModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( LamellarFFHGModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CLamellarFFHGModelError, 
-                   "CLamellarFFHGModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CLamellarFFHGModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->h_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "h_thickness") );
-    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->t_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "t_length") );
-    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "t_length");
-    self->model->t_length.dispersion->accept_as_destination(visitor, self->model->t_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "h_thickness");
-    self->model->h_thickness.dispersion->accept_as_destination(visitor, self->model->h_thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarFFHGModelError, 
-	    	"CLamellarFFHGModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CLamellarFFHGModelError, 
-                   "CLamellarFFHGModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CLamellarFFHGModelError, 
-	    		"CLamellarFFHGModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CLamellarFFHGModelError, 
-                   "CLamellarFFHGModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CLamellarFFHGModelError, 
-                   "CLamellarFFHGModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLamellarFFHGModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->h_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "h_thickness") );
-    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->t_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "t_length") );
-    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "t_length");
-    self->model->t_length.dispersion->accept_as_destination(visitor, self->model->t_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "h_thickness");
-    self->model->h_thickness.dispersion->accept_as_destination(visitor, self->model->h_thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarFFHGModelError, 
-	    	"CLamellarFFHGModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarFFHGModelError, 
-	    		"CLamellarFFHGModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLamellarFFHGModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLamellarFFHGModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLamellarFFHGModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CLamellarFFHGModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->h_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "h_thickness") );
-    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->t_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "t_length") );
-    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "t_length");
-    self->model->t_length.dispersion->accept_as_destination(visitor, self->model->t_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "h_thickness");
-    self->model->h_thickness.dispersion->accept_as_destination(visitor, self->model->h_thickness.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLamellarFFHGModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->h_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "h_thickness") );
-    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->t_length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "t_length") );
-    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "t_length");
-    self->model->t_length.dispersion->accept_as_destination(visitor, self->model->t_length.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "h_thickness");
-    self->model->h_thickness.dispersion->accept_as_destination(visitor, self->model->h_thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarFFHGModelError, 
-	    	"CLamellarFFHGModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarFFHGModelError, 
-	    		"CLamellarFFHGModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLamellarFFHGModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLamellarFFHGModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLamellarFFHGModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CLamellarFFHGModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CLamellarFFHGModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CLamellarFFHGModelError,
-	    	"CLamellarFFHGModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "t_length")) {
-        self->model->t_length.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "h_thickness")) {
-        self->model->h_thickness.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CLamellarFFHGModelError,
-	    	"CLamellarFFHGModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CLamellarFFHGModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CLamellarFFHGModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLamellarFFHGModel",             /*tp_name*/
-    sizeof(CLamellarFFHGModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLamellarFFHGModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLamellarFFHGModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLamellarFFHGModel_methods,             /* tp_methods */
-    CLamellarFFHGModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLamellarFFHGModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLamellarFFHGModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLamellarFFHGModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLamellarFFHGModelType) < 0)
-        return;
-
-    Py_INCREF(&CLamellarFFHGModelType);
-    PyModule_AddObject(module, "CLamellarFFHGModel", (PyObject *)&CLamellarFFHGModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CLamellarFFHGModel.error";
-    CLamellarFFHGModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CLamellarFFHGModelError", CLamellarFFHGModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CLamellarModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLamellarModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,556 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CLamellarModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY lamellar.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "lamellar.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CLamellarModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    LamellarModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CLamellarModel;
-
-
-static void
-CLamellarModel_dealloc(CLamellarModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLamellarModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLamellarModel *self;
-    
-    self = (CLamellarModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLamellarModel_init(CLamellarModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new LamellarModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"sld_sol",Py_BuildValue("d",0.000006300000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"bi_thick",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_bi",Py_BuildValue("d",0.000001000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->bi_thick.dispersion->accept_as_source(visitor, self->model->bi_thick.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "bi_thick", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CLamellarModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CLamellarModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CLamellarModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CLamellarModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLamellarModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(LamellarModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( LamellarModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CLamellarModelError, 
-                   "CLamellarModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CLamellarModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sld_sol = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sol") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->bi_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bi_thick") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_bi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "bi_thick");
-    self->model->bi_thick.dispersion->accept_as_destination(visitor, self->model->bi_thick.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarModelError, 
-	    	"CLamellarModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CLamellarModelError, 
-                   "CLamellarModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CLamellarModelError, 
-	    		"CLamellarModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CLamellarModelError, 
-                   "CLamellarModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CLamellarModelError, 
-                   "CLamellarModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLamellarModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sld_sol = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sol") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->bi_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bi_thick") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_bi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "bi_thick");
-    self->model->bi_thick.dispersion->accept_as_destination(visitor, self->model->bi_thick.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarModelError, 
-	    	"CLamellarModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarModelError, 
-	    		"CLamellarModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLamellarModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLamellarModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLamellarModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CLamellarModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sld_sol = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sol") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->bi_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bi_thick") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_bi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "bi_thick");
-    self->model->bi_thick.dispersion->accept_as_destination(visitor, self->model->bi_thick.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLamellarModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sld_sol = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sol") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->bi_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bi_thick") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_bi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bi") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "bi_thick");
-    self->model->bi_thick.dispersion->accept_as_destination(visitor, self->model->bi_thick.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarModelError, 
-	    	"CLamellarModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarModelError, 
-	    		"CLamellarModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLamellarModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLamellarModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLamellarModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CLamellarModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CLamellarModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CLamellarModelError,
-	    	"CLamellarModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "bi_thick")) {
-        self->model->bi_thick.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CLamellarModelError,
-	    	"CLamellarModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CLamellarModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CLamellarModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLamellarModel",             /*tp_name*/
-    sizeof(CLamellarModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLamellarModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLamellarModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLamellarModel_methods,             /* tp_methods */
-    CLamellarModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLamellarModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLamellarModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLamellarModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLamellarModelType) < 0)
-        return;
-
-    Py_INCREF(&CLamellarModelType);
-    PyModule_AddObject(module, "CLamellarModel", (PyObject *)&CLamellarModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CLamellarModel.error";
-    CLamellarModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CLamellarModelError", CLamellarModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CLamellarPCrystalModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLamellarPCrystalModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,571 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CLamellarPCrystalModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY lamellarPC.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "lamellarPC.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CLamellarPCrystalModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    LamellarPCrystalModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CLamellarPCrystalModel;
-
-
-static void
-CLamellarPCrystalModel_dealloc(CLamellarPCrystalModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLamellarPCrystalModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLamellarPCrystalModel *self;
-    
-    self = (CLamellarPCrystalModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLamellarPCrystalModel_init(CLamellarPCrystalModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new LamellarPCrystalModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"Nlayers",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"spacing",Py_BuildValue("d",250.000000000000));
-        PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006340000));
-        PyDict_SetItemString(self->params,"thickness",Py_BuildValue("d",33.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"pd_spacing",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_layer",Py_BuildValue("d",0.000001000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->thickness.dispersion->accept_as_source(visitor, self->model->thickness.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thickness", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CLamellarPCrystalModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CLamellarPCrystalModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CLamellarPCrystalModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CLamellarPCrystalModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLamellarPCrystalModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(LamellarPCrystalModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( LamellarPCrystalModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CLamellarPCrystalModelError, 
-                   "CLamellarPCrystalModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CLamellarPCrystalModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->Nlayers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nlayers") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->pd_spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "pd_spacing") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_layer = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_layer") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPCrystalModelError, 
-	    	"CLamellarPCrystalModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CLamellarPCrystalModelError, 
-                   "CLamellarPCrystalModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CLamellarPCrystalModelError, 
-	    		"CLamellarPCrystalModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CLamellarPCrystalModelError, 
-                   "CLamellarPCrystalModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CLamellarPCrystalModelError, 
-                   "CLamellarPCrystalModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLamellarPCrystalModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->Nlayers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nlayers") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->pd_spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "pd_spacing") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_layer = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_layer") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPCrystalModelError, 
-	    	"CLamellarPCrystalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarPCrystalModelError, 
-	    		"CLamellarPCrystalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLamellarPCrystalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLamellarPCrystalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLamellarPCrystalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CLamellarPCrystalModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->Nlayers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nlayers") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->pd_spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "pd_spacing") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_layer = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_layer") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLamellarPCrystalModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->Nlayers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nlayers") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->pd_spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "pd_spacing") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_layer = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_layer") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPCrystalModelError, 
-	    	"CLamellarPCrystalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarPCrystalModelError, 
-	    		"CLamellarPCrystalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLamellarPCrystalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLamellarPCrystalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLamellarPCrystalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CLamellarPCrystalModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CLamellarPCrystalModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CLamellarPCrystalModelError,
-	    	"CLamellarPCrystalModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "thickness")) {
-        self->model->thickness.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CLamellarPCrystalModelError,
-	    	"CLamellarPCrystalModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CLamellarPCrystalModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CLamellarPCrystalModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLamellarPCrystalModel",             /*tp_name*/
-    sizeof(CLamellarPCrystalModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLamellarPCrystalModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLamellarPCrystalModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLamellarPCrystalModel_methods,             /* tp_methods */
-    CLamellarPCrystalModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLamellarPCrystalModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLamellarPCrystalModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLamellarPCrystalModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLamellarPCrystalModelType) < 0)
-        return;
-
-    Py_INCREF(&CLamellarPCrystalModelType);
-    PyModule_AddObject(module, "CLamellarPCrystalModel", (PyObject *)&CLamellarPCrystalModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CLamellarPCrystalModel.error";
-    CLamellarPCrystalModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CLamellarPCrystalModelError", CLamellarPCrystalModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CLamellarPSHGModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLamellarPSHGModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,607 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CLamellarPSHGModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY lamellarPS_HG.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "lamellarPS_HG.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CLamellarPSHGModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    LamellarPSHGModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CLamellarPSHGModel;
-
-
-static void
-CLamellarPSHGModel_dealloc(CLamellarPSHGModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLamellarPSHGModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLamellarPSHGModel *self;
-    
-    self = (CLamellarPSHGModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLamellarPSHGModel_init(CLamellarPSHGModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new LamellarPSHGModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"n_plates",Py_BuildValue("d",30.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"deltaT",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"spacing",Py_BuildValue("d",40.000000000000));
-        PyDict_SetItemString(self->params,"sld_tail",Py_BuildValue("d",0.000000400000));
-        PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006000000));
-        PyDict_SetItemString(self->params,"caille",Py_BuildValue("d",0.001000000000));
-        PyDict_SetItemString(self->params,"sld_head",Py_BuildValue("d",0.000002000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000));
-        PyDict_SetItemString(self->params,"deltaH",Py_BuildValue("d",2.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->deltaT.dispersion->accept_as_source(visitor, self->model->deltaT.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "deltaT", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->deltaH.dispersion->accept_as_source(visitor, self->model->deltaH.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "deltaH", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->spacing.dispersion->accept_as_source(visitor, self->model->spacing.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "spacing", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CLamellarPSHGModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CLamellarPSHGModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CLamellarPSHGModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CLamellarPSHGModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLamellarPSHGModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(LamellarPSHGModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( LamellarPSHGModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CLamellarPSHGModelError, 
-                   "CLamellarPSHGModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CLamellarPSHGModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->deltaT = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaT") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
-    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->deltaH = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaH") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "deltaT");
-    self->model->deltaT.dispersion->accept_as_destination(visitor, self->model->deltaT.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH");
-    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "spacing");
-    self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPSHGModelError, 
-	    	"CLamellarPSHGModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CLamellarPSHGModelError, 
-                   "CLamellarPSHGModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CLamellarPSHGModelError, 
-	    		"CLamellarPSHGModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CLamellarPSHGModelError, 
-                   "CLamellarPSHGModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CLamellarPSHGModelError, 
-                   "CLamellarPSHGModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLamellarPSHGModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->deltaT = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaT") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
-    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->deltaH = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaH") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "deltaT");
-    self->model->deltaT.dispersion->accept_as_destination(visitor, self->model->deltaT.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH");
-    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "spacing");
-    self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPSHGModelError, 
-	    	"CLamellarPSHGModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarPSHGModelError, 
-	    		"CLamellarPSHGModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLamellarPSHGModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLamellarPSHGModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLamellarPSHGModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CLamellarPSHGModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->deltaT = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaT") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
-    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->deltaH = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaH") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "deltaT");
-    self->model->deltaT.dispersion->accept_as_destination(visitor, self->model->deltaT.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH");
-    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "spacing");
-    self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLamellarPSHGModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->deltaT = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaT") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
-    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
-    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
-    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->deltaH = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaH") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "deltaT");
-    self->model->deltaT.dispersion->accept_as_destination(visitor, self->model->deltaT.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH");
-    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "spacing");
-    self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPSHGModelError, 
-	    	"CLamellarPSHGModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarPSHGModelError, 
-	    		"CLamellarPSHGModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLamellarPSHGModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLamellarPSHGModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLamellarPSHGModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CLamellarPSHGModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CLamellarPSHGModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CLamellarPSHGModelError,
-	    	"CLamellarPSHGModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "deltaT")) {
-        self->model->deltaT.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "deltaH")) {
-        self->model->deltaH.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "spacing")) {
-        self->model->spacing.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CLamellarPSHGModelError,
-	    	"CLamellarPSHGModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CLamellarPSHGModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CLamellarPSHGModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLamellarPSHGModel",             /*tp_name*/
-    sizeof(CLamellarPSHGModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLamellarPSHGModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLamellarPSHGModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLamellarPSHGModel_methods,             /* tp_methods */
-    CLamellarPSHGModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLamellarPSHGModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLamellarPSHGModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLamellarPSHGModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLamellarPSHGModelType) < 0)
-        return;
-
-    Py_INCREF(&CLamellarPSHGModelType);
-    PyModule_AddObject(module, "CLamellarPSHGModel", (PyObject *)&CLamellarPSHGModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CLamellarPSHGModel.error";
-    CLamellarPSHGModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CLamellarPSHGModelError", CLamellarPSHGModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CLamellarPSModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLamellarPSModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,584 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CLamellarPSModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY lamellarPS.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "lamellarPS.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CLamellarPSModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    LamellarPSModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CLamellarPSModel;
-
-
-static void
-CLamellarPSModel_dealloc(CLamellarPSModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLamellarPSModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLamellarPSModel *self;
-    
-    self = (CLamellarPSModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLamellarPSModel_init(CLamellarPSModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new LamellarPSModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"n_plates",Py_BuildValue("d",20.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sld_sol",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"delta",Py_BuildValue("d",30.000000000000));
-        PyDict_SetItemString(self->params,"spacing",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"caille",Py_BuildValue("d",0.100000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_bi",Py_BuildValue("d",0.000006300000));
-        // 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);
-        PyDict_SetItemString(self->dispersion, "spacing", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CLamellarPSModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CLamellarPSModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CLamellarPSModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CLamellarPSModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLamellarPSModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(LamellarPSModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( LamellarPSModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CLamellarPSModelError, 
-                   "CLamellarPSModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CLamellarPSModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_sol = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sol") );
-    self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_bi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bi") );
-    // 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);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPSModelError, 
-	    	"CLamellarPSModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CLamellarPSModelError, 
-                   "CLamellarPSModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CLamellarPSModelError, 
-	    		"CLamellarPSModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CLamellarPSModelError, 
-                   "CLamellarPSModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CLamellarPSModelError, 
-                   "CLamellarPSModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLamellarPSModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_sol = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sol") );
-    self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_bi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bi") );
-    // 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);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPSModelError, 
-	    	"CLamellarPSModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarPSModelError, 
-	    		"CLamellarPSModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLamellarPSModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLamellarPSModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLamellarPSModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CLamellarPSModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_sol = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sol") );
-    self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_bi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bi") );
-    // 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);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLamellarPSModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sld_sol = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sol") );
-    self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
-    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
-    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_bi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bi") );
-    // 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);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLamellarPSModelError, 
-	    	"CLamellarPSModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLamellarPSModelError, 
-	    		"CLamellarPSModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLamellarPSModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLamellarPSModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLamellarPSModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CLamellarPSModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CLamellarPSModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CLamellarPSModelError,
-	    	"CLamellarPSModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "delta")) {
-        self->model->delta.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "spacing")) {
-        self->model->spacing.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CLamellarPSModelError,
-	    	"CLamellarPSModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CLamellarPSModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CLamellarPSModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLamellarPSModel",             /*tp_name*/
-    sizeof(CLamellarPSModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLamellarPSModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLamellarPSModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLamellarPSModel_methods,             /* tp_methods */
-    CLamellarPSModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLamellarPSModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLamellarPSModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLamellarPSModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLamellarPSModelType) < 0)
-        return;
-
-    Py_INCREF(&CLamellarPSModelType);
-    PyModule_AddObject(module, "CLamellarPSModel", (PyObject *)&CLamellarPSModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CLamellarPSModel.error";
-    CLamellarPSModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CLamellarPSModelError", CLamellarPSModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CLogNormal.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLogNormal.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,533 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CLogNormal
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY logNormal.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "logNormal.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CLogNormalError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    LogNormal * model;
-    /// Log for unit testing
-    PyObject * log;
-} CLogNormal;
-
-
-static void
-CLogNormal_dealloc(CLogNormal* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLogNormal_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLogNormal *self;
-    
-    self = (CLogNormal *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLogNormal_init(CLogNormal *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new LogNormal();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sigma",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"center",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CLogNormal_members[] = {
-    {name_params, T_OBJECT, offsetof(CLogNormal, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CLogNormal, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CLogNormal, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLogNormal_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(LogNormal* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( LogNormal* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CLogNormalError, 
-                   "CLogNormal.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CLogNormal *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLogNormalError, 
-	    	"CLogNormal.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CLogNormalError, 
-                   "CLogNormal.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CLogNormalError, 
-	    		"CLogNormal.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CLogNormalError, 
-                   "CLogNormal.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CLogNormalError, 
-                   "CLogNormal.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLogNormal *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLogNormalError, 
-	    	"CLogNormal.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLogNormalError, 
-	    		"CLogNormal.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLogNormal_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLogNormal_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLogNormal_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CLogNormal *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLogNormal *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLogNormalError, 
-	    	"CLogNormal.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLogNormalError, 
-	    		"CLogNormal.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLogNormal_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLogNormal_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLogNormal_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CLogNormal *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CLogNormal *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CLogNormalError,
-	    	"CLogNormal.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
- {
-	    PyErr_SetString(CLogNormalError,
-	    	"CLogNormal.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CLogNormal_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CLogNormalType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLogNormal",             /*tp_name*/
-    sizeof(CLogNormal),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLogNormal_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLogNormal objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLogNormal_methods,             /* tp_methods */
-    CLogNormal_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLogNormal_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLogNormal_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLogNormal(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLogNormalType) < 0)
-        return;
-
-    Py_INCREF(&CLogNormalType);
-    PyModule_AddObject(module, "CLogNormal", (PyObject *)&CLogNormalType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CLogNormal.error";
-    CLogNormalError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CLogNormalError", CLogNormalError);
-}
-
Index: sansmodels/src/sans/models/c_models/CLorentzian.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLorentzian.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,533 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CLorentzian
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY lorentzian.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "lorentzian.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CLorentzianError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    Lorentzian * model;
-    /// Log for unit testing
-    PyObject * log;
-} CLorentzian;
-
-
-static void
-CLorentzian_dealloc(CLorentzian* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CLorentzian_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CLorentzian *self;
-    
-    self = (CLorentzian *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CLorentzian_init(CLorentzian *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new Lorentzian();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"center",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"gamma",Py_BuildValue("d",1.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CLorentzian_members[] = {
-    {name_params, T_OBJECT, offsetof(CLorentzian, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CLorentzian, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CLorentzian, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CLorentzian_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(Lorentzian* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( Lorentzian* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CLorentzianError, 
-                   "CLorentzian.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CLorentzian *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    self->model->gamma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "gamma") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLorentzianError, 
-	    	"CLorentzian.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CLorentzianError, 
-                   "CLorentzian.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CLorentzianError, 
-	    		"CLorentzian.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CLorentzianError, 
-                   "CLorentzian.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CLorentzianError, 
-                   "CLorentzian.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CLorentzian *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    self->model->gamma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "gamma") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLorentzianError, 
-	    	"CLorentzian.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLorentzianError, 
-	    		"CLorentzian.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CLorentzian_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CLorentzian_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CLorentzian_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CLorentzian *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    self->model->gamma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "gamma") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CLorentzian *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    self->model->gamma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "gamma") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CLorentzianError, 
-	    	"CLorentzian.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CLorentzianError, 
-	    		"CLorentzian.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CLorentzian_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CLorentzian_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CLorentzian_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CLorentzian *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CLorentzian *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CLorentzianError,
-	    	"CLorentzian.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
- {
-	    PyErr_SetString(CLorentzianError,
-	    	"CLorentzian.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CLorentzian_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CLorentzianType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CLorentzian",             /*tp_name*/
-    sizeof(CLorentzian),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CLorentzian_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CLorentzian objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CLorentzian_methods,             /* tp_methods */
-    CLorentzian_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CLorentzian_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CLorentzian_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCLorentzian(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CLorentzianType) < 0)
-        return;
-
-    Py_INCREF(&CLorentzianType);
-    PyModule_AddObject(module, "CLorentzian", (PyObject *)&CLorentzianType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CLorentzian.error";
-    CLorentzianError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CLorentzianError", CLorentzianError);
-}
-
Index: sansmodels/src/sans/models/c_models/CMultiShellModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CMultiShellModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,597 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CMultiShellModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY multishell.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "multishell.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CMultiShellModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    MultiShellModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CMultiShellModel;
-
-
-static void
-CMultiShellModel_dealloc(CMultiShellModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CMultiShellModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CMultiShellModel *self;
-    
-    self = (CMultiShellModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CMultiShellModel_init(CMultiShellModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new MultiShellModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"core_sld",Py_BuildValue("d",0.000006400000));
-        PyDict_SetItemString(self->params,"core_radius",Py_BuildValue("d",60.000000000000));
-        PyDict_SetItemString(self->params,"n_pairs",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"w_thickness",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"s_thickness",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"shell_sld",Py_BuildValue("d",0.000000400000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->core_radius.dispersion->accept_as_source(visitor, self->model->core_radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "core_radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->s_thickness.dispersion->accept_as_source(visitor, self->model->s_thickness.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "s_thickness", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->w_thickness.dispersion->accept_as_source(visitor, self->model->w_thickness.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "w_thickness", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CMultiShellModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CMultiShellModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CMultiShellModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CMultiShellModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CMultiShellModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(MultiShellModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( MultiShellModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CMultiShellModelError, 
-                   "CMultiShellModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CMultiShellModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") );
-    self->model->n_pairs = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_pairs") );
-    self->model->w_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "w_thickness") );
-    self->model->s_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius");
-    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness");
-    self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness");
-    self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CMultiShellModelError, 
-	    	"CMultiShellModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CMultiShellModelError, 
-                   "CMultiShellModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CMultiShellModelError, 
-	    		"CMultiShellModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CMultiShellModelError, 
-                   "CMultiShellModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CMultiShellModelError, 
-                   "CMultiShellModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CMultiShellModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") );
-    self->model->n_pairs = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_pairs") );
-    self->model->w_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "w_thickness") );
-    self->model->s_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius");
-    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness");
-    self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness");
-    self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CMultiShellModelError, 
-	    	"CMultiShellModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CMultiShellModelError, 
-	    		"CMultiShellModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CMultiShellModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CMultiShellModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CMultiShellModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CMultiShellModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") );
-    self->model->n_pairs = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_pairs") );
-    self->model->w_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "w_thickness") );
-    self->model->s_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius");
-    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness");
-    self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness");
-    self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CMultiShellModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->core_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_radius") );
-    self->model->n_pairs = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_pairs") );
-    self->model->w_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "w_thickness") );
-    self->model->s_thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "s_thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_radius");
-    self->model->core_radius.dispersion->accept_as_destination(visitor, self->model->core_radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "s_thickness");
-    self->model->s_thickness.dispersion->accept_as_destination(visitor, self->model->s_thickness.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "w_thickness");
-    self->model->w_thickness.dispersion->accept_as_destination(visitor, self->model->w_thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CMultiShellModelError, 
-	    	"CMultiShellModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CMultiShellModelError, 
-	    		"CMultiShellModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CMultiShellModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CMultiShellModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CMultiShellModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CMultiShellModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CMultiShellModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CMultiShellModelError,
-	    	"CMultiShellModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "core_radius")) {
-        self->model->core_radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "s_thickness")) {
-        self->model->s_thickness.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "w_thickness")) {
-        self->model->w_thickness.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CMultiShellModelError,
-	    	"CMultiShellModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CMultiShellModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CMultiShellModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CMultiShellModel",             /*tp_name*/
-    sizeof(CMultiShellModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CMultiShellModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CMultiShellModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CMultiShellModel_methods,             /* tp_methods */
-    CMultiShellModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CMultiShellModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CMultiShellModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCMultiShellModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CMultiShellModelType) < 0)
-        return;
-
-    Py_INCREF(&CMultiShellModelType);
-    PyModule_AddObject(module, "CMultiShellModel", (PyObject *)&CMultiShellModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CMultiShellModel.error";
-    CMultiShellModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CMultiShellModelError", CMultiShellModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/COnionModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/COnionModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,941 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** COnionModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY onion.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "onion.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * COnionModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    OnionModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} COnionModel;
-
-
-static void
-COnionModel_dealloc(COnionModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-COnionModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    COnionModel *self;
-    
-    self = (COnionModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-COnionModel_init(COnionModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new OnionModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"thick_shell4",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_shell5",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_shell9",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_shell7",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"sld_core0",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"rad_core0",Py_BuildValue("d",200.000000000000));
-        PyDict_SetItemString(self->params,"A_shell10",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_shell1",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"func_shell4",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"func_shell5",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"func_shell6",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"func_shell1",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"thick_shell10",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"func_shell3",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"func_shell8",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"func_shell9",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"sld_in_shell5",Py_BuildValue("d",0.000003700000));
-        PyDict_SetItemString(self->params,"func_shell10",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"sld_in_shell4",Py_BuildValue("d",0.000003200000));
-        PyDict_SetItemString(self->params,"sld_in_shell7",Py_BuildValue("d",0.000004700000));
-        PyDict_SetItemString(self->params,"sld_out_shell9",Py_BuildValue("d",0.000006000000));
-        PyDict_SetItemString(self->params,"sld_out_shell8",Py_BuildValue("d",0.000005500000));
-        PyDict_SetItemString(self->params,"thick_shell6",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"sld_out_shell2",Py_BuildValue("d",0.000002500000));
-        PyDict_SetItemString(self->params,"sld_in_shell9",Py_BuildValue("d",0.000005700000));
-        PyDict_SetItemString(self->params,"sld_in_shell8",Py_BuildValue("d",0.000005200000));
-        PyDict_SetItemString(self->params,"thick_shell2",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_shell3",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"sld_out_shell1",Py_BuildValue("d",0.000002000000));
-        PyDict_SetItemString(self->params,"sld_out_shell5",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_out_shell3",Py_BuildValue("d",0.000003000000));
-        PyDict_SetItemString(self->params,"sld_in_shell6",Py_BuildValue("d",0.000004200000));
-        PyDict_SetItemString(self->params,"sld_in_shell1",Py_BuildValue("d",0.000001700000));
-        PyDict_SetItemString(self->params,"sld_out_shell4",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_in_shell3",Py_BuildValue("d",0.000002700000));
-        PyDict_SetItemString(self->params,"sld_out_shell6",Py_BuildValue("d",0.000004500000));
-        PyDict_SetItemString(self->params,"func_shell7",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"sld_out_shell7",Py_BuildValue("d",0.000005000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"n_shells",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sld_in_shell2",Py_BuildValue("d",0.000002200000));
-        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006400000));
-        PyDict_SetItemString(self->params,"func_shell2",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"thick_shell8",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"sld_out_shell10",Py_BuildValue("d",0.000006200000));
-        PyDict_SetItemString(self->params,"sld_in_shell10",Py_BuildValue("d",0.000006000000));
-        PyDict_SetItemString(self->params,"A_shell8",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"A_shell9",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"A_shell6",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"A_shell7",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"A_shell4",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"A_shell5",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"A_shell2",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"A_shell3",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"A_shell1",Py_BuildValue("d",1.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->rad_core0.dispersion->accept_as_source(visitor, self->model->rad_core0.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rad_core0", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell1.dispersion->accept_as_source(visitor, self->model->thick_shell1.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell1", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell2.dispersion->accept_as_source(visitor, self->model->thick_shell2.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell2", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell3.dispersion->accept_as_source(visitor, self->model->thick_shell3.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell3", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell4.dispersion->accept_as_source(visitor, self->model->thick_shell4.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell4", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell5.dispersion->accept_as_source(visitor, self->model->thick_shell5.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell5", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell6.dispersion->accept_as_source(visitor, self->model->thick_shell6.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell6", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell7.dispersion->accept_as_source(visitor, self->model->thick_shell7.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell7", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell8.dispersion->accept_as_source(visitor, self->model->thick_shell8.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell8", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell9.dispersion->accept_as_source(visitor, self->model->thick_shell9.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell9", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_shell10.dispersion->accept_as_source(visitor, self->model->thick_shell10.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_shell10", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef COnionModel_members[] = {
-    {name_params, T_OBJECT, offsetof(COnionModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(COnionModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(COnionModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double COnionModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(OnionModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( OnionModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(COnionModelError, 
-                   "COnionModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(COnionModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell4") );
-    self->model->thick_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell5") );
-    self->model->thick_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell9") );
-    self->model->thick_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell7") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->A_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell10") );
-    self->model->thick_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell1") );
-    self->model->func_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell4") );
-    self->model->func_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell5") );
-    self->model->func_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell6") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->func_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell1") );
-    self->model->thick_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell10") );
-    self->model->func_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell3") );
-    self->model->func_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell8") );
-    self->model->func_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell9") );
-    self->model->sld_in_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell5") );
-    self->model->func_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell10") );
-    self->model->sld_in_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell4") );
-    self->model->sld_in_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell7") );
-    self->model->sld_out_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell9") );
-    self->model->sld_out_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell8") );
-    self->model->thick_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell6") );
-    self->model->sld_out_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell2") );
-    self->model->sld_in_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell9") );
-    self->model->sld_in_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell8") );
-    self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
-    self->model->sld_out_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell1") );
-    self->model->sld_out_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell5") );
-    self->model->sld_out_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell3") );
-    self->model->sld_in_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell6") );
-    self->model->sld_in_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell1") );
-    self->model->sld_out_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell4") );
-    self->model->sld_in_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell3") );
-    self->model->sld_out_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell6") );
-    self->model->func_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell7") );
-    self->model->sld_out_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell7") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->n_shells = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_shells") );
-    self->model->sld_in_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell2") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->func_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell2") );
-    self->model->thick_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell8") );
-    self->model->sld_out_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell10") );
-    self->model->sld_in_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell10") );
-    self->model->A_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell8") );
-    self->model->A_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell9") );
-    self->model->A_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell6") );
-    self->model->A_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell7") );
-    self->model->A_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell4") );
-    self->model->A_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell5") );
-    self->model->A_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell2") );
-    self->model->A_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell3") );
-    self->model->A_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell1") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
-    self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell2");
-    self->model->thick_shell2.dispersion->accept_as_destination(visitor, self->model->thick_shell2.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell3");
-    self->model->thick_shell3.dispersion->accept_as_destination(visitor, self->model->thick_shell3.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell4");
-    self->model->thick_shell4.dispersion->accept_as_destination(visitor, self->model->thick_shell4.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell5");
-    self->model->thick_shell5.dispersion->accept_as_destination(visitor, self->model->thick_shell5.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell6");
-    self->model->thick_shell6.dispersion->accept_as_destination(visitor, self->model->thick_shell6.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell7");
-    self->model->thick_shell7.dispersion->accept_as_destination(visitor, self->model->thick_shell7.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell8");
-    self->model->thick_shell8.dispersion->accept_as_destination(visitor, self->model->thick_shell8.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell9");
-    self->model->thick_shell9.dispersion->accept_as_destination(visitor, self->model->thick_shell9.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell10");
-    self->model->thick_shell10.dispersion->accept_as_destination(visitor, self->model->thick_shell10.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(COnionModelError, 
-	    	"COnionModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(COnionModelError, 
-                   "COnionModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(COnionModelError, 
-	    		"COnionModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(COnionModelError, 
-                   "COnionModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(COnionModelError, 
-                   "COnionModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(COnionModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell4") );
-    self->model->thick_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell5") );
-    self->model->thick_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell9") );
-    self->model->thick_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell7") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->A_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell10") );
-    self->model->thick_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell1") );
-    self->model->func_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell4") );
-    self->model->func_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell5") );
-    self->model->func_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell6") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->func_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell1") );
-    self->model->thick_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell10") );
-    self->model->func_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell3") );
-    self->model->func_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell8") );
-    self->model->func_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell9") );
-    self->model->sld_in_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell5") );
-    self->model->func_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell10") );
-    self->model->sld_in_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell4") );
-    self->model->sld_in_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell7") );
-    self->model->sld_out_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell9") );
-    self->model->sld_out_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell8") );
-    self->model->thick_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell6") );
-    self->model->sld_out_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell2") );
-    self->model->sld_in_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell9") );
-    self->model->sld_in_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell8") );
-    self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
-    self->model->sld_out_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell1") );
-    self->model->sld_out_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell5") );
-    self->model->sld_out_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell3") );
-    self->model->sld_in_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell6") );
-    self->model->sld_in_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell1") );
-    self->model->sld_out_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell4") );
-    self->model->sld_in_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell3") );
-    self->model->sld_out_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell6") );
-    self->model->func_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell7") );
-    self->model->sld_out_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell7") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->n_shells = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_shells") );
-    self->model->sld_in_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell2") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->func_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell2") );
-    self->model->thick_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell8") );
-    self->model->sld_out_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell10") );
-    self->model->sld_in_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell10") );
-    self->model->A_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell8") );
-    self->model->A_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell9") );
-    self->model->A_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell6") );
-    self->model->A_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell7") );
-    self->model->A_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell4") );
-    self->model->A_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell5") );
-    self->model->A_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell2") );
-    self->model->A_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell3") );
-    self->model->A_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell1") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
-    self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell2");
-    self->model->thick_shell2.dispersion->accept_as_destination(visitor, self->model->thick_shell2.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell3");
-    self->model->thick_shell3.dispersion->accept_as_destination(visitor, self->model->thick_shell3.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell4");
-    self->model->thick_shell4.dispersion->accept_as_destination(visitor, self->model->thick_shell4.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell5");
-    self->model->thick_shell5.dispersion->accept_as_destination(visitor, self->model->thick_shell5.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell6");
-    self->model->thick_shell6.dispersion->accept_as_destination(visitor, self->model->thick_shell6.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell7");
-    self->model->thick_shell7.dispersion->accept_as_destination(visitor, self->model->thick_shell7.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell8");
-    self->model->thick_shell8.dispersion->accept_as_destination(visitor, self->model->thick_shell8.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell9");
-    self->model->thick_shell9.dispersion->accept_as_destination(visitor, self->model->thick_shell9.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell10");
-    self->model->thick_shell10.dispersion->accept_as_destination(visitor, self->model->thick_shell10.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(COnionModelError, 
-	    	"COnionModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(COnionModelError, 
-	    		"COnionModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = COnionModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = COnionModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = COnionModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(COnionModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell4") );
-    self->model->thick_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell5") );
-    self->model->thick_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell9") );
-    self->model->thick_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell7") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->A_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell10") );
-    self->model->thick_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell1") );
-    self->model->func_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell4") );
-    self->model->func_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell5") );
-    self->model->func_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell6") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->func_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell1") );
-    self->model->thick_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell10") );
-    self->model->func_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell3") );
-    self->model->func_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell8") );
-    self->model->func_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell9") );
-    self->model->sld_in_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell5") );
-    self->model->func_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell10") );
-    self->model->sld_in_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell4") );
-    self->model->sld_in_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell7") );
-    self->model->sld_out_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell9") );
-    self->model->sld_out_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell8") );
-    self->model->thick_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell6") );
-    self->model->sld_out_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell2") );
-    self->model->sld_in_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell9") );
-    self->model->sld_in_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell8") );
-    self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
-    self->model->sld_out_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell1") );
-    self->model->sld_out_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell5") );
-    self->model->sld_out_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell3") );
-    self->model->sld_in_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell6") );
-    self->model->sld_in_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell1") );
-    self->model->sld_out_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell4") );
-    self->model->sld_in_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell3") );
-    self->model->sld_out_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell6") );
-    self->model->func_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell7") );
-    self->model->sld_out_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell7") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->n_shells = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_shells") );
-    self->model->sld_in_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell2") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->func_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell2") );
-    self->model->thick_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell8") );
-    self->model->sld_out_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell10") );
-    self->model->sld_in_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell10") );
-    self->model->A_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell8") );
-    self->model->A_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell9") );
-    self->model->A_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell6") );
-    self->model->A_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell7") );
-    self->model->A_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell4") );
-    self->model->A_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell5") );
-    self->model->A_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell2") );
-    self->model->A_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell3") );
-    self->model->A_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell1") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
-    self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell2");
-    self->model->thick_shell2.dispersion->accept_as_destination(visitor, self->model->thick_shell2.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell3");
-    self->model->thick_shell3.dispersion->accept_as_destination(visitor, self->model->thick_shell3.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell4");
-    self->model->thick_shell4.dispersion->accept_as_destination(visitor, self->model->thick_shell4.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell5");
-    self->model->thick_shell5.dispersion->accept_as_destination(visitor, self->model->thick_shell5.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell6");
-    self->model->thick_shell6.dispersion->accept_as_destination(visitor, self->model->thick_shell6.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell7");
-    self->model->thick_shell7.dispersion->accept_as_destination(visitor, self->model->thick_shell7.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell8");
-    self->model->thick_shell8.dispersion->accept_as_destination(visitor, self->model->thick_shell8.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell9");
-    self->model->thick_shell9.dispersion->accept_as_destination(visitor, self->model->thick_shell9.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell10");
-    self->model->thick_shell10.dispersion->accept_as_destination(visitor, self->model->thick_shell10.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(COnionModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell4") );
-    self->model->thick_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell5") );
-    self->model->thick_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell9") );
-    self->model->thick_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell7") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->A_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell10") );
-    self->model->thick_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell1") );
-    self->model->func_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell4") );
-    self->model->func_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell5") );
-    self->model->func_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell6") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->func_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell1") );
-    self->model->thick_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell10") );
-    self->model->func_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell3") );
-    self->model->func_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell8") );
-    self->model->func_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell9") );
-    self->model->sld_in_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell5") );
-    self->model->func_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell10") );
-    self->model->sld_in_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell4") );
-    self->model->sld_in_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell7") );
-    self->model->sld_out_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell9") );
-    self->model->sld_out_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell8") );
-    self->model->thick_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell6") );
-    self->model->sld_out_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell2") );
-    self->model->sld_in_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell9") );
-    self->model->sld_in_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell8") );
-    self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
-    self->model->sld_out_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell1") );
-    self->model->sld_out_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell5") );
-    self->model->sld_out_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell3") );
-    self->model->sld_in_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell6") );
-    self->model->sld_in_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell1") );
-    self->model->sld_out_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell4") );
-    self->model->sld_in_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell3") );
-    self->model->sld_out_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell6") );
-    self->model->func_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell7") );
-    self->model->sld_out_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell7") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->n_shells = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_shells") );
-    self->model->sld_in_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell2") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->func_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_shell2") );
-    self->model->thick_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell8") );
-    self->model->sld_out_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_out_shell10") );
-    self->model->sld_in_shell10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_in_shell10") );
-    self->model->A_shell8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell8") );
-    self->model->A_shell9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell9") );
-    self->model->A_shell6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell6") );
-    self->model->A_shell7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell7") );
-    self->model->A_shell4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell4") );
-    self->model->A_shell5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell5") );
-    self->model->A_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell2") );
-    self->model->A_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell3") );
-    self->model->A_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "A_shell1") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
-    self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell2");
-    self->model->thick_shell2.dispersion->accept_as_destination(visitor, self->model->thick_shell2.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell3");
-    self->model->thick_shell3.dispersion->accept_as_destination(visitor, self->model->thick_shell3.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell4");
-    self->model->thick_shell4.dispersion->accept_as_destination(visitor, self->model->thick_shell4.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell5");
-    self->model->thick_shell5.dispersion->accept_as_destination(visitor, self->model->thick_shell5.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell6");
-    self->model->thick_shell6.dispersion->accept_as_destination(visitor, self->model->thick_shell6.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell7");
-    self->model->thick_shell7.dispersion->accept_as_destination(visitor, self->model->thick_shell7.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell8");
-    self->model->thick_shell8.dispersion->accept_as_destination(visitor, self->model->thick_shell8.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell9");
-    self->model->thick_shell9.dispersion->accept_as_destination(visitor, self->model->thick_shell9.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell10");
-    self->model->thick_shell10.dispersion->accept_as_destination(visitor, self->model->thick_shell10.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(COnionModelError, 
-	    	"COnionModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(COnionModelError, 
-	    		"COnionModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = COnionModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = COnionModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = COnionModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(COnionModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(COnionModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(COnionModelError,
-	    	"COnionModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "rad_core0")) {
-        self->model->rad_core0.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell1")) {
-        self->model->thick_shell1.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell2")) {
-        self->model->thick_shell2.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell3")) {
-        self->model->thick_shell3.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell4")) {
-        self->model->thick_shell4.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell5")) {
-        self->model->thick_shell5.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell6")) {
-        self->model->thick_shell6.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell7")) {
-        self->model->thick_shell7.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell8")) {
-        self->model->thick_shell8.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell9")) {
-        self->model->thick_shell9.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_shell10")) {
-        self->model->thick_shell10.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(COnionModelError,
-	    	"COnionModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef COnionModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject COnionModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "COnionModel",             /*tp_name*/
-    sizeof(COnionModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)COnionModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "COnionModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    COnionModel_methods,             /* tp_methods */
-    COnionModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)COnionModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    COnionModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCOnionModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&COnionModelType) < 0)
-        return;
-
-    Py_INCREF(&COnionModelType);
-    PyModule_AddObject(module, "COnionModel", (PyObject *)&COnionModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "COnionModel.error";
-    COnionModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "COnionModelError", COnionModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CParallelepipedModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CParallelepipedModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,646 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CParallelepipedModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY parallelepiped.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "parallelepiped.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CParallelepipedModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    ParallelepipedModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CParallelepipedModel;
-
-
-static void
-CParallelepipedModel_dealloc(CParallelepipedModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CParallelepipedModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CParallelepipedModel *self;
-    
-    self = (CParallelepipedModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CParallelepipedModel_init(CParallelepipedModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new ParallelepipedModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"short_a",Py_BuildValue("d",35.000000000000));
-        PyDict_SetItemString(self->params,"short_b",Py_BuildValue("d",75.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"long_c",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"sldPipe",Py_BuildValue("d",0.000006300000));
-        PyDict_SetItemString(self->params,"parallel_psi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"parallel_phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"parallel_theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->short_a.dispersion->accept_as_source(visitor, self->model->short_a.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "short_a", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->short_b.dispersion->accept_as_source(visitor, self->model->short_b.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "short_b", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->long_c.dispersion->accept_as_source(visitor, self->model->long_c.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "long_c", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->parallel_phi.dispersion->accept_as_source(visitor, self->model->parallel_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "parallel_phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->parallel_psi.dispersion->accept_as_source(visitor, self->model->parallel_psi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "parallel_psi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->parallel_theta.dispersion->accept_as_source(visitor, self->model->parallel_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "parallel_theta", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CParallelepipedModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CParallelepipedModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CParallelepipedModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CParallelepipedModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CParallelepipedModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(ParallelepipedModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( ParallelepipedModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CParallelepipedModelError, 
-                   "CParallelepipedModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CParallelepipedModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") );
-    self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") );
-    self->model->sldPipe = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldPipe") );
-    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") );
-    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") );
-    self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "short_a");
-    self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "short_b");
-    self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "long_c");
-    self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi");
-    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi");
-    self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta");
-    self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CParallelepipedModelError, 
-	    	"CParallelepipedModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CParallelepipedModelError, 
-                   "CParallelepipedModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CParallelepipedModelError, 
-	    		"CParallelepipedModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CParallelepipedModelError, 
-                   "CParallelepipedModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CParallelepipedModelError, 
-                   "CParallelepipedModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CParallelepipedModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") );
-    self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") );
-    self->model->sldPipe = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldPipe") );
-    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") );
-    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") );
-    self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "short_a");
-    self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "short_b");
-    self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "long_c");
-    self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi");
-    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi");
-    self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta");
-    self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CParallelepipedModelError, 
-	    	"CParallelepipedModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CParallelepipedModelError, 
-	    		"CParallelepipedModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CParallelepipedModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CParallelepipedModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CParallelepipedModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CParallelepipedModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") );
-    self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") );
-    self->model->sldPipe = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldPipe") );
-    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") );
-    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") );
-    self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "short_a");
-    self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "short_b");
-    self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "long_c");
-    self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi");
-    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi");
-    self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta");
-    self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CParallelepipedModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") );
-    self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") );
-    self->model->sldPipe = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldPipe") );
-    self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") );
-    self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") );
-    self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "short_a");
-    self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "short_b");
-    self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "long_c");
-    self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi");
-    self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_psi");
-    self->model->parallel_psi.dispersion->accept_as_destination(visitor, self->model->parallel_psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "parallel_theta");
-    self->model->parallel_theta.dispersion->accept_as_destination(visitor, self->model->parallel_theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CParallelepipedModelError, 
-	    	"CParallelepipedModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CParallelepipedModelError, 
-	    		"CParallelepipedModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CParallelepipedModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CParallelepipedModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CParallelepipedModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CParallelepipedModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CParallelepipedModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CParallelepipedModelError,
-	    	"CParallelepipedModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "short_a")) {
-        self->model->short_a.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "short_b")) {
-        self->model->short_b.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "long_c")) {
-        self->model->long_c.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "parallel_phi")) {
-        self->model->parallel_phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "parallel_psi")) {
-        self->model->parallel_psi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "parallel_theta")) {
-        self->model->parallel_theta.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CParallelepipedModelError,
-	    	"CParallelepipedModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CParallelepipedModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CParallelepipedModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CParallelepipedModel",             /*tp_name*/
-    sizeof(CParallelepipedModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CParallelepipedModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CParallelepipedModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CParallelepipedModel_methods,             /* tp_methods */
-    CParallelepipedModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CParallelepipedModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CParallelepipedModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCParallelepipedModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CParallelepipedModelType) < 0)
-        return;
-
-    Py_INCREF(&CParallelepipedModelType);
-    PyModule_AddObject(module, "CParallelepipedModel", (PyObject *)&CParallelepipedModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CParallelepipedModel.error";
-    CParallelepipedModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CParallelepipedModelError", CParallelepipedModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CPearlNecklaceModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CPearlNecklaceModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,589 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CPearlNecklaceModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY pearlnecklace.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "pearlnecklace.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CPearlNecklaceModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    PearlNecklaceModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CPearlNecklaceModel;
-
-
-static void
-CPearlNecklaceModel_dealloc(CPearlNecklaceModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CPearlNecklaceModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CPearlNecklaceModel *self;
-    
-    self = (CPearlNecklaceModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CPearlNecklaceModel_init(CPearlNecklaceModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new PearlNecklaceModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"num_pearls",Py_BuildValue("d",3.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_string",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"sld_string",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"edge_separation",Py_BuildValue("d",350.000000000000));
-        PyDict_SetItemString(self->params,"sld_pearl",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",80.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006300000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->edge_separation.dispersion->accept_as_source(visitor, self->model->edge_separation.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "edge_separation", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CPearlNecklaceModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CPearlNecklaceModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CPearlNecklaceModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CPearlNecklaceModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CPearlNecklaceModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(PearlNecklaceModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( PearlNecklaceModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CPearlNecklaceModelError, 
-                   "CPearlNecklaceModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CPearlNecklaceModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->num_pearls = PyFloat_AsDouble( PyDict_GetItemString(self->params, "num_pearls") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->thick_string = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_string") );
-    self->model->sld_string = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_string") );
-    self->model->edge_separation = PyFloat_AsDouble( PyDict_GetItemString(self->params, "edge_separation") );
-    self->model->sld_pearl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_pearl") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "edge_separation");
-    self->model->edge_separation.dispersion->accept_as_destination(visitor, self->model->edge_separation.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CPearlNecklaceModelError, 
-	    	"CPearlNecklaceModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CPearlNecklaceModelError, 
-                   "CPearlNecklaceModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CPearlNecklaceModelError, 
-	    		"CPearlNecklaceModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CPearlNecklaceModelError, 
-                   "CPearlNecklaceModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CPearlNecklaceModelError, 
-                   "CPearlNecklaceModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CPearlNecklaceModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->num_pearls = PyFloat_AsDouble( PyDict_GetItemString(self->params, "num_pearls") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->thick_string = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_string") );
-    self->model->sld_string = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_string") );
-    self->model->edge_separation = PyFloat_AsDouble( PyDict_GetItemString(self->params, "edge_separation") );
-    self->model->sld_pearl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_pearl") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "edge_separation");
-    self->model->edge_separation.dispersion->accept_as_destination(visitor, self->model->edge_separation.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CPearlNecklaceModelError, 
-	    	"CPearlNecklaceModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CPearlNecklaceModelError, 
-	    		"CPearlNecklaceModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CPearlNecklaceModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CPearlNecklaceModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CPearlNecklaceModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CPearlNecklaceModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->num_pearls = PyFloat_AsDouble( PyDict_GetItemString(self->params, "num_pearls") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->thick_string = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_string") );
-    self->model->sld_string = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_string") );
-    self->model->edge_separation = PyFloat_AsDouble( PyDict_GetItemString(self->params, "edge_separation") );
-    self->model->sld_pearl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_pearl") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "edge_separation");
-    self->model->edge_separation.dispersion->accept_as_destination(visitor, self->model->edge_separation.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CPearlNecklaceModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->num_pearls = PyFloat_AsDouble( PyDict_GetItemString(self->params, "num_pearls") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->thick_string = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_string") );
-    self->model->sld_string = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_string") );
-    self->model->edge_separation = PyFloat_AsDouble( PyDict_GetItemString(self->params, "edge_separation") );
-    self->model->sld_pearl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_pearl") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "edge_separation");
-    self->model->edge_separation.dispersion->accept_as_destination(visitor, self->model->edge_separation.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CPearlNecklaceModelError, 
-	    	"CPearlNecklaceModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CPearlNecklaceModelError, 
-	    		"CPearlNecklaceModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CPearlNecklaceModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CPearlNecklaceModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CPearlNecklaceModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CPearlNecklaceModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CPearlNecklaceModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CPearlNecklaceModelError,
-	    	"CPearlNecklaceModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "edge_separation")) {
-        self->model->edge_separation.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CPearlNecklaceModelError,
-	    	"CPearlNecklaceModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CPearlNecklaceModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CPearlNecklaceModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CPearlNecklaceModel",             /*tp_name*/
-    sizeof(CPearlNecklaceModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CPearlNecklaceModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CPearlNecklaceModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CPearlNecklaceModel_methods,             /* tp_methods */
-    CPearlNecklaceModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CPearlNecklaceModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CPearlNecklaceModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCPearlNecklaceModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CPearlNecklaceModelType) < 0)
-        return;
-
-    Py_INCREF(&CPearlNecklaceModelType);
-    PyModule_AddObject(module, "CPearlNecklaceModel", (PyObject *)&CPearlNecklaceModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CPearlNecklaceModel.error";
-    CPearlNecklaceModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CPearlNecklaceModelError", CPearlNecklaceModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CPoly_GaussCoil.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CPoly_GaussCoil.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,551 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CPoly_GaussCoil
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY polygausscoil.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "polygausscoil.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CPoly_GaussCoilError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    Poly_GaussCoil * model;
-    /// Log for unit testing
-    PyObject * log;
-} CPoly_GaussCoil;
-
-
-static void
-CPoly_GaussCoil_dealloc(CPoly_GaussCoil* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CPoly_GaussCoil_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CPoly_GaussCoil *self;
-    
-    self = (CPoly_GaussCoil *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CPoly_GaussCoil_init(CPoly_GaussCoil *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new Poly_GaussCoil();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"poly_m",Py_BuildValue("d",2.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"rg",Py_BuildValue("d",60.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->rg.dispersion->accept_as_source(visitor, self->model->rg.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rg", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CPoly_GaussCoil_members[] = {
-    {name_params, T_OBJECT, offsetof(CPoly_GaussCoil, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CPoly_GaussCoil, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CPoly_GaussCoil, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CPoly_GaussCoil_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(Poly_GaussCoil* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( Poly_GaussCoil* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CPoly_GaussCoilError, 
-                   "CPoly_GaussCoil.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CPoly_GaussCoil *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->poly_m = PyFloat_AsDouble( PyDict_GetItemString(self->params, "poly_m") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->rg = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rg") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rg");
-    self->model->rg.dispersion->accept_as_destination(visitor, self->model->rg.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CPoly_GaussCoilError, 
-	    	"CPoly_GaussCoil.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CPoly_GaussCoilError, 
-                   "CPoly_GaussCoil.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CPoly_GaussCoilError, 
-	    		"CPoly_GaussCoil.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CPoly_GaussCoilError, 
-                   "CPoly_GaussCoil.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CPoly_GaussCoilError, 
-                   "CPoly_GaussCoil.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CPoly_GaussCoil *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->poly_m = PyFloat_AsDouble( PyDict_GetItemString(self->params, "poly_m") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->rg = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rg") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rg");
-    self->model->rg.dispersion->accept_as_destination(visitor, self->model->rg.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CPoly_GaussCoilError, 
-	    	"CPoly_GaussCoil.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CPoly_GaussCoilError, 
-	    		"CPoly_GaussCoil.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CPoly_GaussCoil_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CPoly_GaussCoil_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CPoly_GaussCoil_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CPoly_GaussCoil *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->poly_m = PyFloat_AsDouble( PyDict_GetItemString(self->params, "poly_m") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->rg = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rg") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rg");
-    self->model->rg.dispersion->accept_as_destination(visitor, self->model->rg.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CPoly_GaussCoil *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->poly_m = PyFloat_AsDouble( PyDict_GetItemString(self->params, "poly_m") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->rg = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rg") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rg");
-    self->model->rg.dispersion->accept_as_destination(visitor, self->model->rg.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CPoly_GaussCoilError, 
-	    	"CPoly_GaussCoil.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CPoly_GaussCoilError, 
-	    		"CPoly_GaussCoil.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CPoly_GaussCoil_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CPoly_GaussCoil_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CPoly_GaussCoil_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CPoly_GaussCoil *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CPoly_GaussCoil *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CPoly_GaussCoilError,
-	    	"CPoly_GaussCoil.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "rg")) {
-        self->model->rg.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CPoly_GaussCoilError,
-	    	"CPoly_GaussCoil.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CPoly_GaussCoil_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CPoly_GaussCoilType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CPoly_GaussCoil",             /*tp_name*/
-    sizeof(CPoly_GaussCoil),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CPoly_GaussCoil_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CPoly_GaussCoil objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CPoly_GaussCoil_methods,             /* tp_methods */
-    CPoly_GaussCoil_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CPoly_GaussCoil_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CPoly_GaussCoil_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCPoly_GaussCoil(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CPoly_GaussCoilType) < 0)
-        return;
-
-    Py_INCREF(&CPoly_GaussCoilType);
-    PyModule_AddObject(module, "CPoly_GaussCoil", (PyObject *)&CPoly_GaussCoilType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CPoly_GaussCoil.error";
-    CPoly_GaussCoilError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CPoly_GaussCoilError", CPoly_GaussCoilError);
-}
-
Index: sansmodels/src/sans/models/c_models/CRPAModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CRPAModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,676 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CRPAModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY rpa.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "rpa.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CRPAModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    RPAModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CRPAModel;
-
-
-static void
-CRPAModel_dealloc(CRPAModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CRPAModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CRPAModel *self;
-    
-    self = (CRPAModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CRPAModel_init(CRPAModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new RPAModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"va",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"vb",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"vc",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"Lb",Py_BuildValue("d",0.000000000001));
-        PyDict_SetItemString(self->params,"Lc",Py_BuildValue("d",0.000000000001));
-        PyDict_SetItemString(self->params,"La",Py_BuildValue("d",0.000000000001));
-        PyDict_SetItemString(self->params,"Na",Py_BuildValue("d",1000.000000000000));
-        PyDict_SetItemString(self->params,"Nb",Py_BuildValue("d",1000.000000000000));
-        PyDict_SetItemString(self->params,"Nc",Py_BuildValue("d",1000.000000000000));
-        PyDict_SetItemString(self->params,"Nd",Py_BuildValue("d",1000.000000000000));
-        PyDict_SetItemString(self->params,"Ld",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"Kcd",Py_BuildValue("d",-0.000400000000));
-        PyDict_SetItemString(self->params,"vd",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"Phib",Py_BuildValue("d",0.250000000000));
-        PyDict_SetItemString(self->params,"Kac",Py_BuildValue("d",-0.000400000000));
-        PyDict_SetItemString(self->params,"Kab",Py_BuildValue("d",-0.000400000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"bb",Py_BuildValue("d",5.000000000000));
-        PyDict_SetItemString(self->params,"Kad",Py_BuildValue("d",-0.000400000000));
-        PyDict_SetItemString(self->params,"bd",Py_BuildValue("d",5.000000000000));
-        PyDict_SetItemString(self->params,"Phid",Py_BuildValue("d",0.250000000000));
-        PyDict_SetItemString(self->params,"Phic",Py_BuildValue("d",0.250000000000));
-        PyDict_SetItemString(self->params,"ba",Py_BuildValue("d",5.000000000000));
-        PyDict_SetItemString(self->params,"Phia",Py_BuildValue("d",0.250000000000));
-        PyDict_SetItemString(self->params,"bc",Py_BuildValue("d",5.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"Kbc",Py_BuildValue("d",-0.000400000000));
-        PyDict_SetItemString(self->params,"Kbd",Py_BuildValue("d",-0.000400000000));
-        PyDict_SetItemString(self->params,"lcase_n",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->background.dispersion->accept_as_source(visitor, self->model->background.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "background", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CRPAModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CRPAModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CRPAModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CRPAModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CRPAModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(RPAModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( RPAModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CRPAModelError, 
-                   "CRPAModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CRPAModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->va = PyFloat_AsDouble( PyDict_GetItemString(self->params, "va") );
-    self->model->vb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vb") );
-    self->model->vc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vc") );
-    self->model->Lb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Lb") );
-    self->model->Lc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Lc") );
-    self->model->La = PyFloat_AsDouble( PyDict_GetItemString(self->params, "La") );
-    self->model->Na = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Na") );
-    self->model->Nb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nb") );
-    self->model->Nc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nc") );
-    self->model->Nd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nd") );
-    self->model->Ld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Ld") );
-    self->model->Kcd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kcd") );
-    self->model->vd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vd") );
-    self->model->Phib = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phib") );
-    self->model->Kac = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kac") );
-    self->model->Kab = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kab") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->bb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bb") );
-    self->model->Kad = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kad") );
-    self->model->bd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bd") );
-    self->model->Phid = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phid") );
-    self->model->Phic = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phic") );
-    self->model->ba = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ba") );
-    self->model->Phia = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phia") );
-    self->model->bc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bc") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->Kbc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kbc") );
-    self->model->Kbd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kbd") );
-    self->model->lcase_n = PyFloat_AsDouble( PyDict_GetItemString(self->params, "lcase_n") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "background");
-    self->model->background.dispersion->accept_as_destination(visitor, self->model->background.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CRPAModelError, 
-	    	"CRPAModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CRPAModelError, 
-                   "CRPAModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CRPAModelError, 
-	    		"CRPAModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CRPAModelError, 
-                   "CRPAModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CRPAModelError, 
-                   "CRPAModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CRPAModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->va = PyFloat_AsDouble( PyDict_GetItemString(self->params, "va") );
-    self->model->vb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vb") );
-    self->model->vc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vc") );
-    self->model->Lb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Lb") );
-    self->model->Lc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Lc") );
-    self->model->La = PyFloat_AsDouble( PyDict_GetItemString(self->params, "La") );
-    self->model->Na = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Na") );
-    self->model->Nb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nb") );
-    self->model->Nc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nc") );
-    self->model->Nd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nd") );
-    self->model->Ld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Ld") );
-    self->model->Kcd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kcd") );
-    self->model->vd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vd") );
-    self->model->Phib = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phib") );
-    self->model->Kac = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kac") );
-    self->model->Kab = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kab") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->bb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bb") );
-    self->model->Kad = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kad") );
-    self->model->bd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bd") );
-    self->model->Phid = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phid") );
-    self->model->Phic = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phic") );
-    self->model->ba = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ba") );
-    self->model->Phia = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phia") );
-    self->model->bc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bc") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->Kbc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kbc") );
-    self->model->Kbd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kbd") );
-    self->model->lcase_n = PyFloat_AsDouble( PyDict_GetItemString(self->params, "lcase_n") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "background");
-    self->model->background.dispersion->accept_as_destination(visitor, self->model->background.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CRPAModelError, 
-	    	"CRPAModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CRPAModelError, 
-	    		"CRPAModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CRPAModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CRPAModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CRPAModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CRPAModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->va = PyFloat_AsDouble( PyDict_GetItemString(self->params, "va") );
-    self->model->vb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vb") );
-    self->model->vc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vc") );
-    self->model->Lb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Lb") );
-    self->model->Lc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Lc") );
-    self->model->La = PyFloat_AsDouble( PyDict_GetItemString(self->params, "La") );
-    self->model->Na = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Na") );
-    self->model->Nb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nb") );
-    self->model->Nc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nc") );
-    self->model->Nd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nd") );
-    self->model->Ld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Ld") );
-    self->model->Kcd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kcd") );
-    self->model->vd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vd") );
-    self->model->Phib = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phib") );
-    self->model->Kac = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kac") );
-    self->model->Kab = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kab") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->bb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bb") );
-    self->model->Kad = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kad") );
-    self->model->bd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bd") );
-    self->model->Phid = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phid") );
-    self->model->Phic = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phic") );
-    self->model->ba = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ba") );
-    self->model->Phia = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phia") );
-    self->model->bc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bc") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->Kbc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kbc") );
-    self->model->Kbd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kbd") );
-    self->model->lcase_n = PyFloat_AsDouble( PyDict_GetItemString(self->params, "lcase_n") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "background");
-    self->model->background.dispersion->accept_as_destination(visitor, self->model->background.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CRPAModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->va = PyFloat_AsDouble( PyDict_GetItemString(self->params, "va") );
-    self->model->vb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vb") );
-    self->model->vc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vc") );
-    self->model->Lb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Lb") );
-    self->model->Lc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Lc") );
-    self->model->La = PyFloat_AsDouble( PyDict_GetItemString(self->params, "La") );
-    self->model->Na = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Na") );
-    self->model->Nb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nb") );
-    self->model->Nc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nc") );
-    self->model->Nd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Nd") );
-    self->model->Ld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Ld") );
-    self->model->Kcd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kcd") );
-    self->model->vd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "vd") );
-    self->model->Phib = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phib") );
-    self->model->Kac = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kac") );
-    self->model->Kab = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kab") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->bb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bb") );
-    self->model->Kad = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kad") );
-    self->model->bd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bd") );
-    self->model->Phid = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phid") );
-    self->model->Phic = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phic") );
-    self->model->ba = PyFloat_AsDouble( PyDict_GetItemString(self->params, "ba") );
-    self->model->Phia = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Phia") );
-    self->model->bc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "bc") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->Kbc = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kbc") );
-    self->model->Kbd = PyFloat_AsDouble( PyDict_GetItemString(self->params, "Kbd") );
-    self->model->lcase_n = PyFloat_AsDouble( PyDict_GetItemString(self->params, "lcase_n") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "background");
-    self->model->background.dispersion->accept_as_destination(visitor, self->model->background.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CRPAModelError, 
-	    	"CRPAModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CRPAModelError, 
-	    		"CRPAModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CRPAModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CRPAModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CRPAModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CRPAModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CRPAModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CRPAModelError,
-	    	"CRPAModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "background")) {
-        self->model->background.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CRPAModelError,
-	    	"CRPAModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CRPAModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CRPAModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CRPAModel",             /*tp_name*/
-    sizeof(CRPAModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CRPAModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CRPAModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CRPAModel_methods,             /* tp_methods */
-    CRPAModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CRPAModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CRPAModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCRPAModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CRPAModelType) < 0)
-        return;
-
-    Py_INCREF(&CRPAModelType);
-    PyModule_AddObject(module, "CRPAModel", (PyObject *)&CRPAModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CRPAModel.error";
-    CRPAModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CRPAModelError", CRPAModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CReflAdvModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CReflAdvModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,886 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CReflAdvModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY refl_adv.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "refl_adv.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CReflAdvModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    ReflAdvModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CReflAdvModel;
-
-
-static void
-CReflAdvModel_dealloc(CReflAdvModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CReflAdvModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CReflAdvModel *self;
-    
-    self = (CReflAdvModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CReflAdvModel_init(CReflAdvModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new ReflAdvModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"sldIM_flat4",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat8",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat9",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"sldIM_flat7",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldIM_flat10",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldIM_flat5",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat1",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat3",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"n_layers",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat6",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat7",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat4",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat5",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter0",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter1",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"sld_bottom0",Py_BuildValue("d",0.000002070000));
-        PyDict_SetItemString(self->params,"thick_inter3",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter4",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter5",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter6",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter7",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter8",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter9",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"npts_inter",Py_BuildValue("d",21.000000000000));
-        PyDict_SetItemString(self->params,"sldIM_flat1",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sldIM_flat2",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter9",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter10",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"sldIM_flat3",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter8",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat2",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"func_inter0",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_medium",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"func_inter2",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter3",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat10",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"func_inter5",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter6",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter7",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_flat4",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat5",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat6",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat7",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat1",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat2",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat3",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sldIM_flat8",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_flat8",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat9",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sldIM_flat9",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"nu_inter10",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter1",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldIM_sub0",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldIM_medium",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_flat10",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sldIM_flat6",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter4",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter2",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"nu_inter8",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter5",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter4",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter7",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter6",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter1",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter0",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter3",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter2",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter9",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"func_inter10",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->thick_inter0.dispersion->accept_as_source(visitor, self->model->thick_inter0.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_inter0", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CReflAdvModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CReflAdvModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CReflAdvModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CReflAdvModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CReflAdvModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(ReflAdvModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( ReflAdvModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CReflAdvModelError, 
-                   "CReflAdvModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CReflAdvModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );
-    self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );
-    self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->n_layers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_layers") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->sld_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_medium") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );
-    self->model->nu_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter10") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );
-    self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->nu_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter8") );
-    self->model->nu_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter5") );
-    self->model->nu_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter4") );
-    self->model->nu_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter7") );
-    self->model->nu_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter6") );
-    self->model->nu_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter1") );
-    self->model->nu_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter0") );
-    self->model->nu_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter3") );
-    self->model->nu_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter2") );
-    self->model->nu_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter9") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CReflAdvModelError, 
-	    	"CReflAdvModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CReflAdvModelError, 
-                   "CReflAdvModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CReflAdvModelError, 
-	    		"CReflAdvModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CReflAdvModelError, 
-                   "CReflAdvModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CReflAdvModelError, 
-                   "CReflAdvModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CReflAdvModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );
-    self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );
-    self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->n_layers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_layers") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->sld_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_medium") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );
-    self->model->nu_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter10") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );
-    self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->nu_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter8") );
-    self->model->nu_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter5") );
-    self->model->nu_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter4") );
-    self->model->nu_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter7") );
-    self->model->nu_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter6") );
-    self->model->nu_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter1") );
-    self->model->nu_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter0") );
-    self->model->nu_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter3") );
-    self->model->nu_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter2") );
-    self->model->nu_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter9") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CReflAdvModelError, 
-	    	"CReflAdvModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CReflAdvModelError, 
-	    		"CReflAdvModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CReflAdvModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CReflAdvModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CReflAdvModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CReflAdvModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );
-    self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );
-    self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->n_layers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_layers") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->sld_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_medium") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );
-    self->model->nu_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter10") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );
-    self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->nu_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter8") );
-    self->model->nu_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter5") );
-    self->model->nu_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter4") );
-    self->model->nu_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter7") );
-    self->model->nu_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter6") );
-    self->model->nu_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter1") );
-    self->model->nu_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter0") );
-    self->model->nu_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter3") );
-    self->model->nu_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter2") );
-    self->model->nu_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter9") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CReflAdvModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );
-    self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );
-    self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->n_layers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_layers") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->sld_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_medium") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );
-    self->model->nu_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter10") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );
-    self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->nu_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter8") );
-    self->model->nu_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter5") );
-    self->model->nu_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter4") );
-    self->model->nu_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter7") );
-    self->model->nu_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter6") );
-    self->model->nu_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter1") );
-    self->model->nu_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter0") );
-    self->model->nu_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter3") );
-    self->model->nu_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter2") );
-    self->model->nu_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter9") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CReflAdvModelError, 
-	    	"CReflAdvModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CReflAdvModelError, 
-	    		"CReflAdvModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CReflAdvModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CReflAdvModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CReflAdvModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CReflAdvModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CReflAdvModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CReflAdvModelError,
-	    	"CReflAdvModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "thick_inter0")) {
-        self->model->thick_inter0.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CReflAdvModelError,
-	    	"CReflAdvModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CReflAdvModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CReflAdvModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CReflAdvModel",             /*tp_name*/
-    sizeof(CReflAdvModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CReflAdvModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CReflAdvModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CReflAdvModel_methods,             /* tp_methods */
-    CReflAdvModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CReflAdvModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CReflAdvModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCReflAdvModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CReflAdvModelType) < 0)
-        return;
-
-    Py_INCREF(&CReflAdvModelType);
-    PyModule_AddObject(module, "CReflAdvModel", (PyObject *)&CReflAdvModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CReflAdvModel.error";
-    CReflAdvModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CReflAdvModelError", CReflAdvModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CReflModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CReflModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,766 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CReflModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY refl.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "refl.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CReflModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    ReflModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CReflModel;
-
-
-static void
-CReflModel_dealloc(CReflModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CReflModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CReflModel *self;
-    
-    self = (CReflModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CReflModel_init(CReflModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new ReflModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"thick_flat8",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat9",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat1",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat3",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"n_layers",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat6",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat7",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat4",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat5",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter0",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter1",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sld_bottom0",Py_BuildValue("d",0.000002070000));
-        PyDict_SetItemString(self->params,"thick_inter3",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter4",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter5",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter6",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter7",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter8",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter9",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"func_inter9",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter10",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"func_inter8",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat2",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"func_inter0",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_medium",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"func_inter2",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter3",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat10",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"func_inter5",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter6",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter7",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_flat4",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat5",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat6",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat7",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat1",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat2",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat3",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat8",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat9",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter1",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_flat10",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"func_inter4",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter2",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"func_inter10",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->thick_inter0.dispersion->accept_as_source(visitor, self->model->thick_inter0.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_inter0", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CReflModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CReflModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CReflModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CReflModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CReflModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(ReflModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( ReflModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CReflModelError, 
-                   "CReflModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CReflModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->n_layers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_layers") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->sld_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_medium") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CReflModelError, 
-	    	"CReflModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CReflModelError, 
-                   "CReflModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CReflModelError, 
-	    		"CReflModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CReflModelError, 
-                   "CReflModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CReflModelError, 
-                   "CReflModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CReflModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->n_layers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_layers") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->sld_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_medium") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CReflModelError, 
-	    	"CReflModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CReflModelError, 
-	    		"CReflModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CReflModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CReflModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CReflModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CReflModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->n_layers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_layers") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->sld_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_medium") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CReflModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->n_layers = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_layers") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->sld_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_medium") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CReflModelError, 
-	    	"CReflModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CReflModelError, 
-	    		"CReflModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CReflModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CReflModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CReflModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CReflModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CReflModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CReflModelError,
-	    	"CReflModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "thick_inter0")) {
-        self->model->thick_inter0.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CReflModelError,
-	    	"CReflModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CReflModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CReflModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CReflModel",             /*tp_name*/
-    sizeof(CReflModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CReflModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CReflModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CReflModel_methods,             /* tp_methods */
-    CReflModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CReflModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CReflModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCReflModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CReflModelType) < 0)
-        return;
-
-    Py_INCREF(&CReflModelType);
-    PyModule_AddObject(module, "CReflModel", (PyObject *)&CReflModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CReflModel.error";
-    CReflModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CReflModelError", CReflModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CSCCrystalModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CSCCrystalModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,620 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CSCCrystalModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY sc.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "sc.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CSCCrystalModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    SCCrystalModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CSCCrystalModel;
-
-
-static void
-CSCCrystalModel_dealloc(CSCCrystalModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CSCCrystalModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CSCCrystalModel *self;
-    
-    self = (CSCCrystalModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CSCCrystalModel_init(CSCCrystalModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new SCCrystalModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"dnn",Py_BuildValue("d",220.000000000000));
-        PyDict_SetItemString(self->params,"sldSph",Py_BuildValue("d",0.000003000000));
-        PyDict_SetItemString(self->params,"d_factor",Py_BuildValue("d",0.060000000000));
-        PyDict_SetItemString(self->params,"psi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",40.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000006300000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->phi.dispersion->accept_as_source(visitor, self->model->phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->psi.dispersion->accept_as_source(visitor, self->model->psi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "psi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->theta.dispersion->accept_as_source(visitor, self->model->theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "theta", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CSCCrystalModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CSCCrystalModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CSCCrystalModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CSCCrystalModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CSCCrystalModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(SCCrystalModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( SCCrystalModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CSCCrystalModelError, 
-                   "CSCCrystalModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CSCCrystalModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSCCrystalModelError, 
-	    	"CSCCrystalModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CSCCrystalModelError, 
-                   "CSCCrystalModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CSCCrystalModelError, 
-	    		"CSCCrystalModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CSCCrystalModelError, 
-                   "CSCCrystalModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CSCCrystalModelError, 
-                   "CSCCrystalModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CSCCrystalModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSCCrystalModelError, 
-	    	"CSCCrystalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSCCrystalModelError, 
-	    		"CSCCrystalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CSCCrystalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CSCCrystalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CSCCrystalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CSCCrystalModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CSCCrystalModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->dnn = PyFloat_AsDouble( PyDict_GetItemString(self->params, "dnn") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->d_factor = PyFloat_AsDouble( PyDict_GetItemString(self->params, "d_factor") );
-    self->model->psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "psi") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
-    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "psi");
-    self->model->psi.dispersion->accept_as_destination(visitor, self->model->psi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
-    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSCCrystalModelError, 
-	    	"CSCCrystalModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSCCrystalModelError, 
-	    		"CSCCrystalModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CSCCrystalModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CSCCrystalModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CSCCrystalModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CSCCrystalModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CSCCrystalModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CSCCrystalModelError,
-	    	"CSCCrystalModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "phi")) {
-        self->model->phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "psi")) {
-        self->model->psi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "theta")) {
-        self->model->theta.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CSCCrystalModelError,
-	    	"CSCCrystalModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CSCCrystalModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CSCCrystalModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CSCCrystalModel",             /*tp_name*/
-    sizeof(CSCCrystalModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CSCCrystalModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CSCCrystalModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CSCCrystalModel_methods,             /* tp_methods */
-    CSCCrystalModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CSCCrystalModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CSCCrystalModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCSCCrystalModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CSCCrystalModelType) < 0)
-        return;
-
-    Py_INCREF(&CSCCrystalModelType);
-    PyModule_AddObject(module, "CSCCrystalModel", (PyObject *)&CSCCrystalModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CSCCrystalModel.error";
-    CSCCrystalModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CSCCrystalModelError", CSCCrystalModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CSLDCalFunc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CSLDCalFunc.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,561 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CSLDCalFunc
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY sld_cal.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "sld_cal.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CSLDCalFuncError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    SLDCalFunc * model;
-    /// Log for unit testing
-    PyObject * log;
-} CSLDCalFunc;
-
-
-static void
-CSLDCalFunc_dealloc(CSLDCalFunc* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CSLDCalFunc_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CSLDCalFunc *self;
-    
-    self = (CSLDCalFunc *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CSLDCalFunc_init(CSLDCalFunc *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new SLDCalFunc();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"fun_type",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"nu_inter",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"shell_num",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_right",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_left",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"npts_inter",Py_BuildValue("d",21.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->npts_inter.dispersion->accept_as_source(visitor, self->model->npts_inter.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "npts_inter", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CSLDCalFunc_members[] = {
-    {name_params, T_OBJECT, offsetof(CSLDCalFunc, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CSLDCalFunc, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CSLDCalFunc, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CSLDCalFunc_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(SLDCalFunc* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( SLDCalFunc* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CSLDCalFuncError, 
-                   "CSLDCalFunc.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CSLDCalFunc *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->fun_type = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fun_type") );
-    self->model->nu_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter") );
-    self->model->shell_num = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_num") );
-    self->model->sld_right = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_right") );
-    self->model->sld_left = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_left") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "npts_inter");
-    self->model->npts_inter.dispersion->accept_as_destination(visitor, self->model->npts_inter.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSLDCalFuncError, 
-	    	"CSLDCalFunc.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CSLDCalFuncError, 
-                   "CSLDCalFunc.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CSLDCalFuncError, 
-	    		"CSLDCalFunc.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CSLDCalFuncError, 
-                   "CSLDCalFunc.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CSLDCalFuncError, 
-                   "CSLDCalFunc.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CSLDCalFunc *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->fun_type = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fun_type") );
-    self->model->nu_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter") );
-    self->model->shell_num = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_num") );
-    self->model->sld_right = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_right") );
-    self->model->sld_left = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_left") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "npts_inter");
-    self->model->npts_inter.dispersion->accept_as_destination(visitor, self->model->npts_inter.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSLDCalFuncError, 
-	    	"CSLDCalFunc.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSLDCalFuncError, 
-	    		"CSLDCalFunc.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CSLDCalFunc_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CSLDCalFunc_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CSLDCalFunc_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CSLDCalFunc *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->fun_type = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fun_type") );
-    self->model->nu_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter") );
-    self->model->shell_num = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_num") );
-    self->model->sld_right = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_right") );
-    self->model->sld_left = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_left") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "npts_inter");
-    self->model->npts_inter.dispersion->accept_as_destination(visitor, self->model->npts_inter.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CSLDCalFunc *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->fun_type = PyFloat_AsDouble( PyDict_GetItemString(self->params, "fun_type") );
-    self->model->nu_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter") );
-    self->model->shell_num = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_num") );
-    self->model->sld_right = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_right") );
-    self->model->sld_left = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_left") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "npts_inter");
-    self->model->npts_inter.dispersion->accept_as_destination(visitor, self->model->npts_inter.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSLDCalFuncError, 
-	    	"CSLDCalFunc.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSLDCalFuncError, 
-	    		"CSLDCalFunc.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CSLDCalFunc_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CSLDCalFunc_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CSLDCalFunc_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CSLDCalFunc *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CSLDCalFunc *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CSLDCalFuncError,
-	    	"CSLDCalFunc.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "npts_inter")) {
-        self->model->npts_inter.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CSLDCalFuncError,
-	    	"CSLDCalFunc.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CSLDCalFunc_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CSLDCalFuncType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CSLDCalFunc",             /*tp_name*/
-    sizeof(CSLDCalFunc),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CSLDCalFunc_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CSLDCalFunc objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CSLDCalFunc_methods,             /* tp_methods */
-    CSLDCalFunc_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CSLDCalFunc_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CSLDCalFunc_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCSLDCalFunc(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CSLDCalFuncType) < 0)
-        return;
-
-    Py_INCREF(&CSLDCalFuncType);
-    PyModule_AddObject(module, "CSLDCalFunc", (PyObject *)&CSLDCalFuncType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CSLDCalFunc.error";
-    CSLDCalFuncError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CSLDCalFuncError", CSLDCalFuncError);
-}
-
Index: sansmodels/src/sans/models/c_models/CSchulz.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CSchulz.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,533 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CSchulz
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY schulz.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "schulz.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CSchulzError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    Schulz * model;
-    /// Log for unit testing
-    PyObject * log;
-} CSchulz;
-
-
-static void
-CSchulz_dealloc(CSchulz* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CSchulz_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CSchulz *self;
-    
-    self = (CSchulz *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CSchulz_init(CSchulz *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new Schulz();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sigma",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"center",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CSchulz_members[] = {
-    {name_params, T_OBJECT, offsetof(CSchulz, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CSchulz, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CSchulz, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CSchulz_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(Schulz* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( Schulz* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CSchulzError, 
-                   "CSchulz.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CSchulz *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSchulzError, 
-	    	"CSchulz.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CSchulzError, 
-                   "CSchulz.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CSchulzError, 
-	    		"CSchulz.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CSchulzError, 
-                   "CSchulz.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CSchulzError, 
-                   "CSchulz.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CSchulz *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSchulzError, 
-	    	"CSchulz.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSchulzError, 
-	    		"CSchulz.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CSchulz_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CSchulz_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CSchulz_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CSchulz *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CSchulz *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
-    self->model->center = PyFloat_AsDouble( PyDict_GetItemString(self->params, "center") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSchulzError, 
-	    	"CSchulz.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSchulzError, 
-	    		"CSchulz.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CSchulz_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CSchulz_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CSchulz_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CSchulz *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CSchulz *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CSchulzError,
-	    	"CSchulz.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
- {
-	    PyErr_SetString(CSchulzError,
-	    	"CSchulz.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CSchulz_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CSchulzType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CSchulz",             /*tp_name*/
-    sizeof(CSchulz),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CSchulz_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CSchulz objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CSchulz_methods,             /* tp_methods */
-    CSchulz_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CSchulz_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CSchulz_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCSchulz(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CSchulzType) < 0)
-        return;
-
-    Py_INCREF(&CSchulzType);
-    PyModule_AddObject(module, "CSchulz", (PyObject *)&CSchulzType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CSchulz.error";
-    CSchulzError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CSchulzError", CSchulzError);
-}
-
Index: sansmodels/src/sans/models/c_models/CSphereModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CSphereModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,556 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CSphereModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY sphere.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "sphere.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CSphereModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    SphereModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CSphereModel;
-
-
-static void
-CSphereModel_dealloc(CSphereModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CSphereModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CSphereModel *self;
-    
-    self = (CSphereModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CSphereModel_init(CSphereModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new SphereModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"sldSph",Py_BuildValue("d",0.000002000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",60.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CSphereModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CSphereModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CSphereModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CSphereModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CSphereModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(SphereModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( SphereModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CSphereModelError, 
-                   "CSphereModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CSphereModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSphereModelError, 
-	    	"CSphereModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CSphereModelError, 
-                   "CSphereModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CSphereModelError, 
-	    		"CSphereModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CSphereModelError, 
-                   "CSphereModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CSphereModelError, 
-                   "CSphereModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CSphereModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSphereModelError, 
-	    	"CSphereModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSphereModelError, 
-	    		"CSphereModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CSphereModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CSphereModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CSphereModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CSphereModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CSphereModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->sldSph = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSph") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSphereModelError, 
-	    	"CSphereModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSphereModelError, 
-	    		"CSphereModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CSphereModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CSphereModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CSphereModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CSphereModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CSphereModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CSphereModelError,
-	    	"CSphereModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CSphereModelError,
-	    	"CSphereModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CSphereModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CSphereModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CSphereModel",             /*tp_name*/
-    sizeof(CSphereModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CSphereModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CSphereModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CSphereModel_methods,             /* tp_methods */
-    CSphereModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CSphereModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CSphereModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCSphereModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CSphereModelType) < 0)
-        return;
-
-    Py_INCREF(&CSphereModelType);
-    PyModule_AddObject(module, "CSphereModel", (PyObject *)&CSphereModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CSphereModel.error";
-    CSphereModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CSphereModelError", CSphereModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CSphereSLDModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CSphereSLDModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,844 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CSphereSLDModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY spheresld.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "spheresld.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CSphereSLDModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    SphereSLDModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CSphereSLDModel;
-
-
-static void
-CSphereSLDModel_dealloc(CSphereSLDModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CSphereSLDModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CSphereSLDModel *self;
-    
-    self = (CSphereSLDModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CSphereSLDModel_init(CSphereSLDModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new SphereSLDModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"thick_flat8",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat9",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat2",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat3",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat1",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat6",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat7",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat4",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat5",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter0",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter1",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter2",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter3",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"sld_core0",Py_BuildValue("d",0.000002070000));
-        PyDict_SetItemString(self->params,"thick_inter5",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter6",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter7",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter8",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter9",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"rad_core0",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"npts_inter",Py_BuildValue("d",35.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"thick_inter10",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"func_inter8",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter9",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"func_inter0",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter1",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter2",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter3",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"thick_flat10",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"func_inter5",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter6",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"func_inter7",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sld_flat4",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat5",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat6",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat7",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat1",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat2",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat3",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"sld_flat8",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"sld_flat9",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"nu_inter10",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"n_shells",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"sld_flat10",Py_BuildValue("d",0.000003500000));
-        PyDict_SetItemString(self->params,"func_inter4",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"nu_inter8",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter5",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter4",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter7",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter6",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter1",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter0",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter3",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"nu_inter2",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"thick_inter4",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"nu_inter9",Py_BuildValue("d",2.500000000000));
-        PyDict_SetItemString(self->params,"func_inter10",Py_BuildValue("d",0.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->rad_core0.dispersion->accept_as_source(visitor, self->model->rad_core0.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rad_core0", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thick_inter0.dispersion->accept_as_source(visitor, self->model->thick_inter0.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thick_inter0", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CSphereSLDModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CSphereSLDModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CSphereSLDModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CSphereSLDModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CSphereSLDModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(SphereSLDModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( SphereSLDModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CSphereSLDModelError, 
-                   "CSphereSLDModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CSphereSLDModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->nu_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter10") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->n_shells = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_shells") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->nu_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter8") );
-    self->model->nu_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter5") );
-    self->model->nu_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter4") );
-    self->model->nu_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter7") );
-    self->model->nu_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter6") );
-    self->model->nu_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter1") );
-    self->model->nu_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter0") );
-    self->model->nu_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter3") );
-    self->model->nu_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter2") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->nu_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter9") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSphereSLDModelError, 
-	    	"CSphereSLDModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CSphereSLDModelError, 
-                   "CSphereSLDModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CSphereSLDModelError, 
-	    		"CSphereSLDModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CSphereSLDModelError, 
-                   "CSphereSLDModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CSphereSLDModelError, 
-                   "CSphereSLDModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CSphereSLDModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->nu_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter10") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->n_shells = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_shells") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->nu_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter8") );
-    self->model->nu_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter5") );
-    self->model->nu_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter4") );
-    self->model->nu_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter7") );
-    self->model->nu_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter6") );
-    self->model->nu_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter1") );
-    self->model->nu_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter0") );
-    self->model->nu_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter3") );
-    self->model->nu_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter2") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->nu_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter9") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSphereSLDModelError, 
-	    	"CSphereSLDModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSphereSLDModelError, 
-	    		"CSphereSLDModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CSphereSLDModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CSphereSLDModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CSphereSLDModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CSphereSLDModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->nu_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter10") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->n_shells = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_shells") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->nu_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter8") );
-    self->model->nu_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter5") );
-    self->model->nu_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter4") );
-    self->model->nu_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter7") );
-    self->model->nu_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter6") );
-    self->model->nu_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter1") );
-    self->model->nu_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter0") );
-    self->model->nu_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter3") );
-    self->model->nu_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter2") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->nu_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter9") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CSphereSLDModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
-    self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
-    self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
-    self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
-    self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
-    self->model->thick_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat6") );
-    self->model->thick_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat7") );
-    self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") );
-    self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") );
-    self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
-    self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") );
-    self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );
-    self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") );
-    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
-    self->model->thick_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter5") );
-    self->model->thick_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter6") );
-    self->model->thick_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter7") );
-    self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
-    self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
-    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
-    self->model->npts_inter = PyFloat_AsDouble( PyDict_GetItemString(self->params, "npts_inter") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
-    self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
-    self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
-    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
-    self->model->func_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter0") );
-    self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
-    self->model->func_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter2") );
-    self->model->func_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter3") );
-    self->model->thick_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat10") );
-    self->model->func_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter5") );
-    self->model->func_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter6") );
-    self->model->func_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter7") );
-    self->model->sld_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat4") );
-    self->model->sld_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat5") );
-    self->model->sld_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat6") );
-    self->model->sld_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat7") );
-    self->model->sld_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat1") );
-    self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
-    self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
-    self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
-    self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
-    self->model->nu_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter10") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->n_shells = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_shells") );
-    self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
-    self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
-    self->model->nu_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter8") );
-    self->model->nu_inter5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter5") );
-    self->model->nu_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter4") );
-    self->model->nu_inter7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter7") );
-    self->model->nu_inter6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter6") );
-    self->model->nu_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter1") );
-    self->model->nu_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter0") );
-    self->model->nu_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter3") );
-    self->model->nu_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter2") );
-    self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") );
-    self->model->nu_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "nu_inter9") );
-    self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
-    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thick_inter0");
-    self->model->thick_inter0.dispersion->accept_as_destination(visitor, self->model->thick_inter0.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSphereSLDModelError, 
-	    	"CSphereSLDModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSphereSLDModelError, 
-	    		"CSphereSLDModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CSphereSLDModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CSphereSLDModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CSphereSLDModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CSphereSLDModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CSphereSLDModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CSphereSLDModelError,
-	    	"CSphereSLDModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "rad_core0")) {
-        self->model->rad_core0.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thick_inter0")) {
-        self->model->thick_inter0.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CSphereSLDModelError,
-	    	"CSphereSLDModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CSphereSLDModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CSphereSLDModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CSphereSLDModel",             /*tp_name*/
-    sizeof(CSphereSLDModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CSphereSLDModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CSphereSLDModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CSphereSLDModel_methods,             /* tp_methods */
-    CSphereSLDModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CSphereSLDModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CSphereSLDModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCSphereSLDModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CSphereSLDModelType) < 0)
-        return;
-
-    Py_INCREF(&CSphereSLDModelType);
-    PyModule_AddObject(module, "CSphereSLDModel", (PyObject *)&CSphereSLDModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CSphereSLDModel.error";
-    CSphereSLDModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CSphereSLDModelError", CSphereSLDModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CSquareWellStructure.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CSquareWellStructure.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,551 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CSquareWellStructure
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY SquareWell.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "SquareWell.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CSquareWellStructureError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    SquareWellStructure * model;
-    /// Log for unit testing
-    PyObject * log;
-} CSquareWellStructure;
-
-
-static void
-CSquareWellStructure_dealloc(CSquareWellStructure* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CSquareWellStructure_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CSquareWellStructure *self;
-    
-    self = (CSquareWellStructure *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CSquareWellStructure_init(CSquareWellStructure *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new SquareWellStructure();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"welldepth",Py_BuildValue("d",1.500000000000));
-        PyDict_SetItemString(self->params,"effect_radius",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"volfraction",Py_BuildValue("d",0.040000000000));
-        PyDict_SetItemString(self->params,"wellwidth",Py_BuildValue("d",1.200000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->effect_radius.dispersion->accept_as_source(visitor, self->model->effect_radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "effect_radius", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CSquareWellStructure_members[] = {
-    {name_params, T_OBJECT, offsetof(CSquareWellStructure, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CSquareWellStructure, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CSquareWellStructure, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CSquareWellStructure_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(SquareWellStructure* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( SquareWellStructure* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CSquareWellStructureError, 
-                   "CSquareWellStructure.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CSquareWellStructure *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->welldepth = PyFloat_AsDouble( PyDict_GetItemString(self->params, "welldepth") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->wellwidth = PyFloat_AsDouble( PyDict_GetItemString(self->params, "wellwidth") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSquareWellStructureError, 
-	    	"CSquareWellStructure.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CSquareWellStructureError, 
-                   "CSquareWellStructure.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CSquareWellStructureError, 
-	    		"CSquareWellStructure.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CSquareWellStructureError, 
-                   "CSquareWellStructure.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CSquareWellStructureError, 
-                   "CSquareWellStructure.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CSquareWellStructure *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->welldepth = PyFloat_AsDouble( PyDict_GetItemString(self->params, "welldepth") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->wellwidth = PyFloat_AsDouble( PyDict_GetItemString(self->params, "wellwidth") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSquareWellStructureError, 
-	    	"CSquareWellStructure.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSquareWellStructureError, 
-	    		"CSquareWellStructure.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CSquareWellStructure_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CSquareWellStructure_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CSquareWellStructure_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CSquareWellStructure *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->welldepth = PyFloat_AsDouble( PyDict_GetItemString(self->params, "welldepth") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->wellwidth = PyFloat_AsDouble( PyDict_GetItemString(self->params, "wellwidth") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CSquareWellStructure *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->welldepth = PyFloat_AsDouble( PyDict_GetItemString(self->params, "welldepth") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->wellwidth = PyFloat_AsDouble( PyDict_GetItemString(self->params, "wellwidth") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CSquareWellStructureError, 
-	    	"CSquareWellStructure.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CSquareWellStructureError, 
-	    		"CSquareWellStructure.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CSquareWellStructure_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CSquareWellStructure_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CSquareWellStructure_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CSquareWellStructure *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CSquareWellStructure *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CSquareWellStructureError,
-	    	"CSquareWellStructure.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "effect_radius")) {
-        self->model->effect_radius.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CSquareWellStructureError,
-	    	"CSquareWellStructure.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CSquareWellStructure_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CSquareWellStructureType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CSquareWellStructure",             /*tp_name*/
-    sizeof(CSquareWellStructure),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CSquareWellStructure_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CSquareWellStructure objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CSquareWellStructure_methods,             /* tp_methods */
-    CSquareWellStructure_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CSquareWellStructure_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CSquareWellStructure_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCSquareWellStructure(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CSquareWellStructureType) < 0)
-        return;
-
-    Py_INCREF(&CSquareWellStructureType);
-    PyModule_AddObject(module, "CSquareWellStructure", (PyObject *)&CSquareWellStructureType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CSquareWellStructure.error";
-    CSquareWellStructureError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CSquareWellStructureError", CSquareWellStructureError);
-}
-
Index: sansmodels/src/sans/models/c_models/CStackedDisksModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CStackedDisksModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,643 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CStackedDisksModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY stacked_disks.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "stacked_disks.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CStackedDisksModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    StackedDisksModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CStackedDisksModel;
-
-
-static void
-CStackedDisksModel_dealloc(CStackedDisksModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CStackedDisksModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CStackedDisksModel *self;
-    
-    self = (CStackedDisksModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CStackedDisksModel_init(CStackedDisksModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new StackedDisksModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"core_sld",Py_BuildValue("d",0.000004000000));
-        PyDict_SetItemString(self->params,"core_thick",Py_BuildValue("d",10.000000000000));
-        PyDict_SetItemString(self->params,"layer_thick",Py_BuildValue("d",15.000000000000));
-        PyDict_SetItemString(self->params,"axis_theta",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"layer_sld",Py_BuildValue("d",-0.000000400000));
-        PyDict_SetItemString(self->params,"axis_phi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"solvent_sld",Py_BuildValue("d",0.000005000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",0.010000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",3000.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000));
-        PyDict_SetItemString(self->params,"sigma_d",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"n_stacking",Py_BuildValue("d",1.000000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->core_thick.dispersion->accept_as_source(visitor, self->model->core_thick.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "core_thick", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->layer_thick.dispersion->accept_as_source(visitor, self->model->layer_thick.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "layer_thick", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CStackedDisksModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CStackedDisksModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CStackedDisksModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CStackedDisksModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CStackedDisksModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(StackedDisksModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( StackedDisksModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CStackedDisksModelError, 
-                   "CStackedDisksModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CStackedDisksModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->core_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_thick") );
-    self->model->layer_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "layer_thick") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->layer_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "layer_sld") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sigma_d = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma_d") );
-    self->model->n_stacking = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_stacking") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_thick");
-    self->model->core_thick.dispersion->accept_as_destination(visitor, self->model->core_thick.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "layer_thick");
-    self->model->layer_thick.dispersion->accept_as_destination(visitor, self->model->layer_thick.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CStackedDisksModelError, 
-	    	"CStackedDisksModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CStackedDisksModelError, 
-                   "CStackedDisksModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CStackedDisksModelError, 
-	    		"CStackedDisksModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CStackedDisksModelError, 
-                   "CStackedDisksModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CStackedDisksModelError, 
-                   "CStackedDisksModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CStackedDisksModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->core_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_thick") );
-    self->model->layer_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "layer_thick") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->layer_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "layer_sld") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sigma_d = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma_d") );
-    self->model->n_stacking = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_stacking") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_thick");
-    self->model->core_thick.dispersion->accept_as_destination(visitor, self->model->core_thick.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "layer_thick");
-    self->model->layer_thick.dispersion->accept_as_destination(visitor, self->model->layer_thick.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CStackedDisksModelError, 
-	    	"CStackedDisksModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CStackedDisksModelError, 
-	    		"CStackedDisksModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CStackedDisksModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CStackedDisksModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CStackedDisksModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CStackedDisksModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->core_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_thick") );
-    self->model->layer_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "layer_thick") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->layer_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "layer_sld") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sigma_d = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma_d") );
-    self->model->n_stacking = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_stacking") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_thick");
-    self->model->core_thick.dispersion->accept_as_destination(visitor, self->model->core_thick.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "layer_thick");
-    self->model->layer_thick.dispersion->accept_as_destination(visitor, self->model->layer_thick.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CStackedDisksModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->core_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_thick") );
-    self->model->layer_thick = PyFloat_AsDouble( PyDict_GetItemString(self->params, "layer_thick") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->layer_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "layer_sld") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sigma_d = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma_d") );
-    self->model->n_stacking = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_stacking") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "core_thick");
-    self->model->core_thick.dispersion->accept_as_destination(visitor, self->model->core_thick.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "layer_thick");
-    self->model->layer_thick.dispersion->accept_as_destination(visitor, self->model->layer_thick.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CStackedDisksModelError, 
-	    	"CStackedDisksModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CStackedDisksModelError, 
-	    		"CStackedDisksModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CStackedDisksModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CStackedDisksModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CStackedDisksModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CStackedDisksModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CStackedDisksModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CStackedDisksModelError,
-	    	"CStackedDisksModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "core_thick")) {
-        self->model->core_thick.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "layer_thick")) {
-        self->model->layer_thick.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_theta")) {
-        self->model->axis_theta.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_phi")) {
-        self->model->axis_phi.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CStackedDisksModelError,
-	    	"CStackedDisksModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CStackedDisksModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CStackedDisksModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CStackedDisksModel",             /*tp_name*/
-    sizeof(CStackedDisksModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CStackedDisksModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CStackedDisksModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CStackedDisksModel_methods,             /* tp_methods */
-    CStackedDisksModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CStackedDisksModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CStackedDisksModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCStackedDisksModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CStackedDisksModelType) < 0)
-        return;
-
-    Py_INCREF(&CStackedDisksModelType);
-    PyModule_AddObject(module, "CStackedDisksModel", (PyObject *)&CStackedDisksModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CStackedDisksModel.error";
-    CStackedDisksModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CStackedDisksModelError", CStackedDisksModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CStickyHSStructure.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CStickyHSStructure.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,551 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CStickyHSStructure
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY StickyHS.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "StickyHS.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CStickyHSStructureError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    StickyHSStructure * model;
-    /// Log for unit testing
-    PyObject * log;
-} CStickyHSStructure;
-
-
-static void
-CStickyHSStructure_dealloc(CStickyHSStructure* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CStickyHSStructure_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CStickyHSStructure *self;
-    
-    self = (CStickyHSStructure *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CStickyHSStructure_init(CStickyHSStructure *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new StickyHSStructure();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"stickiness",Py_BuildValue("d",0.200000000000));
-        PyDict_SetItemString(self->params,"effect_radius",Py_BuildValue("d",50.000000000000));
-        PyDict_SetItemString(self->params,"volfraction",Py_BuildValue("d",0.100000000000));
-        PyDict_SetItemString(self->params,"perturb",Py_BuildValue("d",0.050000000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->effect_radius.dispersion->accept_as_source(visitor, self->model->effect_radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "effect_radius", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CStickyHSStructure_members[] = {
-    {name_params, T_OBJECT, offsetof(CStickyHSStructure, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CStickyHSStructure, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CStickyHSStructure, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CStickyHSStructure_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(StickyHSStructure* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( StickyHSStructure* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CStickyHSStructureError, 
-                   "CStickyHSStructure.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CStickyHSStructure *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->stickiness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "stickiness") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->perturb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "perturb") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CStickyHSStructureError, 
-	    	"CStickyHSStructure.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CStickyHSStructureError, 
-                   "CStickyHSStructure.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CStickyHSStructureError, 
-	    		"CStickyHSStructure.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CStickyHSStructureError, 
-                   "CStickyHSStructure.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CStickyHSStructureError, 
-                   "CStickyHSStructure.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CStickyHSStructure *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->stickiness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "stickiness") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->perturb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "perturb") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CStickyHSStructureError, 
-	    	"CStickyHSStructure.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CStickyHSStructureError, 
-	    		"CStickyHSStructure.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CStickyHSStructure_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CStickyHSStructure_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CStickyHSStructure_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CStickyHSStructure *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->stickiness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "stickiness") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->perturb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "perturb") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CStickyHSStructure *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->stickiness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "stickiness") );
-    self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") );
-    self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") );
-    self->model->perturb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "perturb") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius");
-    self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CStickyHSStructureError, 
-	    	"CStickyHSStructure.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CStickyHSStructureError, 
-	    		"CStickyHSStructure.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CStickyHSStructure_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CStickyHSStructure_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CStickyHSStructure_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CStickyHSStructure *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CStickyHSStructure *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CStickyHSStructureError,
-	    	"CStickyHSStructure.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "effect_radius")) {
-        self->model->effect_radius.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CStickyHSStructureError,
-	    	"CStickyHSStructure.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CStickyHSStructure_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CStickyHSStructureType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CStickyHSStructure",             /*tp_name*/
-    sizeof(CStickyHSStructure),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CStickyHSStructure_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CStickyHSStructure objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CStickyHSStructure_methods,             /* tp_methods */
-    CStickyHSStructure_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CStickyHSStructure_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CStickyHSStructure_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCStickyHSStructure(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CStickyHSStructureType) < 0)
-        return;
-
-    Py_INCREF(&CStickyHSStructureType);
-    PyModule_AddObject(module, "CStickyHSStructure", (PyObject *)&CStickyHSStructureType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CStickyHSStructure.error";
-    CStickyHSStructureError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CStickyHSStructureError", CStickyHSStructureError);
-}
-
Index: sansmodels/src/sans/models/c_models/CTriaxialEllipsoidModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CTriaxialEllipsoidModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,646 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CTriaxialEllipsoidModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY triaxial_ellipsoid.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "triaxial_ellipsoid.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CTriaxialEllipsoidModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    TriaxialEllipsoidModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CTriaxialEllipsoidModel;
-
-
-static void
-CTriaxialEllipsoidModel_dealloc(CTriaxialEllipsoidModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CTriaxialEllipsoidModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CTriaxialEllipsoidModel *self;
-    
-    self = (CTriaxialEllipsoidModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CTriaxialEllipsoidModel_init(CTriaxialEllipsoidModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new TriaxialEllipsoidModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"axis_psi",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"axis_theta",Py_BuildValue("d",57.325000000000));
-        PyDict_SetItemString(self->params,"semi_axisA",Py_BuildValue("d",35.000000000000));
-        PyDict_SetItemString(self->params,"semi_axisB",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"semi_axisC",Py_BuildValue("d",400.000000000000));
-        PyDict_SetItemString(self->params,"axis_phi",Py_BuildValue("d",57.325000000000));
-        PyDict_SetItemString(self->params,"sldSolv",Py_BuildValue("d",0.000006300000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"sldEll",Py_BuildValue("d",0.000001000000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->semi_axisA.dispersion->accept_as_source(visitor, self->model->semi_axisA.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "semi_axisA", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->semi_axisB.dispersion->accept_as_source(visitor, self->model->semi_axisB.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "semi_axisB", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->semi_axisC.dispersion->accept_as_source(visitor, self->model->semi_axisC.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "semi_axisC", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->axis_psi.dispersion->accept_as_source(visitor, self->model->axis_psi.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "axis_psi", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CTriaxialEllipsoidModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CTriaxialEllipsoidModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CTriaxialEllipsoidModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CTriaxialEllipsoidModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CTriaxialEllipsoidModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(TriaxialEllipsoidModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( TriaxialEllipsoidModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CTriaxialEllipsoidModelError, 
-                   "CTriaxialEllipsoidModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CTriaxialEllipsoidModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_psi") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->semi_axisA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisA") );
-    self->model->semi_axisB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisB") );
-    self->model->semi_axisC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisC") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldEll = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldEll") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisA");
-    self->model->semi_axisA.dispersion->accept_as_destination(visitor, self->model->semi_axisA.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisB");
-    self->model->semi_axisB.dispersion->accept_as_destination(visitor, self->model->semi_axisB.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisC");
-    self->model->semi_axisC.dispersion->accept_as_destination(visitor, self->model->semi_axisC.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_psi");
-    self->model->axis_psi.dispersion->accept_as_destination(visitor, self->model->axis_psi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CTriaxialEllipsoidModelError, 
-	    	"CTriaxialEllipsoidModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CTriaxialEllipsoidModelError, 
-                   "CTriaxialEllipsoidModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CTriaxialEllipsoidModelError, 
-	    		"CTriaxialEllipsoidModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CTriaxialEllipsoidModelError, 
-                   "CTriaxialEllipsoidModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CTriaxialEllipsoidModelError, 
-                   "CTriaxialEllipsoidModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CTriaxialEllipsoidModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_psi") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->semi_axisA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisA") );
-    self->model->semi_axisB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisB") );
-    self->model->semi_axisC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisC") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldEll = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldEll") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisA");
-    self->model->semi_axisA.dispersion->accept_as_destination(visitor, self->model->semi_axisA.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisB");
-    self->model->semi_axisB.dispersion->accept_as_destination(visitor, self->model->semi_axisB.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisC");
-    self->model->semi_axisC.dispersion->accept_as_destination(visitor, self->model->semi_axisC.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_psi");
-    self->model->axis_psi.dispersion->accept_as_destination(visitor, self->model->axis_psi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CTriaxialEllipsoidModelError, 
-	    	"CTriaxialEllipsoidModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CTriaxialEllipsoidModelError, 
-	    		"CTriaxialEllipsoidModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CTriaxialEllipsoidModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CTriaxialEllipsoidModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CTriaxialEllipsoidModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CTriaxialEllipsoidModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_psi") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->semi_axisA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisA") );
-    self->model->semi_axisB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisB") );
-    self->model->semi_axisC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisC") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldEll = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldEll") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisA");
-    self->model->semi_axisA.dispersion->accept_as_destination(visitor, self->model->semi_axisA.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisB");
-    self->model->semi_axisB.dispersion->accept_as_destination(visitor, self->model->semi_axisB.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisC");
-    self->model->semi_axisC.dispersion->accept_as_destination(visitor, self->model->semi_axisC.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_psi");
-    self->model->axis_psi.dispersion->accept_as_destination(visitor, self->model->axis_psi.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CTriaxialEllipsoidModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->axis_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_psi") );
-    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
-    self->model->semi_axisA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisA") );
-    self->model->semi_axisB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisB") );
-    self->model->semi_axisC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "semi_axisC") );
-    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
-    self->model->sldSolv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldSolv") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->sldEll = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldEll") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisA");
-    self->model->semi_axisA.dispersion->accept_as_destination(visitor, self->model->semi_axisA.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisB");
-    self->model->semi_axisB.dispersion->accept_as_destination(visitor, self->model->semi_axisB.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "semi_axisC");
-    self->model->semi_axisC.dispersion->accept_as_destination(visitor, self->model->semi_axisC.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
-    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
-    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "axis_psi");
-    self->model->axis_psi.dispersion->accept_as_destination(visitor, self->model->axis_psi.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CTriaxialEllipsoidModelError, 
-	    	"CTriaxialEllipsoidModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CTriaxialEllipsoidModelError, 
-	    		"CTriaxialEllipsoidModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CTriaxialEllipsoidModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CTriaxialEllipsoidModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CTriaxialEllipsoidModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CTriaxialEllipsoidModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CTriaxialEllipsoidModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CTriaxialEllipsoidModelError,
-	    	"CTriaxialEllipsoidModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "semi_axisA")) {
-        self->model->semi_axisA.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "semi_axisB")) {
-        self->model->semi_axisB.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "semi_axisC")) {
-        self->model->semi_axisC.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_theta")) {
-        self->model->axis_theta.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_phi")) {
-        self->model->axis_phi.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "axis_psi")) {
-        self->model->axis_psi.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CTriaxialEllipsoidModelError,
-	    	"CTriaxialEllipsoidModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CTriaxialEllipsoidModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CTriaxialEllipsoidModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CTriaxialEllipsoidModel",             /*tp_name*/
-    sizeof(CTriaxialEllipsoidModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CTriaxialEllipsoidModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CTriaxialEllipsoidModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CTriaxialEllipsoidModel_methods,             /* tp_methods */
-    CTriaxialEllipsoidModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CTriaxialEllipsoidModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CTriaxialEllipsoidModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCTriaxialEllipsoidModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CTriaxialEllipsoidModelType) < 0)
-        return;
-
-    Py_INCREF(&CTriaxialEllipsoidModelType);
-    PyModule_AddObject(module, "CTriaxialEllipsoidModel", (PyObject *)&CTriaxialEllipsoidModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CTriaxialEllipsoidModel.error";
-    CTriaxialEllipsoidModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CTriaxialEllipsoidModelError", CTriaxialEllipsoidModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/CVesicleModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CVesicleModel.cpp	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,574 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** CVesicleModel
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY vesicle.h
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "vesicle.h"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * CVesicleModelError = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    VesicleModel * model;
-    /// Log for unit testing
-    PyObject * log;
-} CVesicleModel;
-
-
-static void
-CVesicleModel_dealloc(CVesicleModel* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    
-
-}
-
-static PyObject *
-CVesicleModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    CVesicleModel *self;
-    
-    self = (CVesicleModel *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-CVesicleModel_init(CVesicleModel *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new VesicleModel();
-        
-        // Initialize parameter dictionary
-        PyDict_SetItemString(self->params,"core_sld",Py_BuildValue("d",0.000006360000));
-        PyDict_SetItemString(self->params,"thickness",Py_BuildValue("d",30.000000000000));
-        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
-        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",100.000000000000));
-        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
-        PyDict_SetItemString(self->params,"shell_sld",Py_BuildValue("d",0.000000500000));
-        // Initialize dispersion / averaging parameter dict
-        DispersionVisitor* visitor = new DispersionVisitor();
-        PyObject * disp_dict;
-        disp_dict = PyDict_New();
-        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
-        disp_dict = PyDict_New();
-        self->model->thickness.dispersion->accept_as_source(visitor, self->model->thickness.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "thickness", disp_dict);
-
-
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        
-
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef CVesicleModel_members[] = {
-    {name_params, T_OBJECT, offsetof(CVesicleModel, params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof(CVesicleModel, dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof(CVesicleModel, log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double CVesicleModel_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim(VesicleModel* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( VesicleModel* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString(CVesicleModelError, 
-                   "CVesicleModel.evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution(CVesicleModel *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CVesicleModelError, 
-	    	"CVesicleModel.evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString(CVesicleModelError, 
-                   "CVesicleModel.evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString(CVesicleModelError, 
-	    		"CVesicleModel.evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString(CVesicleModelError, 
-                   "CVesicleModel.evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString(CVesicleModelError, 
-                   "CVesicleModel.evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run(CVesicleModel *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CVesicleModelError, 
-	    	"CVesicleModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CVesicleModelError, 
-	    		"CVesicleModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = CVesicleModel_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = CVesicleModel_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = CVesicleModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER(CVesicleModel *self) {
-
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY(CVesicleModel *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	    // Reader parameter dictionary
-    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
-    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
-    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
-    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
-    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
-    // Read in dispersion parameters
-    PyObject* disp_dict;
-    DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
-    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
-    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
-    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
-
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString(CVesicleModelError, 
-	    	"CVesicleModel.run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString(CVesicleModelError, 
-	    		"CVesicleModel.run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = CVesicleModel_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = CVesicleModel_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = CVesicleModel_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset(CVesicleModel *self, PyObject *args) {
-    
-
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion(CVesicleModel *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString(CVesicleModelError,
-	    	"CVesicleModel.set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	    // TODO: refactor this
-    if (!strcmp(par_name, "radius")) {
-        self->model->radius.dispersion = dispersion;
-    } else    if (!strcmp(par_name, "thickness")) {
-        self->model->thickness.dispersion = dispersion;
-    } else {
-	    PyErr_SetString(CVesicleModelError,
-	    	"CVesicleModel.set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef CVesicleModel_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject CVesicleModelType = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "CVesicleModel",             /*tp_name*/
-    sizeof(CVesicleModel),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)CVesicleModel_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "CVesicleModel objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    CVesicleModel_methods,             /* tp_methods */
-    CVesicleModel_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)CVesicleModel_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    CVesicleModel_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void addCVesicleModel(PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&CVesicleModelType) < 0)
-        return;
-
-    Py_INCREF(&CVesicleModelType);
-    PyModule_AddObject(module, "CVesicleModel", (PyObject *)&CVesicleModelType);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "CVesicleModel.error";
-    CVesicleModelError = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "CVesicleModelError", CVesicleModelError);
-}
-
Index: sansmodels/src/sans/models/c_models/DiamCyl.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/DiamCyl.cpp	(revision 2e2452bdc9bc0fb591e01a0c03d516a0730dcf96)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libStructureFactor.h"
-	#include "DiamCyl.h"
-}
-
-DiamCylFunc :: DiamCylFunc() {
-	radius      = Parameter(20.0, true);
-	radius.set_min(0.0);
-	length      = Parameter(400, true);
-	length.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double DiamCylFunc :: operator()(double q) {
-	double dp[2];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = radius();
-	dp[1] = length();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[0] = weights_rad[i].value;
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp[1] = weights_len[j].value;
-
-			sum += weights_rad[i].weight
-						* weights_len[j].weight *DiamCyl(dp[1], dp[0]);
-			norm += weights_rad[i].weight
-				* weights_len[j].weight;
-		}
-	}
-	return sum/norm ;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double DiamCylFunc :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double DiamCylFunc :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double DiamCylFunc :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
-// Testing code
-
-/**
-int main(void)
-{
-	DiamCylFunc c = DiamCylFunc();
-
-	printf("I(Qx=%g,Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	c.radius.dispersion = new GaussianDispersion();
-	c.radius.dispersion->npts = 100;
-	c.radius.dispersion->width = 20;
-
-	//c.length.dispersion = GaussianDispersion();
-	//c.length.dispersion.npts = 20;
-	//c.length.dispersion.width = 65;
-
-	//printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	//printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	//printf("I(Qx=%g, Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	//printf("I(Q=%g,  Phi=%g) = %g\n", 0.00447, .7854, c.evaluate_rphi(sqrt(0.00002), .7854));
-
-
-
-	double i_avg = c(0.01, 0.01);
-	double i_1d = c(sqrt(0.0002));
-
-	printf("\nI(Qx=%g, Qy=%g) = %g\n", 0.01, 0.01, i_avg);
-	printf("I(Q=%g)         = %g\n", sqrt(0.0002), i_1d);
-	printf("ratio %g %g\n", i_avg/i_1d, i_1d/i_avg);
-
-
-	return 0;
-}
- **/
Index: sansmodels/src/sans/models/c_models/DiamEllip.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/DiamEllip.cpp	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libStructureFactor.h"
-	#include "DiamEllip.h"
-}
-
-DiamEllipFunc :: DiamEllipFunc() {
-	radius_a      = Parameter(20.0, true);
-	radius_a.set_min(0.0);
-	radius_b      = Parameter(400, true);
-	radius_b.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double DiamEllipFunc :: operator()(double q) {
-	double dp[2];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = radius_a();
-	dp[1] = radius_b();
-
-	// Get the dispersion points for the radius a
-	vector<WeightPoint> weights_rad_a;
-	radius_a.get_weights(weights_rad_a);
-
-	// Get the dispersion points for the radius b
-	vector<WeightPoint> weights_rad_b;
-	radius_b.get_weights(weights_rad_b);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_a.size(); i++) {
-		dp[0] = weights_rad_a[i].value;
-		// Loop over length weight points
-		for(size_t j=0; j<weights_rad_b.size(); j++) {
-			dp[1] = weights_rad_b[j].value;
-
-			sum += weights_rad_a[i].weight*weights_rad_b[j].weight
-				* DiamEllip(dp[0], dp[1]);
-			norm += weights_rad_a[i].weight*weights_rad_b[j].weight;
-		}
-	}
-	return sum/norm ;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double DiamEllipFunc :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double DiamEllipFunc :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double DiamEllipFunc :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
-// Testing code
-/*
-int main(void)
-{
-	SquareWellModel c = SquareWellModel();
-
-	printf("I(Qx=%g,Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	c.radius.dispersion = new GaussianDispersion();
-	c.radius.dispersion->npts = 100;
-	c.radius.dispersion->width = 5;
-
-	//c.length.dispersion = GaussianDispersion();
-	//c.length.dispersion.npts = 20;
-	//c.length.dispersion.width = 65;
-
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	printf("I(Qx=%g, Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g,  Phi=%g) = %g\n", 0.00447, .7854, c.evaluate_rphi(sqrt(0.00002), .7854));
-
-
-
-	double i_avg = c(0.01, 0.01);
-	double i_1d = c(sqrt(0.0002));
-
-	printf("\nI(Qx=%g, Qy=%g) = %g\n", 0.01, 0.01, i_avg);
-	printf("I(Q=%g)         = %g\n", sqrt(0.0002), i_1d);
-	printf("ratio %g %g\n", i_avg/i_1d, i_1d/i_avg);
-
-
-	return 0;
-}
-*/
Index: sansmodels/src/sans/models/c_models/Hardsphere.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/Hardsphere.cpp	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libStructureFactor.h"
-	#include "Hardsphere.h"
-}
-
-HardsphereStructure :: HardsphereStructure() {
-	effect_radius      = Parameter(50.0, true);
-	effect_radius.set_min(0.0);
-	volfraction = Parameter(0.20, true);
-	volfraction.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double HardsphereStructure :: operator()(double q) {
-	double dp[2];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = effect_radius();
-	dp[1] = volfraction();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	effect_radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[0] = weights_rad[i].value;
-
-		sum += weights_rad[i].weight
-				* HardSphereStruct(dp, q);
-		norm += weights_rad[i].weight;
-	}
-	return sum/norm ;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double HardsphereStructure :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double HardsphereStructure :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double HardsphereStructure :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/HayterMSA.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/HayterMSA.cpp	(revision 8542bf3a1eaeddbf8816e33c28e3f870a9fd8141)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libStructureFactor.h"
-	#include "HayterMSA.h"
-}
-
-HayterMSAStructure :: HayterMSAStructure() {
-	effect_radius      = Parameter(20.75, true);
-	effect_radius.set_min(0.0);
-	charge      = Parameter(19.0, true);
-	volfraction = Parameter(0.0192, true);
-	volfraction.set_min(0.0);
-	temperature = Parameter(318.16, true);
-	temperature.set_min(0.0);
-	saltconc   = Parameter(0.0);
-	dielectconst  = Parameter(71.08);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double HayterMSAStructure :: operator()(double q) {
-	double dp[6];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = 2.0*effect_radius();
-	dp[1] = fabs(charge());
-	dp[2] = volfraction();
-	dp[3] = temperature();
-	dp[4] = saltconc();
-	dp[5] = dielectconst();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	effect_radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[0] = 2.0*weights_rad[i].value;
-
-		sum += weights_rad[i].weight
-				* HayterPenfoldMSA(dp, q);
-		norm += weights_rad[i].weight;
-	}
-	return sum/norm ;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double HayterMSAStructure :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double HayterMSAStructure :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double HayterMSAStructure :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
-
-// Testing code
-/*
-int main(void)
-{
-	SquareWellModel c = SquareWellModel();
-
-	printf("I(Qx=%g,Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	c.radius.dispersion = new GaussianDispersion();
-	c.radius.dispersion->npts = 100;
-	c.radius.dispersion->width = 5;
-
-	//c.length.dispersion = GaussianDispersion();
-	//c.length.dispersion.npts = 20;
-	//c.length.dispersion.width = 65;
-
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	printf("I(Qx=%g, Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g,  Phi=%g) = %g\n", 0.00447, .7854, c.evaluate_rphi(sqrt(0.00002), .7854));
-
-
-
-	double i_avg = c(0.01, 0.01);
-	double i_1d = c(sqrt(0.0002));
-
-	printf("\nI(Qx=%g, Qy=%g) = %g\n", 0.01, 0.01, i_avg);
-	printf("I(Q=%g)         = %g\n", sqrt(0.0002), i_1d);
-	printf("ratio %g %g\n", i_avg/i_1d, i_1d/i_avg);
-
-
-	return 0;
-}
-*/
Index: sansmodels/src/sans/models/c_models/README.txt
===================================================================
--- sansmodels/src/sans/models/c_models/README.txt	(revision 8809e4829d357a9366a256b3595b75252de8b2c2)
+++ 	(revision )
@@ -1,24 +1,0 @@
-NOTE ABOUT THE SANS MODELS REFACTOR [Oct 14, 2008]
-
-This is the new code to implement python extensions for our models.
-
-- The major change here was to create model classes. Parameters
-  are now class objects too, and polydispersity is now part of the
-  parameter definition to speed up computations. See parameters.hh
-  for more details, in particular the definitions of DispersionModel
-  and Parameter.
-
-- Some of the C code that was used to port the IGOR code is still used.
-  For instance, the functions defined in cylinder.c is used in c_models/cylinder.cpp.
-
-- The C++ class are intended to be easily compatible with McVine.
-  
-- The script c_models/WrapperGenerator.py is the script 
-  that was used to generate the python C++ extensions for our models.
-  For instance, CCylinderModel.cpp was created with WrapperGenerator.py run
-  on c_extensions/cylinder.h.
- 
-- See c_extensions/README.txt for more details about the old c_models.
-
- 
-  
Index: sansmodels/src/sans/models/c_models/SquareWell.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/SquareWell.cpp	(revision 74c9a3063aab59b8fd6dfdc3e053aa3db931b19c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libStructureFactor.h"
-	#include "SquareWell.h"
-}
-
-SquareWellStructure :: SquareWellStructure() {
-	effect_radius      = Parameter(50.0, true);
-	effect_radius.set_min(0.0);
-	volfraction = Parameter(0.04, true);
-	volfraction.set_min(0.0);
-	welldepth   = Parameter(1.50);
-	wellwidth  = Parameter(1.20);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double SquareWellStructure :: operator()(double q) {
-	double dp[4];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = effect_radius();
-	dp[1] = volfraction();
-	dp[2] = welldepth();
-	dp[3] = wellwidth();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	effect_radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[0] = weights_rad[i].value;
-
-		sum += weights_rad[i].weight
-				* SquareWellStruct(dp, q);
-		norm += weights_rad[i].weight;
-	}
-	return sum/norm ;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double SquareWellStructure :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SquareWellStructure :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SquareWellStructure :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
-// Testing code
-/*
-int main(void)
-{
-	SquareWellModel c = SquareWellModel();
-
-	printf("I(Qx=%g,Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	c.radius.dispersion = new GaussianDispersion();
-	c.radius.dispersion->npts = 100;
-	c.radius.dispersion->width = 5;
-
-	//c.length.dispersion = GaussianDispersion();
-	//c.length.dispersion.npts = 20;
-	//c.length.dispersion.width = 65;
-
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	printf("I(Qx=%g, Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g,  Phi=%g) = %g\n", 0.00447, .7854, c.evaluate_rphi(sqrt(0.00002), .7854));
-
-
-
-	double i_avg = c(0.01, 0.01);
-	double i_1d = c(sqrt(0.0002));
-
-	printf("\nI(Qx=%g, Qy=%g) = %g\n", 0.01, 0.01, i_avg);
-	printf("I(Q=%g)         = %g\n", sqrt(0.0002), i_1d);
-	printf("ratio %g %g\n", i_avg/i_1d, i_1d/i_avg);
-
-
-	return 0;
-}
-*/
Index: sansmodels/src/sans/models/c_models/StickyHS.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/StickyHS.cpp	(revision 74c9a3063aab59b8fd6dfdc3e053aa3db931b19c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libStructureFactor.h"
-	#include "StickyHS.h"
-}
-
-StickyHSStructure :: StickyHSStructure() {
-	effect_radius      = Parameter(50.0, true);
-	effect_radius.set_min(0.0);
-	volfraction = Parameter(0.10, true);
-	volfraction.set_min(0.0);
-	perturb = Parameter(0.05, true);
-	perturb.set_min(0.0);
-	stickiness = Parameter(0.20, true);;
-	stickiness.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double StickyHSStructure :: operator()(double q) {
-	double dp[4];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = effect_radius();
-	dp[1] = volfraction();
-	dp[2] = perturb();
-	dp[3] = stickiness();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	effect_radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[0] = weights_rad[i].value;
-
-		sum += weights_rad[i].weight
-				* StickyHS_Struct(dp, q);
-		norm += weights_rad[i].weight;
-	}
-	return sum/norm ;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double StickyHSStructure :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double StickyHSStructure :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double StickyHSStructure :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/WrapperGenerator.py
===================================================================
--- sansmodels/src/sans/models/c_models/WrapperGenerator.py	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ 	(revision )
@@ -1,476 +1,0 @@
-#!/usr/bin/env python
-""" WrapperGenerator class to generate model code automatically.
-"""
-
-import os, sys,re
-import lineparser
-
-class WrapperGenerator:
-    """ Python wrapper generator for C models
-    
-        The developer must provide a header file describing 
-        the new model.
-        
-        To provide the name of the Python class to be
-        generated, the .h file must contain the following 
-        string in the comments:
-        
-        // [PYTHONCLASS] = my_model
-        
-        where my_model must be replaced by the name of the
-        class that you want to import from sans.models.
-        (example: [PYTHONCLASS] = MyModel
-          will create a class MyModel in sans.models.MyModel.
-          It will also create a class CMyModel in 
-          sans_extension.c_models.)
-          
-        Also in comments, each parameter of the params 
-        dictionary must be declared with a default value
-        in the following way:
-        
-        // [DEFAULT]=param_name=default_value
-        
-        (example:
-            //  [DEFAULT]=radius=20.0
-        )
-          
-        See cylinder.h for an example.
-        
-        
-        A .c file corresponding to the .h file should also
-        be provided (example: my_model.h, my_model.c).
-    
-        The .h file should define two function definitions. For example,
-        cylinder.h defines the following:
-        
-            /// 1D scattering function
-            double cylinder_analytical_1D(CylinderParameters *pars, double q);
-            
-            /// 2D scattering function
-            double cylinder_analytical_2D(CylinderParameters *pars, double q, double phi);
-            
-        The .c file implements those functions.
-        
-        @author: Mathieu Doucet / UTK
-        @contact: mathieu.doucet@nist.gov
-    """
-    
-    def __init__(self, filename):
-        """ Initialization """
-        
-        ## Name of .h file to generate wrapper from
-        self.file = filename
-        
-        # Info read from file
-        
-        ## Name of python class to write
-        self.pythonClass = None
-        ## Parser in struct section
-        self.inStruct = False
-        ## Name of struct for the c object
-        self.structName = None
-        ## Dictionary of parameters
-        self.params = {}
-        ## ModelCalculation module flag
-        self.modelCalcFlag = False
-        ## List of default parameters (text)
-        self.default_list = ""
-        ## Dictionary of units
-        self.details = ""
-        ## List of dispersed parameters
-        self.disp_params = []
-        #model description
-        self.description=''
-        # paramaters for fittable
-        self.fixed= []
-        # paramaters for non-fittable
-        self.non_fittable= []
-        ## parameters with orientation
-        self.orientation_params =[]
-        
-        
-    def __repr__(self):
-        """ Simple output for printing """
-        
-        rep  = "\n Python class: %s\n\n" % self.pythonClass
-        rep += "  struc name: %s\n\n" % self.structName
-        rep += "  params:     %s\n\n" % self.params
-        rep += "  description:    %s\n\n" % self.description
-        rep += "  Fittable parameters:     %s\n\n"% self.fixed
-        rep += "  Non-Fittable parameters:     %s\n\n"% self.non_fittable
-        rep += "  Orientation parameters:  %s\n\n"% self.orientation_params
-        return rep
-        
-    def read(self):
-        """ Reads in the .h file to catch parameters of the wrapper """
-        
-        # Check if the file is there
-        if not os.path.isfile(self.file):
-            raise ValueError, "File %s is not a regular file" % self.file
-        
-        # Read file
-        f = open(self.file,'r')
-        buf = f.read()
-        
-        self.default_list = "List of default parameters:\n"
-        #lines = string.split(buf,'\n')
-        lines = buf.split('\n')
-        self.details  = "## Parameter details [units, min, max]\n"
-        self.details += "        self.details = {}\n"
-        
-        #open item in this case Fixed
-        text='text'
-        key2="<%s>"%text.lower()
-        # close an item in this case fixed
-        text='TexT'
-        key3="</%s>"%text.lower()
-        
-        ## Catch fixed parameters
-        key = "[FIXED]"
-        try:
-            self.fixed= lineparser.readhelper(lines,key, key2,key3, file= self.file)
-        except:
-           raise   
-        ## Catch non-fittable parameters parameters
-        key = "[NON_FITTABLE_PARAMS]"
-        try:
-            self.non_fittable= lineparser.readhelper(lines,key, key2,key3, file= self.file)
-        except:
-           raise   
-
-        ## Catch parameters with orientation
-        key = "[ORIENTATION_PARAMS]"    
-        try:
-            self.orientation_params = lineparser.readhelper( lines,key, 
-                                                    key2,key3, file= self.file)
-        except:
-           raise 
-        ## Catch Description
-        key = "[DESCRIPTION]"
-        
-        find_description = False
-        temp=""
-        for line in lines:
-            if line.count(key)>0 :
-                
-                try:
-                    find_description= True
-                    index = line.index(key)
-                    toks = line[index:].split("=",1 )
-                    temp=toks[1].lstrip().rstrip()
-                    text='text'
-                    key2="<%s>"%text.lower()
-                    if re.match(key2,temp)!=None:
-    
-                        toks2=temp.split(key2,1)
-                        self.description=toks2[1]
-                        text='text'
-                        key2="</%s>"%text.lower()
-                        if re.search(key2,toks2[1])!=None:
-                            temp=toks2[1].split(key2,1)
-                            self.description=temp[0]
-                            break
-                      
-                    else:
-                        self.description=temp
-                        break
-                except:
-                     raise ValueError, "Could not parse file %s" % self.file
-            elif find_description:
-                text='text'
-                key2="</%s>"%text.lower()
-                if re.search(key2,line)!=None:
-                    tok=line.split(key2,1)
-                    temp=tok[0].split("//",1)
-                    self.description+=tok[1].lstrip().rstrip()
-                    break
-                else:
-                    if re.search("//",line)!=None:
-                        temp=line.split("//",1)
-                        self.description+='\n\t\t'+temp[1].lstrip().rstrip()
-                        
-                    else:
-                        self.description+='\n\t\t'+line.lstrip().rstrip()
-                    
-                
-                
-        for line in lines:
-            
-            # Catch class name
-            key = "[PYTHONCLASS]"
-            if line.count(key)>0:
-                try:
-                    index = line.index(key)
-                    #toks = string.split( line[index:], "=" )
-                    toks = line[index:].split("=" )
-                    self.pythonClass = toks[1].lstrip().rstrip()
-                except:
-                    raise ValueError, "Could not parse file %s" % self.file
-                
-            # Catch struct name
-            if line.count("typedef struct")>0:
-                # We are entering a struct block
-                self.inStruct = True
-            
-            if self.inStruct and line.count("}")>0:
-                # We are exiting a struct block
-                self.inStruct = False
-    
-                # Catch the name of the struct
-                index = line.index("}")
-                #toks = string.split(line[index+1:],";")
-                toks = line[index+1:].split(";")
-                # Catch pointer definition
-                #toks2 = string.split(toks[0],',')
-                toks2 = toks[0].split(',')
-                self.structName = toks2[0].lstrip().rstrip()
-           
-                
-           
-            # Catch struct content
-            key = "[DEFAULT]"
-            if self.inStruct and line.count(key)>0:
-                # Found a new parameter
-                try:
-                    index = line.index(key)
-                    toks = line[index:].split("=")
-                    toks2 = toks[2].split()
-                    val = float(toks2[0])
-                    self.params[toks[1]] = val
-                    #self.pythonClass = toks[1].lstrip().rstrip()
-                    units = ""
-                    if len(toks2) >= 2:
-                        units = toks2[1]
-                    self.default_list += "         %-15s = %s %s\n" % \
-                        (toks[1], val, units)
-                    
-                    # Check for min and max
-                    min = "None"
-                    max = "None"
-                    if len(toks2) == 4:
-                        min = toks2[2]
-                        max = toks2[3]
-                    
-                    self.details += "        self.details['%s'] = ['%s', %s, %s]\n" % \
-                        (toks[1].lstrip().rstrip(), units.lstrip().rstrip(), min, max)
-                except:
-                    raise ValueError, "Could not parse input file %s \n  %s" % \
-                        (self.file, sys.exc_value)
-                
-                
-            # Catch need for numerical calculations
-            key = "CalcParameters calcPars"
-            if line.count(key)>0:
-                self.modelCalcFlag = True
-                
-            # Catch list of dispersed parameters 
-            key = "[DISP_PARAMS]"
-            if line.count(key)>0:
-                try:
-                    index = line.index(key)
-                    toks = line[index:].split("=")
-                    list_str = toks[1].lstrip().rstrip()
-                    self.disp_params = list_str.split(',')
-                except:
-                    raise ValueError, "Could not parse file %s" % self.file
-               
-        
-                
-    def write_c_wrapper(self):
-        """ Writes the C file to create the python extension class 
-            The file is written in C[PYTHONCLASS].c
-        """
-        
-        file = open("C"+self.pythonClass+'.cpp', 'w')
-        template = open("classTemplate.txt", 'r')
-        
-        tmp_buf = template.read()
-        #tmp_lines = string.split(tmp_buf,'\n')
-        tmp_lines = tmp_buf.split('\n')
-        
-        for tmp_line in tmp_lines:
-            
-            # Catch class name
-            newline = self.replaceToken(tmp_line, 
-                                        "[PYTHONCLASS]", 'C'+self.pythonClass)
-            #Catch model description
-            #newline = self.replaceToken(tmp_line, 
-            #                            "[DESCRIPTION]", self.description)
-            # Catch C model name
-            newline = self.replaceToken(newline, 
-                                        "[CMODEL]", self.pythonClass)
-            
-            # Catch class name
-            newline = self.replaceToken(newline, 
-                                        "[MODELSTRUCT]", self.structName)
-            
-            # Dictionary initialization
-            param_str = "// Initialize parameter dictionary\n"            
-            for par in self.params:
-                param_str += "        PyDict_SetItemString(self->params,\"%s\",Py_BuildValue(\"d\",%10.12f));\n" % \
-                    (par, self.params[par])
-
-            param_str += "        // Initialize dispersion / averaging parameter dict\n"
-            param_str += "        DispersionVisitor* visitor = new DispersionVisitor();\n"
-            param_str += "        PyObject * disp_dict;\n"
-            for par in self.disp_params:
-                par = par.strip()
-                param_str += "        disp_dict = PyDict_New();\n"
-                param_str += "        self->model->%s.dispersion->accept_as_source(visitor, self->model->%s.dispersion, disp_dict);\n" % (par, par)
-                param_str += "        PyDict_SetItemString(self->dispersion, \"%s\", disp_dict);\n" % par
-                
-            # Initialize dispersion object dictionnary
-            param_str += "\n"
-            
-                
-            newline = self.replaceToken(newline,
-                                        "[INITDICTIONARY]", param_str)
-            
-            # Read dictionary
-            param_str = "    // Reader parameter dictionary\n"
-            for par in self.params:
-                param_str += "    self->model->%s = PyFloat_AsDouble( PyDict_GetItemString(self->params, \"%s\") );\n" % \
-                    (par, par)
-                    
-            param_str += "    // Read in dispersion parameters\n"
-            param_str += "    PyObject* disp_dict;\n"
-            param_str += "    DispersionVisitor* visitor = new DispersionVisitor();\n"
-            for par in self.disp_params:
-                par = par.strip()
-                param_str += "    disp_dict = PyDict_GetItemString(self->dispersion, \"%s\");\n" % par
-                param_str += "    self->model->%s.dispersion->accept_as_destination(visitor, self->model->%s.dispersion, disp_dict);\n" % (par, par)
-                
-            newline = self.replaceToken(newline, "[READDICTIONARY]", param_str)
-                
-            # Name of .c file
-            #toks = string.split(self.file,'.')
-            basename = os.path.basename(self.file)
-            toks = basename.split('.')
-            newline = self.replaceToken(newline, "[C_FILENAME]", toks[0])
-            
-            # Include file
-            basename = os.path.basename(self.file)
-            newline = self.replaceToken(newline, 
-                                        "[INCLUDE_FILE]", basename)           
-                
-            # Numerical calcs dealloc
-            dealloc_str = "\n"
-            if self.modelCalcFlag:
-                dealloc_str = "    modelcalculations_dealloc(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline, 
-                                        "[NUMERICAL_DEALLOC]", dealloc_str)     
-                
-            # Numerical calcs init
-            init_str = "\n"
-            if self.modelCalcFlag:
-                init_str = "        modelcalculations_init(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline, 
-                                        "[NUMERICAL_INIT]", init_str)     
-                
-            # Numerical calcs reset
-            reset_str = "\n"
-            if self.modelCalcFlag:
-                reset_str = "modelcalculations_reset(&(self->model_pars.calcPars));\n"
-            newline = self.replaceToken(newline, 
-                                        "[NUMERICAL_RESET]", reset_str)     
-                
-            # Setting dispsertion weights
-            set_weights = "    // Ugliness necessary to go from python to C\n"
-            set_weights = "    // TODO: refactor this\n"
-            for par in self.disp_params:
-                par = par.strip()
-                set_weights += "    if (!strcmp(par_name, \"%s\")) {\n" % par
-                set_weights += "        self->model->%s.dispersion = dispersion;\n" % par
-                set_weights += "    } else"
-            newline = self.replaceToken(newline, 
-                                        "[SET_DISPERSION]", set_weights)     
-            
-            # Write new line to the wrapper .c file
-            file.write(newline+'\n')
-            
-            
-        file.close()
-        
-    def write_python_wrapper(self):
-        """ Writes the python file to create the python extension class 
-            The file is written in ../[PYTHONCLASS].py
-        """
-        
-        file = open("../"+self.pythonClass+'.py', 'w')
-        template = open("modelTemplate.txt", 'r')
-        
-        tmp_buf = template.read()
-        tmp_lines = tmp_buf.split('\n')
-        
-        for tmp_line in tmp_lines:
-            
-            # Catch class name
-            newline = self.replaceToken(tmp_line, 
-                                        "[CPYTHONCLASS]", 'C'+self.pythonClass)
-            
-            # Catch class name
-            newline = self.replaceToken(newline, 
-                                        "[PYTHONCLASS]", self.pythonClass)
-            
-            # Include file
-            newline = self.replaceToken(newline, 
-                                        "[INCLUDE_FILE]", self.file)    
-                   
-            # Include file
-            newline = self.replaceToken(newline, 
-                                        "[DEFAULT_LIST]", self.default_list)
-            # model description
-            newline = self.replaceToken(newline, 
-                                        "[DESCRIPTION]", self.description)
-            # Parameter details
-            newline = self.replaceToken(newline, 
-                                        "[PAR_DETAILS]", self.details)
-           
-            # fixed list  details
-            newline = self.replaceToken(newline, 
-                                        "[FIXED]",str(self.fixed))
-            # non-fittable list  details
-            newline = self.replaceToken(newline, 
-                                        "[NON_FITTABLE_PARAMS]",str(self.non_fittable))
-            ## parameters with orientation
-       
-            newline = self.replaceToken(newline, 
-                               "[ORIENTATION_PARAMS]",str(self.orientation_params))
-           
-            # Write new line to the wrapper .c file
-            file.write(newline+'\n')
-               
-        file.close()
-        
-        
-    def replaceToken(self, line, key, value): #pylint: disable-msg=R0201
-        """ Replace a token in the template file 
-            @param line: line of text to inspect
-            @param key: token to look for
-            @param value: string value to replace the token with
-            @return: new string value
-        """
-        lenkey = len(key)
-        newline = line
-       
-        while newline.count(key)>0:
-            index = newline.index(key)
-            newline = newline[:index]+value+newline[index+lenkey:]
-        
-        return newline
-        
-        
-# main
-if __name__ == '__main__':
-    if len(sys.argv)>1:
-        print "Will look for file %s" % sys.argv[1]
-    #app = WrapperGenerator('../c_extensions/elliptical_cylinder.h')
-        app = WrapperGenerator(sys.argv[1])
-    else:
-        app = WrapperGenerator("test.h")
-    app.read()
-    app.write_c_wrapper()
-    app.write_python_wrapper()
-    print app
-   
-# End of file        
Index: sansmodels/src/sans/models/c_models/barbell.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/barbell.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,253 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "barbell.h"
-}
-
-BarBellModel :: BarBellModel() {
-	scale      = Parameter(1.0);
-	rad_bar		= Parameter(20.0);
-	rad_bar.set_min(0.0);
-	len_bar     = Parameter(400.0, true);
-	len_bar.set_min(0.0);
-	rad_bell = Parameter(40.0);
-	rad_bell.set_min(0.0);
-	sld_barbell   = Parameter(1.0e-6);
-	sld_solv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	theta  = Parameter(0.0, true);
-	phi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double BarBellModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = rad_bar();
-	dp[2] = len_bar();
-	dp[3] = rad_bell();
-	dp[4] = sld_barbell();
-	dp[5] = sld_solv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the rad_bar
-	vector<WeightPoint> weights_rad_bar;
-	rad_bar.get_weights(weights_rad_bar);
-	// Get the dispersion points for the len_bar
-	vector<WeightPoint> weights_len_bar;
-	len_bar.get_weights(weights_len_bar);
-	// Get the dispersion points for the rad_bell
-	vector<WeightPoint> weights_rad_bell;
-	rad_bell.get_weights(weights_rad_bell);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double pi,hDist,result;
-	double vol_i = 0.0;
-	pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_bar.size(); i++) {
-		dp[1] = weights_rad_bar[i].value;
-		for(size_t j=0; j<weights_len_bar.size(); j++) {
-			dp[2] = weights_len_bar[j].value;
-			for(size_t k=0; k<weights_rad_bell.size(); k++) {
-				dp[3] = weights_rad_bell[k].value;
-
-				//Un-normalize SphereForm by volume
-				hDist = sqrt(fabs(dp[3]*dp[3]-dp[1]*dp[1]));
-				vol_i = pi*dp[1]*dp[1]*dp[2]+2.0*pi*(2.0*dp[3]*dp[3]*dp[3]/3.0
-								+dp[3]*dp[3]*hDist-hDist*hDist*hDist/3.0);
-				result =  Barbell(dp, q) * vol_i;
-				// This FIXES a singualrity the kernel in libigor.
-				if ( result == INFINITY || result == NAN){
-					result = 0.0;
-				}
-				sum += weights_rad_bar[i].weight*weights_len_bar[j].weight*weights_rad_bell[k].weight
-					* result;
-				//Find average volume
-				vol += weights_rad_bar[i].weight*weights_len_bar[j].weight*weights_rad_bell[k].weight
-					* vol_i;
-
-				norm += weights_rad_bar[i].weight*weights_len_bar[j].weight*weights_rad_bell[k].weight;
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double BarBellModel :: operator()(double qx, double qy) {
-	BarBellParameters dp;
-
-	dp.scale = scale();
-	dp.rad_bar = rad_bar();
-	dp.len_bar = len_bar();
-	dp.rad_bell = rad_bell();
-	dp.sld_barbell = sld_barbell();
-	dp.sld_solv = sld_solv();
-	dp.background = 0.0;
-	dp.theta  = theta();
-	dp.phi    = phi();
-
-
-	// Get the dispersion points for the rad_bar
-	vector<WeightPoint> weights_rad_bar;
-	rad_bar.get_weights(weights_rad_bar);
-
-	// Get the dispersion points for the len_bar
-	vector<WeightPoint> weights_len_bar;
-	len_bar.get_weights(weights_len_bar);
-
-	// Get the dispersion points for the rad_bell
-	vector<WeightPoint> weights_rad_bell;
-	rad_bell.get_weights(weights_rad_bell);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	phi.get_weights(weights_phi);
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi,hDist;
-	double vol_i = 0.0;
-	pi = 4.0*atan(1.0);
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_bar.size(); i++) {
-		dp.rad_bar = weights_rad_bar[i].value;
-		for(size_t j=0; j<weights_len_bar.size(); j++) {
-			dp.len_bar = weights_len_bar[j].value;
-			for(size_t k=0; k<weights_rad_bell.size(); k++) {
-				dp.rad_bell = weights_rad_bell[k].value;
-				// Average over theta distribution
-				for(size_t l=0; l< weights_theta.size(); l++) {
-					dp.theta = weights_theta[l].value;
-					// Average over phi distribution
-					for(size_t m=0; m< weights_phi.size(); m++) {
-						dp.phi = weights_phi[m].value;
-						//Un-normalize Form by volume
-						hDist = sqrt(fabs(dp.rad_bell*dp.rad_bell-dp.rad_bar*dp.rad_bar));
-						vol_i = pi*dp.rad_bar*dp.rad_bar*dp.len_bar+2.0*pi*(2.0*dp.rad_bell*dp.rad_bell*dp.rad_bell/3.0
-										+dp.rad_bell*dp.rad_bell*hDist-hDist*hDist*hDist/3.0);
-
-						double _ptvalue = weights_rad_bar[i].weight
-											* weights_len_bar[j].weight
-											* weights_rad_bell[k].weight
-											* weights_theta[l].weight
-											* weights_phi[m].weight
-											* vol_i
-											* barbell_analytical_2DXY(&dp, qx, qy);
-											//* pow(weights_rad[i].value,3.0);
-						// Consider when there is infinte or nan.
-						if ( _ptvalue == INFINITY || _ptvalue == NAN){
-							_ptvalue = 0.0;
-						}
-						if (weights_theta.size()>1) {
-							_ptvalue *= fabs(sin(weights_theta[l].value*pi/180.0));
-						}
-						sum += _ptvalue;
-						// This model dose not need the volume of spheres correction!!!
-						//Find average volume
-						vol += weights_rad_bar[i].weight
-								* weights_len_bar[j].weight
-								* weights_rad_bell[k].weight
-								* vol_i;
-						//Find norm for volume
-						norm_vol += weights_rad_bar[i].weight
-								* weights_len_bar[j].weight
-								* weights_rad_bell[k].weight;
-
-						norm += weights_rad_bar[i].weight
-								* weights_len_bar[j].weight
-								* weights_rad_bell[k].weight
-								* weights_theta[l].weight
-								* weights_phi[m].weight;
-					}
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double BarBellModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double BarBellModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/bcc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/bcc.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,209 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "bcc.h"
-}
-
-BCCrystalModel :: BCCrystalModel() {
-	scale      = Parameter(1.0);
-	dnn		= Parameter(220.0);
-	d_factor = Parameter(0.06);
-	radius     = Parameter(40.0, true);
-	radius.set_min(0.0);
-	sldSph   = Parameter(3.0e-6);
-	sldSolv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	theta  = Parameter(0.0, true);
-	phi    = Parameter(0.0, true);
-	psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double BCCrystalModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = dnn();
-	dp[2] = d_factor();
-	dp[3] = radius();
-	dp[4] = sldSph();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double result;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[3] = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		result = BCC_ParaCrystal(dp, q) * pow(weights_rad[i].value,3);
-		// This FIXES a singualrity in the kernel in libigor.
-		if ( result == INFINITY || result == NAN){
-			result = 0.0;
-		}
-		sum += weights_rad[i].weight
-			* result;
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double BCCrystalModel :: operator()(double qx, double qy) {
-	BCParameters dp;
-	dp.scale      = scale();
-	dp.dnn   = dnn();
-	dp.d_factor   = d_factor();
-	dp.radius  = radius();
-	dp.sldSph   = sldSph();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.theta  = theta();
-	dp.phi    = phi();
-	dp.psi    = psi();
-	double pi = 4.0*atan(1.0);
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	phi.get_weights(weights_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_psi;
-	psi.get_weights(weights_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.radius = weights_rad[i].value;
-		// Average over theta distribution
-		for(size_t j=0; j< weights_theta.size(); j++) {
-			dp.theta = weights_theta[j].value;
-			// Average over phi distribution
-			for(size_t k=0; k< weights_phi.size(); k++) {
-				dp.phi = weights_phi[k].value;
-				// Average over phi distribution
-				for(size_t l=0; l< weights_psi.size(); l++) {
-					dp.psi = weights_psi[l].value;
-					//Un-normalize SphereForm by volume
-					double _ptvalue = weights_rad[i].weight
-										* weights_theta[j].weight
-										* weights_phi[k].weight
-										* weights_psi[l].weight
-										* bc_analytical_2DXY(&dp, qx, qy);
-										//* pow(weights_rad[i].value,3.0);
-					// Consider when there is infinity or nan.
-					// Actual value for this singular point are typically zero.
-					if ( _ptvalue == INFINITY || _ptvalue == NAN){
-						_ptvalue = 0.0;
-					}
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(sin(weights_theta[j].value*pi/180.0));
-					}
-					sum += _ptvalue;
-					// This model dose not need the volume of spheres correction!!!
-					norm += weights_rad[i].weight
-							* weights_theta[j].weight
-							* weights_phi[k].weight
-							* weights_psi[l].weight;
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BCCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double BCCrystalModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double BCCrystalModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/binaryHS.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/binaryHS.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "binaryHS.h"
-}
-
-BinaryHSModel :: BinaryHSModel() {
-
-	l_radius     = Parameter(160.0, true);
-	l_radius.set_min(0.0);
-	s_radius    = Parameter(25.0, true);
-	s_radius.set_min(0.0);
-	vol_frac_ls  = Parameter(0.2);
-	vol_frac_ss  = Parameter(0.1);
-	ls_sld      = Parameter(3.5e-6);
-	ss_sld     = Parameter(5e-7);
-	solvent_sld   = Parameter(6.36e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double BinaryHSModel :: operator()(double q) {
-	double dp[8];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = l_radius();
-	dp[1] = s_radius();
-	dp[2] = vol_frac_ls();
-	dp[3] = vol_frac_ss();
-	dp[4] = ls_sld();
-	dp[5] = ss_sld();
-	dp[6] = solvent_sld();
-	dp[7] = 0.0;
-
-
-	// Get the dispersion points for the large radius
-	vector<WeightPoint> weights_l_radius;
-	l_radius.get_weights(weights_l_radius);
-
-	// Get the dispersion points for the small radius
-	vector<WeightPoint> weights_s_radius;
-	s_radius.get_weights(weights_s_radius);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over larger radius weight points
-	for(int i=0; i< (int)weights_l_radius.size(); i++) {
-		dp[0] = weights_l_radius[i].value;
-
-		// Loop over small radius weight points
-		for(int j=0; j< (int)weights_s_radius.size(); j++) {
-			dp[1] = weights_s_radius[j].value;
-
-
-			sum += weights_l_radius[i].weight *weights_s_radius[j].weight * BinaryHS(dp, q);
-			norm += weights_l_radius[i].weight *weights_s_radius[j].weight;
-		}
-	}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double BinaryHSModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the vesicle
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double BinaryHSModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double BinaryHSModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
-
Index: sansmodels/src/sans/models/c_models/binaryHS_PSF11.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/binaryHS_PSF11.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-}
-
-BinaryHSPSF11Model :: BinaryHSPSF11Model() {
-
-	l_radius     = Parameter(160.0, true);
-	l_radius.set_min(0.0);
-	s_radius    = Parameter(25.0, true);
-	s_radius.set_min(0.0);
-	vol_frac_ls  = Parameter(0.2);
-	vol_frac_ss  = Parameter(0.1);
-	ls_sld      = Parameter(3.5e-6);
-	ss_sld     = Parameter(5e-7);
-	solvent_sld   = Parameter(6.36e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double BinaryHSPSF11Model :: operator()(double q) {
-	double dp[8];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = l_radius();
-	dp[1] = s_radius();
-	dp[2] = vol_frac_ls();
-	dp[3] = vol_frac_ss();
-	dp[4] = ls_sld();
-	dp[5] = ss_sld();
-	dp[6] = solvent_sld();
-	dp[7] = 0.0;
-
-
-	// Get the dispersion points for the large radius
-	vector<WeightPoint> weights_l_radius;
-	l_radius.get_weights(weights_l_radius);
-
-	// Get the dispersion points for the small radius
-	vector<WeightPoint> weights_s_radius;
-	s_radius.get_weights(weights_s_radius);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over larger radius weight points
-	for(int i=0; i< (int)weights_l_radius.size(); i++) {
-		dp[0] = weights_l_radius[i].value;
-
-		// Loop over small radius weight points
-		for(int j=0; j< (int)weights_s_radius.size(); j++) {
-			dp[1] = weights_s_radius[j].value;
-
-
-			sum += weights_l_radius[i].weight *weights_s_radius[j].weight * BinaryHS_PSF11(dp, q);
-			norm += weights_l_radius[i].weight *weights_s_radius[j].weight;
-		}
-	}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double BinaryHSPSF11Model :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the vesicle
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double BinaryHSPSF11Model :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double BinaryHSPSF11Model :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/c_models.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/c_models.cpp	(revision 8c8cb057f0c1e50cdc80f9ebce08f129f6f1ed26)
+++ 	(revision )
@@ -1,300 +1,0 @@
-/** c_models
- *
- * Module containing all SANS model extensions
- *
- * @author   M.Doucet / UTK
- */
-#include <Python.h>
-#include <parameters.hh>
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
-#include "arrayobject.h"
-
-
-void addCCylinderModel(PyObject *module);
-void addCBarBellModel(PyObject *module);
-void addCCappedCylinderModel(PyObject *module);
-void addCTriaxialEllipsoidModel(PyObject *module);
-void addCParallelepipedModel(PyObject *module);
-void addCCSParallelepipedModel(PyObject *module);
-void addCSphereModel(PyObject *module);
-void addCSphereSLDModel(PyObject *module);
-void addCOnionModel(PyObject *module);
-void addCPearlNecklaceModel(PyObject *module);
-void addCReflModel(PyObject *module);
-void addCReflAdvModel(PyObject *module);
-void addCFuzzySphereModel(PyObject *module);
-void addCHardsphereStructure(PyObject *module);
-void addCStickyHSStructure(PyObject *module);
-void addCSCCrystalModel(PyObject *module);
-void addCFCCrystalModel(PyObject *module);
-void addCBCCrystalModel(PyObject *module);
-void addCSquareWellStructure(PyObject *module);
-void addCHayterMSAStructure(PyObject *module);
-void addCCoreShellModel(PyObject *module);
-void addCCoreFourShellModel(PyObject *module);
-void addCCoreShellCylinderModel(PyObject *module);
-void addCEllipsoidModel(PyObject *module);
-void addCEllipticalCylinderModel(PyObject *module);
-void addCTriaxialEllipsoidModel(PyObject *module);
-void addCFlexibleCylinderModel(PyObject *module);
-void addCFlexCylEllipXModel(PyObject *module);
-void addCStackedDisksModel(PyObject *module);
-void addCLamellarPSModel(PyObject *module);
-void addCLamellarPSHGModel(PyObject *module);
-void addCLamellarPCrystalModel(PyObject *module);
-void addCCoreShellEllipsoidModel(PyObject *module);
-void addCDiamEllipFunc(PyObject *module);
-void addCDiamCylFunc(PyObject *module);
-void addCSLDCalFunc(PyObject *module);
-
-//void addCOblateModel(PyObject *module);
-//void addCProlateModel(PyObject *module);
-void addCLamellarModel(PyObject *module);
-void addCLamellarFFHGModel(PyObject *module);
-void addCHollowCylinderModel(PyObject *module);
-void addCMultiShellModel(PyObject *module);
-void addCVesicleModel(PyObject *module);
-void addCBinaryHSModel(PyObject *module);
-void addCRPAModel(PyObject *module);
-void addCFractalModel(PyObject *module);
-void addCPoly_GaussCoil(PyObject *module);
-
-
-extern "C" {
-	//void addCCoreShellCylinderModel(PyObject *module);
-	//void addCCoreShellModel(PyObject *module);
-	//void addCEllipsoidModel(PyObject *module);
-	//void addCEllipticalCylinderModel(PyObject *module);
-	void addDisperser(PyObject *module);
-	void addCGaussian(PyObject *module);
-	void addCLorentzian(PyObject *module);
-	void addCLogNormal(PyObject *module);
-	void addCSchulz(PyObject *module);
-}
-
-/**
- * Delete a dispersion model object
- */
-void del_dispersion_model(void *ptr){
-	DispersionModel * disp = static_cast<DispersionModel *>(ptr);
-	delete disp;
-	return;
-}
-
-/**
- * Create a dispersion model as a python object
- */
-PyObject * new_dispersion_model(PyObject *, PyObject *args) {
-	DispersionModel *disp = new DispersionModel();
-	return PyCObject_FromVoidPtr(disp, del_dispersion_model);
-}
-
-
-/**
- * Delete a lognormal dispersion model object
- */
-void del_lognormal_dispersion(void *ptr){
-	LogNormalDispersion * disp = static_cast<LogNormalDispersion *>(ptr);
-	delete disp;
-	return;
-}
-
-/**
- * Create a lognormal dispersion model as a python object
- */
-PyObject * new_lognormal_dispersion(PyObject *, PyObject *args) {
-	LogNormalDispersion *disp = new LogNormalDispersion();
-	return PyCObject_FromVoidPtr(disp, del_lognormal_dispersion);
-}
-
-/**
- * Delete a gaussian dispersion model object
- */
-void del_gaussian_dispersion(void *ptr){
-	GaussianDispersion * disp = static_cast<GaussianDispersion *>(ptr);
-	delete disp;
-	return;
-}
-
-/**
- * Create a gaussian dispersion model as a python object
- */
-PyObject * new_gaussian_dispersion(PyObject *, PyObject *args) {
-	GaussianDispersion *disp = new GaussianDispersion();
-	return PyCObject_FromVoidPtr(disp, del_gaussian_dispersion);
-}
-
-
-/**
- * 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
- */
-void del_schulz_dispersion(void *ptr){
-	SchulzDispersion * disp = static_cast<SchulzDispersion *>(ptr);
-	delete disp;
-	return;
-}
-/**
- * Create a schulz dispersion model as a python object
- */
-PyObject * new_schulz_dispersion(PyObject *, PyObject *args) {
-	SchulzDispersion *disp = new SchulzDispersion();
-	return PyCObject_FromVoidPtr(disp, del_schulz_dispersion);
-}
-
-
-/**
- * Delete an array dispersion model object
- */
-void del_array_dispersion(void *ptr){
-	ArrayDispersion * disp = static_cast<ArrayDispersion *>(ptr);
-	delete disp;
-	return;
-}
-
-/**
- * Create an array dispersion model as a python object
- */
-PyObject * new_array_dispersion(PyObject *, PyObject *args) {
-	ArrayDispersion *disp = new ArrayDispersion();
-	return PyCObject_FromVoidPtr(disp, del_array_dispersion);
-}
-
-#define INVECTOR(obj,buf,len)										\
-    do { \
-        int err = PyObject_AsReadBuffer(obj, (const void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-/**
- * Sets weights from a numpy array
- */
-PyObject * set_weights(PyObject *, PyObject *args) {
-	PyObject *val_obj;
-	PyObject *wei_obj;
-	PyObject *disp;
-	Py_ssize_t nval;
-	Py_ssize_t nwei;
-	double *values;
-	double *weights;
-    //int i;
-
-	if (!PyArg_ParseTuple(args, "OOO", &disp, &val_obj, &wei_obj)) return NULL;
-	INVECTOR(val_obj, values, nval);
-	INVECTOR(wei_obj, weights, nwei);
-
-	// Sanity check
-	if(nval!=nwei) return NULL;
-
-	// Set the array pointers
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-	dispersion->set_weights(nval, values, weights);
-
-	return Py_BuildValue("i",1);
-}
-
-
-
-/**
- * Define empty module
- */
-static PyMethodDef module_methods[] = {
-	{"new_dispersion_model", (PyCFunction)new_dispersion_model     , METH_VARARGS,
-		  "Create a new DispersionModel object"},
-	{"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"},
-    {"new_schulz_model",   (PyCFunction)new_schulz_dispersion, METH_VARARGS,
-		  "Create a new SchulzDispersion object"},
-	{"new_array_model",      (PyCFunction)new_array_dispersion  , METH_VARARGS,
-		  "Create a new ArrayDispersion object"},
-	{"set_dispersion_weights",(PyCFunction)set_weights  , METH_VARARGS,
-			"Create the dispersion weight arrays for an Array Dispersion object"},
-    {NULL}
-};
-
-
-#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
-PyMODINIT_FUNC
-initc_models(void)
-{
-    PyObject* m;
-
-    m = Py_InitModule3("c_models", module_methods,
-                       "C extension module for SANS scattering models.");
-	import_array();
-
-	addCCylinderModel(m);
-	addCBarBellModel(m);
-	addCCappedCylinderModel(m);
-	addCParallelepipedModel(m);
-	addCCSParallelepipedModel(m);
-	addCCoreShellCylinderModel(m);
-	addCCoreShellModel(m);
-	addCCoreFourShellModel(m);
-	addCEllipsoidModel(m);
-	addCSphereModel(m);
-	addCSphereSLDModel(m);
-	addCOnionModel(m);
-	addCReflModel(m);
-	addCReflAdvModel(m);
-	addCFuzzySphereModel(m);
-	addCHardsphereStructure(m);
-	addCStickyHSStructure(m);
-	addCSCCrystalModel(m);
-	addCFCCrystalModel(m);
-	addCBCCrystalModel(m);
-	addCSquareWellStructure(m);
-	addCHayterMSAStructure(m);
-	addCEllipticalCylinderModel(m);
-	addCTriaxialEllipsoidModel(m);
-	addCFlexibleCylinderModel(m);
-	addCFlexCylEllipXModel(m);
-	addCStackedDisksModel(m);
-	addCLamellarPSModel(m);
-	addCLamellarPSHGModel(m);
-	addCLamellarPCrystalModel(m);
-	addCCoreShellEllipsoidModel(m);
-	addCDiamEllipFunc(m);
-	addCDiamCylFunc(m);
-	addCSLDCalFunc(m);
-	addCPearlNecklaceModel(m);
-	addCLamellarModel(m);
-	addCLamellarFFHGModel(m);
-	addCHollowCylinderModel(m);
-	addCMultiShellModel(m);
-	addCBinaryHSModel(m);
-	addDisperser(m);
-	addCGaussian(m);
-	addCSchulz(m);
-	addCLogNormal(m);
-	addCLorentzian(m);
-	addCVesicleModel(m);
-	addCPoly_GaussCoil(m);
-	addCRPAModel(m);
-	addCFractalModel(m);
-}
Index: sansmodels/src/sans/models/c_models/capcyl.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/capcyl.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,252 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "capcyl.h"
-}
-
-CappedCylinderModel :: CappedCylinderModel() {
-	scale      = Parameter(1.0);
-	rad_cyl		= Parameter(20.0);
-	rad_cyl.set_min(0.0);
-	len_cyl     = Parameter(400.0, true);
-	len_cyl.set_min(0.0);
-	rad_cap = Parameter(40.0);
-	rad_cap.set_min(0.0);
-	sld_capcyl  = Parameter(1.0e-6);
-	sld_solv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	theta  = Parameter(0.0, true);
-	phi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CappedCylinderModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = rad_cyl();
-	dp[2] = len_cyl();
-	dp[3] = rad_cap();
-	dp[4] = sld_capcyl();
-	dp[5] = sld_solv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the rad_cyl
-	vector<WeightPoint> weights_rad_cyl;
-	rad_cyl.get_weights(weights_rad_cyl);
-	// Get the dispersion points for the len_cyl
-	vector<WeightPoint> weights_len_cyl;
-	len_cyl.get_weights(weights_len_cyl);
-	// Get the dispersion points for the rad_cap
-	vector<WeightPoint> weights_rad_cap;
-	rad_cap.get_weights(weights_rad_cap);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double pi,hDist,result;
-	double vol_i = 0.0;
-	pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_cyl.size(); i++) {
-		dp[1] = weights_rad_cyl[i].value;
-		for(size_t j=0; j<weights_len_cyl.size(); j++) {
-			dp[2] = weights_len_cyl[j].value;
-			for(size_t k=0; k<weights_rad_cap.size(); k++) {
-				dp[3] = weights_rad_cap[k].value;
-
-				//Un-normalize SphereForm by volume
-				hDist = -1.0*sqrt(fabs(dp[3]*dp[3]-dp[1]*dp[1]));
-				vol_i = pi*dp[1]*dp[1]*dp[2]+2.0*pi/3.0*((dp[3]-hDist)*(dp[3]-hDist)*
-								(2.0*(dp[3]+hDist)));
-				result =  CappedCylinder(dp, q) * vol_i;
-				// This FIXES a singualrity the kernel in libigor.
-				if ( result == INFINITY || result == NAN){
-					result = 0.0;
-				}
-				sum += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight
-					* result;
-				//Find average volume
-				vol += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight
-					* vol_i;
-
-				norm += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight;
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double CappedCylinderModel :: operator()(double qx, double qy) {
-	CapCylParameters dp;
-
-	dp.scale = scale();
-	dp.rad_cyl = rad_cyl();
-	dp.len_cyl = len_cyl();
-	dp.rad_cap = rad_cap();
-	dp.sld_capcyl = sld_capcyl();
-	dp.sld_solv = sld_solv();
-	dp.background = 0.0;
-	dp.theta  = theta();
-	dp.phi    = phi();
-
-	// Get the dispersion points for the rad_bar
-	vector<WeightPoint> weights_rad_cyl;
-	rad_cyl.get_weights(weights_rad_cyl);
-
-	// Get the dispersion points for the len_bar
-	vector<WeightPoint> weights_len_cyl;
-	len_cyl.get_weights(weights_len_cyl);
-
-	// Get the dispersion points for the rad_bell
-	vector<WeightPoint> weights_rad_cap;
-	rad_cap.get_weights(weights_rad_cap);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	phi.get_weights(weights_phi);
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi,hDist;
-	double vol_i = 0.0;
-	pi = 4.0*atan(1.0);
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_cyl.size(); i++) {
-		dp.rad_cyl = weights_rad_cyl[i].value;
-		for(size_t j=0; j<weights_len_cyl.size(); j++) {
-			dp.len_cyl = weights_len_cyl[j].value;
-			for(size_t k=0; k<weights_rad_cap.size(); k++) {
-				dp.rad_cap = weights_rad_cap[k].value;
-				// Average over theta distribution
-				for(size_t l=0; l< weights_theta.size(); l++) {
-					dp.theta = weights_theta[l].value;
-					// Average over phi distribution
-					for(size_t m=0; m< weights_phi.size(); m++) {
-						dp.phi = weights_phi[m].value;
-						//Un-normalize Form by volume
-						hDist = -1.0*sqrt(fabs(dp.rad_cap*dp.rad_cap-dp.rad_cyl*dp.rad_cyl));
-						vol_i = pi*dp.rad_cyl*dp.rad_cyl*dp.len_cyl+2.0*pi/3.0*((dp.rad_cap-hDist)*(dp.rad_cap-hDist)*
-										(2*dp.rad_cap+hDist));
-
-						double _ptvalue = weights_rad_cyl[i].weight
-											* weights_len_cyl[j].weight
-											* weights_rad_cap[k].weight
-											* weights_theta[l].weight
-											* weights_phi[m].weight
-											* vol_i
-											* capcyl_analytical_2DXY(&dp, qx, qy);
-											//* pow(weights_rad[i].value,3.0);
-						// Consider when there is infinte or nan.
-						if ( _ptvalue == INFINITY || _ptvalue == NAN){
-							_ptvalue = 0.0;
-						}
-						if (weights_theta.size()>1) {
-							_ptvalue *= fabs(sin(weights_theta[l].value*pi/180.0));
-						}
-						sum += _ptvalue;
-						// This model dose not need the volume of spheres correction!!!
-						//Find average volume
-						vol += weights_rad_cyl[i].weight
-								* weights_len_cyl[j].weight
-								* weights_rad_cap[k].weight
-								* vol_i;
-						//Find norm for volume
-						norm_vol += weights_rad_cyl[i].weight
-								* weights_len_cyl[j].weight
-								* weights_rad_cap[k].weight;
-
-						norm += weights_rad_cyl[i].weight
-								* weights_len_cyl[j].weight
-								* weights_rad_cap[k].weight
-								* weights_theta[l].weight
-								* weights_phi[m].weight;
-					}
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CappedCylinderModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CappedCylinderModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/classTemplate.txt
===================================================================
--- sansmodels/src/sans/models/c_models/classTemplate.txt	(revision 8f5b34a1e0f7fa26c52f9162b5d360734cb91440)
+++ 	(revision )
@@ -1,492 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/** [PYTHONCLASS]
- *
- * C extension 
- *
- * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
- *          DO NOT MODIFY THIS FILE, MODIFY [INCLUDE_FILE]
- *          AND RE-RUN THE GENERATOR SCRIPT
- *
- */
-#define NO_IMPORT_ARRAY
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
- 
-extern "C" {
-#include <Python.h>
-#include <arrayobject.h>
-#include "structmember.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include "[INCLUDE_FILE]"
-}
-
-#include "models.hh"
-#include "dispersion_visitor.hh"
-
-/// Error object for raised exceptions
-static PyObject * [PYTHONCLASS]Error = NULL;
-
-
-// Class definition
-typedef struct {
-    PyObject_HEAD
-    /// Parameters
-    PyObject * params;
-    /// Dispersion parameters
-    PyObject * dispersion;
-    /// Underlying model object
-    [CMODEL] * model;
-    /// Log for unit testing
-    PyObject * log;
-} [PYTHONCLASS];
-
-
-static void
-[PYTHONCLASS]_dealloc([PYTHONCLASS]* self)
-{
-    Py_DECREF(self->params);
-    Py_DECREF(self->dispersion);
-    Py_DECREF(self->log);
-    delete self->model;
-    self->ob_type->tp_free((PyObject*)self);
-    [NUMERICAL_DEALLOC]
-}
-
-static PyObject *
-[PYTHONCLASS]_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
-    [PYTHONCLASS] *self;
-    
-    self = ([PYTHONCLASS] *)type->tp_alloc(type, 0);
-   
-    return (PyObject *)self;
-}
-
-static int
-[PYTHONCLASS]_init([PYTHONCLASS] *self, PyObject *args, PyObject *kwds)
-{
-    if (self != NULL) {
-    	
-    	// Create parameters
-        self->params = PyDict_New();
-        self->dispersion = PyDict_New();
-        self->model = new [CMODEL]();
-        
-        [INITDICTIONARY]
-         
-        // Create empty log
-        self->log = PyDict_New();
-        
-        [NUMERICAL_INIT]
-    }
-    return 0;
-}
-
-static char name_params[] = "params";
-static char def_params[] = "Parameters";
-static char name_dispersion[] = "dispersion";
-static char def_dispersion[] = "Dispersion parameters";
-static char name_log[] = "log";
-static char def_log[] = "Log";
-
-static PyMemberDef [PYTHONCLASS]_members[] = {
-    {name_params, T_OBJECT, offsetof([PYTHONCLASS], params), 0, def_params},
-	{name_dispersion, T_OBJECT, offsetof([PYTHONCLASS], dispersion), 0, def_dispersion},     
-    {name_log, T_OBJECT, offsetof([PYTHONCLASS], log), 0, def_log},
-    {NULL}  /* Sentinel */
-};
-
-/** Read double from PyObject
-    @param p PyObject
-    @return double
-*/
-double [PYTHONCLASS]_readDouble(PyObject *p) {
-    if (PyFloat_Check(p)==1) {
-        return (double)(((PyFloatObject *)(p))->ob_fval);
-    } else if (PyInt_Check(p)==1) {
-        return (double)(((PyIntObject *)(p))->ob_ival);
-    } else if (PyLong_Check(p)==1) {
-        return (double)PyLong_AsLong(p);
-    } else {
-        return 0.0;
-    }
-}
-/**
- * Function to call to evaluate model
- * @param args: input numpy array q[] 
- * @return: numpy array object 
- */
- 
-static PyObject *evaluateOneDim([CMODEL]* model, PyArrayObject *q){
-    PyArrayObject *result;
-   
-    // Check validity of array q , q must be of dimension 1, an array of double
-    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
-    {
-        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
-        //PyErr_SetString(PyExc_ValueError , message);
-        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;
-	}
-#pragma omp parallel for
-	 for (int i = 0; i < q->dimensions[0]; i++){
-      double q_value  = *(double *)(q->data + i*q->strides[0]);
-      double *result_value = (double *)(result->data + i*result->strides[0]);
-      *result_value =(*model)(q_value);
-	}
-    return PyArray_Return(result); 
- }
-
- /**
- * Function to call to evaluate model
- * @param args: input numpy array  [x[],y[]]
- * @return: numpy array object 
- */
- static PyObject * evaluateTwoDimXY( [CMODEL]* model, 
-                              PyArrayObject *x, PyArrayObject *y)
- {
-    PyArrayObject *result;
-    int x_len, y_len, dims[1];
-    //check validity of input vectors
-    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
-        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
-        || y->dimensions[0] != x->dimensions[0]){
-        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
-        PyErr_SetString(PyExc_ValueError , message); 
-        return NULL;
-    }
-   
-	if (PyArray_Check(x) && PyArray_Check(y)) {
-		
-	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
-	    
-	    // Make a new double matrix of same dims
-        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
-        if (result == NULL){
-	    const char * message= "Could not create result ";
-        PyErr_SetString(PyExc_RuntimeError , message);
-	    return NULL;
-	    }
-       
-        /* Do the calculation. */
-#pragma omp parallel for
-        for (int i=0; i< x_len; i++) {
-            double x_value = *(double *)(x->data + i*x->strides[0]);
-  		    double y_value = *(double *)(y->data + i*y->strides[0]);
-  			double *result_value = (double *)(result->data +
-  			      i*result->strides[0]);
-  			*result_value = (*model)(x_value, y_value);
-        }           
-        return PyArray_Return(result); 
-        
-        }else{
-		    PyErr_SetString([PYTHONCLASS]Error, 
-                   "[PYTHONCLASS].evaluateTwoDimXY couldn't run.");
-	        return NULL;
-		}      	
-}
-/**
- *  evalDistribution function evaluate a model function with input vector
- *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
- *
- */ 
-static PyObject * evalDistribution([PYTHONCLASS] *self, PyObject *args){
-	PyObject *qx, *qy;
-	PyArrayObject * pars;
-	int npars ,mpars;
-	
-	// Get parameters
-	
-	[READDICTIONARY]
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString([PYTHONCLASS]Error, 
-	    	"[PYTHONCLASS].evalDistribution expects a q value.");
-		return NULL;
-	}
-    // Check params
-	
-    if(PyArray_Check(pars)==1) {
-		
-	    // Length of list should 1 or 2
-	    npars = pars->nd; 
-	    if(npars==1) {
-	        // input is a numpy array
-	        if (PyArray_Check(pars)) {
-		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
-		    }
-		}else{
-		    PyErr_SetString([PYTHONCLASS]Error, 
-                   "[PYTHONCLASS].evalDistribution expect numpy array of one dimension.");
-	        return NULL;
-		}
-    }else if( PyList_Check(pars)==1) {
-    	// Length of list should be 2 for I(qx,qy)
-	    mpars = PyList_GET_SIZE(pars); 
-	    if(mpars!=2) {
-	    	PyErr_SetString([PYTHONCLASS]Error, 
-	    		"[PYTHONCLASS].evalDistribution expects a list of dimension 2.");
-	    	return NULL;
-	    }
-	     qx = PyList_GET_ITEM(pars,0);
-	     qy = PyList_GET_ITEM(pars,1);
-	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
-	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
-		           (PyArrayObject*)qy);
-		 }else{
-		    PyErr_SetString([PYTHONCLASS]Error, 
-                   "[PYTHONCLASS].evalDistribution expect 2 numpy arrays in list.");
-	        return NULL;
-	     }
-	}
-	PyErr_SetString([PYTHONCLASS]Error, 
-                   "[PYTHONCLASS].evalDistribution couln't be run.");
-	return NULL;
-	
-}
-
-/**
- * Function to call to evaluate model
- * @param args: input q or [q,phi]
- * @return: function value
- */
-static PyObject * run([PYTHONCLASS] *self, PyObject *args) {
-	double q_value, phi_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	[READDICTIONARY]
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString([PYTHONCLASS]Error, 
-	    	"[PYTHONCLASS].run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(q,phi)
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString([PYTHONCLASS]Error, 
-	    		"[PYTHONCLASS].run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the q and phi values at which
-	    // to evaluate I(q,phi)
-	    q_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,0));
-	    phi_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,1));
-	    // Skip zero
-	    if (q_value==0) {
-	    	return Py_BuildValue("d",0.0);
-	    }
-		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		q_value = [PYTHONCLASS]_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(q_value));
-	}	
-}
-/**
- * Function to call to calculate_ER
- * @return: effective radius value 
- */
-static PyObject * calculate_ER([PYTHONCLASS] *self) {
-
-	// Get parameters
-	
-	[READDICTIONARY]
-		
-	return Py_BuildValue("d",(*(self->model)).calculate_ER());
-
-}
-/**
- * Function to call to evaluate model in cartesian coordinates
- * @param args: input q or [qx, qy]]
- * @return: function value
- */
-static PyObject * runXY([PYTHONCLASS] *self, PyObject *args) {
-	double qx_value, qy_value;
-	PyObject* pars;
-	int npars;
-	
-	// Get parameters
-	
-	[READDICTIONARY]
-	
-	// Get input and determine whether we have to supply a 1D or 2D return value.
-	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
-	    PyErr_SetString([PYTHONCLASS]Error, 
-	    	"[PYTHONCLASS].run expects a q value.");
-		return NULL;
-	}
-	  
-	// Check params
-	if( PyList_Check(pars)==1) {
-		
-		// Length of list should be 2 for I(qx, qy))
-	    npars = PyList_GET_SIZE(pars); 
-	    if(npars!=2) {
-	    	PyErr_SetString([PYTHONCLASS]Error, 
-	    		"[PYTHONCLASS].run expects a double or a list of dimension 2.");
-	    	return NULL;
-	    }
-	    // We have a vector q, get the qx and qy values at which
-	    // to evaluate I(qx,qy)
-	    qx_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,0));
-	    qy_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,1));
-	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
-
-	} else {
-
-		// We have a scalar q, we will evaluate I(q)
-		qx_value = [PYTHONCLASS]_readDouble(pars);		
-		
-		return Py_BuildValue("d",(*(self->model))(qx_value));
-	}	
-}
-
-static PyObject * reset([PYTHONCLASS] *self, PyObject *args) {
-    [NUMERICAL_RESET]
-    return Py_BuildValue("d",0.0);
-}
-
-static PyObject * set_dispersion([PYTHONCLASS] *self, PyObject *args) {
-	PyObject * disp;
-	const char * par_name;
-
-	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
-	    PyErr_SetString([PYTHONCLASS]Error,
-	    	"[PYTHONCLASS].set_dispersion expects a DispersionModel object.");
-		return NULL;
-	}
-	void *temp = PyCObject_AsVoidPtr(disp);
-	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-
-
-	// Ugliness necessary to go from python to C
-	[SET_DISPERSION] {
-	    PyErr_SetString([PYTHONCLASS]Error,
-	    	"[PYTHONCLASS].set_dispersion expects a valid parameter name.");
-		return NULL;
-	}
-
-	DispersionVisitor* visitor = new DispersionVisitor();
-	PyObject * disp_dict = PyDict_New();
-	dispersion->accept_as_source(visitor, dispersion, disp_dict);
-	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
-    return Py_BuildValue("i",1);
-}
-
-
-static PyMethodDef [PYTHONCLASS]_methods[] = {
-    {"run",      (PyCFunction)run     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy"},
-    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
-      "Evaluate the model at a given Q or Q, phi"},
-      
-    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
-      "Evaluate the model at a given Q or Qx, Qy vector "},
-    {"reset",    (PyCFunction)reset   , METH_VARARGS,
-      "Reset pair correlation"},
-    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
-      "Set the dispersion model for a given parameter"},
-   {NULL}
-};
-
-static PyTypeObject [PYTHONCLASS]Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "[PYTHONCLASS]",             /*tp_name*/
-    sizeof([PYTHONCLASS]),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)[PYTHONCLASS]_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
-    "[PYTHONCLASS] objects",           /* tp_doc */
-    0,		               /* tp_traverse */
-    0,		               /* tp_clear */
-    0,		               /* tp_richcompare */
-    0,		               /* tp_weaklistoffset */
-    0,		               /* tp_iter */
-    0,		               /* tp_iternext */
-    [PYTHONCLASS]_methods,             /* tp_methods */
-    [PYTHONCLASS]_members,             /* tp_members */
-    0,                         /* tp_getset */
-    0,                         /* tp_base */
-    0,                         /* tp_dict */
-    0,                         /* tp_descr_get */
-    0,                         /* tp_descr_set */
-    0,                         /* tp_dictoffset */
-    (initproc)[PYTHONCLASS]_init,      /* tp_init */
-    0,                         /* tp_alloc */
-    [PYTHONCLASS]_new,                 /* tp_new */
-};
-
-
-//static PyMethodDef module_methods[] = {
-//    {NULL} 
-//};
-
-/**
- * Function used to add the model class to a module
- * @param module: module to add the class to
- */ 
-void add[PYTHONCLASS](PyObject *module) {
-	PyObject *d;
-	
-    if (PyType_Ready(&[PYTHONCLASS]Type) < 0)
-        return;
-
-    Py_INCREF(&[PYTHONCLASS]Type);
-    PyModule_AddObject(module, "[PYTHONCLASS]", (PyObject *)&[PYTHONCLASS]Type);
-    
-    d = PyModule_GetDict(module);
-    static char error_name[] = "[PYTHONCLASS].error";
-    [PYTHONCLASS]Error = PyErr_NewException(error_name, NULL, NULL);
-    PyDict_SetItemString(d, "[PYTHONCLASS]Error", [PYTHONCLASS]Error);
-}
Index: sansmodels/src/sans/models/c_models/corefourshell.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/corefourshell.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,239 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "corefourshell.h"
-}
-
-CoreFourShellModel :: CoreFourShellModel() {
-	scale      = Parameter(1.0);
-	rad_core0     = Parameter(60.0, true);
-	rad_core0.set_min(0.0);
-	sld_core0   = Parameter(6.4e-6);
-	thick_shell1     = Parameter(10.0, true);
-	thick_shell1.set_min(0.0);
-	sld_shell1   = Parameter(1.0e-6);
-	thick_shell2     = Parameter(10.0, true);
-	thick_shell2.set_min(0.0);
-	sld_shell2   = Parameter(2.0e-6);
-	thick_shell3     = Parameter(10.0, true);
-	thick_shell3.set_min(0.0);
-	sld_shell3   = Parameter(3.0e-6);
-	thick_shell4     = Parameter(10.0, true);
-	thick_shell4.set_min(0.0);
-	sld_shell4   = Parameter(4.0e-6);
-	sld_solv   = Parameter(6.4e-6);
-	background = Parameter(0.001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreFourShellModel :: operator()(double q) {
-	double dp[13];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = rad_core0();
-	dp[2] = sld_core0();
-	dp[3] = thick_shell1();
-	dp[4] = sld_shell1();
-	dp[5] = thick_shell2();
-	dp[6] = sld_shell2();
-	dp[7] = thick_shell3();
-	dp[8] = sld_shell3();
-	dp[9] = thick_shell4();
-	dp[10] = sld_shell4();
-	dp[11] = sld_solv();
-	dp[12] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rad_core0.get_weights(weights_rad);
-
-	// Get the dispersion points for the thick 1
-	vector<WeightPoint> weights_s1;
-	thick_shell1.get_weights(weights_s1);
-
-	// Get the dispersion points for the thick 2
-	vector<WeightPoint> weights_s2;
-	thick_shell2.get_weights(weights_s2);
-
-	// Get the dispersion points for the thick 3
-	vector<WeightPoint> weights_s3;
-	thick_shell3.get_weights(weights_s3);
-
-	// Get the dispersion points for the thick 4
-	vector<WeightPoint> weights_s4;
-	thick_shell4.get_weights(weights_s4);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-		// Loop over radius weight points
-		for(size_t j=0; j<weights_s1.size(); j++) {
-			dp[3] = weights_s1[j].value;
-			// Loop over radius weight points
-			for(size_t k=0; k<weights_s2.size(); k++) {
-				dp[5] = weights_s2[k].value;
-				// Loop over radius weight points
-				for(size_t l=0; l<weights_s3.size(); l++) {
-					dp[7] = weights_s3[l].value;
-					// Loop over radius weight points
-					for(size_t m=0; m<weights_s4.size(); m++) {
-						dp[9] = weights_s4[m].value;
-						//Un-normalize FourShell by volume
-						sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-							* FourShell(dp, q) * pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value),3);
-						//Find average volume
-						vol += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-							* pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value),3);
-
-						norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight;
-					}
-				}
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double CoreFourShellModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreFourShellModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreFourShellModel :: calculate_ER() {
-	CoreFourShellParameters dp;
-
-	dp.scale = scale();
-	dp.rad_core0 = rad_core0();
-	dp.sld_core0 = sld_core0();
-	dp.thick_shell1 = thick_shell1();
-	dp.sld_shell1 = sld_shell1();
-	dp.thick_shell2 = thick_shell2();
-	dp.sld_shell2 = sld_shell2();
-	dp.thick_shell3 = thick_shell3();
-	dp.sld_shell3 = sld_shell3();
-	dp.thick_shell4 = thick_shell4();
-	dp.sld_shell4 = sld_shell4();
-	dp.sld_solv = sld_solv();
-	dp.background = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rad_core0.get_weights(weights_rad);
-
-	// Get the dispersion points for the thick 1
-	vector<WeightPoint> weights_s1;
-	thick_shell1.get_weights(weights_s1);
-
-	// Get the dispersion points for the thick 2
-	vector<WeightPoint> weights_s2;
-	thick_shell2.get_weights(weights_s2);
-
-	// Get the dispersion points for the thick 3
-	vector<WeightPoint> weights_s3;
-	thick_shell3.get_weights(weights_s3);
-
-	// Get the dispersion points for the thick 4
-	vector<WeightPoint> weights_s4;
-	thick_shell4.get_weights(weights_s4);
-
-	double rad_out = 0.0;
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.rad_core0 = weights_rad[i].value;
-		// Loop over radius weight points
-		for(size_t j=0; j<weights_s1.size(); j++) {
-			dp.thick_shell1 = weights_s1[j].value;
-			// Loop over radius weight points
-			for(size_t k=0; k<weights_s2.size(); k++) {
-				dp.thick_shell2 = weights_s2[k].value;
-				// Loop over radius weight points
-				for(size_t l=0; l<weights_s3.size(); l++) {
-					dp.thick_shell3 = weights_s3[l].value;
-					// Loop over radius weight points
-					for(size_t m=0; m<weights_s4.size(); m++) {
-						dp.thick_shell4 = weights_s4[m].value;
-						//Un-normalize FourShell by volume
-						sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-							* (dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4);
-						norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight;
-					}
-				}
-			}
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/coreshellcylinder.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/coreshellcylinder.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,302 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "core_shell_cylinder.h"
-}
-
-CoreShellCylinderModel :: CoreShellCylinderModel() {
-	scale      = Parameter(1.0);
-	radius     = Parameter(20.0, true);
-	radius.set_min(0.0);
-	thickness  = Parameter(10.0, true);
-	thickness.set_min(0.0);
-	length     = Parameter(400.0, true);
-	length.set_min(0.0);
-	core_sld   = Parameter(1.e-6);
-	shell_sld  = Parameter(4.e-6);
-	solvent_sld= Parameter(1.e-6);
-	background = Parameter(0.0);
-	axis_theta = Parameter(90.0, true);
-	axis_phi   = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellCylinderModel :: operator()(double q) {
-	double dp[8];
-
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = thickness();
-	dp[3] = length();
-	dp[4] = core_sld();
-	dp[5] = shell_sld();
-	dp[6] = solvent_sld();
-	dp[7] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_thick;
-	thickness.get_weights(weights_thick);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp[3] = weights_len[j].value;
-
-			// Loop over thickness weight points
-			for(size_t k=0; k<weights_thick.size(); k++) {
-				dp[2] = weights_thick[k].value;
-				//Un-normalize by volume
-				sum += weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_thick[k].weight
-					* CoreShellCylinder(dp, q)
-					* pow(weights_rad[i].value+weights_thick[k].value,2)
-					*(weights_len[j].value+2.0*weights_thick[k].value);
-				//Find average volume
-				vol += weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_thick[k].weight
-					* pow(weights_rad[i].value+weights_thick[k].value,2)
-					*(weights_len[j].value+2.0*weights_thick[k].value);
-				norm += weights_rad[i].weight
-				* weights_len[j].weight
-				* weights_thick[k].weight;
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double CoreShellCylinderModel :: operator()(double qx, double qy) {
-	CoreShellCylinderParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.radius     = radius();
-	dp.thickness  = thickness();
-	dp.length     = length();
-	dp.core_sld   = core_sld();
-	dp.shell_sld  = shell_sld();
-	dp.solvent_sld= solvent_sld();
-	dp.background = 0.0;
-	dp.axis_theta = axis_theta();
-	dp.axis_phi   = axis_phi();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_thick;
-	thickness.get_weights(weights_thick);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	axis_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	axis_phi.get_weights(weights_phi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.radius = weights_rad[i].value;
-
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp.length = weights_len[j].value;
-
-			// Loop over thickness weight points
-			for(size_t m=0; m<weights_thick.size(); m++) {
-				dp.thickness = weights_thick[m].value;
-
-			// Average over theta distribution
-			for(size_t k=0; k<weights_theta.size(); k++) {
-				dp.axis_theta = weights_theta[k].value;
-
-				// Average over phi distribution
-				for(size_t l=0; l<weights_phi.size(); l++) {
-					dp.axis_phi = weights_phi[l].value;
-					//Un-normalize by volume
-					double _ptvalue = weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_thick[m].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight
-						* core_shell_cylinder_analytical_2DXY(&dp, qx, qy)
-						* pow(weights_rad[i].value+weights_thick[m].value,2)
-						*(weights_len[j].value+2.0*weights_thick[m].value);
-
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(sin(weights_theta[k].value*pi/180.0));
-					}
-					sum += _ptvalue;
-
-					//Find average volume
-					vol += weights_rad[i].weight
-							* weights_len[j].weight
-							* weights_thick[m].weight
-							* pow(weights_rad[i].value+weights_thick[m].value,2)
-							*(weights_len[j].value+2.0*weights_thick[m].value);
-					//Find norm for volume
-					norm_vol += weights_rad[i].weight
-								* weights_len[j].weight
-								* weights_thick[m].weight;
-
-					norm += weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_thick[m].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight;
-
-				}
-			}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellCylinderModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreShellCylinderModel :: calculate_ER() {
-	CoreShellCylinderParameters dp;
-
-	dp.radius     = radius();
-	dp.thickness  = thickness();
-	dp.length     = length();
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_thickness;
-	thickness.get_weights(weights_thickness);
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_length.size(); i++) {
-		dp.length = weights_length[i].value;
-		for(int j=0; j< (int)weights_thickness.size(); j++) {
-			dp.thickness = weights_thickness[j].value;
-			for(int k=0; k< (int)weights_radius.size(); k++) {
-				dp.radius = weights_radius[k].value;
-				//Note: output of "DiamCyl( )" is DIAMETER.
-				sum +=weights_length[i].weight * weights_thickness[j].weight
-					* weights_radius[k].weight*DiamCyl(dp.length+2.0*dp.thickness,dp.radius+dp.thickness)/2.0;
-				norm += weights_length[i].weight* weights_thickness[j].weight* weights_radius[k].weight;
-			}
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl()" is DIAMETER.
-		rad_out = DiamCyl(dp.length+2.0*dp.thickness,dp.radius+dp.thickness)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/coreshellsphere.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/coreshellsphere.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,169 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "core_shell.h"
-}
-
-CoreShellModel :: CoreShellModel() {
-	scale      = Parameter(1.0);
-	radius     = Parameter(60.0, true);
-	radius.set_min(0.0);
-	thickness  = Parameter(10.0, true);
-	thickness.set_min(0.0);
-	core_sld   = Parameter(1.e-6);
-	shell_sld  = Parameter(2.e-6);
-	solvent_sld = Parameter(3.e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = thickness();
-	dp[3] = core_sld();
-	dp[4] = shell_sld();
-	dp[5] = solvent_sld();
-	dp[6] = 0.0;
-
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_thick;
-	thickness.get_weights(weights_thick);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		// Loop over thickness weight points
-		for(size_t j=0; j<weights_thick.size(); j++) {
-			dp[2] = weights_thick[j].value;
-			//Un-normalize SphereForm by volume
-			sum += weights_rad[i].weight
-				* weights_thick[j].weight * CoreShellForm(dp, q)* pow(weights_rad[i].value+weights_thick[j].value,3);
-
-			//Find average volume
-			vol += weights_rad[i].weight * weights_thick[j].weight
-				* pow(weights_rad[i].value+weights_thick[j].value,3);
-			norm += weights_rad[i].weight
-				* weights_thick[j].weight;
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double CoreShellModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreShellModel :: calculate_ER() {
-	CoreShellParameters dp;
-
-	dp.radius     = radius();
-	dp.thickness  = thickness();
-
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_thickness;
-	thickness.get_weights(weights_thickness);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int j=0; j< (int)weights_thickness.size(); j++) {
-		dp.thickness = weights_thickness[j].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			sum += weights_thickness[j].weight
-				* weights_radius[k].weight*(dp.radius+dp.thickness);
-			norm += weights_thickness[j].weight* weights_radius[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = (dp.radius+dp.thickness);}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/csparallelepiped.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/csparallelepiped.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,344 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2010, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "csparallelepiped.h"
-}
-
-CSParallelepipedModel :: CSParallelepipedModel() {
-	scale      = Parameter(1.0);
-	shortA     = Parameter(35.0, true);
-	shortA.set_min(1.0);
-	midB     = Parameter(75.0, true);
-	midB.set_min(1.0);
-	longC    = Parameter(400.0, true);
-	longC.set_min(1.0);
-	rimA     = Parameter(10.0, true);
-	rimB     = Parameter(10.0, true);
-	rimC     = Parameter(10.0, true);
-	sld_rimA     = Parameter(2.0e-6, true);
-	sld_rimB     = Parameter(4.0e-6, true);
-	sld_rimC    = Parameter(2.0e-6, true);
-	sld_pcore   = Parameter(1.0e-6);
-	sld_solv   = Parameter(6.0e-6);
-	background = Parameter(0.06);
-	parallel_theta  = Parameter(0.0, true);
-	parallel_phi    = Parameter(0.0, true);
-	parallel_psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CSParallelepipedModel :: operator()(double q) {
-	double dp[13];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = shortA();
-	dp[2] = midB();
-	dp[3] = longC();
-	dp[4] = rimA();
-	dp[5] = rimB();
-	dp[6] = rimC();
-	dp[7] = sld_rimA();
-	dp[8] = sld_rimB();
-	dp[9] = sld_rimC();
-	dp[10] = sld_pcore();
-	dp[11] = sld_solv();
-	dp[12] = 0.0;
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_shortA;
-	shortA.get_weights(weights_shortA);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_midB;
-	midB.get_weights(weights_midB);
-
-	// Get the dispersion points for the longuest_edgeC
-	vector<WeightPoint> weights_longC;
-	longC.get_weights(weights_longC);
-
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over short_edgeA weight points
-	for(int i=0; i< (int)weights_shortA.size(); i++) {
-		dp[1] = weights_shortA[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_midB.size(); j++) {
-			dp[2] = weights_midB[j].value;
-
-			// Loop over longuest_edgeC weight points
-			for(int k=0; k< (int)weights_longC.size(); k++) {
-				dp[3] = weights_longC[k].value;
-				//Un-normalize  by volume
-				sum += weights_shortA[i].weight * weights_midB[j].weight
-					* weights_longC[k].weight * CSParallelepiped(dp, q)
-					* weights_shortA[i].value*weights_midB[j].value
-					* weights_longC[k].value;
-				//Find average volume
-				vol += weights_shortA[i].weight * weights_midB[j].weight
-					* weights_longC[k].weight
-					* weights_shortA[i].value * weights_midB[j].value
-					* weights_longC[k].value;
-
-				norm += weights_shortA[i].weight
-					 * weights_midB[j].weight * weights_longC[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double CSParallelepipedModel :: operator()(double qx, double qy) {
-	CSParallelepipedParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.shortA   = shortA();
-	dp.midB   = midB();
-	dp.longC  = longC();
-	dp.rimA   = rimA();
-	dp.rimB   = rimB();
-	dp.rimC  = rimC();
-	dp.sld_rimA   = sld_rimA();
-	dp.sld_rimB   = sld_rimB();
-	dp.sld_rimC  = sld_rimC();
-	dp.sld_pcore   = sld_pcore();
-	dp.sld_solv   = sld_solv();
-	dp.background = 0.0;
-	//dp.background = background();
-	dp.parallel_theta  = parallel_theta();
-	dp.parallel_phi    = parallel_phi();
-	dp.parallel_psi    = parallel_psi();
-
-
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_shortA;
-	shortA.get_weights(weights_shortA);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_midB;
-	midB.get_weights(weights_midB);
-
-	// Get the dispersion points for the longuest_edgeC
-	vector<WeightPoint> weights_longC;
-	longC.get_weights(weights_longC);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_parallel_theta;
-	parallel_theta.get_weights(weights_parallel_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_parallel_phi;
-	parallel_phi.get_weights(weights_parallel_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_parallel_psi;
-	parallel_psi.get_weights(weights_parallel_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-
-	// Loop over radius weight points
-	for(int i=0; i< (int)weights_shortA.size(); i++) {
-		dp.shortA = weights_shortA[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_midB.size(); j++) {
-			dp.midB = weights_midB[j].value;
-
-			// Average over longuest_edgeC distribution
-			for(int k=0; k< (int)weights_longC.size(); k++) {
-				dp.longC = weights_longC[k].value;
-
-				// Average over theta distribution
-				for(int l=0; l< (int)weights_parallel_theta.size(); l++) {
-				dp.parallel_theta = weights_parallel_theta[l].value;
-
-					// Average over phi distribution
-					for(int m=0; m< (int)weights_parallel_phi.size(); m++) {
-						dp.parallel_phi = weights_parallel_phi[m].value;
-
-						// Average over phi distribution
-						for(int n=0; n< (int)weights_parallel_psi.size(); n++) {
-							dp.parallel_psi = weights_parallel_psi[n].value;
-							//Un-normalize by volume
-							double _ptvalue = weights_shortA[i].weight
-								* weights_midB[j].weight
-								* weights_longC[k].weight
-								* weights_parallel_theta[l].weight
-								* weights_parallel_phi[m].weight
-								* weights_parallel_psi[n].weight
-								* csparallelepiped_analytical_2DXY(&dp, qx, qy)
-								* weights_shortA[i].value*weights_midB[j].value
-								* weights_longC[k].value;
-
-							if (weights_parallel_theta.size()>1) {
-								_ptvalue *= fabs(sin(weights_parallel_theta[l].value*pi/180.0));
-							}
-							sum += _ptvalue;
-							//Find average volume
-							vol += weights_shortA[i].weight
-								* weights_midB[j].weight
-								* weights_longC[k].weight
-								* weights_shortA[i].value*weights_midB[j].value
-								* weights_longC[k].value;
-							//Find norm for volume
-							norm_vol += weights_shortA[i].weight
-								* weights_midB[j].weight
-								* weights_longC[k].weight;
-
-							norm += weights_shortA[i].weight
-								* weights_midB[j].weight
-								* weights_longC[k].weight
-								* weights_parallel_theta[l].weight
-								* weights_parallel_phi[m].weight
-								* weights_parallel_psi[n].weight;
-						}
-					}
-
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_parallel_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CSParallelepipedModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CSParallelepipedModel :: calculate_ER() {
-	CSParallelepipedParameters dp;
-	dp.shortA   = shortA();
-	dp.midB   = midB();
-	dp.longC  = longC();
-	dp.rimA   = rimA();
-	dp.rimB   = rimB();
-	dp.rimC  = rimC();
-
-	double rad_out = 0.0;
-	double pi = 4.0*atan(1.0);
-	double suf_rad = sqrt((dp.shortA*dp.midB+2.0*dp.rimA*dp.midB+2.0*dp.rimA*dp.shortA)/pi);
-	double height =(dp.longC + 2.0*dp.rimC);
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_shortA;
-	shortA.get_weights(weights_shortA);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_midB;
-	midB.get_weights(weights_midB);
-
-	// Get angular averaging for the longuest_edgeC
-	vector<WeightPoint> weights_longC;
-	longC.get_weights(weights_longC);
-
-	// Loop over radius weight points
-	for(int i=0; i< (int)weights_shortA.size(); i++) {
-		dp.shortA = weights_shortA[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_midB.size(); j++) {
-			dp.midB = weights_midB[j].value;
-
-			// Average over longuest_edgeC distribution
-			for(int k=0; k< (int)weights_longC.size(); k++) {
-				dp.longC = weights_longC[k].value;
-				//Calculate surface averaged radius
-				//This is rough approximation.
-				suf_rad = sqrt((dp.shortA*dp.midB+2.0*dp.rimA*dp.midB+2.0*dp.rimA*dp.shortA)/pi);
-				height =(dp.longC + 2.0*dp.rimC);
-				//Note: output of "DiamCyl(dp.length,dp.radius)" is a DIAMETER.
-				sum +=weights_shortA[i].weight* weights_midB[j].weight
-					* weights_longC[k].weight*DiamCyl(height, suf_rad)/2.0;
-				norm += weights_shortA[i].weight* weights_midB[j].weight*weights_longC[k].weight;
-			}
-		}
-	}
-
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(length,radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.longC, suf_rad)/2.0;}
-	return rad_out;
-
-}
Index: sansmodels/src/sans/models/c_models/cylinder.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/cylinder.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,306 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "cylinder.h"
-}
-
-CylinderModel :: CylinderModel() {
-	scale      = Parameter(1.0);
-	radius     = Parameter(20.0, true);
-	radius.set_min(0.0);
-	length     = Parameter(400.0, true);
-	length.set_min(0.0);
-	sldCyl   = Parameter(4.e-6);
-	sldSolv   = Parameter(1.e-6);
-	background = Parameter(0.0);
-	cyl_theta  = Parameter(0.0, true);
-	cyl_phi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CylinderModel :: operator()(double q) {
-	double dp[6];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = length();
-	dp[3] = sldCyl();
-	dp[4] = sldSolv();
-	dp[5] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp[2] = weights_len[j].value;
-			//Un-normalize by volume
-			sum += weights_rad[i].weight
-				* weights_len[j].weight * CylinderForm(dp, q)
-				*pow(weights_rad[i].value,2)*weights_len[j].value;
-
-			//Find average volume
-			vol += weights_rad[i].weight
-				* weights_len[j].weight *pow(weights_rad[i].value,2)*weights_len[j].value;
-			norm += weights_rad[i].weight
-				* weights_len[j].weight;
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double CylinderModel :: operator()(double qx, double qy) {
-	CylinderParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.radius     = radius();
-	dp.length     = length();
-	dp.sldCyl   = sldCyl();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.cyl_theta  = cyl_theta();
-	dp.cyl_phi    = cyl_phi();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	cyl_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	cyl_phi.get_weights(weights_phi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.radius = weights_rad[i].value;
-
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp.length = weights_len[j].value;
-
-			// Average over theta distribution
-			for(size_t k=0; k<weights_theta.size(); k++) {
-				dp.cyl_theta = weights_theta[k].value;
-
-				// Average over phi distribution
-				for(size_t l=0; l<weights_phi.size(); l++) {
-					dp.cyl_phi = weights_phi[l].value;
-					//Un-normalize by volume
-					double _ptvalue = weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight
-						* cylinder_analytical_2DXY(&dp, qx, qy)
-						*pow(weights_rad[i].value,2)*weights_len[j].value;
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(sin(weights_theta[k].value*pi/180.0));
-					}
-					sum += _ptvalue;
-					//Find average volume
-					vol += weights_rad[i].weight
-							* weights_len[j].weight
-							* pow(weights_rad[i].value,2)*weights_len[j].value;
-					//Find norm for volume
-					norm_vol += weights_rad[i].weight
-							* weights_len[j].weight;
-
-					norm += weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight;
-
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CylinderModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CylinderModel :: calculate_ER() {
-	CylinderParameters dp;
-
-	dp.radius     = radius();
-	dp.length     = length();
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_length.size(); i++) {
-		dp.length = weights_length[i].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-			sum +=weights_length[i].weight
-				* weights_radius[k].weight*DiamCyl(dp.length,dp.radius)/2.0;
-			norm += weights_length[i].weight* weights_radius[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.length,dp.radius)/2.0;}
-
-	return rad_out;
-}
-// Testing code
-int main(void)
-{
-	CylinderModel c = CylinderModel();
-
-	printf("Length = %g\n", c.length());
-	printf("I(Qx=%g,Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	c.radius.dispersion = new GaussianDispersion();
-	c.radius.dispersion->npts = 100;
-	c.radius.dispersion->width = 5;
-
-	//c.length.dispersion = GaussianDispersion();
-	//c.length.dispersion.npts = 20;
-	//c.length.dispersion.width = 65;
-
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	c.scale = 10.0;
-	printf("I(Q=%g) = %g\n", 0.001, c(0.001));
-	printf("I(Qx=%g, Qy=%g) = %g\n", 0.001, 0.001, c(0.001, 0.001));
-	printf("I(Q=%g,  Phi=%g) = %g\n", 0.00447, .7854, c.evaluate_rphi(sqrt(0.00002), .7854));
-
-	// Average over phi at theta=90 deg
-	c.cyl_theta = 1.57;
-	double values_th[100];
-	double values[100];
-	double weights[100];
-	double pi = acos(-1.0);
-	printf("pi=%g\n", pi);
-	for(int i=0; i<100; i++){
-		values[i] = (float)i*2.0*pi/99.0;
-		values_th[i] = (float)i*pi/99.0;
-		weights[i] = 1.0;
-	}
-	//c.radius.dispersion->width = 0;
-	c.cyl_phi.dispersion = new ArrayDispersion();
-	c.cyl_theta.dispersion = new ArrayDispersion();
-	(*c.cyl_phi.dispersion).set_weights(100, values, weights);
-	(*c.cyl_theta.dispersion).set_weights(100, values_th, weights);
-
-	double i_avg = c(0.01, 0.01);
-	double i_1d = c(sqrt(0.0002));
-
-	printf("\nI(Qx=%g, Qy=%g) = %g\n", 0.01, 0.01, i_avg);
-	printf("I(Q=%g)         = %g\n", sqrt(0.0002), i_1d);
-	printf("ratio %g %g\n", i_avg/i_1d, i_1d/i_avg);
-
-
-	return 0;
-}
-
Index: sansmodels/src/sans/models/c_models/dispersion_visitor.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/dispersion_visitor.cpp	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
+++ 	(revision )
@@ -1,132 +1,0 @@
-#include "dispersion_visitor.hh"
-#include "parameters.hh"
-
-#ifndef __MODELS_STANDALONE__
-extern "C" {
-	#include <Python.h>
-}
-#endif
-
-void DispersionVisitor:: dispersion_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	DispersionModel * disp = (DispersionModel*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "flat"));
-    PyDict_SetItemString(dict, "npts",  Py_BuildValue("i", disp->npts));
-    PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width));
-#endif
-}
-
-void DispersionVisitor:: gaussian_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	GaussianDispersion * disp = (GaussianDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	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));
-    PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas));
-#endif
-}
-
-void DispersionVisitor:: lognormal_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	LogNormalDispersion * disp = (LogNormalDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "lognormal"));
-    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:: schulz_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	SchulzDispersion * disp = (SchulzDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "schulz"));
-    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:: array_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	ArrayDispersion * disp = (ArrayDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-    PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "array"));
-#endif
-}
-
-void DispersionVisitor:: dispersion_from_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	DispersionModel * disp = (DispersionModel*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	disp->npts  = PyInt_AsLong( PyDict_GetItemString(dict, "npts") );
-	disp->width = PyFloat_AsDouble( PyDict_GetItemString(dict, "width") );
-#endif
-}
-
-void DispersionVisitor:: gaussian_from_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	GaussianDispersion * disp = (GaussianDispersion*)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:: 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__
-	LogNormalDispersion * disp = (LogNormalDispersion*)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:: schulz_from_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	SchulzDispersion * disp = (SchulzDispersion*)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:: array_from_dict(void* dispersion, void* dictionary) {}
Index: sansmodels/src/sans/models/c_models/dispersion_visitor.hh
===================================================================
--- sansmodels/src/sans/models/c_models/dispersion_visitor.hh	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-#ifndef DISP_VISIT_H
-#define DISP_VISIT_H
-
-class DispersionVisitor {
-public:
-	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 *);
-	void array_to_dict(void *, void *);
-
-	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 *);
-	void array_from_dict(void*, void *);
-
-};
-
-
-#endif
Index: sansmodels/src/sans/models/c_models/ellipsoid.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/ellipsoid.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,259 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "ellipsoid.h"
-}
-
-EllipsoidModel :: EllipsoidModel() {
-	scale      = Parameter(1.0);
-	radius_a   = Parameter(20.0, true);
-	radius_a.set_min(0.0);
-	radius_b   = Parameter(400.0, true);
-	radius_b.set_min(0.0);
-	sldEll   = Parameter(4.e-6);
-	sldSolv   = Parameter(1.e-6);
-	background = Parameter(0.0);
-	axis_theta  = Parameter(57.325, true);
-	axis_phi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double EllipsoidModel :: operator()(double q) {
-	double dp[6];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius_a();
-	dp[2] = radius_b();
-	dp[3] = sldEll();
-	dp[4] = sldSolv();
-	dp[5] = 0.0;
-
-	// Get the dispersion points for the radius_a
-	vector<WeightPoint> weights_rad_a;
-	radius_a.get_weights(weights_rad_a);
-
-	// Get the dispersion points for the radius_b
-	vector<WeightPoint> weights_rad_b;
-	radius_b.get_weights(weights_rad_b);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius_a weight points
-	for(size_t i=0; i<weights_rad_a.size(); i++) {
-		dp[1] = weights_rad_a[i].value;
-
-		// Loop over radius_b weight points
-		for(size_t j=0; j<weights_rad_b.size(); j++) {
-			dp[2] = weights_rad_b[j].value;
-			//Un-normalize  by volume
-			sum += weights_rad_a[i].weight
-				* weights_rad_b[j].weight * EllipsoidForm(dp, q)
-				* pow(weights_rad_b[j].value,2) * weights_rad_a[i].value;
-
-			//Find average volume
-			vol += weights_rad_a[i].weight
-				* weights_rad_b[j].weight
-				* pow(weights_rad_b[j].value,2)
-				* weights_rad_a[i].value;
-			norm += weights_rad_a[i].weight
-				* weights_rad_b[j].weight;
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double EllipsoidModel :: operator()(double qx, double qy) {
-	EllipsoidParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.radius_a   = radius_a();
-	dp.radius_b   = radius_b();
-	dp.sldEll   = sldEll();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.axis_theta = axis_theta();
-	dp.axis_phi   = axis_phi();
-
-	// Get the dispersion points for the radius_a
-	vector<WeightPoint> weights_rad_a;
-	radius_a.get_weights(weights_rad_a);
-
-	// Get the dispersion points for the radius_b
-	vector<WeightPoint> weights_rad_b;
-	radius_b.get_weights(weights_rad_b);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	axis_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	axis_phi.get_weights(weights_phi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_a.size(); i++) {
-		dp.radius_a = weights_rad_a[i].value;
-
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_rad_b.size(); j++) {
-			dp.radius_b = weights_rad_b[j].value;
-
-			// Average over theta distribution
-			for(size_t k=0; k<weights_theta.size(); k++) {
-				dp.axis_theta = weights_theta[k].value;
-
-				// Average over phi distribution
-				for(size_t l=0; l<weights_phi.size(); l++) {
-					dp.axis_phi = weights_phi[l].value;
-					//Un-normalize by volume
-					double _ptvalue = weights_rad_a[i].weight
-						* weights_rad_b[j].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight
-						* ellipsoid_analytical_2DXY(&dp, qx, qy)
-						* pow(weights_rad_b[j].value,2) * weights_rad_a[i].value;
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(sin(weights_theta[k].value*pi/180.0));
-					}
-					sum += _ptvalue;
-					//Find average volume
-					vol += weights_rad_a[i].weight
-						* weights_rad_b[j].weight
-						* pow(weights_rad_b[j].value,2) * weights_rad_a[i].value;
-					//Find norm for volume
-					norm_vol += weights_rad_a[i].weight
-						* weights_rad_b[j].weight;
-
-					norm += weights_rad_a[i].weight
-						* weights_rad_b[j].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight;
-
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double EllipsoidModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double EllipsoidModel :: calculate_ER() {
-	EllipsoidParameters dp;
-
-	dp.radius_a = radius_a();
-	dp.radius_b = radius_b();
-
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_radius_a;
-	radius_a.get_weights(weights_radius_a);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius_b;
-	radius_b.get_weights(weights_radius_b);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_radius_b.size(); i++) {
-		dp.radius_b = weights_radius_b[i].value;
-		for(int k=0; k< (int)weights_radius_a.size(); k++) {
-			dp.radius_a = weights_radius_a[k].value;
-			sum +=weights_radius_b[i].weight
-				* weights_radius_a[k].weight*DiamEllip(dp.radius_a,dp.radius_b)/2.0;
-			norm += weights_radius_b[i].weight* weights_radius_a[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = DiamEllip(dp.radius_a,dp.radius_b)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,320 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "elliptical_cylinder.h"
-}
-
-EllipticalCylinderModel :: EllipticalCylinderModel() {
-	scale      = Parameter(1.0);
-	r_minor    = Parameter(20.0, true);
-	r_minor.set_min(0.0);
-	r_ratio    = Parameter(1.5, true);
-	r_ratio.set_min(0.0);
-	length     = Parameter(400.0, true);
-	length.set_min(0.0);
-	sldCyl   = Parameter(4.e-6);
-	sldSolv   = Parameter(1.e-6);
-	background = Parameter(0.0);
-	cyl_theta  = Parameter(57.325, true);
-	cyl_phi    = Parameter(0.0, true);
-	cyl_psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double EllipticalCylinderModel :: operator()(double q) {
-	double dp[7];
-
-	dp[0] = scale();
-	dp[1] = r_minor();
-	dp[2] = r_ratio();
-	dp[3] = length();
-	dp[4] = sldCyl();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the r_minor
-	vector<WeightPoint> weights_rad;
-	r_minor.get_weights(weights_rad);
-
-	// Get the dispersion points for the r_ratio
-	vector<WeightPoint> weights_rat;
-	r_ratio.get_weights(weights_rat);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over r_minor weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		// Loop over r_ratio weight points
-		for(size_t j=0; j<weights_rat.size(); j++) {
-			dp[2] = weights_rat[j].value;
-
-			// Loop over length weight points
-			for(size_t k=0; k<weights_len.size(); k++) {
-				dp[3] = weights_len[k].value;
-				//Un-normalize  by volume
-				sum += weights_rad[i].weight
-					* weights_len[k].weight
-					* weights_rat[j].weight
-					* EllipCyl20(dp, q)
-					* pow(weights_rad[i].value,2) * weights_rat[j].value
-					* weights_len[k].value;
-				//Find average volume
-				vol += weights_rad[i].weight
-					* weights_len[k].weight
-					* weights_rat[j].weight
-					* pow(weights_rad[i].value,2) * weights_rat[j].value
-					* weights_len[k].value;
-				norm += weights_rad[i].weight
-					* weights_len[k].weight
-					* weights_rat[j].weight;
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double EllipticalCylinderModel :: operator()(double qx, double qy) {
-	EllipticalCylinderParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.r_minor    = r_minor();
-	dp.r_ratio    = r_ratio();
-	dp.length     = length();
-	dp.sldCyl   = sldCyl();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.cyl_theta  = cyl_theta();
-	dp.cyl_phi    = cyl_phi();
-	dp.cyl_psi    = cyl_psi();
-
-	// Get the dispersion points for the r_minor
-	vector<WeightPoint> weights_rad;
-	r_minor.get_weights(weights_rad);
-
-	// Get the dispersion points for the r_ratio
-	vector<WeightPoint> weights_rat;
-	r_ratio.get_weights(weights_rat);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	cyl_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	cyl_phi.get_weights(weights_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_psi;
-	cyl_psi.get_weights(weights_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over minor radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.r_minor = weights_rad[i].value;
-
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp.length = weights_len[j].value;
-
-			// Loop over r_ration weight points
-			for(size_t m=0; m<weights_rat.size(); m++) {
-				dp.r_ratio = weights_rat[m].value;
-
-			// Average over theta distribution
-			for(size_t k=0; k<weights_theta.size(); k++) {
-				dp.cyl_theta = weights_theta[k].value;
-
-				// Average over phi distribution
-				for(size_t l=0; l<weights_phi.size(); l++) {
-					dp.cyl_phi = weights_phi[l].value;
-
-				// Average over phi distribution
-				for(size_t o=0; o<weights_psi.size(); o++) {
-					dp.cyl_psi = weights_psi[o].value;
-					//Un-normalize by volume
-					double _ptvalue = weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_rat[m].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight
-						* weights_psi[o].weight
-						* elliptical_cylinder_analytical_2DXY(&dp, qx, qy)
-						* pow(weights_rad[i].value,2)
-						* weights_len[j].value
-						* weights_rat[m].value;
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(sin(weights_theta[k].value*pi/180.0));
-					}
-					sum += _ptvalue;
-					//Find average volume
-					vol += weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_rat[m].weight
-						* pow(weights_rad[i].value,2)
-						* weights_len[j].value
-						* weights_rat[m].value;
-					//Find norm for volume
-					norm_vol += weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_rat[m].weight;
-
-					norm += weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_rat[m].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight
-						* weights_psi[o].weight;
-
-				}
-				}
-			}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double EllipticalCylinderModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double EllipticalCylinderModel :: calculate_ER() {
-	EllipticalCylinderParameters dp;
-	dp.r_minor    = r_minor();
-	dp.r_ratio    = r_ratio();
-	dp.length     = length();
-	double rad_out = 0.0;
-	double suf_rad = sqrt(dp.r_minor*dp.r_minor*dp.r_ratio);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the r_minor
-	vector<WeightPoint> weights_rad;
-	r_minor.get_weights(weights_rad);
-
-	// Get the dispersion points for the r_ratio
-	vector<WeightPoint> weights_rat;
-	r_ratio.get_weights(weights_rat);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Loop over minor radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.r_minor = weights_rad[i].value;
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp.length = weights_len[j].value;
-
-			// Loop over r_ration weight points
-			for(size_t m=0; m<weights_rat.size(); m++) {
-				dp.r_ratio = weights_rat[m].value;
-				//Calculate surface averaged radius
-				suf_rad = sqrt(dp.r_minor * dp.r_minor * dp.r_ratio);
-
-				//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-				sum +=weights_rad[i].weight *weights_len[j].weight
-					* weights_rat[m].weight*DiamCyl(dp.length, suf_rad)/2.0;
-				norm += weights_rad[i].weight *weights_len[j].weight* weights_rat[m].weight;
-			}
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.length, suf_rad)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/fcc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/fcc.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,208 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "fcc.h"
-}
-
-FCCrystalModel :: FCCrystalModel() {
-	scale      = Parameter(1.0);
-	dnn		= Parameter(220.0);
-	d_factor = Parameter(0.06);
-	radius     = Parameter(40.0, true);
-	radius.set_min(0.0);
-	sldSph   = Parameter(3.0e-6);
-	sldSolv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	theta  = Parameter(0.0, true);
-	phi    = Parameter(0.0, true);
-	psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FCCrystalModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = dnn();
-	dp[2] = d_factor();
-	dp[3] = radius();
-	dp[4] = sldSph();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double result;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[3] = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		result = FCC_ParaCrystal(dp, q) * pow(weights_rad[i].value,3);
-		// This FIXES a singualrity the kernel in libigor.
-		if ( result == INFINITY || result == NAN){
-			result = 0.0;
-		}
-		sum += weights_rad[i].weight
-			* result;
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double FCCrystalModel :: operator()(double qx, double qy) {
-	FCParameters dp;
-	dp.scale      = scale();
-	dp.dnn   = dnn();
-	dp.d_factor   = d_factor();
-	dp.radius  = radius();
-	dp.sldSph   = sldSph();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.theta  = theta();
-	dp.phi    = phi();
-	dp.psi    = psi();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	phi.get_weights(weights_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_psi;
-	psi.get_weights(weights_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.radius = weights_rad[i].value;
-		// Average over theta distribution
-		for(size_t j=0; j< weights_theta.size(); j++) {
-			dp.theta = weights_theta[j].value;
-			// Average over phi distribution
-			for(size_t k=0; k< weights_phi.size(); k++) {
-				dp.phi = weights_phi[k].value;
-				// Average over phi distribution
-				for(size_t l=0; l< weights_psi.size(); l++) {
-					dp.psi = weights_psi[l].value;
-					//Un-normalize SphereForm by volume
-					double _ptvalue = weights_rad[i].weight
-										* weights_theta[j].weight
-										* weights_phi[k].weight
-										* weights_psi[l].weight
-										* fc_analytical_2DXY(&dp, qx, qy);
-										//* pow(weights_rad[i].value,3.0);
-					// Consider when there is infinte or nan.
-					if ( _ptvalue == INFINITY || _ptvalue == NAN){
-						_ptvalue = 0.0;
-					}
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(sin(weights_theta[j].value*pi/180.0));
-					}
-					sum += _ptvalue;
-					// This model dose not need the volume of spheres correction!!!
-					norm += weights_rad[i].weight
-							* weights_theta[j].weight
-							* weights_phi[k].weight
-							* weights_psi[l].weight;
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the FCCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FCCrystalModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FCCrystalModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/flexcyl_ellipX.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/flexcyl_ellipX.cpp	(revision 8dcfb2e37f2ff15b26dbf167a56b2cb78a77f1bd)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "flexcyl_ellipX.h"
-}
-
-FlexCylEllipXModel :: FlexCylEllipXModel() {
-	scale      = Parameter(1.0);
-	length     = Parameter(1000.0, true);
-	length.set_min(0.0);
-	kuhn_length = Parameter(100.0, true);
-	kuhn_length.set_min(0.0);
-	radius  = Parameter(20.0, true);
-	radius.set_min(0.0);
-	axis_ratio = Parameter(1.5);
-	axis_ratio.set_min(0.0);
-	sldCyl   = Parameter(1.0e-6);
-	sldSolv   = Parameter(6.3e-6);
-	background = Parameter(0.0001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FlexCylEllipXModel :: operator()(double q) {
-	double dp[8];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = length();
-	dp[2] = kuhn_length();
-	dp[3] = radius();
-	dp[4] = axis_ratio();
-	dp[5] = sldCyl();
-	dp[6] = sldSolv();
-	dp[7] = 0.0;
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Get the dispersion points for the kuhn_length
-	vector<WeightPoint> weights_kuhn;
-	kuhn_length.get_weights(weights_kuhn);
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the axis_ratio
-	vector<WeightPoint> weights_ratio;
-	axis_ratio.get_weights(weights_ratio);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over length weight points
-	for(int i=0; i< (int)weights_len.size(); i++) {
-		dp[1] = weights_len[i].value;
-
-		// Loop over kuhn_length weight points
-		for(int j=0; j< (int)weights_kuhn.size(); j++) {
-			dp[2] = weights_kuhn[j].value;
-
-			// Loop over radius weight points
-			for(int k=0; k< (int)weights_rad.size(); k++) {
-				dp[3] = weights_rad[k].value;
-				// Loop over axis_ratio weight points
-				for(int l=0; l< (int)weights_ratio.size(); l++) {
-					dp[4] = weights_ratio[l].value;
-
-					//Un-normalize by volume
-					sum += weights_len[i].weight * weights_kuhn[j].weight*weights_rad[k].weight
-						* weights_ratio[l].weight * FlexCyl_Ellip(dp, q)
-						* (pow(weights_rad[k].value,2.0) * weights_ratio[l].value * weights_len[i].value);
-					//Find weighted volume
-					vol += weights_rad[k].weight * weights_kuhn[j].weight
-						* weights_len[i].weight * weights_ratio[l].weight
-						*pow(weights_rad[k].value,2.0)* weights_ratio[l].weight*weights_len[i].value;
-					norm += weights_len[i].weight * weights_kuhn[j].weight
-						*weights_rad[k].weight* weights_ratio[l].weight;
-				}
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double FlexCylEllipXModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FlexCylEllipXModel :: evaluate_rphi(double q, double phi) {
-	//double qx = q*cos(phi);
-	//double qy = q*sin(phi);
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FlexCylEllipXModel :: calculate_ER() {
-	FlexCylEXParameters dp;
-
-	dp.radius  = radius();
-	dp.length     = length();
-	dp.axis_ratio  = axis_ratio();
-
-	double rad_out = 0.0;
-	double suf_rad = sqrt(dp.radius*dp.radius*dp.axis_ratio );
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the total length
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Get the dispersion points for minor radius
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Get the dispersion points for axis ratio = major_radius/minor_radius
-	vector<WeightPoint> weights_ratio ;
-	axis_ratio.get_weights(weights_ratio);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_length.size(); i++) {
-		dp.length = weights_length[i].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			// Loop over axis_ratio weight points
-			for(int l=0; l< (int)weights_ratio.size(); l++) {
-				dp.axis_ratio = weights_ratio[l].value;
-				suf_rad = sqrt(dp.radius  * dp.radius  * dp.axis_ratio);
-				//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-				sum +=weights_length[i].weight * weights_radius[k].weight
-						* weights_ratio[l].weight *DiamCyl(dp.length,suf_rad)/2.0;
-				norm += weights_length[i].weight* weights_radius[k].weight* weights_ratio[l].weight;
-			}
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.length,suf_rad)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/flexiblecylinder.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/flexiblecylinder.cpp	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- *	TODO: add 2d
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "flexible_cylinder.h"
-}
-
-FlexibleCylinderModel :: FlexibleCylinderModel() {
-	scale      = Parameter(1.0);
-	length     = Parameter(1000.0, true);
-	length.set_min(0.0);
-	kuhn_length = Parameter(100.0, true);
-	kuhn_length.set_min(0.0);
-	radius  = Parameter(20.0, true);
-	radius.set_min(0.0);
-	sldCyl   = Parameter(1.0e-6);
-	sldSolv   = Parameter(6.3e-6);
-	background = Parameter(0.0001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FlexibleCylinderModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = length();
-	dp[2] = kuhn_length();
-	dp[3] = radius();
-	dp[4] = sldCyl();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Get the dispersion points for the kuhn_length
-	vector<WeightPoint> weights_kuhn;
-	kuhn_length.get_weights(weights_kuhn);
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over semi axis A weight points
-	for(int i=0; i< (int)weights_len.size(); i++) {
-		dp[1] = weights_len[i].value;
-
-		// Loop over semi axis B weight points
-		for(int j=0; j< (int)weights_kuhn.size(); j++) {
-			dp[2] = weights_kuhn[j].value;
-
-			// Loop over semi axis C weight points
-			for(int k=0; k< (int)weights_rad.size(); k++) {
-				dp[3] = weights_rad[k].value;
-				//Un-normalize by volume
-				sum += weights_len[i].weight
-					* weights_kuhn[j].weight*weights_rad[k].weight * FlexExclVolCyl(dp, q)
-					* pow(weights_rad[k].value,2.0)*weights_len[i].value;
-				//Find average volume
-				vol += weights_rad[k].weight
-					* weights_len[i].weight
-					* weights_kuhn[j].weight
-					*pow(weights_rad[k].value,2.0)*weights_len[i].value;
-				norm += weights_len[i].weight
-					* weights_kuhn[j].weight*weights_rad[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double FlexibleCylinderModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FlexibleCylinderModel :: evaluate_rphi(double q, double phi) {
-	//double qx = q*cos(phi);
-	//double qy = q*sin(phi);
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FlexibleCylinderModel :: calculate_ER() {
-	FlexibleCylinderParameters dp;
-
-	dp.radius  = radius();
-	dp.length     = length();
-
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_length.size(); i++) {
-		dp.length = weights_length[i].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-			sum +=weights_length[i].weight
-				* weights_radius[k].weight*DiamCyl(dp.length,dp.radius)/2.0;
-			norm += weights_length[i].weight* weights_radius[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.length,dp.radius)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/fractal.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/fractal.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libTwoPhase.h"
-	#include "fractal.h"
-}
-
-FractalModel :: FractalModel() {
-	scale      = Parameter(1.0);
-    radius = Parameter(5.0, true);
-    radius.set_min(0.0);
-    fractal_dim = Parameter(2.0);
-    cor_length = Parameter(100.0);
-    sldBlock = Parameter(2.0e-6);
-    sldSolv= Parameter(6.35e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FractalModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = fractal_dim();
-	dp[3] = cor_length();
-	dp[4] = sldBlock();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		//Un-normalize Fractal by volume
-		sum += weights_rad[i].weight
-			* Fractal(dp, fabs(q)) * pow(weights_rad[i].value,3);
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double FractalModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the FractalModel
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FractalModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FractalModel :: calculate_ER() {
-	//NOT implemented yet!!! 'cause None shape Model
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/fuzzysphere.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/fuzzysphere.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "fuzzysphere.h"
-}
-
-FuzzySphereModel :: FuzzySphereModel() {
-	scale      = Parameter(0.01);
-	radius     = Parameter(60.0, true);
-	radius.set_min(0.0);
-	fuzziness  = Parameter(10.0);
-	fuzziness.set_min(0.0);
-	sldSph   = Parameter(1.0e-6);
-	sldSolv   = Parameter(3.0e-6);
-	background = Parameter(0.001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FuzzySphereModel :: operator()(double q) {
-	double dp[6];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = fuzziness();
-	dp[3] = sldSph();
-	dp[4] = sldSolv();
-	dp[5] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-
-	// Get the dispersion points for the fuzziness
-	vector<WeightPoint> weights_fuzziness;
-	fuzziness.get_weights(weights_fuzziness);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_radius.size(); i++) {
-		dp[1] = weights_radius[i].value;
-		// Loop over fuzziness weight points
-		for(size_t j=0; j<weights_fuzziness.size(); j++) {
-			dp[2] = weights_fuzziness[j].value;
-
-			//Un-normalize SphereForm by volume
-			sum += weights_radius[i].weight * weights_fuzziness[j].weight
-				* fuzzysphere_kernel(dp, q) * pow(weights_radius[i].value,3);
-			//Find average volume : Note the fuzziness has no contribution to the volume
-			vol += weights_radius[i].weight
-				* pow(weights_radius[i].value,3);
-
-			norm += weights_radius[i].weight * weights_fuzziness[j].weight;
-			norm_vol += weights_radius[i].weight;
-		}
-	}
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double FuzzySphereModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FuzzySphereModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FuzzySphereModel :: calculate_ER() {
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the radius
-	// No need to consider the fuzziness.
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-	// Loop over radius weight points to average the radius value
-	for(size_t i=0; i<weights_radius.size(); i++) {
-		sum += weights_radius[i].weight
-			* weights_radius[i].value;
-		norm += weights_radius[i].weight;
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = radius();}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/gamma_win.c
===================================================================
--- sansmodels/src/sans/models/c_models/gamma_win.c	(revision 1a31715ed27b49ae7d0fd4e77b50853f39f14fab)
+++ 	(revision )
@@ -1,141 +1,0 @@
-// Visit http://www.johndcook.com/stand_alone_code.html for the source of this code and more like it.
-// Modified for the DANSE project.
-
-#include <math.h>
-
-#include "gamma_win.h"
-
-// Note that the functions Gamma and LogGamma are mutually dependent.
-
-double gamma(double x)
-{
-  // Split the function domain into three intervals:
-  // (0, 0.001), [0.001, 12), and (12, infinity)
-
-  ///////////////////////////////////////////////////////////////////////////
-  // First interval: (0, 0.001)
-  //
-  // For small x, 1/Gamma(x) has power series x + gamma x^2  - ...
-  // So in this range, 1/Gamma(x) = x + gamma x^2 with error on the order of x^3.
-  // The relative error over this interval is less than 6e-7.
-
-  const double gamma = 0.577215664901532860606512090; // Euler's gamma constant
-  double y;
-  int arg_was_less_than_one = 0;
-  int n = 0;
-  // numerator coefficients for approximation over the interval (1,2)
-  static const double p[] =
-  {
-      -1.71618513886549492533811E+0,
-       2.47656508055759199108314E+1,
-      -3.79804256470945635097577E+2,
-       6.29331155312818442661052E+2,
-       8.66966202790413211295064E+2,
-      -3.14512729688483675254357E+4,
-      -3.61444134186911729807069E+4,
-       6.64561438202405440627855E+4
-  };
-  // denominator coefficients for approximation over the interval (1,2)
-  static const double q[] =
-  {
-      -3.08402300119738975254353E+1,
-       3.15350626979604161529144E+2,
-      -1.01515636749021914166146E+3,
-      -3.10777167157231109440444E+3,
-       2.25381184209801510330112E+4,
-       4.75584627752788110767815E+3,
-      -1.34659959864969306392456E+5,
-      -1.15132259675553483497211E+5
-  };
-  double num = 0.0;
-  double den = 1.0;
-  int i;
-  double z;
-  double result;
-
-  if (x < 0.001)
-      return 1.0/(x*(1.0 + gamma*x));
-
-  ///////////////////////////////////////////////////////////////////////////
-  // Second interval: [0.001, 12)
-
-  if (x < 12.0)
-    {
-      // The algorithm directly approximates gamma over (1,2) and uses
-      // reduction identities to reduce other arguments to this interval.
-
-      y = x;
-
-      if (y < 1.0) arg_was_less_than_one = 1;
-
-      // Add or subtract integers as necessary to bring y into (1,2)
-      // Will correct for this below
-      if (arg_was_less_than_one==1) {
-          y += 1.0;
-      } else {
-          n = (int) (floor(y)) - 1;  // will use n later
-          y -= n;
-      }
-
-      z = y - 1;
-      for (i = 0; i < 8; i++) {
-          num = (num + p[i])*z;
-          den = den*z + q[i];
-      }
-      result = num/den + 1.0;
-
-      // Apply correction if argument was not initially in (1,2)
-      if (arg_was_less_than_one==1) {
-          // Use identity gamma(z) = gamma(z+1)/z
-          // The variable "result" now holds gamma of the original y + 1
-          // Thus we use y-1 to get back the orginal y.
-          result /= (y-1.0);
-      } else {
-          // Use the identity gamma(z+n) = z*(z+1)* ... *(z+n-1)*gamma(z)
-          for (i = 0; i < n; i++)
-              result *= y++;
-      }
-
-      return result;
-    }
-
-    return exp(lgamma(x));
-}
-
-double lgamma (double x)
-{
-  static const double c[8] =
-  {
-   1.0/12.0,
-  -1.0/360.0,
-  1.0/1260.0,
-  -1.0/1680.0,
-  1.0/1188.0,
-  -691.0/360360.0,
-  1.0/156.0,
-  -3617.0/122400.0
-  };
-  double z = 1.0/(x*x);
-  double sum = c[7];
-  static const double halfLogTwoPi = 0.91893853320467274178032973640562;
-  double series;
-  double logGamma;
-  int i;
-
-  if (x < 12.0) {
-     return log(fabs(gamma(x)));
-  }
-
-  // Abramowitz and Stegun 6.1.41
-  // Asymptotic series should be good to at least 11 or 12 figures
-  // For error analysis, see Whittiker and Watson
-  // A Course in Modern Analysis (1927), page 252
-
-  for (i=6; i >= 0; i--) {
-      sum *= z;
-      sum += c[i];
-  }
-  series = sum/x;
-  logGamma = (x - 0.5)*log(x) - x + halfLogTwoPi + series;
-  return logGamma;
-}
Index: sansmodels/src/sans/models/c_models/gamma_win.h
===================================================================
--- sansmodels/src/sans/models/c_models/gamma_win.h	(revision 2c63e80ef62befde3fa23ebbed7e0649985d92b5)
+++ 	(revision )
@@ -1,19 +1,0 @@
-// Visit http://www.johndcook.com/stand_alone_code.html for the source of this code and more like it.
-
-#ifndef GAMMA_H
-#define GAMMA_H
-
-// Note that the functions Gamma and LogGamma are mutually dependent.
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-double lgamma(double);
-double gamma(double);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
Index: sansmodels/src/sans/models/c_models/hollowcylinder.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/hollowcylinder.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,288 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "hollow_cylinder.h"
-}
-
-HollowCylinderModel :: HollowCylinderModel() {
-	scale      = Parameter(1.0);
-	core_radius = Parameter(20.0, true);
-	core_radius.set_min(0.0);
-	radius  = Parameter(30.0, true);
-	radius.set_min(0.0);
-	length     = Parameter(400.0, true);
-	length.set_min(0.0);
-	sldCyl  = Parameter(6.3e-6);
-	sldSolv  = Parameter(1.0e-6);
-	background = Parameter(0.0);
-	axis_theta = Parameter(0.0, true);
-	axis_phi   = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double HollowCylinderModel :: operator()(double q) {
-	double dp[7];
-
-	dp[0] = scale();
-	dp[1] = core_radius();
-	dp[2] = radius();
-	dp[3] = length();
-	dp[4] = sldCyl();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the core radius
-	vector<WeightPoint> weights_core_radius;
-	core_radius.get_weights(weights_core_radius);
-
-	// Get the dispersion points for the shell radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over core radius weight points
-	for(int i=0; i< (int)weights_core_radius.size(); i++) {
-		dp[1] = weights_core_radius[i].value;
-
-		// Loop over length weight points
-		for(int j=0; j< (int)weights_length.size(); j++) {
-			dp[3] = weights_length[j].value;
-
-			// Loop over shell radius weight points
-			for(int k=0; k< (int)weights_radius.size(); k++) {
-				dp[2] = weights_radius[k].value;
-				//Un-normalize  by volume
-				sum += weights_core_radius[i].weight
-					* weights_length[j].weight
-					* weights_radius[k].weight
-					* HollowCylinder(dp, q)
-					* (pow(weights_radius[k].value,2)-pow(weights_core_radius[i].value,2))
-					* weights_length[j].value;
-				//Find average volume
-				vol += weights_core_radius[i].weight
-					* weights_length[j].weight
-					* weights_radius[k].weight
-					* (pow(weights_radius[k].value,2)-pow(weights_core_radius[i].value,2))
-					* weights_length[j].value;
-
-				norm += weights_core_radius[i].weight
-					* weights_length[j].weight
-					* weights_radius[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double HollowCylinderModel :: operator()(double qx, double qy) {
-	HollowCylinderParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.core_radius     = core_radius();
-	dp.radius  = radius();
-	dp.length     = length();
-	dp.sldCyl   = sldCyl();
-	dp.sldSolv  = sldSolv();
-	dp.background = 0.0;
-	dp.axis_theta = axis_theta();
-	dp.axis_phi   = axis_phi();
-
-	// Get the dispersion points for the core radius
-	vector<WeightPoint> weights_core_radius;
-	core_radius.get_weights(weights_core_radius);
-
-	// Get the dispersion points for the shell radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	axis_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	axis_phi.get_weights(weights_phi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over core radius weight points
-	for(int i=0; i<(int)weights_core_radius.size(); i++) {
-		dp.core_radius = weights_core_radius[i].value;
-
-
-		// Loop over length weight points
-		for(int j=0; j<(int)weights_length.size(); j++) {
-			dp.length = weights_length[j].value;
-
-			// Loop over shell radius weight points
-			for(int m=0; m< (int)weights_radius.size(); m++) {
-				dp.radius = weights_radius[m].value;
-
-			// Average over theta distribution
-			for(int k=0; k< (int)weights_theta.size(); k++) {
-				dp.axis_theta = weights_theta[k].value;
-
-				// Average over phi distribution
-				for(int l=0; l< (int)weights_phi.size(); l++) {
-					dp.axis_phi = weights_phi[l].value;
-					//Un-normalize by volume
-					double _ptvalue = weights_core_radius[i].weight
-						* weights_length[j].weight
-						* weights_radius[m].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight
-						* hollow_cylinder_analytical_2DXY(&dp, qx, qy)
-						/ ((pow(weights_radius[m].value,2)-pow(weights_core_radius[i].value,2))
-						* weights_length[j].value);
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(sin(weights_theta[k].value * pi/180.0));
-					}
-					sum += _ptvalue;
-					//Find average volume
-					vol += weights_core_radius[i].weight
-						* weights_length[j].weight
-						* weights_radius[m].weight
-						* (pow(weights_radius[m].value,2)-pow(weights_core_radius[i].value,2))
-						* weights_length[j].value;
-					//Find norm for volume
-					norm_vol += weights_core_radius[i].weight
-						* weights_length[j].weight
-						* weights_radius[m].weight;
-
-					norm += weights_core_radius[i].weight
-						* weights_length[j].weight
-						* weights_radius[m].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight;
-
-				}
-			}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm/asin(1.0);
-	if (vol != 0.0 || norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum*(vol/norm_vol);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the  cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double HollowCylinderModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double HollowCylinderModel :: calculate_ER() {
-	HollowCylinderParameters dp;
-
-	dp.radius  = radius();
-	dp.length     = length();
-
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_length.size(); i++) {
-		dp.length = weights_length[i].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-			sum +=weights_length[i].weight
-				* weights_radius[k].weight*DiamCyl(dp.length,dp.radius)/2.0;
-			norm += weights_length[i].weight* weights_radius[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.length,dp.radius)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/lamellar.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellar.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-//	#include "libCylinder.h"
-	#include "lamellar.h"
-}
-
-LamellarModel :: LamellarModel() {
-	scale      = Parameter(1.0);
-	bi_thick     = Parameter(50.0, true);
-	bi_thick.set_min(0.0);
-	sld_bi    = Parameter(1.0e-6);
-	sld_sol    = Parameter(6.3e-6);
-	background = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarModel :: operator()(double q) {
-	double dp[5];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = bi_thick();
-	dp[2] = sld_bi();
-	dp[3] = sld_sol();
-	dp[4] = 0.0;
-
-	// Get the dispersion points for the bi_thick
-	vector<WeightPoint> weights_bi_thick;
-	bi_thick.get_weights(weights_bi_thick);
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over short_edgeA weight points
-	for(int i=0; i< (int)weights_bi_thick.size(); i++) {
-		dp[1] = weights_bi_thick[i].value;
-
-		sum += weights_bi_thick[i].weight * lamellar_kernel(dp, q);
-		norm += weights_bi_thick[i].weight;
-
-	}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-
-double LamellarModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarModel :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "lamellarFF_HG.h"
-}
-
-LamellarFFHGModel :: LamellarFFHGModel() {
-	scale      = Parameter(1.0);
-	t_length     = Parameter(15.0, true);
-	t_length.set_min(0.0);
-	h_thickness    = Parameter(10.0, true);
-	h_thickness.set_min(0.0);
-	sld_tail   = Parameter(4e-7);
-	sld_head  = Parameter(3e-6);
-	sld_solvent    = Parameter(6e-6);
-	background = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarFFHGModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = t_length();
-	dp[2] = h_thickness();
-	dp[3] = sld_tail();
-	dp[4] = sld_head();
-	dp[5] = sld_solvent();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the tail length
-	vector<WeightPoint> weights_t_length;
-	t_length.get_weights(weights_t_length);
-
-	// Get the dispersion points for the head thickness
-	vector<WeightPoint> weights_h_thickness;
-	h_thickness.get_weights(weights_h_thickness);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over semi axis A weight points
-	for(int i=0; i< (int)weights_t_length.size(); i++) {
-		dp[1] = weights_t_length[i].value;
-
-		for (int j=0; j< (int)weights_h_thickness.size(); j++){
-			dp[2] = weights_h_thickness[j].value;
-
-			sum += weights_t_length[i].weight* weights_h_thickness[j].weight*LamellarFF_HG(dp, q);
-			norm += weights_t_length[i].weight* weights_h_thickness[j].weight;
-		}
-
-	}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-
-double LamellarFFHGModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarFFHGModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarFFHGModel :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/lamellarPC.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPC.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "lamellarPC.h"
-}
-
-LamellarPCrystalModel :: LamellarPCrystalModel() {
-	scale      = Parameter(1.0);
-	thickness     = Parameter(33.0, true);
-	thickness.set_min(0.0);
-	Nlayers    = Parameter(20.0, true);
-	Nlayers.set_min(0.0);
-	spacing   = Parameter(250);
-	pd_spacing   = Parameter(0.0);
-	sld_layer  = Parameter(1.0e-6);
-	sld_solvent    = Parameter(6.34e-6);
-	background = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarPCrystalModel :: operator()(double q) {
-	double dp[8];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = thickness();
-	dp[2] = Nlayers();
-	dp[3] = spacing();
-	dp[4] = pd_spacing();
-	dp[5] = sld_layer();
-	dp[6] = sld_solvent();
-	dp[7] = 0.0; // Do not apply background here.
-
-	// Get the dispersion points for the head thickness
-	vector<WeightPoint> weights_thickness;
-	thickness.get_weights(weights_thickness);
-
-	// Let's provide from the func which is more accurate especially for small q region.
-	// Get the dispersion points for the tail length
-	//vector<WeightPoint> weights_spacing;
-	//spacing.get_weights(weights_spacing);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over thickness and spacing weight points
-	for(int i=0; i< (int)weights_thickness.size(); i++) {
-		dp[1] = weights_thickness[i].value;
-		//for (int j=0; j< (int)weights_spacing.size(); j++){
-			//dp[3] = weights_spacing[j].value;
-			sum += weights_thickness[i].weight*Lamellar_ParaCrystal(dp, q);
-			norm += weights_thickness[i].weight;
-		//}
-	}
-	//apply norm and background
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-
-double LamellarPCrystalModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the lamellar
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarPCrystalModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarPCrystalModel :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/lamellarPS.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPS.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- *	TODO: add 2D function
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "lamellarPS.h"
-}
-
-LamellarPSModel :: LamellarPSModel() {
-	scale      = Parameter(1.0);
-	spacing    = Parameter(400.0, true);
-	spacing.set_min(0.0);
-	delta     = Parameter(30.0);
-	delta.set_min(0.0);
-	sld_bi   = Parameter(6.3e-6);
-	sld_sol   = Parameter(1.0e-6);
-	n_plates     = Parameter(20.0);
-	caille = Parameter(0.1);
-	background = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarPSModel :: operator()(double q) {
-	double dp[8];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = spacing();
-	dp[2] = delta();
-	dp[3] = sld_bi();
-	dp[4] = sld_sol();
-	dp[5] = n_plates();
-	dp[6] = caille();
-	dp[7] = 0.0;
-
-
-	// 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
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over short_edgeA weight points
-	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 * weights_delta[j].weight * LamellarPS_kernel(dp, q);
-			norm += weights_spacing[i].weight * weights_delta[j].weight;
-		}
-	}
-	return sum/norm + background();
-}
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double LamellarPSModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarPSModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarPSModel :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
-
Index: sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,183 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- *	TODO: add 2D function
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "lamellarPS_HG.h"
-}
-
-LamellarPSHGModel :: LamellarPSHGModel() {
-	scale      = Parameter(1.0);
-	spacing    = Parameter(40.0, true);
-	spacing.set_min(0.0);
-	deltaT     = Parameter(10.0, true);
-	deltaT.set_min(0.0);
-	deltaH     = Parameter(2.0, true);
-	deltaH.set_min(0.0);
-	sld_tail    = Parameter(4e-7);
-	sld_head    = Parameter(2e-6);
-	sld_solvent   = Parameter(6e-6);
-	n_plates     = Parameter(30);
-	caille = Parameter(0.001);
-	background = Parameter(0.001);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarPSHGModel :: operator()(double q) {
-	double dp[10];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = spacing();
-	dp[2] = deltaT();
-	dp[3] = deltaH();
-	dp[4] = sld_tail();
-	dp[5] = sld_head();
-	dp[6] = sld_solvent();
-	dp[7] = n_plates();
-	dp[8] = caille();
-	dp[9] = 0.0;
-
-
-	// Get the dispersion points for (deltaT) thickness of the tail
-	vector<WeightPoint> weights_deltaT;
-	deltaT.get_weights(weights_deltaT);
-
-	// Get the dispersion points for (deltaH) thickness of the head
-	vector<WeightPoint> weights_deltaH;
-	deltaH.get_weights(weights_deltaH);
-
-	// Get the dispersion points for spacing
-	vector<WeightPoint> weights_spacing;
-	spacing.get_weights(weights_spacing);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over deltaT  weight points
-	for(int i=0; i< (int)weights_deltaT.size(); i++) {
-		dp[2] = weights_deltaT[i].value;
-
-		// Loop over deltaH weight points
-		for(int j=0; j< (int)weights_deltaH.size(); j++) {
-			dp[3] = weights_deltaH[j].value;
-			// Loop over spacing weight points
-			for(int k=0; k< (int)weights_spacing.size(); k++) {
-				dp[1] = weights_spacing[k].value;
-
-				sum += weights_deltaT[i].weight * weights_deltaH[j].weight *weights_spacing[k].weight
-								*LamellarPS_HG(dp, q);
-				norm += weights_deltaT[i].weight * weights_deltaH[j].weight * weights_spacing[k].weight;
-			}
-		}
-	}
-	return sum/norm + background();
-}
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double LamellarPSHGModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the lamellarPS_HG
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarPSHGModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarPSHGModel :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
-
-/*
-double LamellarPSHGModel :: operator()(double qx, double qy) {
-	LamellarPSHGParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.spacing   = spacing();
-	dp.deltaT  = deltaT();
-	dp.deltaH = deltaH();
-	dp.sld_tail   = sld_tail();
-	dp.sld_head = sld_head();
-	dp.sld_solvent   = sld_solvent();
-	dp.n_plates = n_plates();
-	dp.caille = caille();
-	dp.background    = background();
-
-	// Get the dispersion points for the deltaT
-	vector<WeightPoint> weights_deltaT;
-	deltaT.get_weights(weights_deltaT);
-
-	// Get the dispersion points for the deltaH
-	vector<WeightPoint> weights_deltaH;
-	deltaH.get_weights(weights_deltaH);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over deltaT weight points
-	for(int i=0; i< (int)weights_deltaT.size(); i++) {
-		dp.deltaT = weights_deltaT[i].value;
-
-		// Loop over deltaH weight points
-		for(int j=0; j< (int)weights_deltaH.size(); j++) {
-			dp.deltaH = weights_deltaH[j].value;
-
-			sum += weights_deltaT[i].weight *weights_deltaH[j].weight *lamellarPS_HG_analytical_2DXY(&dp, qx, qy);
-			norm += weights_deltaT[i].weight * weights_deltaH[j].weight;
-		}
-	}
-	return sum/norm + background();
-}
-*/
-
-
Index: sansmodels/src/sans/models/c_models/lineparser.py
===================================================================
--- sansmodels/src/sans/models/c_models/lineparser.py	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
+++ 	(revision )
@@ -1,221 +1,0 @@
-#!/usr/bin/env python
-""" WrapperGenerator class to generate model code automatically.
-"""
-
-import os, sys,re
-def split_list(separator, mylist, n=0):
-    """
-        @return a list of string without white space of separator
-        @param separator: the string to remove
-    """
-    list=[]
-    for item in mylist:
-        if re.search( separator,item)!=None:
-            if n >0:
-                word =re.split(separator,item,int(n))
-            else:
-                word =re.split( separator,item)
-            for new_item in word: 
-                if new_item.lstrip().rstrip() !='':
-                    list.append(new_item.lstrip().rstrip())
-    return list
-def split_text(separator, string1, n=0):
-    """
-        @return a list of string without white space of separator
-        @param separator: the string to remove
-    """
-    list=[]
-    if re.search( separator,string1)!=None:
-        if n >0:
-            word =re.split(separator,string1,int(n))
-        else:
-            word =re.split(separator,string1)
-        for item in word: 
-            if item.lstrip().rstrip() !='':
-                list.append(item.lstrip().rstrip())
-    return list
-def look_for_tag( string1,begin, end=None ):
-    """
-        @note: this method  remove the begin and end tags given by the user
-        from the string .
-        @param begin: the initial tag
-        @param end: the final tag
-        @param string: the string to check
-        @return: begin_flag==True if begin was found,
-         end_flag==if end was found else return false, false
-         
-    """
-    begin_flag= False
-    end_flag= False
-    if  re.search( begin,string1)!=None:
-        begin_flag= True
-    if end !=None:
-        if  re.search(end,string1)!=None:
-            end_flag= True
-    return begin_flag, end_flag
-
-
-  
-def readhelper(lines,key, key2,key3 , file):
-  
-    temp=""
-    # flag to found key
-    find_fixed= False
-    find_key2=False
-    find_key3=False
-    listtofill=[]
-    for line in lines:
-        if line.count(key.lstrip().rstrip())>0 :#[FIXED]= .....
-            try:
-                #print "found key", key
-                find_fixed= True
-                index = line.index(key)
-                toks  = line[index:].split("=",1 )
-                temp  = toks[1].lstrip().rstrip()
-                find_key2, find_key3=look_for_tag( string1=temp,begin=key2, end=key3 )
-                #print "looking for endpoints",find_key2, find_key3
-                ##[key]=<text>param </text>
-                if find_key2 and find_key3:
-                    
-                    temp1=[]
-                    temp2=[]
-                    temp3=[]
-                    temp4=[]
-                    temp1=split_text(separator=key2, string1=temp)
-                    temp2=split_list(separator=key3, mylist=temp1)
-                    temp3=split_list(separator=';', mylist=temp2)
-                    temp4=split_list(separator=',', mylist=temp3)
-                    listtofill= temp3 + temp4
-                    #print "endpoints found",listtofill
-                    return listtofill
-                    
-                    
-                elif find_key2 and not find_key3:
-                    ## [key]= key2(<text>)
-                    ##        ....
-                    ##        key3(<text>)
-                    temp1=[]
-                    temp2=[]
-                    temp3=[]
-                    temp4=[]
-                    ## remove key2= <text>
-                    temp1=split_text(separator=key2, string1=temp)
-                    
-                    ## split ";" first
-                    temp3=split_list(separator=';', mylist=temp1)
-                    temp4=split_list(separator=',', mylist=temp3)
-            
-                    if len(temp3+ temp4)==0:
-                        # [FIXED]=  only one param
-                        listtofill+= temp1
-                    listtofill += temp3+temp4 
-               
-                elif not find_key2 and not find_key3 :
-                    ## [key]= param done looking
-                    temp3=[]
-                    temp4=[]
-                    if look_for_tag( string1=temp,begin=";")[0]:
-                        ## split ";" first
-                        temp3=split_text(separator=';',string1=temp)
-                        temp4=split_list(separator=',', mylist=temp3)
-                    else:
-                        ## slip "," first
-                        temp3=split_text(separator=',',string1=temp)
-                        temp4=split_list(separator=';', mylist=temp3)
-                    if len(temp3+ temp4)==0:
-                        ## [FIXED]=  only one param
-                        if temp.lstrip().rstrip()!="":
-                            listtofill= [temp.lstrip().rstrip()]
-                        
-                    listtofill += temp3+temp4
-                    return listtofill
-            except:
-                raise ValueError, "Could not parse file %s" % file
-        
-        elif find_fixed :
-            if not find_key2:
-                raise ValueError, "Could not parse file %s" % file
-            #print "find_key3",find_key3,line,key3
-            if find_key3:
-                #print "At the ned of the file----->"
-                temp1=[]
-                temp2=[]
-                temp3=[]
-                temp4=[]
-                temp5=[]
-               
-                temp1=split_text(separator=key3, string1=line)
-                temp2=split_list(separator='//',mylist=temp1)
-                temp5=split_list(separator="\*",mylist=temp1)
-                
-                if len(temp5)>0:
-                    temp3=split_list(separator=';',mylist=temp5)
-                    temp4=split_list(separator=',', mylist=temp5)
-                elif len(temp2)>0:
-                    temp3=split_list(separator=';',mylist=temp2)
-                    temp4=split_list(separator=',', mylist=temp2)
-                else:
-                    temp3=split_list(separator=';',mylist=temp1)
-                    temp4=split_list(separator=',', mylist=temp1)
-                
-                if len(temp3+ temp4)==0:# [FIXED]=  only one param
-                    listtofill+= temp1
-                listtofill+=temp3+temp4 #   
-                break
-            
-            else:
-                temp2=split_text(separator='//',string1=line)
-                temp5=split_text(separator="\*",string1=line)
-                if len(temp5)>0:
-                    temp3=split_list(separator=';',mylist=temp5)
-                    temp4=split_list(separator=',', mylist=temp5)
-                elif len(temp2)>0:
-                    temp3=split_list(separator=';',mylist=temp2)
-                    temp4=split_list(separator=',', mylist=temp2)
-                else:
-                    if look_for_tag( string1=line,begin=";")[0]:# split ";" first
-                        temp3=split_text(separator=';',string1=line)
-                        temp4=split_list(separator=',', mylist=temp3)
-                    else:
-                        temp3=split_text(separator=',',string1=line)# slip "," first
-                        temp4=split_list(separator=';', mylist=temp3)
-                if len(temp3+ temp4)==0:# [FIXED]=  only one param
-                    if line.lstrip().rstrip()!="":
-                        listtofill= [line.lstrip().rstrip()]
-                listtofill+=temp3+temp4 #
-                break
-    return listtofill
-   
-# main
-if __name__ == '__main__':
-    
-    # Read file
-    name= "sphere.h"
-    f = open("..\c_extensions\core_shell.h",'r')
-    buf = f.read()
-  
-    lines = buf.split('\n')
-  
-    ## Catch Fixed parameters
-    key = "[FIXED]"
-    #open item in this case Fixed
-    text='text'
-    key2="<%s>"%text.lower()
-    # close an item in this case fixed
-    text='TexT'
-    key3="</%s>"%text.lower()
-    listto=[]
-   
-    listto= readhelper(lines, key, key2,key3, file=name)
-    print "fixed parameters\n ",listto
-    print 
-    
-   
-    key0="[ORIENTATION_PARAMS]"
-   
-    listto=[]
-    listto= readhelper(lines,key0, key2,key3, file=name)
-    print "orientation parameters\n ",listto
-    print 
-    f.close()
-# End of file        
Index: sansmodels/src/sans/models/c_models/modelTemplate.txt
===================================================================
--- sansmodels/src/sans/models/c_models/modelTemplate.txt	(revision f578ad49072dc680aedb24801a4dd956cd5c4d42)
+++ 	(revision )
@@ -1,142 +1,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-#	This software was developed by the University of Tennessee as part of the
-#	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-#	project funded by the US National Science Foundation.
-#
-#	If you use DANSE applications to do scientific research that leads to
-#	publication, we ask that you acknowledge the use of the software with the
-#	following sentence:
-#
-#	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-#
-#	copyright 2008, University of Tennessee
-##############################################################################
-
-
-""" 
-Provide functionality for a C extension model
-
-:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
-         DO NOT MODIFY THIS FILE, MODIFY [INCLUDE_FILE]
-         AND RE-RUN THE GENERATOR SCRIPT
-
-"""
-
-from sans.models.BaseComponent import BaseComponent
-from sans.models.sans_extension.c_models import [CPYTHONCLASS]
-import copy    
-
-def create_[PYTHONCLASS]():
-    obj = [PYTHONCLASS]()
-    #[CPYTHONCLASS].__init__(obj) is called by [PYTHONCLASS] constructor
-    return obj
-
-class [PYTHONCLASS]([CPYTHONCLASS], BaseComponent):
-    """ 
-    Class that evaluates a [PYTHONCLASS] model. 
-    This file was auto-generated from [INCLUDE_FILE].
-    Refer to that file and the structure it contains
-    for details of the model.
-    [DEFAULT_LIST]
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        #apply([CPYTHONCLASS].__init__, (self,)) 
-        [CPYTHONCLASS].__init__(self)
-        
-        ## Name of the model
-        self.name = "[PYTHONCLASS]"
-        ## Model description
-        self.description ="""[DESCRIPTION]"""
-       
-        [PAR_DETAILS]
-        ## fittable parameters
-        self.fixed=[FIXED]
-        
-        ## non-fittable parameters
-        self.non_fittable = [NON_FITTABLE_PARAMS]
-        
-        ## parameters with orientation
-        self.orientation_params = [ORIENTATION_PARAMS]
-
-    def __setstate__(self, state):
-        """
-        restore the state of a model from pickle
-        """
-        self.__dict__, self.params, self.dispersion = state
-        
-    def __reduce_ex__(self, proto):
-        """
-        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of 
-        c model.
-        """
-        state = (self.__dict__, self.params, self.dispersion)
-        return (create_[PYTHONCLASS],tuple(), state, None, None)
-        
-    def clone(self):
-        """ Return a identical copy of self """
-        return self._clone([PYTHONCLASS]())   
-       	
-   
-    def run(self, x=0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q, or [q,phi]
-        
-        :return: scattering function P(q)
-        
-        """
-        
-        return [CPYTHONCLASS].run(self, x)
-   
-    def runXY(self, x=0.0):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        :param x: input q, or [qx, qy]
-        
-        :return: scattering function P(q)
-        
-        """
-        
-        return [CPYTHONCLASS].runXY(self, x)
-        
-    def evalDistribution(self, x=[]):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        :param x: input q[], or [qx[], qy[]]
-        
-        :return: scattering function P(q[])
-        
-        """
-        return [CPYTHONCLASS].evalDistribution(self, x)
-        
-    def calculate_ER(self):
-        """ 
-        Calculate the effective radius for P(q)*S(q)
-        
-        :return: the value of the effective radius
-        
-        """       
-        return [CPYTHONCLASS].calculate_ER(self)
-        
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        :param parameter: name of the parameter [string]
-        :param dispersion: dispersion object of type DispersionModel
-        
-        """
-        return [CPYTHONCLASS].set_dispersion(self, parameter, dispersion.cdisp)
-        
-   
-# End of file
Index: sansmodels/src/sans/models/c_models/models.hh
===================================================================
--- sansmodels/src/sans/models/c_models/models.hh	(revision 8c8cb057f0c1e50cdc80f9ebce08f129f6f1ed26)
+++ 	(revision )
@@ -1,1279 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-#ifndef MODEL_CLASS_H
-#define MODEL_CLASS_H
-
-#include <vector>
-#include "parameters.hh"
-extern "C" {
-	#include "cylinder.h"
-	#include "parallelepiped.h"
-	#include "lamellarPS.h"
-	#include "lamellar.h"
-	#include "fuzzysphere.h"
-}
-
-using namespace std;
-
-class CylinderModel{
-public:
-	// Model parameters
-	Parameter radius;
-	Parameter scale;
-	Parameter length;
-	Parameter sldCyl;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter cyl_theta;
-	Parameter cyl_phi;
-
-	// Constructor
-	CylinderModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class BarBellModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter rad_bar;
-	Parameter len_bar;
-	Parameter rad_bell;
-	Parameter sld_barbell;
-	Parameter sld_solv;
-	Parameter background;
-	Parameter theta;
-	Parameter phi;
-
-	// Constructor
-	BarBellModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class CappedCylinderModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter rad_cyl;
-	Parameter len_cyl;
-	Parameter rad_cap;
-	Parameter sld_capcyl;
-	Parameter sld_solv;
-	Parameter background;
-	Parameter theta;
-	Parameter phi;
-
-	// Constructor
-	CappedCylinderModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class ParallelepipedModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter short_a;
-	Parameter short_b;
-	Parameter long_c;
-	Parameter sldPipe;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter parallel_theta;
-	Parameter parallel_phi;
-	Parameter parallel_psi;
-
-	// Constructor
-	ParallelepipedModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class CSParallelepipedModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter shortA;
-	Parameter midB;
-	Parameter longC;
-	Parameter rimA;
-	Parameter rimB;
-	Parameter rimC;
-	Parameter sld_rimA;
-	Parameter sld_rimB;
-	Parameter sld_rimC;
-	Parameter sld_pcore;
-	Parameter sld_solv;
-	Parameter background;
-	Parameter parallel_theta;
-	Parameter parallel_phi;
-	Parameter parallel_psi;
-
-	// Constructor
-	CSParallelepipedModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class OnionModel{
-public:
-	// Model parameters
-	Parameter n_shells;
-	Parameter scale;
-	Parameter rad_core0;
-	Parameter sld_core0;
-	Parameter sld_solv;
-	Parameter background;
-
-	Parameter sld_out_shell1;
-	Parameter sld_out_shell2;
-	Parameter sld_out_shell3;
-	Parameter sld_out_shell4;
-	Parameter sld_out_shell5;
-	Parameter sld_out_shell6;
-	Parameter sld_out_shell7;
-	Parameter sld_out_shell8;
-	Parameter sld_out_shell9;
-	Parameter sld_out_shell10;
-
-	Parameter sld_in_shell1;
-	Parameter sld_in_shell2;
-	Parameter sld_in_shell3;
-	Parameter sld_in_shell4;
-	Parameter sld_in_shell5;
-	Parameter sld_in_shell6;
-	Parameter sld_in_shell7;
-	Parameter sld_in_shell8;
-	Parameter sld_in_shell9;
-	Parameter sld_in_shell10;
-
-	Parameter A_shell1;
-	Parameter A_shell2;
-	Parameter A_shell3;
-	Parameter A_shell4;
-	Parameter A_shell5;
-	Parameter A_shell6;
-	Parameter A_shell7;
-	Parameter A_shell8;
-	Parameter A_shell9;
-	Parameter A_shell10;
-
-	Parameter thick_shell1;
-	Parameter thick_shell2;
-	Parameter thick_shell3;
-	Parameter thick_shell4;
-	Parameter thick_shell5;
-	Parameter thick_shell6;
-	Parameter thick_shell7;
-	Parameter thick_shell8;
-	Parameter thick_shell9;
-	Parameter thick_shell10;
-
-	Parameter func_shell1;
-	Parameter func_shell2;
-	Parameter func_shell3;
-	Parameter func_shell4;
-	Parameter func_shell5;
-	Parameter func_shell6;
-	Parameter func_shell7;
-	Parameter func_shell8;
-	Parameter func_shell9;
-	Parameter func_shell10;
-
-	// Constructor
-	OnionModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class RPAModel{
-public:
-	// Model parameters
-	Parameter lcase_n;
-	Parameter ba;
-	Parameter bb;
-	Parameter bc;
-	Parameter bd;
-
-	Parameter Kab;
-	Parameter Kac;
-	Parameter Kad;
-	Parameter Kbc;
-	Parameter Kbd;
-	Parameter Kcd;
-
-	Parameter scale;
-	Parameter background;
-
-	Parameter Na;
-	Parameter Phia;
-	Parameter va;
-	Parameter La;
-
-	Parameter Nb;
-	Parameter Phib;
-	Parameter vb;
-	Parameter Lb;
-
-	Parameter Nc;
-	Parameter Phic;
-	Parameter vc;
-	Parameter Lc;
-
-	Parameter Nd;
-	Parameter Phid;
-	Parameter vd;
-	Parameter Ld;
-
-	// Constructor
-	RPAModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class ReflModel{
-public:
-	// Model parameters
-	Parameter n_layers;
-	Parameter scale;
-	Parameter thick_inter0;
-	Parameter func_inter0;
-	Parameter sld_bottom0;
-	Parameter sld_medium;
-	Parameter background;
-
-	Parameter sld_flat1;
-	Parameter sld_flat2;
-	Parameter sld_flat3;
-	Parameter sld_flat4;
-	Parameter sld_flat5;
-	Parameter sld_flat6;
-	Parameter sld_flat7;
-	Parameter sld_flat8;
-	Parameter sld_flat9;
-	Parameter sld_flat10;
-
-	Parameter thick_inter1;
-	Parameter thick_inter2;
-	Parameter thick_inter3;
-	Parameter thick_inter4;
-	Parameter thick_inter5;
-	Parameter thick_inter6;
-	Parameter thick_inter7;
-	Parameter thick_inter8;
-	Parameter thick_inter9;
-	Parameter thick_inter10;
-
-	Parameter thick_flat1;
-	Parameter thick_flat2;
-	Parameter thick_flat3;
-	Parameter thick_flat4;
-	Parameter thick_flat5;
-	Parameter thick_flat6;
-	Parameter thick_flat7;
-	Parameter thick_flat8;
-	Parameter thick_flat9;
-	Parameter thick_flat10;
-
-	Parameter func_inter1;
-	Parameter func_inter2;
-	Parameter func_inter3;
-	Parameter func_inter4;
-	Parameter func_inter5;
-	Parameter func_inter6;
-	Parameter func_inter7;
-	Parameter func_inter8;
-	Parameter func_inter9;
-	Parameter func_inter10;
-
-	// Constructor
-	ReflModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class ReflAdvModel{
-public:
-	// Model parameters
-	Parameter n_layers;
-	Parameter scale;
-	Parameter thick_inter0;
-	Parameter func_inter0;
-	Parameter sld_bottom0;
-	Parameter sld_medium;
-	Parameter background;
-
-	Parameter sld_flat1;
-	Parameter sld_flat2;
-	Parameter sld_flat3;
-	Parameter sld_flat4;
-	Parameter sld_flat5;
-	Parameter sld_flat6;
-	Parameter sld_flat7;
-	Parameter sld_flat8;
-	Parameter sld_flat9;
-	Parameter sld_flat10;
-
-	Parameter thick_inter1;
-	Parameter thick_inter2;
-	Parameter thick_inter3;
-	Parameter thick_inter4;
-	Parameter thick_inter5;
-	Parameter thick_inter6;
-	Parameter thick_inter7;
-	Parameter thick_inter8;
-	Parameter thick_inter9;
-	Parameter thick_inter10;
-
-	Parameter thick_flat1;
-	Parameter thick_flat2;
-	Parameter thick_flat3;
-	Parameter thick_flat4;
-	Parameter thick_flat5;
-	Parameter thick_flat6;
-	Parameter thick_flat7;
-	Parameter thick_flat8;
-	Parameter thick_flat9;
-	Parameter thick_flat10;
-
-	Parameter func_inter1;
-	Parameter func_inter2;
-	Parameter func_inter3;
-	Parameter func_inter4;
-	Parameter func_inter5;
-	Parameter func_inter6;
-	Parameter func_inter7;
-	Parameter func_inter8;
-	Parameter func_inter9;
-	Parameter func_inter10;
-
-	Parameter sldIM_flat1;
-	Parameter sldIM_flat2;
-	Parameter sldIM_flat3;
-	Parameter sldIM_flat4;
-	Parameter sldIM_flat5;
-	Parameter sldIM_flat6;
-	Parameter sldIM_flat7;
-	Parameter sldIM_flat8;
-	Parameter sldIM_flat9;
-	Parameter sldIM_flat10;
-
-	Parameter nu_inter1;
-	Parameter nu_inter2;
-	Parameter nu_inter3;
-	Parameter nu_inter4;
-	Parameter nu_inter5;
-	Parameter nu_inter6;
-	Parameter nu_inter7;
-	Parameter nu_inter8;
-	Parameter nu_inter9;
-	Parameter nu_inter10;
-
-	Parameter sldIM_sub0;
-	Parameter sldIM_medium;
-	Parameter npts_inter;
-	Parameter nu_inter0;
-
-	// Constructor
-	ReflAdvModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class SphereModel{
-public:
-	// Model parameters
-	Parameter radius;
-	Parameter scale;
-	Parameter sldSph;
-	Parameter sldSolv;
-	Parameter background;
-
-	// Constructor
-	SphereModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class SphereSLDModel{
-public:
-	// Model parameters
-	Parameter n_shells;
-	Parameter scale;
-	Parameter thick_inter0;
-	Parameter func_inter0;
-	Parameter sld_core0;
-	Parameter sld_solv;
-	Parameter background;
-
-	Parameter sld_flat1;
-	Parameter sld_flat2;
-	Parameter sld_flat3;
-	Parameter sld_flat4;
-	Parameter sld_flat5;
-	Parameter sld_flat6;
-	Parameter sld_flat7;
-	Parameter sld_flat8;
-	Parameter sld_flat9;
-	Parameter sld_flat10;
-
-	Parameter thick_inter1;
-	Parameter thick_inter2;
-	Parameter thick_inter3;
-	Parameter thick_inter4;
-	Parameter thick_inter5;
-	Parameter thick_inter6;
-	Parameter thick_inter7;
-	Parameter thick_inter8;
-	Parameter thick_inter9;
-	Parameter thick_inter10;
-
-	Parameter thick_flat1;
-	Parameter thick_flat2;
-	Parameter thick_flat3;
-	Parameter thick_flat4;
-	Parameter thick_flat5;
-	Parameter thick_flat6;
-	Parameter thick_flat7;
-	Parameter thick_flat8;
-	Parameter thick_flat9;
-	Parameter thick_flat10;
-
-	Parameter func_inter1;
-	Parameter func_inter2;
-	Parameter func_inter3;
-	Parameter func_inter4;
-	Parameter func_inter5;
-	Parameter func_inter6;
-	Parameter func_inter7;
-	Parameter func_inter8;
-	Parameter func_inter9;
-	Parameter func_inter10;
-
-	Parameter nu_inter1;
-	Parameter nu_inter2;
-	Parameter nu_inter3;
-	Parameter nu_inter4;
-	Parameter nu_inter5;
-	Parameter nu_inter6;
-	Parameter nu_inter7;
-	Parameter nu_inter8;
-	Parameter nu_inter9;
-	Parameter nu_inter10;
-
-	Parameter npts_inter;
-	Parameter nu_inter0;
-	Parameter rad_core0;
-
-	// Constructor
-	SphereSLDModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class SCCrystalModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter dnn;
-	Parameter d_factor;
-	Parameter radius;
-	Parameter sldSph;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter theta;
-	Parameter phi;
-	Parameter psi;
-
-	// Constructor
-	SCCrystalModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class PearlNecklaceModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter radius;
-	Parameter edge_separation;
-	Parameter thick_string;
-	Parameter num_pearls;
-	Parameter sld_pearl;
-	Parameter sld_string;
-	Parameter sld_solv;
-	Parameter background;
-
-	// Constructor
-	PearlNecklaceModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class FCCrystalModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter dnn;
-	Parameter d_factor;
-	Parameter radius;
-	Parameter sldSph;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter theta;
-	Parameter phi;
-	Parameter psi;
-
-	// Constructor
-	FCCrystalModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class BCCrystalModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter dnn;
-	Parameter d_factor;
-	Parameter radius;
-	Parameter sldSph;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter theta;
-	Parameter phi;
-	Parameter psi;
-
-	// Constructor
-	BCCrystalModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class FuzzySphereModel{
-public:
-	// Model parameters
-	Parameter radius;
-	Parameter scale;
-	Parameter fuzziness;
-	Parameter sldSph;
-	Parameter sldSolv;
-	Parameter background;
-
-	// Constructor
-	FuzzySphereModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class HardsphereStructure{
-public:
-	// Model parameters
-	Parameter effect_radius;
-	Parameter volfraction;
-
-	// Constructor
-	HardsphereStructure();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class StickyHSStructure{
-public:
-	// Model parameters
-	Parameter effect_radius;
-	Parameter volfraction;
-	Parameter perturb;
-	Parameter stickiness;
-
-	// Constructor
-	StickyHSStructure();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class SquareWellStructure{
-public:
-	// Model parameters
-	Parameter effect_radius;
-	Parameter volfraction;
-	Parameter welldepth;
-	Parameter wellwidth;
-
-	// Constructor
-	SquareWellStructure();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class HayterMSAStructure{
-public:
-	// Model parameters
-	Parameter effect_radius;
-	Parameter charge;
-	Parameter volfraction;
-	Parameter temperature;
-	Parameter saltconc;
-	Parameter dielectconst;
-
-	// Constructor
-	HayterMSAStructure();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class DiamEllipFunc{
-public:
-	// Model parameters
-	Parameter radius_a;
-	Parameter radius_b;
-
-	// Constructor
-	DiamEllipFunc();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class DiamCylFunc{
-public:
-	// Model parameters
-	Parameter radius;
-	Parameter length;
-
-	// Constructor
-	DiamCylFunc();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class SLDCalFunc{
-public:
-	// Model parameters
-	Parameter fun_type;
-	Parameter npts_inter;
-	Parameter shell_num;
-	Parameter nu_inter;
-	Parameter sld_left;
-	Parameter sld_right;
-
-	// Constructor
-	SLDCalFunc();
-
-	// Operators to get SLD
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class CoreShellModel{
-public:
-	// Model parameters
-	Parameter radius;
-	Parameter scale;
-	Parameter thickness;
-	Parameter core_sld;
-	Parameter shell_sld;
-	Parameter solvent_sld;
-	Parameter background;
-
-	// Constructor
-	CoreShellModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class CoreFourShellModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter rad_core0;
-	Parameter sld_core0;
-	Parameter thick_shell1;
-	Parameter sld_shell1;
-	Parameter thick_shell2;
-	Parameter sld_shell2;
-	Parameter thick_shell3;
-	Parameter sld_shell3;
-	Parameter thick_shell4;
-	Parameter sld_shell4;
-	Parameter sld_solv;
-	Parameter background;
-
-	// Constructor
-	CoreFourShellModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class CoreShellCylinderModel{
-public:
-	// Model parameters
-	Parameter radius;
-	Parameter scale;
-	Parameter thickness;
-	Parameter length;
-	Parameter core_sld;
-	Parameter shell_sld;
-	Parameter solvent_sld;
-	Parameter background;
-	Parameter axis_theta;
-	Parameter axis_phi;
-
-	// Constructor
-	CoreShellCylinderModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class EllipsoidModel{
-public:
-	// Model parameters
-	Parameter radius_a;
-	Parameter scale;
-	Parameter radius_b;
-	Parameter sldEll;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter axis_theta;
-	Parameter axis_phi;
-
-	// Constructor
-	EllipsoidModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class EllipticalCylinderModel{
-public:
-	// Model parameters
-	Parameter r_minor;
-	Parameter scale;
-	Parameter r_ratio;
-	Parameter length;
-	Parameter sldCyl;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter cyl_theta;
-	Parameter cyl_phi;
-	Parameter cyl_psi;
-
-	// Constructor
-	EllipticalCylinderModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-class TriaxialEllipsoidModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter semi_axisA;
-	Parameter semi_axisB;
-	Parameter semi_axisC;
-	Parameter sldEll;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter axis_theta;
-	Parameter axis_phi;
-	Parameter axis_psi;
-
-	// Constructor
-	TriaxialEllipsoidModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class FlexibleCylinderModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter length;
-	Parameter kuhn_length;
-	Parameter radius;
-	Parameter sldCyl;
-	Parameter sldSolv;
-	Parameter background;
-
-	// Constructor
-	FlexibleCylinderModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class FlexCylEllipXModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter length;
-	Parameter kuhn_length;
-	Parameter radius;
-	Parameter axis_ratio;
-	Parameter sldCyl;
-	Parameter sldSolv;
-	Parameter background;
-
-	// Constructor
-	FlexCylEllipXModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class StackedDisksModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter core_thick;
-	Parameter radius;
-	Parameter layer_thick;
-	Parameter core_sld;
-	Parameter layer_sld;
-	Parameter solvent_sld;
-	Parameter n_stacking;
-	Parameter sigma_d;
-	Parameter background;
-	Parameter axis_theta;
-	Parameter axis_phi;
-
-	// Constructor
-	StackedDisksModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class LamellarModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter bi_thick;
-	Parameter sld_bi;
-	Parameter sld_sol;
-	Parameter background;
-
-	// Constructor
-	LamellarModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-
-};
-
-class LamellarFFHGModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter t_length;
-	Parameter h_thickness;
-	Parameter sld_tail;
-	Parameter sld_head;
-	Parameter sld_solvent;
-	Parameter background;
-
-	// Constructor
-	LamellarFFHGModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-
-};
-
-
-
-class LamellarPSModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter spacing;
-	Parameter delta;
-	Parameter sld_bi;
-	Parameter sld_sol;
-	Parameter n_plates;
-	Parameter caille;
-	Parameter background;
-
-	// Constructor
-	LamellarPSModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class LamellarPSHGModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter spacing;
-	Parameter deltaT;
-	Parameter deltaH;
-	Parameter sld_tail;
-	Parameter sld_head;
-	Parameter sld_solvent;
-	Parameter n_plates;
-	Parameter caille;
-	Parameter background;
-
-	// Constructor
-	LamellarPSHGModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-class LamellarPCrystalModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter thickness;
-	Parameter Nlayers;
-	Parameter spacing;
-	Parameter pd_spacing;
-	Parameter sld_layer;
-	Parameter sld_solvent;
-	Parameter background;
-
-	// Constructor
-	LamellarPCrystalModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class CoreShellEllipsoidModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter equat_core;
-	Parameter polar_core;
-	Parameter equat_shell;
-	Parameter polar_shell;
-	Parameter sld_core;
-	Parameter sld_shell;
-	Parameter sld_solvent;
-	Parameter background;
-	Parameter axis_theta;
-	Parameter axis_phi;
-
-	// Constructor
-	CoreShellEllipsoidModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class HollowCylinderModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter core_radius;
-	Parameter radius;
-	Parameter length;
-	Parameter sldCyl;
-	Parameter sldSolv;
-	Parameter background;
-	Parameter axis_theta;
-	Parameter axis_phi;
-
-	//Constructor
-	HollowCylinderModel();
-
-	//Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx , double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class MultiShellModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter core_radius;
-	Parameter s_thickness;
-	Parameter w_thickness;
-	Parameter core_sld;
-	Parameter shell_sld;
-	Parameter n_pairs;
-	Parameter background;
-
-	//Constructor
-	MultiShellModel();
-
-	//Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx , double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class VesicleModel{
-public:
-	// Model parameters
-	Parameter scale;
-	Parameter radius;
-	Parameter thickness;
-	Parameter core_sld;
-	Parameter shell_sld;
-	Parameter background;
-
-	//Constructor
-	VesicleModel();
-
-	//Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx , double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class BinaryHSModel{
-public:
-	// Model parameters
-	Parameter l_radius;
-	Parameter s_radius;
-	Parameter vol_frac_ls;
-	Parameter vol_frac_ss;
-	Parameter ls_sld;
-	Parameter ss_sld;
-	Parameter solvent_sld;
-	Parameter background;
-
-	//Constructor
-	BinaryHSModel();
-
-	//Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx , double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class BinaryHSPSF11Model{
-public:
-	// Model parameters
-	Parameter l_radius;
-	Parameter s_radius;
-	Parameter vol_frac_ls;
-	Parameter vol_frac_ss;
-	Parameter ls_sld;
-	Parameter ss_sld;
-	Parameter solvent_sld;
-	Parameter background;
-
-	//Constructor
-	BinaryHSPSF11Model();
-
-	//Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx , double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class Poly_GaussCoil{
-public:
-	// Model parameters
-	Parameter rg;
-	Parameter scale;
-	Parameter poly_m;
-	Parameter background;
-
-	// Constructor
-	Poly_GaussCoil();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-class FractalModel{
-public:
-	// Model parameters
-	Parameter radius;
-	Parameter scale;
-	Parameter fractal_dim;
-	Parameter cor_length;
-	Parameter sldBlock;
-	Parameter sldSolv;
-	Parameter background;
-
-	// Constructor
-	FractalModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: sansmodels/src/sans/models/c_models/multishell.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/multishell.cpp	(revision c451be953dd7ec3d17683e043145313f5c761ac0)
+++ 	(revision )
@@ -1,185 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "multishell.h"
-}
-
-MultiShellModel :: MultiShellModel() {
-	scale      = Parameter(1.0);
-	core_radius     = Parameter(60.0, true);
-	core_radius.set_min(0.0);
-	s_thickness  = Parameter(10.0, true);
-	s_thickness.set_min(0.0);
-	w_thickness   = Parameter(10.0, true);
-	w_thickness.set_min(0.0);
-	core_sld   = Parameter(6.4e-6);
-	shell_sld   = Parameter(4.0e-7);
-	n_pairs   = Parameter(2);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double MultiShellModel :: operator()(double q) {
-	double dp[8];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = core_radius();
-	dp[2] = s_thickness();
-	dp[3] = w_thickness();
-	dp[4] = core_sld();
-	dp[5] = shell_sld();
-	dp[6] = n_pairs();
-	dp[7] = 0.0;
-
-	// Get the dispersion points for the core radius
-	vector<WeightPoint> weights_core_radius;
-	core_radius.get_weights(weights_core_radius);
-
-	// Get the dispersion points for the s_thickness
-	vector<WeightPoint> weights_s_thickness;
-	s_thickness.get_weights(weights_s_thickness);
-
-	// Get the dispersion points for the w_thickness
-	vector<WeightPoint> weights_w_thickness;
-	w_thickness.get_weights(weights_w_thickness);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(int i=0; i< (int)weights_core_radius.size(); i++) {
-		dp[1] = weights_core_radius[i].value;
-		for(int j=0; j< (int)weights_s_thickness.size(); j++){
-			dp[2] = weights_s_thickness[j].value;
-			for(int k=0; k< (int)weights_w_thickness.size(); k++){
-				dp[3] = weights_w_thickness[k].value;
-				//Un-normalize SphereForm by volume
-				sum += weights_core_radius[i].weight*weights_s_thickness[j].weight
-					*weights_w_thickness[k].weight* MultiShell(dp, q)
-					*pow(weights_core_radius[i].value+dp[6]*weights_s_thickness[j].value+(dp[6]-1)*weights_w_thickness[k].value,3);
-				//Find average volume
-				vol += weights_core_radius[i].weight*weights_s_thickness[j].weight
-					*weights_w_thickness[k].weight
-					*pow(weights_core_radius[i].value+dp[6]*weights_s_thickness[j].value+(dp[6]-1)*weights_w_thickness[k].value,3);
-				norm += weights_core_radius[i].weight*weights_s_thickness[j].weight
-					*weights_w_thickness[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double MultiShellModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the multishell
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double MultiShellModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double MultiShellModel :: calculate_ER() {
-	MultiShellParameters dp;
-
-	dp.core_radius     = core_radius();
-	dp.s_thickness  = s_thickness();
-	dp.w_thickness  = w_thickness();
-	dp.n_pairs = n_pairs();
-
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	if (dp.n_pairs <= 0.0 ){
-		dp.n_pairs = 0.0;
-	}
-
-	// Get the dispersion points for the core radius
-	vector<WeightPoint> weights_core_radius;
-	core_radius.get_weights(weights_core_radius);
-
-	// Get the dispersion points for the s_thickness
-	vector<WeightPoint> weights_s_thickness;
-	s_thickness.get_weights(weights_s_thickness);
-
-	// Get the dispersion points for the w_thickness
-	vector<WeightPoint> weights_w_thickness;
-	w_thickness.get_weights(weights_w_thickness);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_s_thickness.size(); i++) {
-		dp.s_thickness = weights_s_thickness[i].value;
-		for(int j=0; j< (int)weights_w_thickness.size(); j++) {
-			dp.w_thickness = weights_w_thickness[j].value;
-			for(int k=0; k< (int)weights_core_radius.size(); k++) {
-				dp.core_radius = weights_core_radius[k].value;
-				sum += weights_s_thickness[i].weight*weights_w_thickness[j].weight
-					* weights_core_radius[k].weight*(dp.core_radius+dp.n_pairs*dp.s_thickness+(dp.n_pairs-1.0)*dp.w_thickness);
-				norm += weights_s_thickness[i].weight*weights_w_thickness[j].weight* weights_core_radius[k].weight;
-			}
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = (dp.core_radius+dp.n_pairs*dp.s_thickness+(dp.n_pairs-1.0)*dp.w_thickness);}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/notes.txt
===================================================================
--- sansmodels/src/sans/models/c_models/notes.txt	(revision 0f5bc9ff2027432913fd8d2cb067675244acdaf6)
+++ 	(revision )
@@ -1,48 +1,0 @@
-The design of the SANS models is not easily scalable. Although a more efficient
-way (in terms of design and speed) as been implemented on the C/C++ side, the python
-design should be revisited. Areas of improvements include:
-
-1- [C side] Incorporate the C functions that use libigor directly into the new C++ class.
-  	That would mean rewritting the script generator to eliminate all the .c files.
-  
-2- Re-design the sans.models.BaseComponent class to store the parameters as objects,
-	like it's done on the C++ side. A better design may allow us to avoid the awful
-	hard-coding of the translation between the python dictionary holding the 
-	parameters and the C++ Parameter class.
-	 
- Length = 400
-I(Q=0.001) = 450.355
-I(Q=0.001) = 472.332
-I(Q=0.001) = 4723.32
-I(Qx=0.001, Qy=0.001) = 4743.56
-I(Q=0.00447,  Phi=0.7854) = 4733
-pi=3.14159
-
-I(Qx=0.01, Qy=0.01) = 2299
-I(Q=0.0141421)         = 2326.75
-ratio 0.988074 1.01207
-
-Cyl (python):  450.35506578
-Disp(pyhton):  472.332213339
-
---------------
-Hello cylinder
-450.35506578
-449.358988524
-446.344929175
-
-{'npts': 1, 'type': 'gaussian', 'nsigmas': 2, 'width': 0.0}
-{'npts': 1, 'type': 'flat', 'width': 0.0}
-
- q= 0.001
-New Cyl :  450.35506578
-New Disp:  472.332213339
-
-cyl(0.01, 0.01) =96.8691
-cyl(0.0141421) =232.675
-{'type': 'array'}
-cyl(0.01, 0.01) =229.9
-Hello cylinder
-
-Old Cyl :  450.35506578
-Old Disp:  472.332213339
Index: sansmodels/src/sans/models/c_models/onion.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/onion.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,438 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "onion.h"
-}
-
-OnionModel :: OnionModel() {
-	n_shells = Parameter(1.0);
-	scale = Parameter(1.0);
-	rad_core0 = Parameter(200.0);
-	sld_core0 = Parameter(1e-06);
-	sld_solv = Parameter(6.4e-06);
-    background = Parameter(0.0);
-
-
-    sld_out_shell1 = Parameter(1.0e-06);
-    sld_out_shell2 = Parameter(1.0e-06);
-    sld_out_shell3 = Parameter(1.0e-06);
-    sld_out_shell4 = Parameter(1.0e-06);
-    sld_out_shell5 = Parameter(1.0e-06);
-    sld_out_shell6 = Parameter(1.0e-06);
-    sld_out_shell7 = Parameter(1.0e-06);
-    sld_out_shell8 = Parameter(1.0e-06);
-    sld_out_shell9 = Parameter(1.0e-06);
-    sld_out_shell10 = Parameter(1.0e-06);
-
-
-    sld_in_shell1 = Parameter(2.3e-06);
-    sld_in_shell2 = Parameter(2.6e-06);
-    sld_in_shell3 = Parameter(2.9e-06);
-    sld_in_shell4 = Parameter(3.2e-06);
-    sld_in_shell5 = Parameter(3.5e-06);
-    sld_in_shell6 = Parameter(3.8e-06);
-    sld_in_shell7 = Parameter(4.1e-06);
-    sld_in_shell8 = Parameter(4.4e-06);
-    sld_in_shell9 = Parameter(4.7e-06);
-    sld_in_shell10 = Parameter(5.0e-06);
-
-
-    A_shell1 = Parameter(1.0);
-    A_shell2 = Parameter(1.0);
-    A_shell3 = Parameter(1.0);
-    A_shell4 = Parameter(1.0);
-    A_shell5 = Parameter(1.0);
-    A_shell6 = Parameter(1.0);
-    A_shell7 = Parameter(1.0);
-    A_shell8 = Parameter(1.0);
-    A_shell9 = Parameter(1.0);
-    A_shell10 = Parameter(1.0);
-
-
-    thick_shell1 = Parameter(50.0);
-    thick_shell2 = Parameter(50.0);
-    thick_shell3 = Parameter(50.0);
-    thick_shell4 = Parameter(50.0);
-    thick_shell5 = Parameter(50.0);
-    thick_shell6 = Parameter(50.0);
-    thick_shell7 = Parameter(50.0);
-    thick_shell8 = Parameter(50.0);
-    thick_shell9 = Parameter(50.0);
-    thick_shell10 = Parameter(50.0);
-
-
-    func_shell1 = Parameter(2);
-    func_shell2 = Parameter(2);
-    func_shell3 = Parameter(2);
-    func_shell4 = Parameter(2);
-    func_shell5 = Parameter(2);
-    func_shell6 = Parameter(2);
-    func_shell7 = Parameter(2);
-    func_shell8 = Parameter(2);
-    func_shell9 = Parameter(2);
-    func_shell10 = Parameter(2);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double OnionModel :: operator()(double q) {
-	double dp[56];
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = n_shells();
-	dp[1] = scale();
-	dp[2] = rad_core0();
-	dp[3] = sld_core0();
-	dp[4] = sld_solv();
-	dp[5] = 0.0;
-
-	dp[6] = sld_out_shell1();
-	dp[7] = sld_out_shell2();
-	dp[8] = sld_out_shell3();
-	dp[9] = sld_out_shell4();
-	dp[10] = sld_out_shell5();
-	dp[11] = sld_out_shell6();
-	dp[12] = sld_out_shell7();
-	dp[13] = sld_out_shell8();
-	dp[14] = sld_out_shell9();
-	dp[15] = sld_out_shell10();
-
-	dp[16] = sld_in_shell1();
-	dp[17] = sld_in_shell2();
-	dp[18] = sld_in_shell3();
-	dp[19] = sld_in_shell4();
-	dp[20] = sld_in_shell5();
-	dp[21] = sld_in_shell6();
-	dp[22] = sld_in_shell7();
-	dp[23] = sld_in_shell8();
-	dp[24] = sld_in_shell9();
-	dp[25] = sld_in_shell10();
-
-	dp[26] = A_shell1();
-	dp[27] = A_shell2();
-	dp[28] = A_shell3();
-	dp[29] = A_shell4();
-	dp[30] = A_shell5();
-	dp[31] = A_shell6();
-	dp[32] = A_shell7();
-	dp[33] = A_shell8();
-	dp[34] = A_shell9();
-	dp[35] = A_shell10();
-
-	dp[36] = thick_shell1();
-	dp[37] = thick_shell2();
-	dp[38] = thick_shell3();
-	dp[39] = thick_shell4();
-	dp[40] = thick_shell5();
-	dp[41] = thick_shell6();
-	dp[42] = thick_shell7();
-	dp[43] = thick_shell8();
-	dp[44] = thick_shell9();
-	dp[45] = thick_shell10();
-
-	dp[46] = func_shell1();
-	dp[47] = func_shell2();
-	dp[48] = func_shell3();
-	dp[49] = func_shell4();
-	dp[50] = func_shell5();
-	dp[51] = func_shell6();
-	dp[52] = func_shell7();
-	dp[53] = func_shell8();
-	dp[54] = func_shell9();
-	dp[55] = func_shell10();
-
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rad_core0.get_weights(weights_rad);
-
-	// Get the dispersion points for the thick 1
-	vector<WeightPoint> weights_s1;
-	thick_shell1.get_weights(weights_s1);
-
-	// Get the dispersion points for the thick 2
-	vector<WeightPoint> weights_s2;
-	thick_shell2.get_weights(weights_s2);
-
-	// Get the dispersion points for the thick 3
-	vector<WeightPoint> weights_s3;
-	thick_shell3.get_weights(weights_s3);
-
-	// Get the dispersion points for the thick 4
-	vector<WeightPoint> weights_s4;
-	thick_shell4.get_weights(weights_s4);
-
-	// Get the dispersion points for the thick 5
-	vector<WeightPoint> weights_s5;
-	thick_shell5.get_weights(weights_s5);
-
-	// Get the dispersion points for the thick 6
-	vector<WeightPoint> weights_s6;
-	thick_shell6.get_weights(weights_s6);
-
-	// Get the dispersion points for the thick 7
-	vector<WeightPoint> weights_s7;
-	thick_shell7.get_weights(weights_s7);
-
-	// Get the dispersion points for the thick 8
-	vector<WeightPoint> weights_s8;
-	thick_shell8.get_weights(weights_s8);
-	// Get the dispersion points for the thick 9
-	vector<WeightPoint> weights_s9;
-	thick_shell9.get_weights(weights_s9);
-
-	// Get the dispersion points for the thick 10
-	vector<WeightPoint> weights_s10;
-	thick_shell10.get_weights(weights_s10);
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[2] = weights_rad[i].value;
-		// Loop over radius weight points
-		for(size_t j=0; j<weights_s1.size(); j++) {
-			dp[36] = weights_s1[j].value;
-			// Loop over radius weight points
-			for(size_t k=0; k<weights_s2.size(); k++) {
-				dp[37] = weights_s2[k].value;
-				// Loop over radius weight points
-				for(size_t l=0; l<weights_s3.size(); l++) {
-					dp[38] = weights_s3[l].value;
-					// Loop over radius weight points
-					for(size_t m=0; m<weights_s4.size(); m++) {
-						dp[39] = weights_s4[m].value;
-						for(size_t n=0; n<weights_s5.size(); n++) {
-							dp[40] = weights_s5[n].value;
-							for(size_t o=0; o<weights_s6.size(); o++) {
-								dp[41] = weights_s6[o].value;
-								for(size_t p=0; p<weights_s7.size(); p++) {
-									dp[42] = weights_s7[p].value;
-									for(size_t t=0; t<weights_s8.size(); t++) {
-										dp[43] = weights_s8[t].value;
-										for(size_t r=0; r<weights_s9.size(); r++) {
-											dp[44] = weights_s9[r].value;
-											for(size_t s=0; s<weights_s10.size(); s++) {
-												dp[45] = weights_s10[s].value;
-												//Un-normalize Shells by volume
-												sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-														*weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight
-														*weights_s9[r].weight*weights_s10[s].weight
-														* so_kernel(dp,q) * pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value
-																+weights_s5[n].value+weights_s6[o].value+weights_s7[p].value+weights_s8[t].value
-																+weights_s9[r].value+weights_s10[s].value),3.0);
-												//Find average volume
-												vol += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-													*weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight
-													*weights_s9[r].weight*weights_s10[s].weight
-													* pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value
-															+weights_s5[n].value+weights_s6[o].value+weights_s7[p].value+weights_s8[t].value
-															+weights_s9[r].value+weights_s10[s].value),3.0);
-												norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-													*weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight
-													*weights_s9[r].weight*weights_s10[s].weight;
-											}
-										}
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double OnionModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double OnionModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double OnionModel :: calculate_ER() {
-	OnionParameters dp;
-	dp.rad_core0 = rad_core0();
-	dp.thick_shell1 = thick_shell1();
-	dp.thick_shell2 = thick_shell2();
-	dp.thick_shell3 = thick_shell3();
-	dp.thick_shell4 = thick_shell4();
-	dp.thick_shell5 = thick_shell5();
-	dp.thick_shell6 = thick_shell6();
-	dp.thick_shell7 = thick_shell7();
-	dp.thick_shell8 = thick_shell8();
-	dp.thick_shell9 = thick_shell9();
-	dp.thick_shell10 = thick_shell10();
-
-
-	double rad_out = 0.0;
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rad_core0.get_weights(weights_rad);
-
-	// Get the dispersion points for the thick 1
-	vector<WeightPoint> weights_s1;
-	thick_shell1.get_weights(weights_s1);
-
-	// Get the dispersion points for the thick 2
-	vector<WeightPoint> weights_s2;
-	thick_shell2.get_weights(weights_s2);
-
-	// Get the dispersion points for the thick 3
-	vector<WeightPoint> weights_s3;
-	thick_shell3.get_weights(weights_s3);
-
-	// Get the dispersion points for the thick 4
-	vector<WeightPoint> weights_s4;
-	thick_shell4.get_weights(weights_s4);
-	// Get the dispersion points for the thick 5
-	vector<WeightPoint> weights_s5;
-	thick_shell5.get_weights(weights_s5);
-
-	// Get the dispersion points for the thick 6
-	vector<WeightPoint> weights_s6;
-	thick_shell6.get_weights(weights_s6);
-
-	// Get the dispersion points for the thick 7
-	vector<WeightPoint> weights_s7;
-	thick_shell7.get_weights(weights_s7);
-
-	// Get the dispersion points for the thick 8
-	vector<WeightPoint> weights_s8;
-	thick_shell8.get_weights(weights_s8);
-	// Get the dispersion points for the thick 9
-	vector<WeightPoint> weights_s9;
-	thick_shell9.get_weights(weights_s9);
-
-	// Get the dispersion points for the thick 10
-	vector<WeightPoint> weights_s10;
-	thick_shell10.get_weights(weights_s10);
-
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.rad_core0 = weights_rad[i].value;
-		// Loop over radius weight points
-		for(size_t j=0; j<weights_s1.size(); j++) {
-			dp.thick_shell1 = weights_s1[j].value;
-			// Loop over radius weight points
-			for(size_t k=0; k<weights_s2.size(); k++) {
-				dp.thick_shell2 = weights_s2[k].value;
-				// Loop over radius weight points
-				for(size_t l=0; l<weights_s3.size(); l++) {
-					dp.thick_shell3 = weights_s3[l].value;
-					// Loop over radius weight points
-					for(size_t m=0; m<weights_s4.size(); m++) {
-						dp.thick_shell4 = weights_s4[m].value;
-						// Loop over radius weight points
-						for(size_t n=0; j<weights_s5.size(); n++) {
-							dp.thick_shell5 = weights_s5[n].value;
-							// Loop over radius weight points
-							for(size_t o=0; k<weights_s6.size(); o++) {
-								dp.thick_shell6 = weights_s6[o].value;
-								// Loop over radius weight points
-								for(size_t p=0; l<weights_s7.size(); p++) {
-									dp.thick_shell7 = weights_s7[p].value;
-									// Loop over radius weight points
-									for(size_t t=0; m<weights_s8.size(); t++) {
-										dp.thick_shell8 = weights_s8[t].value;
-										// Loop over radius weight points
-										for(size_t r=0; l<weights_s9.size(); r++) {
-											dp.thick_shell8 = weights_s9[r].value;
-											// Loop over radius weight points
-											for(size_t s=0; m<weights_s10.size(); s++) {
-												dp.thick_shell10 = weights_s10[s].value;
-												//Un-normalize FourShell by volume
-												sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-													*weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight
-													*weights_s9[r].weight*weights_s10[s].weight
-													* (dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4+dp.thick_shell5
-															+dp.thick_shell6+dp.thick_shell7+dp.thick_shell8+dp.thick_shell9+dp.thick_shell10);
-												norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight
-													*weights_s4[m].weight*weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight
-													*weights_s8[t].weight*weights_s9[r].weight*weights_s10[s].weight;
-											}
-										}
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4
-					+dp.thick_shell5+dp.thick_shell6+dp.thick_shell7+dp.thick_shell8+dp.thick_shell9+dp.thick_shell10;}
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/parallelepiped.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/parallelepiped.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,323 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- *	TODO: add 2D function
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "parallelepiped.h"
-}
-
-ParallelepipedModel :: ParallelepipedModel() {
-	scale      = Parameter(1.0);
-	short_a     = Parameter(35.0, true);
-	short_a.set_min(1.0);
-	short_b     = Parameter(75.0, true);
-	short_b.set_min(1.0);
-	long_c     = Parameter(400.0, true);
-	long_c.set_min(1.0);
-	sldPipe   = Parameter(6.3e-6);
-	sldSolv   = Parameter(1.0e-6);
-	background = Parameter(0.0);
-	parallel_theta  = Parameter(0.0, true);
-	parallel_phi    = Parameter(0.0, true);
-	parallel_psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double ParallelepipedModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = short_a();
-	dp[2] = short_b();
-	dp[3] = long_c();
-	dp[4] = sldPipe();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_short_a;
-	short_a.get_weights(weights_short_a);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_short_b;
-	short_b.get_weights(weights_short_b);
-
-	// Get the dispersion points for the longuest_edgeC
-	vector<WeightPoint> weights_long_c;
-	long_c.get_weights(weights_long_c);
-
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over short_edgeA weight points
-	for(int i=0; i< (int)weights_short_a.size(); i++) {
-		dp[1] = weights_short_a[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_short_b.size(); j++) {
-			dp[2] = weights_short_b[j].value;
-
-			// Loop over longuest_edgeC weight points
-			for(int k=0; k< (int)weights_long_c.size(); k++) {
-				dp[3] = weights_long_c[k].value;
-				//Un-normalize  by volume
-				sum += weights_short_a[i].weight * weights_short_b[j].weight
-					* weights_long_c[k].weight * Parallelepiped(dp, q)
-					* weights_short_a[i].value*weights_short_b[j].value
-					* weights_long_c[k].value;
-				//Find average volume
-				vol += weights_short_a[i].weight * weights_short_b[j].weight
-					* weights_long_c[k].weight
-					* weights_short_a[i].value * weights_short_b[j].value
-					* weights_long_c[k].value;
-
-				norm += weights_short_a[i].weight
-					 * weights_short_b[j].weight * weights_long_c[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double ParallelepipedModel :: operator()(double qx, double qy) {
-	ParallelepipedParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.short_a   = short_a();
-	dp.short_b   = short_b();
-	dp.long_c  = long_c();
-	dp.sldPipe   = sldPipe();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	//dp.background = background();
-	dp.parallel_theta  = parallel_theta();
-	dp.parallel_phi    = parallel_phi();
-	dp.parallel_psi    = parallel_psi();
-
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_short_a;
-	short_a.get_weights(weights_short_a);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_short_b;
-	short_b.get_weights(weights_short_b);
-
-	// Get angular averaging for the longuest_edgeC
-	vector<WeightPoint> weights_long_c;
-	long_c.get_weights(weights_long_c);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_parallel_theta;
-	parallel_theta.get_weights(weights_parallel_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_parallel_phi;
-	parallel_phi.get_weights(weights_parallel_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_parallel_psi;
-	parallel_psi.get_weights(weights_parallel_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(int i=0; i< (int)weights_short_a.size(); i++) {
-		dp.short_a = weights_short_a[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_short_b.size(); j++) {
-			dp.short_b = weights_short_b[j].value;
-
-			// Average over longuest_edgeC distribution
-			for(int k=0; k< (int)weights_long_c.size(); k++) {
-				dp.long_c = weights_long_c[k].value;
-
-				// Average over theta distribution
-				for(int l=0; l< (int)weights_parallel_theta.size(); l++) {
-				dp.parallel_theta = weights_parallel_theta[l].value;
-
-					// Average over phi distribution
-					for(int m=0; m< (int)weights_parallel_phi.size(); m++) {
-						dp.parallel_phi = weights_parallel_phi[m].value;
-
-						// Average over phi distribution
-						for(int n=0; n< (int)weights_parallel_psi.size(); n++) {
-							dp.parallel_psi = weights_parallel_psi[n].value;
-							//Un-normalize by volume
-							double _ptvalue = weights_short_a[i].weight
-								* weights_short_b[j].weight
-								* weights_long_c[k].weight
-								* weights_parallel_theta[l].weight
-								* weights_parallel_phi[m].weight
-								* weights_parallel_psi[n].weight
-								* parallelepiped_analytical_2DXY(&dp, qx, qy)
-								* weights_short_a[i].value*weights_short_b[j].value
-								* weights_long_c[k].value;
-
-							if (weights_parallel_theta.size()>1) {
-								_ptvalue *= fabs(sin(weights_parallel_theta[l].value*pi/180.0));
-							}
-							sum += _ptvalue;
-							//Find average volume
-							vol += weights_short_a[i].weight
-								* weights_short_b[j].weight
-								* weights_long_c[k].weight
-								* weights_short_a[i].value*weights_short_b[j].value
-								* weights_long_c[k].value;
-							//Find norm for volume
-							norm_vol += weights_short_a[i].weight
-								* weights_short_b[j].weight
-								* weights_long_c[k].weight;
-
-							norm += weights_short_a[i].weight
-								* weights_short_b[j].weight
-								* weights_long_c[k].weight
-								* weights_parallel_theta[l].weight
-								* weights_parallel_phi[m].weight
-								* weights_parallel_psi[n].weight;
-						}
-					}
-
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_parallel_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double ParallelepipedModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double ParallelepipedModel :: calculate_ER() {
-	ParallelepipedParameters dp;
-	dp.short_a   = short_a();
-	dp.short_b   = short_b();
-	dp.long_c  = long_c();
-	double rad_out = 0.0;
-	double pi = 4.0*atan(1.0);
-	double suf_rad = sqrt(dp.short_a*dp.short_b/pi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_short_a;
-	short_a.get_weights(weights_short_a);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_short_b;
-	short_b.get_weights(weights_short_b);
-
-	// Get angular averaging for the longuest_edgeC
-	vector<WeightPoint> weights_long_c;
-	long_c.get_weights(weights_long_c);
-
-	// Loop over radius weight points
-	for(int i=0; i< (int)weights_short_a.size(); i++) {
-		dp.short_a = weights_short_a[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_short_b.size(); j++) {
-			dp.short_b = weights_short_b[j].value;
-
-			// Average over longuest_edgeC distribution
-			for(int k=0; k< (int)weights_long_c.size(); k++) {
-				dp.long_c = weights_long_c[k].value;
-				//Calculate surface averaged radius
-				//This is rough approximation.
-				suf_rad = sqrt(dp.short_a*dp.short_b/pi);
-
-				//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-				sum +=weights_short_a[i].weight* weights_short_b[j].weight
-					* weights_long_c[k].weight*DiamCyl(dp.long_c, suf_rad)/2.0;
-				norm += weights_short_a[i].weight* weights_short_b[j].weight*weights_long_c[k].weight;
-			}
-		}
-	}
-
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(length,radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.long_c, suf_rad)/2.0;}
-	return rad_out;
-
-}
Index: sansmodels/src/sans/models/c_models/parameters.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/parameters.cpp	(revision 83bf68e1b7cb622a72c76c9ab5405abc3116da24)
+++ 	(revision )
@@ -1,467 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-#include "parameters.hh"
-#include <stdio.h>
-#include <math.h>
-using namespace std;
-
-#if defined(_MSC_VER)
-#include "gamma_win.h"
-#endif
-
-/**
- * TODO: normalize all dispersion weight lists
- */
-
-
-/**
- * Weight points
- */
-WeightPoint :: WeightPoint() {
-	value = 0.0;
-	weight = 0.0;
-}
-
-WeightPoint :: WeightPoint(double v, double w) {
-	value = v;
-	weight = w;
-}
-
-/**
- * Dispersion models
- */
-DispersionModel :: DispersionModel() {
-	npts  = 1;
-	width = 0.0;
-};
-
-void DispersionModel :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->dispersion_to_dict(from, to);
-}
-void DispersionModel :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->dispersion_from_dict(from, to);
-}
-void DispersionModel :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-
-			if ((*par).has_min==false){
-				// width = sigma for angles
-				sig = width;
-			}
-			else{
-				//width = polydispersity (=sigma/value) for length
-				sig = width * value;
-			}
-			double val = value + sig * (1.0*double(i)/double(npts-1) - 0.5);
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  )
-				weights.insert(weights.end(), WeightPoint(val, 1.0));
-		}
-	}
-}
-
-/**
- * Method to set the weights
- * Not implemented for this class
- */
-void DispersionModel :: set_weights(int npoints, double* values, double* weights){}
-
-/**
- * Gaussian dispersion
- */
-
-GaussianDispersion :: GaussianDispersion() {
-	npts  = 100;
-	width = 0.0;
-	nsigmas = 10;
-};
-
-void GaussianDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->gaussian_to_dict(from, to);
-}
-void GaussianDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->gaussian_from_dict(from, to);
-}
-
-double gaussian_weight(double mean, double sigma, double x) {
-	double vary, expo_value;
-    vary = x-mean;
-    expo_value = -vary*vary/(2.0*sigma*sigma);
-    //return 1.0;
-    return exp(expo_value);
-}
-
-/**
- * Gaussian dispersion
- * @param mean: mean value of the Gaussian
- * @param sigma: standard deviation of the Gaussian
- * @param x: value at which the Gaussian is evaluated
- * @return: value of the Gaussian
- */
-void GaussianDispersion :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-		nsigmas = 10;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			if ((*par).has_min==false){
-				// width = sigma for angles
-				sig = width;
-			}
-			else{
-				//width = polydispersity (=sigma/value) for length
-				sig = width * value;
-			}
-			// We cover n(nsigmas) times sigmas on each side of the mean
-			double val = value + sig * (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 = gaussian_weight(value, sig, val);
-				weights.insert(weights.end(), WeightPoint(val, _w));
-			}
-		}
-	}
-}
-
-
-/**
- * Flat dispersion
- */
-
-RectangleDispersion :: RectangleDispersion() {
-	npts  = 100;
-	width = 0.0;
-	nsigmas = 1.73205;
-};
-
-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 wid = fabs(sigma) * sqrt(3.0);
-    if (x>= (mean-wid) && x<=(mean+wid)){
-    	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.73205;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			if ((*par).has_min==false){
-				// width = sigma for angles
-				sig = width;
-			}
-			else{
-				//width = polydispersity (=sigma/value) for length
-				sig = width * value;
-			}
-			// We cover n(nsigmas) times sigmas on each side of the mean
-			double val = value + sig * (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, sig, val);
-				weights.insert(weights.end(), WeightPoint(val, _w));
-			}
-		}
-	}
-}
-
-
-/**
- * LogNormal dispersion
- */
-
-LogNormalDispersion :: LogNormalDispersion() {
-	npts  = 100;
-	width = 0.0;
-	nsigmas = 10.0;
-};
-
-void LogNormalDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->lognormal_to_dict(from, to);
-}
-void LogNormalDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->lognormal_from_dict(from, to);
-}
-
-double lognormal_weight(double mean, double sigma, double x) {
-
-	double sigma2 = pow(sigma, 2.0);
-	return 1.0/(x*sigma) * exp( -pow((log(x) - mean), 2.0) / (2.0*sigma2));
-
-}
-
-/**
- * Lognormal dispersion
- * @param mean: mean value of the LogNormal
- * @param sigma: standard deviation of the LogNormal
- * @param x: value at which the LogNormal is evaluated
- * @return: value of the LogNormal
- */
-void LogNormalDispersion :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-		nsigmas = 10.0;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			// Note that the definition of sigma is different from Gaussian
-			if ((*par).has_min==false){
-				// sig  for angles
-				sig = width;
-			}
-			else{
-				// by lognormal definition, PD is same as sigma
-				sig = width * value;
-			}
-			
-			// We cover n(nsigmas) times sigmas on each side of the mean
-			//constant bin in real space
-			double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);
-			// sigma in the lognormal function is in ln(R) space, thus needs converting
-			sig = fabs(sig/value); 
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  ) {
-				double _w = lognormal_weight(log(value), sig, val);
-				weights.insert(weights.end(), WeightPoint(val, _w));
-				//printf("%g \t %g\n",val,_w);
-
-			}
-		}
-	}
-}
-
-
-
-/**
- * Schulz dispersion
- */
-
-SchulzDispersion :: SchulzDispersion() {
-	npts  = 100;
-	width = 0.0;
-	nsigmas = 10.0;
-};
-
-void SchulzDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->schulz_to_dict(from, to);
-}
-void SchulzDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->schulz_from_dict(from, to);
-}
-
-double schulz_weight(double mean, double sigma, double x) {
-    double z = pow(mean/ sigma, 2.0)-1.0;
-	double R= x/mean;
-	double zz= z+1.0;
-	double expo;
-	expo = zz*log(zz)+z*log(R)-R*zz-log(mean)-lgamma(zz);
-	return  exp(expo);
-}
-
-/**
- * Schulz dispersion
- * @param mean: mean value of the Schulz
- * @param sigma: standard deviation of the Schulz
- * @param x: value at which the Schulz is evaluated
- * @return: value of the Schulz
- */
-void SchulzDispersion :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-		nsigmas = 10.0;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			if ((*par).has_min==false){
-				// width = sigma for angles
-				sig = width;
-			}
-			else{
-				//width = polydispersity (=sigma/value) for length
-				sig = width * value;
-			}
-			// We cover n(nsigmas) times sigmas on each side of the mean
-			double val = value + sig * (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 = schulz_weight(value, sig, val);
-				weights.insert(weights.end(), WeightPoint(val, _w));
-			}
-		}
-	}
-}
-
-
-
-
-/**
- * Array dispersion based on input arrays
- */
-
-void ArrayDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->array_to_dict(from, to);
-}
-void ArrayDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->array_from_dict(from, to);
-}
-
-/**
- * Method to get the weights
- */
-void ArrayDispersion :: operator() (void *param, vector<WeightPoint> &weights) {
-	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++) {
-			double val = _values[i]; //+ value;  //ToDo: Talk to Paul and put back the 'value'.
-
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  )
-				weights.insert(weights.end(), WeightPoint(val, _weights[i]));
-		}
-	}
-}
-/**
- * Method to set the weights
- */
-void ArrayDispersion :: set_weights(int npoints, double* values, double* weights){
-	npts = npoints;
-	_values = values;
-	_weights = weights;
-}
-
-
-/**
- * Parameters
- */
-Parameter :: Parameter() {
-	value = 0;
-	min   = 0.0;
-	max   = 0.0;
-	has_min = false;
-	has_max = false;
-	has_dispersion = false;
-	dispersion = new GaussianDispersion();
-}
-
-Parameter :: Parameter(double _value) {
-	value = _value;
-	min   = 0.0;
-	max   = 0.0;
-	has_min = false;
-	has_max = false;
-	has_dispersion = false;
-	dispersion = new GaussianDispersion();
-}
-
-Parameter :: Parameter(double _value, bool disp) {
-	value = _value;
-	min   = 0.0;
-	max   = 0.0;
-	has_min = false;
-	has_max = false;
-	has_dispersion = disp;
-	dispersion = new GaussianDispersion();
-}
-
-void Parameter :: get_weights(vector<WeightPoint> &weights) {
-	(*dispersion)((void*)this, weights);
-}
-
-void Parameter :: set_min(double value) {
-	has_min = true;
-	min = value;
-}
-
-void Parameter :: set_max(double value) {
-	has_max = true;
-	max = value;
-}
-
-double Parameter :: operator()() {
-	return value;
-}
-
-double Parameter :: operator=(double _value){
-	value = _value;
-	return value;
-}
Index: sansmodels/src/sans/models/c_models/parameters.hh
===================================================================
--- sansmodels/src/sans/models/c_models/parameters.hh	(revision 8dc02d8b4348f58c310e83b1e0b10a5ab1e56f16)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-#ifndef PARAM_CLASS_H
-#define PARAM_CLASS_H
-/**
- * TODO: will need to write a bridge class
- * to convert the dispersion model parameters
- * into dictionary parameters for python.
- */
-#include <vector>
-#include "dispersion_visitor.hh"
-
-using namespace std;
-
-/**
- * Weight point class to hold averaging points
- */
-class WeightPoint {
-public:
-	/// Value of the weight point
-	double value;
-	/// Weight of the weight point
-	double weight;
-
-	WeightPoint();
-	WeightPoint(double, double);
-};
-
-/**
- * Basic averaging model. The class instance will
- * generate a flat distribution of weight points
- * according to the number of points specified
- * and the width of the distribution. The center
- * of the distribution is specified by the
- * Parameter object taken in as a parameter.
- */
-class DispersionModel {
-public:
-	/// Number of points to average over
-	int npts;
-	/// Width of the distribution (step function)
-	double width;
-
-	DispersionModel();
-	/// Method that generates the weight points
-	virtual void operator()(void *, vector<WeightPoint>&);
-	virtual void set_weights(int, double*, double*);
-	virtual void accept_as_source(DispersionVisitor*, void*, void*);
-	virtual void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-
-/**
- * Gaussian dispersion model
- */
-class GaussianDispersion: public DispersionModel {
-public:
-	/// Number of sigmas on each side of the mean
-	double nsigmas;
-
-	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*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-/**
- * Schulz dispersion model
- */
-class SchulzDispersion: public DispersionModel {
-public:
-	/// Number of sigmas on each side of the mean
-	double nsigmas;
-
-	SchulzDispersion();
-	void operator()(void *, vector<WeightPoint>&);
-	void accept_as_source(DispersionVisitor*, void*, void*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-/**
- * LogNormal dispersion model
- */
-class LogNormalDispersion: public DispersionModel {
-public:
-	/// Number of sigmas on each side of the mean
-	double nsigmas;
-
-	LogNormalDispersion();
-	void operator()(void *, vector<WeightPoint>&);
-	void accept_as_source(DispersionVisitor*, void*, void*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-};
-
-
-/**
- * Dispersion model based on arrays provided by the user
- */
-class ArrayDispersion: public DispersionModel {
-private:
-	/// Array of values
-	double* _values;
-	/// Array of weights
-	double* _weights;
-
-	/// Method to set the weight points from arrays
-	void set_weights(int, double*, double*);
-	void operator()(void *, vector<WeightPoint>&);
-	void accept_as_source(DispersionVisitor*, void*, void*);
-	void accept_as_destination(DispersionVisitor*, void*, void*);
-public:
-
-};
-
-/**
- * Parameter class to hold information about a
- * parameter.
- */
-class Parameter {
-public:
-	/// Current value of the parameter
-	double value;
-	/// True if the parameter has a minimum bound
-	bool has_min;
-	/// True if the parameter has a maximum bound
-	bool has_max;
-	/// Minimum bound
-	double min;
-	/// Maximum bound
-	double max;
-	/// True if the parameter can be dispersed or averaged
-	bool has_dispersion;
-	/// Pointer to the dispersion model object for this parameter
-	DispersionModel* dispersion;
-
-	Parameter();
-	Parameter(double);
-	Parameter(double, bool);
-
-	/// Method to set a minimum value
-	void set_min(double);
-	/// Method to set a maximum value
-	void set_max(double);
-	/// Method to get weight points for this parameter
-	void get_weights(vector<WeightPoint>&);
-	/// Returns the value of the parameter
-	double operator()();
-	/// Sets the value of the parameter
-	double operator=(double);
-};
-#endif
Index: sansmodels/src/sans/models/c_models/pearlnecklace.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/pearlnecklace.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,177 +1,0 @@
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "pearlnecklace.h"
-}
-
-PearlNecklaceModel :: PearlNecklaceModel() {
-	scale = Parameter(1.0);
-	radius = Parameter(80.0, true);
-	radius.set_min(0.0);
-	edge_separation = Parameter(350.0, true);
-	edge_separation.set_min(0.0);
-	thick_string = Parameter(2.5, true);
-	thick_string.set_min(0.0);
-	num_pearls = Parameter(3);
-	num_pearls.set_min(0.0);
-	sld_pearl = Parameter(1.0e-06);
-	sld_string = Parameter(1.0e-06);
-	sld_solv = Parameter(6.3e-06);
-    background = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D PearlNecklaceModel function
- * @param q: q-value
- * @return: function value
- */
-double PearlNecklaceModel :: operator()(double q) {
-	double dp[9];
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = edge_separation();
-	dp[3] = thick_string();
-	dp[4] = num_pearls();
-	dp[5] = sld_pearl();
-	dp[6] = sld_string();
-	dp[7] = sld_solv();
-	dp[8] = 0.0;
-	double pi = 4.0*atan(1.0);
-	// No polydispersion supported in this model.
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-	vector<WeightPoint> weights_edge_separation;
-	edge_separation.get_weights(weights_edge_separation);
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double string_vol = 0.0;
-	double pearl_vol = 0.0;
-	double tot_vol = 0.0;
-	// Loop over core weight points
-	for(size_t i=0; i<weights_radius.size(); i++) {
-		dp[1] = weights_radius[i].value;
-		// Loop over thick_inter0 weight points
-		for(size_t j=0; j<weights_edge_separation.size(); j++) {
-			dp[2] = weights_edge_separation[j].value;
-			pearl_vol = 4.0 /3.0 * pi * pow(dp[1], 3);
-			string_vol =dp[2] * pi * pow((dp[3] / 2.0), 2);
-			tot_vol = (dp[4] - 1.0) * string_vol;
-			tot_vol += dp[4] * pearl_vol;
-			//Un-normalize Sphere by volume
-			sum += weights_radius[i].weight * weights_edge_separation[j].weight
-				* pearl_necklace_kernel(dp,q) * tot_vol;
-			//Find average volume
-			vol += weights_radius[i].weight * weights_edge_separation[j].weight
-				* tot_vol;
-			norm += weights_radius[i].weight * weights_edge_separation[j].weight;
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D PearlNecklaceModel function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double PearlNecklaceModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate PearlNecklaceModel function
- * @param pars: parameters of the PearlNecklaceModel
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double PearlNecklaceModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate TOTAL radius
- * Todo: decide whether or not we keep this calculation
- * @return: effective radius value
- */
-// No polydispersion supported in this model.
-// Calculate max radius assumming max_radius = effective radius
-// Note that this max radius is not affected by sld of layer, sld of interface, or
-// sld of solvent.
-double PearlNecklaceModel :: calculate_ER() {
-	PeralNecklaceParameters dp;
-
-	dp.scale = scale();
-	dp.radius = radius();
-	dp.edge_separation = edge_separation();
-	dp.thick_string = thick_string();
-	dp.num_pearls = num_pearls();
-
-	double rad_out = 0.0;
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double pi = 4.0*atan(1.0);
-	// No polydispersion supported in this model.
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-	vector<WeightPoint> weights_edge_separation;
-	edge_separation.get_weights(weights_edge_separation);
-	// Perform the computation, with all weight points
-	double string_vol = 0.0;
-	double pearl_vol = 0.0;
-	double tot_vol = 0.0;
-	// Loop over core weight points
-	for(size_t i=0; i<weights_radius.size(); i++) {
-		dp.radius = weights_radius[i].value;
-		// Loop over thick_inter0 weight points
-		for(size_t j=0; j<weights_edge_separation.size(); j++) {
-			dp.edge_separation = weights_edge_separation[j].value;
-			pearl_vol = 4.0 /3.0 * pi * pow(dp.radius , 3);
-			string_vol =dp.edge_separation * pi * pow((dp.thick_string / 2.0), 2);
-			tot_vol = (dp.num_pearls - 1.0) * string_vol;
-			tot_vol += dp.num_pearls * pearl_vol;
-			//Find  volume
-			// This may be a too much approximation
-			//Todo: decided whether or not we keep this calculation
-			sum += weights_radius[i].weight * weights_edge_separation[j].weight
-				* pow(3.0*tot_vol/4.0/pi,0.333333);
-			norm += weights_radius[i].weight * weights_edge_separation[j].weight;
-		}
-	}
-
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		pearl_vol = 4.0 /3.0 * pi * pow(dp.radius , 3);
-		string_vol =dp.edge_separation * pi * pow((dp.thick_string / 2.0), 2);
-		tot_vol = (dp.num_pearls - 1.0) * string_vol;
-		tot_vol += dp.num_pearls * pearl_vol;
-
-		rad_out =  pow((3.0*tot_vol/4.0/pi), 0.33333);
-		}
-
-	return rad_out;
-
-}
Index: sansmodels/src/sans/models/c_models/polygausscoil.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/polygausscoil.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libTwoPhase.h"
-	#include "polygausscoil.h"
-}
-
-Poly_GaussCoil :: Poly_GaussCoil() {
-	scale      = Parameter(1.0);
-	rg     = Parameter(60.0, true);
-	rg.set_min(0.0);
-	poly_m   = Parameter(2.0);
-	background = Parameter(0.001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double Poly_GaussCoil :: operator()(double q) {
-	double dp[4];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = rg();
-	dp[2] = poly_m();
-	dp[3] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rg.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-
-
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		sum += weights_rad[i].weight
-			* PolyGaussCoil(dp, q) * pow(weights_rad[i].value,3);
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-
-
-	sum = PolyGaussCoil(dp, q);
-	return sum + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double Poly_GaussCoil :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Poly_GaussCoil :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double Poly_GaussCoil :: calculate_ER() {
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rg.get_weights(weights_rad);
-	// Loop over radius weight points to average the radius value
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		sum += weights_rad[i].weight
-			* weights_rad[i].value;
-		norm += weights_rad[i].weight;
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = rg();}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/refl.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/refl.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,173 +1,0 @@
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "refl.h"
-}
-
-ReflModel :: ReflModel() {
-	n_layers = Parameter(1.0);
-	scale = Parameter(1.0);
-	thick_inter0 = Parameter(1.0);
-	func_inter0 = Parameter(0);
-	sld_bottom0 = Parameter(2.07e-06);
-	sld_medium = Parameter(1.0e-06);
-    background = Parameter(0.0);
-
-
-    sld_flat1 = Parameter(3.0e-06);
-    sld_flat2 = Parameter(3.5e-06);
-    sld_flat3 = Parameter(4.0e-06);
-    sld_flat4 = Parameter(3.5e-06);
-    sld_flat5 = Parameter(4.0e-06);
-    sld_flat6 = Parameter(3.5e-06);
-    sld_flat7 = Parameter(4.0e-06);
-    sld_flat8 = Parameter(3.5e-06);
-    sld_flat9 = Parameter(4.0e-06);
-    sld_flat10 = Parameter(3.5e-06);
-
-
-    thick_inter1 = Parameter(1);
-    thick_inter2 = Parameter(1);
-    thick_inter3 = Parameter(1);
-    thick_inter4 = Parameter(1);
-    thick_inter5 = Parameter(1);
-    thick_inter6 = Parameter(1);
-    thick_inter7 = Parameter(1);
-    thick_inter8 = Parameter(1);
-    thick_inter9 = Parameter(1);
-    thick_inter10 = Parameter(1);
-
-
-    thick_flat1 = Parameter(15);
-    thick_flat2 = Parameter(100);
-    thick_flat3 = Parameter(100);
-    thick_flat4 = Parameter(100);
-    thick_flat5 = Parameter(100);
-    thick_flat6 = Parameter(100);
-    thick_flat7 = Parameter(100);
-    thick_flat8 = Parameter(100);
-    thick_flat9 = Parameter(100);
-    thick_flat10 = Parameter(100);
-
-
-    func_inter1 = Parameter(0);
-    func_inter2 = Parameter(0);
-    func_inter3 = Parameter(0);
-    func_inter4 = Parameter(0);
-    func_inter5 = Parameter(0);
-    func_inter6 = Parameter(0);
-    func_inter7 = Parameter(0);
-    func_inter8 = Parameter(0);
-    func_inter9 = Parameter(0);
-    func_inter10 = Parameter(0);
-
-}
-
-/**
- * Function to evaluate 1D NR function
- * @param q: q-value
- * @return: function value
- */
-double ReflModel :: operator()(double q) {
-	double dp[47];
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = n_layers();
-	dp[1] = scale();
-	dp[2] = thick_inter0();
-	dp[3] = func_inter0();
-	dp[4] = sld_bottom0();
-	dp[5] = sld_medium();
-	dp[6] = background();
-
-	dp[7] = sld_flat1();
-	dp[8] = sld_flat2();
-	dp[9] = sld_flat3();
-	dp[10] = sld_flat4();
-	dp[11] = sld_flat5();
-	dp[12] = sld_flat6();
-	dp[13] = sld_flat7();
-	dp[14] = sld_flat8();
-	dp[15] = sld_flat9();
-	dp[16] = sld_flat10();
-
-	dp[17] = thick_inter1();
-	dp[18] = thick_inter2();
-	dp[19] = thick_inter3();
-	dp[20] = thick_inter4();
-	dp[21] = thick_inter5();
-	dp[22] = thick_inter6();
-	dp[23] = thick_inter7();
-	dp[24] = thick_inter8();
-	dp[25] = thick_inter9();
-	dp[26] = thick_inter10();
-
-	dp[27] = thick_flat1();
-	dp[28] = thick_flat2();
-	dp[29] = thick_flat3();
-	dp[30] = thick_flat4();
-	dp[31] = thick_flat5();
-	dp[32] = thick_flat6();
-	dp[33] = thick_flat7();
-	dp[34] = thick_flat8();
-	dp[35] = thick_flat9();
-	dp[36] = thick_flat10();
-
-	dp[37] = func_inter1();
-	dp[38] = func_inter2();
-	dp[39] = func_inter3();
-	dp[40] = func_inter4();
-	dp[41] = func_inter5();
-	dp[42] = func_inter6();
-	dp[43] = func_inter7();
-	dp[44] = func_inter8();
-	dp[45] = func_inter9();
-	dp[46] = func_inter10();
-
-	// Get the dispersion points for the radius
-	//vector<WeightPoint> weights_thick;
-	//thick_inter0.get_weights(weights_thick_inter0);
-
-
-	return re_kernel(dp,q);
-}
-
-/**
- * Function to evaluate 2D NR function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double ReflModel :: operator()(double qx, double qy) {
-	// For 2D set qy as q, ignoring qx.
-	double q = qy;//sqrt(qx*qx + qy*qy);
-	if (q < 0.0){
-		return 0.0;
-	}
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D NR function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double ReflModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double ReflModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/refl_adv.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/refl_adv.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,225 +1,0 @@
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "refl_adv.h"
-}
-
-ReflAdvModel :: ReflAdvModel() {
-	n_layers = Parameter(1.0);
-	scale = Parameter(1.0);
-	thick_inter0 = Parameter(1.0);
-	func_inter0 = Parameter(0);
-	sld_bottom0 = Parameter(2.07e-06);
-	sld_medium = Parameter(1.0e-06);
-    background = Parameter(0.0);
-
-
-    sld_flat1 = Parameter(2.7e-06);
-    sld_flat2 = Parameter(3.5e-06);
-    sld_flat3 = Parameter(4.0e-06);
-    sld_flat4 = Parameter(3.5e-06);
-    sld_flat5 = Parameter(4.0e-06);
-    sld_flat6 = Parameter(3.5e-06);
-    sld_flat7 = Parameter(4.0e-06);
-    sld_flat8 = Parameter(3.5e-06);
-    sld_flat9 = Parameter(4.0e-06);
-    sld_flat10 = Parameter(3.5e-06);
-
-
-    thick_inter1 = Parameter(1.0);
-    thick_inter2 = Parameter(1.0);
-    thick_inter3 = Parameter(1.0);
-    thick_inter4 = Parameter(1.0);
-    thick_inter5 = Parameter(1.0);
-    thick_inter6 = Parameter(1.0);
-    thick_inter7 = Parameter(1.0);
-    thick_inter8 = Parameter(1.0);
-    thick_inter9 = Parameter(1.0);
-    thick_inter10 = Parameter(1.0);
-
-
-    thick_flat1 = Parameter(15.0);
-    thick_flat2 = Parameter(100.0);
-    thick_flat3 = Parameter(100.0);
-    thick_flat4 = Parameter(100.0);
-    thick_flat5 = Parameter(100.0);
-    thick_flat6 = Parameter(100.0);
-    thick_flat7 = Parameter(100.0);
-    thick_flat8 = Parameter(100.0);
-    thick_flat9 = Parameter(100.0);
-    thick_flat10 = Parameter(100.0);
-
-
-    func_inter1 = Parameter(0);
-    func_inter2 = Parameter(0);
-    func_inter3 = Parameter(0);
-    func_inter4 = Parameter(0);
-    func_inter5 = Parameter(0);
-    func_inter6 = Parameter(0);
-    func_inter7 = Parameter(0);
-    func_inter8 = Parameter(0);
-    func_inter9 = Parameter(0);
-    func_inter10 = Parameter(0);
-
-    sldIM_flat1 = Parameter(0);
-    sldIM_flat2 = Parameter(0);
-    sldIM_flat3 = Parameter(0);
-    sldIM_flat4 = Parameter(0);
-    sldIM_flat5 = Parameter(0);
-    sldIM_flat6 = Parameter(0);
-    sldIM_flat7 = Parameter(0);
-    sldIM_flat8 = Parameter(0);
-    sldIM_flat9 = Parameter(0);
-    sldIM_flat10 = Parameter(0);
-
-    nu_inter1 = Parameter(2.5);
-    nu_inter2 = Parameter(2.5);
-    nu_inter3 = Parameter(2.5);
-    nu_inter4 = Parameter(2.5);
-    nu_inter5 = Parameter(2.5);
-    nu_inter6 = Parameter(2.5);
-    nu_inter7 = Parameter(2.5);
-    nu_inter8 = Parameter(2.5);
-    nu_inter9 = Parameter(2.5);
-    nu_inter10 = Parameter(2.5);
-
-    sldIM_sub0 = Parameter(0.0);
-    sldIM_medium = Parameter(0.0);
-    npts_inter = Parameter(21.0);
-    nu_inter0 = Parameter(2.5);
-}
-
-/**
- * Function to evaluate 1D NR function
- * @param q: q-value
- * @return: function value
- */
-double ReflAdvModel :: operator()(double q) {
-	double dp[71];
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = n_layers();
-	dp[1] = scale();
-	dp[2] = thick_inter0();
-	dp[3] = func_inter0();
-	dp[4] = sld_bottom0();
-	dp[5] = sld_medium();
-	dp[6] = background();
-
-	dp[7] = sld_flat1();
-	dp[8] = sld_flat2();
-	dp[9] = sld_flat3();
-	dp[10] = sld_flat4();
-	dp[11] = sld_flat5();
-	dp[12] = sld_flat6();
-	dp[13] = sld_flat7();
-	dp[14] = sld_flat8();
-	dp[15] = sld_flat9();
-	dp[16] = sld_flat10();
-
-	dp[17] = thick_inter1();
-	dp[18] = thick_inter2();
-	dp[19] = thick_inter3();
-	dp[20] = thick_inter4();
-	dp[21] = thick_inter5();
-	dp[22] = thick_inter6();
-	dp[23] = thick_inter7();
-	dp[24] = thick_inter8();
-	dp[25] = thick_inter9();
-	dp[26] = thick_inter10();
-
-	dp[27] = thick_flat1();
-	dp[28] = thick_flat2();
-	dp[29] = thick_flat3();
-	dp[30] = thick_flat4();
-	dp[31] = thick_flat5();
-	dp[32] = thick_flat6();
-	dp[33] = thick_flat7();
-	dp[34] = thick_flat8();
-	dp[35] = thick_flat9();
-	dp[36] = thick_flat10();
-
-	dp[37] = func_inter1();
-	dp[38] = func_inter2();
-	dp[39] = func_inter3();
-	dp[40] = func_inter4();
-	dp[41] = func_inter5();
-	dp[42] = func_inter6();
-	dp[43] = func_inter7();
-	dp[44] = func_inter8();
-	dp[45] = func_inter9();
-	dp[46] = func_inter10();
-
-	dp[47] = sldIM_flat1();
-	dp[48] = sldIM_flat2();
-	dp[49] = sldIM_flat3();
-	dp[50] = sldIM_flat4();
-	dp[51] = sldIM_flat5();
-	dp[52] = sldIM_flat6();
-	dp[53] = sldIM_flat7();
-	dp[54] = sldIM_flat8();
-	dp[55] = sldIM_flat9();
-	dp[56] = sldIM_flat10();
-
-	dp[57] = nu_inter1();
-	dp[58] = nu_inter2();
-	dp[59] = nu_inter3();
-	dp[60] = nu_inter4();
-	dp[61] = nu_inter5();
-	dp[62] = nu_inter6();
-	dp[63] = nu_inter7();
-	dp[64] = nu_inter8();
-	dp[65] = nu_inter9();
-	dp[66] = nu_inter10();
-
-	dp[67] = sldIM_sub0();
-	dp[68] = sldIM_medium();
-	dp[69] = npts_inter();
-	dp[70] = nu_inter0();
-	// Get the dispersion points for the radius
-	//vector<WeightPoint> weights_thick;
-	//thick_inter0.get_weights(weights_thick_inter0);
-
-
-	return re_adv_kernel(dp,q);
-}
-
-/**
- * Function to evaluate 2D NR function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double ReflAdvModel :: operator()(double qx, double qy) {
-	// For 2D set qy as q, ignoring qx.
-	double q = qy;//sqrt(qx*qx + qy*qy);
-	if (q < 0.0){
-		return 0.0;
-	}
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D NR function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double ReflAdvModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double ReflAdvModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/rpa.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/rpa.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "rpa.h"
-}
-
-RPAModel :: RPAModel() {
-	lcase_n = Parameter(0.0);
-	ba = Parameter(5.0);
-	bb = Parameter(5.0);
-	bc = Parameter(5.0);
-	bd = Parameter(5.0);
-
-    Kab = Parameter(-0.0004);
-    Kac = Parameter(-0.0004);
-    Kad = Parameter(-0.0004);
-    Kbc = Parameter(-0.0004);
-    Kbd = Parameter(-0.0004);
-    Kcd = Parameter(-0.0004);
-
-    scale = Parameter(1.0);
-    background = Parameter(0.0);
-
-    Na = Parameter(1000.0);
-    Phia = Parameter(0.25);
-    va = Parameter(100.0);
-    La = Parameter(1.0e-012);
-
-    Nb = Parameter(1000.0);
-    Phib = Parameter(0.25);
-    vb = Parameter(100.0);
-    Lb = Parameter(1.0e-012);
-
-    Nc = Parameter(1000.0);
-    Phic = Parameter(0.25);
-    vc = Parameter(100.0);
-    Lc = Parameter(1.0e-012);
-
-    Nd = Parameter(1000.0);
-    Phid = Parameter(0.25);
-    vd = Parameter(100.0);
-    Ld = Parameter(0.0e-012);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double RPAModel :: operator()(double q) {
-	double dp[29];
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	//Fittable parameters
-	dp[0] = lcase_n();
-
-	dp[1] = ba();
-	dp[2] = bb();
-	dp[3] = bc();
-	dp[4] = bd();
-
-	dp[5] = Kab();
-	dp[6] = Kac();
-	dp[7] = Kad();
-	dp[8] = Kbc();
-	dp[9] = Kbd();
-	dp[10] = Kcd();
-
-	dp[11] = scale();
-	dp[12] = background();
-
-	//Fixed parameters
-	dp[13] = Na();
-	dp[14] = Phia();
-	dp[15] = va();
-	dp[16] = La();
-
-	dp[17] = Nb();
-	dp[18] = Phib();
-	dp[19] = vb();
-	dp[20] = Lb();
-
-	dp[21] = Nc();
-	dp[22] = Phic();
-	dp[23] = vc();
-	dp[24] = Lc();
-
-	dp[25] = Nd();
-	dp[26] = Phid();
-	dp[27] = vd();
-	dp[28] = Ld();
-
-	return rpa_kernel(dp,q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double RPAModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RPAModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double RPAModel :: calculate_ER() {
-//NOT implemented!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/run.py
===================================================================
--- sansmodels/src/sans/models/c_models/run.py	(revision fca6936ab3704433fa2327bcd55367e8ea28de72)
+++ 	(revision )
@@ -1,20 +1,0 @@
-import sys, os, math
-from sans.models.CylinderModel import CylinderModel
-from sans.models.DisperseModel import DisperseModel
-
-os.system('gcc -c ../../../libigor/libCylinder.c -o libigor.o -I../c_extensions -I../../../libigor')
-os.system('gcc -c ../c_extensions/cylinder.c -o libcyl.o -I../c_extensions -I../../../libigor')
-os.system('g++ -mno-cygwin cylinder.cpp parameters.cpp  dispersion_visitor.cpp libigor.o libcyl.o -D__MODELS_STANDALONE__ -I../c_extensions -I../../../libigor')
-os.system('a.exe')
-
-
-cyl = CylinderModel()
-cyl.setParam('cyl_phi', 0.0)
-cyl.setParam('cyl_theta', 0.0)
-
-disp = DisperseModel(cyl, ['radius'], [5])
-disp.setParam('n_pts', 100)
-print "" 
-print "Cyl (python): ", cyl.run(0.001)
-print "Disp(pyhton): ", disp.run(0.001)
-
Index: sansmodels/src/sans/models/c_models/sc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/sc.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "sc.h"
-}
-
-SCCrystalModel :: SCCrystalModel() {
-	scale      = Parameter(1.0);
-	dnn		= Parameter(220.0);
-	d_factor = Parameter(0.06);
-	radius     = Parameter(40.0, true);
-	radius.set_min(0.0);
-	sldSph   = Parameter(3.0e-6);
-	sldSolv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	theta  = Parameter(0.0, true);
-	phi    = Parameter(0.0, true);
-	psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double SCCrystalModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = dnn();
-	dp[2] = d_factor();
-	dp[3] = radius();
-	dp[4] = sldSph();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double result;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[3] = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		result = SC_ParaCrystal(dp, q) * pow(weights_rad[i].value,3);
-		// This FIXES a singualrity the kernel in libigor.
-		if ( result == INFINITY || result == NAN){
-			result = 0.0;
-		}
-		sum += weights_rad[i].weight
-			* result;
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double SCCrystalModel :: operator()(double qx, double qy) {
-	SCParameters dp;
-	dp.scale      = scale();
-	dp.dnn   = dnn();
-	dp.d_factor   = d_factor();
-	dp.radius  = radius();
-	dp.sldSph   = sldSph();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.theta  = theta();
-	dp.phi    = phi();
-	dp.psi    = psi();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	phi.get_weights(weights_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_psi;
-	psi.get_weights(weights_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.radius = weights_rad[i].value;
-		// Average over theta distribution
-		for(size_t j=0; j< weights_theta.size(); j++) {
-			dp.theta = weights_theta[j].value;
-			// Average over phi distribution
-			for(size_t k=0; k< weights_phi.size(); k++) {
-				dp.phi = weights_phi[k].value;
-				// Average over phi distribution
-				for(size_t l=0; l< weights_psi.size(); l++) {
-					dp.psi = weights_psi[l].value;
-					//Un-normalize SphereForm by volume
-					double _ptvalue = weights_rad[i].weight
-										* weights_theta[j].weight
-										* weights_phi[k].weight
-										* weights_psi[l].weight
-										* sc_analytical_2DXY(&dp, qx, qy);
-										//* pow(weights_rad[i].value,3.0);
-					// Consider when there is infinte or nan.
-					if ( _ptvalue == INFINITY || _ptvalue == NAN){
-						_ptvalue = 0.0;
-					}
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(sin(weights_theta[j].value*pi/180.0));
-					}
-					sum += _ptvalue;
-					// This model dose not need the volume of spheres correction!!!
-					//Find average volume
-					//vol += weights_rad[i].weight
-					//	* pow(weights_rad[i].value,3);
-					//Find norm for volume
-					//norm_vol += weights_rad[i].weight;
-
-					norm += weights_rad[i].weight
-							* weights_theta[j].weight
-							* weights_phi[k].weight
-							* weights_psi[l].weight;
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SCCrystalModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SCCrystalModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/sld_cal.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/sld_cal.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/c_extensions/libmultifunc/librefl.h
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "sld_cal.h"
-}
-
-SLDCalFunc :: SLDCalFunc() {
-	fun_type     = Parameter(0);
-	npts_inter   = Parameter(21);
-	shell_num	 = Parameter(1);
-	nu_inter	 = Parameter(2.5);
-	sld_left 	 = Parameter(1.0e-06);
-	sld_right	 = Parameter(2.0e-06);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double SLDCalFunc :: operator()(double q) {
-	SLDCalParameters dp;
-
-	dp.fun_type = fun_type();
-	dp.npts_inter = npts_inter();
-	dp.shell_num = shell_num();
-	dp.nu_inter = nu_inter();
-	dp.sld_left = sld_left();
-	dp.sld_right = sld_right();
-
-	return sld_cal_analytical_1D(&dp, q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double SLDCalFunc :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-		return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SLDCalFunc :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SLDCalFunc :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
Index: sansmodels/src/sans/models/c_models/sphere.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/sphere.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "sphere.h"
-}
-
-SphereModel :: SphereModel() {
-	scale      = Parameter(1.0);
-	radius     = Parameter(20.0, true);
-	radius.set_min(0.0);
-	sldSph   = Parameter(4.0e-6);
-	sldSolv   = Parameter(1.0e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double SphereModel :: operator()(double q) {
-	double dp[5];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = sldSph();
-	dp[3] = sldSolv();
-	dp[4] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		sum += weights_rad[i].weight
-			* SphereForm(dp, q) * pow(weights_rad[i].value,3);
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double SphereModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SphereModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SphereModel :: calculate_ER() {
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-	// Loop over radius weight points to average the radius value
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		sum += weights_rad[i].weight
-			* weights_rad[i].value;
-		norm += weights_rad[i].weight;
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = radius();}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/spheresld.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/spheresld.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
+++ 	(revision )
@@ -1,336 +1,0 @@
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "spheresld.h"
-}
-
-SphereSLDModel :: SphereSLDModel() {
-	n_shells = Parameter(1.0);
-	scale = Parameter(1.0);
-	thick_inter0 = Parameter(1.0, true);
-	thick_inter0.set_min(0.0);
-	func_inter0 = Parameter(0);
-	sld_core0 = Parameter(2.07e-06);
-	sld_solv = Parameter(1.0e-06);
-    background = Parameter(0.0);
-
-
-    sld_flat1 = Parameter(2.7e-06);
-    sld_flat2 = Parameter(3.5e-06);
-    sld_flat3 = Parameter(4.0e-06);
-    sld_flat4 = Parameter(3.5e-06);
-    sld_flat5 = Parameter(4.0e-06);
-    sld_flat6 = Parameter(3.5e-06);
-    sld_flat7 = Parameter(4.0e-06);
-    sld_flat8 = Parameter(3.5e-06);
-    sld_flat9 = Parameter(4.0e-06);
-    sld_flat10 = Parameter(3.5e-06);
-
-
-    thick_inter1 = Parameter(1.0);
-    thick_inter2 = Parameter(1.0);
-    thick_inter3 = Parameter(1.0);
-    thick_inter4 = Parameter(1.0);
-    thick_inter5 = Parameter(1.0);
-    thick_inter6 = Parameter(1.0);
-    thick_inter7 = Parameter(1.0);
-    thick_inter8 = Parameter(1.0);
-    thick_inter9 = Parameter(1.0);
-    thick_inter10 = Parameter(1.0);
-
-
-    thick_flat1 = Parameter(100.0);
-    thick_flat2 = Parameter(100.0);
-    thick_flat3 = Parameter(100.0);
-    thick_flat4 = Parameter(100.0);
-    thick_flat5 = Parameter(100.0);
-    thick_flat6 = Parameter(100.0);
-    thick_flat7 = Parameter(100.0);
-    thick_flat8 = Parameter(100.0);
-    thick_flat9 = Parameter(100.0);
-    thick_flat10 = Parameter(100.0);
-
-
-    func_inter1 = Parameter(0);
-    func_inter2 = Parameter(0);
-    func_inter3 = Parameter(0);
-    func_inter4 = Parameter(0);
-    func_inter5 = Parameter(0);
-    func_inter6 = Parameter(0);
-    func_inter7 = Parameter(0);
-    func_inter8 = Parameter(0);
-    func_inter9 = Parameter(0);
-    func_inter10 = Parameter(0);
-
-    nu_inter1 = Parameter(2.5);
-    nu_inter2 = Parameter(2.5);
-    nu_inter3 = Parameter(2.5);
-    nu_inter4 = Parameter(2.5);
-    nu_inter5 = Parameter(2.5);
-    nu_inter6 = Parameter(2.5);
-    nu_inter7 = Parameter(2.5);
-    nu_inter8 = Parameter(2.5);
-    nu_inter9 = Parameter(2.5);
-    nu_inter10 = Parameter(2.5);
-
-    npts_inter = Parameter(35.0);
-    nu_inter0 = Parameter(2.5);
-    rad_core0 = Parameter(60.0, true);
-    rad_core0.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D SphereSLD function
- * @param q: q-value
- * @return: function value
- */
-double SphereSLDModel :: operator()(double q) {
-	double dp[60];
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = n_shells();
-	dp[1] = scale();
-	dp[2] = thick_inter0();
-	dp[3] = func_inter0();
-	dp[4] = sld_core0();
-	dp[5] = sld_solv();
-	dp[6] = 0.0;
-
-	dp[7] = sld_flat1();
-	dp[8] = sld_flat2();
-	dp[9] = sld_flat3();
-	dp[10] = sld_flat4();
-	dp[11] = sld_flat5();
-	dp[12] = sld_flat6();
-	dp[13] = sld_flat7();
-	dp[14] = sld_flat8();
-	dp[15] = sld_flat9();
-	dp[16] = sld_flat10();
-
-	dp[17] = thick_inter1();
-	dp[18] = thick_inter2();
-	dp[19] = thick_inter3();
-	dp[20] = thick_inter4();
-	dp[21] = thick_inter5();
-	dp[22] = thick_inter6();
-	dp[23] = thick_inter7();
-	dp[24] = thick_inter8();
-	dp[25] = thick_inter9();
-	dp[26] = thick_inter10();
-
-	dp[27] = thick_flat1();
-	dp[28] = thick_flat2();
-	dp[29] = thick_flat3();
-	dp[30] = thick_flat4();
-	dp[31] = thick_flat5();
-	dp[32] = thick_flat6();
-	dp[33] = thick_flat7();
-	dp[34] = thick_flat8();
-	dp[35] = thick_flat9();
-	dp[36] = thick_flat10();
-
-	dp[37] = func_inter1();
-	dp[38] = func_inter2();
-	dp[39] = func_inter3();
-	dp[40] = func_inter4();
-	dp[41] = func_inter5();
-	dp[42] = func_inter6();
-	dp[43] = func_inter7();
-	dp[44] = func_inter8();
-	dp[45] = func_inter9();
-	dp[46] = func_inter10();
-
-	dp[47] = nu_inter1();
-	dp[48] = nu_inter2();
-	dp[49] = nu_inter3();
-	dp[50] = nu_inter4();
-	dp[51] = nu_inter5();
-	dp[52] = nu_inter6();
-	dp[53] = nu_inter7();
-	dp[54] = nu_inter8();
-	dp[55] = nu_inter9();
-	dp[56] = nu_inter10();
-
-
-	dp[57] = npts_inter();
-	dp[58] = nu_inter0();
-	dp[59] = rad_core0();
-
-	// No polydispersion supported in this model.
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad_core0;
-	rad_core0.get_weights(weights_rad_core0);
-	vector<WeightPoint> weights_thick_inter0;
-	thick_inter0.get_weights(weights_thick_inter0);
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over core weight points
-	for(size_t i=0; i<weights_rad_core0.size(); i++) {
-		dp[59] = weights_rad_core0[i].value;
-		// Loop over thick_inter0 weight points
-		for(size_t j=0; j<weights_thick_inter0.size(); j++) {
-			dp[2] = weights_thick_inter0[j].value;
-
-			//Un-normalize Sphere by volume
-			sum += weights_rad_core0[i].weight * weights_thick_inter0[j].weight
-				* sphere_sld_kernel(dp,q) * pow((weights_rad_core0[i].value +
-						weights_thick_inter0[j].value),3.0);
-			//Find average volume
-			vol += weights_rad_core0[i].weight * weights_thick_inter0[j].weight
-				* pow((weights_rad_core0[i].value+weights_thick_inter0[j].value),3.0);
-
-			norm += weights_rad_core0[i].weight * weights_thick_inter0[j].weight;
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * 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 SphereSLDModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate SphereSLD function
- * @param pars: parameters of the SphereSLD
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SphereSLDModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate TOTAL radius
- * ToDo: Find What is the effective radius for this model.
- * @return: effective radius value
- */
-// No polydispersion supported in this model.
-// Calculate max radius assumming max_radius = effective radius
-// Note that this max radius is not affected by sld of layer, sld of interface, or
-// sld of solvent.
-double SphereSLDModel :: calculate_ER() {
-	SphereSLDParameters dp;
-
-	dp.n_shells = n_shells();
-
-	dp.rad_core0 = rad_core0();
-	dp.thick_flat1 = thick_flat1();
-	dp.thick_flat2 = thick_flat2();
-	dp.thick_flat3 = thick_flat3();
-	dp.thick_flat4 = thick_flat4();
-	dp.thick_flat5 = thick_flat5();
-	dp.thick_flat6 = thick_flat6();
-	dp.thick_flat7 = thick_flat7();
-	dp.thick_flat8 = thick_flat8();
-	dp.thick_flat9 = thick_flat9();
-	dp.thick_flat10 = thick_flat10();
-
-	dp.thick_inter0 = thick_inter0();
-	dp.thick_inter1 = thick_inter1();
-	dp.thick_inter2 = thick_inter2();
-	dp.thick_inter3 = thick_inter3();
-	dp.thick_inter4 = thick_inter4();
-	dp.thick_inter5 = thick_inter5();
-	dp.thick_inter6 = thick_inter6();
-	dp.thick_inter7 = thick_inter7();
-	dp.thick_inter8 = thick_inter8();
-	dp.thick_inter9 = thick_inter9();
-	dp.thick_inter10 = thick_inter10();
-
-	double rad_out = 0.0;
-	double out = 0.0;
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad_core0;
-	rad_core0.get_weights(weights_rad_core0);
-
-	// Get the dispersion points for the thick 1
-	vector<WeightPoint> weights_thick_inter0;
-	thick_inter0.get_weights(weights_thick_inter0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_core0.size(); i++) {
-		dp.rad_core0 = weights_rad_core0[i].value;
-		// Loop over radius weight points
-		for(size_t j=0; j<weights_thick_inter0.size(); j++) {
-			dp.thick_inter0 = weights_thick_inter0[j].value;
-			rad_out = dp.rad_core0 + dp.thick_inter0;
-			if (dp.n_shells > 0)
-				rad_out += dp.thick_flat1 + dp.thick_inter1;
-			if (dp.n_shells > 1)
-				rad_out += dp.thick_flat2 + dp.thick_inter2;
-			if (dp.n_shells > 2)
-				rad_out += dp.thick_flat3 + dp.thick_inter3;
-			if (dp.n_shells > 3)
-				rad_out += dp.thick_flat4 + dp.thick_inter4;
-			if (dp.n_shells > 4)
-				rad_out += dp.thick_flat5 + dp.thick_inter5;
-			if (dp.n_shells > 5)
-				rad_out += dp.thick_flat6 + dp.thick_inter6;
-			if (dp.n_shells > 6)
-				rad_out += dp.thick_flat7 + dp.thick_inter7;
-			if (dp.n_shells > 7)
-				rad_out += dp.thick_flat8 + dp.thick_inter8;
-			if (dp.n_shells > 8)
-				rad_out += dp.thick_flat9 + dp.thick_inter9;
-			if (dp.n_shells > 9)
-				rad_out += dp.thick_flat10 + dp.thick_inter10;
-			sum += weights_rad_core0[i].weight*weights_thick_inter0[j].weight
-				* (rad_out);
-			norm += weights_rad_core0[i].weight*weights_thick_inter0[j].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		out =  sum/norm;}
-	else{
-		//return normal value
-		out = dp.rad_core0 + dp.thick_inter0;
-		if (dp.n_shells > 0)
-			out += dp.thick_flat1 + dp.thick_inter1;
-		if (dp.n_shells > 1)
-			out += dp.thick_flat2 + dp.thick_inter2;
-		if (dp.n_shells > 2)
-			out += dp.thick_flat3 + dp.thick_inter3;
-		if (dp.n_shells > 3)
-			out += dp.thick_flat4 + dp.thick_inter4;
-		if (dp.n_shells > 4)
-			out += dp.thick_flat5 + dp.thick_inter5;
-		if (dp.n_shells > 5)
-			out += dp.thick_flat6 + dp.thick_inter6;
-		if (dp.n_shells > 6)
-			out += dp.thick_flat7 + dp.thick_inter7;
-		if (dp.n_shells > 7)
-			out += dp.thick_flat8 + dp.thick_inter8;
-		if (dp.n_shells > 8)
-			out += dp.thick_flat9 + dp.thick_inter9;
-		if (dp.n_shells > 9)
-			out += dp.thick_flat10 + dp.thick_inter10;
-		}
-
-	return out;
-
-}
Index: sansmodels/src/sans/models/c_models/spheroid.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/spheroid.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,319 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "spheroid.h"
-}
-
-CoreShellEllipsoidModel :: CoreShellEllipsoidModel() {
-	scale      = Parameter(1.0);
-	equat_core     = Parameter(200.0, true);
-	equat_core.set_min(0.0);
-	polar_core     = Parameter(20.0, true);
-	polar_core.set_min(0.0);
-	equat_shell   = Parameter(250.0, true);
-	equat_shell.set_min(0.0);
-	polar_shell    = Parameter(30.0, true);
-	polar_shell.set_min(0.0);
-	sld_core   = Parameter(2e-6);
-	sld_shell  = Parameter(1e-6);
-	sld_solvent = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	axis_theta  = Parameter(0.0, true);
-	axis_phi    = Parameter(0.0, true);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellEllipsoidModel :: operator()(double q) {
-	double dp[9];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = equat_core();
-	dp[2] = polar_core();
-	dp[3] = equat_shell();
-	dp[4] = polar_shell();
-	dp[5] = sld_core();
-	dp[6] = sld_shell();
-	dp[7] = sld_solvent();
-	dp[8] = 0.0;
-
-	// Get the dispersion points for the major core
-	vector<WeightPoint> weights_equat_core;
-	equat_core.get_weights(weights_equat_core);
-
-	// Get the dispersion points for the minor core
-	vector<WeightPoint> weights_polar_core;
-	polar_core.get_weights(weights_polar_core);
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_equat_shell;
-	equat_shell.get_weights(weights_equat_shell);
-
-	// Get the dispersion points for the minor_shell
-	vector<WeightPoint> weights_polar_shell;
-	polar_shell.get_weights(weights_polar_shell);
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over major core weight points
-	for(int i=0; i<(int)weights_equat_core.size(); i++) {
-		dp[1] = weights_equat_core[i].value;
-
-		// Loop over minor core weight points
-		for(int j=0; j<(int)weights_polar_core.size(); j++) {
-			dp[2] = weights_polar_core[j].value;
-
-			// Loop over major shell weight points
-			for(int k=0; k<(int)weights_equat_shell.size(); k++) {
-				dp[3] = weights_equat_shell[k].value;
-
-				// Loop over minor shell weight points
-				for(int l=0; l<(int)weights_polar_shell.size(); l++) {
-					dp[4] = weights_polar_shell[l].value;
-					//Un-normalize  by volume
-					sum += weights_equat_core[i].weight* weights_polar_core[j].weight * weights_equat_shell[k].weight
-						* weights_polar_shell[l].weight * OblateForm(dp, q)
-						* pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-					//Find average volume
-					vol += weights_equat_core[i].weight* weights_polar_core[j].weight
-						* weights_equat_shell[k].weight
-						* weights_polar_shell[l].weight
-						* pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-					norm += weights_equat_core[i].weight* weights_polar_core[j].weight * weights_equat_shell[k].weight
-							* weights_polar_shell[l].weight;
-				}
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-/*
-double OblateModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-
-	return (*this).operator()(q);
-}
-*/
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the oblate
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellEllipsoidModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double CoreShellEllipsoidModel :: operator()(double qx, double qy) {
-	SpheroidParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.equat_core = equat_core();
-	dp.polar_core = polar_core();
-	dp.equat_shell = equat_shell();
-	dp.polar_shell = polar_shell();
-	dp.sld_core = sld_core();
-	dp.sld_shell = sld_shell();
-	dp.sld_solvent = sld_solvent();
-	dp.background = 0.0;
-	dp.axis_theta = axis_theta();
-	dp.axis_phi = axis_phi();
-
-	// Get the dispersion points for the major core
-	vector<WeightPoint> weights_equat_core;
-	equat_core.get_weights(weights_equat_core);
-
-	// Get the dispersion points for the minor core
-	vector<WeightPoint> weights_polar_core;
-	polar_core.get_weights(weights_polar_core);
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_equat_shell;
-	equat_shell.get_weights(weights_equat_shell);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_polar_shell;
-	polar_shell.get_weights(weights_polar_shell);
-
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	axis_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	axis_phi.get_weights(weights_phi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over major core weight points
-	for(int i=0; i< (int)weights_equat_core.size(); i++) {
-		dp.equat_core = weights_equat_core[i].value;
-
-		// Loop over minor core weight points
-		for(int j=0; j< (int)weights_polar_core.size(); j++) {
-			dp.polar_core = weights_polar_core[j].value;
-
-			// Loop over major shell weight points
-			for(int k=0; k< (int)weights_equat_shell.size(); k++) {
-				dp.equat_shell = weights_equat_shell[i].value;
-
-				// Loop over minor shell weight points
-				for(int l=0; l< (int)weights_polar_shell.size(); l++) {
-					dp.polar_shell = weights_polar_shell[l].value;
-
-					// Average over theta distribution
-					for(int m=0; m< (int)weights_theta.size(); m++) {
-						dp.axis_theta = weights_theta[m].value;
-
-						// Average over phi distribution
-						for(int n=0; n< (int)weights_phi.size(); n++) {
-							dp.axis_phi = weights_phi[n].value;
-							//Un-normalize by volume
-							double _ptvalue = weights_equat_core[i].weight *weights_polar_core[j].weight
-								* weights_equat_shell[k].weight * weights_polar_shell[l].weight
-								* weights_theta[m].weight
-								* weights_phi[n].weight
-								* spheroid_analytical_2DXY(&dp, qx, qy)
-								* pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-							if (weights_theta.size()>1) {
-								_ptvalue *= fabs(sin(weights_theta[m].value*pi/180.0));
-							}
-							sum += _ptvalue;
-							//Find average volume
-							vol += weights_equat_shell[k].weight
-								* weights_polar_shell[l].weight
-								* pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-							//Find norm for volume
-							norm_vol += weights_equat_shell[k].weight
-								* weights_polar_shell[l].weight;
-
-							norm += weights_equat_core[i].weight *weights_polar_core[j].weight
-								* weights_equat_shell[k].weight * weights_polar_shell[l].weight
-								* weights_theta[m].weight * weights_phi[n].weight;
-						}
-					}
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreShellEllipsoidModel :: calculate_ER() {
-	SpheroidParameters dp;
-
-	dp.equat_shell = equat_shell();
-	dp.polar_shell = polar_shell();
-
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_equat_shell;
-	equat_shell.get_weights(weights_equat_shell);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_polar_shell;
-	polar_shell.get_weights(weights_polar_shell);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_equat_shell.size(); i++) {
-		dp.equat_shell = weights_equat_shell[i].value;
-		for(int k=0; k< (int)weights_polar_shell.size(); k++) {
-			dp.polar_shell = weights_polar_shell[k].value;
-			//Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER.
-			sum +=weights_equat_shell[i].weight
-				* weights_polar_shell[k].weight*DiamEllip(dp.polar_shell,dp.equat_shell)/2.0;
-			norm += weights_equat_shell[i].weight* weights_polar_shell[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER.
-		rad_out = DiamEllip(dp.polar_shell,dp.equat_shell)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/stackeddisks.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/stackeddisks.cpp	(revision 85bb87048005735e428588676cad765827cc1f95)
+++ 	(revision )
@@ -1,299 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- *	TODO: add 2d
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "stacked_disks.h"
-}
-
-StackedDisksModel :: StackedDisksModel() {
-	scale      = Parameter(1.0);
-	radius     = Parameter(3000.0, true);
-	radius.set_min(0.0);
-	core_thick  = Parameter(10.0, true);
-	core_thick.set_min(0.0);
-	layer_thick     = Parameter(15.0);
-	layer_thick.set_min(0.0);
-	core_sld = Parameter(4.0e-6);
-	layer_sld  = Parameter(-4.0e-7);
-	solvent_sld  = Parameter(5.0e-6);
-	n_stacking   = Parameter(1);
-	sigma_d   = Parameter(0);
-	background = Parameter(0.001);
-	axis_theta  = Parameter(0.0, true);
-	axis_phi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double StackedDisksModel :: operator()(double q) {
-	double dp[10];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = core_thick();
-	dp[3] = layer_thick();
-	dp[4] = core_sld();
-	dp[5] = layer_sld();
-	dp[6] = solvent_sld();
-	dp[7] = n_stacking();
-	dp[8] = sigma_d();
-	dp[9] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-
-	// Get the dispersion points for the core_thick
-	vector<WeightPoint> weights_core_thick;
-	core_thick.get_weights(weights_core_thick);
-
-	// Get the dispersion points for the layer_thick
-	vector<WeightPoint> weights_layer_thick;
-	layer_thick.get_weights(weights_layer_thick);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over length weight points
-	for(int i=0; i< (int)weights_radius.size(); i++) {
-		dp[1] = weights_radius[i].value;
-
-		// Loop over radius weight points
-		for(int j=0; j< (int)weights_core_thick.size(); j++) {
-			dp[2] = weights_core_thick[j].value;
-
-			// Loop over thickness weight points
-			for(int k=0; k< (int)weights_layer_thick.size(); k++) {
-				dp[3] = weights_layer_thick[k].value;
-				//Un-normalize by volume
-				sum += weights_radius[i].weight
-					* weights_core_thick[j].weight * weights_layer_thick[k].weight* StackedDiscs(dp, q)
-					*pow(weights_radius[i].value,2)*(weights_core_thick[j].value+2*weights_layer_thick[k].value);
-				//Find average volume
-				vol += weights_radius[i].weight
-					* weights_core_thick[j].weight * weights_layer_thick[k].weight
-					*pow(weights_radius[i].value,2)*(weights_core_thick[j].value+2*weights_layer_thick[k].value);
-				norm += weights_radius[i].weight
-					* weights_core_thick[j].weight* weights_layer_thick[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double StackedDisksModel :: operator()(double qx, double qy) {
-	StackedDisksParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.core_thick    = core_thick();
-	dp.radius	  = radius();
-	dp.layer_thick  = layer_thick();
-	dp.core_sld   = core_sld();
-	dp.layer_sld  = layer_sld();
-	dp.solvent_sld= solvent_sld();
-	dp.n_stacking	  = n_stacking();
-	dp.sigma_d   = sigma_d();
-	dp.background = 0.0;
-	dp.axis_theta = axis_theta();
-	dp.axis_phi   = axis_phi();
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_core_thick;
-	core_thick.get_weights(weights_core_thick);
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_layer_thick;
-	layer_thick.get_weights(weights_layer_thick);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	axis_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	axis_phi.get_weights(weights_phi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-
-	// Loop over length weight points
-	for(int i=0; i< (int)weights_core_thick.size(); i++) {
-		dp.core_thick = weights_core_thick[i].value;
-
-		// Loop over radius weight points
-		for(int j=0; j< (int)weights_radius.size(); j++) {
-			dp.radius = weights_radius[j].value;
-
-				// Loop over thickness weight points
-				for(int k=0; k< (int)weights_layer_thick.size(); k++) {
-				dp.layer_thick = weights_layer_thick[k].value;
-
-					for(int l=0; l< (int)weights_theta.size(); l++) {
-					dp.axis_theta = weights_theta[l].value;
-
-						// Average over phi distribution
-						for(int m=0; m <(int)weights_phi.size(); m++) {
-							dp.axis_phi = weights_phi[m].value;
-
-							//Un-normalize by volume
-							double _ptvalue = weights_core_thick[i].weight
-								* weights_radius[j].weight
-								* weights_layer_thick[k].weight
-								* weights_theta[l].weight
-								* weights_phi[m].weight
-								* stacked_disks_analytical_2DXY(&dp, qx, qy)
-								*pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value);
-							if (weights_theta.size()>1) {
-								_ptvalue *= fabs(sin(weights_theta[l].value));
-							}
-							sum += _ptvalue;
-							//Find average volume
-							vol += weights_radius[j].weight
-								* weights_core_thick[i].weight * weights_layer_thick[k].weight
-								*pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value);
-							//Find norm for volume
-							norm_vol += weights_radius[j].weight
-								* weights_core_thick[i].weight * weights_layer_thick[k].weight;
-
-							norm += weights_core_thick[i].weight
-								* weights_radius[j].weight
-								* weights_layer_thick[k].weight
-								* weights_theta[l].weight
-								* weights_phi[m].weight;
-						}
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double StackedDisksModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double StackedDisksModel :: calculate_ER() {
-	StackedDisksParameters dp;
-
-	dp.core_thick    = core_thick();
-	dp.radius	  = radius();
-	dp.layer_thick  = layer_thick();
-	dp.n_stacking	  = n_stacking();
-
-	double rad_out = 0.0;
-	if (dp.n_stacking <= 0.0){
-		return rad_out;
-	}
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_core_thick;
-	core_thick.get_weights(weights_core_thick);
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_layer_thick;
-	layer_thick.get_weights(weights_layer_thick);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_core_thick.size(); i++) {
-		dp.core_thick = weights_core_thick[i].value;
-		for(int j=0; j< (int)weights_layer_thick.size(); j++) {
-			dp.layer_thick = weights_layer_thick[j].value;
-			for(int k=0; k< (int)weights_radius.size(); k++) {
-				dp.radius = weights_radius[k].value;
-				//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-				sum +=weights_core_thick[i].weight*weights_layer_thick[j].weight
-					* weights_radius[k].weight*DiamCyl(dp.n_stacking*(dp.layer_thick*2.0+dp.core_thick),dp.radius)/2.0;
-				norm += weights_core_thick[i].weight*weights_layer_thick[j].weight* weights_radius[k].weight;
-			}
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.n_stacking*(dp.layer_thick*2.0+dp.core_thick),dp.radius)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/triaxialellipsoid.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/triaxialellipsoid.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ 	(revision )
@@ -1,316 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "triaxial_ellipsoid.h"
-}
-
-TriaxialEllipsoidModel :: TriaxialEllipsoidModel() {
-	scale      = Parameter(1.0);
-	semi_axisA     = Parameter(35.0, true);
-	semi_axisA.set_min(0.0);
-	semi_axisB     = Parameter(100.0, true);
-	semi_axisB.set_min(0.0);
-	semi_axisC  = Parameter(400.0, true);
-	semi_axisC.set_min(0.0);
-	sldEll   = Parameter(1.0e-6);
-	sldSolv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	axis_theta  = Parameter(57.325, true);
-	axis_phi    = Parameter(57.325, true);
-	axis_psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double TriaxialEllipsoidModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = semi_axisA();
-	dp[2] = semi_axisB();
-	dp[3] = semi_axisC();
-	dp[4] = sldEll();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the semi axis A
-	vector<WeightPoint> weights_semi_axisA;
-	semi_axisA.get_weights(weights_semi_axisA);
-
-	// Get the dispersion points for the semi axis B
-	vector<WeightPoint> weights_semi_axisB;
-	semi_axisB.get_weights(weights_semi_axisB);
-
-	// Get the dispersion points for the semi axis C
-	vector<WeightPoint> weights_semi_axisC;
-	semi_axisC.get_weights(weights_semi_axisC);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over semi axis A weight points
-	for(int i=0; i< (int)weights_semi_axisA.size(); i++) {
-		dp[1] = weights_semi_axisA[i].value;
-
-		// Loop over semi axis B weight points
-		for(int j=0; j< (int)weights_semi_axisB.size(); j++) {
-			dp[2] = weights_semi_axisB[j].value;
-
-			// Loop over semi axis C weight points
-			for(int k=0; k< (int)weights_semi_axisC.size(); k++) {
-				dp[3] = weights_semi_axisC[k].value;
-				//Un-normalize  by volume
-				sum += weights_semi_axisA[i].weight
-					* weights_semi_axisB[j].weight * weights_semi_axisC[k].weight* TriaxialEllipsoid(dp, q)
-					* weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value;
-				//Find average volume
-				vol += weights_semi_axisA[i].weight
-					* weights_semi_axisB[j].weight * weights_semi_axisC[k].weight
-					* weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value;
-
-				norm += weights_semi_axisA[i].weight
-					* weights_semi_axisB[j].weight * weights_semi_axisC[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double TriaxialEllipsoidModel :: operator()(double qx, double qy) {
-	TriaxialEllipsoidParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.semi_axisA   = semi_axisA();
-	dp.semi_axisB     = semi_axisB();
-	dp.semi_axisC     = semi_axisC();
-	dp.sldEll   = sldEll();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.axis_theta  = axis_theta();
-	dp.axis_phi    = axis_phi();
-	dp.axis_psi    = axis_psi();
-
-	// Get the dispersion points for the semi_axis A
-	vector<WeightPoint> weights_semi_axisA;
-	semi_axisA.get_weights(weights_semi_axisA);
-
-	// Get the dispersion points for the semi_axis B
-	vector<WeightPoint> weights_semi_axisB;
-	semi_axisB.get_weights(weights_semi_axisB);
-
-	// Get the dispersion points for the semi_axis C
-	vector<WeightPoint> weights_semi_axisC;
-	semi_axisC.get_weights(weights_semi_axisC);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	axis_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	axis_phi.get_weights(weights_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_psi;
-	axis_psi.get_weights(weights_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over semi axis A weight points
-	for(int i=0; i< (int)weights_semi_axisA.size(); i++) {
-		dp.semi_axisA = weights_semi_axisA[i].value;
-
-		// Loop over semi axis B weight points
-		for(int j=0; j< (int)weights_semi_axisB.size(); j++) {
-			dp.semi_axisB = weights_semi_axisB[j].value;
-
-			// Loop over semi axis C weight points
-			for(int k=0; k < (int)weights_semi_axisC.size(); k++) {
-			dp.semi_axisC = weights_semi_axisC[k].value;
-
-				// Average over theta distribution
-				for(int l=0; l< (int)weights_theta.size(); l++) {
-					dp.axis_theta = weights_theta[l].value;
-
-					// Average over phi distribution
-					for(int m=0; m <(int)weights_phi.size(); m++) {
-						dp.axis_phi = weights_phi[m].value;
-						// Average over psi distribution
-						for(int n=0; n <(int)weights_psi.size(); n++) {
-							dp.axis_psi = weights_psi[n].value;
-							//Un-normalize  by volume
-							double _ptvalue = weights_semi_axisA[i].weight
-								* weights_semi_axisB[j].weight
-								* weights_semi_axisC[k].weight
-								* weights_theta[l].weight
-								* weights_phi[m].weight
-								* weights_psi[n].weight
-								* triaxial_ellipsoid_analytical_2DXY(&dp, qx, qy)
-								* weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value;
-							if (weights_theta.size()>1) {
-								_ptvalue *= fabs(sin(weights_theta[k].value*pi/180.0));
-							}
-							sum += _ptvalue;
-							//Find average volume
-							vol += weights_semi_axisA[i].weight
-								* weights_semi_axisB[j].weight
-								* weights_semi_axisC[k].weight
-								* weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value;
-							//Find norm for volume
-							norm_vol += weights_semi_axisA[i].weight
-								* weights_semi_axisB[j].weight
-								* weights_semi_axisC[k].weight;
-
-							norm += weights_semi_axisA[i].weight
-								* weights_semi_axisB[j].weight
-								* weights_semi_axisC[k].weight
-								* weights_theta[l].weight
-								* weights_phi[m].weight
-								* weights_psi[n].weight;
-						}
-					}
-
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double TriaxialEllipsoidModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double TriaxialEllipsoidModel :: calculate_ER() {
-	TriaxialEllipsoidParameters dp;
-
-	dp.semi_axisA   = semi_axisA();
-	dp.semi_axisB     = semi_axisB();
-	//polar axis C
-	dp.semi_axisC     = semi_axisC();
-
-	double rad_out = 0.0;
-	//Surface average radius at the equat. cross section.
-	double suf_rad = sqrt(dp.semi_axisA * dp.semi_axisB);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the semi_axis A
-	vector<WeightPoint> weights_semi_axisA;
-	semi_axisA.get_weights(weights_semi_axisA);
-
-	// Get the dispersion points for the semi_axis B
-	vector<WeightPoint> weights_semi_axisB;
-	semi_axisB.get_weights(weights_semi_axisB);
-
-	// Get the dispersion points for the semi_axis C
-	vector<WeightPoint> weights_semi_axisC;
-	semi_axisC.get_weights(weights_semi_axisC);
-
-	// Loop over semi axis A weight points
-	for(int i=0; i< (int)weights_semi_axisA.size(); i++) {
-		dp.semi_axisA = weights_semi_axisA[i].value;
-
-		// Loop over semi axis B weight points
-		for(int j=0; j< (int)weights_semi_axisB.size(); j++) {
-			dp.semi_axisB = weights_semi_axisB[j].value;
-
-			// Loop over semi axis C weight points
-			for(int k=0; k < (int)weights_semi_axisC.size(); k++) {
-				dp.semi_axisC = weights_semi_axisC[k].value;
-
-				//Calculate surface averaged radius
-				suf_rad = sqrt(dp.semi_axisA * dp.semi_axisB);
-
-				//Sum
-				sum += weights_semi_axisA[i].weight
-					* weights_semi_axisB[j].weight
-					* weights_semi_axisC[k].weight * DiamEllip(dp.semi_axisC, suf_rad)/2.0;
-				//Norm
-				norm += weights_semi_axisA[i].weight* weights_semi_axisB[j].weight
-					* weights_semi_axisC[k].weight;
-			}
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = DiamEllip(dp.semi_axisC, suf_rad)/2.0;}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/vesicle.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/vesicle.cpp	(revision c451be953dd7ec3d17683e043145313f5c761ac0)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "models.hh"
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-	#include "vesicle.h"
-}
-
-VesicleModel :: VesicleModel() {
-	scale      = Parameter(1.0);
-	radius     = Parameter(100.0, true);
-	radius.set_min(0.0);
-	thickness  = Parameter(30.0, true);
-	thickness.set_min(0.0);
-	core_sld   = Parameter(6.36e-6);
-	shell_sld   = Parameter(5.0e-7);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double VesicleModel :: operator()(double q) {
-	double dp[6];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = thickness();
-	dp[3] = core_sld();
-	dp[4] = shell_sld();
-	dp[5] = 0.0;
-
-
-	// Get the dispersion points for the core radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_thickness;
-	thickness.get_weights(weights_thickness);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(int i=0; i< (int)weights_radius.size(); i++) {
-		dp[1] = weights_radius[i].value;
-		for(int j=0; j< (int)weights_thickness.size(); j++) {
-			dp[2] = weights_thickness[j].value;
-			sum += weights_radius[i].weight
-				* weights_thickness[j].weight * VesicleForm(dp, q)
-				*(pow(weights_radius[i].value+weights_thickness[j].value,3)-pow(weights_radius[i].value,3));
-			//Find average volume
-			vol += weights_radius[i].weight * weights_thickness[j].weight
-				*(pow(weights_radius[i].value+weights_thickness[j].value,3)-pow(weights_radius[i].value,3));
-			norm += weights_radius[i].weight * weights_thickness[j].weight;
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double VesicleModel :: operator()(double qx, double qy) {
-	double q = sqrt(qx*qx + qy*qy);
-	return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the vesicle
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double VesicleModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double VesicleModel :: calculate_ER() {
-	VesicleParameters dp;
-
-	dp.radius     = radius();
-	dp.thickness  = thickness();
-
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_thickness;
-	thickness.get_weights(weights_thickness);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int j=0; j< (int)weights_thickness.size(); j++) {
-		dp.thickness = weights_thickness[j].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			sum += weights_thickness[j].weight
-				* weights_radius[k].weight*(dp.radius+dp.thickness);
-			norm += weights_thickness[j].weight* weights_radius[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = (dp.radius+dp.thickness);}
-
-	return rad_out;
-}
Index: sansmodels/src/sans/models/c_models/wrapping.py
===================================================================
--- sansmodels/src/sans/models/c_models/wrapping.py	(revision 9ce41c6f9cb652f9c0a81a779f2dd143382ac661)
+++ 	(revision )
@@ -1,23 +1,0 @@
-import sys
-import os
-import os.path
-from WrapperGenerator import WrapperGenerator
-
-
-root= os.path.dirname(os.getcwd())
-
-dir = os.path.join(root, "c_extensions")
-#print "dir", dir
-list= os.listdir(dir)
-nModels=0
-for item in list:
-    toks = os.path.splitext(os.path.basename(item))
-    if toks[1]=='.h':
-        nModels += 1
-        name = toks[0]
-        app = WrapperGenerator(os.path.join('..','c_extensions',name+".h"))
-        app.read()
-        app.write_c_wrapper()
-        app.write_python_wrapper()
-        print app
-print "Number total of models is %s"%nModels
Index: sansmodels/src/sans/models/c_smearer/smearer.cpp
===================================================================
--- sansmodels/src/sans/models/c_smearer/smearer.cpp	(revision ef7606be64eda1789836259dee1665b978c84f75)
+++ 	(revision )
@@ -1,373 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2009, University of Tennessee
- */
-#include "smearer.hh"
-#include <stdio.h>
-#include <math.h>
-using namespace std;
-
-#if defined(_MSC_VER)
-extern "C" {
-#include "winFuncs.h"
-}
-#endif
-/**
- * Constructor for BaseSmearer
- *
- * @param qmin: minimum Q value
- * @param qmax: maximum Q value
- * @param nbins: number of Q bins
- */
-BaseSmearer :: BaseSmearer(double qmin, double qmax, int nbins) {
-	// Number of bins
-	this->nbins = nbins;
-	this->qmin = qmin;
-	this->qmax = qmax;
-	// Flag to keep track of whether we have a smearing matrix or
-	// whether we need to compute one
-	has_matrix = false;
-	even_binning = true;
-};
-
-/**
- * Constructor for BaseSmearer
- *
- * Used for uneven binning
- * @param q: array of Q values
- * @param nbins: number of Q bins
- */
-BaseSmearer :: BaseSmearer(double* q, int nbins) {
-	// Number of bins
-	this->nbins = nbins;
-	this->q_values = q;
-	// Flag to keep track of whether we have a smearing matrix or
-	// whether we need to compute one
-	has_matrix = false;
-	even_binning = false;
-};
-
-/**
- * Constructor for SlitSmearer
- *
- * @param width: slit width in Q units
- * @param height: slit height in Q units
- * @param qmin: minimum Q value
- * @param qmax: maximum Q value
- * @param nbins: number of Q bins
- */
-SlitSmearer :: SlitSmearer(double width, double height, double qmin, double qmax, int nbins) :
-	BaseSmearer(qmin, qmax, nbins){
-	this->height = height;
-	this->width = width;
-};
-
-/**
- * Constructor for SlitSmearer
- *
- * @param width: slit width in Q units
- * @param height: slit height in Q units
- * @param q: array of Q values
- * @param nbins: number of Q bins
- */
-SlitSmearer :: SlitSmearer(double width, double height, double* q, int nbins) :
-	BaseSmearer(q, nbins){
-	this->height = height;
-	this->width = width;
-};
-
-/**
- * Constructor for QSmearer
- *
- * @param width: array slit widths for each Q point, in Q units
- * @param qmin: minimum Q value
- * @param qmax: maximum Q value
- * @param nbins: number of Q bins
- */
-QSmearer :: QSmearer(double* width, double qmin, double qmax, int nbins) :
-	BaseSmearer(qmin, qmax, nbins){
-	this->width = width;
-};
-
-/**
- * Constructor for QSmearer
- *
- * @param width: array slit widths for each Q point, in Q units
- * @param q: array of Q values
- * @param nbins: number of Q bins
- */
-QSmearer :: QSmearer(double* width, double* q, int nbins) :
-	BaseSmearer(q, nbins){
-	this->width = width;
-};
-
-/**
- * Compute the slit smearing matrix
- *
- * For even binning (q_min to q_max with nbins):
- *
- *   step = (q_max-q_min)/(nbins-1)
- *   first bin goes from q_min to q_min+step
- *   last bin goes from q_max to q_max+step
- *
- * For binning according to q array:
- *
- * Each q point represents a bin going from half the distance between it
- * and the previous point to half the distance between it and the next point.
- *
- *    Example: bin i goes from (q_values[i-1]+q_values[i])/2 to (q_values[i]+q_values[i+1])/2
- *
- * The exceptions are the first and last bins, which are centered at the first and
- * last q-values, respectively. The width of the first and last bins is the distance between
- * their respective neighboring q-value.
- */
-void SlitSmearer :: compute_matrix(){
-
-	weights = new vector<double>(nbins*nbins,0);
-
-	// Check the length of the data
-	if (nbins<2) return;
-	int npts_h = height>0.0 ? npts : 1;
-	int npts_w = width>0.0 ? npts : 1;
-
-	// If both height and width are great than zero,
-	// modify the number of points in each direction so
-	// that the total number of points is still what
-	// the user would expect (downgrade resolution)
-	//if(npts_h>1 && npts_w>1){
-	//	npts_h = (int)ceil(sqrt((double)npts));
-	//	npts_w = npts_h;
-	//}
-	double shift_h, shift_w, hbin_size, wbin_size;
-	// Make sure height and width are all positive (FWMH/2)
-	// Assumption; height and width are all same for all q points
-	if(npts_h == 1){
-		shift_h = 0.0;
-	} else {
-		shift_h = fabs(height);
-	}
-	if(npts_w == 1){
-		shift_w = 0.0;
-	} else {
-		shift_w = fabs(width);
-	}
-	// size of the h bin and w bin
-	hbin_size = shift_h / nbins;
-	wbin_size = shift_w / nbins;
-
-	// Loop over all q-values
-	double q, q_min, q_max, q_0=0.0;
-	for(int i=0; i<nbins; i++) {
-		// Find Weights
-		// Find q where the resolution smearing calculation of I(q) occurs
-		get_bin_range(i, &q, &q_min, &q_max);
-		// Block q becomes <=0
-		if (q <= 0){
-			continue;
-		}
-		// Find q[0] value to normalize the weight later,
-		//  otherwise, we will have a precision problem.
-		if (i == 0){
-			q_0 = q;
-		}
-		// Loop over all qj-values
-		for(int j=0; j<nbins; j++) {
-			double q_j, q_high, q_low;
-			// Calculate bin size of q_j
-			get_bin_range(j, &q_j, &q_low, &q_high);
-			// Block q_j becomes <=0
-			if (q_j <= 0){
-				continue;
-			}
-			// Check q_low that can not be negative.
-			if (q_low < 0.0){
-				q_low = 0.0;
-			}
-			// default parameter values
-			(*weights)[i*nbins+j] = 0.0;
-			// protect for negative q
-			if (q <= 0.0 || q_j <= 0.0){
-					continue;
-			}
-			double shift_w = 0.0;
-			// Condition: zero slit smear.
-			if (npts_w == 1 && npts_h == 1){
-				if(q_j == q) {
-					(*weights)[i*nbins+j] = 1.0;
-				}
-			}
-			//Condition:Smear weight integration for width >0 when the height (=0) does not present.
-			//Or height << width.
-			else if((npts_w!=1 && npts_h == 1)|| (npts_w!=1 && npts_h != 1 && width/height > 100.0)){
-				shift_w = width;
-				//del_w = width/((double)npts_w-1.0);
-				double q_shifted_low = q - shift_w;
-				// High limit of the resolution range
-				double q_shifted_high = q + shift_w;
-				// Go through all the q_js for weighting those points
-				if(q_j >= q_shifted_low && q_j <= q_shifted_high) {
-					// The weighting factor comes,
-					// Give some weight (delq_bin) for the q_j within the resolution range
-					// Weight should be same for all qs except
-					// for the q bin size at j.
-					// Note that the division by q_0 is only due to the precision problem
-					// where q_high - q_low gets to very small.
-					// Later, it will be normalized again.
-					(*weights)[i*nbins+j] += (q_high - q_low)/q_0 ;
-				}
-			}
-			else{
-				// Loop for width (;Height is analytical.)
-				// Condition: height >>> width, otherwise, below is not accurate enough.
-				// Smear weight numerical iteration for width >0 when the height (>0) presents.
-				// When width = 0, the numerical iteration will be skipped.
-				// The resolution calculation for the height is done by direct integration,
-				// assuming the I(q'=sqrt(q_j^2-(q+shift_w)^2)) is constant within a q' bin, [q_high, q_low].
-				// In general, this weight numerical iteration for width >0 might be a rough approximation,
-				// but it must be good enough when height >>> width.
-				for(int k=(-npts_w + 1); k<npts_w; k++){
-					if(npts_w!=1){
-						shift_w = width/((double)npts_w-1.0)*(double)k;
-					}
-					// For each q-value, compute the weight of each other q-bin
-					// in the I(q) array
-					// Low limit of the resolution range
-					double q_shift = q + shift_w;
-					if (q_shift < 0.0){
-						q_shift = 0.0;
-					}
-					double q_shifted_low = q_shift;
-					// High limit of the resolution range
-					double q_shifted_high = sqrt(q_shift * q_shift + shift_h * shift_h);
-
-
-					// Go through all the q_js for weighting those points
-					if(q_j >= q_shifted_low && q_j <= q_shifted_high) {
-						// The weighting factor comes,
-						// Give some weight (delq_bin) for the q_j within the resolution range
-						// Weight should be same for all qs except
-						// for the q bin size at j.
-						// Note that the division by q_0 is only due to the precision problem
-						// where q_high - q_low gets to very small.
-						// Later, it will be normalized again.
-
-						// The fabs below are not necessary but in case: the weight should never be imaginary.
-						// At the edge of each sub_width. weight += u(at q_high bin) - u(0), where u(0) = 0,
-						// and weighted by (2.0* npts_w -1.0)once for each q.
-						//if (q == q_j) {
-						if (q_low <= q_shift && q_high > q_shift) {
-							//if (k==0)
-								(*weights)[i*nbins+j] += (sqrt(fabs((q_high)*(q_high)-q_shift * q_shift)))/q_0;// * (2.0*double(npts_w)-1.0);
-						}
-						// For the rest of sub_width. weight += u(at q_high bin) - u(at q_low bin)
-						else{// if (u > 0.0){
-							(*weights)[i*nbins+j] += (sqrt(fabs((q_high)*(q_high)- q_shift * q_shift))-sqrt(fabs((q_low)*(q_low)- q_shift * q_shift)))/q_0 ;
-						}
-					}
-				}
-			}
-		}
-	}
-};
-
-/**
- * Compute the point smearing matrix
- */
-void QSmearer :: compute_matrix(){
-	weights = new vector<double>(nbins*nbins,0);
-
-	// Loop over all q-values
-	double q, q_min, q_max;
-	double q_j, q_jmax, q_jmin;
-	for(int i=0; i<nbins; i++) {
-		get_bin_range(i, &q, &q_min, &q_max);
-
-		for(int j=0; j<nbins; j++) {
-			get_bin_range(j, &q_j, &q_jmin, &q_jmax);
-
-			// Compute the fraction of the Gaussian contributing
-			// to the q_j bin between q_jmin and q_jmax
-			long double value =  erf( (q_jmax-q)/(sqrt(2.0)*width[i]) );
-        	value -= erf( (q_jmin-q)/(sqrt(2.0)*width[i]) );
-        	(*weights)[i*nbins+j] += value;
-		}
-	}
-}
-
-/**
- * Computes the Q range of a given bin of the Q distribution.
- * The range is computed according the the data distribution that
- * was given to the object at initialization.
- *
- * @param i: number of the bin in the distribution
- * @param q: q-value of bin i
- * @param q_min: lower bound of the bin
- * @param q_max: higher bound of the bin
- *
- */
-int BaseSmearer :: get_bin_range(int i, double* q, double* q_min, double* q_max) {
-	if (even_binning) {
-		double step = (qmax-qmin)/((double)nbins-1.0);
-		*q = qmin + (double)i*step;
-		*q_min = *q - 0.5*step;
-		*q_max = *q + 0.5*step;
-		return 1;
-	} else if (i>=0 && i<nbins) {
-		*q = q_values[i];
-		if (i==0) {
-			double step = (q_values[1]-q_values[0])/2.0;
-			*q_min = *q - step;
-			*q_max = *q + step;
-		} else if (i==nbins-1) {
-			double step = (q_values[i]-q_values[i-1])/2.0;
-			*q_min = *q - step;
-			*q_max = *q + step;
-		} else {
-			*q_min = *q - (q_values[i]-q_values[i-1])/2.0;
-			*q_max = *q + (q_values[i+1]-q_values[i])/2.0;
-		}
-		return 1;
-	}
-	return -1;
-}
-
-/**
- * Perform smearing by applying the smearing matrix to the input Q array
- */
-void BaseSmearer :: smear(double *iq_in, double *iq_out, int first_bin, int last_bin){
-
-	// If we haven't computed the smearing matrix, do it now
-	if(!has_matrix) {
-		compute_matrix();
-		has_matrix = true;
-	}
-
-	// Loop over q-values and multiply apply matrix
-	for(int q_i=first_bin; q_i<=last_bin; q_i++){
-		double sum = 0.0;
-		double counts = 0.0;
-
-		for(int i=first_bin; i<=last_bin; i++){
-			// Skip if weight is less than 1e-03(this value is much smaller than
-			// the weight at the 3*sigma distance
-			// Will speed up a little bit...
-			if ((*weights)[q_i*nbins+i] < 1.0e-003){
-				continue;
-			}
-			sum += iq_in[i] * (*weights)[q_i*nbins+i];
-			counts += (*weights)[q_i*nbins+i];
-		}
-
-		// Normalize counts
-		iq_out[q_i] = (counts>0.0) ? sum/counts : 0.0;
-	}
-}
Index: sansmodels/src/sans/models/c_smearer/smearer.hh
===================================================================
--- sansmodels/src/sans/models/c_smearer/smearer.hh	(revision 642b259b9abb82689ce5f576e23b9b02fdb74600)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2009, University of Tennessee
- */
-#ifndef SMEARER_CLASS_H
-#define SMEARER_CLASS_H
-
-#include <vector>
-
-using namespace std;
-
-/**
- * Base smearer class, implementing the matrix multiplication only
- */
-class BaseSmearer {
-protected:
-	// Internal flag: true when the weights vector is filled
-	bool has_matrix;
-	// True when only qmin, qmax and nbins are given. Bins are equidistant
-	bool even_binning;
-	// Smearing matrix
-	vector<double>* weights;
-	// Q vector
-	double* q_values;
-    // Q_min (Min Q-value for I(q))
-    double qmin;
-    // Q_max (Max Q_value for I(q))
-    double qmax;
-    // Number of Q bins
-    int nbins;
-
-public:
-    // Constructor
-    BaseSmearer(double qmin, double qmax, int nbins);
-    BaseSmearer(double* q, int nbins);
-	// Smear function
-	virtual void smear(double *, double *, int, int);
-	// Compute the smearing matrix
-	virtual void compute_matrix(){};
-	// Utility function to check the number of bins
-	int get_nbins() { return nbins; }
-	// Get the q range of a particular bin
-	virtual int get_bin_range(int, double*, double*, double*);
-};
-
-
-/**
- * Slit smearer class
- */
-class SlitSmearer : public BaseSmearer {
-
-protected:
-    // Number of points used in the smearing computation
-    static const int npts   = 500;
-
-public:
-    // Slit width in Q units
-    double width;
-    // Slit height in Q units
-    double height;
-
-    // Constructor
-	SlitSmearer(double width, double height, double qmin, double qmax, int nbins);
-	SlitSmearer(double width, double height, double* q, int nbins);
-	// Compute the smearing matrix
-	virtual void compute_matrix();
-};
-
-
-/**
- * Point smearer class
- */
-class QSmearer : public BaseSmearer {
-
-protected:
-    // Standard deviation in Q [A-1]
-    double* width;
-
-public:
-
-    // Constructor
-    QSmearer(double* width, double qmin, double qmax, int nbins);
-    QSmearer(double* width, double* q, int nbins);
-	// Compute the smearing matrix
-	virtual void compute_matrix();
-};
-
-#endif
Index: sansmodels/src/sans/models/c_smearer/smearer2d_helper.cpp
===================================================================
--- sansmodels/src/sans/models/c_smearer/smearer2d_helper.cpp	(revision 74c9a3063aab59b8fd6dfdc3e053aa3db931b19c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2009, University of Tennessee
- */
-#include "smearer2d_helper.hh"
-#include <stdio.h>
-#include <math.h>
-using namespace std;
-
-/**
- * Constructor for BaseSmearer
- *
- * binning
- * @param qx: array of Qx values
- * @param qy: array of Qy values
- * @param nrbins: number of r bins
- * @param nphibins: number of phi bins
- */
-Smearer_helper :: Smearer_helper(int npoints, double* qx, double* qy,
-		double* dqx, double* dqy, double rlimit, int nrbins, int nphibins) {
-	// Number of bins
-	this->npoints = npoints;
-	this->rlimit = rlimit;
-	this->nrbins = nrbins;
-	this->nphibins = nphibins;
-	this->qx_values = qx;
-	this->qy_values = qy;
-	this->dqx_values = dqx;
-	this->dqy_values = dqy;
-};
-
-/**
- * Compute the point smearing matrix
- */
-void Smearer_helper :: smear2d(double *weights, double *qx_out, double *qy_out){
-
-	double rbin_size = rlimit / double(nrbins);
-	double phibin_size = 0.0;
-	double rbin = 0.0;
-	double phibin = 0.0;
-	double qr = 0.0;
-	double qphi = 0.0;
-	double Pi = 4.0*atan(1.0);
-	// Loop over q-values and multiply apply matrix
-
-	for(int i=0; i<nrbins; i++){
-		rbin = rbin_size * (double(i) + 0.5);
-		for(int j=0; j<nphibins; j++){
-			phibin_size =  2.0 * Pi / double(nphibins);
-			phibin = phibin_size * (double(j));
-			for(int q_i=0; q_i<npoints; q_i++){
-				qr = sqrt(qx_values[q_i]*qx_values[q_i] + qy_values[q_i]*qy_values[q_i]);
-				qphi = atan(qy_values[q_i]/qx_values[q_i]);
-				qx_out[q_i + npoints*(nrbins * j + i)] = (rbin*dqx_values[q_i]*cos(phibin) + qr)*cos(qphi)-
-										rbin*dqy_values[q_i]*sin(phibin)*sin(qphi);
-				qy_out[q_i + npoints*(nrbins * j + i)] = (rbin*dqx_values[q_i]*cos(phibin) + qr)*sin(qphi)+
-										rbin*dqy_values[q_i]*sin(phibin)*cos(qphi);
-				if (q_i==0){
-					weights[nrbins * j + i] = exp(-0.5 * ((rbin - rbin_size / 2.0) *
-							(rbin - rbin_size / 2.0)))- exp(-0.5 * ((rbin + rbin_size / 2.0 ) *
-									(rbin + rbin_size / 2.0)));
-			}
-		}
-	}
-	}
-}
-
Index: sansmodels/src/sans/models/c_smearer/smearer2d_helper.hh
===================================================================
--- sansmodels/src/sans/models/c_smearer/smearer2d_helper.hh	(revision 87615a4840b7cfe8cb701bebbed7fd96effdc759)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/**
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	If you use DANSE applications to do scientific research that leads to
-	publication, we ask that you acknowledge the use of the software with the
-	following sentence:
-
-	"This work benefited from DANSE software developed under NSF award DMR-0520547."
-
-	copyright 2009, University of Tennessee
- */
-#ifndef SMEARER2D_HELPER_CLASS_H
-#define SMEARER2D_HELPER_CLASS_H
-
-#include <vector>
-
-using namespace std;
-
-/**
- * Base smearer class, implementing the matrix multiplication only
- */
-class Smearer_helper {
-protected:
-	// Smearing matrix
-	vector<double>* weights;
-	vector<double>* qx_out;
-	vector<double>* qy_out;
-	// Q vector
-	double* qx_values;
-	double* qy_values;
-	double* dqx_values;
-	double* dqy_values;
-    // r limit
-    double rlimit;
-    // Numbers
-    int npoints;
-    int nrbins;
-    int nphibins;
-
-public:
-    // Constructor
-	Smearer_helper(int npoints, double* qx, double* qy, double* dqx, double* dqy,
-			double rlimit, int nrbins, int nphibins);
-	// Smear function
-	virtual void smear2d(double *weights, double *qx_out, double *qy_out);
-};
-
-#endif
Index: sansmodels/src/sans/models/c_smearer/smearer2d_helper_module.cpp
===================================================================
--- sansmodels/src/sans/models/c_smearer/smearer2d_helper_module.cpp	(revision 74c9a3063aab59b8fd6dfdc3e053aa3db931b19c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/**
-  Smearer module to perform point and slit smearing calculations
-
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	See the license text in license.txt
-
-	copyright 2009, University of Tennessee
- */
-#include <Python.h>
-#include <stdio.h>
-#include <smearer2d_helper.hh>
-
-// Utilities
-#define INVECTOR(obj,buf,len)										\
-    do { \
-        int err = PyObject_AsReadBuffer(obj, (const void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-#define OUTVECTOR(obj,buf,len) \
-    do { \
-        int err = PyObject_AsWriteBuffer(obj, (void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-
-/**
- * Delete a Smearer2d object
- */
-void del_smearer2d_helper(void *ptr){
-	Smearer_helper* smearer2d_helper = static_cast<Smearer_helper *>(ptr);
-	delete smearer2d_helper;
-	return;
-}
-
-/**
- * Create a QSmearer as a python object by supplying a q array
- */
-PyObject * new_Smearer_helper(PyObject *, PyObject *args) {
-	PyObject *qx_values_obj;
-	PyObject *qy_values_obj;
-	PyObject *dqx_values_obj;
-	PyObject *dqy_values_obj;
-	Py_ssize_t n_q;
-	//PyObject rlimit_obj;
-	//PyObject npoints_obj;
-	//PyObject nrbins_obj;
-	//PyObject nphibins_obj;
-	double* qx_values;
-	double* qy_values;
-	double* dqx_values;
-	double* dqy_values;
-	double rlimit;
-	int npoints;
-	int nrbins;
-	int nphibins;
-
-
-	if (!PyArg_ParseTuple(args, "OOOOdiii", &qx_values_obj, &qy_values_obj, &dqx_values_obj, &dqy_values_obj, &rlimit, &nrbins, &nphibins, &npoints)) return NULL;
-	OUTVECTOR(qx_values_obj, qx_values, n_q);
-	OUTVECTOR(qy_values_obj, qy_values, n_q);
-	OUTVECTOR(dqx_values_obj, dqx_values, n_q);
-	OUTVECTOR(dqy_values_obj, dqy_values, n_q);
-	Smearer_helper* smearer2d_helper = new Smearer_helper(npoints,qx_values,qy_values,dqx_values,dqy_values, rlimit, nrbins, nphibins);
-	return PyCObject_FromVoidPtr(smearer2d_helper, del_smearer2d_helper);
-}
-
-/**
- * Smear the given input according to a given smearer object
- */
-PyObject * smear2d_input(PyObject *, PyObject *args) {
-	PyObject *weights_obj;
-	Py_ssize_t w_out;
-	double *weights;
-	PyObject *qx_out_obj;
-	Py_ssize_t n_out;
-	double *qx_out;
-	PyObject *qy_out_obj;
-	//Py_ssize_t n_out;
-	double *qy_out;
-	PyObject *smear_obj;
-
-	if (!PyArg_ParseTuple(args, "OOOO",  &smear_obj, &weights_obj, &qx_out_obj, &qy_out_obj)) return NULL;
-	OUTVECTOR(weights_obj, weights, w_out);
-	OUTVECTOR(qx_out_obj, qx_out, n_out);
-	OUTVECTOR(qy_out_obj, qy_out, n_out);
-
-	// Sanity check
-	//if(n_in!=n_out) return Py_BuildValue("i",-1);
-
-	// Set the array pointers
-	void *temp = PyCObject_AsVoidPtr(smear_obj);
-	Smearer_helper* s = static_cast<Smearer_helper *>(temp);
-
-	s->smear2d(weights, qx_out, qy_out);
-	//return PyCObject_FromVoidPtr(s, del_smearer2d_helper);
-	return Py_BuildValue("i",1);
-}
-
-
-/**
- * Define module methods
- */
-static PyMethodDef module_methods[] = {
-	{"new_Smearer_helper", (PyCFunction)new_Smearer_helper, METH_VARARGS,
-		  "Create a new Q Smearer object"},
-	{"smearer2d_helper",(PyCFunction)smear2d_input, METH_VARARGS,
-		  "Smear the given input array"},
-    {NULL}
-};
-
-
-#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
-PyMODINIT_FUNC
-initsmearer2d_helper(void)
-{
-    PyObject* m;
-
-    m = Py_InitModule3("smearer2d_helper", module_methods,
-                       "Smearer2d_helper module");
-}
Index: sansmodels/src/sans/models/c_smearer/smearer_module.cpp
===================================================================
--- sansmodels/src/sans/models/c_smearer/smearer_module.cpp	(revision 642b259b9abb82689ce5f576e23b9b02fdb74600)
+++ 	(revision )
@@ -1,205 +1,0 @@
-/**
- *  Smearer module to perform point and slit smearing calculations
-
-	This software was developed by the University of Tennessee as part of the
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-	project funded by the US National Science Foundation.
-
-	See the license text in license.txt
-
-	copyright 2009, University of Tennessee
- */
-#include <Python.h>
-#include <stdio.h>
-#include <smearer.hh>
-
-// Utilities
-#define INVECTOR(obj,buf,len)										\
-    do { \
-        int err = PyObject_AsReadBuffer(obj, (const void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-#define OUTVECTOR(obj,buf,len) \
-    do { \
-        int err = PyObject_AsWriteBuffer(obj, (void **)(&buf), &len); \
-        if (err < 0) return NULL; \
-        len /= sizeof(*buf); \
-    } while (0)
-
-/**
- * Delete a SlitSmearer object
- */
-void del_slit_smearer(void *ptr){
-	SlitSmearer* smearer = static_cast<SlitSmearer *>(ptr);
-	delete smearer;
-	return;
-}
-
-/**
- * Create a SlitSmearer as a python object
- */
-PyObject * new_slit_smearer(PyObject *, PyObject *args) {
-	double width;
-	double height;
-	double qmin;
-	double qmax;
-	int nbins;
-
-	if (!PyArg_ParseTuple(args, "ddddi", &width, &height, &qmin, &qmax, &nbins)) return NULL;
-	SlitSmearer* smearer = new SlitSmearer(width, height, qmin, qmax, nbins);
-	return PyCObject_FromVoidPtr(smearer, del_slit_smearer);
-}
-
-/**
- * Create a SlitSmearer as a python object by supplying a q array
- */
-PyObject * new_slit_smearer_with_q(PyObject *, PyObject *args) {
-	PyObject *qvalues_obj;
-	Py_ssize_t n_q;
-	double* qvalues;
-	double width;
-	double height;
-
-	if (!PyArg_ParseTuple(args, "ddO", &width, &height, &qvalues_obj)) return NULL;
-	OUTVECTOR(qvalues_obj, qvalues, n_q);
-	SlitSmearer* smearer = new SlitSmearer(width, height, qvalues, n_q);
-	return PyCObject_FromVoidPtr(smearer, del_slit_smearer);
-}
-
-/**
- * Delete a QSmearer object
- */
-void del_q_smearer(void *ptr){
-	QSmearer* smearer = static_cast<QSmearer *>(ptr);
-	delete smearer;
-	return;
-}
-
-/**
- * Create a QSmearer as a python object
- */
-PyObject * new_q_smearer(PyObject *, PyObject *args) {
-	PyObject *width_obj;
-	Py_ssize_t n_w;
-	double* width;
-	double qmin;
-	double qmax;
-	int nbins;
-
-	if (!PyArg_ParseTuple(args, "Oddi", &width_obj, &qmin, &qmax, &nbins)) return NULL;
-	OUTVECTOR(width_obj, width, n_w);
-	QSmearer* smearer = new QSmearer(width, qmin, qmax, nbins);
-	return PyCObject_FromVoidPtr(smearer, del_q_smearer);
-}
-
-/**
- * Create a QSmearer as a python object by supplying a q array
- */
-PyObject * new_q_smearer_with_q(PyObject *, PyObject *args) {
-	PyObject *width_obj;
-	Py_ssize_t n_w;
-	double* width;
-	PyObject *qvalues_obj;
-	Py_ssize_t n_q;
-	double* qvalues;
-
-	if (!PyArg_ParseTuple(args, "OO", &width_obj, &qvalues_obj)) return NULL;
-	OUTVECTOR(width_obj, width, n_w);
-	OUTVECTOR(qvalues_obj, qvalues, n_q);
-	QSmearer* smearer = new QSmearer(width, qvalues, n_q);
-	return PyCObject_FromVoidPtr(smearer, del_q_smearer);
-}
-
-/**
- * Smear the given input according to a given smearer object
- */
-PyObject * smear_input(PyObject *, PyObject *args) {
-	PyObject *input_iq_obj;
-	PyObject *output_iq_obj;
-	PyObject *smear_obj;
-	Py_ssize_t n_in;
-	Py_ssize_t n_out;
-	double *input_iq;
-	double *output_iq;
-	int first_bin;
-	int last_bin;
-
-
-	if (!PyArg_ParseTuple(args, "OOOii", &smear_obj, &input_iq_obj, &output_iq_obj, &first_bin, &last_bin)) return NULL;
-	OUTVECTOR(input_iq_obj, input_iq, n_in);
-	OUTVECTOR(output_iq_obj, output_iq, n_out);
-
-	// Sanity check
-	if(n_in!=n_out) return Py_BuildValue("i",-1);
-
-	// Set the array pointers
-	void *temp = PyCObject_AsVoidPtr(smear_obj);
-	BaseSmearer* s = static_cast<BaseSmearer *>(temp);
-
-	if(n_in!=s->get_nbins()) {
-		return Py_BuildValue("i",-2);
-	}
-
-	s->smear(input_iq, output_iq, first_bin, last_bin);
-
-	return Py_BuildValue("i",1);
-}
-
-/**
- * Get the q-value of a given bin
- */
-PyObject * get_q(PyObject *, PyObject *args) {
-	PyObject *smear_obj;
-	int bin;
-
-	if (!PyArg_ParseTuple(args, "Oi", &smear_obj, &bin)) return NULL;
-
-	// Set the array pointers
-	void *temp = PyCObject_AsVoidPtr(smear_obj);
-	BaseSmearer* s = static_cast<BaseSmearer *>(temp);
-
-	if(s->get_nbins()<=0 || s->get_nbins()<=bin) {
-		return NULL;
-	}
-
-	double q, q_min, q_max;
-	if (s->get_bin_range(bin, &q, &q_min, &q_max)<0) {
-		return NULL;
-	}
-	return Py_BuildValue("d", q);
-}
-
-
-/**
- * Define module methods
- */
-static PyMethodDef module_methods[] = {
-	{"new_slit_smearer", (PyCFunction)new_slit_smearer, METH_VARARGS,
-		  "Create a new Slit Smearer object"},
-	{"new_slit_smearer_with_q", (PyCFunction)new_slit_smearer_with_q, METH_VARARGS,
-		  "Create a new Slit Smearer object by supplying an array of Q values"},
-	{"new_q_smearer", (PyCFunction)new_q_smearer, METH_VARARGS,
-		  "Create a new Q Smearer object"},
-	{"new_q_smearer_with_q", (PyCFunction)new_q_smearer_with_q, METH_VARARGS,
-		  "Create a new Q Smearer object by supplying an array of Q values"},
-	{"smear",(PyCFunction)smear_input, METH_VARARGS,
-		  "Smear the given input array"},
-	{"get_q",(PyCFunction)get_q, METH_VARARGS,
-		  "Get the q-value of a given bin"},
-    {NULL}
-};
-
-
-#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
-PyMODINIT_FUNC
-initsmearer(void)
-{
-    PyObject* m;
-
-    m = Py_InitModule3("smearer", module_methods,
-                       "Q Smearing module");
-}
Index: sansmodels/src/sans/models/libigor/GaussWeights.c
===================================================================
--- sansmodels/src/sans/models/libigor/GaussWeights.c	(revision 71d21947dae252738712986279b665b2db6682a6)
+++ 	(revision )
@@ -1,520 +1,0 @@
-/*
- *  GaussWeights.c
- *  SANSAnalysis
- *
- *  Created by Andrew Jackson on 4/23/07.
- *  Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
-
-// Gaussians
-const double Gauss20Wt[20]={
-	.0176140071391521,
-	.0406014298003869,
-	.0626720483341091,
-	.0832767415767047,
-	.10193011981724,
-	.118194531961518,
-	.131688638449177,
-	.142096109318382,
-	.149172986472604,
-	.152753387130726,
-	.152753387130726,
-	.149172986472604,
-	.142096109318382,
-	.131688638449177,
-	.118194531961518,
-	.10193011981724,
-	.0832767415767047,
-	.0626720483341091,
-	.0406014298003869,
-	.0176140071391521
-};
-
-const double Gauss20Z[20]={
-	-.993128599185095,
-	-.963971927277914,
-	-.912234428251326,
-	-.839116971822219,
-	-.746331906460151,
-	-.636053680726515,
-	-.510867001950827,
-	-.37370608871542,
-	-.227785851141645,
-	-.076526521133497,
-	.0765265211334973,
-	.227785851141645,
-	.37370608871542,
-	.510867001950827,
-	.636053680726515,
-	.746331906460151,
-	.839116971822219,
-	.912234428251326,
-	.963971927277914,
-	.993128599185095
-};
-
-const double Gauss76Wt[76]={
-	.00126779163408536,		//0
-	.00294910295364247,
-	.00462793522803742,
-	.00629918049732845,
-	.00795984747723973,
-	.00960710541471375,
-	.0112381685696677,
-	.0128502838475101,
-	.0144407317482767,
-	.0160068299122486,
-	.0175459372914742,		//10
-	.0190554584671906,
-	.020532847967908,
-	.0219756145344162,
-	.0233813253070112,
-	.0247476099206597,
-	.026072164497986,
-	.0273527555318275,
-	.028587223650054,
-	.029773487255905,
-	.0309095460374916,		//20
-	.0319934843404216,
-	.0330234743977917,
-	.0339977794120564,
-	.0349147564835508,
-	.0357728593807139,
-	.0365706411473296,
-	.0373067565423816,
-	.0379799643084053,
-	.0385891292645067,
-	.0391332242205184,		//30
-	.0396113317090621,
-	.0400226455325968,
-	.040366472122844,
-	.0406422317102947,
-	.0408494593018285,
-	.040987805464794,
-	.0410570369162294,
-	.0410570369162294,
-	.040987805464794,
-	.0408494593018285,		//40
-	.0406422317102947,
-	.040366472122844,
-	.0400226455325968,
-	.0396113317090621,
-	.0391332242205184,
-	.0385891292645067,
-	.0379799643084053,
-	.0373067565423816,
-	.0365706411473296,
-	.0357728593807139,		//50
-	.0349147564835508,
-	.0339977794120564,
-	.0330234743977917,
-	.0319934843404216,
-	.0309095460374916,
-	.029773487255905,
-	.028587223650054,
-	.0273527555318275,
-	.026072164497986,
-	.0247476099206597,		//60
-	.0233813253070112,
-	.0219756145344162,
-	.020532847967908,
-	.0190554584671906,
-	.0175459372914742,
-	.0160068299122486,
-	.0144407317482767,
-	.0128502838475101,
-	.0112381685696677,
-	.00960710541471375,		//70
-	.00795984747723973,
-	.00629918049732845,
-	.00462793522803742,
-	.00294910295364247,
-	.00126779163408536		//75 (indexed from 0)
-};
-
-const double Gauss76Z[76]={
-	 .999505948362153*(-1.0),		//0
-	 .997397786355355*(-1.0),
-	 .993608772723527*(-1.0),
-	 .988144453359837*(-1.0),
-	 .981013938975656*(-1.0),
-	 .972229228520377*(-1.0),
-	 .961805126758768*(-1.0),
-	 .949759207710896*(-1.0),
-	 .936111781934811*(-1.0),
-	 .92088586125215*(-1.0),
-	 .904107119545567*(-1.0),		//10
-	 .885803849292083*(-1.0),
-	 .866006913771982*(-1.0),
-	 .844749694983342*(-1.0),
-	 .822068037328975*(-1.0),
-	 .7980001871612*(-1.0),
-	 .77258672828181*(-1.0),
-	 .74587051350361*(-1.0),
-	 .717896592387704*(-1.0),
-	 .688712135277641*(-1.0),
-	 .658366353758143*(-1.0),		//20
-	 .626910417672267*(-1.0),
-	 .594397368836793*(-1.0),
-	 .560882031601237*(-1.0),
-	 .526420920401243*(-1.0),
-	 .491072144462194*(-1.0),
-	 .454895309813726*(-1.0),
-	 .417951418780327*(-1.0),
-	 .380302767117504*(-1.0),
-	 .342012838966962*(-1.0),
-	 .303146199807908*(-1.0),		//30
-	 .263768387584994*(-1.0),
-	 .223945802196474*(-1.0),
-	 .183745593528914*(-1.0),
-	 .143235548227268*(-1.0),
-	 .102483975391227*(-1.0),
-	 .0615595913906112*(-1.0),
-	 .0205314039939986*(-1.0),
-	-.0205314039939986*(-1.0),
-	-.0615595913906112*(-1.0),
-	-.102483975391227*(-1.0),			//40
-	-.143235548227268*(-1.0),
-	-.183745593528914*(-1.0),
-	-.223945802196474*(-1.0),
-	-.263768387584994*(-1.0),
-	-.303146199807908*(-1.0),
-	-.342012838966962*(-1.0),
-	-.380302767117504*(-1.0),
-	-.417951418780327*(-1.0),
-	-.454895309813726*(-1.0),
-	-.491072144462194*(-1.0),		//50
-	-.526420920401243*(-1.0),
-	-.560882031601237*(-1.0),
-	-.594397368836793*(-1.0),
-	-.626910417672267*(-1.0),
-	-.658366353758143*(-1.0),
-	-.688712135277641*(-1.0),
-	-.717896592387704*(-1.0),
-	-.74587051350361*(-1.0),
-	-.77258672828181*(-1.0),
-	-.7980001871612*(-1.0),	//60
-	-.822068037328975*(-1.0),
-	-.844749694983342*(-1.0),
-	-.866006913771982*(-1.0),
-	-.885803849292083*(-1.0),
-	-.904107119545567*(-1.0),
-	-.92088586125215*(-1.0),
-	-.936111781934811*(-1.0),
-	-.949759207710896*(-1.0),
-	-.961805126758768*(-1.0),
-	-.972229228520377*(-1.0),		//70
-	-.981013938975656*(-1.0),
-	-.988144453359837*(-1.0),
-	-.993608772723527*(-1.0),
-	-.997397786355355*(-1.0),
-	-.999505948362153*(-1.0)		//75
-};
-
-const double Gauss150Z[150]={
-  	-0.9998723404457334,
-  	-0.9993274305065947,
-  	-0.9983473449340834,
-  	-0.9969322929775997,
-  	-0.9950828645255290,
-  	-0.9927998590434373,
-  	-0.9900842691660192,
-  	-0.9869372772712794,
-  	-0.9833602541697529,
-  	-0.9793547582425894,
-  	-0.9749225346595943,
-  	-0.9700655145738374,
-  	-0.9647858142586956,
-  	-0.9590857341746905,
-  	-0.9529677579610971,
-  	-0.9464345513503147,
-  	-0.9394889610042837,
-  	-0.9321340132728527,
-  	-0.9243729128743136,
-  	-0.9162090414984952,
-  	-0.9076459563329236,
-  	-0.8986873885126239,
-  	-0.8893372414942055,
-  	-0.8795995893549102,
-  	-0.8694786750173527,
-  	-0.8589789084007133,
-  	-0.8481048644991847,
-  	-0.8368612813885015,
-  	-0.8252530581614230,
-  	-0.8132852527930605,
-  	-0.8009630799369827,
-  	-0.7882919086530552,
-  	-0.7752772600680049,
-  	-0.7619248049697269,
-  	-0.7482403613363824,
-  	-0.7342298918013638,
-  	-0.7198995010552305,
-  	-0.7052554331857488,
-  	-0.6903040689571928,
-  	-0.6750519230300931,
-  	-0.6595056411226444,
-  	-0.6436719971150083,
-  	-0.6275578900977726,
-  	-0.6111703413658551,
-  	-0.5945164913591590,
-  	-0.5776035965513142,
-  	-0.5604390262878617,
-  	-0.5430302595752546,
-  	-0.5253848818220803,
-  	-0.5075105815339176,
-  	-0.4894151469632753,
-  	-0.4711064627160663,
-  	-0.4525925063160997,
-  	-0.4338813447290861,
-  	-0.4149811308476706,
-  	-0.3959000999390257,
-  	-0.3766465660565522,
-  	-0.3572289184172501,
-  	-0.3376556177463400,
-  	-0.3179351925907259,
-  	-0.2980762356029071,
-  	-0.2780873997969574,
-  	-0.2579773947782034,
-  	-0.2377549829482451,
-  	-0.2174289756869712,
-  	-0.1970082295132342,
-  	-0.1765016422258567,
-  	-0.1559181490266516,
-  	-0.1352667186271445,
-  	-0.1145563493406956,
-  	-0.0937960651617229,
-  	-0.0729949118337358,
-  	-0.0521619529078925,
-  	-0.0313062657937972,
-  	-0.0104369378042598,
-  	0.0104369378042598,
-  	0.0313062657937972,
-  	0.0521619529078925,
-  	0.0729949118337358,
-  	0.0937960651617229,
-  	0.1145563493406956,
-  	0.1352667186271445,
-  	0.1559181490266516,
-  	0.1765016422258567,
-  	0.1970082295132342,
-  	0.2174289756869712,
-  	0.2377549829482451,
-  	0.2579773947782034,
-  	0.2780873997969574,
-  	0.2980762356029071,
-  	0.3179351925907259,
-  	0.3376556177463400,
-  	0.3572289184172501,
-  	0.3766465660565522,
-  	0.3959000999390257,
-  	0.4149811308476706,
-  	0.4338813447290861,
-  	0.4525925063160997,
-  	0.4711064627160663,
-  	0.4894151469632753,
-  	0.5075105815339176,
-  	0.5253848818220803,
-  	0.5430302595752546,
-  	0.5604390262878617,
-  	0.5776035965513142,
-  	0.5945164913591590,
-  	0.6111703413658551,
-  	0.6275578900977726,
-  	0.6436719971150083,
-  	0.6595056411226444,
-  	0.6750519230300931,
-  	0.6903040689571928,
-  	0.7052554331857488,
-  	0.7198995010552305,
-  	0.7342298918013638,
-  	0.7482403613363824,
-  	0.7619248049697269,
-  	0.7752772600680049,
-  	0.7882919086530552,
-  	0.8009630799369827,
-  	0.8132852527930605,
-  	0.8252530581614230,
-  	0.8368612813885015,
-  	0.8481048644991847,
-  	0.8589789084007133,
-  	0.8694786750173527,
-  	0.8795995893549102,
-  	0.8893372414942055,
-  	0.8986873885126239,
-  	0.9076459563329236,
-  	0.9162090414984952,
-  	0.9243729128743136,
-  	0.9321340132728527,
-  	0.9394889610042837,
-  	0.9464345513503147,
-  	0.9529677579610971,
-  	0.9590857341746905,
-  	0.9647858142586956,
-  	0.9700655145738374,
-  	0.9749225346595943,
-  	0.9793547582425894,
-  	0.9833602541697529,
-  	0.9869372772712794,
-  	0.9900842691660192,
-  	0.9927998590434373,
-  	0.9950828645255290,
-  	0.9969322929775997,
-  	0.9983473449340834,
-  	0.9993274305065947,
-  	0.9998723404457334
-};
-
-const double Gauss150Wt[150]={
-  	0.0003276086705538,
-  	0.0007624720924706,
-  	0.0011976474864367,
-  	0.0016323569986067,
-  	0.0020663664924131,
-  	0.0024994789888943,
-  	0.0029315036836558,
-  	0.0033622516236779,
-  	0.0037915348363451,
-  	0.0042191661429919,
-  	0.0046449591497966,
-  	0.0050687282939456,
-  	0.0054902889094487,
-  	0.0059094573005900,
-  	0.0063260508184704,
-  	0.0067398879387430,
-  	0.0071507883396855,
-  	0.0075585729801782,
-  	0.0079630641773633,
-  	0.0083640856838475,
-  	0.0087614627643580,
-  	0.0091550222717888,
-  	0.0095445927225849,
-  	0.0099300043714212,
-  	0.0103110892851360,
-  	0.0106876814158841,
-  	0.0110596166734735,
-  	0.0114267329968529,
-  	0.0117888704247183,
-  	0.0121458711652067,
-  	0.0124975796646449,
-  	0.0128438426753249,
-  	0.0131845093222756,
-  	0.0135194311690004,
-  	0.0138484622795371,
-  	0.0141714592928592,
-  	0.0144882814685445,
-  	0.0147987907597169,
-  	0.0151028518701744,
-  	0.0154003323133401,
-  	0.0156911024699895,
-  	0.0159750356447283,
-  	0.0162520081211971,
-  	0.0165218992159766,
-  	0.0167845913311726,
-  	0.0170399700056559,
-  	0.0172879239649355,
-  	0.0175283451696437,
-  	0.0177611288626114,
-  	0.0179861736145128,
-  	0.0182033813680609,
-  	0.0184126574807331,
-  	0.0186139107660094,
-  	0.0188070535331042,
-  	0.0189920016251754,
-  	0.0191686744559934,
-  	0.0193369950450545,
-  	0.0194968900511231,
-  	0.0196482898041878,
-  	0.0197911283358190,
-  	0.0199253434079123,
-  	0.0200508765398072,
-  	0.0201676730337687,
-  	0.0202756819988200,
-  	0.0203748563729175,
-  	0.0204651529434560,
-  	0.0205465323660984,
-  	0.0206189591819181,
-  	0.0206824018328499,
-  	0.0207368326754401,
-  	0.0207822279928917,
-  	0.0208185680053983,
-  	0.0208458368787627,
-  	0.0208640227312962,
-  	0.0208731176389954,
-  	0.0208731176389954,
-  	0.0208640227312962,
-  	0.0208458368787627,
-  	0.0208185680053983,
-  	0.0207822279928917,
-  	0.0207368326754401,
-  	0.0206824018328499,
-  	0.0206189591819181,
-  	0.0205465323660984,
-  	0.0204651529434560,
-  	0.0203748563729175,
-  	0.0202756819988200,
-  	0.0201676730337687,
-  	0.0200508765398072,
-  	0.0199253434079123,
-  	0.0197911283358190,
-  	0.0196482898041878,
-  	0.0194968900511231,
-  	0.0193369950450545,
-  	0.0191686744559934,
-  	0.0189920016251754,
-  	0.0188070535331042,
-  	0.0186139107660094,
-  	0.0184126574807331,
-  	0.0182033813680609,
-  	0.0179861736145128,
-  	0.0177611288626114,
-  	0.0175283451696437,
-  	0.0172879239649355,
-  	0.0170399700056559,
-  	0.0167845913311726,
-  	0.0165218992159766,
-  	0.0162520081211971,
-  	0.0159750356447283,
-  	0.0156911024699895,
-  	0.0154003323133401,
-  	0.0151028518701744,
-  	0.0147987907597169,
-  	0.0144882814685445,
-  	0.0141714592928592,
-  	0.0138484622795371,
-  	0.0135194311690004,
-  	0.0131845093222756,
-  	0.0128438426753249,
-  	0.0124975796646449,
-  	0.0121458711652067,
-  	0.0117888704247183,
-  	0.0114267329968529,
-  	0.0110596166734735,
-  	0.0106876814158841,
-  	0.0103110892851360,
-  	0.0099300043714212,
-  	0.0095445927225849,
-  	0.0091550222717888,
-  	0.0087614627643580,
-  	0.0083640856838475,
-  	0.0079630641773633,
-  	0.0075585729801782,
-  	0.0071507883396855,
-  	0.0067398879387430,
-  	0.0063260508184704,
-  	0.0059094573005900,
-  	0.0054902889094487,
-  	0.0050687282939456,
-  	0.0046449591497966,
-  	0.0042191661429919,
-  	0.0037915348363451,
-  	0.0033622516236779,
-  	0.0029315036836558,
-  	0.0024994789888943,
-  	0.0020663664924131,
-  	0.0016323569986067,
-  	0.0011976474864367,
-  	0.0007624720924706,
-  	0.0003276086705538
-};
-
Index: sansmodels/src/sans/models/libigor/GaussWeights.h
===================================================================
--- sansmodels/src/sans/models/libigor/GaussWeights.h	(revision 71d21947dae252738712986279b665b2db6682a6)
+++ 	(revision )
@@ -1,24 +1,0 @@
-#ifndef GAUSSWEIGHTS_H
-#define GAUSSWEIGHTS_H
-/*
- *  GaussWeights.h
- *  SANSAnalysis
- *
- *  Created by Andrew Jackson on 4/23/07.
- *  Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
-
-// Gaussians
-extern const double Gauss20Wt[20];
-
-extern const double Gauss20Z[20];
-
-extern const double Gauss76Wt[76];
-
-extern const double Gauss76Z[76];
-
-extern const double Gauss150Z[150];
-
-extern const double Gauss150Wt[150];
-#endif
Index: sansmodels/src/sans/models/libigor/Make.mm
===================================================================
--- sansmodels/src/sans/models/libigor/Make.mm	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ 	(revision )
@@ -1,80 +1,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#                               Michael A.G. Aivazis
-#                        California Institute of Technology
-#                        (C) 1998-2004  All Rights Reserved
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-include local.def
-
-PROJECT = sans
-PACKAGE = libsansigor
-
-PROJ_SAR = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SAR)
-PROJ_DLL = $(BLD_BINDIR)/$(PACKAGE).$(EXT_SO)
-PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
-PROJ_CLEAN += $(PROJ_SAR) $(PROJ_DLL)
-
-PROJ_SRCS = \
-	libCylinder.c \
-	libSphere.c \
-	libStructureFactor.c \
-	libTwoPhase.c \
-
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# build the library
-
-all: $(PROJ_SAR) export
-
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-ifeq (Win32, ${findstring Win32, $(PLATFORM_ID)})
-
-# build the shared object
-$(PROJ_SAR): product_dirs $(PROJ_OBJS)
-	$(CXX) $(LCXXFLAGS) -o $(PROJ_DLL) \
-	-Wl,--out-implib=$(PROJ_SAR) $(PROJ_OBJS)
-
-# export
-export:: export-headers export-libraries export-binaries
-
-else
-
-# build the shared object
-$(PROJ_SAR): product_dirs $(PROJ_OBJS)
-	$(CXX) $(LCXXFLAGS) -o $(PROJ_SAR) $(PROJ_OBJS)
-
-
-# export
-export:: export-headers export-libraries 
-
-endif
-
-EXPORT_HEADERS = \
-	GaussWeights.h \
-	StandardHeaders.h \
-	libCylinder.h \
-	libSANSAnalysis.h \
-	libSphere.h \
-	libStructureFactor.h \
-	libTwoPhase.h \
-
-EXPORT_LIBS = $(PROJ_SAR)
-EXPORT_BINS = $(PROJ_DLL)
-
-
-
-#include doxygen/default.def
-#docs: export-doxygen-docs
-
-
-# version
-# $Id: Make.mm 1444 2007-11-16 16:46:15Z linjiao $
-
-#
-# End of file
Index: sansmodels/src/sans/models/libigor/StandardHeaders.h
===================================================================
--- sansmodels/src/sans/models/libigor/StandardHeaders.h	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ 	(revision )
@@ -1,19 +1,0 @@
-/*
- *  StandardHeaders.h
- *  SANSAnalysis
- *
- *  Created by Andrew Jackson on 4/23/07.
- *  Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
-
-#include <math.h>
-#include <ctype.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef _WIN32
-#include <float.h>
-#include "winFuncs.h"
-#endif
Index: sansmodels/src/sans/models/libigor/libCylinder.c
===================================================================
--- sansmodels/src/sans/models/libigor/libCylinder.c	(revision a24f530f78afcdef6c68238cd38554623b2bb2c6)
+++ 	(revision )
@@ -1,3311 +1,0 @@
-/*	CylinderFit.c
-
-A simplified project designed to act as a template for your curve fitting function.
-The fitting function is a Cylinder form factor. No resolution effects are included (yet)
-*/
-
-#include "StandardHeaders.h"			// Include ANSI headers, Mac headers
-#include "GaussWeights.h"
-#include "libCylinder.h"
-
-/////////functions for WRC implementation of flexible cylinders
-static double
-gammaln(double xx)
-{
-  double x,y,tmp,ser;
-  static double cof[6]={76.18009172947146,-86.50532032941677,
-    24.01409824083091,-1.231739572450155,
-    0.1208650973866179e-2,-0.5395239384953e-5};
-  int j;
-
-  y=x=xx;
-  tmp=x+5.5;
-  tmp -= (x+0.5)*log(tmp);
-  ser=1.000000000190015;
-  for (j=0;j<=5;j++) ser += cof[j]/++y;
-  return -tmp+log(2.5066282746310005*ser/x);
-}
-/////////functions for WRC implementation of flexible cylinders
-
-//
-static double
-AlphaSquare(double x)
-{
-    double yy;
-    yy = pow( (1.0 + (x/3.12)*(x/3.12) + (x/8.67)*(x/8.67)*(x/8.67)),(0.176/3.0) );
-
-    return (yy);
-}
-
-//
-static double
-Rgsquarezero(double q, double L, double b)
-{
-    double yy;
-    yy = (L*b/6.0) * (1.0 - 1.5*(b/L) + 1.5*pow((b/L),2) - 0.75*pow((b/L),3)*(1.0 - exp(-2.0*(L/b))));
-
-    return (yy);
-}
-
-//
-static double
-Rgsquareshort(double q, double L, double b)
-{
-    double yy;
-    yy = AlphaSquare(L/b) * Rgsquarezero(q,L,b);
-
-    return (yy);
-}
-
-//
-static double
-Rgsquare(double q, double L, double b)
-{
-    double yy;
-    yy = AlphaSquare(L/b)*L*b/6.0;
-
-    return (yy);
-}
-
-// ?? funciton is not used - but should the log actually be log10???
-/*
-static double
-miu(double x)
-{
-    double yy;
-    yy = (1.0/8.0)*(9.0*x - 2.0 + 2.0*log(1.0 + x)/x)*exp(1.0/2.565*(1.0/x + (1.0 - 1.0/(x*x))*log(1.0 + x)));
-
-    return (yy);
-}
-*/
-
-//WR named this w (too generic)
-static double
-w_WR(double x)
-{
-    double yy;
-    yy = 0.5*(1 + tanh((x - 1.523)/0.1477));
-
-    return (yy);
-}
-
-//
-static double
-u1(double q, double L, double b)
-{
-    double yy;
-
-    yy = Rgsquareshort(q,L,b)*q*q;
-
-    return (yy);
-}
-
-// was named u
-static double
-u_WR(double q, double L, double b)
-{
-    double yy;
-    yy = Rgsquare(q,L,b)*q*q;
-    return (yy);
-}
-
-
-//
-static double
-Sdebye1(double q, double L, double b)
-{
-    double yy;
-    yy = 2.0*(exp(-u1(q,L,b)) + u1(q,L,b) -1.0)/( pow((u1(q,L,b)),2.0) );
-
-    return (yy);
-}
-
-
-//
-static double
-Sdebye(double q, double L, double b)
-{
-    double yy;
-    yy = 2.0*(exp(-u_WR(q,L,b)) + u_WR(q,L,b) -1.0)/(pow((u_WR(q,L,b)),2));
-
-    return (yy);
-}
-
-//
-static double
-Sexv(double q, double L, double b)
-{
-    double yy,C1,C2,C3,miu,Rg2;
-    C1=1.22;
-    C2=0.4288;
-    C3=-1.651;
-    miu = 0.585;
-
-    Rg2 = Rgsquare(q,L,b);
-
-    yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) +  C2*pow((q*sqrt(Rg2)),(-2.0/miu)) +    C3*pow((q*sqrt(Rg2)),(-3.0/miu)));
-
-    return (yy);
-}
-
-// this must be WR modified version
-static double
-Sexvnew(double q, double L, double b)
-{
-    double yy,C1,C2,C3,miu;
-    double del=1.05,C_star2,Rg2;
-
-    C1=1.22;
-    C2=0.4288;
-    C3=-1.651;
-    miu = 0.585;
-
-    //calculating the derivative to decide on the corection (cutoff) term?
-    // I have modified this from WRs original code
-
-    if( (Sexv(q*del,L,b)-Sexv(q,L,b))/(q*del - q) >= 0.0 ) {
-        C_star2 = 0.0;
-    } else {
-        C_star2 = 1.0;
-    }
-
-    Rg2 = Rgsquare(q,L,b);
-
-  yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + C_star2*w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) + C2*pow((q*sqrt(Rg2)),(-2.0/miu)) + C3*pow((q*sqrt(Rg2)),(-3.0/miu)));
-
-    return (yy);
-}
-
-// these are the messy ones
-static double
-a2short(double q, double L, double b, double p1short, double p2short, double q0)
-{
-    double yy,Rg2_sh;
-    double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p;
-    double pi;
-
-    E = 2.718281828459045091;
-  pi = 4.0*atan(1.0);
-    Rg2_sh = Rgsquareshort(q,L,b);
-    Rg2_sh2 = Rg2_sh*Rg2_sh;
-    t1 = ((q0*q0*Rg2_sh)/(b*b));
-    Et1 = pow(E,t1);
-    Emt1 =pow(E,-t1);
-    q02 = q0*q0;
-    q0p = pow(q0,(-4.0 + p2short) );
-
-    //E is the number e
-    yy = ((-(1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b*b*b*L - 8.0*b*b*b*Et1*L - 2.0*b*b*b*L*p1short + 2.0*b*b*b*Et1*L*p1short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p1short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p1short*pi*q02*q0*Rg2_sh2)))))));
-
-    return (yy);
-}
-
-//
-static double
-a1short(double q, double L, double b, double p1short, double p2short, double q0)
-{
-    double yy,Rg2_sh;
-    double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p,b3;
-  double pi;
-
-    E = 2.718281828459045091;
-  pi = 4.0*atan(1.0);
-    Rg2_sh = Rgsquareshort(q,L,b);
-    Rg2_sh2 = Rg2_sh*Rg2_sh;
-    b3 = b*b*b;
-    t1 = ((q0*q0*Rg2_sh)/(b*b));
-    Et1 = pow(E,t1);
-    Emt1 =pow(E,-t1);
-    q02 = q0*q0;
-    q0p = pow(q0,(-4.0 + p1short) );
-
-    yy = ((1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b3*L - 8.0*b3*Et1*L - 2.0*b3*L*p2short + 2.0*b3*Et1*L*p2short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p2short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p2short*pi*q02*q0*Rg2_sh2))))));
-
-    return(yy);
-}
-
-
-//need to define this on my own
-static double
-sech_WR(double x)
-{
-  return(1/cosh(x));
-}
-
-// this one will be lots of trouble
-static double
-a2long(double q, double L, double b, double p1, double p2, double q0)
-{
-    double yy,C1,C2,C3,C4,C5,miu,C,Rg2;
-    double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,pi;
-    double E,b2,b3,b4,q02,q03,q04,q05,Rg22;
-
-    pi = 4.0*atan(1.0);
-    E = 2.718281828459045091;
-    if( L/b > 10.0) {
-        C = 3.06/pow((L/b),0.44);
-    } else {
-        C = 1.0;
-    }
-
-    C1 = 1.22;
-    C2 = 0.4288;
-    C3 = -1.651;
-    C4 = 1.523;
-    C5 = 0.1477;
-    miu = 0.585;
-
-    Rg2 = Rgsquare(q,L,b);
-    Rg22 = Rg2*Rg2;
-    b2 = b*b;
-    b3 = b*b*b;
-    b4 = b3*b;
-    q02 = q0*q0;
-    q03 = q0*q0*q0;
-    q04 = q03*q0;
-    q05 = q04*q0;
-
-    t1 = (1.0/(b* p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2)) ));
-
-    t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7*b2)/(15.0*q02*Rg2)))*Rg2)/b)))/L;
-
-    t3 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2.0))/(2.0*C5);
-
-    t4 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(C5*q04*Rg22);
-
-    t5 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);
-
-    t6 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q05*Rg22);
-
-    t7 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu));
-
-    t8 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
-
-    t9 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))))/L;
-
-    t10 = (2.0*b4*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);
-
-
-    yy = ((-1.0*(t1* ((-pow(q0,-p1)*(((b2*pi)/(L*q02) + t2 + t3 - t4 + t5 - t6 + 1.0/2.0*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) + t9 + t10 + 1.0/2.0*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))))));
-
-    return (yy);
-}
-//
-static double
-a1long(double q, double L, double b, double p1, double p2, double q0)
-{
-    double yy,C,C1,C2,C3,C4,C5,miu,Rg2;
-    double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15;
-    double E,pi;
-    double b2,b3,b4,q02,q03,q04,q05,Rg22;
-
-    pi = 4.0*atan(1.0);
-    E = 2.718281828459045091;
-
-    if( L/b > 10.0) {
-        C = 3.06/pow((L/b),0.44);
-    } else {
-        C = 1.0;
-    }
-
-    C1 = 1.22;
-    C2 = 0.4288;
-    C3 = -1.651;
-    C4 = 1.523;
-    C5 = 0.1477;
-    miu = 0.585;
-
-    Rg2 = Rgsquare(q,L,b);
-    Rg22 = Rg2*Rg2;
-    b2 = b*b;
-    b3 = b*b*b;
-    b4 = b3*b;
-    q02 = q0*q0;
-    q03 = q0*q0*q0;
-    q04 = q03*q0;
-    q05 = q04*q0;
-
-    t1 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))));
-
-    t2 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
-
-    t3 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))));
-
-    t4 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
-
-    t5 = (1.0/(b*p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2))));
-
-    t6 = (b*C*(((-((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2)))*Rg2)/b)));
-
-    t7 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2));
-
-    t8 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2));
-
-    t9 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
-
-    t10 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
-
-    t11 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu));
-
-    t12 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
-
-    t13 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02* Rg2))) + (7.0*b2)/(15.0*q02*Rg2))));
-
-    t14 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
-
-    t15 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))));
-
-
-    yy = (pow(q0,p1)*(((-((b*pi)/(L*q0))) +t1/L +t2/(q04*Rg22) + 1.0/2.0*t3*t4)) + (t5*((pow(q0,(p1 - p2))*(((-pow(q0,(-p1)))*(((b2*pi)/(L*q02) +t6/L +t7/(2.0*C5) -t8/(C5*q04*Rg22) +t9/(q04*Rg22) -t10/(q05*Rg22) + 1.0/2.0*t11*t12)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) +t13/L +t14/(q04*Rg22) + 1.0/2.0*t15*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))))))));
-
-    return (yy);
-}
-
-
-static double
-Sk_WR(double q, double L, double b)
-{
-  //
-  double p1,p2,p1short,p2short,q0;
-  double C,ans,q0short,Sexvmodify,pi;
-
-  pi = 4.0*atan(1.0);
-
-  p1 = 4.12;
-  p2 = 4.42;
-  p1short = 5.36;
-  p2short = 5.62;
-  q0 = 3.1;
-  //
-  q0short = fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0);
-
-  //
-  if(L/b > 10.0) {
-    C = 3.06/pow((L/b),0.44);
-  } else {
-    C = 1.0;
-  }
-  //
-
-  if( L > 4*b ) { // Longer Chains
-    if (q*b <= 3.1) {   //Modified by Yun on Oct. 15,
-      Sexvmodify = Sexvnew(q, L, b);
-      ans = Sexvmodify + C * (4.0/15.0 + 7.0/(15.0*u_WR(q,L,b)) - (11.0/15.0 + 7.0/(15.0*u_WR(q,L,b)))*exp(-u_WR(q,L,b)))*(b/L);
-    } else { //q(i)*b > 3.1
-      ans = a1long(q, L, b, p1, p2, q0)/(pow((q*b),p1)) + a2long(q, L, b, p1, p2, q0)/(pow((q*b),p2)) + pi/(q*L);
-    }
-  } else { //L <= 4*b Shorter Chains
-    if (q*b <= fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0) ) {
-      if (q*b<=0.01) {
-        ans = 1.0 - Rgsquareshort(q,L,b)*(q*q)/3.0;
-      } else {
-        ans = Sdebye1(q,L,b);
-      }
-    } else {  //q*b > max(1.9/sqrt(Rgsquareshort(q(i),L,b)),3)
-      ans = a1short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p1short)) + a2short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p2short)) + pi/(q*L);
-    }
-  }
-
-  return(ans);
-  //return(a2long(q, L, b, p1, p2, q0));
-}
-
-/*	CylinderForm  :  calculates the form factor of a cylinder at the give x-value p->x
-
-Warning:
-The call to WaveData() below returns a pointer to the middle
-of an unlocked Macintosh handle. In the unlikely event that your
-calculations could cause memory to move, you should copy the coefficient
-values to local variables or an array before such operations.
-*/
-double
-CylinderForm(double dp[], double q)
-{
-
-	int i;
-	double Pi;
-	double scale,radius,length,delrho,bkg,halfheight,sldCyl,sldSolv;		//local variables of coefficient wave
-	int nord=76;			//order of integration
-	double uplim,lolim;		//upper and lower integration limits
-	double summ,zi,yyy,answer,vcyl;			//running tally of integration
-	
-	Pi = 4.0*atan(1.0);
-	lolim = 0.0;
-	uplim = Pi/2.0;
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	radius = dp[1];
-	length = dp[2];
-	sldCyl = dp[3];
-	sldSolv = dp[4];
-	bkg = dp[5];
-	
-	delrho = sldCyl-sldSolv;
-	halfheight = length/2.0;
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss76Wt[i] * CylKernel(q, radius, halfheight, zi);
-		summ += yyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= delrho*delrho;
-	//normalize by cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-	vcyl=Pi*radius*radius*length;
-	answer *= vcyl;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	EllipCyl76X  :  calculates the form factor of a elliptical cylinder at the given x-value p->x
-
-Uses 76 pt Gaussian quadrature for both integrals
-
-Warning:
-The call to WaveData() below returns a pointer to the middle
-of an unlocked Macintosh handle. In the unlikely event that your
-calculations could cause memory to move, you should copy the coefficient
-values to local variables or an array before such operations.
-*/
-double
-EllipCyl76(double dp[], double q)
-{
-	int i,j;
-	double Pi,slde,sld;
-	double scale,ra,nu,length,delrho,bkg;		//local variables of coefficient wave
-	int nord=76;			//order of integration
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer,vell;			//running tally of integration
-	double summj,vaj,vbj,zij,arg, si;			//for the inner integration
-
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 1.0;		//orintational average, outer integral
-	vaj=0.0;
-	vbj=Pi;		//endpoints of inner integral
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	ra = dp[1];
-	nu = dp[2];
-	length = dp[3];
-	slde = dp[4];
-	sld = dp[5];
-	delrho = slde - sld;
-	bkg = dp[6];
-	
-	for(i=0;i<nord;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0;
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the "x" dummy
-		arg = ra*sqrt(1.0-zi*zi);
-		for(j=0;j<nord;j++) {
-			//76 gauss points for the inner integral as well
-			zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "y" dummy
-			yyy = Gauss76Wt[j] * EllipCylKernel(q,arg,nu,zij);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		answer = (vbj-vaj)/2.0*summj;
-		//divide integral by Pi
-		answer /=Pi;
-		
-		//now calculate outer integral
-		arg = q*length*zi/2.0;
-		if (arg == 0.0){
-			si = 1.0;
-		}else{
-			si = sin(arg) * sin(arg) / arg / arg;
-		}
-		yyy = Gauss76Wt[i] * answer * si;
-		summ += yyy;
-	}
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= delrho*delrho;
-	//normalize by cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-	vell = Pi*ra*(nu*ra)*length;
-	answer *= vell;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	EllipCyl20X  :  calculates the form factor of a elliptical cylinder at the given x-value p->x
-
-Uses 76 pt Gaussian quadrature for orientational integral
-Uses 20 pt quadrature for the inner integral over the elliptical cross-section
-
-Warning:
-The call to WaveData() below returns a pointer to the middle
-of an unlocked Macintosh handle. In the unlikely event that your
-calculations could cause memory to move, you should copy the coefficient
-values to local variables or an array before such operations.
-*/
-double
-EllipCyl20(double dp[], double q)
-{
-	int i,j;
-	double Pi,slde,sld;
-	double scale,ra,nu,length,delrho,bkg;		//local variables of coefficient wave
-	int nordi=76;			//order of integration
-	int nordj=20;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer,vell;			//running tally of integration
-	double summj,vaj,vbj,zij,arg,si;			//for the inner integration
-
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 1.0;		//orintational average, outer integral
-	vaj=0.0;
-	vbj=Pi;		//endpoints of inner integral
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	ra = dp[1];
-	nu = dp[2];
-	length = dp[3];
-	slde = dp[4];
-	sld = dp[5];
-	delrho = slde - sld;
-	bkg = dp[6];
-	
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0;
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the "x" dummy
-		arg = ra*sqrt(1.0-zi*zi);
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss20Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "y" dummy
-			yyy = Gauss20Wt[j] * EllipCylKernel(q,arg,nu,zij);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		answer = (vbj-vaj)/2.0*summj;
-		//divide integral by Pi
-		answer /=Pi;
-		
-		//now calculate outer integral
-		arg = q*length*zi/2.0;
-		if (arg == 0.0){
-			si = 1.0;
-		}else{
-			si = sin(arg) * sin(arg) / arg / arg;
-		}
-		yyy = Gauss76Wt[i] * answer * si;
-		summ += yyy;
-	}
-	
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= delrho*delrho;
-	//normalize by cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-	vell = Pi*ra*(nu*ra)*length;
-	answer *= vell;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-
-	return answer;
-}
-
-/*	TriaxialEllipsoidX  :  calculates the form factor of a Triaxial Ellipsoid at the given x-value p->x
-
-Uses 76 pt Gaussian quadrature for both integrals
-
-Warning:
-The call to WaveData() below returns a pointer to the middle
-of an unlocked Macintosh handle. In the unlikely event that your
-calculations could cause memory to move, you should copy the coefficient
-values to local variables or an array before such operations.
-*/
-double
-TriaxialEllipsoid(double dp[], double q)
-{
-	int i,j;
-	double Pi;
-	double scale,aa,bb,cc,delrho,bkg;		//local variables of coefficient wave
-	int nordi=76;			//order of integration
-	int nordj=76;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij,slde,sld;			//for the inner integration
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 1.0;		//orintational average, outer integral
-	vaj = 0.0;
-	vbj = 1.0;		//endpoints of inner integral
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	aa = dp[1];
-	bb = dp[2];
-	cc = dp[3];
-	slde = dp[4];
-	sld = dp[5];
-	delrho = slde - sld;
-	bkg = dp[6];
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the "x" dummy
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "y" dummy
-			yyy = Gauss76Wt[j] * TriaxialKernel(q,aa,bb,cc,zi,zij);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		answer = (vbj-vaj)/2.0*summj;
-		
-		//now calculate outer integral
-		yyy = Gauss76Wt[i] * answer;
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= delrho*delrho;
-	//normalize by ellipsoid volume
-	answer *= 4.0*Pi/3.0*aa*bb*cc;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	ParallelepipedX  :  calculates the form factor of a Parallelepiped (a rectangular solid)
-at the given x-value p->x
-
-Uses 76 pt Gaussian quadrature for both integrals
-
-Warning:
-The call to WaveData() below returns a pointer to the middle
-of an unlocked Macintosh handle. In the unlikely event that your
-calculations could cause memory to move, you should copy the coefficient
-values to local variables or an array before such operations.
-*/
-double
-Parallelepiped(double dp[], double q)
-{
-	int i,j;
-	double scale,aa,bb,cc,delrho,bkg;		//local variables of coefficient wave
-	int nordi=76;			//order of integration
-	int nordj=76;
-	double va,vb;		//upper and lower integration limits
-	double summ,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj;			//for the inner integration
-	double mu,mudum,arg,sigma,uu,vol,sldp,sld;
-	
-	
-	//	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 1.0;		//orintational average, outer integral
-	vaj = 0.0;
-	vbj = 1.0;		//endpoints of inner integral
-
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	aa = dp[1];
-	bb = dp[2];
-	cc = dp[3];
-	sldp = dp[4];
-	sld = dp[5];
-	delrho = sldp - sld;
-	bkg = dp[6];
-	
-	mu = q*bb;
-	vol = aa*bb*cc;
-	// normalize all WRT bb
-	aa = aa/bb;
-	cc = cc/bb;
-	
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		sigma = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the outer dummy
-		
-		for(j=0;j<nordj;j++) {
-			//76 gauss points for the inner integral
-			uu = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the inner dummy
-			mudum = mu*sqrt(1.0-sigma*sigma);
-			yyy = Gauss76Wt[j] * PPKernel(aa,mudum,uu);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		answer = (vbj-vaj)/2.0*summj;
-
-		arg = mu*cc*sigma/2.0;
-		if ( arg == 0.0 ) {
-			answer *= 1.0;
-		} else {
-			answer *= sin(arg)*sin(arg)/arg/arg;
-		}
-		
-		//now sum up the outer integral
-		yyy = Gauss76Wt[i] * answer;
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= delrho*delrho;
-	//normalize by volume
-	answer *= vol;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	HollowCylinderX  :  calculates the form factor of a Hollow Cylinder
-at the given x-value p->x
-
-Uses 76 pt Gaussian quadrature for the single integral
-
-Warning:
-The call to WaveData() below returns a pointer to the middle
-of an unlocked Macintosh handle. In the unlikely event that your
-calculations could cause memory to move, you should copy the coefficient
-values to local variables or an array before such operations.
-*/
-double
-HollowCylinder(double dp[], double q)
-{
-	int i;
-	double scale,rcore,rshell,length,delrho,bkg;		//local variables of coefficient wave
-	int nord=76;			//order of integration
-	double va,vb,zi;		//upper and lower integration limits
-	double summ,answer,pi,sldc,sld;			//running tally of integration
-	
-	pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 1.0;		//limits of numerical integral
-
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];		//make local copies in case memory moves
-	rcore = dp[1];
-	rshell = dp[2];
-	length = dp[3];
-	sldc = dp[4];
-	sld = dp[5];
-	delrho = sldc - sld;
-	bkg = dp[6];
-	
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;
-		summ += Gauss76Wt[i] * HolCylKernel(q, rcore, rshell, length, zi);
-	}
- 	
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= delrho*delrho;
-	//normalize by volume
-	answer *= pi*(rshell*rshell-rcore*rcore)*length;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	EllipsoidFormX  :  calculates the form factor of an ellipsoid of revolution with semiaxes a:a:nua
-at the given x-value p->x
-
-Uses 76 pt Gaussian quadrature for the single integral
-
-Warning:
-The call to WaveData() below returns a pointer to the middle
-of an unlocked Macintosh handle. In the unlikely event that your
-calculations could cause memory to move, you should copy the coefficient
-values to local variables or an array before such operations.
-*/
-double
-EllipsoidForm(double dp[], double q)
-{
-	int i;
-	double scale,a,nua,delrho,bkg;		//local variables of coefficient wave
-	int nord=76;			//order of integration
-	double va,vb,zi;		//upper and lower integration limits
-	double summ,answer,pi,slde,sld;			//running tally of integration
-	
-	pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 1.0;		//limits of numerical integral
-
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	nua = dp[1];
-	a = dp[2];
-	slde = dp[3];
-	sld = dp[4];
-	delrho = slde - sld;
-	bkg = dp[5];
-	
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;
-		summ += Gauss76Wt[i] * EllipsoidKernel(q, a, nua, zi);
-	}
-	
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= delrho*delrho;
-	//normalize by volume
-	answer *= 4.0*pi/3.0*a*a*nua;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-
-/*	Cyl_PolyRadiusX  :  calculates the form factor of a cylinder at the given x-value p->x
-the cylinder has a polydisperse cross section
-
-*/
-double
-Cyl_PolyRadius(double dp[], double q)
-{
-	int i;
-	double scale,radius,length,pd,delrho,bkg;		//local variables of coefficient wave
-	int nord=20;			//order of integration
-	double uplim,lolim;		//upper and lower integration limits
-	double summ,zi,yyy,answer,Vpoly;			//running tally of integration
-	double range,zz,Pi,sldc,sld;
-	
-	Pi = 4.0*atan(1.0);
-	range = 3.4;
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	radius = dp[1];
-	length = dp[2];
-	pd = dp[3];
-	sldc = dp[4];
-	sld = dp[5];
-	delrho = sldc - sld;
-	bkg = dp[6];
-	
-	zz = (1.0/pd)*(1.0/pd) - 1.0;
-	
-	lolim = radius*(1.0-range*pd);		//set the upper/lower limits to cover the distribution
-	if(lolim<0.0) {
-		lolim = 0.0;
-	}
-	if(pd>0.3) {
-		range = 3.4 + (pd-0.3)*18.0;
-	}
-	uplim = radius*(1.0+range*pd);
-	
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss20Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss20Wt[i] * Cyl_PolyRadKernel(q, radius, length, zz, delrho, zi);
-		summ += yyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	//normalize by average cylinder volume
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-	Vpoly=Pi*radius*radius*length*(zz+2.0)/(zz+1.0);
-	answer /= Vpoly;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	Cyl_PolyLengthX  :  calculates the form factor of a cylinder at the given x-value p->x
-the cylinder has a polydisperse Length
-
-*/
-double
-Cyl_PolyLength(double dp[], double q)
-{
-	int i;
-	double scale,radius,length,pd,delrho,bkg;		//local variables of coefficient wave
-	int nord=20;			//order of integration
-	double uplim,lolim;		//upper and lower integration limits
-	double summ,zi,yyy,answer,Vpoly;			//running tally of integration
-	double range,zz,Pi,sldc,sld;
-	
-	
-	Pi = 4.0*atan(1.0);
-	range = 3.4;
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	radius = dp[1];
-	length = dp[2];
-	pd = dp[3];
-	sldc = dp[4];
-	sld = dp[5];
-	delrho = sldc - sld;
-	bkg = dp[6];
-	
-	zz = (1.0/pd)*(1.0/pd) - 1.0;
-	
-	lolim = length*(1.0-range*pd);		//set the upper/lower limits to cover the distribution
-	if(lolim<0.0) {
-		lolim = 0.0;
-	}
-	if(pd>0.3) {
-		range = 3.4 + (pd-0.3)*18.0;
-	}
-	uplim = length*(1.0+range*pd);
-	
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss20Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss20Wt[i] * Cyl_PolyLenKernel(q, radius, length, zz, delrho, zi);
-		summ += yyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	//normalize by average cylinder volume (first moment)
-	//NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-	Vpoly=Pi*radius*radius*length;
-	answer /= Vpoly;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	CoreShellCylinderX  :  calculates the form factor of a cylinder at the given x-value p->x
-the cylinder has a core-shell structure
-
-*/
-double
-CoreShellCylinder(double dp[], double q)
-{
-	int i;
-	double scale,rcore,length,bkg;		//local variables of coefficient wave
-	double thick,rhoc,rhos,rhosolv;
-	int nord=76;			//order of integration
-	double uplim,lolim,halfheight;		//upper and lower integration limits
-	double summ,zi,yyy,answer,Vcyl;			//running tally of integration
-	double Pi;
-	
-	Pi = 4.0*atan(1.0);
-	
-	lolim = 0.0;
-	uplim = Pi/2.0;
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];		//make local copies in case memory moves
-	rcore = dp[1];
-	thick = dp[2];
-	length = dp[3];
-	rhoc = dp[4];
-	rhos = dp[5];
-	rhosolv = dp[6];
-	bkg = dp[7];
-	
-	halfheight = length/2.0;
-	
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss76Wt[i] * CoreShellCylKernel(q, rcore, thick, rhoc,rhos,rhosolv, halfheight, zi);
-		summ += yyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	// length is the total core length 
-	Vcyl=Pi*(rcore+thick)*(rcore+thick)*(length+2.0*thick);
-	answer /= Vcyl;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-
-/*	PolyCoShCylinderX  :  calculates the form factor of a core-shell cylinder at the given x-value p->x
-the cylinder has a polydisperse CORE radius
-
-*/
-double
-PolyCoShCylinder(double dp[], double q)
-{
-	int i;
-	double scale,radius,length,sigma,bkg;		//local variables of coefficient wave
-	double rad,radthick,facthick,rhoc,rhos,rhosolv;
-	int nord=20;			//order of integration
-	double uplim,lolim;		//upper and lower integration limits
-	double summ,yyy,answer,Vpoly;			//running tally of integration
-	double Pi,AR,Rsqrsumm,Rsqryyy,Rsqr;
-		
-	Pi = 4.0*atan(1.0);
-	
-	summ = 0.0;			//initialize intergral
-	Rsqrsumm = 0.0;
-	
-	scale = dp[0];
-	radius = dp[1];
-	sigma = dp[2];				//sigma is the standard mean deviation
-	length = dp[3];
-	radthick = dp[4];
-	facthick= dp[5];
-	rhoc = dp[6];
-	rhos = dp[7];
-	rhosolv = dp[8];
-	bkg = dp[9];
-	
-	lolim = exp(log(radius)-(4.*sigma));
-	if (lolim<0.0) {
-		lolim=0.0;		//to avoid numerical error when  va<0 (-ve r value)
-	}
-	uplim = exp(log(radius)+(4.*sigma));
-	
-	for(i=0;i<nord;i++) {
-		rad = ( Gauss20Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		AR=(1.0/(rad*sigma*sqrt(2.0*Pi)))*exp(-(0.5*((log(radius/rad))/sigma)*((log(radius/rad))/sigma)));
-		yyy = AR* Gauss20Wt[i] * CSCylIntegration(q,rad,radthick,facthick,rhoc,rhos,rhosolv,length);
-		Rsqryyy= Gauss20Wt[i] * AR * (rad+radthick)*(rad+radthick);		//SRK normalize to total dimensions
-		summ += yyy;
-		Rsqrsumm += Rsqryyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	Rsqr = (uplim-lolim)/2.0*Rsqrsumm;
-	//normalize by average cylinder volume
-	Vpoly = Pi*Rsqr*(length+2*facthick);
-	answer /= Vpoly;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	OblateFormX  :  calculates the form factor of a core-shell Oblate ellipsoid at the given x-value p->x
-the ellipsoid has a core-shell structure
-
-*/
-double
-OblateForm(double dp[], double q)
-{
-	int i;
-	double scale,crmaj,crmin,trmaj,trmin,delpc,delps,bkg;
-	int nord=76;			//order of integration
-	double uplim,lolim;		//upper and lower integration limits
-	double summ,zi,yyy,answer,oblatevol;			//running tally of integration
-	double Pi,sldc,slds,sld;
-	
-	Pi = 4.0*atan(1.0);
-	
-	lolim = 0.0;
-	uplim = 1.0;
-	
-	summ = 0.0;			//initialize intergral
-	
-	
-	scale = dp[0];		//make local copies in case memory moves
-	crmaj = dp[1];
-	crmin = dp[2];
-	trmaj = dp[3];
-	trmin = dp[4];
-	sldc = dp[5];
-	slds = dp[6];
-	sld = dp[7];
-	delpc = sldc - slds;	//core - shell
-	delps = slds - sld;		//shell - solvent
-	bkg = dp[8];
-
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss76Wt[i] * gfn4(zi,crmaj,crmin,trmaj,trmin,delpc,delps,q);
-		summ += yyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	// normalize by particle volume
-	oblatevol = 4.0*Pi/3.0*trmaj*trmaj*trmin;
-	answer /= oblatevol;
-	
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	ProlateFormX  :  calculates the form factor of a core-shell Prolate ellipsoid at the given x-value p->x
-the ellipsoid has a core-shell structure
-
-*/
-double
-ProlateForm(double dp[], double q)
-{
-	int i;
-	double scale,crmaj,crmin,trmaj,trmin,delpc,delps,bkg;
-	int nord=76;			//order of integration
-	double uplim,lolim;		//upper and lower integration limits
-	double summ,zi,yyy,answer,prolatevol;			//running tally of integration
-	double Pi,sldc,slds,sld;
-	
-	Pi = 4.0*atan(1.0);
-	
-	lolim = 0.0;
-	uplim = 1.0;
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];		//make local copies in case memory moves
-	crmaj = dp[1];
-	crmin = dp[2];
-	trmaj = dp[3];
-	trmin = dp[4];
-	sldc = dp[5];
-	slds = dp[6];
-	sld = dp[7];
-	delpc = sldc - slds;		//core - shell
-	delps = slds - sld;		//shell  - sovent
-	bkg = dp[8];
-
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss76Wt[i] * gfn2(zi,crmaj,crmin,trmaj,trmin,delpc,delps,q);
-		summ += yyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	// normalize by particle volume
-	prolatevol = 4.0*Pi/3.0*trmaj*trmin*trmin;
-	answer /= prolatevol;
-	
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-
-/*	StackedDiscsX  :  calculates the form factor of a stacked "tactoid" of core shell disks
-like clay platelets that are not exfoliated
-
-*/
-double
-StackedDiscs(double dp[], double q)
-{
-	int i;
-	double scale,length,bkg,rcore,thick,rhoc,rhol,rhosolv,N,gsd;		//local variables of coefficient wave
-	double va,vb,vcyl,summ,yyy,zi,halfheight,d,answer;
-	int nord=76;			//order of integration
-	double Pi;
-	
-	
-	Pi = 4.0*atan(1.0);
-	
-	va = 0.0;
-	vb = Pi/2.0;
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];
-	rcore = dp[1];
-	length = dp[2];
-	thick = dp[3];
-	rhoc = dp[4];
-	rhol = dp[5];
-	rhosolv = dp[6];
-	N = dp[7];
-	gsd = dp[8];
-	bkg = dp[9];
-	
-	d=2.0*thick+length;
-	halfheight = length/2.0;
-	
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(vb-va) + vb + va )/2.0;
-		yyy = Gauss76Wt[i] * Stackdisc_kern(q, rcore, rhoc,rhol,rhosolv, halfheight,thick,zi,gsd,d,N);
-		summ += yyy;
-	}
-	
-	answer = (vb-va)/2.0*summ;
-	// length is the total core length 
-	vcyl=Pi*rcore*rcore*(2.0*thick+length)*N;
-	answer /= vcyl;
-	//Convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-
-/*	LamellarFFX  :  calculates the form factor of a lamellar structure - no S(q) effects included
-
-*/
-double
-LamellarFF(double dp[], double q)
-{
-	double scale,del,sig,contr,bkg;		//local variables of coefficient wave
-	double inten, qval,Pq;
-	double Pi,sldb,sld;
-	
-	
-	Pi = 4.0*atan(1.0);
-	scale = dp[0];
-	del = dp[1];
-	sig = dp[2]*del;
-	sldb = dp[3];
-	sld = dp[4];
-	contr = sldb - sld;
-	bkg = dp[5];
-	qval=q;
-	
-	Pq = 2.0*contr*contr/qval/qval*(1.0-cos(qval*del)*exp(-0.5*qval*qval*sig*sig));
-	
-	inten = 2.0*Pi*scale*Pq/(qval*qval);		//this is now dimensionless...
-	
-	inten /= del;			//normalize by the thickness (in A)
-	
-	inten *= 1.0e8;		// 1/A to 1/cm
-	
-	return(inten+bkg);
-}
-
-/*	LamellarPSX  :  calculates the form factor of a lamellar structure - with S(q) effects included
---- now the proper resolution effects are used - the "default" resolution is turned off (= 0) and the
-model is smeared just like any other function
-*/
-double
-LamellarPS(double dp[], double q)
-{
-	double scale,dd,del,sig,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,sldb,sld;
-	int ii,NNint;
-//	char buf[256];
-
-	
-	Euler = 0.5772156649;		// Euler's constant
-//	dQDefault = 0.0025;		//[=] 1/A, q-resolution, default value
-	dQDefault = 0.0;
-	dQ = dQDefault;
-	
-	Pi = 4.0*atan(1.0);
-	qval = q;
-	
-	scale = dp[0];
-	dd = dp[1];
-	del = dp[2];
-	sig = dp[3]*del;
-	sldb = dp[4];
-	sld = dp[5];
-	contr = sldb - sld;
-	NN = trunc(dp[6]);		//be sure that NN is an integer
-	Cp = dp[7];
-	bkg = dp[8];
-	
-	Pq = 2.0*contr*contr/qval/qval*(1.0-cos(qval*del)*exp(-0.5*qval*qval*sig*sig));
-	
-	NNint = (int)NN;		//cast to an integer for the loop
-	
-//	sprintf(buf, "qval = %g\r", qval);
-//	XOPNotice(buf);
-	
-	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*fii) + Euler);
-		t1 = 2.0*dQ*dQ*dd*dd*alpha;
-		t2 = 2.0*qval*qval*dd*dd*alpha;
-		t3 = dQ*dQ*dd*dd*fii*fii;
-		
-		temp = 1.0-fii/NN;
-		temp *= cos(dd*qval*fii/(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);
-}
-
-
-/*	LamellarPS_HGX  :  calculates the form factor of a lamellar structure - with S(q) effects included
---- now the proper resolution effects are used - the "default" resolution is turned off (= 0) and the
-model is smeared just like any other function
-*/
-double
-LamellarPS_HG(double dp[], double q)
-{
-	double scale,dd,delT,delH,SLD_T,SLD_H,SLD_S,NN,Cp,bkg;		//local variables of coefficient wave
-	double inten,qval,Pq,Sq,alpha,temp,t1,t2,t3,dQ,drh,drt;
-	double Pi,Euler,dQDefault,fii;
-	int ii,NNint;
-	
-	
-	Euler = 0.5772156649;		// Euler's constant
-//	dQDefault = 0.0025;		//[=] 1/A, q-resolution, default value
-	dQDefault = 0.0;
-	dQ = dQDefault;
-	
-	Pi = 4.0*atan(1.0);
-	qval= q;
-	
-	scale = dp[0];
-	dd = dp[1];
-	delT = dp[2];
-	delH = dp[3];
-	SLD_T = dp[4];
-	SLD_H = dp[5];
-	SLD_S = dp[6];
-	NN = trunc(dp[7]);		//be sure that NN is an integer
-	Cp = dp[8];
-	bkg = dp[9];
-	
-	
-	drh = SLD_H - SLD_S;
-	drt = SLD_T - SLD_S;	//correction 13FEB06 by L.Porcar
-	
-	Pq = drh*(sin(qval*(delH+delT))-sin(qval*delT)) + drt*sin(qval*delT);
-	Pq *= Pq;
-	Pq *= 4.0/(qval*qval);
-	
-	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);
-}
-
-/*	LamellarFF_HGX  :  calculates the form factor of a lamellar structure - no S(q) effects included
-but extra SLD for head groups is included
-
-*/
-double
-LamellarFF_HG(double dp[], double q)
-{
-	double scale,delT,delH,slds,sldh,sldt,bkg;		//local variables of coefficient wave
-	double inten, qval,Pq,drh,drt;
-	double Pi;
-	
-	
-	Pi = 4.0*atan(1.0);
-	qval= q;
-	scale = dp[0];
-	delT = dp[1];
-	delH = dp[2];
-	sldt = dp[3];
-	sldh = dp[4];
-	slds = dp[5];
-	bkg = dp[6];
-	
-	
-	drh = sldh - slds;
-	drt = sldt - slds;		//correction 13FEB06 by L.Porcar
-	
-	Pq = drh*(sin(qval*(delH+delT))-sin(qval*delT)) + drt*sin(qval*delT);
-	Pq *= Pq;
-	Pq *= 4.0/(qval*qval);
-	
-	inten = 2.0*Pi*scale*Pq/(qval*qval);		//dimensionless...
-	
-	inten /= 2.0*(delT+delH);			//normalize by the bilayer thickness
-	
-	inten *= 1.0e8;		// 1/A to 1/cm
-	
-	return(inten+bkg);
-}
-
-/*	FlexExclVolCylX  :  calculates the form factor of a flexible cylinder with a circular cross section
--- incorporates Wei-Ren Chen's fixes - 2006
-
-	*/
-double
-FlexExclVolCyl(double dp[], double q)
-{
-	double scale,L,B,bkg,rad,qr,cont,sldc,slds;
-	double Pi,flex,crossSect,answer;
-	
-	
-	Pi = 4.0*atan(1.0);
-	
-	scale = dp[0];		//make local copies in case memory moves
-	L = dp[1];
-	B = dp[2];
-	rad = dp[3];
-	sldc = dp[4];
-	slds = dp[5];
-	cont = sldc-slds;
-	bkg = dp[6];
-	
-    
-	qr = q*rad;
-	
-	flex = Sk_WR(q,L,B);
-	
-	crossSect = (2.0*NR_BessJ1(qr)/qr)*(2.0*NR_BessJ1(qr)/qr);
-	flex *= crossSect;
-	flex *= Pi*rad*rad*L;
-	flex *= cont*cont;
-	flex *= 1.0e8;
-	answer = scale*flex + bkg;
-	
-	return answer;
-}
-
-/*	FlexCyl_EllipX  :  calculates the form factor of a flexible cylinder with an elliptical cross section
--- incorporates Wei-Ren Chen's fixes - 2006
-
-	*/
-double
-FlexCyl_Ellip(double dp[], double q)
-{
-	double scale,L,B,bkg,rad,qr,cont,ellRatio,slds,sldc;
-	double Pi,flex,crossSect,answer;
-	
-	
-	Pi = 4.0*atan(1.0);
-	scale = dp[0];		//make local copies in case memory moves
-	L = dp[1];
-	B = dp[2];
-	rad = dp[3];
-	ellRatio = dp[4];
-	sldc = dp[5];
-	slds = dp[6];
-	bkg = dp[7];
-	
-	cont = sldc - slds;
-	qr = q*rad;
-	
-	flex = Sk_WR(q,L,B);
-	
-	crossSect = EllipticalCross_fn(q,rad,(rad*ellRatio));
-	flex *= crossSect;
-	flex *= Pi*rad*rad*ellRatio*L;
-	flex *= cont*cont;
-	flex *= 1.0e8;
-	answer = scale*flex + bkg;
-	
-	return answer;
-}
-
-double
-EllipticalCross_fn(double qq, double a, double b)
-{
-    double uplim,lolim,Pi,summ,arg,zi,yyy,answer;
-    int i,nord=76;
-    
-    Pi = 4.0*atan(1.0);
-    lolim=0.0;
-    uplim=Pi/2.0;
-    summ=0.0;
-    
-    for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		arg = qq*sqrt(a*a*sin(zi)*sin(zi)+b*b*cos(zi)*cos(zi));
-		yyy = pow((2.0 * NR_BessJ1(arg) / arg),2);
-		yyy *= Gauss76Wt[i];
-		summ += yyy;
-    }
-    answer = (uplim-lolim)/2.0*summ;
-    answer *= 2.0/Pi;
-    return(answer);
-	
-}
-/*	FlexCyl_PolyLenX  :  calculates the form factor of a flecible cylinder at the given x-value p->x
-the cylinder has a polydisperse Length
-
-*/
-double
-FlexCyl_PolyLen(double dp[], double q)
-{
-	int i;
-	double scale,radius,length,pd,bkg,lb,delrho,sldc,slds;		//local variables of coefficient wave
-	int nord=20;			//order of integration
-	double uplim,lolim;		//upper and lower integration limits
-	double summ,zi,yyy,answer,Vpoly;			//running tally of integration
-	double range,zz,Pi;
-	
-	Pi = 4.0*atan(1.0);
-	range = 3.4;
-	
-	summ = 0.0;			//initialize intergral
-	scale = dp[0];			//make local copies in case memory moves
-	length = dp[1];			//radius
-	pd = dp[2];			// average length
-	lb = dp[3];
-	radius = dp[4];
-	sldc = dp[5];
-	slds = dp[6];
-	bkg = dp[7];
-	
-	delrho = sldc - slds;
-	zz = (1.0/pd)*(1.0/pd) - 1.0;
-	
-	lolim = length*(1.0-range*pd);		//set the upper/lower limits to cover the distribution
-	if(lolim<0.0) {
-		lolim = 0.0;
-	}
-	if(pd>0.3) {
-		range = 3.4 + (pd-0.3)*18.0;
-	}
-	uplim = length*(1.0+range*pd);
-	
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss20Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss20Wt[i] * FlePolyLen_kernel(q,radius,length,lb,zz,delrho,zi);
-		summ += yyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	//normalize by average cylinder volume (first moment), using the average length
-	Vpoly=Pi*radius*radius*length;
-	answer /= Vpoly;
-	
-	answer *=delrho*delrho;
-	
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-/*	FlexCyl_PolyLenX  :  calculates the form factor of a flexible cylinder at the given x-value p->x
-the cylinder has a polydisperse cross sectional radius
-
-*/
-double
-FlexCyl_PolyRad(double dp[], double q)
-{
-	int i;
-	double scale,radius,length,pd,delrho,bkg,lb,sldc,slds;		//local variables of coefficient wave
-	int nord=76;			//order of integration
-	double uplim,lolim;		//upper and lower integration limits
-	double summ,zi,yyy,answer,Vpoly;			//running tally of integration
-	double range,zz,Pi;
-	
-	
-	Pi = 4.0*atan(1.0);
-	range = 3.4;
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];			//make local copies in case memory moves
-	length = dp[1];			//radius
-	lb = dp[2];			// average length
-	radius = dp[3];
-	pd = dp[4];
-	sldc = dp[5];
-	slds = dp[6];
-	bkg = dp[7];
-	
-	delrho = sldc-slds;
-	zz = (1.0/pd)*(1.0/pd) - 1.0;
-	
-	lolim = radius*(1.0-range*pd);		//set the upper/lower limits to cover the distribution
-	if(lolim<0.0) {
-		lolim = 0.0;
-	}
-	if(pd>0.3) {
-		range = 3.4 + (pd-0.3)*18.0;
-	}
-	uplim = radius*(1.0+range*pd);
-	
-	for(i=0;i<nord;i++) {
-		//zi = ( Gauss20Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		//yyy = Gauss20Wt[i] * FlePolyRad_kernel(q,radius,length,lb,zz,delrho,zi);
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss76Wt[i] * FlePolyRad_kernel(q,radius,length,lb,zz,delrho,zi);
-		summ += yyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	//normalize by average cylinder volume (second moment), using the average radius
-	Vpoly = Pi*radius*radius*length*(zz+2.0)/(zz+1.0);
-	answer /= Vpoly;
-	
-	answer *=delrho*delrho;
-	
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
-
-
-///////////////
-
-//
-//     FUNCTION gfn2:    CONTAINS F(Q,A,B,mu)**2  AS GIVEN
-//                       BY (53) AND (56,57) IN CHEN AND 
-//                       KOTLARCHYK REFERENCE
-//
-//     <PROLATE ELLIPSOIDS>
-//
-double
-gfn2(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq)
-{
-	// local variables
-	double aa,bb,u2,ut2,uq,ut,vc,vt,siq,sit,gfnc,gfnt,gfn2,pi43,gfn,Pi;
-
-	Pi = 4.0*atan(1.0);
-	
-	pi43=4.0/3.0*Pi;
-	aa = crmaj;
-	bb = crmin;
-	u2 = (aa*aa*xx*xx + bb*bb*(1.0-xx*xx));
-	ut2 = (trmaj*trmaj*xx*xx + trmin*trmin*(1.0-xx*xx));
-	uq = sqrt(u2)*qq;
-	ut= sqrt(ut2)*qq;
-	vc = pi43*aa*bb*bb;
-	vt = pi43*trmaj*trmin*trmin;
-   	if (uq == 0.0){
-   		siq = 1.0/3.0;
-   	}else{
-   		siq = (sin(uq)/uq/uq - cos(uq)/uq)/uq;
-   	}
-   	if (ut == 0.0){
-   		sit = 1.0/3.0;
-   	}else{
-   		sit = (sin(ut)/ut/ut - cos(ut)/ut)/ut;
-   	}
-	gfnc = 3.0*siq*vc*delpc;
-	gfnt = 3.0*sit*vt*delps;
-	gfn = gfnc+gfnt;
-	gfn2 = gfn*gfn;
-	
-	return (gfn2);
-}
-
-//
-//     FUNCTION gfn4:    CONTAINS F(Q,A,B,MU)**2  AS GIVEN
-//                       BY (53) & (58-59) IN CHEN AND
-//                       KOTLARCHYK REFERENCE
-//
-//       <OBLATE ELLIPSOID>
-// function gfn4 for oblate ellipsoids 
-double
-gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq)
-{
-	// local variables
-	double aa,bb,u2,ut2,uq,ut,vc,vt,siq,sit,gfnc,gfnt,tgfn,gfn4,pi43,Pi;
-
-	Pi = 4.0*atan(1.0);
-	pi43=4.0/3.0*Pi;
-  	aa = crmaj;
- 	bb = crmin;
- 	u2 = (bb*bb*xx*xx + aa*aa*(1.0-xx*xx));
- 	ut2 = (trmin*trmin*xx*xx + trmaj*trmaj*(1.0-xx*xx));
-   	uq = sqrt(u2)*qq;
- 	ut= sqrt(ut2)*qq;
-	vc = pi43*aa*aa*bb;
-   	vt = pi43*trmaj*trmaj*trmin;
-   	if (uq == 0.0){
-   		siq = 1.0/3.0;
-   	}else{
-   		siq = (sin(uq)/uq/uq - cos(uq)/uq)/uq;
-   	}
-   	if (ut == 0.0){
-   		sit = 1.0/3.0;
-   	}else{
-   		sit = (sin(ut)/ut/ut - cos(ut)/ut)/ut;
-   	}
-   	gfnc = 3.0*siq*vc*delpc;
-  	gfnt = 3.0*sit*vt*delps;
-  	tgfn = gfnc+gfnt;
-  	gfn4 = tgfn*tgfn;
-  	
-  	return (gfn4);
-}
-
-double
-FlePolyLen_kernel(double q, double radius, double length, double lb, double zz, double delrho, double zi)
-{
-    double Pq,vcyl,dl;
-    double Pi,qr;
-    
-    Pi = 4.0*atan(1.0);
-    qr = q*radius;
-    
-    Pq = Sk_WR(q,zi,lb);		//does not have cross section term
-    if (qr !=0){
-    	Pq *= (2.0*NR_BessJ1(qr)/qr)*(2.0*NR_BessJ1(qr)/qr);
-    } 
-    vcyl=Pi*radius*radius*zi;
-    Pq *= vcyl*vcyl;
-    
-    dl = SchulzPoint_cpr(zi,length,zz);
-    return (Pq*dl);	
-	
-}
-
-double
-FlePolyRad_kernel(double q, double ravg, double Lc, double Lb, double zz, double delrho, double zi)
-{
-    double Pq,vcyl,dr;
-    double Pi,qr;
-    
-    Pi = 4.0*atan(1.0);
-    qr = q*zi;
-    
-    Pq = Sk_WR(q,Lc,Lb);		//does not have cross section term
-    if (qr !=0){
-    	Pq *= (2.0*NR_BessJ1(qr)/qr)*(2.0*NR_BessJ1(qr)/qr);
-    }
-
-    vcyl=Pi*zi*zi*Lc;
-    Pq *= vcyl*vcyl;
-    
-    dr = SchulzPoint_cpr(zi,ravg,zz);
-    return (Pq*dr);	
-	
-}
-
-double
-CSCylIntegration(double qq, double rad, double radthick, double facthick, double rhoc, double rhos, double rhosolv, double length)
-{
-	double answer,halfheight,Pi;
-	double lolim,uplim,summ,yyy,zi;
-	int nord,i;
-	
-	// set up the integration end points 
-	Pi = 4.0*atan(1.0);
-	nord = 76;
-	lolim = 0.0;
-	uplim = Pi/2.0;
-	halfheight = length/2.0;
-	
-	summ = 0.0;				// initialize integral
-	i=0;
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss76Wt[i] * CScyl(qq, rad, radthick, facthick, rhoc,rhos,rhosolv, halfheight, zi);
-		summ += yyy;
-	}
-	
-	// calculate value of integral to return
-	answer = (uplim-lolim)/2.0*summ;
-	return (answer);
-}
-
-double
-CScyl(double qq, double rad, double radthick, double facthick, double rhoc, double rhos, double rhosolv, double length, double dum)
-{	
-	// qq is the q-value for the calculation (1/A)
-	// radius is the core radius of the cylinder (A)
-	//  radthick and facthick are the radial and face layer thicknesses
-	// rho(n) are the respective SLD's
-	// length is the *Half* CORE-LENGTH of the cylinder 
-	// dum is the dummy variable for the integration (theta)
-
-	double dr1,dr2,besarg1,besarg2,vol1,vol2,sinarg1,sinarg2,si1,si2,be1,be2,t1,t2,retval;
-	double Pi;
-	
-	Pi = 4.0*atan(1.0); 
-	
-	dr1 = rhoc-rhos;
-	dr2 = rhos-rhosolv;
-	vol1 = Pi*rad*rad*(2.0*length);
-	vol2 = Pi*(rad+radthick)*(rad+radthick)*(2.0*length+2.0*facthick);
-	
-	besarg1 = qq*rad*sin(dum);
-	besarg2 = qq*(rad+radthick)*sin(dum);
-	sinarg1 = qq*length*cos(dum);
-	sinarg2 = qq*(length+facthick)*cos(dum);
-	if (besarg1 == 0.0){
-		be1 = 0.5;
-	}else{
-		be1 = NR_BessJ1(besarg1)/besarg1;
-	}
-	if (besarg2 == 0.0){
-		be2 = 0.5;
-	}else{
-		be2 = NR_BessJ1(besarg2)/besarg2;
-	}
-	if (sinarg1 == 0.0){
-		si1 = 1.0;
-	}else{
-		si1 = sin(sinarg1)/sinarg1;
-	}
-	if (sinarg2 == 0.0){
-		si2 = 1.0;
-	}else{
-		si2 = sin(sinarg2)/sinarg2;
-	}
-
-	t1 = 2.0*vol1*dr1*si1*be1;
-	t2 = 2.0*vol2*dr2*si2*be2;
-
-	retval = ((t1+t2)*(t1+t2))*sin(dum);
-	return (retval);
-    
-}
-
-
-double
-CoreShellCylKernel(double qq, double rcore, double thick, double rhoc, double rhos, double rhosolv, double length, double dum)
-{
-
-    double dr1,dr2,besarg1,besarg2,vol1,vol2,sinarg1,sinarg2,si1,si2,be1,be2,t1,t2,retval;
-    double Pi;
-    
-    Pi = 4.0*atan(1.0);
-    
-    dr1 = rhoc-rhos;
-    dr2 = rhos-rhosolv;
-    vol1 = Pi*rcore*rcore*(2.0*length);
-    vol2 = Pi*(rcore+thick)*(rcore+thick)*(2.0*length+2.0*thick);
-    
-    besarg1 = qq*rcore*sin(dum);
-    besarg2 = qq*(rcore+thick)*sin(dum);
-    sinarg1 = qq*length*cos(dum);
-    sinarg2 = qq*(length+thick)*cos(dum);
-
-	if (besarg1 == 0.0){
-		be1 = 0.5;
-	}else{
-		be1 = NR_BessJ1(besarg1)/besarg1;
-	}
-	if (besarg2 == 0.0){
-		be2 = 0.5;
-	}else{
-		be2 = NR_BessJ1(besarg2)/besarg2;
-	}
-	if (sinarg1 == 0.0){
-		si1 = 1.0;
-	}else{
-		si1 = sin(sinarg1)/sinarg1;
-	}
-	if (sinarg2 == 0.0){
-		si2 = 1.0;
-	}else{
-		si2 = sin(sinarg2)/sinarg2;
-	}
-
-    t1 = 2.0*vol1*dr1*si1*be1;
-    t2 = 2.0*vol2*dr2*si2*be2;
-
-    retval = ((t1+t2)*(t1+t2))*sin(dum);
-	
-    return (retval);
-}
-
-double
-Cyl_PolyLenKernel(double q, double radius, double len_avg, double zz, double delrho, double dumLen)
-{
-	
-    double halfheight,uplim,lolim,zi,summ,yyy,Pi;
-    double answer,dr,Vcyl;
-    int i,nord;
-    
-    Pi = 4.0*atan(1.0);
-    lolim = 0.0;
-    uplim = Pi/2.0;
-    halfheight = dumLen/2.0;
-    nord=20;
-    summ = 0.0;
-    
-    //do the cylinder orientational average
-    for(i=0;i<nord;i++) {
-		zi = ( Gauss20Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss20Wt[i] * CylKernel(q, radius, halfheight, zi);
-		summ += yyy;
-    }
-    answer = (uplim-lolim)/2.0*summ;
-    // Multiply by contrast^2
-    answer *= delrho*delrho;
-    // don't do the normal scaling to volume here
-    // instead, multiply by VCyl^2 to get rid of the normalization for this radius of cylinder
-    Vcyl = Pi*radius*radius*dumLen;
-    answer *= Vcyl*Vcyl;
-    
-    dr = SchulzPoint_cpr(dumLen,len_avg,zz);
-    return(dr*answer);
-}
-
-
-double
-Stackdisc_kern(double qq, double rcore, double rhoc, double rhol, double rhosolv, double length, double thick, double dum, double gsd, double d, double N)
-{         	
-	// qq is the q-value for the calculation (1/A)
-	// rcore is the core radius of the cylinder (A)
-	// rho(n) are the respective SLD's
-	// length is the *Half* CORE-LENGTH of the cylinder = L (A)
-	// dum is the dummy variable for the integration (x in Feigin's notation)
-
-	//Local variables
-	double totald,dr1,dr2,besarg1,besarg2,be1,be2,si1,si2,area,sinarg1,sinarg2,t1,t2,retval,sqq,dexpt;
-	double Pi;
-	int kk;
-	
-	Pi = 4.0*atan(1.0);
-	
-	dr1 = rhoc-rhosolv;
-	dr2 = rhol-rhosolv;
-	area = Pi*rcore*rcore;
-	totald=2.0*(thick+length);
-	
-	besarg1 = qq*rcore*sin(dum);
-	besarg2 = qq*rcore*sin(dum);
-	
-	sinarg1 = qq*length*cos(dum);
-	sinarg2 = qq*(length+thick)*cos(dum);
-
-	if (besarg1 == 0.0){
-		be1 = 0.5;
-	}else{
-		be1 = NR_BessJ1(besarg1)/besarg1;
-	}
-	if (besarg2 == 0.0){
-		be2 = 0.5;
-	}else{
-		be2 = NR_BessJ1(besarg2)/besarg2;
-	}
-	if (sinarg1 == 0.0){
-		si1 = 1.0;
-	}else{
-		si1 = sin(sinarg1)/sinarg1;
-	}
-	if (sinarg2 == 0.0){
-		si2 = 1.0;
-	}else{
-		si2 = sin(sinarg2)/sinarg2;
-	}
-
-	t1 = 2.0*area*(2.0*length)*dr1*(si1)*(be1);
-	t2 = 2.0*area*dr2*(totald*si2-2.0*length*si1)*(be2);
-
-	retval =((t1+t2)*(t1+t2))*sin(dum);
-	
-	// loop for the structure facture S(q)
-	sqq=0.0;
-	for(kk=1;kk<N;kk+=1) {
-		dexpt=qq*cos(dum)*qq*cos(dum)*d*d*gsd*gsd*kk/2.0;
-		sqq=sqq+(N-kk)*cos(qq*cos(dum)*d*kk)*exp(-1.*dexpt);
-	}			
-	
-	// end of loop for S(q)
-	sqq=1.0+2.0*sqq/N;
-	retval *= sqq;
-    
-	return(retval);
-}
-
-
-double
-Cyl_PolyRadKernel(double q, double radius, double length, double zz, double delrho, double dumRad)
-{
-	
-    double halfheight,uplim,lolim,zi,summ,yyy,Pi;
-    double answer,dr,Vcyl;
-    int i,nord;
-    
-    Pi = 4.0*atan(1.0);
-    lolim = 0.0;
-    uplim = Pi/2.0;
-    halfheight = length/2.0;
-	//    nord=20;
-    nord=76;
-    summ = 0.0;
-    
-    //do the cylinder orientational average
-	//    for(i=0;i<nord;i++) {
-	//            zi = ( Gauss20Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-	//            yyy = Gauss20Wt[i] * CylKernel(q, dumRad, halfheight, zi);
-	//            summ += yyy;
-	//    }
-    for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss76Wt[i] * CylKernel(q, dumRad, halfheight, zi);
-		summ += yyy;
-    }
-    answer = (uplim-lolim)/2.0*summ;
-    // Multiply by contrast^2
-    answer *= delrho*delrho;
-    // don't do the normal scaling to volume here
-    // instead, multiply by VCyl^2 to get rid of the normalization for this radius of cylinder
-    Vcyl = Pi*dumRad*dumRad*length;
-    answer *= Vcyl*Vcyl;
-    
-    dr = SchulzPoint_cpr(dumRad,radius,zz);
-    return(dr*answer);
-}
-
-double
-SchulzPoint_cpr(double dumRad, double radius, double zz)
-{
-    double dr;
-    
-    dr = zz*log(dumRad) - gammaln(zz+1.0) + (zz+1.0)*log((zz+1.0)/radius)-(dumRad/radius*(zz+1.0));
-    return(exp(dr));
-}
-
-
-double
-EllipsoidKernel(double qq, double a, double nua, double dum)
-{
-    double arg,nu,retval;		//local variables
-	
-    nu = nua/a;
-    arg = qq*a*sqrt(1.0+dum*dum*(nu*nu-1.0));
-    if (arg == 0.0){
-    	retval =1.0/3.0;
-    }else{
-    	retval = (sin(arg)-arg*cos(arg))/(arg*arg*arg);
-    }
-    retval *= retval;
-    retval *= 9.0;
-
-    return(retval);
-}//Function EllipsoidKernel()
-
-double
-HolCylKernel(double qq, double rcore, double rshell, double length, double dum)
-{
-    double gamma,arg1,arg2,lam1,lam2,psi,sinarg,t2,retval;		//local variables
-    
-    gamma = rcore/rshell;
-    arg1 = qq*rshell*sqrt(1.0-dum*dum);		//1=shell (outer radius)
-    arg2 = qq*rcore*sqrt(1.0-dum*dum);			//2=core (inner radius)
-    if (arg1 == 0.0){
-    	lam1 = 1.0;
-    }else{
-    	lam1 = 2.0*NR_BessJ1(arg1)/arg1;
-    }
-    if (arg2 == 0.0){
-    	lam2 = 1.0;
-    }else{
-    	lam2 = 2.0*NR_BessJ1(arg2)/arg2;
-    }
-    //Todo: Need to check psi behavior as gamma goes to 1.
-    psi = 1.0/(1.0-gamma*gamma)*(lam1 -  gamma*gamma*lam2);		//SRK 10/19/00
-    sinarg = qq*length*dum/2.0;
-    if (sinarg == 0.0){
-    	t2 = 1.0;
-    }else{
-    	t2 = sin(sinarg)/sinarg;
-    }
-
-    retval = psi*psi*t2*t2;
-    
-    return(retval);
-}//Function HolCylKernel()
-
-double
-PPKernel(double aa, double mu, double uu)
-{
-    // mu passed in is really mu*sqrt(1-sig^2)
-    double arg1,arg2,Pi,tmp1,tmp2;			//local variables
-	
-    Pi = 4.0*atan(1.0);
-    
-    //handle arg=0 separately, as sin(t)/t -> 1 as t->0
-    arg1 = (mu/2.0)*cos(Pi*uu/2.0);
-    arg2 = (mu*aa/2.0)*sin(Pi*uu/2.0);
-    if(arg1==0.0) {
-		tmp1 = 1.0;
-	} else {
-		tmp1 = sin(arg1)*sin(arg1)/arg1/arg1;
-    }
-
-    if (arg2==0.0) {
-		tmp2 = 1.0;
-	} else {
-		tmp2 = sin(arg2)*sin(arg2)/arg2/arg2;
-    }
-	
-    return (tmp1*tmp2);
-	
-}//Function PPKernel()
-
-
-double
-TriaxialKernel(double q, double aa, double bb, double cc, double dx, double dy)
-{
-	
-    double arg,val,pi;			//local variables
-	
-    pi = 4.0*atan(1.0);
-    
-    arg = aa*aa*cos(pi*dx/2)*cos(pi*dx/2);
-    arg += bb*bb*sin(pi*dx/2)*sin(pi*dx/2)*(1-dy*dy);
-    arg += cc*cc*dy*dy;
-    arg = q*sqrt(arg);
-    if (arg == 0.0){
-    	val = 1.0; // as arg --> 0, val should go to 1.0
-    }else{
-    	val = 9.0 * ( (sin(arg) - arg*cos(arg))/(arg*arg*arg) ) * ( (sin(arg) - arg*cos(arg))/(arg*arg*arg) );
-    }
-    return (val);
-	
-}//Function TriaxialKernel()
-
-
-double
-CylKernel(double qq, double rr,double h, double theta)
-{
-	
-	// qq is the q-value for the calculation (1/A)
-	// rr is the radius of the cylinder (A)
-	// h is the HALF-LENGTH of the cylinder = L/2 (A)
-
-    double besarg,bj,retval,d1,t1,b1,t2,b2,siarg,be,si;		 //Local variables
-
-
-    besarg = qq*rr*sin(theta);
-    siarg = qq * h * cos(theta);
-    bj =NR_BessJ1(besarg);
-	
-	//* Computing 2nd power */
-    d1 = sin(siarg);
-    t1 = d1 * d1;
-	//* Computing 2nd power */
-    d1 = bj;
-    t2 = d1 * d1 * 4.0 * sin(theta);
-	//* Computing 2nd power */
-    d1 = siarg;
-    b1 = d1 * d1;
-	//* Computing 2nd power */
-    d1 = qq * rr * sin(theta);
-    b2 = d1 * d1;
-    if (besarg == 0.0){
-    	be = sin(theta);
-    }else{
-    	be = t2 / b2;
-    }
-    if (siarg == 0.0){
-    	si = 1.0;
-    }else{
-    	si = t1 / b1;
-    }
-    retval = be * si;
-
-    return (retval);
-	
-}//Function CylKernel()
-
-double
-EllipCylKernel(double qq, double ra,double nu, double theta)
-{
-	//this is the function LAMBDA1^2 in Feigin's notation	
-	// qq is the q-value for the calculation (1/A)
-	// ra is the transformed radius"a" in Feigin's notation
-	// nu is the ratio (major radius)/(minor radius) of the Ellipsoid [=] ---
-	// theta is the dummy variable of the integration
-	
-	double retval,arg;		 //Local variables 
-	
-	arg = qq*ra*sqrt((1.0+nu*nu)/2+(1.0-nu*nu)*cos(theta)/2);
-	if (arg == 0.0){
-		retval = 1.0;
-	}else{
-		retval = 2.0*NR_BessJ1(arg)/arg;
-	}
-
-	//square it
-	retval *= retval;
-	
-    return(retval);
-	
-}//Function EllipCylKernel()
-
-double NR_BessJ1(double x)
-{
-	double ax,z;
-	double xx,y,ans,ans1,ans2;
-	
-	if ((ax=fabs(x)) < 8.0) {
-		y=x*x;
-		ans1=x*(72362614232.0+y*(-7895059235.0+y*(242396853.1
-												  +y*(-2972611.439+y*(15704.48260+y*(-30.16036606))))));
-		ans2=144725228442.0+y*(2300535178.0+y*(18583304.74
-											   +y*(99447.43394+y*(376.9991397+y*1.0))));
-		ans=ans1/ans2;
-	} else {
-		z=8.0/ax;
-		y=z*z;
-		xx=ax-2.356194491;
-		ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4
-								   +y*(0.2457520174e-5+y*(-0.240337019e-6))));
-		ans2=0.04687499995+y*(-0.2002690873e-3
-							  +y*(0.8449199096e-5+y*(-0.88228987e-6
-													 +y*0.105787412e-6)));
-		ans=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2);
-		if (x < 0.0) ans = -ans;
-	}
-	
-	return(ans);
-}
-
-/*	Lamellar_ParaCrystal - Pedersen's model
-
-*/
-double
-Lamellar_ParaCrystal(double w[], double q)
-{
-//	 Input (fitting) variables are:
-	//[0] scale factor
-	//[1]	thickness
-	//[2]	number of layers
-	//[3]	spacing between layers
-	//[4]	polydispersity of spacing
-	//[5] SLD lamellar
-	//[6] SLD solvent
-	//[7] incoherent background
-//	give them nice names
-	double inten,qval,scale,th,nl,davg,pd,contr,bkg,xn;
-	double xi,ww,Pbil,Znq,Snq,an,sldLayer,sldSolvent,pi;
-	long n1,n2;
-	
-	pi = 4.0*atan(1.0);
-	scale = w[0];
-	th = w[1];
-	nl = w[2];
-	davg = w[3];
-	pd = w[4];
-	sldLayer = w[5];
-	sldSolvent = w[6];
-	bkg = w[7];
-	
-	contr = w[5] - w[6];
-	qval = q;
-		
-	//get the fractional part of nl, to determine the "mixing" of N's
-	
-	n1 = trunc(nl);		//rounds towards zero
-	n2 = n1 + 1;
-	xn = (double)n2 - nl;			//fractional contribution of n1
-	
-	ww = exp(-qval*qval*pd*pd*davg*davg/2.0);
-	
-	//calculate the n1 contribution
-	an = paraCryst_an(ww,qval,davg,n1);
-	Snq = paraCryst_sn(ww,qval,davg,n1,an);
-	
-	Znq = xn*Snq;
-	
-	//calculate the n2 contribution
-	an = paraCryst_an(ww,qval,davg,n2);
-	Snq = paraCryst_sn(ww,qval,davg,n2,an);
-	
-	Znq += (1.0-xn)*Snq;
-	
-	//and the independent contribution
-	Znq += (1.0-ww*ww)/(1.0+ww*ww-2.0*ww*cos(qval*davg));
-	
-	//the limit when NL approaches infinity
-//	Zq = (1-ww^2)/(1+ww^2-2*ww*cos(qval*davg))
-	
-	xi = th/2.0;		//use 1/2 the bilayer thickness
-	Pbil = (sin(qval*xi)/(qval*xi))*(sin(qval*xi)/(qval*xi));
-	
-	inten = 2.0*pi*contr*contr*Pbil*Znq/(qval*qval);
-	inten *= 1.0e8;
-	
-	return(scale*inten+bkg);
-}
-
-// functions for the lamellar paracrystal model
-double
-paraCryst_sn(double ww, double qval, double davg, long nl, double an) {
-	
-	double Snq;
-	
-	Snq = an/( (double)nl*pow((1.0+ww*ww-2.0*ww*cos(qval*davg)),2) );
-	
-	return(Snq);
-}
-
-
-double
-paraCryst_an(double ww, double qval, double davg, long nl) {
-	
-	double an;
-	
-	an = 4.0*ww*ww - 2.0*(ww*ww*ww+ww)*cos(qval*davg);
-	an -= 4.0*pow(ww,(nl+2))*cos((double)nl*qval*davg);
-	an += 2.0*pow(ww,(nl+3))*cos((double)(nl-1)*qval*davg);
-	an += 2.0*pow(ww,(nl+1))*cos((double)(nl+1)*qval*davg);
-	
-	return(an);
-}
-
-
-/*	Spherocylinder  :
-
-Uses 76 pt Gaussian quadrature for both integrals
-*/
-double
-Spherocylinder(double w[], double x)
-{
-	int i,j;
-	double Pi;
-	double scale,contr,bkg,sldc,slds;
-	double len,rad,hDist,endRad;
-	int nordi=76;			//order of integration
-	int nordj=76;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	double SphCyl_tmp[7],arg1,arg2,inner,be;
-	
-	
-	scale = w[0];
-	rad = w[1];
-	len = w[2];
-	sldc = w[3];
-	slds = w[4];
-	bkg = w[5];
-	
-	SphCyl_tmp[0] = w[0];
-	SphCyl_tmp[1] = w[1];
-	SphCyl_tmp[2] = w[2];
-	SphCyl_tmp[3] = w[1];		//end radius is same as cylinder radius
-	SphCyl_tmp[4] = w[3];
-	SphCyl_tmp[5] = w[4];
-	SphCyl_tmp[6] = w[5];
-	
-	hDist = 0;		//by definition for this model
-	endRad = rad;
-	
-	contr = sldc-slds;
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = Pi/2.0;		//orintational average, outer integral
-	vaj = -1.0*hDist/endRad;
-	vbj = 1.0;		//endpoints of inner integral
-
-	summ = 0.0;			//initialize intergral
-
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the "theta" dummy
-		
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
-			yyy = Gauss76Wt[j] * SphCyl_kernel(SphCyl_tmp,x,zij,zi);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		inner = (vbj-vaj)/2.0*summj;
-		inner *= 4.0*Pi*endRad*endRad*endRad;
-		
-		//now calculate outer integrand
-		arg1 = x*len/2.0*cos(zi);
-		arg2 = x*rad*sin(zi);
-		yyy = inner;
-
-		if(arg2 == 0) {
-			be = 0.5;
-		} else {
-			be = NR_BessJ1(arg2)/arg2;
-		}
-		
-		if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
-			yyy += Pi*rad*rad*len*2.0*be;
-		} else {
-			yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-		}
-		yyy *= yyy;
-		yyy *= sin(zi);		// = |A(q)|^2*sin(theta)
-		yyy *= Gauss76Wt[i];
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-
-	answer /= Pi*rad*rad*len + Pi*4.0*endRad*endRad*endRad/3.0;		//divide by volume
-	answer *= 1.0e8;		//convert to cm^-1
-	answer *= contr*contr;
-	answer *= scale;
-	answer += bkg;
-		
-	return answer;
-}
-
-
-// inner integral of the sphereocylinder model, special case of hDist = 0
-//
-double
-SphCyl_kernel(double w[], double x, double tt, double theta) {
-
-	double val,arg1,arg2;
-	double scale,bkg,sldc,slds;
-	double len,rad,hDist,endRad,be;
-	scale = w[0];
-	rad = w[1];
-	len = w[2];
-	endRad = w[3];
-	sldc = w[4];
-	slds = w[5];
-	bkg = w[6];
-	
-	hDist = 0.0;
-		
-	arg1 = x*cos(theta)*(endRad*tt+hDist+len/2.0);
-	arg2 = x*endRad*sin(theta)*sqrt(1.0-tt*tt);
-	
-	if(arg2 == 0) {
-		be = 0.5;
-	} else {
-		be = NR_BessJ1(arg2)/arg2;
-	}
-	val = cos(arg1)*(1.0-tt*tt)*be;
-	
-	return(val);
-}
-
-
-/*	Convex Lens  : special case where L ~ 0 and hDist < 0
-
-Uses 76 pt Gaussian quadrature for both integrals
-*/
-double
-ConvexLens(double w[], double x)
-{
-	int i,j;
-	double Pi;
-	double scale,contr,bkg,sldc,slds;
-	double len,rad,hDist,endRad;
-	int nordi=76;			//order of integration
-	int nordj=76;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	double CLens_tmp[7],arg1,arg2,inner,hh,be;
-	
-	
-	scale = w[0];
-	rad = w[1];
-//	len = w[2]
-	endRad = w[2];
-	sldc = w[3];
-	slds = w[4];
-	bkg = w[5];
-	
-	len = 0.01;
-	
-	CLens_tmp[0] = w[0];
-	CLens_tmp[1] = w[1];
-	CLens_tmp[2] = len;			//length is some small number, essentially zero
-	CLens_tmp[3] = w[2];
-	CLens_tmp[4] = w[3];
-	CLens_tmp[5] = w[4];
-	CLens_tmp[6] = w[5];
-		
-	hDist = -1.0*sqrt(fabs(endRad*endRad-rad*rad));		//by definition for this model
-	
-	contr = sldc-slds;
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = Pi/2.0;		//orintational average, outer integral
-	vaj = -1.0*hDist/endRad;
-	vbj = 1.0;		//endpoints of inner integral
-
-	summ = 0.0;			//initialize intergral
-
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the "theta" dummy
-		
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
-			yyy = Gauss76Wt[j] * ConvLens_kernel(CLens_tmp,x,zij,zi);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		inner = (vbj-vaj)/2.0*summj;
-		inner *= 4.0*Pi*endRad*endRad*endRad;
-		
-		//now calculate outer integrand
-		arg1 = x*len/2.0*cos(zi);
-		arg2 = x*rad*sin(zi);
-		yyy = inner;
-		
-		if(arg2 == 0) {
-			be = 0.5;
-		} else {
-			be = NR_BessJ1(arg2)/arg2;
-		}
-		
-		if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
-			yyy += Pi*rad*rad*len*2.0*be;
-		} else {
-			yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-		}
-		yyy *= yyy;
-		yyy *= sin(zi);		// = |A(q)|^2*sin(theta)
-		yyy *= Gauss76Wt[i];
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-
-	hh = fabs(hDist);		//need positive value for spherical cap volume
-	answer /= 2.0*(1.0/3.0*Pi*(endRad-hh)*(endRad-hh)*(2.0*endRad+hh));		//divide by volume
-	answer *= 1.0e8;		//convert to cm^-1
-	answer *= contr*contr;
-	answer *= scale;
-	answer += bkg;
-		
-	return answer;
-}
-
-/*	Capped Cylinder  : special case where L is nonzero and hDist < 0
-
- -- uses the same Kernel as the Convex Lens
- 
-Uses 76 pt Gaussian quadrature for both integrals
-*/
-double
-CappedCylinder(double w[], double x)
-{
-	int i,j;
-	double Pi;
-	double scale,contr,bkg,sldc,slds;
-	double len,rad,hDist,endRad;
-	int nordi=76;			//order of integration
-	int nordj=76;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	double arg1,arg2,inner,hh,be;
-	
-	
-	scale = w[0];
-	rad = w[1];
-	len = w[2];
-	endRad = w[3];
-	sldc = w[4];
-	slds = w[5];
-	bkg = w[6];
-		
-	hDist = -1.0*sqrt(fabs(endRad*endRad-rad*rad));		//by definition for this model
-	
-	contr = sldc-slds;
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = Pi/2.0;		//orintational average, outer integral
-	vaj = -1.0*hDist/endRad;
-	vbj = 1.0;		//endpoints of inner integral
-
-	summ = 0.0;			//initialize intergral
-
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the "theta" dummy
-		
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
-			yyy = Gauss76Wt[j] * ConvLens_kernel(w,x,zij,zi);		//uses the same kernel as ConvexLens, except here L != 0
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		inner = (vbj-vaj)/2.0*summj;
-		inner *= 4.0*Pi*endRad*endRad*endRad;
-		
-		//now calculate outer integrand
-		arg1 = x*len/2.0*cos(zi);
-		arg2 = x*rad*sin(zi);
-		yyy = inner;
-		
-		if(arg2 == 0) {
-			be = 0.5;
-		} else {
-			be = NR_BessJ1(arg2)/arg2;
-		}
-		
-		if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
-			yyy += Pi*rad*rad*len*2.0*be;
-		} else {
-			yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-		}
-		
-		
-		
-		yyy *= yyy;
-		yyy *= sin(zi);		// = |A(q)|^2*sin(theta)
-		yyy *= Gauss76Wt[i];
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-
-	hh = fabs(hDist);		//need positive value for spherical cap volume
-	answer /= Pi*rad*rad*len + 2.0*(1.0/3.0*Pi*(endRad-hh)*(endRad-hh)*(2.0*endRad+hh));		//divide by volume
-	answer *= 1.0e8;		//convert to cm^-1
-	answer *= contr*contr;
-	answer *= scale;
-	answer += bkg;
-		
-	return answer;
-}
-
-
-
-// inner integral of the ConvexLens model, special case where L ~ 0 and hDist < 0
-//
-double
-ConvLens_kernel(double w[], double x, double tt, double theta) {
-
-	double val,arg1,arg2;
-	double scale,bkg,sldc,slds;
-	double len,rad,hDist,endRad,be;
-	scale = w[0];
-	rad = w[1];
-	len = w[2];
-	endRad = w[3];
-	sldc = w[4];
-	slds = w[5];
-	bkg = w[6];
-	
-	hDist = -1.0*sqrt(fabs(endRad*endRad-rad*rad));
-		
-	arg1 = x*cos(theta)*(endRad*tt+hDist+len/2.0);
-	arg2 = x*endRad*sin(theta)*sqrt(1.0-tt*tt);
-	
-	if(arg2 == 0) {
-		be = 0.5;
-	} else {
-		be = NR_BessJ1(arg2)/arg2;
-	}
-	
-	val = cos(arg1)*(1.0-tt*tt)*be;
-	
-	return(val);
-}
-
-
-/*	Dumbbell  : special case where L ~ 0 and hDist > 0
-
-Uses 76 pt Gaussian quadrature for both integrals
-*/
-double
-Dumbbell(double w[], double x)
-{
-	int i,j;
-	double Pi;
-	double scale,contr,bkg,sldc,slds;
-	double len,rad,hDist,endRad;
-	int nordi=76;			//order of integration
-	int nordj=76;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	double Dumb_tmp[7],arg1,arg2,inner,be;
-	
-	
-	scale = w[0];
-	rad = w[1];
-//	len = w[2]
-	endRad = w[2];
-	sldc = w[3];
-	slds = w[4];
-	bkg = w[5];
-	
-	len = 0.01;
-	
-	Dumb_tmp[0] = w[0];
-	Dumb_tmp[1] = w[1];
-	Dumb_tmp[2] = len;		//length is some small number, essentially zero
-	Dumb_tmp[3] = w[2];
-	Dumb_tmp[4] = w[3];
-	Dumb_tmp[5] = w[4];
-	Dumb_tmp[6] = w[5];
-			
-	hDist = sqrt(fabs(endRad*endRad-rad*rad));		//by definition for this model
-	
-	contr = sldc-slds;
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = Pi/2.0;		//orintational average, outer integral
-	vaj = -1.0*hDist/endRad;
-	vbj = 1.0;		//endpoints of inner integral
-
-	summ = 0.0;			//initialize intergral
-
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the "theta" dummy
-		
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
-			yyy = Gauss76Wt[j] * Dumb_kernel(Dumb_tmp,x,zij,zi);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		inner = (vbj-vaj)/2.0*summj;
-		inner *= 4.0*Pi*endRad*endRad*endRad;
-		
-		//now calculate outer integrand
-		arg1 = x*len/2.0*cos(zi);
-		arg2 = x*rad*sin(zi);
-		yyy = inner;
-		
-		if(arg2 == 0) {
-			be = 0.5;
-		} else {
-			be = NR_BessJ1(arg2)/arg2;
-		}
-		
-		if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
-			yyy += Pi*rad*rad*len*2.0*be;
-		} else {
-			yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-		}
-		yyy *= yyy;
-		yyy *= sin(zi);		// = |A(q)|^2*sin(theta)
-		yyy *= Gauss76Wt[i];
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-
-	answer /= 2.0*Pi*(2.0*endRad*endRad*endRad/3.0+endRad*endRad*hDist-hDist*hDist*hDist/3.0);		//divide by volume
-	answer *= 1.0e8;		//convert to cm^-1
-	answer *= contr*contr;
-	answer *= scale;
-	answer += bkg;
-		
-	return answer;
-}
-
-
-/*	Barbell  : "normal" case where L is nonzero 0 and hDist > 0
-
--- uses the same kernel as the Dumbbell case
-
-Uses 76 pt Gaussian quadrature for both integrals
-*/
-double
-Barbell(double w[], double x)
-{
-	int i,j;
-	double Pi;
-	double scale,contr,bkg,sldc,slds;
-	double len,rad,hDist,endRad;
-	int nordi=76;			//order of integration
-	int nordj=76;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	double arg1,arg2,inner,be;
-	
-	
-	scale = w[0];
-	rad = w[1];
-	len = w[2];
-	endRad = w[3];
-	sldc = w[4];
-	slds = w[5];
-	bkg = w[6];
-			
-	hDist = sqrt(fabs(endRad*endRad-rad*rad));		//by definition for this model
-	
-	contr = sldc-slds;
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = Pi/2.0;		//orintational average, outer integral
-	vaj = -1.0*hDist/endRad;
-	vbj = 1.0;		//endpoints of inner integral
-
-	summ = 0.0;			//initialize intergral
-
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the "theta" dummy
-		
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
-			yyy = Gauss76Wt[j] * Dumb_kernel(w,x,zij,zi);		//uses the same Kernel as the Dumbbell, here L>0
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		inner = (vbj-vaj)/2.0*summj;
-		inner *= 4.0*Pi*endRad*endRad*endRad;
-		
-		//now calculate outer integrand
-		arg1 = x*len/2.0*cos(zi);
-		arg2 = x*rad*sin(zi);
-		yyy = inner;
-		
-		if(arg2 == 0) {
-			be = 0.5;
-		} else {
-			be = NR_BessJ1(arg2)/arg2;
-		}
-		
-		if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
-			yyy += Pi*rad*rad*len*2.0*be;
-		} else {
-			yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-		}
-		yyy *= yyy;
-		yyy *= sin(zi);		// = |A(q)|^2*sin(theta)
-		yyy *= Gauss76Wt[i];
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-
-	answer /= Pi*rad*rad*len + 2.0*Pi*(2.0*endRad*endRad*endRad/3.0+endRad*endRad*hDist-hDist*hDist*hDist/3.0);		//divide by volume
-	answer *= 1.0e8;		//convert to cm^-1
-	answer *= contr*contr;
-	answer *= scale;
-	answer += bkg;
-		
-	return answer;
-}
-
-
-
-// inner integral of the Dumbbell model, special case where L ~ 0 and hDist > 0
-//
-// inner integral of the Barbell model if L is nonzero
-//
-double
-Dumb_kernel(double w[], double x, double tt, double theta) {
-
-	double val,arg1,arg2;
-	double scale,bkg,sldc,slds;
-	double len,rad,hDist,endRad,be;
-	scale = w[0];
-	rad = w[1];
-	len = w[2];
-	endRad = w[3];
-	sldc = w[4];
-	slds = w[5];
-	bkg = w[6];
-	
-	hDist = sqrt(fabs(endRad*endRad-rad*rad));
-		
-	arg1 = x*cos(theta)*(endRad*tt+hDist+len/2.0);
-	arg2 = x*endRad*sin(theta)*sqrt(1.0-tt*tt);
-	
-	if(arg2 == 0) {
-		be = 0.5;
-	} else {
-		be = NR_BessJ1(arg2)/arg2;
-	}
-	val = cos(arg1)*(1.0-tt*tt)*be;
-	
-	return(val);
-}
-
-double PolyCoreBicelle(double dp[], double q)
-{
-	int i;
-	int nord = 20;
-	double scale, length, sigma, bkg, radius, radthick, facthick;
-	double rhoc, rhoh, rhor, rhosolv;
-	double answer, Vpoly;
-	double Pi,lolim,uplim,summ,yyy,rad,AR,Rsqr,Rsqrsumm,Rsqryyy;
-	
-	scale = dp[0];
-	radius = dp[1];
-	sigma = dp[2];				//sigma is the standard mean deviation
-	length = dp[3];
-	radthick = dp[4];
-	facthick= dp[5];
-	rhoc = dp[6];
-	rhoh = dp[7];
-	rhor=dp[8];
-	rhosolv = dp[9];
-	bkg = dp[10];
-	
-	Pi = 4.0*atan(1.0);
-	
-	lolim = exp(log(radius)-(4.*sigma));
-	if (lolim<0.0) {
-		lolim=0.0;		//to avoid numerical error when  va<0 (-ve r value)
-	}
-	uplim = exp(log(radius)+(4.*sigma));
-	
-	summ = 0.0;
-	Rsqrsumm = 0.0;
-	
-	for(i=0;i<nord;i++) {
-		rad = ( Gauss20Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		AR=(1.0/(rad*sigma*sqrt(2.0*Pi)))*exp(-(0.5*((log(radius/rad))/sigma)*((log(radius/rad))/sigma)));
-		yyy = AR* Gauss20Wt[i] * BicelleIntegration(q,rad,radthick,facthick,rhoc,rhoh,rhor,rhosolv,length);
-		Rsqryyy= Gauss20Wt[i] * AR * (rad+radthick)*(rad+radthick);		//SRK normalize to total dimensions
-		summ += yyy;
-		Rsqrsumm += Rsqryyy;
-	}
-	
-	answer = (uplim-lolim)/2.0*summ;
-	Rsqr = (uplim-lolim)/2.0*Rsqrsumm;
-	//normalize by average cylinder volume
-	Vpoly = Pi*Rsqr*(length+2*facthick);
-	answer /= Vpoly;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-		
-	return answer;
-	
-}
-
-double
-BicelleIntegration(double qq, double rad, double radthick, double facthick, double rhoc, double rhoh, double rhor, double rhosolv, double length){
-
-	double answer,halfheight,Pi;
-	double lolim,uplim,summ,yyy,zi;
-	int nord,i;
-	
-	// set up the integration end points 
-	Pi = 4.0*atan(1.0);
-	nord = 76;
-	lolim = 0.0;
-	uplim = Pi/2;
-	halfheight = length/2.0;
-	
-	summ = 0.0;				// initialize integral
-	i=0;
-	for(i=0;i<nord;i++) {
-		zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0;
-		yyy = Gauss76Wt[i] * BicelleKernel(qq, rad, radthick, facthick, rhoc, rhoh, rhor,rhosolv, halfheight, zi);
-		summ += yyy;
-	}
-	
-	// calculate value of integral to return
-	answer = (uplim-lolim)/2.0*summ;
-	return(answer);	
-}
-
-double
-BicelleKernel(double qq, double rad, double radthick, double facthick, double rhoc, double rhoh, double rhor, double rhosolv, double length, double dum)
-{
-	double dr1,dr2,dr3;
-	double besarg1,besarg2;
-	double vol1,vol2,vol3;
-	double sinarg1,sinarg2;
-	double t1,t2,t3;
-	double retval,si1,si2,be1,be2;
-	
-	double Pi = 4.0*atan(1.0);
-	
-	dr1 = rhoc-rhoh;
-	dr2 = rhor-rhosolv;
-	dr3=  rhoh-rhor;
-	vol1 = Pi*rad*rad*(2.0*length);
-	vol2 = Pi*(rad+radthick)*(rad+radthick)*(2.0*length+2.0*facthick);
-	vol3= Pi*(rad)*(rad)*(2.0*length+2.0*facthick);
-	besarg1 = qq*rad*sin(dum);
-	besarg2 = qq*(rad+radthick)*sin(dum);
-	sinarg1 = qq*length*cos(dum);
-	sinarg2 = qq*(length+facthick)*cos(dum);
-	
-	if(besarg1 == 0) {
-		be1 = 0.5;
-	} else {
-		be1 = NR_BessJ1(besarg1)/besarg1;
-	}
-	if(besarg2 == 0) {
-		be2 = 0.5;
-	} else {
-		be2 = NR_BessJ1(besarg2)/besarg2;
-	}	
-	if(sinarg1 == 0) {
-		si1 = 1.0;
-	} else {
-		si1 = sin(sinarg1)/sinarg1;
-	}
-	if(sinarg2 == 0) {
-		si2 = 1.0;
-	} else {
-		si2 = sin(sinarg2)/sinarg2;
-	}
-	t1 = 2.0*vol1*dr1*si1*be1;
-	t2 = 2.0*vol2*dr2*si2*be2;
-	t3 = 2.0*vol3*dr3*si2*be1;
-	
-	retval = ((t1+t2+t3)*(t1+t2+t3))*sin(dum);
-	return(retval);
-	
-}
-
-
-double
-CSPPKernel(double dp[], double mu, double uu)
-{	
-	double aa,bb,cc, ta,tb,tc; 
-	double Vin,Vot,V1,V2;
-	double rhoA,rhoB,rhoC, rhoP, rhosolv;
-	double dr0, drA,drB, drC;
-	double arg1,arg2,arg3,arg4,t1,t2, t3, t4;
-	double Pi,retVal;
-
-	aa = dp[1];
-	bb = dp[2];
-	cc = dp[3];
-	ta = dp[4];
-	tb = dp[5];
-	tc = dp[6];
-	rhoA=dp[7];
-	rhoB=dp[8];
-	rhoC=dp[9];
-	rhoP=dp[10];
-	rhosolv=dp[11];
-	dr0=rhoP-rhosolv;
-	drA=rhoA-rhosolv;
-	drB=rhoB-rhosolv;
-	drC=rhoC-rhosolv; 
-	Vin=(aa*bb*cc);
-	Vot=(aa*bb*cc+2.0*ta*bb*cc+2.0*aa*tb*cc+2.0*aa*bb*tc);
-	V1=(2.0*ta*bb*cc);   //  incorrect V1 (aa*bb*cc+2*ta*bb*cc)
-	V2=(2.0*aa*tb*cc);  // incorrect V2(aa*bb*cc+2*aa*tb*cc)
-	aa = aa/bb;
-	ta=(aa+2.0*ta)/bb;
-	tb=(aa+2.0*tb)/bb;
-	
-	Pi = 4.0*atan(1.0);
-	
-	arg1 = (mu*aa/2.0)*sin(Pi*uu/2.0);
-	arg2 = (mu/2.0)*cos(Pi*uu/2.0);
-	arg3=  (mu*ta/2.0)*sin(Pi*uu/2.0);
-	arg4=  (mu*tb/2.0)*cos(Pi*uu/2.0);
-			 
-	if(arg1==0.0){
-		t1 = 1.0;
-	} else {
-		t1 = (sin(arg1)/arg1);                //defn for CSPP model sin(arg1)/arg1    test:  (sin(arg1)/arg1)*(sin(arg1)/arg1)   
-	}
-	if(arg2==0.0){
-		t2 = 1.0;
-	} else {
-		t2 = (sin(arg2)/arg2);           //defn for CSPP model sin(arg2)/arg2   test: (sin(arg2)/arg2)*(sin(arg2)/arg2)    
-	}	
-	if(arg3==0.0){
-		t3 = 1.0;
-	} else {
-		t3 = sin(arg3)/arg3;
-	}
-	if(arg4==0.0){
-		t4 = 1.0;
-	} else {
-		t4 = sin(arg4)/arg4;
-	}
-	retVal =( dr0*t1*t2*Vin + drA*(t3-t1)*t2*V1+ drB*t1*(t4-t2)*V2 )*( dr0*t1*t2*Vin + drA*(t3-t1)*t2*V1+ drB*t1*(t4-t2)*V2 );   //  correct FF : square of sum of phase factors
-	return(retVal); 
-
-}
-
-/*	CSParallelepiped  :  calculates the form factor of a Parallelepiped with a core-shell structure
- -- different SLDs can be used for the face and rim
-
-Uses 76 pt Gaussian quadrature for both integrals
-*/
-double
-CSParallelepiped(double dp[], double q)
-{
-	int i,j;
-	double scale,aa,bb,cc,ta,tb,tc,rhoA,rhoB,rhoC,rhoP,rhosolv,bkg;		//local variables of coefficient wave
-	int nordi=76;			//order of integration
-	int nordj=76;
-	double va,vb;		//upper and lower integration limits
-	double summ,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj;			//for the inner integration
-	double mu,mudum,arg,sigma,uu,vol;
-	
-	
-	//	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 1.0;		//orintational average, outer integral
-	vaj = 0.0;
-	vbj = 1.0;		//endpoints of inner integral
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = dp[0];
-	aa = dp[1];
-	bb = dp[2];
-	cc = dp[3];
-	ta  = dp[4];
-	tb  = dp[5];
-	tc  = dp[6];   // is 0 at the moment  
-	rhoA=dp[7];   //rim A SLD
-	rhoB=dp[8];   //rim B SLD
-	rhoC=dp[9];    //rim C SLD
-	rhoP = dp[10];   //Parallelpiped core SLD
-	rhosolv=dp[11];  // Solvent SLD
-	bkg = dp[12];
-	
-	mu = q*bb;
-	vol = aa*bb*cc+2.0*ta*bb*cc+2.0*aa*tb*cc+2.0*aa*bb*tc;		//calculate volume before rescaling
-	
-	// do the rescaling here, not in the kernel
-	// normalize all WRT bb
-	aa = aa/bb;
-	cc = cc/bb;
-	
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		sigma = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;		//the outer dummy
-		
-		for(j=0;j<nordj;j++) {
-			//76 gauss points for the inner integral
-			uu = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the inner dummy
-			mudum = mu*sqrt(1.0-sigma*sigma);
-			yyy = Gauss76Wt[j] * CSPPKernel(dp,mudum,uu);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		answer = (vbj-vaj)/2.0*summj;
-		
-		//finish the outer integral cc already scaled
-		arg = mu*cc*sigma/2.0;
-		if ( arg == 0.0 ) {
-			answer *= 1.0;
-		} else {
-			answer *= sin(arg)*sin(arg)/arg/arg;
-		}
-		
-		//now sum up the outer integral
-		yyy = Gauss76Wt[i] * answer;
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-
-	//normalize by volume
-	answer /= vol;
-	//convert to [cm-1]
-	answer *= 1.0e8;
-	//Scale
-	answer *= scale;
-	// add in the background
-	answer += bkg;
-	
-	return answer;
-}
-
Index: sansmodels/src/sans/models/libigor/libCylinder.h
===================================================================
--- sansmodels/src/sans/models/libigor/libCylinder.h	(revision 5f0dcab5458a4b59903104d524321c74b70f291c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
-	libCylinderFit.h -- equates for CylinderFit XOP
-*/
-#if defined(_MSC_VER)
-#include "winFuncs.h"
-#endif
-
-/* Prototypes */
-/* IGOR Fit Functions */
-double CylinderForm(double dp[], double q);
-double EllipCyl76(double dp[], double q);
-double EllipCyl20(double dp[], double q);
-double TriaxialEllipsoid(double dp[], double q);
-double Parallelepiped(double dp[], double q);
-double HollowCylinder(double dp[], double q);
-double EllipsoidForm(double dp[], double q);
-double Cyl_PolyRadius(double dp[], double q);
-double Cyl_PolyLength(double dp[], double q);
-double CoreShellCylinder(double dp[], double q);
-double OblateForm(double dp[], double q);
-double ProlateForm(double dp[], double q);
-double FlexExclVolCyl(double dp[], double q);
-double FlexCyl_PolyLen(double dp[], double q);
-double FlexCyl_PolyRad(double dp[], double q);
-double FlexCyl_Ellip(double dp[], double q);
-double PolyCoShCylinder(double dp[], double q);
-double StackedDiscs(double dp[], double q);
-double LamellarFF(double dp[], double q);
-double LamellarFF_HG(double dp[], double q);
-double LamellarPS(double dp[], double q);
-double LamellarPS_HG(double dp[], double q);
-double Lamellar_ParaCrystal(double dp[], double q);
-double Spherocylinder(double dp[], double q);
-double ConvexLens(double dp[], double q);
-double Dumbbell(double dp[], double q);
-double CappedCylinder(double dp[], double q);
-double Barbell(double dp[], double q);
-double PolyCoreBicelle(double dp[], double q);
-double CSParallelepiped(double dp[], double q);
-
-/* internal functions */
-double CylKernel(double qq, double rr,double h, double theta);
-double NR_BessJ1(double x);
-double EllipCylKernel(double qq, double ra,double nu, double theta);
-double TriaxialKernel(double q, double aa, double bb, double cc, double dx, double dy);
-double PPKernel(double aa, double mu, double uu);
-double HolCylKernel(double qq, double rcore, double rshell, double length, double dum);
-double EllipsoidKernel(double qq, double a, double va, double dum);
-double Cyl_PolyRadKernel(double q, double radius, double length, double zz, double delrho, double dumRad);
-double SchulzPoint_cpr(double dumRad, double radius, double zz);
-double Cyl_PolyLenKernel(double q, double radius, double len_avg, double zz, double delrho, double dumLen);
-double CoreShellCylKernel(double qq, double rcore, double thick, double rhoc, double rhos, double rhosolv, double length, double dum);
-double gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq);
-double gfn2(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq);
-double FlePolyLen_kernel(double q, double radius, double length, double lb, double zz, double delrho, double zi);
-double FlePolyRad_kernel(double q, double ravg, double Lc, double Lb, double zz, double delrho, double zi);
-double EllipticalCross_fn(double qq, double a, double b);
-double CScyl(double qq, double rad, double radthick, double facthick, double rhoc, double rhos, double rhosolv, double length, double dum);
-double CSCylIntegration(double qq, double rad, double radthick, double facthick, double rhoc, double rhos, double rhosolv, double length);
-double Stackdisc_kern(double qq, double rcore, double rhoc, double rhol, double rhosolv, double length, double thick, double dum, double gsd, double d, double N);
-double paraCryst_sn(double ww, double qval, double davg, long nl, double an);
-double paraCryst_an(double ww, double qval, double davg, long nl);
-double SphCyl_kernel(double w[], double x, double tt, double Theta);
-double ConvLens_kernel(double w[], double x, double tt, double theta);
-double Dumb_kernel(double w[], double x, double tt, double theta);
-double BicelleKernel(double qq, double rad, double radthick, double facthick, double rhoc, double rhoh, double rhor, double rhosolv, double length, double dum);
-double BicelleIntegration(double qq, double rad, double radthick, double facthick, double rhoc, double rhoh, double rhor, double rhosolv, double length);
-double CSPPKernel(double dp[], double mu, double uu);
-
-
Index: sansmodels/src/sans/models/libigor/libSANSAnalysis.h
===================================================================
--- sansmodels/src/sans/models/libigor/libSANSAnalysis.h	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- *  libSANSAnalysis.h
- *  SANSAnalysis
- *
- *  Created by Andrew Jackson on 4/24/07.
- *  Copyright 2007 __MyCompanyName__. All rights reserved.
- *
- */
-
-#include "libCylinder.h"
-#include "libSphere.h"
-#include "libStructureFactor.h"
-#include "libTwoPhase.h"
-
-/*This should not be necessary AJJ May 09*/
-/* IGOR Fit Functions */
-/*
-double CylinderForm(double dp[], double q);
-double EllipCyl76(double dp[], double q);
-double EllipCyl20(double dp[], double q);
-double TriaxialEllipsoid(double dp[], double q);
-double Parallelepiped(double dp[], double q);
-double HollowCylinder(double dp[], double q);
-double EllipsoidForm(double dp[], double q);
-double Cyl_PolyRadius(double dp[], double q);
-double Cyl_PolyLength(double dp[], double q);
-double CoreShellCylinder(double dp[], double q);
-double OblateForm(double dp[], double q);
-double ProlateForm(double dp[], double q);
-double FlexExclVolCyl(double dp[], double q);
-double FlexCyl_PolyLen(double dp[], double q);
-double FlexCyl_PolyRad(double dp[], double q);
-double FlexCyl_Ellip(double dp[], double q);
-double PolyCoShCylinder(double dp[], double q);
-double StackedDiscs(double dp[], double q);
-double LamellarFF(double dp[], double q);
-double LamellarFF_HG(double dp[], double q);
-double LamellarPS(double dp[], double q);
-double LamellarPS_HG(double dp[], double q);
-//
-double Lamellar_ParaCrystal(double dp[], double q);
-double Spherocylinder(double dp[], double q);
-double ConvexLens(double dp[], double q);
-double Dumbbell(double dp[], double q);
-double CappedCylinder(double dp[], double q);
-double Barbell(double dp[], double q);
-double PolyCoreBicelle(double dp[], double q);
-*/
-
-/* internal functions */
-/*
-double CylKernel(double qq, double rr,double h, double theta);
-double NR_BessJ1(double x);
-double EllipCylKernel(double qq, double ra,double nu, double theta);
-double TriaxialKernel(double q, double aa, double bb, double cc, double dx, double dy);
-double PPKernel(double aa, double mu, double uu);
-double HolCylKernel(double qq, double rcore, double rshell, double length, double dum);
-double EllipsoidKernel(double qq, double a, double va, double dum);
-double Cyl_PolyRadKernel(double q, double radius, double length, double zz, double delrho, double dumRad);
-double SchulzPoint_cpr(double dumRad, double radius, double zz);
-double Cyl_PolyLenKernel(double q, double radius, double len_avg, double zz, double delrho, double dumLen);
-double CoreShellCylKernel(double qq, double rcore, double thick, double rhoc, double rhos, double rhosolv, double length, double dum);
-double gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq);
-double gfn2(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq);
-double FlePolyLen_kernel(double q, double radius, double length, double lb, double zz, double delrho, double zi);
-double FlePolyRad_kernel(double q, double ravg, double Lc, double Lb, double zz, double delrho, double zi);
-double EllipticalCross_fn(double qq, double a, double b);
-double CScyl(double qq, double rad, double radthick, double facthick, double rhoc, double rhos, double rhosolv, double length, double dum);
-double CSCylIntegration(double qq, double rad, double radthick, double facthick, double rhoc, double rhos, double rhosolv, double length);
-double Stackdisc_kern(double qq, double rcore, double rhoc, double rhol, double rhosolv, double length, double thick, double dum, double gsd, double d, double N);
-double BicelleKernel(double qq, double rad, double radthick, double facthick, double rhoc, double rhoh, double rhor, double rhosolv, double length, double dum);
-double BicelleIntegration(double qq, double rad, double radthick, double facthick, double rhoc, double rhoh, double rhor, double rhosolv, double length);
-*/
-
-
-//
-/* IGOR Fit Functions */
-/*
-double MultiShell(double dp[], double q);
-double PolyMultiShell(double dp[], double q);
-double SphereForm(double dp[], double q);
-double CoreShellForm(double dp[], double q);
-double PolyCoreForm(double dp[], double q);
-double PolyCoreShellRatio(double dp[], double q);
-double VesicleForm(double dp[], double q);
-double SchulzSpheres(double dp[], double q);
-double PolyRectSpheres(double dp[], double q);
-double PolyHardSphereIntensity(double dp[], double q);
-double BimodalSchulzSpheres(double dp[], double q);
-double GaussPolySphere(double dp[], double q);
-double LogNormalPolySphere(double dp[], double q);
-double BinaryHS(double dp[], double q);
-double BinaryHS_PSF11(double dp[], double q);
-double BinaryHS_PSF12(double dp[], double q);
-double BinaryHS_PSF22(double dp[], double q);
-//
-double OneShell(double dp[], double q);
-double TwoShell(double dp[], double q);
-double ThreeShell(double dp[], double q);
-double FourShell(double dp[], double q);
-double PolyOneShell(double dp[], double q);
-double PolyTwoShell(double dp[], double q);
-double PolyThreeShell(double dp[], double q);
-double PolyFourShell(double dp[], double q);
-double BCC_ParaCrystal(double dp[], double q);
-double FCC_ParaCrystal(double dp[], double q);
-double SC_ParaCrystal(double dp[], double q);
-
-//function prototypes
-double F_func(double qr);
-double MultiShellGuts(double q,double rcore,double ts,double tw,double rhocore,double rhoshel,int num);
-double fnt2(double yy, double zz);
-double fnt3(double yy, double pp, double zz);
-double SchulzSphere_Fn(double scale, double ravg, double pd, double rho, double rhos, double x);
-int ashcroft(double qval, double r2, double nf2, double aa, double phi, double *s11, double *s22, double *s12);
-
-
-////
-double HardSphereStruct(double dp[], double q);
-double SquareWellStruct(double dp[], double q);
-double StickyHS_Struct(double dp[], double q);
-double HayterPenfoldMSA(double dp[], double q);
-double DiamCyl(double a, double b);
-double DiamEllip(double a, double b);
-double sqhcal(double qq);
-int sqfun(int ix, int ir);
-int sqcoef(int ir);
-*/
-////
-/* IGOR Fit Functions */
-/*
-double TeubnerStreyModel(double dp[], double q);
-double Power_Law_Model(double dp[], double q);
-double Peak_Lorentz_Model(double dp[], double q);
-double Peak_Gauss_Model(double dp[], double q);
-double Lorentz_Model(double dp[], double q);
-double Fractal(double dp[], double q);
-double DAB_Model(double dp[], double q);
-double OneLevel(double dp[], double q);
-double TwoLevel(double dp[], double q);
-double ThreeLevel(double dp[], double q);
-double FourLevel(double dp[], double q);
-//
-double BroadPeak(double dp[], double q);
-double CorrLength(double dp[], double q);
-double TwoLorentzian(double dp[], double q);
-double TwoPowerLaw(double dp[], double q);
-double PolyGaussCoil(double dp[], double q);
-double GaussLorentzGel(double dp[], double q);
-double GaussianShell(double dp[], double q);
-*/
-
-// since the XOP and the library are separate chunks of compiled code
-// it is imperative to set ALL the structure alignments to be two-byte
-// rather than leave it to the whim of the compiler
-/* SRK08
-#include "XOPStructureAlignmentTwoByte.h"
-
-typedef struct {
-    double scale;
-    double radius;
-    double length;
-    double contrast;
-	double background;    
-    double cyl_theta;
-    double cyl_phi;    
-} CylinderParameters;
-
-typedef struct {
-    double scale;
-    double radius;
-    double length;
-    double contrast;
-	double background;
-    double cyl_theta;
-    double cyl_phi; 
-    double sigma_theta;
-    double sigma_phi;
-    double sigma_radius;
-} SmearCylinderParameters;
-
-#include "XOPStructureAlignmentReset.h"
-
-/// 1D scattering function
-double cylinder_analytical_1D(CylinderParameters *pars, double q);
-/// 2D scattering function
-double cylinder_analytical_2D(CylinderParameters *pars, double q, double phi);
-/// 1D scattering function
-double smeared_cylinder_analytical_1D(SmearCylinderParameters *pars, double q);
-/// 2D scattering function
-double dist_cylinder_2D(double pars[], double q, double phi);
-double smeared_cylinder_analytical_2D(SmearCylinderParameters *pars, double q, double phi);
-double smeared_cylinder_dist( double x, double mean, double sigma );
-*/
Index: sansmodels/src/sans/models/libigor/libSphere.c
===================================================================
--- sansmodels/src/sans/models/libigor/libSphere.c	(revision 5f0dcab5458a4b59903104d524321c74b70f291c)
+++ 	(revision )
@@ -1,2332 +1,0 @@
-/*	SimpleFit.c
-
-A simplified project designed to act as a template for your curve fitting function.
-The fitting function is a simple polynomial. It works but is of no practical use.
-*/
-
-#include "StandardHeaders.h"			// Include ANSI headers, Mac headers
-#include "GaussWeights.h"
-#include "libSphere.h"
-
-
-static double
-gammln(double xx) {
-    double x,y,tmp,ser;
-    static double cof[6]={76.18009172947146,-86.50532032941677,
-    24.01409824083091,-1.231739572450155,
-    0.1208650973866179e-2,-0.5395239384953e-5};
-    int j;
-
-    y=x=xx;
-    tmp=x+5.5;
-    tmp -= (x+0.5)*log(tmp);
-    ser=1.000000000190015;
-    for (j=0;j<=5;j++) ser += cof[j]/++y;
-    return -tmp+log(2.5066282746310005*ser/x);
-}
-
-static double
-LogNormal_distr(double sig, double mu, double pt)
-{
-  double retval,pi;
-
-  pi = 4.0*atan(1.0);
-  retval = (1.0/ (sig*pt*sqrt(2.0*pi)) )*exp( -0.5*(log(pt) - mu)*(log(pt) - mu)/sig/sig );
-  return(retval);
-}
-
-static double
-Gauss_distr(double sig, double avg, double pt)
-{
-  double retval,Pi;
-
-  Pi = 4.0*atan(1.0);
-  retval = (1.0/ (sig*sqrt(2.0*Pi)) )*exp(-(avg-pt)*(avg-pt)/sig/sig/2.0);
-  return(retval);
-}
-
-static double SchulzPoint(double x, double avg, double zz) {
-    double dr;
-    dr = zz*log(x) - gammln(zz+1.0)+(zz+1.0)*log((zz+1.0)/avg)-(x/avg*(zz+1.0));
-    return (exp(dr));
-};
-
-
-// scattering from a sphere - hardly needs to be an XOP...
-double
-SphereForm(double dp[], double q)
-{
-	double scale,radius,delrho,bkg,sldSph,sldSolv;		//my local names
-	double bes,f,vol,f2,pi,qr;
-
-	pi = 4.0*atan(1.0);
-	scale = dp[0];
-	radius = dp[1];
-	sldSph = dp[2];
-	sldSolv = dp[3];
-	bkg = dp[4];
-	
-	delrho = sldSph - sldSolv;
-	//handle qr==0 separately
-	qr = q*radius;
-	if(qr == 0.0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	
-	vol = 4.0*pi/3.0*radius*radius*radius;
-	f = vol*bes*delrho;		// [=] A-1
-							// normalize to single particle volume, convert to 1/cm
-	f2 = f * f / vol * 1.0e8;		// [=] 1/cm
-	
-	return(scale*f2+bkg);	//scale, and add in the background
-}
-
-// scattering from a monodisperse core-shell sphere - hardly needs to be an XOP...
-double
-CoreShellForm(double dp[], double q)
-{
-	double x,pi;
-	double scale,rcore,thick,rhocore,rhoshel,rhosolv,bkg;		//my local names
-	double bes,f,vol,qr,contr,f2;
-	
-	pi = 4.0*atan(1.0);
-	x=q;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	thick = dp[2];
-	rhocore = dp[3];
-	rhoshel = dp[4];
-	rhosolv = dp[5];
-	bkg = dp[6];
-	// core first, then add in shell
-	qr=x*rcore;
-	contr = rhocore-rhoshel;
-	if(qr == 0.0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*rcore*rcore*rcore;
-	f = vol*bes*contr;
-	//now the shell
-	qr=x*(rcore+thick);
-	contr = rhoshel-rhosolv;
-	if(qr == 0.0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*pow((rcore+thick),3);
-	f += vol*bes*contr;
-
-	// normalize to particle volume and rescale from [A-1] to [cm-1]
-	f2 = f*f/vol*1.0e8;
-	
-	//scale if desired
-	f2 *= scale;
-	// then add in the background
-	f2 += bkg;
-	
-	return(f2);
-}
-
-// scattering from a unilamellar vesicle - hardly needs to be an XOP...
-// same functional form as the core-shell sphere, but more intuitive for a vesicle
-double
-VesicleForm(double dp[], double q)
-{
-	double x,pi;
-	double scale,rcore,thick,rhocore,rhoshel,rhosolv,bkg;		//my local names
-	double bes,f,vol,qr,contr,f2;
-	pi = 4.0*atan(1.0);
-	x= q;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	thick = dp[2];
-	rhocore = dp[3];
-	rhosolv = rhocore;
-	rhoshel = dp[4];
-	bkg = dp[5];
-	// core first, then add in shell
-	qr=x*rcore;
-	contr = rhocore-rhoshel;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*rcore*rcore*rcore;
-	f = vol*bes*contr;
-	//now the shell
-	qr=x*(rcore+thick);
-	contr = rhoshel-rhosolv;
-	if(qr == 0.0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*pow((rcore+thick),3);
-	f += vol*bes*contr;
-
-	// normalize to the particle volume and rescale from [A-1] to [cm-1]
-	//note that for the vesicle model, the volume is ONLY the shell volume
-	vol = 4.0*pi/3.0*(pow((rcore+thick),3)-pow(rcore,3));
-	f2 = f*f/vol*1.0e8;
-	
-	//scale if desired
-	f2 *= scale;
-	// then add in the background
-	f2 += bkg;
-	
-	return(f2);
-}
-
-
-// scattering from a core shell sphere with a (Schulz) polydisperse core and constant shell thickness
-//
-double
-PolyCoreForm(double dp[], double q)
-{
-	double pi;
-	double scale,corrad,sig,zz,del,drho1,drho2,form,bkg;		//my local names
-	double d, g ,h;
-	double qq, x, y, c1, c2, c3, c4, c5, c6, c7, c8, c9, t1, t2, t3;
-	double t4, t5, tb, cy, sy, tb1, tb2, tb3, c2y, zp1, zp2;
-	double zp3,vpoly;
-	double s2y, arg1, arg2, arg3, drh1, drh2;
-	
-	pi = 4.0*atan(1.0);
-	qq= q;
-	scale = dp[0];
-	corrad = dp[1];
-	sig = dp[2];
-	del = dp[3];
-	drho1 = dp[4]-dp[5];		//core-shell
-	drho2 = dp[5]-dp[6];		//shell-solvent
-	bkg = dp[7];
-	
-	zz = (1.0/sig)*(1.0/sig) - 1.0;   
-	
-	h=qq;
-	
-	drh1 = drho1;
-	drh2 = drho2;
-	g = drh2 * -1. / drh1;
-	zp1 = zz + 1.;
-	zp2 = zz + 2.;
-	zp3 = zz + 3.;
-	vpoly = 4*pi/3*zp3*zp2/zp1/zp1*pow((corrad+del),3);
-	
-	
-	// remember that h is the passed in value of q for the calculation
-	y = h *del;
-	x = h *corrad;
-	d = atan(x * 2. / zp1);
-	arg1 = zp1 * d;
-	arg2 = zp2 * d;
-	arg3 = zp3 * d;
-	sy = sin(y);
-	cy = cos(y);
-	s2y = sin(y * 2.);
-	c2y = cos(y * 2.);
-	c1 = .5 - g * (cy + y * sy) + g * g * .5 * (y * y + 1.);
-	c2 = g * y * (g - cy);
-	c3 = (g * g + 1.) * .5 - g * cy;
-	c4 = g * g * (y * cy - sy) * (y * cy - sy) - c1;
-	c5 = g * 2. * sy * (1. - g * (y * sy + cy)) + c2;
-	c6 = c3 - g * g * sy * sy;
-	c7 = g * sy - g * .5 * g * (y * y + 1.) * s2y - c5;
-	c8 = c4 - .5 + g * cy - g * .5 * g * (y * y + 1.) * c2y;
-	c9 = g * sy * (1. - g * cy);
-	
-	tb = log(zp1 * zp1 / (zp1 * zp1 + x * 4. * x));
-	tb1 = exp(zp1 * .5 * tb);
-	tb2 = exp(zp2 * .5 * tb);
-	tb3 = exp(zp3 * .5 * tb);
-	
-	t1 = c1 + c2 * x + c3 * x * x * zp2 / zp1;
-	t2 = tb1 * (c4 * cos(arg1) + c7 * sin(arg1));
-	t3 = x * tb2 * (c5 * cos(arg2) + c8 * sin(arg2));
-	t4 = zp2 / zp1 * x * x * tb3 * (c6 * cos(arg3) + c9 * sin(arg3));
-	t5 = t1 + t2 + t3 + t4;
-	form = t5 * 16. * pi * pi * drh1 * drh1 / pow(qq,6);
-	//	normalize by the average volume !!! corrected for polydispersity
-	// and convert to cm-1
-	form /= vpoly;
-	form *= 1.0e8;
-	//Scale
-	form *= scale;
-	// then add in the background
-	form += bkg;
-	
-	return(form);
-}
-
-// scattering from a uniform sphere with a (Schulz) size distribution
-// structure factor effects are explicitly and correctly included.
-//
-double
-PolyHardSphereIntensity(double dp[], double q)
-{
-	double pi;
-	double rad,z2,phi,cont,bkg,sigma;		//my local names
-	double mu,mu1,d1,d2,d3,d4,d5,d6,capd,rho;
-	double ll,l1,bb,cc,chi,chi1,chi2,ee,t1,t2,t3,pp;
-	double ka,zz,v1,v2,p1,p2;
-	double h1,h2,h3,h4,e1,yy,y1,s1,s2,s3,hint1,hint2;
-	double capl,capl1,capmu,capmu1,r3,pq;
-	double ka2,r1,heff;
-	double hh,k,slds,sld;
-	
-	pi = 4.0*atan(1.0);
-	k= q;
-	
-	rad = dp[0];		// radius (A)
-	z2 = dp[1];		//polydispersity (0<z2<1)
-	phi = dp[2];		// volume fraction (0<phi<1)
-	slds = dp[3];
-	sld = dp[4];
-	cont = (slds - sld)*1.0e4;		// contrast (odd units)
-	bkg = dp[5];
-	sigma = 2*rad;
-	
-	zz=1.0/(z2*z2)-1.0;
-	bb = sigma/(zz+1.0);
-	cc = zz+1.0;
-	
-	//*c   Compute the number density by <r-cubed>, not <r> cubed*/
-	r1 = sigma/2.0;
-	r3 = r1*r1*r1;
-	r3 *= (zz+2.0)*(zz+3.0)/((zz+1.0)*(zz+1.0));
-	rho=phi/(1.3333333333*pi*r3);
-	t1 = rho*bb*cc;
-	t2 = rho*bb*bb*cc*(cc+1.0);
-	t3 = rho*bb*bb*bb*cc*(cc+1.0)*(cc+2.0);
-	capd = 1.0-pi*t3/6.0;
-	//************
-	v1=1.0/(1.0+bb*bb*k*k);
-	v2=1.0/(4.0+bb*bb*k*k);
-	pp=pow(v1,(cc/2.0))*sin(cc*atan(bb*k));
-	p1=bb*cc*pow(v1,((cc+1.0)/2.0))*sin((cc+1.0)*atan(bb*k));
-	p2=cc*(cc+1.0)*bb*bb*pow(v1,((cc+2.0)/2.0))*sin((cc+2.0)*atan(bb*k));
-	mu=pow(2,cc)*pow(v2,(cc/2.0))*sin(cc*atan(bb*k/2.0));
-	mu1=pow(2,(cc+1.0))*bb*cc*pow(v2,((cc+1.0)/2.0))*sin((cc+1.0)*atan(k*bb/2.0));
-	s1=bb*cc;
-	s2=cc*(cc+1.0)*bb*bb;
-	s3=cc*(cc+1.0)*(cc+2.0)*bb*bb*bb;
-	chi=pow(v1,(cc/2.0))*cos(cc*atan(bb*k));
-	chi1=bb*cc*pow(v1,((cc+1.0)/2.0))*cos((cc+1.0)*atan(bb*k));
-	chi2=cc*(cc+1.0)*bb*bb*pow(v1,((cc+2.0)/2.0))*cos((cc+2.0)*atan(bb*k));
-	ll=pow(2,cc)*pow(v2,(cc/2.0))*cos(cc*atan(bb*k/2.0));
-	l1=pow(2,(cc+1.0))*bb*cc*pow(v2,((cc+1.0)/2.0))*cos((cc+1.0)*atan(k*bb/2.0));
-	d1=(pi/capd)*(2.0+(pi/capd)*(t3-(rho/k)*(k*s3-p2)));
-	d2=pow((pi/capd),2)*(rho/k)*(k*s2-p1);
-	d3=(-1.0)*pow((pi/capd),2)*(rho/k)*(k*s1-pp);
-	d4=(pi/capd)*(k-(pi/capd)*(rho/k)*(chi1-s1));
-	d5=pow((pi/capd),2)*((rho/k)*(chi-1.0)+0.5*k*t2);
-	d6=pow((pi/capd),2)*(rho/k)*(chi2-s2);
-	
-	e1=pow((pi/capd),2)*pow((rho/k/k),2)*((chi-1.0)*(chi2-s2)-(chi1-s1)*(chi1-s1)-(k*s1-pp)*(k*s3-p2)+pow((k*s2-p1),2));
-	ee=1.0-(2.0*pi/capd)*(1.0+0.5*pi*t3/capd)*(rho/k/k/k)*(k*s1-pp)-(2.0*pi/capd)*rho/k/k*((chi1-s1)+(0.25*pi*t2/capd)*(chi2-s2))-e1;
-	y1=pow((pi/capd),2)*pow((rho/k/k),2)*((k*s1-pp)*(chi2-s2)-2.0*(k*s2-p1)*(chi1-s1)+(k*s3-p2)*(chi-1.0));
-	yy = (2.0*pi/capd)*(1.0+0.5*pi*t3/capd)*(rho/k/k/k)*(chi+0.5*k*k*s2-1.0)-(2.0*pi*rho/capd/k/k)*(k*s2-p1+(0.25*pi*t2/capd)*(k*s3-p2))-y1;    
-	
-	capl=2.0*pi*cont*rho/k/k/k*(pp-0.5*k*(s1+chi1));
-	capl1=2.0*pi*cont*rho/k/k/k*(p1-0.5*k*(s2+chi2));
-	capmu=2.0*pi*cont*rho/k/k/k*(1.0-chi-0.5*k*p1);
-	capmu1=2.0*pi*cont*rho/k/k/k*(s1-chi1-0.5*k*p2);
-	
-	h1=capl*(capl*(yy*d1-ee*d6)+capl1*(yy*d2-ee*d4)+capmu*(ee*d1+yy*d6)+capmu1*(ee*d2+yy*d4));
-	h2=capl1*(capl*(yy*d2-ee*d4)+capl1*(yy*d3-ee*d5)+capmu*(ee*d2+yy*d4)+capmu1*(ee*d3+yy*d5));
-	h3=capmu*(capl*(ee*d1+yy*d6)+capl1*(ee*d2+yy*d4)+capmu*(ee*d6-yy*d1)+capmu1*(ee*d4-yy*d2));
-	h4=capmu1*(capl*(ee*d2+yy*d4)+capl1*(ee*d3+yy*d5)+capmu*(ee*d4-yy*d2)+capmu1*(ee*d5-yy*d3));
-	
-	//*  This part computes the second integral in equation (1) of the paper.*/
-	
-	hint1 = -2.0*(h1+h2+h3+h4)/(k*k*k*(ee*ee+yy*yy));
-	
-	//*  This part computes the first integral in equation (1).  It also
-	// generates the KC approximated effective structure factor.*/
-	
-	pq=4.0*pi*cont*(sin(k*sigma/2.0)-0.5*k*sigma*cos(k*sigma/2.0));
-	hint2=8.0*pi*pi*rho*cont*cont/(k*k*k*k*k*k)*(1.0-chi-k*p1+0.25*k*k*(s2+chi2));
-	
-	ka=k*(sigma/2.0);
-	//
-	hh=hint1+hint2;		// this is the model intensity
-						//
-	heff=1.0+hint1/hint2;
-	ka2=ka*ka;
-	//*
-	//  heff is PY analytical solution for intensity divided by the 
-	//   form factor.  happ is the KC approximated effective S(q)
-	 
-	 //*******************
-	 //  add in the background then return the intensity value
-	 
-	 return(hh+bkg);	//scale, and add in the background
-}
-
-// scattering from a uniform sphere with a (Schulz) size distribution, bimodal population
-// NO CROSS TERM IS ACCOUNTED FOR == DILUTE SOLUTION!!
-//
-double
-BimodalSchulzSpheres(double dp[], double q)
-{
-	double x,pq;
-	double scale,ravg,pd,bkg,rho,rhos;		//my local names
-	double scale2,ravg2,pd2,rho2;		//my local names
-	
-	x= q;
-	
-	scale = dp[0];
-	ravg = dp[1];
-	pd = dp[2];
-	rho = dp[3];
-	scale2 = dp[4];
-	ravg2 = dp[5];
-	pd2 = dp[6];
-	rho2 = dp[7];
-	rhos = dp[8];
-	bkg = dp[9];
-	
-	pq = SchulzSphere_Fn( scale,  ravg,  pd,  rho,  rhos, x);
-	pq += SchulzSphere_Fn( scale2,  ravg2,  pd2,  rho2,  rhos, x);
-	// add in the background
-	pq += bkg;
-	
-	return (pq);
-}
-
-// scattering from a uniform sphere with a (Schulz) size distribution
-//
-double
-SchulzSpheres(double dp[], double q)
-{
-	double x,pq;
-	double scale,ravg,pd,bkg,rho,rhos;		//my local names
-	
-	x= q;
-	
-	scale = dp[0];
-	ravg = dp[1];
-	pd = dp[2];
-	rho = dp[3];
-	rhos = dp[4];
-	bkg = dp[5];
-	pq = SchulzSphere_Fn( scale,  ravg,  pd,  rho,  rhos, x);
-	// add in the background
-	pq += bkg;
-	
-	return(pq);
-}
-
-// calculates everything but the background
-double
-SchulzSphere_Fn(double scale, double ravg, double pd, double rho, double rhos, double x)
-{
-	double zp1,zp2,zp3,zp4,zp5,zp6,zp7,vpoly;
-	double aa,at1,at2,rt1,rt2,rt3,t1,t2,t3;
-	double v1,v2,v3,g1,pq,pi,delrho,zz;
-	double i_zero,Rg2,zp8;
-	
-	pi = 4.0*atan(1.0);
-	delrho = rho-rhos;
-	zz = (1.0/pd)*(1.0/pd) - 1.0;   
-	
-	zp1 = zz + 1.0;
-	zp2 = zz + 2.0;
-	zp3 = zz + 3.0;
-	zp4 = zz + 4.0;
-	zp5 = zz + 5.0;
-	zp6 = zz + 6.0;
-	zp7 = zz + 7.0;
-	//
-	
-	//small QR limit - use Guinier approx
-	zp8 = zz+8.0;
-	if(x*ravg < 0.1) {
-		i_zero = scale*delrho*delrho*1.e8*4.*pi/3.*pow(ravg,3);
-		i_zero *= zp6*zp5*zp4/zp1/zp1/zp1;		//6th moment / 3rd moment
-		Rg2 = 3.*zp8*zp7/5./(zp1*zp1)*ravg*ravg;
-		pq = i_zero*exp(-x*x*Rg2/3.);
-		//pq += bkg;		//unlike the Igor code, the backgorund is added in the wrapper (above)
-		return(pq);
-	}
-	//
-
-	aa = (zz+1.0)/x/ravg;
-	
-	at1 = atan(1.0/aa);
-	at2 = atan(2.0/aa);
-	//
-	//  calculations are performed to avoid  large # errors
-	// - trick is to propogate the a^(z+7) term through the g1
-	// 
-	t1 = zp7*log10(aa) - zp1/2.0*log10(aa*aa+4.0);
-	t2 = zp7*log10(aa) - zp3/2.0*log10(aa*aa+4.0);
-	t3 = zp7*log10(aa) - zp2/2.0*log10(aa*aa+4.0);
-	//	print t1,t2,t3
-	rt1 = pow(10,t1);
-	rt2 = pow(10,t2);
-	rt3 = pow(10,t3);
-	v1 = pow(aa,6) - rt1*cos(zp1*at2);
-	v2 = zp1*zp2*( pow(aa,4) + rt2*cos(zp3*at2) );
-	v3 = -2.0*zp1*rt3*sin(zp2*at2);
-	g1 = (v1+v2+v3);
-	
-	pq = log10(g1) - 6.0*log10(zp1) + 6.0*log10(ravg);
-	pq = pow(10,pq)*8.0*pi*pi*delrho*delrho;
-	
-	//
-	// beta factor is not used here, but could be for the 
-	// decoupling approximation
-	// 
-	//	g11 = g1
-	//	gd = -zp7*log(aa)
-	//	g1 = log(g11) + gd
-	//                       
-	//	t1 = zp1*at1
-	//	t2 = zp2*at1
-	//	g2 = sin( t1 ) - zp1/sqrt(aa*aa+1)*cos( t2 )
-	//	g22 = g2*g2
-	//	beta = zp1*log(aa) - zp1*log(aa*aa+1) - g1 + log(g22) 
-	//	beta = 2*alog(beta)
-	
-	//re-normalize by the average volume
-	vpoly = 4.0*pi/3.0*zp3*zp2/zp1/zp1*ravg*ravg*ravg;
-	pq /= vpoly;
-	//scale, convert to cm^-1
-	pq *= scale * 1.0e8;
-    
-    return(pq);
-}
-
-// scattering from a uniform sphere with a rectangular size distribution
-//
-double
-PolyRectSpheres(double dp[], double q)
-{
-	double pi,x;
-	double scale,rad,pd,cont,bkg;		//my local names
-	double inten,h1,qw,qr,width,sig,averad3,Rg2,slds,sld;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	
-	scale = dp[0];
-	rad = dp[1];		// radius (A)
-	pd = dp[2];		//polydispersity of rectangular distribution
-	slds = dp[3];
-	sld = dp[4];
-	cont = slds - sld;		// contrast (A^-2)
-	bkg = dp[5];
-	
-	// as usual, poly = sig/ravg
-	// for the rectangular distribution, sig = width/sqrt(3)
-	// width is the HALF- WIDTH of the rectangular distrubution
-	
-	sig = pd*rad;
-	width = sqrt(3.0)*sig;
-	
-	//x is the q-value
-	qw = x*width;
-	qr = x*rad;
-	
-	// as for the numerical inatabilities at low QR, the function is calculating the sines and cosines
-	// just fine - the problem seems to be that the 
-	// leading terms nearly cancel with the last term (the -6*qr... term), to within machine
-	// precision - the difference is on the order of 10^-20
-	// so just use the limiting Guiner value
-	if(qr<0.1) {
-		h1 = scale*cont*cont*1.e8*4.*pi/3.0*pow(rad,3);
-		h1 *= 	(1. + 15.*pow(pd,2) + 27.*pow(pd,4) +27./7.*pow(pd,6) );				//6th moment
-		h1 /= (1.+3.*pd*pd);	//3rd moment
-		Rg2 = 3.0/5.0*rad*rad*( 1.+28.*pow(pd,2)+126.*pow(pd,4)+108.*pow(pd,6)+27.*pow(pd,8) );
-		Rg2 /= (1.+15.*pow(pd,2)+27.*pow(pd,4)+27./7.*pow(pd,6));
-		h1 *= exp(-1./3.*Rg2*x*x);
-		h1 += bkg;
-		return(h1);
-	}
-	
-	// normal calculation
-	h1 = -0.5*qw + qr*qr*qw + (qw*qw*qw)/3.0;
-	h1 -= 5.0/2.0*cos(2.0*qr)*sin(qw)*cos(qw);
-	h1 += 0.5*qr*qr*cos(2.0*qr)*sin(2.0*qw);
-	h1 += 0.5*qw*qw*cos(2.0*qr)*sin(2.0*qw);
-	h1 += qw*qr*sin(2.0*qr)*cos(2.0*qw);
-	h1 += 3.0*qw*(cos(qr)*cos(qw))*(cos(qr)*cos(qw));
-	h1+= 3.0*qw*(sin(qr)*sin(qw))*(sin(qr)*sin(qw));
-	h1 -= 6.0*qr*cos(qr)*sin(qr)*cos(qw)*sin(qw);
-	
-	// calculate P(q) = <f^2>
-	inten = 8.0*pi*pi*cont*cont/width/pow(x,7)*h1;
-	
-	// beta(q) would be calculated as 2/width/x/h1*h2*h2
-	// with 
-	// h2 = 2*sin(x*rad)*sin(x*width)-x*rad*cos(x*rad)*sin(x*width)-x*width*sin(x*rad)*cos(x*width)
-	
-	// normalize to the average volume
-	// <R^3> = ravg^3*(1+3*pd^2)
-	// or... "zf"  = (1 + 3*p^2), which will be greater than one
-	
-	averad3 =  rad*rad*rad*(1.0+3.0*pd*pd);
-	inten /= 4.0*pi/3.0*averad3;
-	//resacle to 1/cm
-	inten *= 1.0e8;
-	//scale the result
-	inten *= scale;
-	// then add in the background
-	inten += bkg;
-	
-	return(inten);
-}
-
-
-// scattering from a uniform sphere with a Gaussian size distribution
-//
-double
-GaussPolySphere(double dp[], double q)
-{
-	double pi,x;
-	double scale,rad,pd,sig,rho,rhos,bkg,delrho;		//my local names
-	double va,vb,zi,yy,summ,inten;
-	int nord=20,ii;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	
-	scale=dp[0];
-	rad=dp[1];
-	pd=dp[2];
-	sig=pd*rad;
-	rho=dp[3];
-	rhos=dp[4];
-	delrho=rho-rhos;
-	bkg=dp[5];
-	
-	va = -4.0*sig + rad;
-	if (va<0.0) {
-		va=0.0;		//to avoid numerical error when  va<0 (-ve q-value)
-	}
-	vb = 4.0*sig +rad;
-	
-	summ = 0.0;		// initialize integral
-	for(ii=0;ii<nord;ii+=1) {
-		// calculate Gauss points on integration interval (r-value for evaluation)
-		zi = ( Gauss20Z[ii]*(vb-va) + vb + va )/2.0;
-		// calculate sphere scattering
-		//return(3*(sin(qr) - qr*cos(qr))/(qr*qr*qr)); pass qr
-		yy = F_func(x*zi)*(4.0*pi/3.0*zi*zi*zi)*delrho;
-		yy *= yy;
-		yy *= Gauss20Wt[ii] *  Gauss_distr(sig,rad,zi);
-		
-		summ += yy;		//add to the running total of the quadrature
-   	}
-	// calculate value of integral to return
-	inten = (vb-va)/2.0*summ;
-	
-	//re-normalize by polydisperse sphere volume
-	inten /= (4.0*pi/3.0*rad*rad*rad)*(1.0+3.0*pd*pd);
-	
-	inten *= 1.0e8;
-	inten *= scale;
-	inten += bkg;
-	
-    return(inten);	//scale, and add in the background
-}
-
-// scattering from a uniform sphere with a LogNormal size distribution
-//
-double
-LogNormalPolySphere(double dp[], double q)
-{
-	double pi,x;
-	double scale,rad,sig,rho,rhos,bkg,delrho,mu,r3;		//my local names
-	double va,vb,zi,yy,summ,inten;
-	int nord=76,ii;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	
-	scale=dp[0];
-	rad=dp[1];		//rad is the median radius
-	mu = log(dp[1]);
-	sig=dp[2];
-	rho=dp[3];
-	rhos=dp[4];
-	delrho=rho-rhos;
-	bkg=dp[5];
-	
-	va = -3.5*sig + mu;
-	va = exp(va);
-	if (va<0.0) {
-		va=0.0;		//to avoid numerical error when  va<0 (-ve q-value)
-	}
-	vb = 3.5*sig*(1.0+sig) +mu;
-	vb = exp(vb);
-	
-	summ = 0.0;		// initialize integral
-	for(ii=0;ii<nord;ii+=1) {
-		// calculate Gauss points on integration interval (r-value for evaluation)
-		zi = ( Gauss76Z[ii]*(vb-va) + vb + va )/2.0;
-		// calculate sphere scattering
-		//return(3*(sin(qr) - qr*cos(qr))/(qr*qr*qr)); pass qr
-		yy = F_func(x*zi)*(4.0*pi/3.0*zi*zi*zi)*delrho;
-		yy *= yy;
-		yy *= Gauss76Wt[ii] *  LogNormal_distr(sig,mu,zi);
-		
-		summ += yy;		//add to the running total of the quadrature
-   	}
-	// calculate value of integral to return
-	inten = (vb-va)/2.0*summ;
-	
-	//re-normalize by polydisperse sphere volume
-	r3 = exp(3.0*mu + 9.0/2.0*sig*sig);		// <R^3> directly
-	inten /= (4.0*pi/3.0*r3);		//polydisperse volume
-	
-	inten *= 1.0e8;
-	inten *= scale;
-	inten += bkg;
-	
-	return(inten);
-}
-
-/*
-static double
-LogNormal_distr(double sig, double mu, double pt)
-{	
-	double retval,pi;
-	
-	pi = 4.0*atan(1.0);
-	retval = (1.0/ (sig*pt*sqrt(2.0*pi)) )*exp( -0.5*(log(pt) - mu)*(log(pt) - mu)/sig/sig );
-	return(retval);
-}
-
-static double
-Gauss_distr(double sig, double avg, double pt)
-{	
-	double retval,Pi;
-	
-	Pi = 4.0*atan(1.0);
-	retval = (1.0/ (sig*sqrt(2.0*Pi)) )*exp(-(avg-pt)*(avg-pt)/sig/sig/2.0);
-	return(retval);
-}
-*/
-
-// scattering from a core shell sphere with a (Schulz) polydisperse core and constant ratio (shell thickness)/(core radius)
-// - the polydispersity is of the WHOLE sphere
-//
-double
-PolyCoreShellRatio(double dp[], double q)
-{
-	double pi,x;
-	double scale,corrad,thick,shlrad,pp,drho1,drho2,sig,zz,bkg;		//my local names
-	double sld1,sld2,sld3,zp1,zp2,zp3,vpoly;
-	double pi43,c1,c2,form,volume,arg1,arg2;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	
-	scale = dp[0];
-	corrad = dp[1];
-	thick = dp[2];
-	sig = dp[3];
-	sld1 = dp[4];
-	sld2 = dp[5];
-	sld3 = dp[6];
-	bkg = dp[7];
-	
-	zz = (1.0/sig)*(1.0/sig) - 1.0;   
-	shlrad = corrad + thick;
-	drho1 = sld1-sld2;		//core-shell
-	drho2 = sld2-sld3;		//shell-solvent
-	zp1 = zz + 1.;
-	zp2 = zz + 2.;
-	zp3 = zz + 3.;
-	vpoly = 4.0*pi/3.0*zp3*zp2/zp1/zp1*pow((corrad+thick),3);
-	
-	// the beta factor is not calculated
- 	// the calculated form factor <f^2> has units [length^2]
- 	// and must be multiplied by number density [l^-3] and the correct unit
- 	// conversion to get to absolute scale
-	
-	pi43=4.0/3.0*pi;
- 	pp=corrad/shlrad;
- 	volume=pi43*shlrad*shlrad*shlrad;
- 	c1=drho1*volume;
- 	c2=drho2*volume;
-	
-	arg1 = x*shlrad*pp;
-	arg2 = x*shlrad;
-	
-	form=pow(pp,6)*c1*c1*fnt2(arg1,zz);
-	form += c2*c2*fnt2(arg2,zz);
-	form += 2.0*c1*c2*fnt3(arg2,pp,zz);
-	
-	//convert the result to [cm^-1]
-	
-	//scale the result
-	// - divide by the polydisperse volume, mult by 10^8
-	form  /= vpoly;
-	form *= 1.0e8;
-	form *= scale;
-	
-	//add in the background
-	form += bkg;
-	
-	return(form);
-}
-
-//cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
-//c
-//c      function fnt2(y,z)
-//c
-double
-fnt2(double yy, double zz)
-{
-	double z1,z2,z3,u,ww,term1,term2,term3,ans;
-	
-	z1=zz+1.0;
-	z2=zz+2.0;
-	z3=zz+3.0;
-	u=yy/z1;
-	ww=atan(2.0*u);
-	term1=cos(z1*ww)/pow((1.0+4.0*u*u),(z1/2.0));
-	term2=2.0*yy*sin(z2*ww)/pow((1.0+4.0*u*u),(z2/2.0));
-	term3=1.0+cos(z3*ww)/pow((1.0+4.0*u*u),(z3/2.0));
-	ans=(4.50/z1/pow(yy,6))*(z1*(1.0-term1-term2)+yy*yy*z2*term3);
-	
-	return(ans);
-}
-
-//cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
-//c
-//c      function fnt3(y,p,z)
-//c
-double
-fnt3(double yy, double pp, double zz)
-{     	
-	double z1,z2,z3,yp,yn,up,un,vp,vn,term1,term2,term3,term4,term5,term6,ans;
-	
-	z1=zz+1.0;
-	z2=zz+2.0;
-	z3=zz+3.0;
-	yp=(1.0+pp)*yy;
-	yn=(1.0-pp)*yy;
-	up=yp/z1;
-	un=yn/z1;
-	vp=atan(up);
-	vn=atan(un);
-	term1=cos(z1*vn)/pow((1.0+un*un),(z1/2.0));
-	term2=cos(z1*vp)/pow((1.0+up*up),(z1/2.0));
-	term3=cos(z3*vn)/pow((1.0+un*un),(z3/2.0));
-	term4=cos(z3*vp)/pow((1.0+up*up),(z3/2.0));
-	term5=yn*sin(z2*vn)/pow((1.0+un*un),(z2/2.0));
-	term6=yp*sin(z2*vp)/pow((1.0+up*up),(z2/2.0));
-	ans=4.5/z1/pow(yy,6);
-	ans *=(z1*(term1-term2)+yy*yy*pp*z2*(term3+term4)+z1*(term5-term6));
-	
-	return(ans);
-}
-
-// scattering from a a binary population of hard spheres, 3 partial structure factors
-// are properly accounted for...
-//	 Input (fitting) variables are:
-//	larger sphere radius(angstroms) = guess[0]
-// 	smaller sphere radius (A) = w[1]
-//	number fraction of larger spheres = guess[2]
-//	total volume fraction of spheres = guess[3]
-//	size ratio, alpha(0<a<1) = derived
-//	SLD(A-2) of larger particle = guess[4]
-//	SLD(A-2) of smaller particle = guess[5]
-//	SLD(A-2) of the solvent = guess[6]
-//	background = guess[7]
-double
-BinaryHS(double dp[], double q)
-{
-	double x,pi;
-	double r2,r1,nf2,phi,aa,rho2,rho1,rhos,inten,bgd;		//my local names
-	double psf11,psf12,psf22;
-	double phi1,phi2,phr,a3;
-	double v1,v2,n1,n2,qr1,qr2,b1,b2,sc1,sc2;
-	int err;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	r2 = dp[0];
-	r1 = dp[1];
-	phi2 = dp[2];
-	phi1 = dp[3];
-	rho2 = dp[4];
-	rho1 = dp[5];
-	rhos = dp[6];
-	bgd = dp[7];
-	
-	
-	phi = phi1 + phi2;
-	aa = r1/r2;
-	//calculate the number fraction of larger spheres (eqn 2 in reference)
-	a3=aa*aa*aa;
-	phr=phi2/phi;
-	nf2 = phr*a3/(1.0-phr+phr*a3);
-	// calculate the PSF's here
-	err = ashcroft(x,r2,nf2,aa,phi,&psf11,&psf22,&psf12);
-	
-	// /* do form factor calculations  */
-	
-	v1 = 4.0*pi/3.0*r1*r1*r1;
-	v2 = 4.0*pi/3.0*r2*r2*r2;
-	
-	n1 = phi1/v1;
-	n2 = phi2/v2;
-	
-	qr1 = r1*x;
-	qr2 = r2*x;
-
-	if (qr1 == 0){
-		sc1 = 1.0/3.0;
-	}else{
-		sc1 = (sin(qr1)-qr1*cos(qr1))/qr1/qr1/qr1;
-	}
-	if (qr2 == 0){
-		sc2 = 1.0/3.0;
-	}else{
-		sc2 = (sin(qr2)-qr2*cos(qr2))/qr2/qr2/qr2;
-	}
-	b1 = r1*r1*r1*(rho1-rhos)*4.0*pi*sc1;
-	b2 = r2*r2*r2*(rho2-rhos)*4.0*pi*sc2;
-	inten = n1*b1*b1*psf11;
-	inten += sqrt(n1*n2)*2.0*b1*b2*psf12;
-	inten += n2*b2*b2*psf22;
-	///* convert I(1/A) to (1/cm)  */
-	inten *= 1.0e8;
-	
-	inten += bgd;
-	
-	return(inten);
-}
-
-double
-BinaryHS_PSF11(double dp[], double q)
-{
-	double x,pi;
-	double r2,r1,nf2,phi,aa,rho2,rho1,rhos,bgd;		//my local names
-	double psf11,psf12,psf22;
-	double phi1,phi2,phr,a3;
-	int err;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	r2 = dp[0];
-	r1 = dp[1];
-	phi2 = dp[2];
-	phi1 = dp[3];
-	rho2 = dp[4];
-	rho1 = dp[5];
-	rhos = dp[6];
-	bgd = dp[7];
-	phi = phi1 + phi2;
-	aa = r1/r2;
-	//calculate the number fraction of larger spheres (eqn 2 in reference)
-	a3=aa*aa*aa;
-	phr=phi2/phi;
-	nf2 = phr*a3/(1.0-phr+phr*a3);
-	// calculate the PSF's here
-	err = ashcroft(x,r2,nf2,aa,phi,&psf11,&psf22,&psf12);
-	
-    return(psf11);	//scale, and add in the background
-}
-
-double
-BinaryHS_PSF12(double dp[], double q)
-{
-	double x,pi;
-	double r2,r1,nf2,phi,aa,rho2,rho1,rhos,bgd;		//my local names
-	double psf11,psf12,psf22;
-	double phi1,phi2,phr,a3;
-	int err;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	r2 = dp[0];
-	r1 = dp[1];
-	phi2 = dp[2];
-	phi1 = dp[3];
-	rho2 = dp[4];
-	rho1 = dp[5];
-	rhos = dp[6];
-	bgd = dp[7];
-	phi = phi1 + phi2;
-	aa = r1/r2;
-	//calculate the number fraction of larger spheres (eqn 2 in reference)
-	a3=aa*aa*aa;
-	phr=phi2/phi;
-	nf2 = phr*a3/(1.0-phr+phr*a3);
-	// calculate the PSF's here
-	err = ashcroft(x,r2,nf2,aa,phi,&psf11,&psf22,&psf12);
-	
-    return(psf12);	//scale, and add in the background
-}
-
-double
-BinaryHS_PSF22(double dp[], double q)
-{
-	double x,pi;
-	double r2,r1,nf2,phi,aa,rho2,rho1,rhos,bgd;		//my local names
-	double psf11,psf12,psf22;
-	double phi1,phi2,phr,a3;
-	int err;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	
-	r2 = dp[0];
-	r1 = dp[1];
-	phi2 = dp[2];
-	phi1 = dp[3];
-	rho2 = dp[4];
-	rho1 = dp[5];
-	rhos = dp[6];
-	bgd = dp[7];
-	phi = phi1 + phi2;
-	aa = r1/r2;
-	//calculate the number fraction of larger spheres (eqn 2 in reference)
-	a3=aa*aa*aa;
-	phr=phi2/phi;
-	nf2 = phr*a3/(1.0-phr+phr*a3);
-	// calculate the PSF's here
-	err = ashcroft(x,r2,nf2,aa,phi,&psf11,&psf22,&psf12);
-	
-    return(psf22);	//scale, and add in the background
-}
-
-int
-ashcroft(double qval, double r2, double nf2, double aa, double phi, double *s11, double *s22, double *s12)
-{
-	//	variable qval,r2,nf2,aa,phi,&s11,&s22,&s12
-	
-	//   calculate constant terms
-	double s1,s2,v,a3,v1,v2,g11,g12,g22,wmv,wmv3,wmv4;
-	double a1,a2i,a2,b1,b2,b12,gm1,gm12;
-	double err=0.0,yy,ay,ay2,ay3,t1,t2,t3,f11,y2,y3,tt1,tt2,tt3;
-	double c11,c22,c12,f12,f22,ttt1,ttt2,ttt3,ttt4,yl,y13;
-	double t21,t22,t23,t31,t32,t33,t41,t42,yl3,wma3,y1;
-	
-	s2 = 2.0*r2;
-	s1 = aa*s2;
-	v = phi;
-	a3 = aa*aa*aa;
-	v1=((1.-nf2)*a3/(nf2+(1.-nf2)*a3))*v;
-	v2=(nf2/(nf2+(1.-nf2)*a3))*v;
-	g11=((1.+.5*v)+1.5*v2*(aa-1.))/(1.-v)/(1.-v);
-	g22=((1.+.5*v)+1.5*v1*(1./aa-1.))/(1.-v)/(1.-v);
-	g12=((1.+.5*v)+1.5*(1.-aa)*(v1-v2)/(1.+aa))/(1.-v)/(1.-v);
-	wmv = 1/(1.-v);
-	wmv3 = wmv*wmv*wmv;
-	wmv4 = wmv*wmv3;
-	a1=3.*wmv4*((v1+a3*v2)*(1.+v+v*v)-3.*v1*v2*(1.-aa)*(1.-aa)*(1.+v1+aa*(1.+v2))) + ((v1+a3*v2)*(1.+2.*v)+(1.+v+v*v)-3.*v1*v2*(1.-aa)*(1.-aa)-3.*v2*(1.-aa)*(1.-aa)*(1.+v1+aa*(1.+v2)))*wmv3;
-	a2i=((v1+a3*v2)*(1.+v+v*v)-3.*v1*v2*(1.-aa)*(1.-aa)*(1.+v1+aa*(1.+v2)))*3*wmv4 + ((v1+a3*v2)*(1.+2.*v)+a3*(1.+v+v*v)-3.*v1*v2*(1.-aa)*(1.-aa)*aa-3.*v1*(1.-aa)*(1.-aa)*(1.+v1+aa*(1.+v2)))*wmv3;
-	a2=a2i/a3;
-	b1=-6.*(v1*g11*g11+.25*v2*(1.+aa)*(1.+aa)*aa*g12*g12);
-	b2=-6.*(v2*g22*g22+.25*v1/a3*(1.+aa)*(1.+aa)*g12*g12);
-	b12=-3.*aa*(1.+aa)*(v1*g11/aa/aa+v2*g22)*g12;
-	gm1=(v1*a1+a3*v2*a2)*.5;
-	gm12=2.*gm1*(1.-aa)/aa;
-	//c  
-	//c   calculate the direct correlation functions and print results
-	//c
-	//	do 20 j=1,npts
-	
-	yy=qval*s2;
-	//c   calculate direct correlation functions
-	//c   ----c11
-	ay=aa*yy;
-	ay2 = ay*ay;
-	ay3 = ay*ay*ay;
-	t1=a1*(sin(ay)-ay*cos(ay));
-	t2=b1*(2.*ay*sin(ay)-(ay2-2.)*cos(ay)-2.)/ay;
-	t3=gm1*((4.*ay*ay2-24.*ay)*sin(ay)-(ay2*ay2-12.*ay2+24.)*cos(ay)+24.)/ay3;
-	f11=24.*v1*(t1+t2+t3)/ay3;
-	
-	//c ------c22
-	y2=yy*yy;
-	y3=yy*y2;
-	tt1=a2*(sin(yy)-yy*cos(yy));
-	tt2=b2*(2.*yy*sin(yy)-(y2-2.)*cos(yy)-2.)/yy;
-	tt3=gm1*((4.*y3-24.*yy)*sin(yy)-(y2*y2-12.*y2+24.)*cos(yy)+24.)/ay3;
-	f22=24.*v2*(tt1+tt2+tt3)/y3;
-	
-	//c   -----c12
-	yl=.5*yy*(1.-aa);
-	yl3=yl*yl*yl;
-	wma3 = (1.-aa)*(1.-aa)*(1.-aa);
-	y1=aa*yy;
-	y13 = y1*y1*y1;
-	ttt1=3.*wma3*v*sqrt(nf2)*sqrt(1.-nf2)*a1*(sin(yl)-yl*cos(yl))/((nf2+(1.-nf2)*a3)*yl3);
-	t21=b12*(2.*y1*cos(y1)+(y1*y1-2.)*sin(y1));
-	t22=gm12*((3.*y1*y1-6.)*cos(y1)+(y1*y1*y1-6.*y1)*sin(y1)+6.)/y1;
-	t23=gm1*((4.*y13-24.*y1)*cos(y1)+(y13*y1-12.*y1*y1+24.)*sin(y1))/(y1*y1);
-	t31=b12*(2.*y1*sin(y1)-(y1*y1-2.)*cos(y1)-2.);
-	t32=gm12*((3.*y1*y1-6.)*sin(y1)-(y1*y1*y1-6.*y1)*cos(y1))/y1;
-  	t33=gm1*((4.*y13-24.*y1)*sin(y1)-(y13*y1-12.*y1*y1+24.)*cos(y1)+24.)/(y1*y1);
-	t41=cos(yl)*((sin(y1)-y1*cos(y1))/(y1*y1) + (1.-aa)/(2.*aa)*(1.-cos(y1))/y1);
-	t42=sin(yl)*((cos(y1)+y1*sin(y1)-1.)/(y1*y1) + (1.-aa)/(2.*aa)*sin(y1)/y1);
-	ttt2=sin(yl)*(t21+t22+t23)/(y13*y1);
-	ttt3=cos(yl)*(t31+t32+t33)/(y13*y1);
-	ttt4=a1*(t41+t42)/y1;
-	f12=ttt1+24.*v*sqrt(nf2)*sqrt(1.-nf2)*a3*(ttt2+ttt3+ttt4)/(nf2+(1.-nf2)*a3);
-	
-	c11=f11;
-	c22=f22;
-	c12=f12;
-	*s11=1./(1.+c11-(c12)*c12/(1.+c22));
-	*s22=1./(1.+c22-(c12)*c12/(1.+c11)); 
-	*s12=-c12/((1.+c11)*(1.+c22)-(c12)*(c12));   
-	
-	return(err);
-}
-
-
-
-/*
- // calculates the scattering from a spherical particle made up of a core (aqueous) surrounded
- // by N spherical layers, each of which is a PAIR of shells, solvent + surfactant since there
- //must always be a surfactant layer on the outside
- //
- // bragg peaks arise naturally from the periodicity of the sample
- // resolution smeared version gives he most appropriate view of the model
- 
-	Warning:
- The call to WaveData() below returns a pointer to the middle
- of an unlocked Macintosh handle. In the unlikely event that your
- calculations could cause memory to move, you should copy the coefficient
- values to local variables or an array before such operations.
- */
-double
-MultiShell(double dp[], double q)
-{
-	double x;
-	double scale,rcore,tw,ts,rhocore,rhoshel,num,bkg;		//my local names
-	int ii;
-	double fval,voli,ri,sldi;
-	double pi;
-	
-	pi = 4.0*atan(1.0);
-	
-	x= q;
-	scale = dp[0];
-	rcore = dp[1];
-	ts = dp[2];
-	tw = dp[3];
-	rhocore = dp[4];
-	rhoshel = dp[5];
-	num = dp[6];
-	bkg = dp[7];
-	
-	//calculate with a loop, two shells at a time
-	
-	ii=0;
-	fval=0.0;
-	
-	do {
-		ri = rcore + (double)ii*ts + (double)ii*tw;
-		voli = 4.0*pi/3.0*ri*ri*ri;
-		sldi = rhocore-rhoshel;
-		fval += voli*sldi*F_func(ri*x);
-		ri += ts;
-		voli = 4.0*pi/3.0*ri*ri*ri;
-		sldi = rhoshel-rhocore;
-		fval += voli*sldi*F_func(ri*x);
-		ii+=1;		//do 2 layers at a time
-	} while(ii<=num-1);  //change to make 0 < num < 2 correspond to unilamellar vesicles (C. Glinka, 11/24/03)
-	
-	fval *= fval;		//square it
-	fval /= voli;		//normalize by the overall volume
-	fval *= scale*1.0e8;
-	fval += bkg;
-	
-	return(fval);
-}
-
-/*
- // calculates the scattering from a POLYDISPERSE spherical particle made up of a core (aqueous) surrounded
- // by N spherical layers, each of which is a PAIR of shells, solvent + surfactant since there
- //must always be a surfactant layer on the outside
- //
- // bragg peaks arise naturally from the periodicity of the sample
- // resolution smeared version gives he most appropriate view of the model
- //
- // Polydispersity is of the total (outer) radius. This is converted into a distribution of MLV's
- // with integer numbers of layers, with a minimum of one layer... a vesicle... depending
- // on the parameters, the "distribution" of MLV's that is used may be truncated
- //
-	Warning:
- The call to WaveData() below returns a pointer to the middle
- of an unlocked Macintosh handle. In the unlikely event that your
- calculations could cause memory to move, you should copy the coefficient
- values to local variables or an array before such operations.
- */
-double
-PolyMultiShell(double dp[], double q)
-{
-	double x;
-	double scale,rcore,tw,ts,rhocore,rhoshel,bkg;		//my local names
-	int ii,minPairs,maxPairs,first;
-	double fval,ri,pi;
-	double avg,pd,zz,lo,hi,r1,r2,d1,d2,distr;
-	
-	pi = 4.0*atan(1.0);	
-	x= q;
-	
-	scale = dp[0];
-	avg = dp[1];		// average (total) outer radius
-	pd = dp[2];
-	rcore = dp[3];
-	ts = dp[4];
-	tw = dp[5];
-	rhocore = dp[6];
-	rhoshel = dp[7];
-	bkg = dp[8];
-	
-	zz = (1.0/pd)*(1.0/pd)-1.0;
-	
-	//max radius set to be 5 std deviations past mean
-	hi = avg + pd*avg*5.0;
-	lo = avg - pd*avg*5.0;
-	
-	maxPairs = trunc( (hi-rcore+tw)/(ts+tw) );
-	minPairs = trunc( (lo-rcore+tw)/(ts+tw) );
-	minPairs = (minPairs < 1) ? 1 : minPairs;	// need a minimum of one
-	
-	ii=minPairs;
-	fval=0.0;
-	d1 = 0.0;
-	d2 = 0.0;
-	r1 = 0.0;
-	r2 = 0.0;
-	distr = 0.0;
-	first = 1.0;
-	do {
-		//make the current values old
-		r1 = r2;
-		d1 = d2;
-		
-		ri = (double)ii*(ts+tw) - tw + rcore;
-		fval += SchulzPoint(ri,avg,zz) * MultiShellGuts(x, rcore, ts, tw, rhocore, rhoshel, ii) * (4*pi/3*ri*ri*ri);
-		// get a running integration of the fraction of the distribution used, but not the first time
-		r2 = ri;
-		d2 = SchulzPoint(ri,avg,zz);
-		if( !first ) {
-			distr += 0.5*(d1+d2)*(r2-r1);		//cheap trapezoidal integration
-		}
-		ii+=1;
-		first = 0;
-	} while(ii<=maxPairs);
-	
-	fval /= 4.0*pi/3.0*avg*avg*avg;		//normalize by the overall volume
-	fval /= distr;
-	fval *= scale;
-	fval += bkg;
-	
-	return(fval);
-}
-
-double
-MultiShellGuts(double x,double rcore,double ts,double tw,double rhocore,double rhoshel,int num) {
-	
-    double ri,sldi,fval,voli,pi;
-    int ii;
-    
-	pi = 4.0*atan(1.0);
-    ii=0;
-    fval=0.0;
-    
-    do {
-        ri = rcore + (double)ii*ts + (double)ii*tw;
-        voli = 4.0*pi/3.0*ri*ri*ri;
-        sldi = rhocore-rhoshel;
-        fval += voli*sldi*F_func(ri*x);
-        ri += ts;
-        voli = 4.0*pi/3.0*ri*ri*ri;
-        sldi = rhoshel-rhocore;
-        fval += voli*sldi*F_func(ri*x);
-        ii+=1;		//do 2 layers at a time
-    } while(ii<=num-1);  //change to make 0 < num < 2 correspond to unilamellar vesicles (C. Glinka, 11/24/03)
-    
-    fval *= fval;
-    fval /= voli;
-    fval *= 1.0e8;
-    
-    return(fval);	// this result still needs to be multiplied by scale and have background added
-}
-
-/*
-static double
-SchulzPoint(double x, double avg, double zz) {
-	
-    double dr;
-    
-    dr = zz*log(x) - gammln(zz+1.0)+(zz+1.0)*log((zz+1.0)/avg)-(x/avg*(zz+1.0));
-    return (exp(dr));
-}
-
-static double
-gammln(double xx) {
-	
-    double x,y,tmp,ser;
-    static double cof[6]={76.18009172947146,-86.50532032941677,
-		24.01409824083091,-1.231739572450155,
-		0.1208650973866179e-2,-0.5395239384953e-5};
-    int j;
-	
-    y=x=xx;
-    tmp=x+5.5;
-    tmp -= (x+0.5)*log(tmp);
-    ser=1.000000000190015;
-    for (j=0;j<=5;j++) ser += cof[j]/++y;
-    return -tmp+log(2.5066282746310005*ser/x);
-}
-*/
-
-double
-F_func(double qr) {
-	double sc;
-	if (qr == 0.0){
-		sc = 1.0;
-	}else{
-		sc=(3.0*(sin(qr) - qr*cos(qr))/(qr*qr*qr));
-	}
-	return sc;
-}
-
-double
-OneShell(double dp[], double q)
-{
-	// variables are:
-	//[0] scale factor
-	//[1] radius of core [ï¿œ]
-	//[2] SLD of the core	[ï¿œ-2]
-	//[3] thickness of the shell	[ï¿œ]
-	//[4] SLD of the shell
-	//[5] SLD of the solvent
-	//[6] background	[cm-1]
-	
-	double x,pi;
-	double scale,rcore,thick,rhocore,rhoshel,rhosolv,bkg;		//my local names
-	double bes,f,vol,qr,contr,f2;
-	
-	pi = 4.0*atan(1.0);
-	x=q;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	rhocore = dp[2];
-	thick = dp[3];
-	rhoshel = dp[4];
-	rhosolv = dp[5];
-	bkg = dp[6];
-	
-	// core first, then add in shell
-	qr=x*rcore;
-	contr = rhocore-rhoshel;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*rcore*rcore*rcore;
-	f = vol*bes*contr;
-	//now the shell
-	qr=x*(rcore+thick);
-	contr = rhoshel-rhosolv;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*pow((rcore+thick),3);
-	f += vol*bes*contr;
-	
-	// normalize to particle volume and rescale from [ï¿œ-1] to [cm-1]
-	f2 = f*f/vol*1.0e8;
-	
-	//scale if desired
-	f2 *= scale;
-	// then add in the background
-	f2 += bkg;
-	
-	return(f2);
-}
-
-double
-TwoShell(double dp[], double q)
-{
-	// variables are:
-	//[0] scale factor
-	//[1] radius of core [ï¿œ]
-	//[2] SLD of the core	[ï¿œ-2]
-	//[3] thickness of shell 1 [ï¿œ]
-	//[4] SLD of shell 1
-	//[5] thickness of shell 2 [ï¿œ]
-	//[6] SLD of shell 2
-	//[7] SLD of the solvent
-	//[8] background	[cm-1]
-	
-	double x,pi;
-	double scale,rcore,thick1,rhocore,rhoshel1,rhosolv,bkg;		//my local names
-	double bes,f,vol,qr,contr,f2;
-	double rhoshel2,thick2;
-	
-	pi = 4.0*atan(1.0);
-	x=q;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	rhocore = dp[2];
-	thick1 = dp[3];
-	rhoshel1 = dp[4];
-	thick2 = dp[5];
-	rhoshel2 = dp[6];	
-	rhosolv = dp[7];
-	bkg = dp[8];
-		// core first, then add in shells
-	qr=x*rcore;
-	contr = rhocore-rhoshel1;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*rcore*rcore*rcore;
-	f = vol*bes*contr;
-	//now the shell (1)
-	qr=x*(rcore+thick1);
-	contr = rhoshel1-rhoshel2;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1)*(rcore+thick1)*(rcore+thick1);
-	f += vol*bes*contr;
-	//now the shell (2)
-	qr=x*(rcore+thick1+thick2);
-	contr = rhoshel2-rhosolv;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1+thick2)*(rcore+thick1+thick2)*(rcore+thick1+thick2);
-	f += vol*bes*contr;
-	
-		
-	// normalize to particle volume and rescale from [ï¿œ-1] to [cm-1]
-	f2 = f*f/vol*1.0e8;
-	
-	//scale if desired
-	f2 *= scale;
-	// then add in the background
-	f2 += bkg;
-	
-	return(f2);
-}
-
-double
-ThreeShell(double dp[], double q)
-{
-	// variables are:
-	//[0] scale factor
-	//[1] radius of core [ï¿œ]
-	//[2] SLD of the core	[ï¿œ-2]
-	//[3] thickness of shell 1 [ï¿œ]
-	//[4] SLD of shell 1
-	//[5] thickness of shell 2 [ï¿œ]
-	//[6] SLD of shell 2
-	//[7] thickness of shell 3
-	//[8] SLD of shell 3
-	//[9] SLD of solvent
-	//[10] background	[cm-1]
-	
-	double x,pi;
-	double scale,rcore,thick1,rhocore,rhoshel1,rhosolv,bkg;		//my local names
-	double bes,f,vol,qr,contr,f2;
-	double rhoshel2,thick2,rhoshel3,thick3;
-	
-	pi = 4.0*atan(1.0);
-	x=q;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	rhocore = dp[2];
-	thick1 = dp[3];
-	rhoshel1 = dp[4];
-	thick2 = dp[5];
-	rhoshel2 = dp[6];	
-	thick3 = dp[7];
-	rhoshel3 = dp[8];	
-	rhosolv = dp[9];
-	bkg = dp[10];
-	
-		// core first, then add in shells
-	qr=x*rcore;
-	contr = rhocore-rhoshel1;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*rcore*rcore*rcore;
-	f = vol*bes*contr;
-	//now the shell (1)
-	qr=x*(rcore+thick1);
-	contr = rhoshel1-rhoshel2;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1)*(rcore+thick1)*(rcore+thick1);
-	f += vol*bes*contr;
-	//now the shell (2)
-	qr=x*(rcore+thick1+thick2);
-	contr = rhoshel2-rhoshel3;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1+thick2)*(rcore+thick1+thick2)*(rcore+thick1+thick2);
-	f += vol*bes*contr;
-	//now the shell (3)
-	qr=x*(rcore+thick1+thick2+thick3);
-	contr = rhoshel3-rhosolv;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1+thick2+thick3)*(rcore+thick1+thick2+thick3)*(rcore+thick1+thick2+thick3);
-	f += vol*bes*contr;
-		
-	// normalize to particle volume and rescale from [ï¿œ-1] to [cm-1]
-	f2 = f*f/vol*1.0e8;
-	
-	//scale if desired
-	f2 *= scale;
-	// then add in the background
-	f2 += bkg;
-	
-	return(f2);
-}
-
-double
-FourShell(double dp[], double q)
-{
-	// variables are:
-	//[0] scale factor
-	//[1] radius of core [ï¿œ]
-	//[2] SLD of the core	[ï¿œ-2]
-	//[3] thickness of shell 1 [ï¿œ]
-	//[4] SLD of shell 1
-	//[5] thickness of shell 2 [ï¿œ]
-	//[6] SLD of shell 2
-	//[7] thickness of shell 3
-	//[8] SLD of shell 3
-	//[9] thickness of shell 3
-	//[10] SLD of shell 3
-	//[11] SLD of solvent
-	//[12] background	[cm-1]
-	
-	double x,pi;
-	double scale,rcore,thick1,rhocore,rhoshel1,rhosolv,bkg;		//my local names
-	double bes,f,vol,qr,contr,f2;
-	double rhoshel2,thick2,rhoshel3,thick3,rhoshel4,thick4;
-	
-	pi = 4.0*atan(1.0);
-	x=q;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	rhocore = dp[2];
-	thick1 = dp[3];
-	rhoshel1 = dp[4];
-	thick2 = dp[5];
-	rhoshel2 = dp[6];	
-	thick3 = dp[7];
-	rhoshel3 = dp[8];
-	thick4 = dp[9];
-	rhoshel4 = dp[10];	
-	rhosolv = dp[11];
-	bkg = dp[12];
-	
-		// core first, then add in shells
-	qr=x*rcore;
-	contr = rhocore-rhoshel1;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*rcore*rcore*rcore;
-	f = vol*bes*contr;
-	//now the shell (1)
-	qr=x*(rcore+thick1);
-	contr = rhoshel1-rhoshel2;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1)*(rcore+thick1)*(rcore+thick1);
-	f += vol*bes*contr;
-	//now the shell (2)
-	qr=x*(rcore+thick1+thick2);
-	contr = rhoshel2-rhoshel3;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1+thick2)*(rcore+thick1+thick2)*(rcore+thick1+thick2);
-	f += vol*bes*contr;
-	//now the shell (3)
-	qr=x*(rcore+thick1+thick2+thick3);
-	contr = rhoshel3-rhoshel4;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1+thick2+thick3)*(rcore+thick1+thick2+thick3)*(rcore+thick1+thick2+thick3);
-	f += vol*bes*contr;
-	//now the shell (4)
-	qr=x*(rcore+thick1+thick2+thick3+thick4);
-	contr = rhoshel4-rhosolv;
-	if(qr == 0){
-		bes = 1.0;
-	}else{
-		bes = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);
-	}
-	vol = 4.0*pi/3.0*(rcore+thick1+thick2+thick3+thick4)*(rcore+thick1+thick2+thick3+thick4)*(rcore+thick1+thick2+thick3+thick4);
-	f += vol*bes*contr;
-	
-		
-	// normalize to particle volume and rescale from [ï¿œ-1] to [cm-1]
-	f2 = f*f/vol*1.0e8;
-	
-	//scale if desired
-	f2 *= scale;
-	// then add in the background
-	f2 += bkg;
-	
-	return(f2);
-}
-
-double
-PolyOneShell(double dp[], double x)
-{
-	double scale,rcore,thick,rhocore,rhoshel,rhosolv,bkg,pd,zz;		//my local names
-	double va,vb,summ,yyy,zi;
-	double answer,zp1,zp2,zp3,vpoly,range,temp_1sf[7],pi;
-	int nord=76,ii;
-	
-	pi = 4.0*atan(1.0);
-	
-	scale = dp[0];
-	rcore = dp[1];
-	pd = dp[2];
-	rhocore = dp[3];
-	thick = dp[4];
-	rhoshel = dp[5];
-	rhosolv = dp[6];
-	bkg = dp[7];
-		
-	zz = (1.0/pd)*(1.0/pd)-1.0;		//polydispersity of the core only
-	
-	range = 8.0;			//std deviations for the integration
-	va = rcore*(1.0-range*pd);
-	if (va<0.0) {
-		va=0.0;		//otherwise numerical error when pd >= 0.3, making a<0
-	}
-	if (pd>0.3) {
-		range = range + (pd-0.3)*18.0;		//stretch upper range to account for skewed tail
-	}
-	vb = rcore*(1.0+range*pd);		// is this far enough past avg radius?
-	
-	//temp set scale=1 and bkg=0 for quadrature calc
-	temp_1sf[0] = 1.0;
-	temp_1sf[1] = dp[1];	//the core radius will be changed in the loop
-	temp_1sf[2] = dp[3];
-	temp_1sf[3] = dp[4];
-	temp_1sf[4] = dp[5];
-	temp_1sf[5] = dp[6];
-	temp_1sf[6] = 0.0;
-	
-	summ = 0.0;		// initialize integral
-	for(ii=0;ii<nord;ii+=1) {
-		// calculate Gauss points on integration interval (r-value for evaluation)
-		zi = ( Gauss76Z[ii]*(vb-va) + vb + va )/2.0;
-		temp_1sf[1] = zi;
-		yyy = Gauss76Wt[ii] * SchulzPoint(zi,rcore,zz) * OneShell(temp_1sf,x);
-		//un-normalize by volume
-		yyy *= 4.0*pi/3.0*pow((zi+thick),3);
-		summ += yyy;		//add to the running total of the quadrature
-   	}
-	// calculate value of integral to return
-	answer = (vb-va)/2.0*summ;
-   	
-	//re-normalize by the average volume
-	zp1 = zz + 1.0;
-	zp2 = zz + 2.0;
-	zp3 = zz + 3.0;
-	vpoly = 4.0*pi/3.0*zp3*zp2/zp1/zp1*pow((rcore+thick),3);
-	answer /= vpoly;
-//scale
-	answer *= scale;
-// add in the background
-	answer += bkg;
-		
-    return(answer);
-}
-
-double
-PolyTwoShell(double dp[], double x)
-{
-	double scale,rcore,rhocore,rhosolv,bkg,pd,zz;		//my local names
-	double va,vb,summ,yyy,zi;
-	double answer,zp1,zp2,zp3,vpoly,range,temp_2sf[9],pi;
-	int nord=76,ii;
-	double thick1,thick2;
-	double rhoshel1,rhoshel2;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	pd = dp[2];
-	rhocore = dp[3];
-	thick1 = dp[4];
-	rhoshel1 = dp[5];
-	thick2 = dp[6];
-	rhoshel2 = dp[7];
-	rhosolv = dp[8];
-	bkg = dp[9];
-	
-	pi = 4.0*atan(1.0);
-		
-	zz = (1.0/pd)*(1.0/pd)-1.0;		//polydispersity of the core only
-	
-	range = 8.0;			//std deviations for the integration
-	va = rcore*(1.0-range*pd);
-	if (va<0.0) {
-		va=0.0;		//otherwise numerical error when pd >= 0.3, making a<0
-	}
-	if (pd>0.3) {
-		range = range + (pd-0.3)*18.0;		//stretch upper range to account for skewed tail
-	}
-	vb = rcore*(1.0+range*pd);		// is this far enough past avg radius?
-	
-	//temp set scale=1 and bkg=0 for quadrature calc
-	temp_2sf[0] = 1.0;
-	temp_2sf[1] = dp[1];		//the core radius will be changed in the loop
-	temp_2sf[2] = dp[3];
-	temp_2sf[3] = dp[4];
-	temp_2sf[4] = dp[5];
-	temp_2sf[5] = dp[6];
-	temp_2sf[6] = dp[7];
-	temp_2sf[7] = dp[8];
-	temp_2sf[8] = 0.0;
-	
-	summ = 0.0;		// initialize integral
-	for(ii=0;ii<nord;ii+=1) {
-		// calculate Gauss points on integration interval (r-value for evaluation)
-		zi = ( Gauss76Z[ii]*(vb-va) + vb + va )/2.0;
-		temp_2sf[1] = zi;
-		yyy = Gauss76Wt[ii] * SchulzPoint(zi,rcore,zz) * TwoShell(temp_2sf,x);
-		//un-normalize by volume
-		yyy *= 4.0*pi/3.0*pow((zi+thick1+thick2),3);
-		summ += yyy;		//add to the running total of the quadrature
-   	}
-	// calculate value of integral to return
-	answer = (vb-va)/2.0*summ;
-   	
-	//re-normalize by the average volume
-	zp1 = zz + 1.0;
-	zp2 = zz + 2.0;
-	zp3 = zz + 3.0;
-	vpoly = 4.0*pi/3.0*zp3*zp2/zp1/zp1*pow((rcore+thick1+thick2),3);
-	answer /= vpoly;
-//scale
-	answer *= scale;
-// add in the background
-	answer += bkg;
-		
-    return(answer);
-}
-
-double
-PolyThreeShell(double dp[], double x)
-{
-	double scale,rcore,rhocore,rhosolv,bkg,pd,zz;		//my local names
-	double va,vb,summ,yyy,zi;
-	double answer,zp1,zp2,zp3,vpoly,range,temp_3sf[11],pi;
-	int nord=76,ii;
-	double thick1,thick2,thick3;
-	double rhoshel1,rhoshel2,rhoshel3;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	pd = dp[2];
-	rhocore = dp[3];
-	thick1 = dp[4];
-	rhoshel1 = dp[5];
-	thick2 = dp[6];
-	rhoshel2 = dp[7];
-	thick3 = dp[8];
-	rhoshel3 = dp[9];
-	rhosolv = dp[10];
-	bkg = dp[11];
-	
-	pi = 4.0*atan(1.0);
-		
-	zz = (1.0/pd)*(1.0/pd)-1.0;		//polydispersity of the core only
-	
-	range = 8.0;			//std deviations for the integration
-	va = rcore*(1.0-range*pd);
-	if (va<0) {
-		va=0;		//otherwise numerical error when pd >= 0.3, making a<0
-	}
-	if (pd>0.3) {
-		range = range + (pd-0.3)*18.0;		//stretch upper range to account for skewed tail
-	}
-	vb = rcore*(1.0+range*pd);		// is this far enough past avg radius?
-	
-	//temp set scale=1 and bkg=0 for quadrature calc
-	temp_3sf[0] = 1.0;
-	temp_3sf[1] = dp[1];		//the core radius will be changed in the loop
-	temp_3sf[2] = dp[3];
-	temp_3sf[3] = dp[4];
-	temp_3sf[4] = dp[5];
-	temp_3sf[5] = dp[6];
-	temp_3sf[6] = dp[7];
-	temp_3sf[7] = dp[8];
-	temp_3sf[8] = dp[9];
-	temp_3sf[9] = dp[10];
-	temp_3sf[10] = 0.0;
-	
-	summ = 0.0;		// initialize integral
-	for(ii=0;ii<nord;ii+=1) {
-		// calculate Gauss points on integration interval (r-value for evaluation)
-		zi = ( Gauss76Z[ii]*(vb-va) + vb + va )/2.0;
-		temp_3sf[1] = zi;
-		yyy = Gauss76Wt[ii] * SchulzPoint(zi,rcore,zz) * ThreeShell(temp_3sf,x);
-		//un-normalize by volume
-		yyy *= 4.0*pi/3.0*pow((zi+thick1+thick2+thick3),3);
-		summ += yyy;		//add to the running total of the quadrature
-   	}
-	// calculate value of integral to return
-	answer = (vb-va)/2.0*summ;
-   	
-	//re-normalize by the average volume
-	zp1 = zz + 1.0;
-	zp2 = zz + 2.0;
-	zp3 = zz + 3.0;
-	vpoly = 4.0*pi/3.0*zp3*zp2/zp1/zp1*pow((rcore+thick1+thick2+thick3),3);
-	answer /= vpoly;
-//scale
-	answer *= scale;
-// add in the background
-	answer += bkg;
-		
-    return(answer);
-}
-
-double
-PolyFourShell(double dp[], double x)
-{
-	double scale,rcore,rhocore,rhosolv,bkg,pd,zz;		//my local names
-	double va,vb,summ,yyy,zi;
-	double answer,zp1,zp2,zp3,vpoly,range,temp_4sf[13],pi;
-	int nord=76,ii;
-	double thick1,thick2,thick3,thick4;
-	double rhoshel1,rhoshel2,rhoshel3,rhoshel4;
-	
-	scale = dp[0];
-	rcore = dp[1];
-	pd = dp[2];
-	rhocore = dp[3];
-	thick1 = dp[4];
-	rhoshel1 = dp[5];
-	thick2 = dp[6];
-	rhoshel2 = dp[7];
-	thick3 = dp[8];
-	rhoshel3 = dp[9];
-	thick4 = dp[10];
-	rhoshel4 = dp[11];
-	rhosolv = dp[12];
-	bkg = dp[13];
-	
-	pi = 4.0*atan(1.0);
-		
-	zz = (1.0/pd)*(1.0/pd)-1.0;		//polydispersity of the core only
-	
-	range = 8.0;			//std deviations for the integration
-	va = rcore*(1.0-range*pd);
-	if (va<0) {
-		va=0;		//otherwise numerical error when pd >= 0.3, making a<0
-	}
-	if (pd>0.3) {
-		range = range + (pd-0.3)*18.0;		//stretch upper range to account for skewed tail
-	}
-	vb = rcore*(1.0+range*pd);		// is this far enough past avg radius?
-	
-	//temp set scale=1 and bkg=0 for quadrature calc
-	temp_4sf[0] = 1.0;
-	temp_4sf[1] = dp[1];		//the core radius will be changed in the loop
-	temp_4sf[2] = dp[3];
-	temp_4sf[3] = dp[4];
-	temp_4sf[4] = dp[5];
-	temp_4sf[5] = dp[6];
-	temp_4sf[6] = dp[7];
-	temp_4sf[7] = dp[8];
-	temp_4sf[8] = dp[9];
-	temp_4sf[9] = dp[10];
-	temp_4sf[10] = dp[11];
-	temp_4sf[11] = dp[12];
-	temp_4sf[12] = 0.0;
-		
-	summ = 0.0;		// initialize integral
-	for(ii=0;ii<nord;ii+=1) {
-		// calculate Gauss points on integration interval (r-value for evaluation)
-		zi = ( Gauss76Z[ii]*(vb-va) + vb + va )/2.0;
-		temp_4sf[1] = zi;
-		yyy = Gauss76Wt[ii] * SchulzPoint(zi,rcore,zz) * FourShell(temp_4sf,x);
-		//un-normalize by volume
-		yyy *= 4.0*pi/3.0*pow((zi+thick1+thick2+thick3+thick4),3);
-		summ += yyy;		//add to the running total of the quadrature
-   	}
-	// calculate value of integral to return
-	answer = (vb-va)/2.0*summ;
-   	
-	//re-normalize by the average volume
-	zp1 = zz + 1.0;
-	zp2 = zz + 2.0;
-	zp3 = zz + 3.0;
-	vpoly = 4.0*pi/3.0*zp3*zp2/zp1/zp1*pow((rcore+thick1+thick2+thick3+thick4),3);
-	answer /= vpoly;
-//scale
-	answer *= scale;
-// add in the background
-	answer += bkg;
-		
-    return(answer);
-}
-
-
-/*	BCC_ParaCrystal  :  calculates the form factor of a Triaxial Ellipsoid at the given x-value p->x
-
-Uses 150 pt Gaussian quadrature for both integrals
-
-*/
-double
-BCC_ParaCrystal(double w[], double x)
-{
-	int i,j;
-	double Pi;
-	double scale,Dnn,gg,Rad,contrast,background,latticeScale,sld,sldSolv;		//local variables of coefficient wave
-	int nordi=150;			//order of integration
-	int nordj=150;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 2.0*Pi;		//orintational average, outer integral
-	vaj = 0.0;
-	vbj = Pi;		//endpoints of inner integral
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = w[0];
-	Dnn = w[1];					//Nearest neighbor distance A
-	gg = w[2];					//Paracrystal distortion factor
-	Rad = w[3];					//Sphere radius
-	sld = w[4];
-	sldSolv = w[5];
-	background = w[6]; 
-	
-	contrast = sld - sldSolv;
-	
-	//Volume fraction calculated from lattice symmetry and sphere radius
-	latticeScale = 2.0*(4.0/3.0)*Pi*(Rad*Rad*Rad)/pow(Dnn/sqrt(3.0/4.0),3);
-	
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss150Z[i]*(vb-va) + va + vb )/2.0;		//the outer dummy is phi
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss150Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the inner dummy is theta
-			yyy = Gauss150Wt[j] * BCC_Integrand(w,x,zi,zij);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		answer = (vbj-vaj)/2.0*summj;
-		
-		//now calculate outer integral
-		yyy = Gauss150Wt[i] * answer;
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= SphereForm_Paracrystal(Rad,contrast,x)*scale*latticeScale;
-	// add in the background
-	answer += background;
-	
-	return answer;
-}
-
-// xx is phi (outer)
-// yy is theta (inner)
-double
-BCC_Integrand(double w[], double qq, double xx, double yy) {
-	
-	double retVal,temp1,temp3,aa,Da,Dnn,gg,Pi;
-	
-	Dnn = w[1]; //Nearest neighbor distance A
-	gg = w[2]; //Paracrystal distortion factor
-	aa = Dnn;
-	Da = gg*aa;
-	
-	Pi = 4.0*atan(1.0);
-	temp1 = qq*qq*Da*Da;
-	temp3 = qq*aa;	
-	
-	retVal = BCCeval(yy,xx,temp1,temp3);
-	retVal /=4.0*Pi;
-	
-	return(retVal);
-}
-
-double
-BCCeval(double Theta, double Phi, double temp1, double temp3) {
-
-	double temp6,temp7,temp8,temp9,temp10;
-	double result;
-	
-	temp6 = sin(Theta);
-	temp7 = sin(Theta)*cos(Phi)+sin(Theta)*sin(Phi)+cos(Theta);
-	temp8 = -1.0*sin(Theta)*cos(Phi)-sin(Theta)*sin(Phi)+cos(Theta);
-	temp9 = -1.0*sin(Theta)*cos(Phi)+sin(Theta)*sin(Phi)-cos(Theta);
-	temp10 = exp((-1.0/8.0)*temp1*((temp7*temp7)+(temp8*temp8)+(temp9*temp9)));
-	result = pow(1.0-(temp10*temp10),3)*temp6/((1.0-2.0*temp10*cos(0.5*temp3*(temp7))+(temp10*temp10))*(1.0-2.0*temp10*cos(0.5*temp3*(temp8))+(temp10*temp10))*(1.0-2.0*temp10*cos(0.5*temp3*(temp9))+(temp10*temp10)));
-	
-	return (result);
-}
-
-double
-SphereForm_Paracrystal(double radius, double delrho, double x) {					
-	
-	double bes,f,vol,f2,pi;
-	pi = 4.0*atan(1.0);
-	//
-	//handle q==0 separately
-	if(x==0) {
-		f = 4.0/3.0*pi*radius*radius*radius*delrho*delrho*1.0e8;
-		return(f);
-	}
-	
-	bes = 3.0*(sin(x*radius)-x*radius*cos(x*radius))/(x*x*x)/(radius*radius*radius);
-	vol = 4.0*pi/3.0*radius*radius*radius;
-	f = vol*bes*delrho	;	// [=] ï¿œ
-	// normalize to single particle volume, convert to 1/cm
-	f2 = f * f / vol * 1.0e8;		// [=] 1/cm
-	
-	return (f2);
-}
-
-/*	FCC_ParaCrystal  :  calculates the form factor of a Triaxial Ellipsoid at the given x-value p->x
-
-Uses 150 pt Gaussian quadrature for both integrals
-
-*/
-double
-FCC_ParaCrystal(double w[], double x)
-{
-	int i,j;
-	double Pi;
-	double scale,Dnn,gg,Rad,contrast,background,latticeScale,sld,sldSolv;		//local variables of coefficient wave
-	int nordi=150;			//order of integration
-	int nordj=150;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = 2.0*Pi;		//orintational average, outer integral
-	vaj = 0.0;
-	vbj = Pi;		//endpoints of inner integral
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = w[0];
-	Dnn = w[1];					//Nearest neighbor distance A
-	gg = w[2];					//Paracrystal distortion factor
-	Rad = w[3];					//Sphere radius
-	sld = w[4];
-	sldSolv = w[5];
-	background = w[6]; 
-	
-	contrast = sld - sldSolv;
-	//Volume fraction calculated from lattice symmetry and sphere radius
-	latticeScale = 4.0*(4.0/3.0)*Pi*(Rad*Rad*Rad)/pow(Dnn*sqrt(2.0),3);
-	
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss150Z[i]*(vb-va) + va + vb )/2.0;		//the outer dummy is phi
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss150Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the inner dummy is theta
-			yyy = Gauss150Wt[j] * FCC_Integrand(w,x,zi,zij);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		answer = (vbj-vaj)/2.0*summj;
-		
-		//now calculate outer integral
-		yyy = Gauss150Wt[i] * answer;
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= SphereForm_Paracrystal(Rad,contrast,x)*scale*latticeScale;
-	// add in the background
-	answer += background;
-	
-	return answer;
-}
-
-
-// xx is phi (outer)
-// yy is theta (inner)
-double
-FCC_Integrand(double w[], double qq, double xx, double yy) {
-	
-	double retVal,temp1,temp3,aa,Da,Dnn,gg,Pi;
-	
-	Pi = 4.0*atan(1.0);
-	Dnn = w[1]; //Nearest neighbor distance A
-	gg = w[2]; //Paracrystal distortion factor
-	aa = Dnn;
-	Da = gg*aa;
-	
-	temp1 = qq*qq*Da*Da;
-	temp3 = qq*aa;
-	
-	retVal = FCCeval(yy,xx,temp1,temp3);
-	retVal /=4*Pi;
-	
-	return(retVal);
-}
-
-double
-FCCeval(double Theta, double Phi, double temp1, double temp3) {
-
-	double temp6,temp7,temp8,temp9,temp10;
-	double result;
-	
-	temp6 = sin(Theta);
-	temp7 = sin(Theta)*sin(Phi)+cos(Theta);
-	temp8 = -1.0*sin(Theta)*cos(Phi)+cos(Theta);
-	temp9 = -1.0*sin(Theta)*cos(Phi)+sin(Theta)*sin(Phi);
-	temp10 = exp((-1.0/8.0)*temp1*((temp7*temp7)+(temp8*temp8)+(temp9*temp9)));
-	result = pow((1.0-(temp10*temp10)),3)*temp6/((1.0-2.0*temp10*cos(0.5*temp3*(temp7))+(temp10*temp10))*(1.0-2.0*temp10*cos(0.5*temp3*(temp8))+(temp10*temp10))*(1.0-2.0*temp10*cos(0.5*temp3*(temp9))+(temp10*temp10)));
-	
-	return (result);
-}
-
-
-/*	SC_ParaCrystal  :  calculates the form factor of a Triaxial Ellipsoid at the given x-value p->x
-
-Uses 150 pt Gaussian quadrature for both integrals
-
-*/
-double
-SC_ParaCrystal(double w[], double x)
-{
-	int i,j;
-	double Pi;
-	double scale,Dnn,gg,Rad,contrast,background,latticeScale,sld,sldSolv;		//local variables of coefficient wave
-	int nordi=150;			//order of integration
-	int nordj=150;
-	double va,vb;		//upper and lower integration limits
-	double summ,zi,yyy,answer;			//running tally of integration
-	double summj,vaj,vbj,zij;			//for the inner integration
-	
-	Pi = 4.0*atan(1.0);
-	va = 0.0;
-	vb = Pi/2.0;		//orintational average, outer integral
-	vaj = 0.0;
-	vbj = Pi/2.0;		//endpoints of inner integral
-	
-	summ = 0.0;			//initialize intergral
-	
-	scale = w[0];
-	Dnn = w[1];					//Nearest neighbor distance A
-	gg = w[2];					//Paracrystal distortion factor
-	Rad = w[3];					//Sphere radius
-	sld = w[4];
-	sldSolv = w[5];
-	background = w[6]; 
-	
-	contrast = sld - sldSolv;
-	//Volume fraction calculated from lattice symmetry and sphere radius
-	latticeScale = (4.0/3.0)*Pi*(Rad*Rad*Rad)/pow(Dnn,3);
-	
-	for(i=0;i<nordi;i++) {
-		//setup inner integral over the ellipsoidal cross-section
-		summj=0.0;
-		zi = ( Gauss150Z[i]*(vb-va) + va + vb )/2.0;		//the outer dummy is phi
-		for(j=0;j<nordj;j++) {
-			//20 gauss points for the inner integral
-			zij = ( Gauss150Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the inner dummy is theta
-			yyy = Gauss150Wt[j] * SC_Integrand(w,x,zi,zij);
-			summj += yyy;
-		}
-		//now calculate the value of the inner integral
-		answer = (vbj-vaj)/2.0*summj;
-		
-		//now calculate outer integral
-		yyy = Gauss150Wt[i] * answer;
-		summ += yyy;
-	}		//final scaling is done at the end of the function, after the NT_FP64 case
-	
-	answer = (vb-va)/2.0*summ;
-	// Multiply by contrast^2
-	answer *= SphereForm_Paracrystal(Rad,contrast,x)*scale*latticeScale;
-	// add in the background
-	answer += background;
-	
-	return answer;
-}
-
-// xx is phi (outer)
-// yy is theta (inner)
-double
-SC_Integrand(double w[], double qq, double xx, double yy) {
-	
-	double retVal,temp1,temp2,temp3,temp4,temp5,aa,Da,Dnn,gg,Pi;
-	
-	Pi = 4.0*atan(1.0);
-	Dnn = w[1]; //Nearest neighbor distance A
-	gg = w[2]; //Paracrystal distortion factor
-	aa = Dnn;
-	Da = gg*aa;
-	
-	temp1 = qq*qq*Da*Da;
-	temp2 = pow( 1.0-exp(-1.0*temp1) ,3);
-	temp3 = qq*aa;
-	temp4 = 2.0*exp(-0.5*temp1);
-	temp5 = exp(-1.0*temp1);
-	
-	
-	retVal = temp2*SCeval(yy,xx,temp3,temp4,temp5);
-	retVal *= 2.0/Pi;
-	
-	return(retVal);
-}
-
-double
-SCeval(double Theta, double Phi, double temp3, double temp4, double temp5) { //Function to calculate integrand values for simple cubic structure
-
-	double temp6,temp7,temp8,temp9; //Theta and phi dependent parts of the equation
-	double result;
-	
-	temp6 = sin(Theta);
-	temp7 = -1.0*temp3*sin(Theta)*cos(Phi);
-	temp8 = temp3*sin(Theta)*sin(Phi);
-	temp9 = temp3*cos(Theta);
-	result = temp6/((1.0-temp4*cos((temp7))+temp5)*(1.0-temp4*cos((temp8))+temp5)*(1.0-temp4*cos((temp9))+temp5));
-	
-	return (result);
-}
-
-// scattering from a uniform sphere with a Gaussian size distribution
-//
-double
-FuzzySpheres(double dp[], double q)
-{
-	double pi,x;
-	double scale,rad,pd,sig,rho,rhos,bkg,delrho,sig_surf,f2,bes,vol,f;		//my local names
-	double va,vb,zi,yy,summ,inten;
-	int nord=20,ii;
-	
-	pi = 4.0*atan(1.0);
-	x= q;
-	
-	scale=dp[0];
-	rad=dp[1];
-	pd=dp[2];
-	sig=pd*rad;
-	sig_surf = dp[3];
-	rho=dp[4];
-	rhos=dp[5];
-	delrho=rho-rhos;
-	bkg=dp[6];
-	
-			
-	va = -4.0*sig + rad;
-	if (va<0) {
-		va=0;		//to avoid numerical error when  va<0 (-ve q-value)
-	}
-	vb = 4.0*sig +rad;
-	
-	summ = 0.0;		// initialize integral
-	for(ii=0;ii<nord;ii+=1) {
-		// calculate Gauss points on integration interval (r-value for evaluation)
-		zi = ( Gauss20Z[ii]*(vb-va) + vb + va )/2.0;
-		// calculate sphere scattering
-		//
-		//handle q==0 separately
-		if (x==0.0) {
-			f2 = 4.0/3.0*pi*zi*zi*zi*delrho*delrho*1.0e8;
-			f2 *= exp(-0.5*sig_surf*sig_surf*x*x);
-			f2 *= exp(-0.5*sig_surf*sig_surf*x*x);
-		} else {
-			bes = 3.0*(sin(x*zi)-x*zi*cos(x*zi))/(x*x*x)/(zi*zi*zi);
-			vol = 4.0*pi/3.0*zi*zi*zi;
-			f = vol*bes*delrho;		// [=] A
-			f *= exp(-0.5*sig_surf*sig_surf*x*x);
-			// normalize to single particle volume, convert to 1/cm
-			f2 = f * f / vol * 1.0e8;		// [=] 1/cm
-		}
-	
-		yy = Gauss20Wt[ii] *  Gauss_distr(sig,rad,zi) * f2;
-		yy *= 4.0*pi/3.0*zi*zi*zi;		//un-normalize by current sphere volume
-		
-		summ += yy;		//add to the running total of the quadrature
-		
-		
-   	}
-	// calculate value of integral to return
-	inten = (vb-va)/2.0*summ;
-	
-	//re-normalize by polydisperse sphere volume
-	inten /= (4.0*pi/3.0*rad*rad*rad)*(1.0+3.0*pd*pd);
-	
-	inten *= scale;
-	inten += bkg;
-	
-    return(inten);	//scale, and add in the background
-}
-
-
Index: sansmodels/src/sans/models/libigor/libSphere.h
===================================================================
--- sansmodels/src/sans/models/libigor/libSphere.h	(revision 5f0dcab5458a4b59903104d524321c74b70f291c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-// header for SphereFit.c
-#if defined(_MSC_VER)
-#include "winFuncs.h"
-#endif
-
-/* IGOR Fit Functions */
-double MultiShell(double dp[], double q);
-double PolyMultiShell(double dp[], double q);
-double SphereForm(double dp[], double q);
-double CoreShellForm(double dp[], double q);
-double PolyCoreForm(double dp[], double q);
-double PolyCoreShellRatio(double dp[], double q);
-double VesicleForm(double dp[], double q);
-double SchulzSpheres(double dp[], double q);
-double PolyRectSpheres(double dp[], double q);
-double PolyHardSphereIntensity(double dp[], double q);
-double BimodalSchulzSpheres(double dp[], double q);
-double GaussPolySphere(double dp[], double q);
-double LogNormalPolySphere(double dp[], double q);
-double BinaryHS(double dp[], double q);
-double BinaryHS_PSF11(double dp[], double q);
-double BinaryHS_PSF12(double dp[], double q);
-double BinaryHS_PSF22(double dp[], double q);
-double OneShell(double dp[], double q);
-double TwoShell(double dp[], double q);
-double ThreeShell(double dp[], double q);
-double FourShell(double dp[], double q);
-double PolyOneShell(double dp[], double q);
-double PolyTwoShell(double dp[], double q);
-double PolyThreeShell(double dp[], double q);
-double PolyFourShell(double dp[], double q);
-double BCC_ParaCrystal(double dp[], double q);
-double FCC_ParaCrystal(double dp[], double q);
-double SC_ParaCrystal(double dp[], double q);
-double FuzzySpheres(double dp[], double q);
-
-//function prototypes
-double F_func(double qr);
-double MultiShellGuts(double q,double rcore,double ts,double tw,double rhocore,double rhoshel,int num);
-double fnt2(double yy, double zz);
-double fnt3(double yy, double pp, double zz);
-double SchulzSphere_Fn(double scale, double ravg, double pd, double rho, double rhos, double x);
-int ashcroft(double qval, double r2, double nf2, double aa, double phi, double *s11, double *s22, double *s12);
-double BCC_Integrand(double w[], double qq, double xx, double yy);
-double BCCeval(double Theta, double Phi, double temp1, double temp3);
-double SphereForm_Paracrystal(double radius, double delrho, double x);
-double FCC_Integrand(double w[], double qq, double xx, double yy);
-double FCCeval(double Theta, double Phi, double temp1, double temp3);
-double SC_Integrand(double w[], double qq, double xx, double yy);
-double SCeval(double Theta, double Phi, double temp3, double temp4, double temp5);
Index: sansmodels/src/sans/models/libigor/libStructureFactor.c
===================================================================
--- sansmodels/src/sans/models/libigor/libStructureFactor.c	(revision 71d21947dae252738712986279b665b2db6682a6)
+++ 	(revision )
@@ -1,759 +1,0 @@
-/*	SimpleFit.c
-
-A simplified project designed to act as a template for your curve fitting function.
-The fitting function is a simple polynomial. It works but is of no practical use.
-*/
-
-#include "StandardHeaders.h"			// Include ANSI headers, Mac headers, IgorXOP.h, XOP.h and XOPSupport.h
-#include "libStructureFactor.h"
-
-static double gMSAWave[17]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
-
-//Hard Sphere Structure Factor
-//
-double
-HardSphereStruct(double dp[], double q)
-{
-	double denom,dnum,alpha,beta,gamm,a,asq,ath,afor,rca,rsa;
-	double calp,cbeta,cgam,prefac,c,vstruc;
-	double r,phi,struc;
-	
-	r = dp[0];
-	phi = dp[1];
-	//  compute constants
-	denom = pow((1.0-phi),4);
-	dnum = pow((1.0 + 2.0*phi),2);
-	alpha = dnum/denom;
-	beta = -6.0*phi*pow((1.0 + phi/2.0),2)/denom;
-	gamm = 0.50*phi*dnum/denom;
-	//
-	//  calculate the structure factor
-	//     
-	a = 2.0*q*r;
-	asq = a*a;
-	ath = asq*a;
-	afor = ath*a;
-	rca = cos(a);
-	rsa = sin(a);
-	calp = alpha*(rsa/asq - rca/a);
-	cbeta = beta*(2.0*rsa/asq - (asq - 2.0)*rca/ath - 2.0/ath);
-	cgam = gamm*(-rca/a + (4.0/a)*((3.0*asq - 6.0)*rca/afor + (asq - 6.0)*rsa/ath + 6.0/afor));
-	prefac = -24.0*phi/a;
-	c = prefac*(calp + cbeta + cgam);
-	vstruc = 1.0/(1.0-c);
-	struc = vstruc;
-	
-	return(struc);
-}
-
-//Sticky Hard Sphere Structure Factor
-//
-double
-StickyHS_Struct(double dp[], double q)
-{
-	double qv;
-	double rad,phi,eps,tau,eta;
-	double sig,aa,etam1,qa,qb,qc,radic;
-	double lam,lam2,test,mu,alpha,beta;
-	double kk,k2,k3,ds,dc,aq1,aq2,aq3,aq,bq1,bq2,bq3,bq,sq;
-	
-	qv= q;
-	rad = dp[0];
-	phi = dp[1];
-	eps = dp[2];
-	tau = dp[3];
-	
-	eta = phi/(1.0-eps)/(1.0-eps)/(1.0-eps);
-	
-	sig = 2.0 * rad;
-	aa = sig/(1.0 - eps);
-	etam1 = 1.0 - eta;
-	//C
-	//C  SOLVE QUADRATIC FOR LAMBDA
-	//C
-	qa = eta/12.0;
-	qb = -1.0*(tau + eta/(etam1));
-	qc = (1.0 + eta/2.0)/(etam1*etam1);
-	radic = qb*qb - 4.0*qa*qc;
-	if(radic<0) {
-		//if(x>0.01 && x<0.015)
-	 	//	Print "Lambda unphysical - both roots imaginary"
-	 	//endif
-		return(-1.0);
-	}
-	//C   KEEP THE SMALLER ROOT, THE LARGER ONE IS UNPHYSICAL
-	lam = (-1.0*qb-sqrt(radic))/(2.0*qa);
-	lam2 = (-1.0*qb+sqrt(radic))/(2.0*qa);
-	if(lam2<lam) {
-		lam = lam2;
-	}
-	test = 1.0 + 2.0*eta;
-	mu = lam*eta*etam1;
-	if(mu>test) {
-		//if(x>0.01 && x<0.015)
-		// Print "Lambda unphysical mu>test"
-		//endif
-		return(-1.0);
-	}
-	alpha = (1.0 + 2.0*eta - mu)/(etam1*etam1);
-	beta = (mu - 3.0*eta)/(2.0*etam1*etam1);
-	//C
-	//C   CALCULATE THE STRUCTURE FACTOR
-	//C
-	kk = qv*aa;
-	k2 = kk*kk;
-	k3 = kk*k2;
-	ds = sin(kk);
-	dc = cos(kk);
-	aq1 = ((ds - kk*dc)*alpha)/k3;
-	aq2 = (beta*(1.0-dc))/k2;
-	aq3 = (lam*ds)/(12.0*kk);
-	aq = 1.0 + 12.0*eta*(aq1+aq2-aq3);
-	//
-	bq1 = alpha*(0.5/kk - ds/k2 + (1.0 - dc)/k3);
-	bq2 = beta*(1.0/kk - ds/k2);
-	bq3 = (lam/12.0)*((1.0 - dc)/kk);
-	bq = 12.0*eta*(bq1+bq2-bq3);
-	//
-	sq = 1.0/(aq*aq +bq*bq);
-	
-	return(sq);
-}
-
-
-
-//     SUBROUTINE SQWELL: CALCULATES THE STRUCTURE FACTOR FOR A
-//                        DISPERSION OF MONODISPERSE HARD SPHERES
-//     IN THE Mean Spherical APPROXIMATION ASSUMING THE SPHERES
-//     INTERACT THROUGH A SQUARE WELL POTENTIAL.
-//** not the best choice of closure ** see note below
-//     REFS:  SHARMA,SHARMA, PHYSICA 89A,(1977),212
-double
-SquareWellStruct(double dp[], double q)
-{
-	double req,phis,edibkb,lambda,struc;
-	double sigma,eta,eta2,eta3,eta4,etam1,etam14,alpha,beta,gamm;
-	double x,sk,sk2,sk3,sk4,t1,t2,t3,t4,ck;
-	
-	x= q;
-	
-	req = dp[0];
-	phis = dp[1];
-	edibkb = dp[2];
-	lambda = dp[3];
-	
-	sigma = req*2.;
-	eta = phis;
-	eta2 = eta*eta;
-	eta3 = eta*eta2;
-	eta4 = eta*eta3;
-	etam1 = 1. - eta;
-	etam14 = etam1*etam1*etam1*etam1;
-	alpha = (  pow((1. + 2.*eta),2) + eta3*( eta-4.0 )  )/etam14;
-	beta = -(eta/3.0) * ( 18. + 20.*eta - 12.*eta2 + eta4 )/etam14;
-	gamm = 0.5*eta*( pow((1. + 2.*eta),2) + eta3*(eta-4.) )/etam14;
-	//
-	//  calculate the structure factor
-	
-	sk = x*sigma;
-	sk2 = sk*sk;
-	sk3 = sk*sk2;
-	sk4 = sk3*sk;
-	t1 = alpha * sk3 * ( sin(sk) - sk * cos(sk) );
-	t2 = beta * sk2 * ( 2.*sk*sin(sk) - (sk2-2.)*cos(sk) - 2.0 );
-	t3 =   ( 4.0*sk3 - 24.*sk ) * sin(sk);
-	t3 = t3 - ( sk4 - 12.0*sk2 + 24.0 )*cos(sk) + 24.0;
-	t3 = gamm*t3;
-	t4 = -edibkb*sk3*(sin(lambda*sk) - lambda*sk*cos(lambda*sk)+ sk*cos(sk) - sin(sk) );
-	ck =  -24.0*eta*( t1 + t2 + t3 + t4 )/sk3/sk3;
-	struc  = 1./(1.-ck);
-	
-	return(struc);
-}
-
-// Hayter-Penfold (rescaled) MSA structure factor for screened Coulomb interactions 
-//
-double
-HayterPenfoldMSA(double dp[], double q)
-{
-	double Elcharge=1.602189e-19;		// electron charge in Coulombs (C)
-	double kB=1.380662e-23;				// Boltzman constant in J/K
-	double FrSpPerm=8.85418782E-12;	//Permittivity of free space in C^2/(N m^2)
-	double SofQ, QQ, Qdiam, Vp, csalt, ss;
-	double VolFrac, SIdiam, diam, Kappa, cs, IonSt;
-	double dialec, Perm, Beta, Temp, zz, charge;
-	double pi;
-	int ierr;
-	
-	pi = 4.0*atan(1.);
-	QQ= q;
-
-	diam=dp[0];		//in A
-	zz = dp[1];		//# of charges
-	VolFrac=dp[2];
-	Temp=dp[3];		//in degrees Kelvin
-	csalt=dp[4];		//in molarity
-	dialec=dp[5];		// unitless
-						////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-						//////////////////////////// convert to USEFUL inputs in SI units                                                //
-						////////////////////////////    NOTE: easiest to do EVERYTHING in SI units                               //
-						////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-	Beta=1.0/(kB*Temp);		// in Joules^-1
-	Perm=dialec*FrSpPerm;	//in C^2/(N  m^2)
-	charge=zz*Elcharge;		//in Coulomb (C)
-	SIdiam = diam*1E-10;		//in m
-	Vp=4.0*pi/3.0*(SIdiam/2.0)*(SIdiam/2.0)*(SIdiam/2.0);	//in m^3
-	cs=csalt*6.022E23*1E3;	//# salt molecules/m^3
-	
-	//         Compute the derived values of :
-	//			 Ionic strength IonSt (in C^2/m^3)  
-	// 			Kappa (Debye-Huckel screening length in m)
-	//	and		gamma Exp(-k)
-	IonSt=0.5 * Elcharge*Elcharge*(zz*VolFrac/Vp+2.0*cs);
-	Kappa=sqrt(2*Beta*IonSt/Perm);     //Kappa calc from Ionic strength
-									   //	Kappa=2/SIdiam					// Use to compare with HP paper
-	gMSAWave[5]=Beta*charge*charge/(pi*Perm*SIdiam*pow((2.0+Kappa*SIdiam),2));
-	
-	//         Finally set up dimensionless parameters 
-	Qdiam=QQ*diam;
-	gMSAWave[6] = Kappa*SIdiam;
-	gMSAWave[4] = VolFrac;
-	
-	//Function sqhpa(qq)  {this is where Hayter-Penfold program began}
-	
-	//       FIRST CALCULATE COUPLING
-	
-	ss=pow(gMSAWave[4],(1.0/3.0));
-	gMSAWave[9] = 2.0*ss*gMSAWave[5]*exp(gMSAWave[6]-gMSAWave[6]/ss);
-	
-	//        CALCULATE COEFFICIENTS, CHECK ALL IS WELL
-	//        AND IF SO CALCULATE S(Q*SIG)
-	
-	ierr=0;
-	ierr=sqcoef(ierr);
-	if (ierr>=0) {
-		SofQ=sqhcal(Qdiam);
-	}else{
-       	//SofQ=NaN;
-		SofQ=-1.0;
-		//	print "Error Level = ",ierr
-		//      print "Please report HPMSA problem with above error code"
-	}
-	
-	return(SofQ);
-}
-
-
-
-/////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////
-//
-//
-//      CALCULATES RESCALED VOLUME FRACTION AND CORRESPONDING
-//      COEFFICIENTS FOR "SQHPA"
-//
-//      JOHN B. HAYTER   (I.L.L.)    14-SEP-81
-//
-//      ON EXIT:
-//
-//      SETA IS THE RESCALED VOLUME FRACTION
-//      SGEK IS THE RESCALED CONTACT POTENTIAL
-//      SAK IS THE RESCALED SCREENING CONSTANT
-//      A,B,C,F,U,V ARE THE MSA COEFFICIENTS
-//      G1= G(1+) IS THE CONTACT VALUE OF G(R/SIG):
-//      FOR THE GILLAN CONDITION, THE DIFFERENCE FROM
-//      ZERO INDICATES THE COMPUTATIONAL ACCURACY.
-//
-//      IR > 0:    NORMAL EXIT,  IR IS THE NUMBER OF ITERATIONS.
-//         < 0:    FAILED TO CONVERGE
-//
-int
-sqcoef(int ir)
-{	
-	int itm=40,ix,ig,ii;
-	double acc=5.0E-6,del,e1,e2,f1,f2;
-	
-	//      WAVE gMSAWave = $"root:HayPenMSA:gMSAWave"
-	f1=0;		//these were never properly initialized...
-	f2=0;
-	
-	ig=1;
-	if (gMSAWave[6]>=(1.0+8.0*gMSAWave[4])) {
-		ig=0;
-		gMSAWave[15]=gMSAWave[14];
-		gMSAWave[16]=gMSAWave[4];
-		ix=1;
-		ir = sqfun(ix,ir);
-		gMSAWave[14]=gMSAWave[15];
-		gMSAWave[4]=gMSAWave[16];
-		if((ir<0.0) || (gMSAWave[14]>=0.0)) {
-			return ir;
-		}
-	}
-	gMSAWave[10]=fmin(gMSAWave[4],0.20);
-	if ((ig!=1) || ( gMSAWave[9]>=0.15)) {
-		ii=0;                             
-		do {
-			ii=ii+1;
-			if(ii>itm) {
-				ir=-1;
-				return ir;		
-			}
-			if (gMSAWave[10]<=0.0) {
-			    gMSAWave[10]=gMSAWave[4]/ii;
-			}
-			if(gMSAWave[10]>0.6) {
-			    gMSAWave[10] = 0.35/ii;
-			}
-			e1=gMSAWave[10];
-			gMSAWave[15]=f1;
-			gMSAWave[16]=e1;
-			ix=2;
-			ir = sqfun(ix,ir);
-			f1=gMSAWave[15];
-			e1=gMSAWave[16];
-			e2=gMSAWave[10]*1.01;
-			gMSAWave[15]=f2;
-			gMSAWave[16]=e2;
-			ix=2;
-			ir = sqfun(ix,ir);
-			f2=gMSAWave[15];
-			e2=gMSAWave[16];
-			e2=e1-(e2-e1)*f1/(f2-f1);
-			gMSAWave[10] = e2;
-			del = fabs((e2-e1)/e1);
-		} while (del>acc);
-		gMSAWave[15]=gMSAWave[14];
-		gMSAWave[16]=e2;
-		ix=4;
-		ir = sqfun(ix,ir);
-		gMSAWave[14]=gMSAWave[15];
-		e2=gMSAWave[16];
-		ir=ii;
-		if ((ig!=1) || (gMSAWave[10]>=gMSAWave[4])) {
-		    return ir;
-		}
-	}
-	gMSAWave[15]=gMSAWave[14];
-	gMSAWave[16]=gMSAWave[4];
-	ix=3;
-	ir = sqfun(ix,ir);
-	gMSAWave[14]=gMSAWave[15];
-	gMSAWave[4]=gMSAWave[16];
-	if ((ir>=0) && (gMSAWave[14]<0.0)) {
-		ir=-3;
-	}
-	return ir;
-}
-
-
-int
-sqfun(int ix, int ir)
-{	
-	double acc=1.0e-6;
-	double reta,eta2,eta21,eta22,eta3,eta32,eta2d,eta2d2,eta3d,eta6d,e12,e24,rgek;
-	double rak,ak1,ak2,dak,dak2,dak4,d,d2,dd2,dd4,dd45,ex1,ex2,sk,ck,ckma,skma;
-	double al1,al2,al3,al4,al5,al6,be1,be2,be3,vu1,vu2,vu3,vu4,vu5,ph1,ph2,ta1,ta2,ta3,ta4,ta5;
-	double a1,a2,a3,b1,b2,b3,v1,v2,v3,p1,p2,p3,pp,pp1,pp2,p1p2,t1,t2,t3,um1,um2,um3,um4,um5,um6;
-	double w0,w1,w2,w3,w4,w12,w13,w14,w15,w16,w24,w25,w26,w32,w34,w3425,w35,w3526,w36,w46,w56;
-	double fa,fap,ca,e24g,pwk,qpw,pg,del,fun,fund,g24;
-	int ii,ibig,itm=40;
-	//      WAVE gMSAWave = $"root:HayPenMSA:gMSAWave"
-	a2=0;
-	a3=0;
-	b2=0;
-	b3=0;
-	v2=0;
-	v3=0;
-	p2=0;
-	p3=0;
-	
-	//     CALCULATE CONSTANTS; NOTATION IS HAYTER PENFOLD (1981)
-	
-	reta = gMSAWave[16];                                                
-	eta2 = reta*reta;
-	eta3 = eta2*reta;
-	e12 = 12.0*reta;
-	e24 = e12+e12;
-	gMSAWave[13] = pow( (gMSAWave[4]/gMSAWave[16]),(1.0/3.0));
-	gMSAWave[12]=gMSAWave[6]/gMSAWave[13];
-	ibig=0;
-	if (( gMSAWave[12]>15.0) && (ix==1)) {
-		ibig=1;
-	}
-    
-	gMSAWave[11] = gMSAWave[5]*gMSAWave[13]*exp(gMSAWave[6]- gMSAWave[12]);
-	rgek =  gMSAWave[11];
-	rak =  gMSAWave[12];
-	ak2 = rak*rak;
-	ak1 = 1.0+rak;
-	dak2 = 1.0/ak2;
-	dak4 = dak2*dak2;
-	d = 1.0-reta;
-	d2 = d*d;
-	dak = d/rak;
-	dd2 = 1.0/d2;
-	dd4 = dd2*dd2;
-	dd45 = dd4*2.0e-1;
-	eta3d=3.0*reta;
-	eta6d = eta3d+eta3d;
-	eta32 = eta3+ eta3;
-	eta2d = reta+2.0;
-	eta2d2 = eta2d*eta2d;
-	eta21 = 2.0*reta+1.0;
-	eta22 = eta21*eta21;
-	
-	//     ALPHA(I)
-	
-	al1 = -eta21*dak;
-	al2 = (14.0*eta2-4.0*reta-1.0)*dak2;
-	al3 = 36.0*eta2*dak4;
-	
-	//      BETA(I)
-	
-	be1 = -(eta2+7.0*reta+1.0)*dak;
-	be2 = 9.0*reta*(eta2+4.0*reta-2.0)*dak2;
-	be3 = 12.0*reta*(2.0*eta2+8.0*reta-1.0)*dak4;
-	
-	//      NU(I)
-	
-	vu1 = -(eta3+3.0*eta2+45.0*reta+5.0)*dak;
-	vu2 = (eta32+3.0*eta2+42.0*reta-2.0e1)*dak2;
-	vu3 = (eta32+3.0e1*reta-5.0)*dak4;
-	vu4 = vu1+e24*rak*vu3;
-	vu5 = eta6d*(vu2+4.0*vu3);
-	
-	//      PHI(I)
-	
-	ph1 = eta6d/rak;
-	ph2 = d-e12*dak2;
-	
-	//      TAU(I)
-	
-	ta1 = (reta+5.0)/(5.0*rak);
-	ta2 = eta2d*dak2;
-	ta3 = -e12*rgek*(ta1+ta2);
-	ta4 = eta3d*ak2*(ta1*ta1-ta2*ta2);
-	ta5 = eta3d*(reta+8.0)*1.0e-1-2.0*eta22*dak2;
-	
-	//     double PRECISION SINH(K), COSH(K)
-	
-	ex1 = exp(rak);
-	ex2 = 0.0;
-	if ( gMSAWave[12]<20.0) {
-		ex2=exp(-rak);
-	}
-	sk=0.5*(ex1-ex2);
-	ck = 0.5*(ex1+ex2);
-	ckma = ck-1.0-rak*sk;
-	skma = sk-rak*ck;
-	
-	//      a(I)
-	
-	a1 = (e24*rgek*(al1+al2+ak1*al3)-eta22)*dd4;
-	if (ibig==0) {
-		a2 = e24*(al3*skma+al2*sk-al1*ck)*dd4;
-		a3 = e24*(eta22*dak2-0.5*d2+al3*ckma-al1*sk+al2*ck)*dd4;
-	}
-	
-	//      b(I)
-	
-	b1 = (1.5*reta*eta2d2-e12*rgek*(be1+be2+ak1*be3))*dd4;
-	if (ibig==0) {
-		b2 = e12*(-be3*skma-be2*sk+be1*ck)*dd4;
-		b3 = e12*(0.5*d2*eta2d-eta3d*eta2d2*dak2-be3*ckma+be1*sk-be2*ck)*dd4;
-	}
-	
-	//      V(I)
-	
-	v1 = (eta21*(eta2-2.0*reta+1.0e1)*2.5e-1-rgek*(vu4+vu5))*dd45;
-	if (ibig==0) {
-		v2 = (vu4*ck-vu5*sk)*dd45;
-		v3 = ((eta3-6.0*eta2+5.0)*d-eta6d*(2.0*eta3-3.0*eta2+18.0*reta+1.0e1)*dak2+e24*vu3+vu4*sk-vu5*ck)*dd45;
-	}
-	
-	
-	//       P(I)
-	
-	pp1 = ph1*ph1;
-	pp2 = ph2*ph2;
-	pp = pp1+pp2;
-	p1p2 = ph1*ph2*2.0;
-	p1 = (rgek*(pp1+pp2-p1p2)-0.5*eta2d)*dd2;
-	if (ibig==0) {
-		p2 = (pp*sk+p1p2*ck)*dd2;
-		p3 = (pp*ck+p1p2*sk+pp1-pp2)*dd2;
-	}
-	
-	//       T(I)
-	
-	t1 = ta3+ta4*a1+ta5*b1;
-	if (ibig!=0) {
-		
-		//		VERY LARGE SCREENING:  ASYMPTOTIC SOLUTION
-		
-  		v3 = ((eta3-6.0*eta2+5.0)*d-eta6d*(2.0*eta3-3.0*eta2+18.0*reta+1.0e1)*dak2+e24*vu3)*dd45;
-		t3 = ta4*a3+ta5*b3+e12*ta2 - 4.0e-1*reta*(reta+1.0e1)-1.0;
-		p3 = (pp1-pp2)*dd2;
-		b3 = e12*(0.5*d2*eta2d-eta3d*eta2d2*dak2+be3)*dd4;
-		a3 = e24*(eta22*dak2-0.5*d2-al3)*dd4;
-		um6 = t3*a3-e12*v3*v3;
-		um5 = t1*a3+a1*t3-e24*v1*v3;
-		um4 = t1*a1-e12*v1*v1;
-		al6 = e12*p3*p3;
-		al5 = e24*p1*p3-b3-b3-ak2;
-		al4 = e12*p1*p1-b1-b1;
-		w56 = um5*al6-al5*um6;
-		w46 = um4*al6-al4*um6;
-		fa = -w46/w56;
-		ca = -fa;
-		gMSAWave[3] = fa;
-		gMSAWave[2] = ca;
-		gMSAWave[1] = b1+b3*fa;
-		gMSAWave[0] = a1+a3*fa;
-		gMSAWave[8] = v1+v3*fa;
-		gMSAWave[14] = -(p1+p3*fa);
-		gMSAWave[15] = gMSAWave[14];
-		if (fabs(gMSAWave[15])<1.0e-3) {
-			gMSAWave[15] = 0.0;
-		}
-		gMSAWave[10] = gMSAWave[16];
-		
-	} else {
-        
-		t2 = ta4*a2+ta5*b2+e12*(ta1*ck-ta2*sk);
-		t3 = ta4*a3+ta5*b3+e12*(ta1*sk-ta2*(ck-1.0))-4.0e-1*reta*(reta+1.0e1)-1.0;
-		
-		//		MU(i)
-		
-		um1 = t2*a2-e12*v2*v2;
-		um2 = t1*a2+t2*a1-e24*v1*v2;
-		um3 = t2*a3+t3*a2-e24*v2*v3;
-		um4 = t1*a1-e12*v1*v1;
-		um5 = t1*a3+t3*a1-e24*v1*v3;
-		um6 = t3*a3-e12*v3*v3;
-		
-		//			GILLAN CONDITION ?
-		//
-		//			YES - G(X=1+) = 0
-		//
-		//			COEFFICIENTS AND FUNCTION VALUE
-		//
-		if ((ix==1) || (ix==3)) {
-			
-			//			NO - CALCULATE REMAINING COEFFICIENTS.
-			
-			//			LAMBDA(I)
-			
-			al1 = e12*p2*p2;
-			al2 = e24*p1*p2-b2-b2;
-			al3 = e24*p2*p3;
-			al4 = e12*p1*p1-b1-b1;
-			al5 = e24*p1*p3-b3-b3-ak2;
-			al6 = e12*p3*p3;
-			
-			//			OMEGA(I)
-			
-			w16 = um1*al6-al1*um6;
-			w15 = um1*al5-al1*um5;
-			w14 = um1*al4-al1*um4;
-			w13 = um1*al3-al1*um3;
-			w12 = um1*al2-al1*um2;
-			
-			w26 = um2*al6-al2*um6;
-			w25 = um2*al5-al2*um5;
-			w24 = um2*al4-al2*um4;
-			
-			w36 = um3*al6-al3*um6;
-			w35 = um3*al5-al3*um5;
-			w34 = um3*al4-al3*um4;
-			w32 = um3*al2-al3*um2;
-			//
-			w46 = um4*al6-al4*um6;
-			w56 = um5*al6-al5*um6;
-			w3526 = w35+w26;
-			w3425 = w34+w25;
-			
-			//			QUARTIC COEFFICIENTS
-			
-			w4 = w16*w16-w13*w36;
-			w3 = 2.0*w16*w15-w13*w3526-w12*w36;
-			w2 = w15*w15+2.0*w16*w14-w13*w3425-w12*w3526;
-			w1 = 2.0*w15*w14-w13*w24-w12*w3425;
-			w0 = w14*w14-w12*w24;
-			
-			//			ESTIMATE THE STARTING VALUE OF f
-			
-			if (ix==1) {
-				//				LARGE K
-				fap = (w14-w34-w46)/(w12-w15+w35-w26+w56-w32);
-			} else {
-				//				ASSUME NOT TOO FAR FROM GILLAN CONDITION.
-				//				IF BOTH RGEK AND RAK ARE SMALL, USE P-W ESTIMATE.
-				gMSAWave[14]=0.5*eta2d*dd2*exp(-rgek);
-				if (( gMSAWave[11]<=2.0) && ( gMSAWave[11]>=0.0) && ( gMSAWave[12]<=1.0)) {
-					e24g = e24*rgek*exp(rak);
-					pwk = sqrt(e24g);
-					qpw = (1.0-sqrt(1.0+2.0*d2*d*pwk/eta22))*eta21/d;
-					gMSAWave[14] = -qpw*qpw/e24+0.5*eta2d*dd2;
-				}
-  				pg = p1+gMSAWave[14];
-				ca = ak2*pg+2.0*(b3*pg-b1*p3)+e12*gMSAWave[14]*gMSAWave[14]*p3;
-				ca = -ca/(ak2*p2+2.0*(b3*p2-b2*p3));
-				fap = -(pg+p2*ca)/p3;
-			}
-			
-			//			AND REFINE IT ACCORDING TO NEWTON
-			ii=0;
-			do {
-				ii = ii+1;
-				if (ii>itm) {
-					//					FAILED TO CONVERGE IN ITM ITERATIONS
-					ir=-2;
-					return (ir);
-				}
-				fa = fap;
-				fun = w0+(w1+(w2+(w3+w4*fa)*fa)*fa)*fa;
-				fund = w1+(2.0*w2+(3.0*w3+4.0*w4*fa)*fa)*fa;
-				fap = fa-fun/fund;
-				del=fabs((fap-fa)/fa);
-			} while (del>acc);
-			
-			ir = ir+ii;
-			fa = fap;
-			ca = -(w16*fa*fa+w15*fa+w14)/(w13*fa+w12);
-			gMSAWave[14] = -(p1+p2*ca+p3*fa);
-			gMSAWave[15] = gMSAWave[14];
-			if (fabs(gMSAWave[15])<1.0e-3) {
-				gMSAWave[15] = 0.0;
-			}
-			gMSAWave[10] = gMSAWave[16];
-		} else {
-			ca = ak2*p1+2.0*(b3*p1-b1*p3);
-			ca = -ca/(ak2*p2+2.0*(b3*p2-b2*p3));
-			fa = -(p1+p2*ca)/p3;
-			if (ix==2) {
-				gMSAWave[15] = um1*ca*ca+(um2+um3*fa)*ca+um4+um5*fa+um6*fa*fa;
-			}
-			if (ix==4) {
-				gMSAWave[15] = -(p1+p2*ca+p3*fa);
-			}
-		}
-   		gMSAWave[3] = fa;
-		gMSAWave[2] = ca;
-		gMSAWave[1] = b1+b2*ca+b3*fa;
-		gMSAWave[0] = a1+a2*ca+a3*fa;
-		gMSAWave[8] = (v1+v2*ca+v3*fa)/gMSAWave[0];
-	}
-   	g24 = e24*rgek*ex1;
-	gMSAWave[7] = (rak*ak2*ca-g24)/(ak2*g24);
-	return (ir);
-}
-
-// called as DiamCyl(hcyl,rcyl)
-double
-DiamCyl(double hcyl, double rcyl)
-{
-	
-	double diam,a,b,t1,t2,ddd;
-	double pi;
-	
-	pi = 4.0*atan(1.0);
-	if (rcyl == 0 || hcyl == 0) {
-		return 0.0;
-	}
-	a = rcyl;
-	b = hcyl/2.0;
-	t1 = a*a*2.0*b/2.0;
-	t2 = 1.0 + (b/a)*(1.0+a/b/2.0)*(1.0+pi*a/b/2.0);
-	ddd = 3.0*t1*t2;
-	diam = pow(ddd,(1.0/3.0));
-	
-	return(diam);
-}
-
-//prolate OR oblate ellipsoids
-//aa is the axis of rotation
-//if aa>bb, then PROLATE
-//if aa<bb, then OBLATE
-// A. Isihara, J. Chem. Phys. 18, 1446 (1950)
-//returns DIAMETER
-// called as DiamEllip(aa,bb)
-double
-DiamEllip(double aa, double bb)
-{
-	
-	double ee,e1,bd,b1,bL,b2,del,ddd,diam;
-
-	if (aa == 0 || bb == 0) {
-		return 0.0;
-	}
-	if (aa == bb) {
-		return 2.0*aa;
-	}
-	if(aa>bb) {
-		ee = (aa*aa - bb*bb)/(aa*aa);
-	}else{
-		ee = (bb*bb - aa*aa)/(bb*bb);
-	}
-	
-	bd = 1.0-ee;
-	e1 = sqrt(ee);
-	b1 = 1.0 + asin(e1)/(e1*sqrt(bd));
-	bL = (1.0+e1)/(1.0-e1);
-	b2 = 1.0 + bd/2/e1*log(bL);
-	del = 0.75*b1*b2;
-	
-	ddd = 2.0*(del+1.0)*aa*bb*bb;		//volume is always calculated correctly
-	diam = pow(ddd,(1.0/3.0));
-	
-	return(diam);
-}
-
-double
-sqhcal(double qq)
-{      	
-    double SofQ,etaz,akz,gekz,e24,x1,x2,ck,sk,ak2,qk,q2k,qk2,qk3,qqk,sink,cosk,asink,qcosk,aqk,inter; 		
-	//	WAVE gMSAWave = $"root:HayPenMSA:gMSAWave"
-	
-	etaz = gMSAWave[10];
-	akz =  gMSAWave[12];
-	gekz =  gMSAWave[11];
-	e24 = 24.0*etaz;
-	x1 = exp(akz);
-	x2 = 0.0;
-	if ( gMSAWave[12]<20.0) {
-		x2 = exp(-akz);
-	}
-	ck = 0.5*(x1+x2);
-	sk = 0.5*(x1-x2);
-	ak2 = akz*akz;
-	
-	if (qq<=0.0) {
-		SofQ = -1.0/gMSAWave[0];
-	} else {
-		qk = qq/gMSAWave[13];
-		q2k = qk*qk;
-		qk2 = 1.0/q2k;
-		qk3 = qk2/qk;
-		qqk = 1.0/(qk*(q2k+ak2));
-		sink = sin(qk);
-		cosk = cos(qk);
-		asink = akz*sink;
-		qcosk = qk*cosk;
-		aqk = gMSAWave[0]*(sink-qcosk);
-		aqk=aqk+gMSAWave[1]*((2.0*qk2-1.0)*qcosk+2.0*sink-2.0/qk);
-		inter=24.0*qk3+4.0*(1.0-6.0*qk2)*sink;
-		aqk=(aqk+0.5*etaz*gMSAWave[0]*(inter-(1.0-12.0*qk2+24.0*qk2*qk2)*qcosk))*qk3;
-		aqk=aqk +gMSAWave[2]*(ck*asink-sk*qcosk)*qqk;
-		aqk=aqk +gMSAWave[3]*(sk*asink-qk*(ck*cosk-1.0))*qqk;
-		aqk=aqk +gMSAWave[3]*(cosk-1.0)*qk2;
-		aqk=aqk -gekz*(asink+qcosk)*qqk;
-		SofQ = 1.0/(1.0-e24*aqk);
-	}
-	return (SofQ);
-}
-
-///////////end of XOP
-
-
Index: sansmodels/src/sans/models/libigor/libStructureFactor.h
===================================================================
--- sansmodels/src/sans/models/libigor/libStructureFactor.h	(revision 71d21947dae252738712986279b665b2db6682a6)
+++ 	(revision )
@@ -1,14 +1,0 @@
-// header for SphereFit.c
-
-/* IGOR Fit Functions */
-double HardSphereStruct(double dp[], double q);
-double SquareWellStruct(double dp[], double q);
-double StickyHS_Struct(double dp[], double q);
-double HayterPenfoldMSA(double dp[], double q);
-double DiamCyl(double a, double b);
-double DiamEllip(double a, double b);
-
-//function prototypes
-double sqhcal(double qq);
-int sqfun(int ix, int ir);
-int sqcoef(int ir);
Index: sansmodels/src/sans/models/libigor/libTwoPhase.c
===================================================================
--- sansmodels/src/sans/models/libigor/libTwoPhase.c	(revision 8bea12ddb76b18cae350684c1423711b58948114)
+++ 	(revision )
@@ -1,555 +1,0 @@
-/*	TwoPhaseFit.c
-
-*/
-
-#include "StandardHeaders.h"			// Include ANSI headers, Mac headers
-#include "libTwoPhase.h"
-
-/* internal functions */
-static double
-gammln(double xx) {
-
-    double x,y,tmp,ser;
-    static double cof[6]={76.18009172947146,-86.50532032941677,
-    24.01409824083091,-1.231739572450155,
-    0.1208650973866179e-2,-0.5395239384953e-5};
-    int j;
-
-    y=x=xx;
-    tmp=x+5.5;
-    tmp -= (x+0.5)*log(tmp);
-    ser=1.000000000190015;
-    for (j=0;j<=5;j++) ser += cof[j]/++y;
-    return -tmp+log(2.5066282746310005*ser/x);
-}
-
-// scattering from the Teubner-Strey model for microemulsions - hardly needs to be an XOP...
-double
-TeubnerStreyModel(double dp[], double q)
-{
-	double inten,q2,q4;		//my local names
-	
-	q2 = q*q;
-	q4 = q2*q2;
-	
-	inten = 1.0/(dp[0]+dp[1]*q2+dp[2]*q4);
-	inten += dp[3];  
-	return(inten);
-}
-
-double
-Power_Law_Model(double dp[], double q)
-{
-	double qval;
-	double inten,A,m,bgd;		//my local names
-	
-	qval= q;
-	
-	A = dp[0];
-	m = dp[1];
-	bgd = dp[2];
-	inten = A*pow(qval,-m) + bgd;
-	return(inten);
-}
-
-
-double
-Peak_Lorentz_Model(double dp[], double q)
-{
-	double qval;
-	double inten,I0, qpk, dq,bgd;		//my local names
-	qval= q;
-	
-	I0 = dp[0];
-	qpk = dp[1];
-	dq = dp[2];
-	bgd = dp[3];
-	inten = I0/(1.0 + pow( (qval-qpk)/dq,2) ) + bgd;
-	
-	return(inten);
-}
-
-double
-Peak_Gauss_Model(double dp[], double q)
-{
-	double qval;
-	double inten,I0, qpk, dq,bgd;		//my local names
-	
-	qval= q;
-	
-	I0 = dp[0];
-	qpk = dp[1];
-	dq = dp[2];
-	bgd = dp[3];
-	inten = I0*exp(-0.5*pow((qval-qpk)/dq,2))+ bgd;
-	
-	return(inten);
-}
-
-double
-Lorentz_Model(double dp[], double q)
-{
-	double qval;
-	double inten,I0, L,bgd;		//my local names
-	
-	qval= q;
-	
-	I0 = dp[0];
-	L = dp[1];
-	bgd = dp[2];
-	inten = I0/(1.0 + (qval*L)*(qval*L)) + bgd;
-	
-	return(inten);
-}
-
-double
-Fractal(double dp[], double q)
-{
-	double x,pi;
-	double r0,Df,corr,phi,sldp,sldm,bkg;
-	double pq,sq,ans;
-	
-	pi = 4.0*atan(1.0);
-	x=q;
-	
-	phi = dp[0];		// volume fraction of building block spheres...
-	r0 = dp[1];		//  radius of building block
-	Df = dp[2];		//  fractal dimension
-	corr = dp[3];		//  correlation length of fractal-like aggregates
-	sldp = dp[4];		// SLD of building block
-	sldm = dp[5];		// SLD of matrix or solution
-	bkg = dp[6];		//  flat background 
-	
-	//calculate P(q) for the spherical subunits, units cm-1 sr-1
-	pq = 1.0e8*phi*4.0/3.0*pi*r0*r0*r0*(sldp-sldm)*(sldp-sldm)*pow((3*(sin(x*r0) - x*r0*cos(x*r0))/pow((x*r0),3)),2);
-	
-	//calculate S(q)
-	sq = Df*exp(gammln(Df-1.0))*sin((Df-1.0)*atan(x*corr));
-	sq /= pow((x*r0),Df) * pow((1.0 + 1.0/(x*corr)/(x*corr)),((Df-1.0)/2.0));
-	sq += 1.0;
-	//combine and return
-	ans = pq*sq + bkg;
-	
-	return(ans);
-}
-
-// 6 JUL 2009 SRK changed definition of Izero scale factor to be uncorrelated with range
-//
-double
-DAB_Model(double dp[], double q)
-{
-	double qval,inten;
-	double Izero, range, incoh;
-	
-	qval= q;
-	Izero = dp[0];
-	range = dp[1];
-	incoh = dp[2]; 
-	
-	inten = (Izero*range*range*range)/pow((1.0 + (qval*range)*(qval*range)),2) + incoh;
-	
-	return(inten);
-}
-
-// G. Beaucage's Unified Model (1-4 levels)
-//
-double
-OneLevel(double dp[], double q)
-{
-	double x,ans,erf1;
-	double G1,Rg1,B1,Pow1,bkg,scale;
-	
-	x=q;
-	scale = dp[0];
-	G1 = dp[1];
-	Rg1 = dp[2];
-	B1 = dp[3];
-	Pow1 = dp[4];
-	bkg = dp[5];
-	
-	erf1 = erf( (x*Rg1/sqrt(6.0)));
-	
-	ans = G1*exp(-x*x*Rg1*Rg1/3.0);
-	ans += B1*pow((erf1*erf1*erf1/x),Pow1);
-	
-	if(x == 0) {
-		ans = G1;
-	}
-	
-	ans *= scale;
-	ans += bkg;
-	return(ans);
-}
-
-// G. Beaucage's Unified Model (1-4 levels)
-//
-double
-TwoLevel(double dp[], double q)
-{
-	double x;
-	double ans,G1,Rg1,B1,G2,Rg2,B2,Pow1,Pow2,bkg;
-	double erf1,erf2,scale;
-	
-	x=q;
-	
-	scale = dp[0];
-	G1 = dp[1];	//equivalent to I(0)
-	Rg1 = dp[2];
-	B1 = dp[3];
-	Pow1 = dp[4];
-	G2 = dp[5];
-	Rg2 = dp[6];
-	B2 = dp[7];
-	Pow2 = dp[8];
-	bkg = dp[9];
-	
-	erf1 = erf( (x*Rg1/sqrt(6.0)) );
-	erf2 = erf( (x*Rg2/sqrt(6.0)) );
-	//Print erf1
-	
-	ans = G1*exp(-x*x*Rg1*Rg1/3.0);
-	ans += B1*exp(-x*x*Rg2*Rg2/3.0)*pow((erf1*erf1*erf1/x),Pow1);
-	ans += G2*exp(-x*x*Rg2*Rg2/3.0);
-	ans += B2*pow((erf2*erf2*erf2/x),Pow2);
-
-	if(x == 0) {
-		ans = G1+G2;
-	}
-	
-	ans *= scale;
-	ans += bkg;
-	
-	return(ans);
-}
-
-// G. Beaucage's Unified Model (1-4 levels)
-//
-double
-ThreeLevel(double dp[], double q)
-{
-	double x;
-	double ans,G1,Rg1,B1,G2,Rg2,B2,Pow1,Pow2,bkg;
-	double G3,Rg3,B3,Pow3,erf3;
-	double erf1,erf2,scale;
-	
-	x=q;
-	
-	scale = dp[0];
-	G1 = dp[1];	//equivalent to I(0)
-	Rg1 = dp[2];
-	B1 = dp[3];
-	Pow1 = dp[4];
-	G2 = dp[5];
-	Rg2 = dp[6];
-	B2 = dp[7];
-	Pow2 = dp[8];
-	G3 = dp[9];
-	Rg3 = dp[10];
-	B3 = dp[11];
-	Pow3 = dp[12];
-	bkg = dp[13];
-	
-	erf1 = erf( (x*Rg1/sqrt(6.0)) );
-	erf2 = erf( (x*Rg2/sqrt(6.0)) );
-	erf3 = erf( (x*Rg3/sqrt(6.0)) );
-	//Print erf1
-	
-	ans = G1*exp(-x*x*Rg1*Rg1/3.0) + B1*exp(-x*x*Rg2*Rg2/3.0)*pow((erf1*erf1*erf1/x),Pow1);
-	ans += G2*exp(-x*x*Rg2*Rg2/3.0) + B2*exp(-x*x*Rg3*Rg3/3.0)*pow((erf2*erf2*erf2/x),Pow2);
-	ans += G3*exp(-x*x*Rg3*Rg3/3.0) + B3*pow((erf3*erf3*erf3/x),Pow3);
-
-	if(x == 0) {
-		ans = G1+G2+G3;
-	}
-	
-	ans *= scale;
-	ans += bkg;
-	
-	return(ans);
-}
-
-// G. Beaucage's Unified Model (1-4 levels)
-//
-double
-FourLevel(double dp[], double q)
-{
-	double x;
-	double ans,G1,Rg1,B1,G2,Rg2,B2,Pow1,Pow2,bkg;
-	double G3,Rg3,B3,Pow3,erf3;
-	double G4,Rg4,B4,Pow4,erf4;
-	double erf1,erf2,scale;
-	
-	x=q;
-	
-	scale = dp[0];
-	G1 = dp[1];	//equivalent to I(0)
-	Rg1 = dp[2];
-	B1 = dp[3];
-	Pow1 = dp[4];
-	G2 = dp[5];
-	Rg2 = dp[6];
-	B2 = dp[7];
-	Pow2 = dp[8];
-	G3 = dp[9];
-	Rg3 = dp[10];
-	B3 = dp[11];
-	Pow3 = dp[12];
-	G4 = dp[13];
-	Rg4 = dp[14];
-	B4 = dp[15];
-	Pow4 = dp[16];
-	bkg = dp[17];
-	
-	erf1 = erf( (x*Rg1/sqrt(6.0)) );
-	erf2 = erf( (x*Rg2/sqrt(6.0)) );
-	erf3 = erf( (x*Rg3/sqrt(6.0)) );
-	erf4 = erf( (x*Rg4/sqrt(6.0)) );
-	
-	ans = G1*exp(-x*x*Rg1*Rg1/3.0) + B1*exp(-x*x*Rg2*Rg2/3.0)*pow((erf1*erf1*erf1/x),Pow1);
-	ans += G2*exp(-x*x*Rg2*Rg2/3.0) + B2*exp(-x*x*Rg3*Rg3/3.0)*pow((erf2*erf2*erf2/x),Pow2);
-	ans += G3*exp(-x*x*Rg3*Rg3/3.0) + B3*exp(-x*x*Rg4*Rg4/3.0)*pow((erf3*erf3*erf3/x),Pow3);
-	ans += G4*exp(-x*x*Rg4*Rg4/3.0) + B4*pow((erf4*erf4*erf4/x),Pow4);
-
-	if(x == 0) {
-		ans = G1+G2+G3+G4;
-	}
-	
-	ans *= scale;
-	ans += bkg;
-	
-    return(ans);
-}
-
-double
-BroadPeak(double dp[], double q)
-{
-	// variables are:							
-	//[0] Porod term scaling
-	//[1] Porod exponent
-	//[2] Lorentzian term scaling
-	//[3] Lorentzian screening length [A]
-	//[4] peak location [1/A]
-	//[5] Lorentzian exponent
-	//[6] background
-	
-	double aa,nn,cc,LL,Qzero,mm,bgd,inten,qval;
-	qval= q;
-	aa = dp[0];
-	nn = dp[1];
-	cc = dp[2]; 
-	LL = dp[3]; 
-	Qzero = dp[4]; 
-	mm = dp[5]; 
-	bgd = dp[6]; 
-	
-	inten = aa/pow(qval,nn);
-	inten += cc/(1.0 + pow((fabs(qval-Qzero)*LL),mm) );
-	inten += bgd;
-	
-	return(inten);
-}
-
-double
-CorrLength(double dp[], double q)
-{
-	// variables are:							
-	//[0] Porod term scaling
-	//[1] Porod exponent
-	//[2] Lorentzian term scaling
-	//[3] Lorentzian screening length [A]
-	//[4] Lorentzian exponent
-	//[5] background
-	
-	double aa,nn,cc,LL,mm,bgd,inten,qval;
-	qval= q;
-	aa = dp[0];
-	nn = dp[1];
-	cc = dp[2]; 
-	LL = dp[3]; 
-	mm = dp[4]; 
-	bgd = dp[5]; 
-	
-	inten = aa/pow(qval,nn);
-	inten += cc/(1.0 + pow((qval*LL),mm) );
-	inten += bgd;
-	
-	return(inten);
-}
-
-double
-TwoLorentzian(double dp[], double q)
-{
-	// variables are:							
-	//[0] Lorentzian term scaling
-	//[1] Lorentzian screening length [A]
-	//[2] Lorentzian exponent
-	//[3] Lorentzian #2 term scaling
-	//[4] Lorentzian #2 screening length [A]
-	//[5] Lorentzian #2 exponent
-	//[6] background
-		
-	double aa,LL1,nn,cc,LL2,mm,bgd,inten,qval;
-	qval= q;
-	aa = dp[0];
-	LL1 = dp[1];
-	nn = dp[2]; 
-	cc = dp[3]; 
-	LL2 = dp[4]; 
-	mm = dp[5]; 
-	bgd= dp[6];
-	
-	inten = aa/(1.0 + pow((qval*LL1),nn) );
-	inten += cc/(1.0 + pow((qval*LL2),mm) );
-	inten += bgd;
-	
-	return(inten);
-}
-
-double
-TwoPowerLaw(double dp[], double q)
-{
-	//[0] Coefficient
-	//[1] (-) Power @ low Q
-	//[2] (-) Power @ high Q
-	//[3] crossover Q-value
-	//[4] incoherent background
-		
-	double A, m1,m2,qc,bgd,scale,inten,qval;
-	qval= q;
-	A = dp[0];
-	m1 = dp[1];
-	m2 = dp[2]; 
-	qc = dp[3]; 
-	bgd = dp[4]; 
-	
-	if(qval<=qc){
-		inten = A*pow(qval,-1.0*m1);
-	} else {
-		scale = A*pow(qc,-1.0*m1) / pow(qc,-1.0*m2);
-		inten = scale*pow(qval,-1.0*m2);
-	}
-	
-	inten += bgd;
-	
-	return(inten);
-}
-
-double
-PolyGaussCoil(double dp[], double x)
-{
-	//w[0] = scale
-	//w[1] = radius of gyration [ï¿œ]
-	//w[2] = polydispersity, ratio of Mw/Mn
-	//w[3] = bkg [cm-1]
-		
-	double scale,bkg,Rg,uval,Mw_Mn,inten,xi;
-
-	scale = dp[0];
-	Rg = dp[1];
-	Mw_Mn = dp[2]; 
-	bkg = dp[3]; 
-	
-	uval = Mw_Mn - 1.0;
-	if(uval == 0.0) {
-		uval = 1e-6;		//avoid divide by zero error
-	}
-	
-	xi = Rg*Rg*x*x/(1.0+2.0*uval);
-	
-	if(xi < 1e-3) {
-		return(scale+bkg);		//limiting value
-	}
-	
-	inten = 2.0*(pow((1.0+uval*xi),(-1.0/uval))+xi-1.0);
-	inten /= (1.0+uval)*xi*xi;
-
-	inten *= scale;
-	//add in the background
-	inten += bkg;	
-	return(inten);
-}
-
-double
-GaussLorentzGel(double dp[], double x)
-{
-	//[0] Gaussian scale factor
-	//[1] Gaussian (static) screening length
-	//[2] Lorentzian (fluctuation) scale factor
-	//[3] Lorentzian screening length
-	//[4] incoherent background
-		
-	double Ig0,gg,Il0,ll,bgd,inten;
-
-	Ig0 = dp[0];
-	gg = dp[1];
-	Il0 = dp[2]; 
-	ll = dp[3];
-	bgd = dp[4]; 
-	
-	inten = Ig0*exp(-1.0*x*x*gg*gg/2.0) + Il0/(1.0 + (x*ll)*(x*ll)) + bgd;
-	
-	return(inten);
-}
-
-
-double
-GaussianShell(double w[], double x)
-{
-	// variables are:							
-	//[0] scale
-	//[1] radius (ï¿œ)
-	//[2] thick (ï¿œ) (thickness parameter - this is the std. dev. of the Gaussian width of the shell)
-	//[3] polydispersity of the radius
-	//[4] sld shell (ï¿œ-2)
-	//[5] sld solvent
-	//[6] background (cm-1)
-	
-	double scale,rad,delrho,bkg,del,thick,pd,sig,pi;
-	double t1,t2,t3,t4,retval,exfact,vshell,vexcl,sldShell,sldSolvent;
-	scale = w[0];
-	rad = w[1];
-	thick = w[2];
-	pd = w[3];
-	sldShell = w[4];
-	sldSolvent = w[5];
-	bkg = w[6];
-	
-	delrho = w[4] - w[5];
-	sig = pd*rad;
-	
-	pi = 4.0*atan(1.0);
-	
-	///APPROXIMATION (see eqn 4 - but not a bad approximation)
-	// del is the equivalent shell thickness with sharp boundaries, centered at mean radius
-	del = thick*sqrt(2.0*pi);
-	
-	// calculate the polydisperse shell volume and the excluded volume
-	vshell=4.0*pi/3.0*( pow((rad+del/2.0),3) - pow((rad-del/2.0),3) ) *(1.0+pd*pd);
-	vexcl=4.0*pi/3.0*( pow((rad+del/2.0),3) ) *(1.0+pd*pd);
-	
-	//intensity, eqn 9(a-d)
-	exfact = exp(-2.0*sig*sig*x*x);
-	
-	t1 = 0.5*x*x*thick*thick*thick*thick*(1.0+cos(2.0*x*rad)*exfact);
-	t2 = x*thick*thick*(rad*sin(2.0*x*rad) + 2.0*x*sig*sig*cos(2.0*x*rad))*exfact;
-	t3 = 0.5*rad*rad*(1.0-cos(2.0*x*rad)*exfact);
-	t4 = 0.5*sig*sig*(1.0+4.0*x*rad*sin(2.0*x*rad)*exfact+cos(2.0*x*rad)*(4.0*sig*sig*x*x-1.0)*exfact);
-	
-	retval = t1+t2+t3+t4;
-	retval *= exp(-1.0*x*x*thick*thick);
-	retval *= (del*del/x/x);
-	retval *= 16.0*pi*pi*delrho*delrho*scale;
-	retval *= 1.0e8;
-	
-	//NORMALIZED by the AVERAGE shell volume, since scale is the volume fraction of material
-//	retval /= vshell
-	retval /= vexcl;
-	//re-normalize by polydisperse sphere volume, Gaussian distribution
-	retval /= (1.0+3.0*pd*pd);
-	
-	retval += bkg;
-	
-	return(retval);
-}
-
-
Index: sansmodels/src/sans/models/libigor/libTwoPhase.h
===================================================================
--- sansmodels/src/sans/models/libigor/libTwoPhase.h	(revision 8bea12ddb76b18cae350684c1423711b58948114)
+++ 	(revision )
@@ -1,23 +1,0 @@
-// header for TwoPhaseFit.c
-
-//function prototypes
-/* IGOR Fit Functions */
-double TeubnerStreyModel(double dp[], double q);
-double Power_Law_Model(double dp[], double q);
-double Peak_Lorentz_Model(double dp[], double q);
-double Peak_Gauss_Model(double dp[], double q);
-double Lorentz_Model(double dp[], double q);
-double Fractal(double dp[], double q);
-double DAB_Model(double dp[], double q);
-double OneLevel(double dp[], double q);
-double TwoLevel(double dp[], double q);
-double ThreeLevel(double dp[], double q);
-double FourLevel(double dp[], double q);
-double BroadPeak(double dp[], double q);
-double CorrLength(double dp[], double q);
-double TwoLorentzian(double dp[], double q);
-double TwoPowerLaw(double dp[], double q);
-double PolyGaussCoil(double dp[], double q);
-double GaussLorentzGel(double dp[], double q);
-double GaussianShell(double dp[], double q);
-
Index: sansmodels/src/sans/models/libigor/local.def
===================================================================
--- sansmodels/src/sans/models/libigor/local.def	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ 	(revision )
@@ -1,29 +1,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-#                               Michael A.G. Aivazis
-#                        California Institute of Technology
-#                        (C) 1998-2004  All Rights Reserved
-#
-# <LicenseText>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-#
-# Local (project) definitions
-#
-
-# C++
-
-    PROJ_CXX_FLAGS += $(CXX_SOFLAGS)
-    PROJ_LCXX_FLAGS += $(LCXX_SARFLAGS)
-
-#PROJ_CXX_DEFINES += DEEPDEBUG
-#PROJ_CXX_DEFINES += DEBUG
-
-# version
-# $Id: local.def 1280 2007-06-25 07:01:00Z linjiao $
-
-# End of file
Index: sansmodels/src/sans/models/libigor/release_notes.txt
===================================================================
--- sansmodels/src/sans/models/libigor/release_notes.txt	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ 	(revision )
@@ -1,8 +1,0 @@
-Release Notes for 'libigor'
-
-The C code in 'libigor' has been written as part of the SANS analysis package
-that uses IGOR. More information can be found here:
-
-	http://www.ncnr.nist.gov/programs/sans/data/red_anal.html
-	 
-    "Reduction and Analysis of SANS and USANS Data using Igor Pro", Kline, S. R. J Appl. Cryst. 39(6), 895 (2006).
Index: sansmodels/src/sans/models/libigor/winFuncs.c
===================================================================
--- sansmodels/src/sans/models/libigor/winFuncs.c	(revision 6a2c931c3536b9dc9b10b8c6e5e3135853fd83bf)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/* winFuncs.c
-   Adding functions missing from windows math library
-   Andrew Jackson, October 2007
-   */
-
-#include <stdio.h>
-#include <math.h>
-
-#include "winFuncs.h"
-
-
-double fmax(double x, double y){
-	//Doesn't exactly match BSD as if one or other value is NaN behaviour is undefined
-	//BSD returns the other value if one is NaN and NaN if both are NaN
-	//probably wouldn't want to rely on that in any case.
-	if (x > y) {
-		//x is greater than y
-		return x;
-	} else if (y > x) {
-		//y is greater than x
-		return y;
-	} else {
-		//equal
-		return x;
-	}
-}
-
-double fmin(double x, double y){
-	//Doesn't exactly match BSD as if one or other value is NaN behaviour is undefined
-	//BSD returns the other value if one is NaN and NaN if both are NaN
-	//probably wouldn't want to rely on that in any case.
-	if (x < y) {
-		//x is less than y
-		return x;
-	} else if (y < x) {
-		//y is less than x
-		return y;
-	} else {
-		//equal
-		return x;
-	}
-}
-
-double trunc(double x){
-	//This is probably slow as hell
-	if (x > 0){
-		//positive - need floor
-		return floor(x);
-	} else if (x < 0) {
-		//negative - need ceiling
-		return ceil(x);
-	} else {
-		//x is zero or infinity, return x
-		return x;
-	}
-
-}
-
-
-/* erf.c  - public domain implementation of error function erf(3m)
-
-reference - Haruhiko Okumura: C-gengo niyoru saishin algorithm jiten
-            (New Algorithm handbook in C language) (Gijyutsu hyouron
-            sha, Tokyo, 1991) p.227 [in Japanese]                 */
-
-
-#ifdef _WIN32
-# include <float.h>
-# if !defined __MINGW32__ || defined __NO_ISOCEXT
-#  ifndef isnan
-#   define isnan(x) _isnan(x)
-#  endif
-#  ifndef isinf
-#   define isinf(x) (!_finite(x) && !_isnan(x))
-#  endif
-#  ifndef finite
-#   define finite(x) _finite(x)
-#  endif
-# endif
-#endif
-
-static double q_gamma(double, double, double);
-
-/* Incomplete gamma function
-   1 / Gamma(a) * Int_0^x exp(-t) t^(a-1) dt  */
-static double p_gamma(double a, double x, double loggamma_a)
-{
-    int k;
-    double result, term, previous;
-
-    if (x >= 1 + a) return 1 - q_gamma(a, x, loggamma_a);
-    if (x == 0)     return 0;
-    result = term = exp(a * log(x) - x - loggamma_a) / a;
-    for (k = 1; k < 1000; k++) {
-        term *= x / (a + k);
-        previous = result;  result += term;
-        if (result == previous) return result;
-    }
-    fprintf(stderr, "erf.c:%d:p_gamma() could not converge.", __LINE__);
-    return result;
-}
-
-/* Incomplete gamma function
-   1 / Gamma(a) * Int_x^inf exp(-t) t^(a-1) dt  */
-static double q_gamma(double a, double x, double loggamma_a)
-{
-    int k;
-    double result, w, temp, previous;
-    double la = 1, lb = 1 + x - a;  /* Laguerre polynomial */
-
-    if (x < 1 + a) return 1 - p_gamma(a, x, loggamma_a);
-    w = exp(a * log(x) - x - loggamma_a);
-    result = w / lb;
-    for (k = 2; k < 1000; k++) {
-        temp = ((k - 1 - a) * (lb - la) + (k + x) * lb) / k;
-        la = lb;  lb = temp;
-        w *= (k - 1 - a) / k;
-        temp = w / (la * lb);
-        previous = result;  result += temp;
-        if (result == previous) return result;
-    }
-    fprintf(stderr, "erf.c:%d:q_gamma() could not converge.", __LINE__);
-    return result;
-}
-
-#define LOG_PI_OVER_2 0.572364942924700087071713675675 /* log_e(PI)/2 */
-
-double erf(double x)
-{
-    if (!finite(x)) {
-        if (isnan(x)) return x;      /* erf(NaN)   = NaN   */
-        return (x>0 ? 1.0 : -1.0);   /* erf(+-inf) = +-1.0 */
-    }
-    if (x >= 0) return   p_gamma(0.5, x * x, LOG_PI_OVER_2);
-    else        return - p_gamma(0.5, x * x, LOG_PI_OVER_2);
-}
-
-double erfc(double x)
-{
-    if (!finite(x)) {
-        if (isnan(x)) return x;      /* erfc(NaN)   = NaN      */
-        return (x>0 ? 0.0 : 2.0);    /* erfc(+-inf) = 0.0, 2.0 */
-    }
-    if (x >= 0) return  q_gamma(0.5, x * x, LOG_PI_OVER_2);
-    else        return  1 + p_gamma(0.5, x * x, LOG_PI_OVER_2);
-}
Index: sansmodels/src/sans/models/libigor/winFuncs.h
===================================================================
--- sansmodels/src/sans/models/libigor/winFuncs.h	(revision 09e89b7edf2e2980feac6922ea47d5cf617cdff3)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#if !defined(WINFUNCS_H)
-#define WINFUNCS_H
-/* winFuncs.h
-   Definitions for missing math lib functions
-   Andrew Jackson, October 2007
-   */
-
-double fmax(double x, double y);
-//long double fmaxl (long double x, long double y);
-//float fmaxf (float x, float y);
-
-double fmin(double x, double y);
-
-double trunc(double x);
-//long double truncl(long double x);
-//float truncf(float x);
-
-double erf(double x);
-//long double erfl(long double x);
-//float erff (float x);
-//double erfc(double x);
-//long double erfcl(long double x);
-//float erfcf(float x;
-
-
-// Define INFINITY and NAN
-typedef union { unsigned char __c[4]; float __f; } __huge_valf_t;
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 }
-# endif
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f }
-# endif
-
-static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
-# define INFINITY  (__huge_valf.__f)
-
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define __nan_bytes   { 0x7f, 0xc0, 0, 0 }
-# endif
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define __nan_bytes   { 0, 0, 0xc0, 0x7f }
-# endif
-
-static union { unsigned char __c[4]; float __d; } __nan_union;
-# define NAN  (__nan_union.__d)
-
-#endif
