Index: c/sas/models/AddComponent.py
===================================================================
--- src/sas/models/AddComponent.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-#!/usr/bin/env python
-
-""" 
-Provide base functionality for all model components
-
-:author: Mathieu Doucet / UTK
-
-:contact: mathieu.doucet@nist.gov
-
-"""
-
-# info
-__author__ = "Mathieu Doucet /  UTK"
-__id__ = "$Id: BaseComponent.py,v 1.2 2007/03/14 21:04:40 doucet Exp $"
-   
-# imports   
-from sas.models.BaseComponent import BaseComponent
-
-class AddComponent(BaseComponent):
-    """ 
-    Basic model component for Addition
-    Provides basic arithmetics
-    """
-
-    def __init__(self, base=None, other=None):
-        """
-        :param base: component to add to 
-        :param other: component to add
-        
-        """
-        BaseComponent.__init__(self)
-        # Component to add to
-        self.operateOn = base
-        # Component to add
-        self.other = other
-        # name
-        self.name = 'AddComponent'
-        
-    def run(self, x=0):
-        """
-        Evaluate each part of the component and sum the results
-        
-        :param x: input parameter
-        
-        :return: value of the model at x
-        
-        """
-        return self.operateOn.run(x) + self.other.run(x)
-        
-    def runXY(self, x=0):
-        """
-        Evaluate each part of the component and sum the results
-        
-        :param x: input parameter
-        
-        :return: value of the model at x
-        
-        """
-        return self.operateOn.runXY(x) + self.other.runXY(x)
-        
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-        
-        :param name: name of parameter to set
-        :param value: value to give the paramter
-        
-        """
-        return BaseComponent.setParamWithToken(self, name, 
-                                               value, 'add', self.other)
-    
-    def getParam(self, name):
-        """ 
-        Set the value of a model parameter
-        
-        :param name: name of the parameter
-        
-        :return: value of the parameter
-        
-        """
-        return BaseComponent.getParamWithToken(self, name, 'add', self.other)
-    
-    def getParamList(self):
-        """ 
-        Return a list of all available parameters for the model 
-        """
-        return BaseComponent.getParamListWithToken(self, 'add', self.other)
-        
-    
-# End of file
Index: c/sas/models/BEPolyelectrolyte.py
===================================================================
--- src/sas/models/BEPolyelectrolyte.py	(revision ac7be54ccf932e813cbe6e41e05b682a1630a03e)
+++ 	(revision )
@@ -1,128 +1,0 @@
-"""
- BEPolyelectrolyte as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class BEPolyelectrolyte(BaseComponent):
-    """
-        Class that evaluates a BEPolyelectrolyte.
-        
-        F(x) = K/(4 pi Lb (alpha)^(2)) (q^(2)+k2)/(1+(r02)^(2)) (q^(2)+k2)\
-                        (q^(2)-(12 h C/b^(2)))
-        
-        The model has Eight parameters::
-
-            K        = Constrast factor of the polymer
-            Lb       = Bjerrum length
-            H        = virial parameter
-            B        = monomer length
-            Cs       = Concentration of monovalent salt
-            alpha    = ionazation degree
-            C        = polymer molar concentration
-            bkd      = background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "BEPolyelectrolyte"
-        self.description = """
-        F(x) = K*1/(4*pi*Lb*(alpha)^(2))*(q^(2)+k^(2))/(1+(r02)^(2))
-            *(q^(2)+k^(2))*(q^(2)-(12*h*C/b^(2)))+bkd
-                
-        The model has Eight parameters: 
-        K        =  Constrast factor of the polymer
-        Lb       =  Bjerrum length
-        H        =  virial parameter
-        B        =  monomer length
-        Cs       =  Concentration of monovalent salt 
-        alpha    =  ionazation degree 
-        C        = polymer molar concentration
-        bkd      = background
-        """
-        ## Define parameters
-        self.params = {}
-        self.params['k']     = 10
-        self.params['lb']    = 7.1
-        self.params['h']     = 12
-        self.params['b']     = 10
-        self.params['cs']    = 0.0
-        self.params['alpha'] = 0.05
-        self.params['c']     = 0.7
-        self.params['background']  = 0.0
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['k']     = ['[barns]', None, None]
-        self.details['lb']    = ['[A]', None, None]
-        self.details['h']     = ['[1/A^(2)]', None, None]
-        self.details['b']     = ['[A]', None, None]
-        self.details['cs']    = ['[mol/L]', None, None]
-        self.details['alpha'] = ['', None, None]
-        self.details['c']     = ['[mol/L]', None, None]
-        self.details['background'] = ['[1/cm]', None, None]
-        #list of parameter that cannot be fitted
-        self.fixed = []
-               
-    def _BEPoly(self, x):
-        """
-            Evaluate  
-            F(x) = K 1/(4 pi Lb (alpha)^(2)) (q^(2)+k2)/(1+(r02)^(2))
-                 (q^(2)+k2) (q^(2)-(12 h C/b^(2)))
-        
-            has 3 internal parameters :
-                   The inverse Debye Length: K2 = 4 pi Lb (2 Cs+alpha C)
-                   r02 =1/alpha/Ca^(0.5) (B/(48 pi Lb)^(0.5))
-                   Ca = 6.022136e-4 C
-        """
-        Ca = self.params['c'] * 6.022136e-4
-        #remove singulars
-        if self.params['alpha']<=0 or self.params['c']<=0\
-            or self.params['b']==0 or self.params['lb']<=0:
-            return 0
-        else:
-            
-            K2 = 4.0 * math.pi * self.params['lb'] * (2*self.params['cs'] + \
-                     self.params['alpha'] * Ca)
-            
-            r02 = 1.0/self.params['alpha']/math.sqrt(Ca) * \
-                    (self.params['b']/\
-                     math.sqrt((48.0*math.pi*self.params['lb'])))
-            
-            return self.params['k']/( 4.0 * math.pi * self.params['lb'] \
-                                      * self.params['alpha']**2 ) \
-                   * ( x**2 + K2 ) / ( 1.0 + r02**2 * ( x**2 + K2 ) \
-                        * (x**2 - ( 12.0 * self.params['h'] \
-                        * Ca/(self.params['b']**2) ))) \
-                        + self.params['background']
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (debye value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._BEPoly(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._BEPoly(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: debye value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._BEPoly(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._BEPoly(x)
Index: c/sas/models/BaseComponent.py
===================================================================
--- src/sas/models/BaseComponent.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,310 +1,0 @@
-#!/usr/bin/env python
-
-""" 
-Provide base functionality for all model components
-"""
-
-# imports   
-import copy
-import numpy
-#TO DO: that about a way to make the parameter
-#is self return if it is fittable or not  
-
-class BaseComponent:
-    """ 
-    Basic model component
-    
-    Since version 0.5.0, basic operations are no longer supported.
-    """
-
-    def __init__(self):
-        """ Initialization"""
-        
-        ## Name of the model
-        self.name = "BaseComponent"
-        
-        ## Parameters to be accessed by client
-        self.params = {}
-        self.details = {}
-        ## Dictionary used to store the dispersity/averaging
-        #  parameters of dispersed/averaged parameters.
-        self.dispersion = {}
-        # string containing information about the model such as the equation
-        #of the given model, exception or possible use
-        self.description = ''
-        #list of parameter that can be fitted
-        self.fixed = []
-        #list of non-fittable parameter
-        self.non_fittable = []
-        ## parameters with orientation
-        self.orientation_params = []
-        ## magnetic parameters
-        self.magnetic_params = []
-        ## store dispersity reference
-        self._persistency_dict = {}
-        ## independent parameter name and unit [string]
-        self.input_name = "Q"
-        self.input_unit = "A^{-1}"
-        ## output name and unit  [string]
-        self.output_name = "Intensity"
-        self.output_unit = "cm^{-1}"
-        
-    def __str__(self):
-        """ 
-        :return: string representatio
-
-        """
-        return self.name
-   
-    def is_fittable(self, par_name):
-        """
-        Check if a given parameter is fittable or not
-        
-        :param par_name: the parameter name to check 
-        
-        """
-        return par_name.lower() in self.fixed
-        #For the future
-        #return self.params[str(par_name)].is_fittable()
-   
-    def run(self, x): 
-        """
-        run 1d
-        """
-        return NotImplemented
-    
-    def runXY(self, x): 
-        """
-        run 2d
-        """
-        return NotImplemented  
-    
-    def calculate_ER(self): 
-        """
-        Calculate effective radius
-        """
-        return NotImplemented  
-    
-    def calculate_VR(self): 
-        """
-        Calculate volume fraction ratio
-        """
-        return NotImplemented 
-    
-    def evalDistribution(self, qdist):
-        """
-        Evaluate a distribution of q-values.
-        
-        * For 1D, a numpy array is expected as input: ::
-        
-            evalDistribution(q)
-            
-          where q is a numpy array.
-        
-        
-        * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime],
-          where 1D arrays, ::
-        
-              qx_prime = [ qx[0], qx[1], qx[2], ....]
-
-          and ::
-
-              qy_prime = [ qy[0], qy[1], qy[2], ....] 
-        
-        Then get ::
-
-            q = numpy.sqrt(qx_prime^2+qy_prime^2)
-        
-        that is a qr in 1D array; ::
-
-            q = [q[0], q[1], q[2], ....] 
-        
-        ..note::
-          Due to 2D speed issue, no anisotropic scattering 
-          is supported for python models, thus C-models should have
-          their own evalDistribution methods.
-        
-        The method is then called the following way: ::
-        
-            evalDistribution(q)
-
-        where q is a numpy array.
-        
-        :param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 1D ndarrays
-        """
-        if qdist.__class__.__name__ == 'list':
-            # Check whether we have a list of ndarrays [qx,qy]
-            if len(qdist)!=2 or \
-                qdist[0].__class__.__name__ != 'ndarray' or \
-                qdist[1].__class__.__name__ != 'ndarray':
-                msg = "evalDistribution expects a list of 2 ndarrays"
-                raise RuntimeError, msg
-                
-            # Extract qx and qy for code clarity
-            qx = qdist[0]
-            qy = qdist[1]
-            
-            # calculate q_r component for 2D isotropic
-            q = numpy.sqrt(qx**2+qy**2)
-            # vectorize the model function runXY
-            v_model = numpy.vectorize(self.runXY, otypes=[float])
-            # calculate the scattering
-            iq_array = v_model(q)
-
-            return iq_array
-                
-        elif qdist.__class__.__name__ == 'ndarray':
-            # We have a simple 1D distribution of q-values
-            v_model = numpy.vectorize(self.runXY, otypes=[float])
-            iq_array = v_model(qdist)
-            return iq_array
-            
-        else:
-            mesg = "evalDistribution is expecting an ndarray of scalar q-values"
-            mesg += " or a list [qx,qy] where qx,qy are 2D ndarrays."
-            raise RuntimeError, mesg
-        
-    
-    
-    def clone(self):
-        """ Returns a new object identical to the current object """
-        obj = copy.deepcopy(self)
-        return self._clone(obj)
-    
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal
-        data members to a fresh copy.
-        """
-        obj.params     = copy.deepcopy(self.params)
-        obj.details    = copy.deepcopy(self.details)
-        obj.dispersion = copy.deepcopy(self.dispersion)
-        obj._persistency_dict = copy.deepcopy( self._persistency_dict)
-        return obj
-    
-    def set_dispersion(self, parameter, dispersion):
-        """
-        model dispersions
-        """ 
-        ##Not Implemented
-        return None
-        
-    def getProfile(self):
-        """
-        Get SLD profile 
-        
-        : return: (z, beta) where z is a list of depth of the transition points
-                beta is a list of the corresponding SLD values 
-        """
-        #Not Implemented
-        return None, None
-            
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        :param name: name of the parameter
-        :param value: value of the parameter
-        
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2:
-            for item in self.dispersion.keys():
-                if item.lower()==toks[0].lower():
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            self.dispersion[item][par] = value
-                            return
-        else:
-            # Look for standard parameter
-            for item in self.params.keys():
-                if item.lower()==name.lower():
-                    self.params[item] = value
-                    return
-            
-        raise ValueError, "Model does not contain parameter %s" % name
-        
-    def getParam(self, name):
-        """ 
-        Set the value of a model parameter
-
-        :param name: name of the parameter
-        
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2:
-            for item in self.dispersion.keys():
-                if item.lower()==toks[0].lower():
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            return self.dispersion[item][par]
-        else:
-            # Look for standard parameter
-            for item in self.params.keys():
-                if item.lower()==name.lower():
-                    return self.params[item]
-            
-        raise ValueError, "Model does not contain parameter %s" % name
-     
-    def getParamList(self):
-        """ 
-        Return a list of all available parameters for the model
-        """ 
-        list = self.params.keys()
-        # WARNING: Extending the list with the dispersion parameters
-        list.extend(self.getDispParamList())
-        return list
-    
-    def getDispParamList(self):
-        """ 
-        Return a list of all available parameters for the model
-        """ 
-        list = []
-        
-        for item in self.dispersion.keys():
-            for p in self.dispersion[item].keys():
-                if p not in ['type']:
-                    list.append('%s.%s' % (item.lower(), p.lower()))
-                    
-        return list
-    
-    # Old-style methods that are no longer used
-    def setParamWithToken(self, name, value, token, member): 
-        """
-        set Param With Token
-        """
-        return NotImplemented
-    def getParamWithToken(self, name, token, member): 
-        """
-        get Param With Token
-        """
-        return NotImplemented
-    
-    def getParamListWithToken(self, token, member): 
-        """
-        get Param List With Token
-        """
-        return NotImplemented
-    def __add__(self, other): 
-        """
-        add
-        """
-        raise ValueError, "Model operation are no longer supported"
-    def __sub__(self, other): 
-        """
-        sub
-        """
-        raise ValueError, "Model operation are no longer supported"
-    def __mul__(self, other): 
-        """
-        mul
-        """
-        raise ValueError, "Model operation are no longer supported"
-    def __div__(self, other): 
-        """
-        div
-        """
-        raise ValueError, "Model operation are no longer supported"
-        
Index: c/sas/models/BaseModel.py
===================================================================
--- src/sas/models/BaseModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,136 +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 base functionality for all model components
-
-The following has changed since going from BaseComponent to BaseModel:
-
-    - Arithmetic operation between models is no longer supported.
-      It was found to be of little use and not very flexible.
-    
-    - Parameters are now stored as Parameter object to provide 
-      the necessary extra information like limits, units, etc... 
-"""
-
-# imports   
-import copy
-   
-class Parameter(object):
-    """
-    Parameter class
-    """
-    name  = ''
-    value = 0.0
-    def __init__(self, name, value):
-        self.name = name
-        self.value = value
-        
-    def __str__(self):
-        return "%s: %g" % (self.name, self.value)
-
-class ParameterProperty(object):
-    """
-    Parameter property allow direct access to
-    the parameter values
-    """
-    def __init__(self,name,**kw):
-        self.name = name
-       
-    def __get__(self,instance,cls):
-        return instance.parameters[self.name].value
-
-    def __set__(self,instance,value):
-        instance.parameters[self.name].value = value
-
-
-   
-from ModelAdaptor import ModelAdaptor
-
-class BaseModel(ModelAdaptor):
-    """ 
-    Basic model component
-    """
-    ## Name of the model
-    name = "BaseModel"
-    
-    def __init__(self):
-        ## Dictionary of Parameter objects
-        self.parameters = {}
-
-    # Evaluation methods to be implemented by the models
-    def run(self, x=0):  return NotImplemented
-    def runXY(self, x=0):  return NotImplemented
-    def calculate_ER(self):  return NotImplemented
-    def __call__(self, x=0):
-        """     
-        Evaluate the model. Equivalent to runXY(x)
-        
-        :param x: input value
-        
-        :return: value of the model
-        
-        """
-        return self.runXY(x)
-    
-    def clone(self):
-        """ Returns a new object identical to the current object """
-        
-        obj = copy.deepcopy(self)
-        obj.params = copy.deepcopy(self.params)
-        obj.details = copy.deepcopy(self.details)
-        return obj
-    
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        :param name: name of the parameter
-        :param value: value of the parameter
-        
-        """
-        # Lowercase for case insensitivity
-        name = name.lower()
-        if name in self.parameters:
-            print "found"
-            #self.parameters[name].value = value
-        return object.__setattr__(self, name, value)
-        
-    def getParam(self, name):
-        """ 
-        Set the value of a model parameter
-
-        :param name: name of the parameter
-        :param value: value of the parameter
-        
-        """
-        # Lowercase for case insensitivity
-        name = name.lower()
-        return object.__getattribute__(self, name)
-        
-    def getParamList(self):
-        """ 
-        Return a list of all available parameters for the model 
-        """
-        param_list = self.params.keys()
-        return param_list
-        
-    
-if __name__ == "__main__":
-    b = BaseModel() 
-    #print b.operateOn
-    
Index: c/sas/models/BroadPeakModel.py
===================================================================
--- src/sas/models/BroadPeakModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-""" 
-    BroadPeakModel function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
-from numpy import power
-
-class BroadPeakModel(BaseComponent):
-    """ 
-    Class that evaluates a BroadPeakModel.
-    I(q) = I(q) = scale_p/pow(qval,exponent)+scale_l/
-    (1.0 + pow((qval*length_l),exponent_l) )+ background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        self.counter = 0
-        ## Name of the model
-        self.name = "BroadPeakModel"
-        self.description = """I(q) = scale_p/pow(q,exponent)+scale_l/
-        (1.0 + pow((fabs(q-q_peak)*length_l),exponent_l) )+ background
-             List of default parameters:
-             scale_p = Porod term scaling
-             exponent_p = Porod exponent
-             scale_l = Lorentzian term scaling
-             length_l = Lorentzian screening length [A]
-             q_peak = peak location [1/A]
-             exponent_l = Lorentzian exponent
-             background = Incoherent background
-        """
-        ## Define parameters
-        self.params = {}
-        self.params['scale_p']  = 1.0e-05
-        self.params['exponent_p']     = 3.0
-        self.params['scale_l']  = 10.0
-        self.params['length_l']     = 50.0
-        self.params['q_peak']     = 0.1
-        self.params['exponent_l']     = 2.0
-        self.params['background']     = 0.1
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale_p'] = ['', None, None]
-        self.details['exponent_p'] =  ['', None, None]
-        self.details['scale_l']  =  ['', None, None]
-        self.details['length_l']  =   ['[A]', None, None]
-        self.details['q_peak']  =  ['[1/A]', None, None]
-        self.details['exponent_l']  =   ['', None, None]
-        self.details['background']   =  ['[1/cm]', None, None]
-
-        #list of parameter that cannot be fitted
-        self.fixed = []  
-    def _broadpeak(self, x):
-        """
-        Model definition
-        """
-        inten = self.params['scale_p']/pow(x,self.params['exponent_p'])
-        inten += self.params['scale_l']/(1.0 + \
-                power((math.fabs(x-self.params['q_peak'])\
-                       *self.params['length_l']),\
-                    self.params['exponent_l']))
-
-        inten += self.params['background']
-        
-        return inten  
-   
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        param x: input q-value (float or [float, float] as [r, theta])
-        return: (scattering value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._broadpeak(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._broadpeak(x)
-   
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        param x: input q-value (float or [float, float] as [qx, qy])
-        return: scattering value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._broadpeak(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._broadpeak(x)
-        
-        
Index: c/sas/models/Constant.py
===================================================================
--- src/sas/models/Constant.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-""" 
-    Provide constant function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import copy
-
-class Constant(BaseComponent):
-    """
-    Class that evaluates a constant model. 
-    List of default parameters:
-    
-    * value           = 1.0 
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Constant"
-        self.description = 'F(c)= c where c is a constant'
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['value'] = ['', None, None]
-        self.params['value'] = 1.0
-        #list of parameter that cannot be fitted
-        self.fixed = []
-    def clone(self):
-        """ Return a identical copy of self """
-        obj = Constant()
-        obj.params = copy.deepcopy(self.params)
-        return obj   
-    
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: unused
-            @return: (constant value)
-        """
-        return self.params['value']
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: unused
-            @return: constant value
-        """
-        return self.params['value']
-   
-# End of file
Index: c/sas/models/CoreMultiShellModel.py
===================================================================
--- src/sas/models/CoreMultiShellModel.py	(revision e0c16ce98473cdb3b4705e5df48c3cf15ac1b858)
+++ 	(revision )
@@ -1,320 +1,0 @@
-"""
-    Core-Multi-Shell model
-"""
-from sas.models.BaseComponent import BaseComponent
-from sas.models.CoreFourShellModel import CoreFourShellModel
-import copy
-max_nshells = 5
-class CoreMultiShellModel(BaseComponent):
-    """
-    This multi-model is based on CoreFourShellModel and provides the capability
-    of changing the number of shells between 1 and 4.
-    """
-    def __init__(self, multfactor=1):
-        BaseComponent.__init__(self)
-        """
-        :param n_shells: number of shells in the model, assumes 1<= n_shells <=4.
-        """
-
-        ## Setting  model name model description
-        self.description=""
-        model = CoreFourShellModel()
-        self.model = model
-        self.name = "CoreMultiShellModel"
-        self.description=""
-        self.n_shells = multfactor
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        # non-fittable parameters
-        self.non_fittable = model.non_fittable
-        
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        self.orientation_params = []
-        self.magnetic_params = []
-        
-        ## functional multiplicity info of the model
-        # [int(maximum no. of functionality),"str(Titl),
-        # [str(name of function0),...], [str(x-asix name of sld),...]]
-        self.multiplicity_info = [max_nshells, "No. of Shells:", [], ['Radius']]
-
-        ## parameters with orientation: can be removed since there is no orientational params
-        self._set_orientation_params()
-
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal
-        data members to a fresh copy.
-        """
-        obj.params = copy.deepcopy(self.params)
-        obj.description = copy.deepcopy(self.description)
-        obj.details = copy.deepcopy(self.details)
-        obj.dispersion = copy.deepcopy(self.dispersion)
-        obj.model = self.model.clone()
-
-        return obj
-
-    def _set_dispersion(self):
-        """
-        model dispersions
-        Polydispersion should not be applied to s_model
-        """
-        ##set dispersion from model
-        for name , value in self.model.dispersion.iteritems():      
-            nshell = 0
-            if name.split('_').count('thick') > 0:
-                while nshell < self.n_shells:
-                    nshell += 1
-                    if name.split('_')[-1] == 'shell%s' % str(nshell):
-                        self.dispersion[name] = value
-                    else:
-                        continue
-            else:
-                self.dispersion[name] = value
-
-    def _set_orientation_params(self):
-        """
-        model orientation and magnetic parameters, same params for this model
-        """
-        ##set dispersion from model 
-        for param in self.model.orientation_params:     
-            nshell = 0
-            if param.split('_')[-1].count('shell') < 1:
-                #print "param", param, param.split('_')[-1].count('shell')
-                self.orientation_params.append(param)
-                self.magnetic_params.append(param)
-                continue
-            while nshell < self.n_shells:
-                nshell += 1
-                if param.split('_')[-1] == 'shell%s' % str(nshell):
-                    self.orientation_params.append(param)
-                    self.magnetic_params.append(param)
-                    continue
-
-    def _set_params(self):
-        """
-        Concatenate the parameters of the model to create
-        this model parameters
-        """
-        # rearrange the parameters for the given # of shells
-        for name , value in self.model.params.iteritems():
-            nshell = 0
-            if name.split('_').count('thick') > 0 or \
-                        name.split('_').count('sld') > 0 or \
-                        name[0] == 'M':
-                if name.split('_')[-1] == 'solv' or \
-                        name.split('_')[-1] == 'core0':
-                    self.params[name]= value
-                    continue
-                while nshell < self.n_shells:
-                    nshell += 1
-                    if name.split('_')[-1] == 'shell%s' % str(nshell):
-                        self.params[name]= value
-                        continue
-            else:
-                self.params[name]= value
-
-        # set constrained values for the original model params
-        self._set_xtra_model_param()
-
-    def _set_details(self):
-        """
-        Concatenate details of the original model to create
-        this model details
-        """
-        for name ,detail in self.model.details.iteritems():
-            if name in self.params.iterkeys():
-                self.details[name]= detail
-
-
-    def _set_xtra_model_param(self):
-        """
-        Set params of original model that are hidden from this model
-        """
-        # look for the model parameters that are not in param list
-        for key in self.model.params.iterkeys():
-            if key not in self.params.keys():
-                if  key.split('_').count('thick') > 0:
-                    self.model.setParam(key, 0)
-                    continue
-
-                for nshell in range(self.n_shells,max_nshells):
-                     if key.split('_').count('sld') > 0 and \
-                            key.split('_')[-1] == 'shell%s' % str(nshell+1):
-                        try:
-                            if key[0] != 'M':
-                                value = self.model.params['sld_solv']
-                                self.model.setParam(key, value)
-                            else:
-                                self.model.setParam(key, 0.0)
-                        except: pass
-
-
-    def getProfile(self):
-        """
-        Get SLD profile
-        **Note:** This works only for func_shell num = 2.
-
-        :return: (r, beta) where r is a list of radius of the transition points\
-         and beta is a list of the corresponding SLD values.
-        """
-        r = []
-        beta = []
-        # for core at r=0
-        r.append(0)
-        beta.append(self.params['sld_core0'])
-        # for core at r=rad_core
-        r.append(self.params['rad_core0'])
-        beta.append(self.params['sld_core0'])
-
-        # for shells
-        for n in range(1, self.n_shells+1):
-            # Left side of each shells
-            r0 = r[len(r)-1]
-            r.append(r0)
-            exec "beta.append(self.params['sld_shell%s'% str(n)])"
-
-            # Right side of each shells
-            exec "r0 += self.params['thick_shell%s'% str(n)]"
-            r.append(r0)
-            exec "beta.append(self.params['sld_shell%s'% str(n)])"
-
-        # for solvent
-        r0 = r[len(r)-1]            
-        r.append(r0)
-        beta.append(self.params['sld_solv'])
-        r_solv = 5*r0/4
-        r.append(r_solv)
-        beta.append(self.params['sld_solv'])
-
-        return r, beta
-
-    def setParam(self, name, value):
-        """
-        Set the value of a model parameter
-
-        :param name: name of the parameter
-        :param value: value of the parameter
-        """
-        # set param to new model
-        self._setParamHelper( name, value)
-        ## setParam to model
-        if name == 'sld_solv':
-            # the sld_*** model.params not in params must set to value of sld_solv
-            for key in self.model.params.iterkeys():
-                if key not in self.params.keys():
-                    if key.split('_')[0] == 'sld':
-                        self.model.setParam(key, value)
-                    elif key.split('_')[1] == 'sld':
-                        # mag params
-                        self.model.setParam(key, 0.0)
-        self.model.setParam( name, value)
-
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setParam
-        """
-        #look for dispersion parameters
-        toks = name.split('.')
-        if len(toks) == 2:
-            for item in self.dispersion.keys():
-                if item.lower()==toks[0].lower():
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            self.dispersion[item][par] = value
-                            return
-        # Look for standard parameter
-        for item in self.params.keys():
-            if item.lower()==name.lower():
-                self.params[item] = value
-                return
-        #raise ValueError, "Model does not contain parameter %s" % name
-
-
-    def _set_fixed_params(self):
-        """
-        Fill the self.fixed list with the model fixed list
-        """
-        for item in self.model.fixed:
-            if item.split('.')[0] in self.params.keys():
-                self.fixed.append(item)
-
-        self.fixed.sort()
-
-    def run(self, x = 0.0):
-        """
-        Evaluate the model
-
-        :param x: input q-value (float or [float, float] as [r, theta])
-        :return: (DAB value)
-        """
-        # set effective radius and scaling factor before run
-
-        return self.model.run(x)
-
-    def runXY(self, x = 0.0):
-        """
-        Evaluate the model
-
-        :param x: input q-value (float or [float, float] as [qx, qy])
-        :return: DAB value
-        """  
-        # set effective radius and scaling factor before run
-
-        return self.model.runXY(x)
-
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x = []):
-        """
-        Evaluate the model in cartesian coordinates
-
-        :param x: input q[], or [qx[], qy[]]
-        :return: scattering function P(q[])
-        """
-        # set effective radius and scaling factor before run
-        return self.model.evalDistribution(x)
-
-    def calculate_ER(self):
-        """
-        Calculate the effective radius for P(q)*S(q)
-
-        :return: the value of the effective radius
-        """
-        return self.model.calculate_ER() 
-
-    def calculate_VR(self):
-        """
-        Calculate the volf ratio for P(q)*S(q)
-
-        :return: the value of the volf ratio
-        """
-        return self.model.calculate_VR()
-
-    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
-        """
-        value = None
-        try:
-            if parameter in self.model.dispersion.keys():
-                value = self.model.set_dispersion(parameter, dispersion)
-            self._set_dispersion()
-            return value
-        except:
-            raise
Index: c/sas/models/CorrLengthModel.py
===================================================================
--- src/sas/models/CorrLengthModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#!/usr/bin/env python
-""" 
-CorrLengthModel function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-from numpy import power
-import math
-
-class CorrLengthModel(BaseComponent):
-    """ 
-    Class that evaluates a CorrLengthModel.
-    I(q) = I(q) = scale_p/pow(q,exponent)+scale_l/
-    (1.0 + pow((q*length_l),exponent_l) )+ background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "CorrLength"
-        self.description = """I(q) = scale_p/pow(q,exponent)+scale_l/
-            (1.0 + pow((q*length_l),exponent_l) )+ background
-             List of default parameters:
-             scale_p = Porod term scaling
-             exponent_p = Porod exponent
-             scale_l = Lorentzian term scaling
-             length_l = Lorentzian screening length [A]
-             exponent_l = Lorentzian exponent
-             background = Incoherent background
-        """
-        ## Define parameters
-        self.params = {}
-        self.params['scale_p']  = 1.0e-06
-        self.params['exponent_p']     = 3.0
-        self.params['scale_l']  = 10.0
-        self.params['length_l']     = 50.0
-        self.params['exponent_l']     = 2.0
-        self.params['background']     = 0.1
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale_p'] = ['', None, None]
-        self.details['exponent_p'] =  ['', None, None]
-        self.details['scale_l']  =  ['', None, None]
-        self.details['length_l']  =   ['A', None, None]
-        self.details['exponent_l']  =   ['', None, None]
-        self.details['background']   =  ['[1/cm]', None, None]
-
-        #list of parameter that cannot be fitted
-        self.fixed = []  
-    def _corrlength(self, x):
-        """
-        Model definition
-        """
-        inten = self.params['scale_p']/pow(x, self.params['exponent_p'])
-        inten += self.params['scale_l']/(1.0 + \
-                power((x*self.params['length_l']), self.params['exponent_l']))
-        inten += self.params['background']
-
-        return inten  
-   
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        param x: input q-value (float or [float, float] as [r, theta])
-        return: (scattering value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._corrlength(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._corrlength(x)
-   
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        param x: input q-value (float or [float, float] as [qx, qy])
-        return: scattering value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._corrlength(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._corrlength(x)
Index: c/sas/models/Cos.py
===================================================================
--- src/sas/models/Cos.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-""" 
-    Provide cos(x) function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
- 
-class Cos(BaseComponent):
-    """ 
-        Class that evaluates a cos(x) model. 
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Cos"
-        self.description = 'F(x)=cos(x)'
-        ## Parameter details [units, min, max]
-        self.details = {}
-   
-    def clone(self):
-        """ Return a identical copy of self """
-        return Cos()
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input x, or [x, phi] [radian]
-            @return: cos(x) or cos(x*cos(phi))*cos(x*cos(phi))
-        """
-        if x.__class__.__name__ == 'list':
-            return math.cos(x[0]*math.cos(x[1]))*math.cos(x[0]*math.sin(x[1]))
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return math.cos(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input x, or [x, y] [radian]
-            @return: cos(x) or cos(x)*cos(y)
-        """
-        if x.__class__.__name__ == 'list':
-            return math.cos(x[0])*math.cos(x[1])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return math.cos(x)
-
Index: c/sas/models/DebyeModel.py
===================================================================
--- src/sas/models/DebyeModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-""" 
-    Provide F(x) = 2( exp(-x) + x - 1 )/x**2
-    with x = (q*R_g)**2
-    
-    Debye function as a BaseComponent model
-"""
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class DebyeModel(BaseComponent):
-    """
-        Class that evaluates a Debye model.
-        
-        F(x) = 2( exp(-x) + x - 1 )/x**2
-        with x = (q*R_g)**2
-        
-        The model has three parameters: 
-            Rg     =  radius of gyration
-            scale  =  scale factor
-            bkd    =  Constant background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Debye"
-        self.description = """ 
-        F(x) = 2( exp(-x) + x - 1 )/x**2
-        with x = (q*R_g)**2
-        
-        The model has three parameters: 
-        Rg     =  radius of gyration
-        scale  =  scale factor
-        bkd    =  Constant background
-        """
-        ## Define parameters
-        self.params = {}
-        self.params['rg']          = 50.0
-        self.params['scale']       = 1.0
-        self.params['background']  = 0.0
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['rg']         = ['[A]', None, None]
-        self.details['scale']      = ['', None, None]
-        self.details['background'] = ['[1/cm]', None, None]
-        #list of parameter that cannot be fitted
-        self.fixed = [] 
-             
-    def _debye(self, x):
-        """
-            Evaluate F(x)= scale * D + bkd
-            has 2 internal parameters :
-                    D = 2 * (exp(-y) + y - 1)/y**2 
-                    y = (x * Rg)^(2)
-        """
-        # Note that a zero denominator value will raise
-        # an exception
-        y = (x * self.params['rg'])**2.0
-        if x == 0:
-            D = 1
-        else:
-            D = 2.0*( math.exp(-y) + y -1.0 )/y**2.0
-        return self.params['scale'] * D + self.params['background']
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (debye value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._debye(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._debye(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: debye value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._debye(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._debye(x)
Index: c/sas/models/DisperseModel.py
===================================================================
--- src/sas/models/DisperseModel.py	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,88 +1,0 @@
-""" 
-    Wrapper for the Disperser class extension
-"""
-from sas.models.BaseComponent import BaseComponent
-from sas_extension.c_models import Disperser
-    
-class DisperseModel(Disperser, BaseComponent):
-    """ 
-    Wrapper class for the Disperser extension
-    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.
-    
-    Example: ::
-    
-        cyl = CylinderModel()
-        disp = DisperseModel(cyl, ['cyl_phi'], [0.3])
-        disp.run([0.01, 1.57])
-        
-    """
-        
-    def __init__(self, model, paramList, sigmaList):
-        """ 
-        Initialization 
-        
-        :param model: Model to disperse [BaseComponent]
-        :param paramList: list of parameters to disperse [List of strings]
-        :param sigmaList: list of std deviations for Gaussian dispersion
-                    [List of floats]
-        
-        """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        Disperser.__init__(self, model, paramList, sigmaList)
-        ## Name of the model
-        self.name = model.name
-        ## Keep track of the underlying model
-        self.model = model
-        self.description =''
-        #list of parameter that cannot be fitted
-        self.fixed = []
-        
-    def clone(self):
-        """ Return a identical copy of self """
-        return DisperseModel(self.model, self.params['paramList'], 
-                             self.params['sigmaList']) 
-   
-    def setParam(self, name, value):
-        """
-            Set a parameter value
-            :param name: parameter name
-        """
-        if name.lower() in self.params:
-            BaseComponent.setParam(self, name, value)
-        else:
-            self.model.setParam(name, value)
-   
-    def getParam(self, name):
-        """
-            Get the value of the given parameter
-            :param name: parameter name
-        """
-        if name.lower() in self.params:
-            return BaseComponent.getParam(self, name)
-        else:
-            return self.model.getParam(name)
-   
-    def run(self, x = 0.0):
-        """ 
-            Evaluate the model
-            :param x: input q, or [q,phi]
-            :return: scattering function P(q)
-        """
-        return Disperser.run(self, x)
-           
-    def runXY(self, x = 0.0):
-        """ 
-            Evaluate the model
-            :param x: input q, or [q,phi]
-            :return: scattering function P(q)
-        """
-        return Disperser.runXY(self, x)
-   
-# End of file
Index: c/sas/models/DivComponent.py
===================================================================
--- src/sas/models/DivComponent.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-#!/usr/bin/env python
-""" Provide base functionality for all model components
-    @author: Mathieu Doucet / UTK
-    @contact: mathieu.doucet@nist.gov
-"""
-
-# info
-__author__ = "Mathieu Doucet /  UTK"
-__id__ = "$Id: BaseComponent.py,v 1.2 2007/03/14 21:04:40 doucet Exp $"
-   
-# imports  
-from sas.models.BaseComponent import BaseComponent
-
-class DivComponent(BaseComponent):
-    """ Basic model component for Division
-        Provides basic arithmetics
-    """
-
-    def __init__(self, base=None, other=None):
-        """
-            @param base: component to div
-            @param other: component to div by
-        """
-        BaseComponent.__init__(self)
-        # Component to divide
-        self.operateOn = base
-        # Component to divide by
-        self.other = other
-        # name
-        self.name = 'DivComponent'
-        
-    def run(self, x=0):
-        """
-            Evaluate each part of the component and sum the results
-            @param x: input parameter
-            @return: value of the model at x
-        """
-        return self.operateOn.run(x) / self.other.run(x)
-        
-    def runXY(self, x=0):
-        """
-            Evaluate each part of the component and sum the results
-            @param x: input parameter
-            @return: value of the model at x
-        """
-        return self.operateOn.runXY(x) / self.other.runXY(x)
-        
-    def setParam(self, name, value):
-        """ 
-            Set the value of a model parameter
-            @param name: name of parameter to set
-            @param value: value to give the paramter
-        """
-        return BaseComponent.setParamWithToken(self, name, 
-                                               value, 'div', self.other)
-    
-    def getParam(self, name):
-        """ 
-            Set the value of a model parameter
-            @param name: name of the parameter
-            @return: value of the parameter
-        """
-        return BaseComponent.getParamWithToken(self, name, 'div', self.other)
-    
-    def getParamList(self):
-        """ Return a list of all available parameters for the model 
-        """
-        return BaseComponent.getParamListWithToken(self, 'div', self.other)
-    
-# End of file
Index: c/sas/models/FractalCoreShellModel.py
===================================================================
--- src/sas/models/FractalCoreShellModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,246 +1,0 @@
-"""
-    Fractal Core-Shell model
-"""
-from sas.models.BaseComponent import BaseComponent
-from sas.models.CoreShellModel import CoreShellModel
-from scipy.special import gammaln
-import math
-from numpy import power
-from copy import deepcopy
-
-class FractalCoreShellModel(BaseComponent):
-    """
-    Class that evaluates a FractalCoreShellModel
-    List of default parameters:
-    volfraction     = 0.05
-    radius          = 20.0 [A]
-    thickness       = 5.0 [A]
-    frac_dim        = 2.0
-    cor_length      = 100 [A]
-    core_sld        = 3.5e-006 [1/A^(2)]
-    shell_sld       = 1.0e-006 [1/A^(2)]
-    solvent_sld     = 6.35e-006 [1/A^(2)]
-    background      = 0.0 [1/cm]
-    """
-    def __init__(self):
-        BaseComponent.__init__(self)
-
-        ## Setting  model name model description
-        model = CoreShellModel()
-        self.description = model
-        
-        self.model = model
-        self.name = "FractalCoreShell"
-        self.description = """Scattering  from a fractal structure 
-        with a primary building block of a spherical particle 
-        with particle with a core-shell structure.
-        Note: Setting the (core) radius polydispersion with a Schulz 
-        distribution is equivalent to the FractalPolyCore function 
-        in NIST/Igor Package.
-        List of parameters:
-        volfraction: volume fraction of building block spheres
-        radius: radius of building block
-        thickness: shell thickness
-        frac_dim:  fractal dimension
-        cor_length: correlation length of fractal-like aggregates
-        core_sld: SLD of building block
-        shell_sld: SLD of shell
-        solvent_sld: SLD of matrix or solution
-        background: flat background"""
-        
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        # non-fittable parameters
-        self.non_fittable = model.non_fittable
-        
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-
-        ## parameters with orientation:
-        for item in self.model.orientation_params:
-            self.orientation_params.append(item)
-                
-    def _fractalcore(self, x):
-        """
-        Define model function
-        
-        return S(q): Fractal Structure 
-        """
-        # set local variables
-        Df = self.params['frac_dim']
-        corr = self.params['cor_length']
-        r0 = self.params['radius']
-        #calculate S(q)
-        sq = Df*math.exp(gammaln(Df-1.0))*math.sin((Df-1.0)*math.atan(x*corr))
-        sq /= power((x*r0), Df) * power((1.0 + 1.0/(x*corr*x*corr)), ((Df-1)/2))
-        sq += 1.0
-        return sq
-
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal
-        data members to a fresh copy.
-        """
-        obj.params     = deepcopy(self.params)
-        obj.description     = deepcopy(self.description)
-        obj.details    = deepcopy(self.details)
-        obj.dispersion = deepcopy(self.dispersion)
-        obj.model  = self.model.clone()
-
-        return obj 
-    
-    def _set_dispersion(self):
-        """
-        model dispersions
-        """ 
-        ##set dispersion from model 
-        for name , value in self.model.dispersion.iteritems():      
-            self.dispersion[name] = value
-                              
-    def _set_params(self):
-        """
-        Concatenate the parameters of the model to create
-        this model parameters 
-        """
-        # rearrange the parameters for the given # of shells
-        for name , value in self.model.params.iteritems():
-            if name == 'scale':
-                value = 0.05   
-            elif name == 'radius':
-                value = 20.0
-            elif name == 'thickness':
-                value = 5.0
-            elif name == 'core_sld':
-                value = 3.5e-06
-            elif name == 'shell_sld':
-                value = 1.0e-06
-            elif name == 'solvent_sld':
-                value = 6.35e-06
-            elif name == 'background':
-                value = 0.0
-            self.model.params[name] = value
-            if name  == 'scale':
-                name = 'volfraction'
-            self.params[name] = value
-        self.params['frac_dim'] = 2.0
-        self.params['cor_length'] = 100.0  
-  
-    def _set_details(self):
-        """
-        Concatenate details of the original model to create
-        this model details 
-        """
-        for name, detail in self.model.details.iteritems():
-            if name in self.params.iterkeys():
-                if name == 'scale':
-                    name = 'volfraction'
-                self.details[name] = detail
-        self.details['frac_dim']   = ['', None, None]
-        self.details['cor_length'] = ['[A]', None, None]  
-
-
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        : param name: name of the parameter
-        : param value: value of the parameter
-        """
-        # set param to new model
-        self._setParamHelper(name, value)
-
-        if name == 'volfraction':
-            name = 'scale'
-        # model.setParam except the two names below
-        if name != 'frac_dim' and name != 'cor_length':
-            # background is always 0.0 in the coreshellmodel
-            if name == 'background':
-                value = 0.0
-            self.model.setParam(name, value)
-
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setParam
-        """
-        #look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2:
-            for item in self.dispersion.keys():
-                if item.lower()==toks[0].lower():
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            self.dispersion[item][par] = value
-                            return
-        # Look for standard parameter
-        for item in self.params.keys():
-            if item.lower()==name.lower():
-                self.params[item] = value
-                return
-        
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-     
-                
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [r, theta])
-        : return: (DAB value)
-        """
-        if x.__class__.__name__ == 'list':
-            # Take absolute value of Q, since this model is really meant to
-            # be defined in 1D for a given length of Q
-            #qx = math.fabs(x[0]*math.cos(x[1]))
-            #qy = math.fabs(x[0]*math.sin(x[1]))
-            return self.params['background']\
-                +self._fractalcore(x[0])*self.model.run(x)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self.params['background']\
-                +self._fractalcore(x)*self.model.run(x)
-
-        return self.params['background']+self._fractalcore(x)*self.model.run(x)
-
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [qx, qy])
-        : return: DAB value
-        """  
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self.params['background']\
-                +self._fractalcore(q)*self.model.runXY(x)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self.params['background']\
-                +self._fractalcore(x)*self.model.runXY(x)
-
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        : param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        value = None
-        try:
-            if parameter in self.model.dispersion.keys():
-                value = self.model.set_dispersion(parameter, dispersion)
-            self._set_dispersion()
-            return value
-        except:
-            raise 
Index: c/sas/models/GaussLorentzGelModel.py
===================================================================
--- src/sas/models/GaussLorentzGelModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-""" 
-    Provide I(q) = I_0 exp ( - R_g^2 q^2 / 3.0)
-    GaussLorentzGel function as a BaseComponent model
-"""
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class GaussLorentzGelModel(BaseComponent):
-    """ 
-    Class that evaluates a GaussLorentzGel model.
-
-    I(q) = scale_g*exp(- q^2*Z^2 / 2)+scale_l/(1+q^2*z^2)
-            + background
-    List of default parameters:
-     scale_g = Gauss scale factor
-     Z = Static correlation length
-     scale_l = Lorentzian scale factor
-     z = Dynamic correlation length
-     background = Incoherent background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "GaussLorentzGel"
-        self.description = """I(q)=scale_g*exp(-q^2*Z^2/2)+scale_l/(1+q^2*z^2)
-            + background
-            List of default parameters:
-             scale_g = Gauss scale factor
-             stat_colength = Static correlation length
-             scale_l = Lorentzian scale factor
-             dyn_colength = Dynamic correlation length
-             background = Incoherent background
-"""
-        ## Define parameters
-        self.params = {}
-        self.params['scale_g']  = 100.0
-        self.params['stat_colength']     = 100.0
-        self.params['scale_l']  = 50.0
-        self.params['dyn_colength']     = 20.0
-        self.params['background']     = 0.0
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale_g'] = ['', None, None]
-        self.details['stat_colength'] =  ['A', None, None]
-        self.details['scale_l']  =  ['', None, None]
-        self.details['dyn_colength']  =   ['A', None, None]
-        self.details['background']   =  ['[1/cm]', None, None]
-
-        #list of parameter that cannot be fitted
-        self.fixed = []  
-        
-    def _gausslorentzgel(self, x):
-        """
-        Model definition
-        """
-        inten = self.params['scale_g'] \
-                *math.exp(-1.0*x*x*self.params['stat_colength']* \
-                self.params['stat_colength']/2.0) + self.params['scale_l']/ \
-                (1.0 + (x*self.params['dyn_colength'])* \
-                 (x*self.params['dyn_colength'])) + self.params['background']
-        return inten  
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (guinier value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._gausslorentzgel(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._gausslorentzgel(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: guinier value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._gausslorentzgel(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._gausslorentzgel(x)
Index: c/sas/models/GuinierModel.py
===================================================================
--- src/sas/models/GuinierModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-""" 
-    Provide I(q) = I_0 exp ( - R_g^2 q^2 / 3.0)
-    Guinier function as a BaseComponent model
-"""
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class GuinierModel(BaseComponent):
-    """ 
-        Class that evaluates a Guinier model.
-    
-        I(q) = I_0 exp ( - R_g^2 q^2 / 3.0 )
-        
-        List of default parameters:
-         I_0 = Scale
-         R_g = Radius of gyration
-          
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Guinier"
-        self.description = """ I(q) = I_0 exp ( - R_g^2 q^2 / 3.0 )
-        
-                        List of default parameters:
-                        I_0 = Scale
-                        R_g = Radius of gyration"""
-        ## Define parameters
-        self.params = {}
-        self.params['scale']  = 1.0
-        self.params['rg']     = 60
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale'] = ['[1/cm]', None, None]
-        self.details['rg']    = ['[A]', None, None]
-        #list of parameter that cannot be fitted
-        self.fixed = []  
-        
-    def _guinier(self, x):
-        """
-            Evaluate guinier function
-            :param x: q-value
-        """
-        return self.params['scale']*math.exp( -(self.params['rg']*x)**2/3.0 )  
-   
-    def run(self, x = 0.0):
-        """ 
-            Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (guinier value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._guinier(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._guinier(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: guinier value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._guinier(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._guinier(x)
Index: c/sas/models/GuinierPorodModel.py
===================================================================
--- src/sas/models/GuinierPorodModel.py	(revision ac7be54ccf932e813cbe6e41e05b682a1630a03e)
+++ 	(revision )
@@ -1,103 +1,0 @@
-""" 
-Guinier function as a BaseComponent model
-"""
-from sas.models.BaseComponent import BaseComponent
-from math import sqrt,exp
-
-class GuinierPorodModel(BaseComponent):
-    """ 
-    Class that evaluates a GuinierPorod model.
-
-    Calculate::
-
-        I(q) = scale/q^s exp(-q^2 Rg^2 / (3-s) ) for q<= ql
-        I(q) = scale/q^m exp(-ql^2 Rg^2 / (3-s)) ql^(m-s) for q>=ql
-    """
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "GuinierPorod"
-        self.description = """
-         I(q) = scale/q^s* exp ( - R_g^2 q^2 / (3-s) ) for q<= ql
-         = scale/q^m*exp((-ql^2*Rg^2)/(3-s))*ql^(m-s) for q>=ql
-                        where ql = sqrt((m-s)(3-s)/2)/Rg.
-                        List of parameters:
-                        scale = Guinier Scale
-                        s = Dimension Variable
-                        Rg = Radius of Gyration [A] 
-                        m = Porod Exponent
-                        background  = Background [1/cm]"""
-        ## Define parameters
-        self.params = {}
-        self.params['scale']  = 1.0
-        self.params['dim']  = 1.0
-        self.params['rg']     = 100.0
-        self.params['m']     = 3.0
-        self.params['background']     = 0.1
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale'] = ['', None, None]
-        self.details['dim']  = ['', None, None]
-        self.details['rg']    = ['[A]', None, None]
-        self.details['m']     = ['', None, None]
-        self.details['background']     = ['[1/cm]', None, None]
-
-        #list of parameter that cannot be fitted
-        self.fixed = []  
-        
-    def _guinier_porod(self, x):
-        """
-        Guinier-Porod Model
-        """
-        # parameters
-        G = self.params['scale']
-        s = self.params['dim']
-        Rg = self.params['rg']
-        m = self.params['m']
-        bgd = self.params['background']
-        n = 3.0 - s
-        qval = x
-        # take care of the singular points
-        if Rg <= 0.0:
-            return bgd
-        if (n-3.0+m) <= 0.0:
-            return bgd
-        #do the calculation and return the function value
-        q1 = sqrt((n-3.0+m)*n/2.0)/Rg
-        if qval < q1:
-            F = (G/pow(qval,(3.0-n)))*exp((-qval*qval*Rg*Rg)/n) 
-        else:
-            F = (G/pow(qval, m))*exp(-(n-3.0+m)/2.0)*pow(((n-3.0+m)*n/2.0),
-                                        ((n-3.0+m)/2.0))/pow(Rg,(n-3.0+m))
-        inten = F + bgd
-    
-        return inten
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (guinier value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._guinier_porod(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._guinier_porod(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: guinier value
-        """
-        if x.__class__.__name__ == 'list':
-            q = sqrt(x[0]**2 + x[1]**2)
-            return self._guinier_porod(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._guinier_porod(x)
Index: c/sas/models/LineModel.py
===================================================================
--- src/sas/models/LineModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-#!/usr/bin/env python
-""" 
-    Provide Line function (y= A + Bx) as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
-import numpy
-
-
-class LineModel(BaseComponent):
-    """ 
-        Class that evaluates a linear model.
-        
-        f(x) = A + Bx
-         
-        List of default parameters:
-          A = 1.0
-          B = 1.0 
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "LineModel"
-
-        ## Define parameters
-        self.params = {}
-        self.params['A'] = 1.0
-        self.params['B'] = 1.0
-        self.description='f(x) = A + Bx'
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['A'] = ['', None, None]
-        self.details['B'] = ['', None, None]
-        # fixed paramaters
-        self.fixed=[]
-    def _line(self, x):
-        """
-            Evaluate the function
-            @param x: x-value
-            @return: function value
-        """
-        return  self.params['A'] + x *self.params['B']
-    
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: simple value
-            @return: (Line value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._line(x[0]*math.cos(x[1]))*self._line(x[0]*math.sin(x[1]))
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._line(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: simple value
-            @return: Line value
-        """
-        if x.__class__.__name__ == 'list':
-            return self._line(x[1])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._line(x)
-        
-    def evalDistribution(self, qdist):
-        """
-        Evaluate a distribution of q-values.
-        
-        * For 1D, a numpy array is expected as input:
-        
-            evalDistribution(q)
-            
-        where q is a numpy array.
-        
-        
-        * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime],
-          where 1D arrays,
-                
-        :param qdist: ndarray of scalar q-values or list [qx,qy] 
-                    where qx,qy are 1D ndarrays 
-        
-        """
-        if qdist.__class__.__name__ == 'list':
-            # Check whether we have a list of ndarrays [qx,qy]
-            if len(qdist)!=2 or \
-                qdist[0].__class__.__name__ != 'ndarray' or \
-                qdist[1].__class__.__name__ != 'ndarray':
-                    raise RuntimeError, "evalDistribution expects a list of 2 ndarrays"
-                
-            # Extract qx and qy for code clarity
-            qx = qdist[0]
-            qy = qdist[1]
-            #For 2D, Z = A + B * Y, 
-            # so that it keeps its linearity in y-direction.
-            # calculate q_r component for 2D isotropic
-            q =  qy
-            # vectorize the model function runXY
-            v_model = numpy.vectorize(self.runXY,otypes=[float])
-            # calculate the scattering
-            iq_array = v_model(q)
-
-            return iq_array
-                
-        elif qdist.__class__.__name__ == 'ndarray':
-                # We have a simple 1D distribution of q-values
-                v_model = numpy.vectorize(self.runXY,otypes=[float])
-                iq_array = v_model(qdist)
-
-                return iq_array
-            
-        else:
-            mesg = "evalDistribution is expecting an ndarray of scalar q-values"
-            mesg += " or a list [qx,qy] where qx,qy are 2D ndarrays."
-            raise RuntimeError, mesg
-        
-    
-   
-
-if __name__ == "__main__": 
-    l = LineModel()
-    print "hello"
-       
-# End of file
Index: c/sas/models/LorentzModel.py
===================================================================
--- src/sas/models/LorentzModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-#!/usr/bin/env python
-""" 
-    Provide F(x) = scale/( 1 + (x*L)^2 ) + bkd
-    Lorentz (Ornstein-Zernicke) function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class LorentzModel(BaseComponent):
-   
-    """
-        Class that evaluates a Lorentz (Ornstein-Zernicke) model.
-        
-        F(x) = scale/( 1 + (x*L)^2 ) + bkd
-        
-        The model has three parameters: 
-            L     =  screen Length
-            scale  =  scale factor
-            bkd    =  incoherent background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Lorentz"
-        self.description="""Lorentz (Ornstein-Zernicke) model.
-        F(x) = scale/( 1 + (x*L)^2 ) + bkd 
-        
-        The model has three parameters:      
-        L     =  screen Length\n\
-        scale  =  scale factor\n\
-        bkd    =  incoherent background"""
-        ## Define parameters
-        self.params = {}
-        self.params['length']      = 50.0
-        self.params['scale']       = 1.0
-        self.params['background']  = 0.0
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['length']     = ['[A]', None, None]
-        self.details['scale']      = ['', None, None]
-        self.details['background'] = ['[1/cm]', None, None]
-        #list of parameter that cannot be fitted
-        self.fixed= []      
-    def _lorentz(self, x):
-        """
-            Evaluate F(x) = scale/( 1 + (x*L)^2 ) + bkd
-           
-        """
-        return self.params['scale']/( 1 + math.pow((x * self.params['length']),2))\
-                + self.params['background']
-       
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (Lorentz value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._lorentz(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._lorentz(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: Lorentz value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._lorentz(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._lorentz(x)
Index: c/sas/models/ModelAdaptor.py
===================================================================
--- src/sas/models/ModelAdaptor.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,108 +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 base functionality for all model components
-    
-    The following has changed since going from BaseComponent to BaseModel:
-    
-        - Arithmetic operation between models is no longer supported.
-          It was found to be of little use and not very flexible.
-        
-        - Parameters are now stored as Parameter object to provide 
-          the necessary extra information like limits, units, etc... 
-"""
-
-class ParameterDict(dict):
-    """
-        Parameter dictionary used for backward 
-        compatibility between the old-style 'params'
-        dictionary and the new-style 'parameters'
-        dictionary.
-    """
-    def __init__(self, parameters):
-        """    
-        Initialization
-        param parameters: new-style 'parameters' dictionary
-        """
-        self.parameters = parameters
-        
-    def __setitem__(self, name, value):
-        self.parameters[name].value = value
-    
-    def __getitem__(self, name):
-        return self.parameters[name].value 
-    
-class ModelAdaptor(object):
-    """ 
-    Model adaptor to provide old-style model functionality
-    """
-    def __init__(self):
-        """ Initialization"""
-        ## Dictionary of Parameter objects
-        self.parameters = {}
-        ## Dictionary of parameters, available for backward compatibility
-        self.params = ParameterDict(self.parameters)
-        ## Additional details, provided for backward compatibility
-        self.details = {}
-        self.description = ''
-        ## Dictionary used to store the dispersity/averaging
-        #  parameters of dispersed/averaged parameters.
-        ## Provided for backward compatibility
-        self.dispersion = {}
-                              
-    # Old-style methods that are no longer used
-    def setParamWithToken(self, name, value, token, member): 
-        """
-        set Param With Token
-        """
-        return NotImplemented
-    
-    def getParamWithToken(self, name, token, member): 
-        """
-        get Param With Token
-        """
-        return NotImplemented
-    
-    def getParamListWithToken(self, token, member): 
-        """
-        get Param List With Token
-        """
-        return NotImplemented
-    def __add__(self, other): 
-        """
-        add
-        """
-        raise ValueError, "Model operation are no longer supported"
-    def __sub__(self, other): 
-        """
-        sub
-        """
-        raise ValueError, "Model operation are no longer supported"
-    def __mul__(self, other): 
-        """
-        mul
-        """
-        raise ValueError, "Model operation are no longer supported"
-    def __div__(self, other): 
-        """
-        div
-        """
-        raise ValueError, "Model operation are no longer supported"
-
-if __name__ == "__main__":
-    b = ModelAdaptor() 
-    #print b.operateOn
-    
Index: c/sas/models/MulComponent.py
===================================================================
--- src/sas/models/MulComponent.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-#!/usr/bin/env python
-""" Provide base functionality for all model components
-    @author: Mathieu Doucet / UTK
-    @contact: mathieu.doucet@nist.gov
-"""
-
-# info
-__author__ = "Mathieu Doucet /  UTK"
-__id__ = "$Id: BaseComponent.py,v 1.2 2007/03/14 21:04:40 doucet Exp $"
-   
-# imports   
-from sas.models.BaseComponent import BaseComponent
-
-class MulComponent(BaseComponent):
-    """ Basic model component for Multiply
-        Provides basic arithmetics
-    """
-
-    def __init__(self, base=None, other=None):
-        """
-            @param base: component to multiply
-            @param other: component to multiply by
-        """
-        BaseComponent.__init__(self)
-        # Component to multiply
-        self.operateOn = base
-        # Component to multiply by
-        self.other = other
-        # name
-        self.name = 'MulComponent'
-        
-    def run(self, x=0):
-        """
-            Evaluate each part of the component and sum the results
-            @param x: input parameter
-            @return: value of the model at x
-        """
-        return self.operateOn.run(x) * self.other.run(x)
-        
-    def runXY(self, x=0):
-        """
-            Evaluate each part of the component and sum the results
-            @param x: input parameter
-            @return: value of the model at x
-        """
-        return self.operateOn.runXY(x) * self.other.runXY(x)
-        
-    def setParam(self, name, value):
-        """ 
-            Set the value of a model parameter
-            @param name: name of parameter to set
-            @param value: value to give the paramter
-        """
-        return BaseComponent.setParamWithToken(self, name, 
-                                               value, 'mul', self.other)
-    
-    def getParam(self, name):
-        """ 
-            Set the value of a model parameter
-            @param name: name of the parameter
-            @return: value of the parameter
-        """
-        return BaseComponent.getParamWithToken(self, name, 'mul', self.other)
-
-    def getParamList(self):
-        """ Return a list of all available parameters for the model 
-        """
-        return BaseComponent.getParamListWithToken(self, 'mul', self.other)
-    
-# End of file
Index: c/sas/models/MultiplicationModel.py
===================================================================
--- src/sas/models/MultiplicationModel.py	(revision fb3f9af6b7f4c21e4835a63ed3f7428632d42bc2)
+++ 	(revision )
@@ -1,317 +1,0 @@
-
-from sas.models.BaseComponent import BaseComponent
-#import numpy, math
-import copy
-#from sas.models.pluginmodel import Model1DPlugin
-class MultiplicationModel(BaseComponent):
-    r"""
-        Use for P(Q)\*S(Q); function call must be in the order of P(Q) and then S(Q):
-        The model parameters are combined from both models, P(Q) and S(Q), except 1) 'effect_radius' of S(Q)
-        which will be calculated from P(Q) via calculate_ER(), 
-        and 2) 'scale' in P model which is synchronized w/ volfraction in S 
-        then P*S is multiplied by a new parameter, 'scale_factor'.
-        The polydispersion is applicable only to P(Q), not to S(Q).
-
-        .. note:: P(Q) refers to 'form factor' model while S(Q) does to 'structure factor'.
-    """
-    def __init__(self, p_model, s_model ):
-        BaseComponent.__init__(self)
-        """
-        :param p_model: form factor, P(Q)
-        :param s_model: structure factor, S(Q)
-        """
-
-        ## Setting  model name model description
-        self.description = ""
-        self.name = p_model.name +" * "+ s_model.name
-        self.description= self.name + "\n"
-        self.fill_description(p_model, s_model)
-
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        ##models 
-        self.p_model = p_model
-        self.s_model = s_model        
-        self.magnetic_params = []
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        ## New parameter:Scaling factor
-        self.params['scale_factor'] = 1
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        self.details['scale_factor'] = ['',     None, None]
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        ## parameters with orientation
-        for item in self.p_model.orientation_params:
-            self.orientation_params.append(item)
-        for item in self.p_model.magnetic_params:  
-            self.magnetic_params.append(item) 
-        for item in self.s_model.orientation_params:
-            if not item in self.orientation_params:
-                self.orientation_params.append(item)
-        # get multiplicity if model provide it, else 1.
-        try:
-            multiplicity = p_model.multiplicity
-        except:
-            multiplicity = 1
-        ## functional multiplicity of the model
-        self.multiplicity = multiplicity    
-          
-        # non-fittable parameters
-        self.non_fittable = p_model.non_fittable  
-        self.multiplicity_info = [] 
-        self.fun_list = {}
-        if self.non_fittable > 1:
-            try:
-                self.multiplicity_info = p_model.multiplicity_info 
-                self.fun_list = p_model.fun_list
-            except:
-                pass
-        else:
-            self.multiplicity_info = []
-            
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal data members to a
-        fresh copy.
-        """
-        obj.params     = copy.deepcopy(self.params)
-        obj.description     = copy.deepcopy(self.description)
-        obj.details    = copy.deepcopy(self.details)
-        obj.dispersion = copy.deepcopy(self.dispersion)
-        obj.p_model  = self.p_model.clone()
-        obj.s_model  = self.s_model.clone()
-        #obj = copy.deepcopy(self)
-        return obj
-    
-    
-    def _set_dispersion(self):
-        """
-        combine the two models' dispersions. Polydispersity should not be
-        applied to s_model
-        """
-        ##set dispersion only from p_model 
-        for name , value in self.p_model.dispersion.iteritems():
-            self.dispersion[name] = value 
-                                      
-    def getProfile(self):
-        """
-        Get SLD profile of p_model if exists
-        
-        :return: (r, beta) where r is a list of radius of the transition points\
-                beta is a list of the corresponding SLD values
-
-        .. note:: This works only for func_shell num = 2 (exp function).
-        """
-        try:
-            x, y = self.p_model.getProfile()
-        except:
-            x = None
-            y = None
-            
-        return x, y
-    
-    def _set_params(self):
-        """
-        Concatenate the parameters of the two models to create
-        these model parameters 
-        """
-
-        for name , value in self.p_model.params.iteritems():
-            if not name in self.params.keys() and name != 'scale':
-                self.params[name] = value
-            
-        for name , value in self.s_model.params.iteritems():
-            #Remove the effect_radius from the (P*S) model parameters.
-            if not name in self.params.keys() and name != 'effect_radius':
-                self.params[name] = value
-                
-        # Set "scale and effec_radius to P and S model as initializing
-        # since run P*S comes from P and S separately.
-        self._set_scale_factor()
-        self._set_effect_radius()       
-            
-    def _set_details(self):
-        """
-        Concatenate details of the two models to create
-        this model's details 
-        """
-        for name, detail in self.p_model.details.iteritems():
-            if name != 'scale':
-                self.details[name] = detail
-            
-        for name , detail in self.s_model.details.iteritems():
-            if not name in self.details.keys() or name != 'effect_radius':
-                self.details[name] = detail
-    
-    def _set_scale_factor(self):
-        """
-        Set scale=volfraction for P model
-        """
-        value = self.params['volfraction']
-        if value != None: 
-            factor = self.p_model.calculate_VR()
-            if factor == None or factor == NotImplemented or factor == 0.0:
-                val = value
-            else:
-                val = value / factor
-            self.p_model.setParam('scale', value)
-            self.s_model.setParam('volfraction', val)
-            
-    def _set_effect_radius(self):
-        """
-        Set effective radius to S(Q) model
-        """
-        if not 'effect_radius' in self.s_model.params.keys():
-            return
-        effective_radius = self.p_model.calculate_ER()
-        #Reset the effective_radius of s_model just before the run
-        if effective_radius != None and effective_radius != NotImplemented:
-            self.s_model.setParam('effect_radius', effective_radius)
-                
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-        
-        :param name: name of the parameter
-        :param value: value of the parameter
-        """
-        # set param to P*S model
-        self._setParamHelper( name, value)
-        
-        ## setParam to p model 
-        # set 'scale' in P(Q) equal to volfraction 
-        if name == 'volfraction':
-            self._set_scale_factor()
-        elif name in self.p_model.getParamList():
-            self.p_model.setParam( name, value)
-        
-        ## setParam to s model 
-        # This is a little bit abundant: Todo: find better way         
-        self._set_effect_radius()
-        if name in self.s_model.getParamList():
-            if name != 'volfraction':
-                self.s_model.setParam( name, value)
-            
-
-        #self._setParamHelper( name, value)
-        
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setparam
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2:
-            for item in self.dispersion.keys():
-                if item.lower()==toks[0].lower():
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            self.dispersion[item][par] = value
-                            return
-        else:
-            # Look for standard parameter
-            for item in self.params.keys():
-                if item.lower() == name.lower():
-                    self.params[item] = value
-                    return
-            
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-        Fill the self.fixed list with the p_model fixed list
-        """
-        for item in self.p_model.fixed:
-            self.fixed.append(item)
-
-        self.fixed.sort()
-                
-                
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q-value (float or [float, float] as [r, theta])
-        :return: (scattering function value)
-        """
-        # set effective radius and scaling factor before run
-        self._set_effect_radius()
-        self._set_scale_factor()
-        return self.params['scale_factor'] * self.p_model.run(x) * \
-                            self.s_model.run(x)
-
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q-value (float or [float, float] as [qx, qy])
-        :return: scattering function value
-        """  
-        # set effective radius and scaling factor before run
-        self._set_effect_radius()
-        self._set_scale_factor()
-        out = self.params['scale_factor'] * self.p_model.runXY(x) * \
-                        self.s_model.runXY(x)
-        return out
-    
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x = []):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        :param x: input q[], or [qx[], qy[]]
-        :return: scattering function P(q[])
-        """
-        # set effective radius and scaling factor before run
-        self._set_effect_radius()
-        self._set_scale_factor()
-        out = self.params['scale_factor'] * self.p_model.evalDistribution(x) * \
-                        self.s_model.evalDistribution(x)
-        return out
-
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        :param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        value = None
-        try:
-            if parameter in self.p_model.dispersion.keys():
-                value = self.p_model.set_dispersion(parameter, dispersion)
-            self._set_dispersion()
-            return value
-        except:
-            raise 
-
-    def fill_description(self, p_model, s_model):
-        """
-        Fill the description for P(Q)*S(Q)
-        """
-        description = ""
-        description += "Note:1) The effect_radius (effective radius) of %s \n"%\
-                                                                (s_model.name)
-        description += "             is automatically calculated "
-        description += "from size parameters (radius...).\n"
-        description += "         2) For non-spherical shape, "
-        description += "this approximation is valid \n"
-        description += "            only for limited systems. "
-        description += "Thus, use it at your own risk.\n"
-        description += "See %s description and %s description \n"% \
-                                                ( p_model.name, s_model.name )
-        description += "        for details of individual models."
-        self.description += description
-    
Index: c/sas/models/NoStructure.py
===================================================================
--- src/sas/models/NoStructure.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#!/usr/bin/env python
-""" Provide sin(x) function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
- 
-class NoStructure(BaseComponent):
-    """ Class that evaluates a sin(x) model. 
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "NoStructure"
-        self.description=""" NoStructure factor
-        F(x)= 1
-        """
-       
-    def clone(self):
-        """ Return a identical copy of self """
-        return self._clone(NoStructure())   
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input x
-            @return: 1
-        """
-        if x.__class__.__name__ == 'list':
-            return 1
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return 1
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input x, or [x, y] [radian]
-            @return: sin(x) or sin(x)*sin(y)
-        """
-        if x.__class__.__name__ == 'list':
-            return 1
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return 1
-   
-# End of file
Index: c/sas/models/NullModel.py
===================================================================
--- src/sas/models/NullModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#!/usr/bin/env python
-""" Provide sin(x) function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
- 
-class NullModel(BaseComponent):
-    """ Class that evaluates a sin(x) model. 
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Error!"
-        self.description="""Error  model
-        F(x)= 0
-        """
-       
-    def clone(self):
-        """ Return a identical copy of self """
-        return self._clone(NullModel())   
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input x
-            @return: 1
-        """
-        if x.__class__.__name__ == 'list':
-            return 0
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return 0
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input x, or [x, y] [radian]
-            @return: sin(x) or sin(x)*sin(y)
-        """
-        if x.__class__.__name__ == 'list':
-            return 0
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return 0
-   
-# End of file
Index: c/sas/models/OnionExpShellModel.py
===================================================================
--- src/sas/models/OnionExpShellModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,298 +1,0 @@
-   
-from sas.models.BaseComponent import BaseComponent
-from sas.models.OnionModel import OnionModel
-import copy
-max_nshells = 10
-class OnionExpShellModel(BaseComponent):
-    """
-    This multi-model is based on CoreMultiShellModel with exponential 
-    func shells and provides the capability
-    of changing the number of shells between 1 and 10.
-    """
-    def __init__(self, n_shells=1):
-        BaseComponent.__init__(self)
-        """
-        :param n_shells: number of shells in the model, 
-        assumes 1<= n_shells <=10.
-        """
-
-        ## Setting  model name model description
-        self.description=""
-        model = OnionModel()
-        self.model = model
-        self.name = "OnionExpShellModel"
-        self.description=model.description
-        self.n_shells = n_shells
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        self.model.params['n_shells'] = self.n_shells
-        ## functional multiplicity info of the model
-        # [int(maximum no. of functionality),"str(Titl),
-        # [str(name of function0),...], [str(x-asix name of sld),...]]
-        self.multiplicity_info = [max_nshells,"No. of Shells:",[],['Radius']]
-
-        ## parameters with orientation: can be removed since there is 
-        # no orientational params
-        for item in self.model.orientation_params:
-            self.orientation_params.append(item)
-        self.getProfile()        
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal
-        data members to a fresh copy.
-        """
-        obj.params     = copy.deepcopy(self.params)
-        obj.description     = copy.deepcopy(self.description)
-        obj.details    = copy.deepcopy(self.details)
-        obj.dispersion = copy.deepcopy(self.dispersion)
-        obj.model  = self.model.clone()
-
-        return obj
-    
-    
-    def _set_dispersion(self):
-        """
-        model dispersions
-        """ 
-        ##set dispersion from model 
-        for name , value in self.model.dispersion.iteritems():   
-              
-            nshell = 0
-            if name.split('_')[0] == 'thick':
-                while nshell<self.n_shells:
-                    nshell += 1
-                    if name.split('_')[1] == 'shell%s' % str(nshell):
-                        self.dispersion[name]= value
-                    else: 
-                        continue
-            else:
-                self.dispersion[name]= value
-                    
-
-    def _set_params(self):
-        """
-        Concatenate the parameters of the model to create
-        this model parameters 
-        """
-        # rearrange the parameters for the given # of shells
-        for name , value in self.model.params.iteritems():
-            nshell = 0
-            pos = len(name.split('_'))-1
-            if name.split('_')[0] == 'func':
-                continue
-            elif name.split('_')[pos][0:5] == 'shell':
-                    while nshell<self.n_shells:
-                        nshell += 1
-                        if name.split('_')[pos] == 'shell%s' % str(nshell):
-                            self.params[name]= value
-                            continue
-            else:
-                self.params[name]= value
-               
-        self.model.params['n_shells'] = self.n_shells    
-
-        # set constrained values for the original model params
-        self._set_xtra_model_param()       
-  
-    def _set_details(self):
-        """
-        Concatenate details of the original model to create
-        this model details 
-        """
-        for name ,detail in self.model.details.iteritems():
-            if name in self.params.iterkeys():
-                self.details[name]= detail
-            
-    
-    def _set_xtra_model_param(self):
-        """
-        Set params of original model that are hidden from this model
-        """
-        # look for the model parameters that are not in param list
-        for key in self.model.params.iterkeys():
-            if key not in self.params.keys():
-                if  key.split('_')[0] == 'thick':
-                    self.model.setParam(key, 0)
-                    continue
-                if  key.split('_')[0] == 'A':
-                    self.model.setParam(key, 0)
-                    continue
-                if  key.split('_')[0] == 'func':
-                    self.model.setParam(key, 2)
-                    continue
-                for nshell in range(self.n_shells,max_nshells):
-                    if key.split('_')[1] == 'sld_in_shell%s' % str(nshell+1):
-                        try:
-                            value = self.model.params['sld_solv']
-                            self.model.setParam(key, value)
-                        except: pass
-    def getProfile(self):
-        """
-        Get SLD profile 
-        
-        : return: (r, beta) where r is a list of radius of the transition 
-                points and  beta is a list of the corresponding SLD values 
-        """
-        # max_pts for each shells
-        max_pts = 10
-        r = []
-        beta = []
-        # for core at r=0
-        r.append(0)
-        beta.append(self.params['sld_core0'])
-        # for core at r=rad_core
-        r.append(self.params['rad_core0'])
-        beta.append(self.params['sld_core0'])
-        
-        # for shells
-        for n in range(1,self.n_shells+1):
-            # Left side of each shells
-            r0 = r[len(r)-1]            
-            r.append(r0)
-            beta.append(self.params['sld_in_shell%s'% str(n)])
-            
-            A = self.params['A_shell%s'% str(n)]
-            from math import fabs
-            if fabs(A) <1.0e-16:
-                # Right side of each shells
-                r0 += self.params['thick_shell%s'% str(n)]
-                r.append(r0)
-                beta.append(self.params['sld_in_shell%s'% str(n)])
-            else:
-                from math import exp
-                rn = r0
-                for n_sub in range(0,max_pts):
-                    # Right side of each sub_shells
-                    rn += self.params['thick_shell%s'% str(n)]/10.0
-                    r.append(rn)
-                    slope = (self.params['sld_out_shell%s'% str(n)] \
-                                    -self.params['sld_in_shell%s'% str(n)]) \
-                                     /(exp(self.params['A_shell%s'% str(n)])-1)
-                    const = (self.params['sld_in_shell%s'% str(n)]-slope)
-                    beta_n = slope*exp((self.params['A_shell%s'% str(n)]* \
-                        (rn-r0)/self.params['thick_shell%s'% str(n)])) + const
-                    beta.append(beta_n)
-            
-        # for solvent
-        r0 = r[len(r)-1]            
-        r.append(r0)
-        beta.append(self.params['sld_solv'])
-        r_solv = 5*r0/4
-        r.append(r_solv)
-        beta.append(self.params['sld_solv'])
-        
-        return r, beta
-    
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        : param name: name of the parameter
-        : param value: value of the parameter
-        """
-        # set param to new model
-        self._setParamHelper( name, value)
-        
-        ## setParam to model 
-        if name=='sld_solv':
-            # the sld_*** model.params not in params must set to value 
-            # of sld_solv
-            for key in self.model.params.iterkeys():
-                if key not in self.params.keys()and key.split('_')[0] == 'sld':
-                        self.model.setParam(key, value)
-        self.model.setParam( name, value)
-       
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setParam
-        """
-        #look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2:
-            for item in self.dispersion.keys():
-                if item.lower()==toks[0].lower():
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            self.dispersion[item][par] = value
-                            return
-        # Look for standard parameter
-        for item in self.params.keys():
-            if item.lower()==name.lower():
-                self.params[item] = value
-                return
-        
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-        Fill the self.fixed list with the model fixed list
-        """
-        for item in self.model.fixed:
-            if item.split('.')[0] in self.params.keys(): 
-                self.fixed.append(item)
-
-        self.fixed.sort()
-        pass         
-                
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [r, theta])
-        : return: (I value)
-        """
-
-        return self.model.run(x)
-
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [qx, qy])
-        : return: I value
-        """  
-
-        return self.model.runXY(x)
-    
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x = []):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        : param x: input q[], or [qx[], qy[]]
-        : return: scattering function P(q[])
-        """
-        # set effective radius and scaling factor before run
-        return self.model.evalDistribution(x)
-
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        : param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        value= None
-        try:
-            if parameter in self.model.dispersion.keys():
-                value= self.model.set_dispersion(parameter, dispersion)
-            self._set_dispersion()
-            return value
-        except:
-            raise 
Index: c/sas/models/PeakGaussModel.py
===================================================================
--- src/sas/models/PeakGaussModel.py	(revision d430ee8a3536142d375f39d42bb58a227871cb95)
+++ 	(revision )
@@ -1,88 +1,0 @@
-#!/usr/bin/env python
-""" 
-PeakGaussModel function as a BaseComponent model
-"""
-from __future__ import division
-
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class PeakGaussModel(BaseComponent):
-   
-    """
-        Class that evaluates a gaussian shaped peak with a flat background.
-        
-        F(q) = scale exp( -1/2 [(q-qo)/B]^2 )+ background
-        
-        The model has three parameters: 
-            scale     =  scale
-            q0        =  peak position
-            B         =  standard deviation
-            background=  incoherent background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Peak Gauss Model"
-        self.description=""" F(q) = scale*exp( -1/2 *[(q-q0)/B]^2 )+ background
-        
-        The model has three parameters: 
-        scale     =  scale
-        q0        =  peak position
-        B         =  standard deviation
-        background=  incoherent background"""
-        ## Define parameters
-        self.params = {}
-        self.params['scale']              = 100.0
-        self.params['q0']                 = 0.05
-        self.params['B']              = 0.005
-        self.params['background']         = 1.0
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['q0']            = ['[1/A]', None, None]
-        self.details['scale']             = ['', 0, None]
-        self.details['B']            = ['[1/A]', None, None]
-        self.details['background']        = ['[1/cm]', None, None]
-        #list of parameter that cannot be fitted
-        self.fixed= []  
-            
-    def _PeakGauss(self, x):
-        """
-            Evaluate  F(x) = scale exp( -1/2 [(x-q0)/B]^2 )+ background
-           
-        """
-        return self.params['scale']*math.exp(-1/2 *\
-                         math.pow((x - self.params['q0'])/self.params['B'],2)) \
-                            + self.params['background']
-       
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (Peak Gaussian value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._PeakGauss(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._PeakGauss(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: Peak Gaussian value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._PeakGauss(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._PeakGauss(x)
Index: c/sas/models/PeakLorentzModel.py
===================================================================
--- src/sas/models/PeakLorentzModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-#!/usr/bin/env python
-""" 
-    Model describes a Lorentzian shaped peak including a flat background
-    Provide F(q) = scale/(1+[(q-q0)/B]^2 ) + background
-    PeakLorentzModel function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class PeakLorentzModel(BaseComponent):
-   
-    """
-        Class that evaluates a gaussian  shaped peak.
-        
-        F(q) = scale/(1+[(q-q0)/B]^2 ) + background
-        
-        The model has three parameters: 
-            scale     =  scale
-            q0        =  peak position
-            B         =  ( hwhm) half-width-halfmaximum
-            background=  incoherent background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Peak Lorentz Model"
-        self.description = """ F(q) = scale/(1+[(q-q0)/B]^2 ) + background
-        
-        The model has three parameters: 
-        scale     =  scale
-        q0        =  peak position
-        B         =  ( hwhm) half-width-halfmaximum
-        background=  incoherent background"""
-        ## Define parameters
-        self.params = {}
-        self.params['scale']              = 100.0
-        self.params['q0']                 = 0.05
-        self.params['B']              = 0.005
-        self.params['background']         = 1.0
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['q0']            = ['[1/A]', None, None]
-        self.details['scale']             = ['', 0, None]
-        self.details['B']            = ['[1/A]', None, None]
-        self.details['background']        = ['[1/cm]', None, None]
-        #list of parameter that cannot be fitted
-        self.fixed = []  
-            
-    def _PeakLorentz(self, x):
-        """
-            Evaluate  F(x) = scale/(1+[(x-q0)/B]^2 ) + background
-           
-        """
-        return self.params['scale']/(1+\
-                         math.pow((x - self.params['q0'])/self.params['B'],2)) \
-                            + self.params['background']
-       
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: Peak Lorentzian value
-        """
-        if x.__class__.__name__ == 'list':
-            return self._PeakLorentz(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._PeakLorentz(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: Peak Lorentzian value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._PeakLorentz(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._PeakLorentz(x)
Index: c/sas/models/PolymerExclVolume.py
===================================================================
--- src/sas/models/PolymerExclVolume.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,124 +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
-##############################################################################
-from sas.models.BaseComponent import BaseComponent
-from scipy.special import gammainc,gamma
-import copy    
-import math
-    
-class PolymerExclVolume(BaseComponent):
-    """ 
-    Class that evaluates a PolymerExclVolModel model. 
-    This file was auto-generated from ..\c_extensions\polyexclvol.h.
-    Refer to that file and the structure it contains
-    for details of the model.
-
-    List of default parameters:
-    
-    * scale           = 0.01 
-    * rg              = 100.0 [A]
-    * m               = 3.0 
-    * background      = 0.0 [1/cm]
-
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "PolymerExclVolume"
-        ## Model description
-        self.description =""" Compute the scattering intensity from polymers with excluded volume effects.
-		scale: scale factor times volume fraction,
-		or just volume fraction for absolute scale data
-		rg: radius of gyration
-		m = Porod exponent
-		background: incoherent background
-		"""
-        ## Define parameters
-        self.params = {}
-        self.params['scale']        = 1.0
-        self.params['rg']           = 60.0
-        self.params['m']            = 3.0
-        self.params['background']   = 0.0
-
-       
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale'] = ['', None, None]
-        self.details['rg'] = ['[A]', None, None]
-        self.details['m'] = ['', None, None]
-        self.details['background'] = ['[1/cm]', None, None]
-
-        ## fittable parameters
-        self.fixed=[]
-        
-        ## non-fittable parameters
-        self.non_fittable=[]
-        
-        ## parameters with orientation
-        self.orientation_params =[]
-        
-    def _polymerexclvol(self, x):
-        
-        sc = self.params['scale']
-        rg = self.params['rg']
-        mm  = self.params['m']
-        bg = self.params['background']
-    
-        nu = 1.0 / mm
-    
-        Xx = x * x * rg * rg *(2.0 * nu + 1.0) * (2.0 * nu + 2.0) / 6.0
-        onu = 1.0 / nu
-        o2nu = 1.0 /(2.0 * nu)
-        Ps =(1.0 / (nu * pow(Xx,o2nu))) * (gamma(o2nu)*gammainc(o2nu,Xx) - \
-                        1.0 / pow(Xx,o2nu) * gamma(onu)*gammainc(onu,Xx))
-
-        if x == 0:
-            Ps = 1.0
-
-        return (sc * Ps + bg);
-
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (guinier value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._polymerexclvol(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._polymerexclvol(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: guinier value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._polymerexclvol(x)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._polymerexclvol(x)
-        
-
-   
-# End of file
Index: c/sas/models/PorodModel.py
===================================================================
--- src/sas/models/PorodModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-""" 
-    Provide I(q) = C/q^4,
-    Porod function as a BaseComponent model
-"""
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class PorodModel(BaseComponent):
-    """ 
-        Class that evaluates a Porod model.
-        I(q) = scale/q^4 +background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "PorodModel"
-
-        ## Define parameters
-        self.params = {}
-        self.params['scale'] = 1.0
-        self.params['background'] = 0.0
-        self.description = """The Porod model.
-        I(q) = scale/q^4 +background"""
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale']      = ['[1/(cm A^4)]', None, None]
-        self.details['background'] = ['[1/cm]', None, None]
-        #list of parameter that cannot be fitted
-        self.fixed = []
-               
-    def _porod(self, x):
-        """
-            Evaluate Porod function
-            :param x: q-value
-        """
-        return self.params['scale']/x**4.0 + self.params['background']
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (porod value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._porod(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._porod(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: porod value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._porod(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._porod(x)
Index: c/sas/models/PowerLawAbsModel.py
===================================================================
--- src/sas/models/PowerLawAbsModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-""" 
-    Provide F(x) = scale* (\|x\|)^(-m) + bkd
-    Power law function as a BaseComponent model
-"""
-from sas.models.PowerLawModel import PowerLawModel
-import math
-
-class PowerLawAbsModel(PowerLawModel):
-    """
-    Class that evaluates a absolute Power_Law model. ::
-    
-        F(x) = scale* (|x|)^(-m) + bkd
-    
-    The model has three parameters:
-
-    * m     =  power
-    * scale  =  scale factor
-    * bkd    =  incoherent background
-    """
-    
-    def __init__(self):
-        """ Initialization """
-        # Initialize PowerLawAbsModel 
-        PowerLawModel.__init__(self)
-        ## Name of the model
-        self.name = "Absolute Power_Law"
-        self.description = """ The Power_Law model.
-        F(x) = scale* (|x|)^(-m) + bkd
-        
-        The model has three parameters: 
-        m     =  power
-        scale  =  scale factor
-        bkd    =  incoherent background"""
-        
-        
-    def _PowerLaw(self, x):
-        return PowerLawModel._PowerLaw(self, math.fabs(x))
-       
Index: c/sas/models/PowerLawModel.py
===================================================================
--- src/sas/models/PowerLawModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-""" 
-    Provide F(x) = scale* (x)^(-m) + bkd
-    Power law function as a BaseComponent model
-"""
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class PowerLawModel(BaseComponent):
-    """
-        Class that evaluates a Power_Law model.
-        
-        F(x) = scale* (x)^(-m) + bkd
-        
-        The model has three parameters: 
-            m     =  power
-            scale  =  scale factor
-            bkd    =  incoherent background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Power_Law"
-
-        ## Define parameters
-        self.params = {}
-        self.params['m']            = 4.0
-        self.params['scale']        = 1.0
-        self.params['background']   = 0.0
-        self.description = """ The Power_Law model.
-        F(x) = scale* (x)^(-m) + bkd
-        
-        The model has three parameters: 
-        m     =  power
-        scale  =  scale factor
-        bkd    =  incoherent background"""
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['m']           = ['', 0,    None]
-        self.details['scale']       = ['', None, None]
-        self.details['background']  = ['[1/cm]', None, None]
-        #list of parameter that cannot be fitted
-        self.fixed = []    
-    def _PowerLaw(self, x):
-        """
-            Evaluate  F(x) = scale* (x)^(-m) + bkd
-            :param x: q-value
-        """
-        if self.params['m'] > 0 and x == 0:
-            return 1e+32
-        elif self.params['m'] == 0 and x == 0:
-            return 1
-        else:
-            return self.params['scale']*math.pow(x, -1.0*self.params['m'])\
-                + self.params['background']
-       
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            :param x: input q-value (float or [float, float] as [r, theta])
-            :return: (PowerLaw value)
-        """
-        if x.__class__.__name__ == 'list':
-            # Take absolute value of Q, since this model is really meant to
-            # be defined in 1D for a given length of Q
-            #qx = math.fabs(x[0]*math.cos(x[1]))
-            #qy = math.fabs(x[0]*math.sin(x[1]))
-            return self._PowerLaw(math.fabs(x[0]))
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._PowerLaw(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: PowerLaw value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._PowerLaw(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to models"
-        else:
-            return self._PowerLaw(x)
Index: c/sas/models/RPA10Model.py
===================================================================
--- src/sas/models/RPA10Model.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,261 +1,0 @@
-   
-from sas.models.BaseComponent import BaseComponent
-from sas.models.RPAModel import RPAModel
-from copy import deepcopy
-max_case_n = 10
-class RPA10Model(BaseComponent):
-    """
-    This multi-model is based on Parratt formalism and provides the capability
-    of changing the number of layers between 0 and 10.
-    """
-    def __init__(self, multfactor=1):
-        BaseComponent.__init__(self)
-        """
-        :param multfactor: number of cases in the model, assumes 0<= case# <=10.
-        """
-
-        ## Setting  model name model description
-        self.description=""
-        model = RPAModel()
-        self.model = model
-        self.name = "RPA10Model"
-        self.description=model.description
-        self.case_num = multfactor
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        # non-fittable parameters
-        self.non_fittable = model.non_fittable
-
-        # list of function in order of the function number 
-        self.fun_list = self._get_func_list()
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        self.model.params['lcase_n'] = self.case_num
-        
-        ## functional multiplicity of the model
-        self.multiplicity_info = [max_case_n,"Case No.:",["C/D Binary Mixture of Homopolymers",
-                                                         "C-D Diblock Copolymer",
-                                                         "B/C/D Ternary Mixture of Homopolymers",
-                                                         "B/C-D Mixture of Homopolymer B and Diblock Copolymer C-D",
-                                                         "B-C-D Triblock Copolymer",
-                                                         "A/B/C/D Quaternary Mixture of Homopolymers",
-                                                         "A/B/C-D Mixture of Homopolymer A/B and Diblock C-D",
-                                                         "A/B-C-D Mixture of Homopolymer A and triblock B-C-D",
-                                                         "A-B/C-D Mixture of Diblock Copolymer A-B and Diblock C-D",
-                                                         "A-B-C-D Four-block Copolymer"],
-                                                         []]
-    
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal
-        data members to a fresh copy.
-        """
-        obj.params     = deepcopy(self.params)
-        obj.non_fittable     = deepcopy(self.non_fittable)
-        obj.description     = deepcopy(self.description)
-        obj.details    = deepcopy(self.details)
-        obj.dispersion = deepcopy(self.dispersion)
-        obj.model  = self.model.clone()
-
-        return obj
-    
-    
-    def _set_dispersion(self):
-        """
-        model dispersions
-        """ 
-        ##set dispersion from model 
-        self.dispersion = {}
-                    
-
-    def _set_params(self):
-        """
-        Concatenate the parameters of the model to create
-        this model parameters 
-        """
-        # set the case number first
-        self.model.params['lcase_n'] = self.case_num  
-        # rearrange the parameters for the given # of shells
-        for name , value in self.model.params.iteritems():
-            if name == 'lcase_n':
-                continue
-            elif name.lower() == 'scale' or \
-                        name.lower() == 'background':
-                    self.params[name] = value
-            elif self.case_num <= 1:
-                if name.lower() == 'nc' or \
-                        name.lower() == 'phic' or \
-                        name.lower() == 'vc' or \
-                        name.lower() == 'lc' or \
-                        name.lower() == 'bc' or \
-                        name.lower() == 'nd' or \
-                        name.lower() == 'phid' or \
-                        name.lower() == 'vd' or \
-                        name.lower() == 'ld' or \
-                        name.lower() == 'bd' or \
-                        name.lower() == 'kcd':
-                    self.params[name] = value
-            elif self.case_num > 1 and self.case_num <= 4:
-                if name.lower() == 'nb' or \
-                        name.lower() == 'phib' or \
-                        name.lower() == 'vb' or \
-                        name.lower() == 'lb' or \
-                        name.lower() == 'bb' or \
-                        name.lower() == 'nc' or \
-                        name.lower() == 'phic' or \
-                        name.lower() == 'vc' or \
-                        name.lower() == 'lc' or \
-                        name.lower() == 'bc' or \
-                        name.lower() == 'nd' or \
-                        name.lower() == 'phid' or \
-                        name.lower() == 'vd' or \
-                        name.lower() == 'ld' or \
-                        name.lower() == 'bd' or \
-                        name.lower() == 'kbc' or \
-                        name.lower() == 'kbd' or \
-                        name.lower() == 'kcd' :
-                    self.params[name] = value
-            else:
-                if name.lower() == 'na' or \
-                        name.lower() == 'phia' or \
-                        name.lower() == 'va' or \
-                        name.lower() == 'la' or \
-                        name.lower() == 'ba' or \
-                        name.lower() == 'nb' or \
-                        name.lower() == 'phib' or \
-                        name.lower() == 'vb' or \
-                        name.lower() == 'lb' or \
-                        name.lower() == 'bb' or \
-                        name.lower() == 'nc' or \
-                        name.lower() == 'phic' or \
-                        name.lower() == 'vc' or \
-                        name.lower() == 'lc' or \
-                        name.lower() == 'bc' or \
-                        name.lower() == 'nd' or \
-                        name.lower() == 'phid' or \
-                        name.lower() == 'vd' or \
-                        name.lower() == 'ld' or \
-                        name.lower() == 'bd' or \
-                        name.lower() == 'kab' or \
-                        name.lower() == 'kac' or \
-                        name.lower() == 'kad' or \
-                        name.lower() == 'kbc' or \
-                        name.lower() == 'kbd' or \
-                        name.lower() == 'kcd' :
-                    self.params[name] = value
-            
-          
-
-    def _set_details(self):
-        """
-        Concatenate details of the original model to create
-        this model details 
-        """
-        for name ,detail in self.model.details.iteritems():
-            if name in self.params.iterkeys():
-                self.details[name]= detail
-    
-    def _get_func_list(self):
-        """
-        Get the list of functions in each cases 
-        """
-        func_list = {}
-        return func_list
-        
-    def getProfile(self):
-        """
-        Get SLD profile 
-        
-        : return: None, No SLD profile supporting for this model
-        """
-        return None
-        
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        : param name: name of the parameter
-        : param value: value of the parameter
-        """
-        # set param to new model
-        self._setParamHelper( name, value)
-            
-        self.model.setParam( name, value)
-
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setParam
-        """
-
-        # Look for standard parameter
-        for item in self.params.keys():
-            if item.lower()==name.lower():
-                self.params[item] = value
-                return
-        
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-        Fill the self.fixed list with the model fixed list
-        """
-        pass         
-
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q, or [q,phi]
-        
-        :return: scattering function P(q)
-        
-        """
-
-        return self.model.run(x)
-
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [qx, qy])
-        : return: scattering function value
-        """  
-
-        return self.model.runXY(x)
-    
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x = []):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        : param x: input q[], or [qx[], qy[]]
-        : return: scattering function P(q[])
-        """
-        # set effective radius and scaling factor before run
-        return self.model.evalDistribution(x)
-    def calculate_ER(self):
-        """
-        """
-        return self.model.calculate_ER()
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        : param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        pass
Index: c/sas/models/ReflectivityIIModel.py
===================================================================
--- src/sas/models/ReflectivityIIModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,365 +1,0 @@
-   
-from sas.models.BaseComponent import BaseComponent
-from sas.models.ReflAdvModel import ReflAdvModel
-from copy import deepcopy
-from math import floor
-from math import fabs
-func_list = {'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, \
-                     'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4}
-max_nshells = 10
-class ReflectivityIIModel(BaseComponent):
-    """
-    This multi-model is based on Parratt formalism and provides the capability
-    of changing the number of layers between 0 and 10.
-    """
-    def __init__(self, multfactor=1):
-        """
-            :param multfactor: number of layers in the model, 
-            assumes 0<= n_layers <=10.
-        """
-        BaseComponent.__init__(self)
-
-        ## Setting  model name model description
-        self.description = ""
-        model = ReflAdvModel()
-        self.model = model
-        self.name = "ReflectivityIIModel"
-        self.description = model.description
-        self.n_layers = int(multfactor)
-        ## Define parameters
-        self.params = {}
-        
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        # non-fittable parameters
-        self.non_fittable = model.non_fittable
-        
-        # list of function in order of the function number 
-        self.fun_list = self._get_func_list()
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        self.model.params['n_layers'] = self.n_layers
-        
-        ## functional multiplicity info of the model
-        # [int(maximum no. of functionality),"str(Titl),
-        # [str(name of function0),...], [str(x-asix name of sld),...]]
-        self.multiplicity_info = [max_nshells, "No. of Layers:", [], ['Depth']]
-        ## independent parameter name and unit [string]
-        self.input_name = "Q"
-        self.input_unit = "A^{-1}"
-        ## output name and unit  [string]
-        self.output_name = "Reflectivity"
-        self.output_unit = ""
-   
-    
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal
-        data members to a fresh copy.
-        """
-        obj.params     = deepcopy(self.params)
-        obj.non_fittable     = deepcopy(self.non_fittable)
-        obj.description     = deepcopy(self.description)
-        obj.details    = deepcopy(self.details)
-        obj.dispersion = deepcopy(self.dispersion)
-        obj.model  = self.model.clone()
-
-        return obj
-    
-    
-    def _set_dispersion(self):
-        """
-        model dispersions
-        """ 
-        ##set dispersion from model 
-        self.dispersion = {}
-                    
-
-    def _set_params(self):
-        """
-        Concatenate the parameters of the model to create
-        this model parameters 
-        """
-        # rearrange the parameters for the given # of shells
-        for name, value in self.model.params.iteritems():
-            n = 0
-            pos = len(name.split('_'))-1
-            first_name = name.split('_')[0]
-            last_name = name.split('_')[pos]
-            if first_name == 'npts':
-                self.params[name]=value
-                continue
-            elif first_name == 'sldIM':
-                continue
-            elif first_name == 'func':
-                n = -1
-                while n < self.n_layers:
-                    n += 1
-                    if last_name == 'inter%s' % str(n): 
-                        self.params[name] = value
-                        continue
-            
-                #continue
-            elif last_name[0:5] == 'inter':
-                n = -1
-                while n < self.n_layers:
-                    n += 1
-                    if last_name == 'inter%s' % str(n):
-                        self.params[name] = value
-                        continue
-            elif last_name[0:4] == 'flat':
-                while n < self.n_layers:
-                    n += 1
-                    if last_name == 'flat%s' % str(n):
-                        self.params[name] = value
-                        continue
-            elif name == 'n_layers':
-                continue
-            else:
-                self.params[name] = value
-  
-        self.model.params['n_layers'] = self.n_layers    
-  
-        # set constrained values for the original model params
-        self._set_xtra_model_param()       
-
-    def _set_details(self):
-        """
-        Concatenate details of the original model to create
-        this model details 
-        """
-        for name, detail in self.model.details.iteritems():
-            if name in self.params.iterkeys():
-                self.details[name] = detail
-            
-    
-    def _set_xtra_model_param(self):
-        """
-        Set params of original model that are hidden from this model
-        """
-        # look for the model parameters that are not in param list
-        for key in self.model.params.iterkeys():
-            if key not in self.params.keys():
-                if  key.split('_')[0] == 'thick':
-                    self.model.setParam(key, 0)
-                    continue
-                if  key.split('_')[0] == 'func': 
-                    self.model.setParam(key, 0)
-                    continue
-
-                for nshell in range(self.n_layers,max_nshells):
-                    if key.split('_')[1] == 'flat%s' % str(nshell+1):
-                        try:
-                            if key.split('_')[0] == 'sld':
-                                value = self.model.params['sld_medium']
-                            elif key.split('_')[0] == 'sldIM':
-                                value = self.model.params['sldIM_medium']
-                            self.model.setParam(key, value)
-                        except:
-                            message = "ReflectivityIIModel evaluation problem"
-                            raise RuntimeError, message
-    
-    def _get_func_list(self):
-        """
-            Get the list of functions in each layer (shell) 
-        """
-        return func_list
-        
-    def getProfile(self):
-        """
-        Get SLD profile 
-        
-        : return: (z, beta) where z is a list of depth of the transition points
-                beta is a list of the corresponding SLD values 
-        """
-        # max_pts for each layers
-        n_sub = int(self.params['npts_inter'])
-        z = []
-        beta = []
-        z.append(0)
-        beta.append(self.params['sld_bottom0']) 
-       
-        z0 = 0.0
-        dz = 0.0
-        # for layers from the top
-        for n_lyr in range(1, self.n_layers+2):
-            i = n_lyr
-            # j=0 for interface, j=1 for flat layer 
-            for j in range(0, 2):
-                # interation for sub-layers
-                for n_s in range(0, n_sub):
-                    # for flat layer
-                    if j == 1:
-                        if i == self.n_layers+1:
-                            break
-                        # shift half sub thickness for the first point
-                        z0 -= dz/2.0
-                        z.append(z0)
-                        sld_i = self.params['sld_flat%s' % str(i)]
-                        beta.append(sld_i)
-                        dz = self.params['thick_flat%s' % str(i)]
-                        z0 += dz
-                    else:
-                        dz = self.params['thick_inter%s' % str(i-1)]/n_sub
-                        nu = fabs(self.params['nu_inter%s' % str(i-1)])
-                        if n_s == 0:
-                            # shift half sub thickness for the point
-                            z0 += dz/2.0
-                        # decide which sld is which, sld_r or sld_l
-                        if i == 1:
-                            sld_l = self.params['sld_bottom0']
-                        else:
-                            sld_l = self.params['sld_flat%s' % str(i-1)]
-                        if i == self.n_layers+1:
-                            sld_r = self.params['sld_medium']
-                        else:
-                            sld_r = self.params['sld_flat%s' % str(i)]
-                        if sld_r == sld_l:
-                            sld_i = sld_r
-                        else:
-                            func_idx = self.params['func_inter%s' % str(i-1)]
-                            # calculate the sld
-                            sld_i = self._get_sld(func_idx, n_sub, n_s+0.5, nu,
-                                              sld_l, sld_r)
-                    # append to the list
-                    z.append(z0)
-                    beta.append(sld_i)
-                    if j == 1: 
-                        break
-                    else: 
-                        z0 += dz
-        # put substrate and superstrate profile
-        z.append(z0)
-        beta.append(self.params['sld_medium'])  
-        z_ext = z0/5.0
-        
-        # put the extra points for the substrate 
-        # and superstrate
-        z.append(z0+z_ext)
-        beta.append(self.params['sld_medium']) 
-        z.insert(0, -z_ext)
-        beta.insert(0, self.params['sld_bottom0']) 
-        # rearrange the profile for NR sld profile style
-        z = [z0 - x for x in z]
-        z.reverse()
-        beta.reverse()  
-        return z, beta
-    
-    def _get_sld(self, func_idx, n_sub, n_s, nu, sld_l, sld_r):
-        """
-        Get the function asked to build sld profile
-        : param func_idx: func type number
-        : param n_sub: total number of sub_layer
-        : param n_s: index of sub_layer
-        : param nu: coefficient of the function
-        : param sld_l: sld on the left side
-        : param sld_r: sld on the right side
-        : return: sld value, float
-        """
-        from sas.models.SLDCalFunc import SLDCalFunc
-        # sld_cal init
-        sld_cal = SLDCalFunc()
-        # set params
-        sld_cal.setParam('fun_type', func_idx)
-        sld_cal.setParam('npts_inter', n_sub)
-        sld_cal.setParam('shell_num', n_s)
-        sld_cal.setParam('nu_inter', nu)
-        sld_cal.setParam('sld_left', sld_l)
-        sld_cal.setParam('sld_right', sld_r)
-        # return sld value
-        return sld_cal.run()
-    
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        : param name: name of the parameter
-        : param value: value of the parameter
-        """
-        # set param to new model
-        self._setParamHelper( name, value)
-        
-        ## setParam to model 
-        if name == 'sld_medium':
-            # the sld_*** model.params not in params must set 
-            # to value of sld_solv
-            for key in self.model.params.iterkeys():
-                if key not in self.params.keys()and key.split('_')[0] == 'sld':
-                    self.model.setParam(key, value)   
-        
-        self.model.setParam( name, value)
-
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setParam
-        """
-
-        # Look for standard parameter
-        for item in self.params.keys():
-            if item.lower()==name.lower():
-                self.params[item] = value
-                return
-        
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-        Fill the self.fixed list with the model fixed list
-        """
-        pass         
-
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q, or [q,phi]
-        
-        :return: scattering function P(q)
-        
-        """
-
-        return self.model.run(x)
-
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [qx, qy])
-        : return: scattering function value
-        """  
-
-        return self.model.runXY(x)
-    
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        : param x: input q[], or [qx[], qy[]]
-        : return: scattering function P(q[])
-        """
-        # set effective radius and scaling factor before run
-        return self.model.evalDistribution(x)
-    def calculate_ER(self):
-        """
-        """
-        return self.model.calculate_ER()
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        : param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        pass
Index: c/sas/models/ReflectivityModel.py
===================================================================
--- src/sas/models/ReflectivityModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,376 +1,0 @@
-   
-from sas.models.BaseComponent import BaseComponent
-from sas.models.ReflModel import ReflModel
-from copy import deepcopy
-from math import floor
-from scipy.special import erf
-func_list = {'Erf':0, 'Linear':1}
-max_nshells = 10
-
-class ReflectivityModel(BaseComponent):
-    """
-    This multi-model is based on Parratt formalism and provides the capability
-    of changing the number of layers between 0 and 10.
-    """
-    def __init__(self, multfactor=1):
-        """
-            :param multfactor: number of layers in the model, 
-            assumes 0<= n_shells <=10.
-        """
-        BaseComponent.__init__(self)
-
-        ## Setting  model name model description
-        self.description = ""
-        model = ReflModel()
-        self.model = model
-        self.name = "ReflectivityModel"
-        self.description = model.description
-        self.n_layers = int(multfactor)
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        # non-fittable parameters
-        self.non_fittable = model.non_fittable
-        
-        # list of function in order of the function number 
-        self.fun_list = self._get_func_list()
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        self.model.params['n_layers'] = self.n_layers
-        
-        ## functional multiplicity info of the model
-        # [int(maximum no. of functionality),"str(Titl),
-        # [str(name of function0),...], [str(x-asix name of sld),...]]
-        self.multiplicity_info = [max_nshells, "No. of Layers:", [], ['Depth']]
-        ## independent parameter name and unit [string]
-        self.input_name = "Q"
-        self.input_unit = "A^{-1}"
-        ## output name and unit  [string]
-        self.output_name = "Reflectivity"
-        self.output_unit = ""
-    
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal
-        data members to a fresh copy.
-        """
-        obj.params     = deepcopy(self.params)
-        obj.non_fittable     = deepcopy(self.non_fittable)
-        obj.description     = deepcopy(self.description)
-        obj.details    = deepcopy(self.details)
-        obj.dispersion = deepcopy(self.dispersion)
-        obj.model  = self.model.clone()
-
-        return obj
-    
-    
-    def _set_dispersion(self):
-        """
-        model dispersions
-        """ 
-        ##set dispersion from model 
-        self.dispersion = {}
-                    
-
-    def _set_params(self):
-        """
-        Concatenate the parameters of the model to create
-        this model parameters 
-        """
-        # rearrange the parameters for the given # of shells
-        for name , value in self.model.params.iteritems():
-            n = 0
-            pos = len(name.split('_'))-1
-            if name.split('_')[0] == 'sldIM':
-                continue
-            elif name.split('_')[0] == 'func':
-                n = -1
-                while n < self.n_layers:
-                    n += 1
-                    if name.split('_')[pos] == 'inter%s' % str(n):
-                        self.params[name] = value
-                        continue
-                #continue
-            elif name.split('_')[pos][0:5] == 'inter':
-                n = -1
-                while n < self.n_layers:
-                    n += 1
-                    if name.split('_')[pos] == 'inter%s' % str(n):
-                        self.params[name] = value
-                        continue
-            elif name.split('_')[pos][0:4] == 'flat':
-                while n < self.n_layers:
-                    n += 1
-                    if name.split('_')[pos] == 'flat%s' % str(n):
-                        self.params[name] = value
-                        continue
-            elif name == 'n_layers':
-                continue
-            else:
-                self.params[name] = value
-               
-        self.model.params['n_layers'] = self.n_layers    
-
-        # set constrained values for the original model params
-        self._set_xtra_model_param()       
-
-    def _set_details(self):
-        """
-        Concatenate details of the original model to create
-        this model details 
-        """
-        for name, detail in self.model.details.iteritems():
-            if name in self.params.iterkeys():
-                self.details[name] = detail
-            
-    
-    def _set_xtra_model_param(self):
-        """
-        Set params of original model that are hidden from this model
-        """
-        # look for the model parameters that are not in param list
-        for key in self.model.params.iterkeys():
-            if key not in self.params.keys():
-                if  key.split('_')[0] == 'thick':
-                    self.model.setParam(key, 0)
-                    continue
-                if  key.split('_')[0] == 'func':
-                    self.model.setParam(key, 0)
-                    continue
-                for nshell in range(self.n_layers,max_nshells):
-                    if key.split('_')[1] == 'flat%s' % str(nshell+1):
-                        try:
-                            if key.split('_')[0] == 'sld':
-                                value = self.model.params['sld_medium']
-                            elif key.split('_')[0] == 'sldIM':
-                                value = self.model.params['sldIM_medium']
-                            self.model.setParam(key, value)
-                        except:
-                            raise RuntimeError, "ReflectivityModel problem"
-    
-    def _get_func_list(self):
-        """
-        Get the list of functions in each layer (shell) 
-        """
-        #func_list = {}
-        return func_list
-        
-    def getProfile(self):
-        """
-        Get SLD profile 
-        
-        : return: (z, beta) where z is a list of depth of the transition points
-                beta is a list of the corresponding SLD values 
-        """
-        # max_pts for each layers
-        n_sub = 21
-        z = []
-        beta = []
-        sub_range = int(floor(n_sub/2.0))
-        z.append(0)
-        beta.append(self.params['sld_bottom0']) 
-       
-        z0 = 0
-        # for layers from the top
-        for n in range(1, self.n_layers+2):
-            i = n
-
-            for j in range(0, 2):
-                for n_s in range(-sub_range, sub_range+1): 
-                    dz = self.params['thick_inter%s' % str(i-1)]/n_sub
-                    if j == 1:
-                        if i == self.n_layers+1:
-                            break
-                        # shift half sub thickness for the first point
-                        z0 += dz/2.0
-                        z.append(z0)
-                        #z0 -= dz/2.0
-                        z0 += self.params['thick_flat%s' % str(i)]
-                        
-                        sld_i = self.params['sld_flat%s' % str(i)]
-                        beta.append(self.params['sld_flat%s' % str(i)])
-                    else:
-                        if n_s == -sub_range:
-                            # shift half sub thickness for the first point
-                            z0 -= dz/2.0
-                        #exec "dz = self.params['thick_inter[%s-1]'% str(i)]/9"
-                        #print "%d = %g \n"% (i,self.params['thick_inter3'])
-                        z0 += dz
-
-                        if i == 1:
-                            sld_l = self.params['sld_bottom0']
-                        else:
-                            sld_l = self.params['sld_flat%s' % str(i-1)]
-                        if i == self.n_layers+1:
-                            sld_r = self.params['sld_medium']
-                        else:
-                            sld_r = self.params['sld_flat%s' % str(i)]
-                        func_idx = self.params['func_inter%s' % str(i-1)]
-                        func = self._get_func(n_s, n_sub, func_idx)
-                        if sld_r > sld_l:
-                            sld_i = (sld_r-sld_l)*func+sld_l
-                        elif sld_r < sld_l:
-                            sld_i = (sld_l-sld_r)*(1-func)+sld_r
-                        else:
-                            sld_i = sld_r
-                    z.append(z0)
-                    beta.append(sld_i)
-                    if j == 1:
-                        break
-        # put substrate and superstrate profile
-        # shift half sub thickness for the first point
-        z0 += dz/2.0
-        z.append(z0)
-        beta.append(self.params['sld_medium'])  
-        z_ext = z0/6.0
-        
-        # put the extra points for the substrate 
-        # and superstrate
-        z.append(z0+z_ext)
-        beta.append(self.params['sld_medium']) 
-        z.insert(0, -z_ext)
-        beta.insert(0, self.params['sld_bottom0']) 
-        z = [z0 - x for x in z]
-        z.reverse()
-        beta.reverse()  
-        return z, beta
-    
-    def _get_func(self, index, n_sub, func_idx):
-        """
-        Get the function asked to buil sld profile
-        : param index: index of sub_layer
-        : param n_sub: total number of sub_layer
-        : param func_idx: an integer to identify a function
-        
-        : return out: the output from the function, float
-        """
-        # cal bin_size
-        bin_size = 1.0/n_sub
-        # erf
-        if func_idx == 0:
-            out = erf(index/(n_sub/5.0))/2.0 + 0.5
-            return out
-        else:
-            index += 0.5
-        # linear
-        if func_idx == 1:
-            out = ((index + floor(n_sub/2.0))*bin_size)
-        # r_parabolic
-        elif func_idx == 2:
-            out = ((index + floor(n_sub/2.0))*bin_size)* \
-                    ((index + floor(n_sub/2.0))*bin_size)
-        # l_parabolic
-        elif func_idx == 3:
-            out = 1.0-(((index + floor(n_sub/2.0))*bin_size) - 1.0) *\
-                    (((index + floor(n_sub/2.0))*bin_size) - 1.0)
-        # r_cubic
-        elif func_idx == 4:
-            out = ((index + floor(n_sub/2.0))*bin_size)* \
-                    ((index + floor(n_sub/2.0))*bin_size)* \
-                    ((index + floor(n_sub/2.0))*bin_size)
-        # l_cubic
-        elif func_idx == 5:
-            out = 1.0+(((index + floor(n_sub/2.0)))*bin_size - 1.0) *\
-                    (((index + floor(n_sub/2.0)))*bin_size - 1.0) *\
-                    (((index + floor(n_sub/2.0)))*bin_size - 1.0)
-        # return output
-        return out
-    
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        : param name: name of the parameter
-        : param value: value of the parameter
-        """
-        # set param to new model
-        self._setParamHelper( name, value)
-        
-        ## setParam to model 
-        if name == 'sld_medium':
-            # the sld_*** model.params not in params must set 
-            # to value of sld_solv
-            for key in self.model.params.iterkeys():
-                if key not in self.params.keys()and key.split('_')[0] == 'sld':
-                    self.model.setParam(key, value)
-            
-        self.model.setParam( name, value)
-
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setParam
-        """
-
-        # Look for standard parameter
-        for item in self.params.keys():
-            if item.lower()==name.lower():
-                self.params[item] = value
-                return
-        
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-        Fill the self.fixed list with the model fixed list
-        """
-        pass         
-
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q, or [q,phi]
-        
-        :return: scattering function P(q)
-        
-        """
-
-        return self.model.run(x)
-
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [qx, qy])
-        : return: scattering function value
-        """  
-
-        return self.model.runXY(x)
-    
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        : param x: input q[], or [qx[], qy[]]
-        : return: scattering function P(q[])
-        """
-        # set effective radius and scaling factor before run
-        return self.model.evalDistribution(x)
-    
-    def calculate_ER(self):
-        """
-        """
-        return self.model.calculate_ER()
-    
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        : param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        pass
Index: c/sas/models/Sin.py
===================================================================
--- src/sas/models/Sin.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-#!/usr/bin/env python
-""" Provide sin(x) function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-import math
- 
-class Sin(BaseComponent):
-    """ Class that evaluates a sin(x) model. 
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "Sin"
-        self.description=""" the sin model
-        F(x)=sin(x)
-        """
-        ## Parameter details [units, min, max]
-        self.details = {}
-        #list of parameter that cannot be fitted
-        self.fixed= []
-    def clone(self):
-        """ Return a identical copy of self """
-        return Sin()
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input x, or [x, phi] [radian]
-            @return: sin(x) or sin(x*cos(phi))*sin(x*sin(phi))
-        """
-        if x.__class__.__name__ == 'list':
-            return math.sin(x[0]*math.cos(x[1]))*math.sin(x[0]*math.sin(x[1]))
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return math.sin(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input x, or [x, y] [radian]
-            @return: sin(x) or sin(x)*sin(y)
-        """
-        if x.__class__.__name__ == 'list':
-            return math.sin(x[0])*math.sin(x[1])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return math.sin(x)
-   
-# End of file
Index: c/sas/models/SphericalSLDModel.py
===================================================================
--- src/sas/models/SphericalSLDModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,368 +1,0 @@
-"""
-    Spherical SLD model
-"""
-from sas.models.BaseComponent import BaseComponent
-from sas.models.SphereSLDModel import SphereSLDModel
-from copy import deepcopy
-func_list = {'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, \
-                     'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4}
-max_nshells = 10
-
-class SphericalSLDModel(BaseComponent):
-    """
-    This multi-model is based on Parratt formalism and provides the capability
-    of changing the number of layers between 0 and 10.
-    """
-    def __init__(self, multfactor=1):
-        """
-            :param multfactor: number of layers in the model, 
-            assumes 0<= n_shells <=10.
-        """
-        BaseComponent.__init__(self)
-
-        ## Setting  model name model description
-        self.description = ""
-        model = SphereSLDModel()
-        self.model = model
-        self.name = "SphericalSLDModel"
-        self.description = model.description
-        self.n_shells = multfactor
-        ## Define parameters
-        self.params = {}
-        
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        # non-fittable parameters
-        self.non_fittable = model.non_fittable
-        
-        # list of function in order of the function number 
-        self.fun_list = self._get_func_list()
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        self.model.params['n_shells'] = self.n_shells
-        
-        ## functional multiplicity info of the model
-        # [int(maximum no. of functionality),"str(Titl),
-        # [str(name of function0),...], [str(x-asix name of sld),...]]
-        self.multiplicity_info = [max_nshells, "No. of Shells:", [], ['Radius']]
-        
-    
-    def _clone(self, obj):
-        """
-        Internal utility function to copy the internal
-        data members to a fresh copy.
-        """
-        obj.params     = deepcopy(self.params)
-        obj.non_fittable     = deepcopy(self.non_fittable)
-        obj.description     = deepcopy(self.description)
-        obj.details    = deepcopy(self.details)
-        obj.dispersion = deepcopy(self.dispersion)
-        obj.model  = self.model.clone()
-
-        return obj
-    
-    
-    def _set_dispersion(self):
-        """
-        model dispersions
-        """ 
-        ##set dispersion from model 
-        for name , value in self.model.dispersion.iteritems():   
-              
-            nshell = -1
-            if name.split('_')[0] == 'thick':
-                while nshell < 1:
-                    nshell += 1
-                    if name.split('_')[1] == 'inter%s' % str(nshell):
-                        self.dispersion[name] = value
-                    else: 
-                        continue
-            else:
-                self.dispersion[name] = value
-
-    def _set_params(self):
-        """
-        Concatenate the parameters of the model to create
-        this model parameters 
-        """
-        # rearrange the parameters for the given # of shells
-        for name , value in self.model.params.iteritems():
-            n = 0
-            pos = len(name.split('_'))-1
-            first_name = name.split('_')[0]
-            last_name = name.split('_')[pos]
-            if first_name == 'npts':
-                self.params[name] = value
-                continue
-            elif first_name == 'func':
-                n = -1
-                while n < self.n_shells:
-                    n += 1
-                    if last_name == 'inter%s' % str(n): 
-                        self.params[name] = value
-                        continue
-            elif last_name[0:5] == 'inter':
-                n = -1
-                while n < self.n_shells:
-                    n += 1
-                    if last_name == 'inter%s' % str(n):
-                        self.params[name] = value
-                        continue
-            elif last_name[0:4] == 'flat':
-                while n < self.n_shells:
-                    n += 1
-                    if last_name == 'flat%s' % str(n):
-                        self.params[name] = value
-                        continue
-            elif name == 'n_shells':
-                continue
-            else:
-                self.params[name] = value
-  
-        self.model.params['n_shells'] = self.n_shells    
-  
-        # set constrained values for the original model params
-        self._set_xtra_model_param()       
-
-    def _set_details(self):
-        """
-        Concatenate details of the original model to create
-        this model details 
-        """
-        for name, detail in self.model.details.iteritems():
-            if name in self.params.iterkeys():
-                self.details[name] = detail
-            
-    
-    def _set_xtra_model_param(self):
-        """
-        Set params of original model that are hidden from this model
-        """
-        # look for the model parameters that are not in param list
-        for key in self.model.params.iterkeys():
-            if key not in self.params.keys():
-                if key.split('_')[0] == 'thick':
-                    self.model.setParam(key, 0)
-                    continue
-                if key.split('_')[0] == 'func': 
-                    self.model.setParam(key, 0)
-                    continue
-
-                for nshell in range(self.n_shells, max_nshells):
-                    if key.split('_')[1] == 'flat%s' % str(nshell+1):
-                        try:
-                            if key.split('_')[0] == 'sld':
-                                value = self.model.params['sld_solv']
-                            self.model.setParam(key, value)
-                        except:
-                            raise RuntimeError, "SphericalSLD model problem"
-    
-    def _get_func_list(self):
-        """
-        Get the list of functions in each layer (shell) 
-        """
-        return func_list
-        
-    def getProfile(self):
-        """
-        Get SLD profile 
-        
-        : return: (z, beta) where z is a list of depth of the transition points
-                beta is a list of the corresponding SLD values 
-        """
-        # max_pts for each layers
-        n_sub = int(self.params['npts_inter'])
-        z = []
-        beta = []
-        z0 = 0
-        # two sld points for core
-        z.append(0)
-        beta.append(self.params['sld_core0']) 
-        z.append(self.params['rad_core0']) 
-        beta.append(self.params['sld_core0']) 
-        z0 += self.params['rad_core0']
-        # for layers from the core
-        for i in range(1, self.n_shells+2):
-            dz = self.params['thick_inter%s' % str(i-1)]/n_sub
-            # j=0 for interface, j=1 for flat layer 
-            for j in range(0, 2):
-                # interation for sub-layers
-                for n_s in range(0, n_sub+1):
-                    if j == 1:
-                        if i == self.n_shells+1:
-                            break
-                        # shift half sub thickness for the first point
-                        z0 -= dz#/2.0
-                        z.append(z0)
-                        #z0 -= dz/2.0
-                        z0 += self.params['thick_flat%s' % str(i)]
-                        
-                        sld_i = self.params['sld_flat%s' % str(i)]
-                        beta.append(self.params['sld_flat%s' % str(i)])
-                        dz = 0
-                    else:
-                        nu = self.params['nu_inter%s' % str(i-1)]
-                        # decide which sld is which, sld_r or sld_l
-                        if i == 1:
-                            sld_l = self.params['sld_core0']
-                        else:
-                            sld_l = self.params['sld_flat%s' % str(i-1)]
-                        if i == self.n_shells+1:
-                            sld_r = self.params['sld_solv']
-                        else:
-                            sld_r = self.params['sld_flat%s' % str(i)]
-                        # get function type
-                        func_idx = self.params['func_inter%s' % str(i-1)]
-                        # calculate the sld
-                        sld_i = self._get_sld(func_idx, n_sub, n_s, nu,
-                                              sld_l, sld_r)
-                    # append to the list
-                    z.append(z0)
-                    beta.append(sld_i)
-                    z0 += dz
-                    if j == 1:
-                        break
-        # put sld of solvent
-        z.append(z0)
-        beta.append(self.params['sld_solv'])  
-        z_ext = z0/5.0
-        z.append(z0+z_ext)
-        beta.append(self.params['sld_solv']) 
-        # return sld profile (r, beta)
-        return z, beta
-    
-    def _get_sld(self, func_idx, n_sub, n_s, nu, sld_l, sld_r):
-        """
-        Get the function asked to build sld profile
-        : param func_idx: func type number
-        : param n_sub: total number of sub_layer
-        : param n_s: index of sub_layer
-        : param nu: coefficient of the function
-        : param sld_l: sld on the left side
-        : param sld_r: sld on the right side
-        : return: sld value, float
-        """
-        from sas.models.SLDCalFunc import SLDCalFunc
-        # sld_cal init
-        sld_cal = SLDCalFunc()
-        # set params
-        sld_cal.setParam('fun_type', func_idx)
-        sld_cal.setParam('npts_inter', n_sub)
-        sld_cal.setParam('shell_num', n_s)
-        sld_cal.setParam('nu_inter', nu)
-        sld_cal.setParam('sld_left', sld_l)
-        sld_cal.setParam('sld_right', sld_r)
-        # return sld value
-        return sld_cal.run()
-    
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        : param name: name of the parameter
-        : param value: value of the parameter
-        """
-        # set param to new model
-        self._setParamHelper(name, value)
-        
-        ## setParam to model 
-        if name == 'sld_solv':
-            # the sld_*** model.params not in params must set to 
-            # value of sld_solv
-            for key in self.model.params.iterkeys():
-                if key not in self.params.keys() and key.split('_')[0] == 'sld':
-                    self.model.setParam(key, value)
-            
-        self.model.setParam(name, value)
-
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setParam
-        """
-        toks = name.split('.')
-        if len(toks) == 2:
-            for item in self.dispersion.keys():
-                if item.lower() == toks[0].lower():
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            self.dispersion[item][par] = value
-                            return
-        # Look for standard parameter
-        for item in self.params.keys():
-            if item.lower() == name.lower():
-                self.params[item] = value
-                return
-        
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-        Fill the self.fixed list with the model fixed list
-        """
-        for item in self.model.fixed:
-            if item.split('.')[0] in self.params.keys(): 
-                self.fixed.append(item)
-
-        self.fixed.sort()
-
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q, or [q,phi]
-        
-        :return: scattering function P(q)
-        
-        """
-
-        return self.model.run(x)
-
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [qx, qy])
-        : return: scattering function value
-        """  
-
-        return self.model.runXY(x)
-    
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        : param x: input q[], or [qx[], qy[]]
-        : return: scattering function P(q[])
-        """
-        # set effective radius and scaling factor before run
-        return self.model.evalDistribution(x)
-    
-    def calculate_ER(self):
-        """
-        """
-        return self.model.calculate_ER()
-    
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        : param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        value = None
-        if parameter in self.model.dispersion.keys():
-            value = self.model.set_dispersion(parameter, dispersion)
-        self._set_dispersion()
-        return value
Index: c/sas/models/SubComponent.py
===================================================================
--- src/sas/models/SubComponent.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-#!/usr/bin/env python
-""" Provide base functionality for all model components
-    @author: Mathieu Doucet / UTK
-    @contact: mathieu.doucet@nist.gov
-"""
-
-# info
-__author__ = "Mathieu Doucet /  UTK"
-__id__ = "$Id: BaseComponent.py,v 1.2 2007/03/14 21:04:40 doucet Exp $"
-   
-# imports   
-from sas.models.BaseComponent import BaseComponent
-
-class SubComponent(BaseComponent):
-    """ Basic model component for Subtraction
-        Provides basic arithmetics
-    """
-
-    def __init__(self, base=None, other=None):
-        """
-            @param base: component to subtract from
-            @param other: component to subtract
-        """
-        BaseComponent.__init__(self)
-        # Component to subtract from
-        self.operateOn = base
-        # Component to subtract
-        self.other = other
-        # name
-        self.name = 'SubComponent'
-        
-    def run(self, x=0):
-        """
-            Evaluate each part of the component and sum the results
-            @param x: input parameter
-            @return: value of the model at x
-        """
-        return self.operateOn.run(x) - self.other.run(x)
-        
-    def runXY(self, x=0):
-        """
-            Evaluate each part of the component and sum the results
-            @param x: input parameter
-            @return: value of the model at x
-        """
-        return self.operateOn.runXY(x) - self.other.runXY(x)
-        
-    def setParam(self, name, value):
-        """ 
-            Set the value of a model parameter
-            @param name: name of parameter to set
-            @param value: value to give the paramter
-        """
-        return BaseComponent.setParamWithToken(self, name, 
-                                               value, 'sub', self.other)
-    
-    def getParam(self, name):
-        """ 
-            Set the value of a model parameter
-            @param name: name of the parameter
-            @return: value of the parameter
-        """
-        return BaseComponent.getParamWithToken(self, name, 'sub', self.other)
-
-    def getParamList(self):
-        """ Return a list of all available parameters for the model 
-        """
-        return BaseComponent.getParamListWithToken(self, 'sub', self.other)
-    
-# End of file
Index: c/sas/models/TwoLorentzianModel.py
===================================================================
--- src/sas/models/TwoLorentzianModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-#!/usr/bin/env python
-""" 
-TwoLorentzianModel function as a BaseComponent model
-"""
-
-from sas.models.BaseComponent import BaseComponent
-from numpy import power
-import math
-
-class TwoLorentzianModel(BaseComponent):
-    """ 
-    Class that evaluates a TwoLorentzianModel.
-    I(q) = II(q) = scale_1/(1.0 + pow((q*length_1),exponent_1))
-    + scale_2/(1.0 + pow((q*length_2),exponent_2) )+ background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "TwoLorentzian"
-        self.description = """I(q) = scale_1/(1.0 + pow((q*length_1),exponent_1))
-             + scale_2/(1.0 + pow((q*length_2),exponent_2) )+ background
-             List of default parameters:
-             scale_1 = Lorentzian term scaling #1
-             length_1 = Lorentzian screening length #1 [A]
-             exponent_1 = Lorentzian exponent #1
-             scale_2 = Lorentzian term scaling #2
-             length_2 = Lorentzian screening length #2 [A]
-             exponent_2 = Lorentzian exponent #2
-             background = Incoherent background
-        """
-        ## Define parameters
-        self.params = {}
-        self.params['scale_1']  = 10.0
-        self.params['length_1']     = 100.0
-        self.params['exponent_1']     = 3.0
-        self.params['scale_2']  = 1.0
-        self.params['length_2']     = 10.0
-        self.params['exponent_2']     = 2.0
-        self.params['background']     = 0.1
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['scale_1'] = ['', None, None]
-        self.details['length_1'] = ['A', None, None]
-        self.details['exponent_1'] =  ['', None, None]
-        self.details['scale_2']  =  ['', None, None]
-        self.details['length_2']  =   ['A', None, None]
-        self.details['exponent_2']  =   ['', None, None]
-        self.details['background']   =  ['[1/cm]', None, None]
-
-        #list of parameter that cannot be fitted
-        self.fixed = []  
-    def _twolorentzian(self, x):
-        """
-        Model definition
-        """
-        inten = self.params['scale_1']/(1.0 + \
-                power((x*self.params['length_1']),self.params['exponent_1']))
-        inten += self.params['scale_2']/(1.0 + \
-                power((x*self.params['length_2']),self.params['exponent_2']))
-        inten += self.params['background']
-
-        return inten  
-   
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        param x: input q-value (float or [float, float] as [r, theta])
-        return: (scattering value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._twolorentzian(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._twolorentzian(x)
-   
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        param x: input q-value (float or [float, float] as [qx, qy])
-        return: scattering value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._twolorentzian(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._twolorentzian(x)
Index: c/sas/models/TwoPowerLawModel.py
===================================================================
--- src/sas/models/TwoPowerLawModel.py	(revision ac7be54ccf932e813cbe6e41e05b682a1630a03e)
+++ 	(revision )
@@ -1,108 +1,0 @@
-#!/usr/bin/env python
-""" 
-TwoPowerLaw function as a BaseComponent model
-
-Calculate::
-
-    I(q) = A pow(qval,-m1) for q<=qc
-    I(q) = scale pow(qval,-m2) for q>qc
-"""
-
-from sas.models.BaseComponent import BaseComponent
-from numpy import power
-import math
-
-class TwoPowerLawModel(BaseComponent):
-    """ 
-    Class that evaluates a TwoPowerLawModel.
-
-    Calculate::
-
-       I(q) = coef_A pow(qval,-power1) for q<=qc
-       I(q) = C pow(qval,-power2) for q>qc
-
-    where C=coef_A pow(qc,-power1)/pow(qc,-power2).
-    
-    List of default parameters:
-    
-    * coef_A = coefficient
-    * power1 = (-) Power @ low Q
-    * power2 = (-) Power @ high Q
-    * qc = crossover Q-value
-    * background = incoherent background
-    """
-        
-    def __init__(self):
-        """ Initialization """
-        
-        # Initialize BaseComponent first, then sphere
-        BaseComponent.__init__(self)
-        
-        ## Name of the model
-        self.name = "TwoPowerLaw"
-        self.description="""I(q) = coef_A*pow(qval,-1.0*power1) for q<=qc
-            =C*pow(qval,-1.0*power2) for q>qc
-            where C=coef_A*pow(qc,-1.0*power1)/pow(qc,-1.0*power2).
-             List of default parameters:
-             coef_A = coefficient
-             power1 = (-) Power @ low Q
-             power2 = (-) Power @ high Q
-             qc = crossover Q-value
-             background = incoherent background
-        """
-        ## Define parameters
-        self.params = {}
-        self.params['coef_A']  = 1.0
-        self.params['power1']     = 1.0
-        self.params['power2']  = 4.0
-        self.params['qc']     = 0.04
-        self.params['background']     = 0.0
-        ## Parameter details [units, min, max]
-        self.details = {}
-        self.details['coef_A'] = ['', None, None]
-        self.details['power1'] =  ['', None, None]
-        self.details['power2']  =  ['', None, None]
-        self.details['qc']  =   ['1/A', None, None]
-        self.details['background']   =  ['[1/cm]', None, None]
-
-        #list of parameter that cannot be fitted
-        self.fixed= []  
-    def _twopowerlaw(self, x):
-        """
-        Model definition
-        """
-        qc= self.params['qc']
-        if(x<=qc):
-            inten = self.params['coef_A']*power(x,-1.0*self.params['power1'])
-        else:
-            scale = self.params['coef_A']*power(qc,-1.0*self.params['power1']) \
-                                    / power(qc,-1.0*self.params['power2'])
-            inten = scale*power(x,-1.0*self.params['power2'])
-        inten += self.params['background']
-
-        return inten  
-   
-    def run(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [r, theta])
-            @return: (guinier value)
-        """
-        if x.__class__.__name__ == 'list':
-            return self._twopowerlaw(x[0])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._twopowerlaw(x)
-   
-    def runXY(self, x = 0.0):
-        """ Evaluate the model
-            @param x: input q-value (float or [float, float] as [qx, qy])
-            @return: guinier value
-        """
-        if x.__class__.__name__ == 'list':
-            q = math.sqrt(x[0]**2 + x[1]**2)
-            return self._twopowerlaw(q)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self._twopowerlaw(x)
Index: c/sas/models/UnifiedPowerRgModel.py
===================================================================
--- src/sas/models/UnifiedPowerRgModel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,256 +1,0 @@
-from sas.models.BaseComponent import BaseComponent
-from math import exp, sqrt
-from numpy import power
-from scipy.special import erf
-max_level_n = 7
-class UnifiedPowerRgModel(BaseComponent):
-    """
-    This model is based on Exponential/Power-law fit method developed 
-    by G. Beaucage
-    """
-    def __init__(self, multfactor=1):
-        BaseComponent.__init__(self)
-        """
-        :param multfactor: number of levels in the model, 
-            assumes 0<= level# <=5.
-        """
-
-        ## Setting  model name model description
-        self.name = "UnifiedPowerRg"
-        self.description = """
-        Multiple Levels of Unified Exponential/Power-law Method.
-        Up to Level 6 is provided.
-        Note; the additional Level 0 is an inverse linear function, 
-        i.e., y = scale/x + background.
-        The Level N is defined as
-        y = background + scale * Sum(1..N)[G_i*exp(-x^2*Rg_i^2/3)
-        + B_i/x^(power_i)*(erf(x*Rg_i/sqrt(6))^(3*power_i))].
-        Ref:
-        G. Beaucage (1995).  J. Appl. Cryst., vol. 28, p717-728.
-        G. Beaucage (1996).  J. Appl. Cryst., vol. 29, p134-146.
-        """
-        self.level_num = multfactor
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        # non-fittable parameters
-        self.non_fittable = []
-
-        # list of function in order of the function number 
-        self.fun_list = self._get_func_list()
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        
-        ## functional multiplicity of the model
-        self.multiplicity_info = [max_level_n, "Level No.:", [], []]
-    
-    def _unifiedpowerrg(self, x):
-        """
-        Scattering function
-        
-        :param x: q value(s)
-        :return answer: output of the function
-        """
-        # common parameters for the model functions
-        bkg = self.params['background'] 
-        scale = self.params['scale']
-        l_num = self.level_num
-        # set default output
-        answer = 0.0
-        # Set constant on lebel zero (special case)
-        if l_num == 0:
-            answer = scale / x + bkg
-            return answer
-        # rearrange the parameters for the given label no.
-        for ind in range(1, l_num+1):
-            # get exp term
-            exp_now = exp(-power(x*self.params['Rg%s'% ind], 2)/3.0)
-            # get erf term
-            erf_now = erf(x*self.params['Rg%s'% ind]/sqrt(6.0))
-            # get power term
-            pow_now = power((erf_now*erf_now*erf_now/x), 
-                            self.params['power%s'% ind])
-            # get next exp term only if it exists
-            try:
-                exp_next = exp(-power(x*self.params['Rg%s'% (ind+1)], 2)/3.0)
-            except:
-                exp_next = 1.0
-            # get to the calculation
-            answer += self.params['G%s'% ind]*exp_now + \
-                            self.params['B%s'% ind] * exp_next * pow_now
-        # take care of the singular point
-        if x == 0.0:
-            answer = 0.0
-            for ind in range(1, l_num+1):
-                answer += self.params['G%s'% ind]
-        # get scaled
-        answer *= scale
-        # add background
-        answer += bkg
-        return answer
-        
-    def _set_dispersion(self):
-        """
-        model dispersions
-        """ 
-        ##set dispersion from model 
-        self.dispersion = {}
-                    
-
-    def _set_params(self):
-        """
-        Concatenate the parameters of the model to create
-        this model parameters 
-        """
-        # common parameters for the model functions
-        self.params['background'] = 0.0
-        self.params['scale'] = 1.0
-        l_num = self.level_num
-        # rearrange the parameters for the given label no.
-        for ind in range(0, l_num+1):
-            if ind == 0:
-                continue
-            # multiple factor for higher labels
-            mult = 1.0
-            mul_pow = 1.0
-            if ind != l_num:
-                mult = 10.0 * 4.0/3.0
-                mul_pow = 2.0
-            # Set reasonably define default values that consistent 
-            # w/NIST for label #1
-            self.params['G%s'% ind] = 0.3 * mult * pow(10, \
-                            (l_num+1 - float('%s'% ind)))
-            self.params['Rg%s'% ind] = 21.0 / mult * pow(10, \
-                              (l_num - float('%s'% ind)))
-            self.params['B%s'% ind] = 6e-03/mult * pow(10, \
-                           -(l_num+1 - float('%s'% ind)))
-            self.params['power%s'% ind] = 2.0 * mul_pow
-            
-
-    def _set_details(self):
-        """
-        Concatenate details of the original model to create
-        this model details 
-        """
-        # common parameters for the model functions
-        self.details['background'] = ['[1/cm]', None, None]
-        self.details['scale'] = ['', None, None]
-        # rearrange the parameters for the given label no.
-        for ind in range(0, self.level_num+1):
-            if ind == 0:
-                continue
-            self.details['G%s'% ind] = ['[1/(cm.sr)]', None, None]
-            self.details['Rg%s'% ind] = ['[A]', None, None]
-            self.details['B%s'% ind] = ['[1/(cm.sr)]', None, None]
-            self.details['power%s'% ind] = ['', None, None]
-
-    
-    def _get_func_list(self):
-        """
-        Get the list of functions in each cases 
-        """
-        func_list = {}
-        return func_list
-        
-    def getProfile(self):
-        """
-        Get SLD profile 
-        
-        : return: None, No SLD profile supporting for this model
-        """
-        return None
-        
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        : param name: name of the parameter
-        : param value: value of the parameter
-        """
-        # set param to new model
-        self._setParamHelper(name, value)
-
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setParam
-        """
-
-        # Look for standard parameter
-        for item in self.params.keys():
-            if item.lower()==name.lower():
-                self.params[item] = value
-                return
-        
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-        Fill the self.fixed list with the model fixed list
-        """
-        pass         
-
-                
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [r, theta])
-        : return: (DAB value)
-        """
-        if x.__class__.__name__ == 'list':
-            # Take absolute value of Q, since this model is really meant to
-            # be defined in 1D for a given length of Q
-            #qx = math.fabs(x[0]*math.cos(x[1]))
-            #qy = math.fabs(x[0]*math.sin(x[1]))
-            return self._unifiedpowerrg(x)
-        elif x.__class__.__name__ == 'tuple':
-            msg = "Tuples are not allowed as input to BaseComponent models"
-            raise ValueError, msg
-        else:
-            return self._unifiedpowerrg(x)
-
-
-        return self._unifiedpowerrg(x)
-
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        : param x: input q-value (float or [float, float] as [qx, qy])
-        : return: DAB value
-        """  
-        if x.__class__.__name__ == 'list':
-            q = sqrt(x[0]**2 + x[1]**2)
-            return self._unifiedpowerrg(x)
-        elif x.__class__.__name__ == 'tuple':
-            msg = "Tuples are not allowed as input to BaseComponent models"
-            raise ValueError, msg
-        else:
-            return self._unifiedpowerrg(x)
-
-    def calculate_ER(self):
-        """
-        """
-        # Not implemented!!!
-        pass
-    
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        : param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        pass
Index: c/sas/models/__init__.py
===================================================================
--- src/sas/models/__init__.py	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,55 +1,0 @@
-"""
-    1D Modeling for SAS
-"""
-#from sas.models import *
-
-import os
-from distutils.filelist import findall
-
-__version__ = "2.1.0"
-
-def get_data_path(media):
-    """
-    """
-    # Check for data path in the package
-    path = os.path.join(os.path.dirname(__file__), media)
-    if os.path.isdir(path):
-        return path
-
-    # Check for data path next to exe/zip file.
-    # If we are inside a py2exe zip file, we need to go up
-    # to get to the directory containing 
-    # the media for this module
-    path = os.path.dirname(__file__)
-    #Look for maximum n_dir up of the current dir to find media
-    n_dir = 12
-    for i in range(n_dir):
-        path, _ = os.path.split(path)
-        media_path = os.path.join(path, media)
-        if os.path.isdir(media_path):
-            module_media_path = os.path.join(media_path, 'models_media')
-            if os.path.isdir(module_media_path):
-                return module_media_path
-            return media_path
-   
-    raise RuntimeError('Could not find models media files')
-
-def data_files():
-    """
-    Return the data files associated with media.
-    
-    The format is a list of (directory, [files...]) pairs which can be
-    used directly in setup(...,data_files=...) for setup.py.
-
-    """
-    data_files = []
-    path = get_data_path(media="media")
-    path_img = get_data_path(media=os.path.join("media","img"))
-    im_list = findall(path_img)
-    for f in findall(path):
-        if os.path.isfile(f) and f not in im_list:
-            data_files.append(('media/models_media', [f]))
-    
-    for f in im_list:
-        data_files.append(('media/models_media/img', [f]))
-    return data_files
Index: c/sas/models/c_extension/c_models/DiamCyl.cpp
===================================================================
--- src/sas/models/c_extension/c_models/DiamCyl.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,114 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "DiamCyl.h"
-
-extern "C" {
-	#include "libStructureFactor.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;
-}
-double DiamCylFunc :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/DiamEllip.cpp
===================================================================
--- src/sas/models/c_extension/c_models/DiamEllip.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,112 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "DiamEllip.h"
-
-extern "C" {
-	#include "libStructureFactor.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;
-}
-double DiamEllipFunc :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/FractalQtoN.cpp
===================================================================
--- src/sas/models/c_extension/c_models/FractalQtoN.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,146 +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
-
-    See Schmidt, J Appl Cryst, 24, (1991), 414-435, Eqn (19)
-    See Hurd, Schaefer & Martin, 35, (1987), 2361-2364
-
-    Ported to C++ from Fortran by Robert Whitley (2012)
-*/
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include "FractalQtoN.h"
-using namespace std;
-
-FractalO_Z::FractalO_Z()
-{
-    scale = Parameter(10000.0, true);
-    m_fractal = Parameter(1.8);
-    cluster_rg = Parameter(3250.0);
-    s_fractal = Parameter(2.5);
-    primary_rg = Parameter(82.0);
-    background = Parameter(0.01);
-}
-
-double FractalO_Z :: operator()(double q)
-{
-    double dp[3];
-    dp[0] = m_fractal();
-    dp[1] = s_fractal();
-    
-    
-    if (dp[0] <= 0)
-    {
-        //std::cout << "\n\nThe mass fractal dimension must be > 0!";
-        //std::cout << "\nWill set to 3.";
-        dp[0] = 3.0;
-    }
-    else 
-    {
-        if (dp[0] > 6)
-        {
-            //std::cout << "\n\nThe mass fractal dimension must be <= 6!";
-            //std::cout << "\nWill be set to 3."; 
-            dp[0] = 3.0;
-        }
-    }
-    
-    if (dp[1] <= 0)
-    {
-        //std::cout << "\n\nThe surface dimension must be > 0!";
-        //std::cout << "\nWill be set to 2.";
-        dp[1] = 2.0;
-    }
-    else
-    {
-        if (dp[1] > 6)
-        {
-            //std::cout << "\n\nThe surface dimension must be <= 6!";
-            //std::cout << "\nWill be set to 2.";
-            dp[1] = 2.0;
-        }
-    }
-    
-    double a(dp[0]/2.0);
-    double b((cluster_rg() * cluster_rg())/(3.0*a) );
-    
-    // If C goes negative, it will crash with undefined exponentiation.
-    // So (Ds + Dm) <= 6
-    // c = ((ds-6.0)/-2.0)-a
-    if ((dp[1] > (6.0-dp[0])) && (primary_rg() > 0.0))
-    {
-        dp[1] = 6.0 - dp[0];
-        //std::cout << "\n\nThe surface fractal dimension must be <= (6-Dm)!\n";
-        //std::cout << setprecision(5) << fixed << dp[1];
-    }
-    
-    // c = (ds -6.0 + dm)/-2.0;
-    double c = (6.0 - dp[1] - dp[0])/2.0;
-    double d(0.0);
-    
-    // If c = 0 then it will crash with a floating divide by zero.
-    if (c == 0)
-    {
-        d = 1.0e+37;
-    }
-    else
-    {
-        d = (primary_rg() * primary_rg()) / (3.0 * c);
-    }
-
-    double eVar = q*q*b;
-    double fVar = q*q*d;
-    double g = pow((1.0+eVar),a);
-    double h = pow((1.0+fVar),c);
-    double i = g*h;
-    double result((scale()/i) + background() );
-    return result;
-}
-
-
-/**
- * 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 FractalO_Z :: 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 FractalO_Z :: 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 FractalO_Z :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double FractalO_Z :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/GelFit.cpp
===================================================================
--- src/sas/models/c_extension/c_models/GelFit.cpp	(revision 1d115ef0ea20114c0109dad8c815846e6281604a)
+++ 	(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
-    
-    SHIBAYAMA-GEISSLER TWO-LENGTH SCALE SCATTERING FUNCTION FOR GELS
-
-    See Sibayama, Tanaka & Han, J Chem Phys, (1992), 97(9), 6829-6841
-    or  Mallam, Horkay, Hecht, Rennie & Geissler, Macromol, (1991), 24, 543
-
-    Ported to C++ from Fortran by Robert Whitley (2012)
-*/
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "GelFit.h"
-
-GelFitModel::GelFitModel()
-{
-    lScale = Parameter(3.5);
-    gScale = Parameter(1.7);
-    zeta = Parameter(16.0);
-    radius = Parameter(104.0,true);
-    radius.set_min(2.0);
-    FractalExp = Parameter(2.0,true);
-    background = Parameter(0.01);
-}
-
-double GelFitModel::operator()(double q) 
-{
-    double dp[3];
-    dp[0] = zeta();
-    dp[1] = radius();
-    dp[2] = FractalExp();
-    
-    if (dp[2] <= 0)
-    {
-        //cout << "\n\nThe Scaling Exponent must be > 0";
-        //cout << "\nWill set to 2.0";
-        dp[2] = 2.0;
-    }
-
-    // Lorentzian Term
-    ////////////////////////double a(x[i]*x[i]*zeta*zeta);
-    double a(q*q*dp[0]*dp[0]);
-    double b(1.0 + (((dp[2] + 1.0)/3.0)*a) );
-    double c(pow(b, (dp[2]/2.0) ) );
-    
-    // Exponential Term
-    ////////////////////////double d(x[i]*x[i]*rg*rg);
-    double d(q*q*dp[1]*dp[1]);
-    double e(-1.0*(d/3.0) );
-    double f(exp(e));
-        
-        // Scattering Law
-    double result((lScale()/c) + (gScale()*f) + background());
-    return result;
-}
-
-
-/**
- * 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 GelFitModel::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 GelFitModel::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 GelFitModel::calculate_ER() 
-{
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double GelFitModel::calculate_VR() 
-{
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/Hardsphere.cpp
===================================================================
--- src/sas/models/c_extension/c_models/Hardsphere.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,105 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "Hardsphere.h"
-
-extern "C" {
-#include "libStructureFactor.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;
-}
-double HardsphereStructure :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/HayterMSA.cpp
===================================================================
--- src/sas/models/c_extension/c_models/HayterMSA.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,115 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "HayterMSA.h"
-
-extern "C" {
-#include "libStructureFactor.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;
-}
-double HayterMSAStructure :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/RectangularHollowPrism.cpp
===================================================================
--- src/sas/models/c_extension/c_models/RectangularHollowPrism.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,199 +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: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <iostream>
-using namespace std;
-
-extern "C" {
-    #include "libCylinder.h"
-    #include "libStructureFactor.h"
-    #include "libmultifunc/libfunc.h"
-}
-#include "RectangularHollowPrism.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double short_side;
-    double b2a_ratio;
-    double c2a_ratio;
-    double thickness;
-    double sldPipe;
-    double sldSolv;
-    double background;
-} RectangularHollowPrismParameters;
-
-
-RectangularHollowPrismModel :: RectangularHollowPrismModel() {
-    scale      = Parameter(1.0);
-    short_side = Parameter(35.0, true);
-    short_side.set_min(1.0);
-    b2a_ratio   = Parameter(1.0, true);
-    b2a_ratio.set_min(1.0);
-    c2a_ratio   = Parameter(1.0, true);
-    c2a_ratio.set_min(1.0);
-    thickness = Parameter(1.0, true);
-    thickness.set_min(0.0);
-    sldPipe   = Parameter(6.3e-6);
-    sldSolv   = Parameter(1.0e-6);
-    background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double RectangularHollowPrismModel :: operator()(double q) {
-
-    double dp[8];
-
-    // Fill parameter array for IGOR library
-    // Add the background after averaging
-    dp[0] = scale();
-    dp[1] = short_side();
-    dp[2] = b2a_ratio();
-    dp[3] = c2a_ratio();
-    dp[4] = thickness();
-    dp[5] = sldPipe();
-    dp[6] = sldSolv();
-    dp[7] = 0.0;
-
-    // Get the dispersion points for a
-    vector<WeightPoint> weights_short_side;
-    short_side.get_weights(weights_short_side);
-
-    // Get the dispersion points for b/a ratio
-    vector<WeightPoint> weights_b2a_ratio;
-    b2a_ratio.get_weights(weights_b2a_ratio);
-
-    // Get the dispersion points for c/a ratio
-    vector<WeightPoint> weights_c2a_ratio;
-    c2a_ratio.get_weights(weights_c2a_ratio);
-
-    // 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 short_side weight points
-    for (int i=0; i < (int)weights_short_side.size(); i++) {
-
-        dp[1] = weights_short_side[i].value;
-
-        // Loop over b/a ratios
-        for (int j=0; j < (int)weights_b2a_ratio.size(); j++) {
-
-            dp[2] = weights_b2a_ratio[j].value;
-
-            // Loop over c/a ratios
-            for (int k=0; k < (int)weights_c2a_ratio.size(); k++) {
-
-                dp[3] = weights_c2a_ratio[k].value;
-
-                // Loop over thicknesses
-                for (int l=0; l < (int)weights_thickness.size(); l++) {
-
-                    dp[4] = weights_thickness[l].value;
-
-        	        // Un-normalize  by volume = abc - (a-2*t)*(b-2*t)*(c-2*t)
-
-		            double a = dp[1];
-		            double b = dp[1] * dp[2];
-		            double c = dp[1] * dp[3];
-		            double t = dp[4];
-		            double vol_i = a*b*c - (a-2*t)*(b-2*t)*(c-2*t);
-
-        	        sum += weights_short_side[i].weight *
-        	               weights_b2a_ratio[j].weight *
-        	               weights_c2a_ratio[k].weight *
-			               weights_thickness[l].weight *
-        	               RectangularHollowPrism(dp, q) *
-        	               vol_i;
-
-        	        //Find average volume (ABC)
-
-        	        vol += weights_short_side[i].weight *
-        	               weights_b2a_ratio[j].weight *
-        	               weights_c2a_ratio[k].weight *
-			               weights_thickness[l].weight *
-        	               vol_i;
-
-        	        norm += weights_short_side[i].weight *
-                	        weights_b2a_ratio[j].weight *
-                	        weights_c2a_ratio[k].weight *
-			                weights_thickness[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 RectangularHollowPrismModel :: operator()(double qx, double qy) {
-    return 1.0;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RectangularHollowPrismModel :: 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 RectangularHollowPrismModel :: calculate_ER() {
-    return 1.0;
-
-}
-double RectangularHollowPrismModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/RectangularHollowPrismInfThinWalls.cpp
===================================================================
--- src/sas/models/c_extension/c_models/RectangularHollowPrismInfThinWalls.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,181 +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: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <iostream>
-using namespace std;
-
-extern "C" {
-    #include "libCylinder.h"
-    #include "libStructureFactor.h"
-    #include "libmultifunc/libfunc.h"
-}
-#include "RectangularHollowPrismInfThinWalls.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double short_side;
-    double b2a_ratio;
-    double c2a_ratio;
-    double sldPipe;
-    double sldSolv;
-    double background;
-} RectangularHollowPrismInfThinWallsParameters;
-
-
-RectangularHollowPrismInfThinWallsModel :: RectangularHollowPrismInfThinWallsModel() {
-    scale      = Parameter(1.0);
-    short_side = Parameter(35.0, true);
-    short_side.set_min(1.0);
-    b2a_ratio   = Parameter(1.0, true);
-    b2a_ratio.set_min(1.0);
-    c2a_ratio   = Parameter(1.0, true);
-    c2a_ratio.set_min(1.0);
-    sldPipe   = Parameter(6.3e-6);
-    sldSolv   = Parameter(1.0e-6);
-    background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double RectangularHollowPrismInfThinWallsModel :: operator()(double q) {
-
-    double dp[7];
-
-    // Fill parameter array for IGOR library
-    // Add the background after averaging
-    dp[0] = scale();
-    dp[1] = short_side();
-    dp[2] = b2a_ratio();
-    dp[3] = c2a_ratio();
-    dp[4] = sldPipe();
-    dp[5] = sldSolv();
-    dp[6] = 0.0;
-
-    // Get the dispersion points for a
-    vector<WeightPoint> weights_short_side;
-    short_side.get_weights(weights_short_side);
-
-    // Get the dispersion points for b/a ratio
-    vector<WeightPoint> weights_b2a_ratio;
-    b2a_ratio.get_weights(weights_b2a_ratio);
-
-    // Get the dispersion points for c/a ratio
-    vector<WeightPoint> weights_c2a_ratio;
-    c2a_ratio.get_weights(weights_c2a_ratio);
-
-    // Perform the computation, with all weight points
-    double sum = 0.0;
-    double norm = 0.0;
-    double vol = 0.0;
-
-    // Loop over short_side weight points
-    for (int i=0; i < (int)weights_short_side.size(); i++) {
-
-        dp[1] = weights_short_side[i].value;
-
-        // Loop over b/a ratios
-        for (int j=0; j < (int)weights_b2a_ratio.size(); j++) {
-
-            dp[2] = weights_b2a_ratio[j].value;
-
-            // Loop over c/a ratios
-            for (int k=0; k < (int)weights_c2a_ratio.size(); k++) {
-
-                dp[3] = weights_c2a_ratio[k].value;
-
-        	    // Un-normalize  by volume = 2*a*b + 2*a*c + 2*b*c
-
-	            double a = dp[1];
-	            double b = dp[1] * dp[2];
-	            double c = dp[1] * dp[3];
-                double vol_i = (2.0*a*b) + (2.0*a*c) + (2.0*b*c);
-
-        	    sum += weights_short_side[i].weight *
-        	           weights_b2a_ratio[j].weight *
-        	           weights_c2a_ratio[k].weight *
-        	           RectangularHollowPrismInfThinWalls(dp, q) *
-                       vol_i;
-
-        	    //Find average volume (ABC)
-
-        	    vol += weights_short_side[i].weight *
-        	           weights_b2a_ratio[j].weight *
-        	           weights_c2a_ratio[k].weight *
-                       vol_i;
-
-        	    norm += weights_short_side[i].weight *
-                	    weights_b2a_ratio[j].weight *
-                	    weights_c2a_ratio[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 RectangularHollowPrismInfThinWallsModel :: operator()(double qx, double qy) {
-    return 1.0;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RectangularHollowPrismInfThinWallsModel :: 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 RectangularHollowPrismInfThinWallsModel :: calculate_ER() {
-    return 1.0;
-
-}
-double RectangularHollowPrismInfThinWallsModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/RectangularPrism.cpp
===================================================================
--- src/sas/models/c_extension/c_models/RectangularPrism.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,177 +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: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <iostream>
-using namespace std;
-
-extern "C" {
-    #include "libCylinder.h"
-    #include "libStructureFactor.h"
-    #include "libmultifunc/libfunc.h"
-}
-#include "RectangularPrism.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double short_side;
-    double b2a_ratio;
-    double c2a_ratio;
-    double sldPipe;
-    double sldSolv;
-    double background;
-} RectangularPrismParameters;
-
-
-RectangularPrismModel :: RectangularPrismModel() {
-    scale      = Parameter(1.0);
-    short_side = Parameter(35.0, true);
-    short_side.set_min(1.0);
-    b2a_ratio   = Parameter(1.0, true);
-    b2a_ratio.set_min(1.0);
-    c2a_ratio   = Parameter(1.0, true);
-    c2a_ratio.set_min(1.0);
-    sldPipe   = Parameter(6.3e-6);
-    sldSolv   = Parameter(1.0e-6);
-    background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double RectangularPrismModel :: operator()(double q) {
-
-    double dp[7];
-
-    // Fill parameter array for IGOR library
-    // Add the background after averaging
-    dp[0] = scale();
-    dp[1] = short_side();
-    dp[2] = b2a_ratio();
-    dp[3] = c2a_ratio();
-    dp[4] = sldPipe();
-    dp[5] = sldSolv();
-    dp[6] = 0.0;
-
-    // Get the dispersion points for a
-    vector<WeightPoint> weights_short_side;
-    short_side.get_weights(weights_short_side);
-
-    // Get the dispersion points for b/a ratio
-    vector<WeightPoint> weights_b2a_ratio;
-    b2a_ratio.get_weights(weights_b2a_ratio);
-
-    // Get the dispersion points for c/a ratio
-    vector<WeightPoint> weights_c2a_ratio;
-    c2a_ratio.get_weights(weights_c2a_ratio);
-
-    // Perform the computation, with all weight points
-    double sum = 0.0;
-    double norm = 0.0;
-    double vol = 0.0;
-
-    // Loop over short_side weight points
-    for (int i=0; i < (int)weights_short_side.size(); i++) {
-
-        dp[1] = weights_short_side[i].value;
-
-        // Loop over b/a ratios
-        for (int j=0; j < (int)weights_b2a_ratio.size(); j++) {
-
-            dp[2] = weights_b2a_ratio[j].value;
-
-            // Loop over c/a ratios
-            for (int k=0; k < (int)weights_c2a_ratio.size(); k++) {
-
-                dp[3] = weights_c2a_ratio[k].value;
-
-        	    // Un-normalize  by volume = a * (a * b/a) * (a * c/a)
-                double vol_i = dp[1] * dp[1] * dp[2] * dp[1] * dp[3];
-
-        	    sum += weights_short_side[i].weight *
-        	           weights_b2a_ratio[j].weight *
-        	           weights_c2a_ratio[k].weight *
-        	           RectangularPrism(dp, q) *
-        	           vol_i;
-
-        	    //Find average volume (ABC)
-
-        	    vol += weights_short_side[i].weight *
-        	           weights_b2a_ratio[j].weight *
-        	           weights_c2a_ratio[k].weight *
-        	           vol_i;
-
-        	    norm += weights_short_side[i].weight *
-                	    weights_b2a_ratio[j].weight *
-                	    weights_c2a_ratio[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 RectangularPrismModel :: operator()(double qx, double qy) {
-    return 1.0;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RectangularPrismModel :: 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 RectangularPrismModel :: calculate_ER() {
-    return 1.0;
-
-}
-double RectangularPrismModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/SquareWell.cpp
===================================================================
--- src/sas/models/c_extension/c_models/SquareWell.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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
- *
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "SquareWell.h"
-
-extern "C" {
-#include "libStructureFactor.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;
-}
-double SquareWellStructure :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/StickyHS.cpp
===================================================================
--- src/sas/models/c_extension/c_models/StickyHS.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,112 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "StickyHS.h"
-
-extern "C" {
-	#include "libStructureFactor.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;
-}
-double StickyHSStructure :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/TwoYukawa.cpp
===================================================================
--- src/sas/models/c_extension/c_models/TwoYukawa.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,133 +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 "parameters.hh"
-#include <stdio.h>
-//#include <iostream>
-using namespace std;
-#include "TwoYukawa.h"
-
-extern "C" {
-#include "2Y_TwoYukawa.h"
-}
-
-TwoYukawaModel :: TwoYukawaModel() {
-	// Model parameters
-	volfraction = Parameter(0.2, true);
-	effect_radius = Parameter(50.0, true);
-	effect_radius.set_min(0.0);
-	scale_K1 = Parameter(6.0);
-	decayConst_Z1 = Parameter(10.0);
-	scale_K2 = Parameter(-1.0);
-	decayConst_Z2 = Parameter(2.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 TwoYukawaModel :: operator()(double q) 
-{
-  double dp[6];
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = volfraction();
-  dp[1] = effect_radius();
-  dp[2] = scale_K1();
-  dp[3] = decayConst_Z1();
-  dp[4] = scale_K2();
-  dp[5] = decayConst_Z2();
-  
-  double ZERO = 1.0e-24;
-  if (fabs(dp[2]) < 0.001){
-  	return ZERO;
-  	}
-  if (fabs(dp[3]) < 0.001){
-  	return ZERO;
-  	}
-  if (fabs(dp[4]) < 0.001){
-  	return ZERO;
-  	}
-  if (fabs(dp[5]) < 0.001){
-  	return ZERO;
-  	}
-  	
-  double a, b, c1, c2, d1, d2;
-  int check = 1;
-  double x_in = q * dp[1] *2.0;
-  int ok = 0;
-  
-  ok = TY_SolveEquations(dp[3], dp[5], dp[2], dp[4], dp[0], &a, &b, &c1, &c2, &d1, &d2, 0);
-  if (ok > 0 ){
-	//check = TY_CheckSolution(dp[3], dp[5], dp[2], dp[4], dp[0], &a, &b, &c1, &c2, &d1, &d2);
-    if (check > 0){
-    	return SqTwoYukawa(x_in, dp[3], dp[5], dp[2], dp[4], dp[0], a, b, c1, c2, d1, d2);
-    }
-    else{
-    	return ZERO;
-    }
-  }
-  else{
-     return ZERO;
-  }
-}
-
-/**
- * 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 TwoYukawaModel :: 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 TwoYukawaModel :: 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 TwoYukawaModel :: calculate_ER()
-{
-  return effect_radius();
-}
-double TwoYukawaModel :: calculate_VR()
-{
-  return 1.0;
-}
-
Index: c/sas/models/c_extension/c_models/barbell.cpp
===================================================================
--- src/sas/models/c_extension/c_models/barbell.cpp	(revision db46d13d6ad925ea6da0c9aa178a62e3dc325cdb)
+++ 	(revision )
@@ -1,413 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-  #include "GaussWeights.h"
-	#include "barbell.h"
-}
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double rad_bar;
-    double len_bar;
-    double rad_bell;
-    double sld_barbell;
-    double sld_solv;
-    double background;
-    double theta;
-    double phi;
-} BarBellParameters;
-
-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);
-}
-
-double barbell2d_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
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static 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 = cos(theta) * cos(phi);
-    cyl_y = sin(theta);
-    //cyl_z = -cos(theta) * sin(phi);
-
-    // 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 );
-
-  answer = barbell2d_kernel(dp, q, alpha);
-
-
-  return answer;
-
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-/**
- * 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;
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	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/3.0*((dp.rad_bell-hDist)*(dp.rad_bell-hDist)*
-										(2*dp.rad_bell+hDist));
-						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);
-											//* output;
-											//* 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(cos(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;
-}
-/**
- * Function to calculate volf_ratio for shell/tot
- * @return: volf_ratio value
- */
-double BarBellModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/bcc.cpp
===================================================================
--- src/sas/models/c_extension/c_models/bcc.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,342 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "bcc.h"
-
-extern "C" {
-	#include "libSphere.h"
-}
-
-// Convenience structure
-typedef struct {
-  double scale;
-  double dnn;
-  double d_factor;
-  double radius;
-  double sldSph;
-  double sldSolv;
-  double background;
-  double theta;
-  double phi;
-  double psi;
-
-} BCParameters;
-
-/**
- * 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
- */
-static double bc_analytical_2D_scaled(BCParameters *pars, double q, double q_x, double q_y) {
-  double b3_x, b3_y, b1_x, b1_y, b2_x, b2_y; //b3_z,
-  double q_z;
-  double 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 = cos(theta) * cos(phi);
-    b3_y = sin(theta);
-    //b3_z = -cos(theta) * sin(phi);
-    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 = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-    b1_y = sin(psi)*cos(theta);
-    cos_val_b1 = b1_x*q_x + b1_y*q_y;
-    // b2 axis orientation
-    b2_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  	b2_y = cos(theta)*cos(psi);
-    cos_val_b2 = b2_x*q_x + b2_y*q_y;
-    
-    // The following test should always pass
-    if (fabs(cos_val_b3)>1.0) {
-      //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-      cos_val_b3 = 1.0;
-    }
-    if (fabs(cos_val_b2)>1.0) {
-      //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-      cos_val_b2 = 1.0;
-    }
-    if (fabs(cos_val_b1)>1.0) {
-      //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-      cos_val_b1 = 1.0;
-    }
-    // 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);
-
-
-    // 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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BCC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-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(cos(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;
-}
-double BCCrystalModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/binaryHS.cpp
===================================================================
--- src/sas/models/c_extension/c_models/binaryHS.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,127 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "binaryHS.h"
-
-extern "C" {
-#include "libSphere.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;
-}
-double BinaryHSModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/binaryHS_PSF11.cpp
===================================================================
--- src/sas/models/c_extension/c_models/binaryHS_PSF11.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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
- *
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libSphere.h"
-}
-
-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 calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-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;
-}
-double BinaryHSPSF11Model :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/c_models.cpp.template
===================================================================
--- src/sas/models/c_extension/c_models/c_models.cpp.template	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,198 +1,0 @@
-/** c_models
- *
- * Module containing all SAS model extensions
- *
- * @author   M.Doucet / UTK
- */
-#include <Python.h>
-#include <parameters.hh>
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sas
-#include "arrayobject.h"
-
-// [TAG_1]
-
-
-
-extern "C" {
-  void addDisperser(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 SAS scattering models.");
-  import_array();
-
-  // [TAG_2]
-
-}
Index: c/sas/models/c_extension/c_models/capcyl.cpp
===================================================================
--- src/sas/models/c_extension/c_models/capcyl.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,406 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-  #include "GaussWeights.h"
-	#include "libCylinder.h"
-}
-#include "capcyl.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double rad_cyl;
-    double len_cyl;
-    double rad_cap;
-    double sld_capcyl;
-    double sld_solv;
-    double background;
-    double theta;
-    double phi;
-} CapCylParameters;
-
-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);
-}
-
-static 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
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static 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 = cos(theta) * cos(phi);
-    cyl_y = sin(theta);
-    //cyl_z = -cos(theta) * sin(phi);
-
-    // 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 );
-
-  answer = capcyl2d_kernel(dp, q, alpha);
-
-
-  return answer;
-
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-/**
- * 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 = 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 = 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(cos(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;
-}
-double CappedCylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/corefourshell.cpp
===================================================================
--- src/sas/models/c_extension/c_models/corefourshell.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,552 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "corefourshell.h"
-
-extern "C" {
-	#include "libSphere.h"
-	#include "libmultifunc/libfunc.h"
-}
-
-typedef struct {
-  double scale;
-  double rad_core0;
-  double sld_core0;
-  double thick_shell1;
-  double sld_shell1;
-  double thick_shell2;
-  double sld_shell2;
-  double thick_shell3;
-  double sld_shell3;
-  double thick_shell4;
-  double sld_shell4;
-  double sld_solv;
-  double background;
-  double M0_sld_shell1;
-  double M_theta_shell1;
-  double M_phi_shell1;
-  double M0_sld_shell2;
-  double M_theta_shell2;
-  double M_phi_shell2;
-  double M0_sld_shell3;
-  double M_theta_shell3;
-  double M_phi_shell3;
-  double M0_sld_shell4;
-  double M_theta_shell4;
-  double M_phi_shell4;
-  double M0_sld_core0;
-  double M_theta_core0;
-  double M_phi_core0;
-  double M0_sld_solv;
-  double M_theta_solv;
-  double M_phi_solv;
-  double Up_frac_i;
-  double Up_frac_f;
-  double Up_theta;
-} CoreFourShellParameters;
-
-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);
-	M0_sld_shell1 = Parameter(0.0e-6);
-	M_theta_shell1 = Parameter(0.0);
-	M_phi_shell1 = Parameter(0.0);
-	M0_sld_shell2 = Parameter(0.0e-6);
-	M_theta_shell2 = Parameter(0.0);
-	M_phi_shell2 = Parameter(0.0);
-	M0_sld_shell3 = Parameter(0.0e-6);
-	M_theta_shell3 = Parameter(0.0);
-	M_phi_shell3 = Parameter(0.0);
-	M0_sld_shell4 = Parameter(0.0e-6);
-	M_theta_shell4 = Parameter(0.0);
-	M_phi_shell4 = Parameter(0.0);
-	M0_sld_core0 = Parameter(0.0e-6);
-	M_theta_core0 = Parameter(0.0);
-	M_phi_core0 = Parameter(0.0);
-	M0_sld_solv = Parameter(0.0e-6);
-	M_theta_solv = Parameter(0.0);
-	M_phi_solv = Parameter(0.0);
-	Up_frac_i = Parameter(0.5);
-	Up_frac_f = Parameter(0.5);
-	Up_theta = 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 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
- */
-
-static double corefourshell_analytical_2D_scaled(CoreFourShellParameters *pars, double q, double q_x, double q_y) {
-	double dp[13];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-
-	dp[0] = pars->scale;
-	dp[1] = pars->rad_core0;
-	dp[2] = 0.0; //sld_core0;
-	dp[3] = pars->thick_shell1;
-	dp[4] = 0.0; //sld_shell1;
-	dp[5] = pars->thick_shell2;
-	dp[6] = 0.0; //sld_shell2;
-	dp[7] = pars->thick_shell3;
-	dp[8] = 0.0; //sld_shell3;
-	dp[9] = pars->thick_shell4;
-	dp[10] = 0.0; //sld_shell4;
-	dp[11] = 0.0; //sld_solv;
-	dp[12] = 0.0;
-
-    double sld_core0 = pars->sld_core0;
-    double sld_shell1 = pars->sld_shell1;
-	double sld_shell2 = pars->sld_shell2;
-	double sld_shell3 = pars->sld_shell3;
-	double sld_shell4 = pars->sld_shell4;
-	double sld_solv = pars->sld_solv;
-	double answer = 0.0;
-	double m_max0 = pars->M0_sld_core0;
-	double m_max_shell1 = pars->M0_sld_shell1;
-	double m_max_shell2 = pars->M0_sld_shell2;
-	double m_max_shell3 = pars->M0_sld_shell3;
-	double m_max_shell4 = pars->M0_sld_shell4;
-	double m_max_solv = pars->M0_sld_solv;
-
-	if (m_max0 < 1.0e-32 && m_max_solv < 1.0e-32 && m_max_shell1 < 1.0e-32 && m_max_shell2 <
-						1.0e-32 && m_max_shell3 < 1.0e-32 && m_max_shell4 < 1.0e-32){
-		dp[2] = sld_core0;
-		dp[4] = sld_shell1;
-		dp[6] = sld_shell2;
-		dp[8] = sld_shell3;
-		dp[10] = sld_shell4;
-		dp[11] = sld_solv;
-		answer = FourShell(dp, q);
-	}
-	else{
-		double qx = q_x;
-		double qy = q_y;
-		double s_theta = pars->Up_theta;
-		double m_phi0 = pars->M_phi_core0;
-		double m_theta0 = pars->M_theta_core0;
-		double m_phi_shell1 = pars->M_phi_shell1;
-		double m_theta_shell1 = pars->M_theta_shell1;
-		double m_phi_shell2 = pars->M_phi_shell2;
-		double m_theta_shell2 = pars->M_theta_shell2;
-		double m_phi_shell3 = pars->M_phi_shell3;
-		double m_theta_shell3 = pars->M_theta_shell3;
-		double m_phi_shell4 = pars->M_phi_shell4;
-		double m_theta_shell4 = pars->M_theta_shell4;
-		double m_phi_solv = pars->M_phi_solv;
-		double m_theta_solv = pars->M_theta_solv;
-		double in_spin = pars->Up_frac_i;
-		double out_spin = pars->Up_frac_f;
-		polar_sld p_sld_core0;
-		polar_sld p_sld_shell1;
-		polar_sld p_sld_shell2;
-		polar_sld p_sld_shell3;
-		polar_sld p_sld_shell4;
-		polar_sld p_sld_solv;
-		//Find (b+m) slds
-		p_sld_core0 = cal_msld(1, qx, qy, sld_core0, m_max0, m_theta0, m_phi0,
-								in_spin, out_spin, s_theta);
-		p_sld_shell1 = cal_msld(1, qx, qy, sld_shell1, m_max_shell1, m_theta_shell1, m_phi_shell1,
-								in_spin, out_spin, s_theta);
-		p_sld_shell2 = cal_msld(1, qx, qy, sld_shell2, m_max_shell2, m_theta_shell2, m_phi_shell2,
-								in_spin, out_spin, s_theta);
-		p_sld_shell3 = cal_msld(1, qx, qy, sld_shell3, m_max_shell3, m_theta_shell3, m_phi_shell3,
-								in_spin, out_spin, s_theta);
-		p_sld_shell4 = cal_msld(1, qx, qy, sld_shell4, m_max_shell4, m_theta_shell4, m_phi_shell4,
-								in_spin, out_spin, s_theta);
-		p_sld_solv = cal_msld(1, qx, qy, sld_solv, m_max_solv, m_theta_solv, m_phi_solv,
-						 		in_spin, out_spin, s_theta);
-		//up_up
-		if (in_spin > 0.0 && out_spin > 0.0){
-			dp[2] = p_sld_core0.uu;
-			dp[4] = p_sld_shell1.uu;
-			dp[6] = p_sld_shell2.uu;
-			dp[8] = p_sld_shell3.uu;
-			dp[10] = p_sld_shell4.uu;
-			dp[11] = p_sld_solv.uu;
-			answer += FourShell(dp, q);
-			}
-		//down_down
-		if (in_spin < 1.0 && out_spin < 1.0){
-			dp[2] = p_sld_core0.dd;
-			dp[4] = p_sld_shell1.dd;
-			dp[6] = p_sld_shell2.dd;
-			dp[8] = p_sld_shell3.dd;
-			dp[10] = p_sld_shell4.dd;
-			dp[11] = p_sld_solv.dd;
-			answer += FourShell(dp, q);
-			}
-		//up_down
-		if (in_spin > 0.0 && out_spin < 1.0){
-			dp[2] = p_sld_core0.re_ud;
-			dp[4] = p_sld_shell1.re_ud;
-			dp[6] = p_sld_shell2.re_ud;
-			dp[8] = p_sld_shell3.re_ud;
-			dp[10] = p_sld_shell4.re_ud;
-			dp[11] = p_sld_solv.re_ud;
-			answer += FourShell(dp, q);
-			dp[2] = p_sld_core0.im_ud;
-			dp[4] = p_sld_shell1.im_ud;
-			dp[6] = p_sld_shell2.im_ud;
-			dp[8] = p_sld_shell3.im_ud;
-			dp[10] = p_sld_shell4.im_ud;
-			dp[11] = p_sld_solv.im_ud;
-			answer += FourShell(dp, q);
-			}
-		//down_up
-		if (in_spin < 1.0 && out_spin > 0.0){
-			dp[2] = p_sld_core0.re_du;
-			dp[4] = p_sld_shell1.re_du;
-			dp[6] = p_sld_shell2.re_du;
-			dp[8] = p_sld_shell3.re_du;
-			dp[10] = p_sld_shell4.re_du;
-			dp[11] = p_sld_solv.re_du;
-			answer += FourShell(dp, q);
-			dp[2] = p_sld_core0.im_du;
-			dp[4] = p_sld_shell1.im_du;
-			dp[6] = p_sld_shell2.im_du;
-			dp[8] = p_sld_shell3.im_du;
-			dp[10] = p_sld_shell4.im_du;
-			dp[11] = p_sld_solv.im_du;
-			answer += FourShell(dp, q);
-			}
-	}
-	// Already normalized
-	// add in the background
-	answer += pars->background;
-	return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @return: function value
- */
-static double corefourshell_analytical_2DXY(CoreFourShellParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return corefourshell_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-double CoreFourShellModel :: operator()(double qx, double qy) {
-	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;
-	dp.M0_sld_shell1 = M0_sld_shell1();
-	dp.M_theta_shell1 = M_theta_shell1();
-	dp.M_phi_shell1 = M_phi_shell1();
-	dp.M0_sld_shell2 = M0_sld_shell2();
-	dp.M_theta_shell2 = M_theta_shell2();
-	dp.M_phi_shell2 = M_phi_shell2();
-	dp.M0_sld_shell3 = M0_sld_shell3();
-	dp.M_theta_shell3 = M_theta_shell3();
-	dp.M_phi_shell3 = M_phi_shell3();
-	dp.M0_sld_shell4 = M0_sld_shell4();
-	dp.M_theta_shell4 = M_theta_shell4();
-	dp.M_phi_shell4 = M_phi_shell4();
-	dp.M0_sld_core0 = M0_sld_core0();
-	dp.M_theta_core0 = M_theta_core0();
-	dp.M_phi_core0 = M_phi_core0();
-	dp.M0_sld_solv = M0_sld_solv();
-	dp.M_theta_solv = M_theta_solv();
-	dp.M_phi_solv = M_phi_solv();
-	dp.Up_frac_i = Up_frac_i();
-	dp.Up_frac_f = Up_frac_f();
-	dp.Up_theta = Up_theta();
-    
-	// 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.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
-							* corefourshell_analytical_2DXY(&dp, qx, qy) * 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 pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreFourShellModel :: 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 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;
-}
-double CoreFourShellModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/coresecondmoment.cpp
===================================================================
--- src/sas/models/c_extension/c_models/coresecondmoment.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/**
- * Scattering model classes
- *
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "coresecondmoment.h"
-
-static double core_secondmoment_kernel(double dp[], double q) {
-  //fit parameters
-  double scale = dp[0];
-  double density_poly = dp[1];
-  double sld_poly = dp[2];
-  double radius_core = dp[3];
-  double volf_cores = dp[4];
-  double ads_amount = dp[5];
-  double second_moment = dp[6];
-  double sld_solv = dp[7];
-  double background = dp[8];
-  // Not valid for very small r
-  if (radius_core < 0.001){
-	  return 0.0;
-  }
-  //others
-  double form_factor = 0.0;
-  double x_val = 0.0;
-  //Pi
-  double pi = 4.0 * atan(1.0);
-  //relative sld
-  double contrast = sld_poly - sld_solv;
-  //x for exp
-  x_val = q*second_moment;
-  x_val *= x_val;
-  //computation
-  form_factor = contrast * ads_amount;
-  form_factor /= (q * density_poly);
-  form_factor *= form_factor;
-  form_factor *= (6.0 * pi * volf_cores * 1.0e+10);
-  form_factor /= radius_core;
-  form_factor *= exp(-x_val);
-
-  // scale and background
-  form_factor *= scale;
-  form_factor += background;
-  return (form_factor);
-}
-
-Core2ndMomentModel :: Core2ndMomentModel() {
-	scale = Parameter(1.0);
-	density_poly = Parameter(0.7);
-	sld_poly = Parameter(1.5e-6);
-	radius_core = Parameter(500.0, true);
-	radius_core.set_min(0.0);
-	volf_cores = Parameter(0.14);
-	ads_amount = Parameter(1.9);
-	second_moment = Parameter(23.0);
-	sld_solv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double Core2ndMomentModel :: operator()(double q) {
-	double dp[9];
-
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = density_poly();
-	dp[2] = sld_poly();
-	dp[3] = radius_core();
-	dp[4] = volf_cores();
-	dp[5] = ads_amount();
-	dp[6] = second_moment();
-	dp[7] = sld_solv();
-	dp[8] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius_core.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[3] = weights_rad[i].value;
-		//weighted sum
-		sum += weights_rad[i].weight
-			* core_secondmoment_kernel(dp, q);
-		norm += weights_rad[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 Core2ndMomentModel :: 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 Core2ndMomentModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double Core2ndMomentModel :: calculate_ER() {
-	return 0.0;
-}
-double Core2ndMomentModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/coreshellbicelle.cpp
===================================================================
--- src/sas/models/c_extension/c_models/coreshellbicelle.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,433 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "core_shell_bicelle.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double rim_thick;
-  double face_thick;
-  double length;
-  double core_sld;
-  double rim_sld;
-  double face_sld;
-  double solvent_sld;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} CoreShellBicelleParameters;
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell Bicelle
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double core_shell_bicelle_analytical_2D_scaled(CoreShellBicelleParameters *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 = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // 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_bicelle_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 = BicelleKernel(q, pars->radius, pars->rim_thick, pars->face_thick,
-      pars->core_sld,pars->face_sld,pars->rim_sld,
-      pars->solvent_sld, pars->length/2.0, alpha) / fabs(sin(alpha));
-
-  //normalize by cylinder volume
-  vol=pi*(pars->radius+pars->rim_thick)
-          *(pars->radius+pars->rim_thick)
-          *(pars->length+2.0*pars->face_thick);
-  answer /= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @return: function value
- */
-static double core_shell_bicelle_analytical_2DXY(CoreShellBicelleParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return core_shell_bicelle_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-CoreShellBicelleModel :: CoreShellBicelleModel() {
-  scale      = Parameter(1.0);
-  radius     = Parameter(20.0, true);
-  radius.set_min(0.0);
-  face_thick  = Parameter(10.0, true);
-  face_thick.set_min(0.0);
-  rim_thick  = Parameter(10.0, true);
-  rim_thick.set_min(0.0);
-  length     = Parameter(400.0, true);
-  length.set_min(0.0);
-  core_sld   = Parameter(1.e-6);
-  face_sld  = Parameter(4.e-6);
-  rim_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 CoreShellBicelleModel :: operator()(double q) {
-  double dp[10];
-
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = rim_thick();
-  dp[3] = face_thick();
-  dp[4] = length();
-  dp[5] = core_sld();
-  dp[6] = face_sld();
-  dp[7] = rim_sld();
-  dp[8] = solvent_sld();
-  dp[9] = 0.0;
-  double pi = 4.0*atan(1.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_rthick;
-  rim_thick.get_weights(weights_rthick);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_fthick;
-  face_thick.get_weights(weights_fthick);
-
-  // 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[4] = weights_len[j].value;
-
-      // Loop over thickness weight points
-      for(size_t k=0; k<weights_rthick.size(); k++) {
-        dp[2] = weights_rthick[k].value;
-        for(size_t l=0; l<weights_fthick.size(); l++) {
-            dp[3] = weights_fthick[l].value;
-			//Un-normalize by volume
-			sum += weights_rad[i].weight
-				* weights_len[j].weight
-				* weights_rthick[k].weight
-				* weights_fthick[l].weight
-				* BicelleIntegration(q, dp[1],dp[2], dp[3],
-						dp[5],dp[6],dp[7],dp[8], dp[4]);
-			//* pow(weights_rad[i].value+weights_rthick[k].value,2)
-			//*(weights_len[j].value+2.0*weights_fthick[k].value);
-			//Find average volume
-			vol += weights_rad[i].weight
-				* weights_len[j].weight
-				* weights_rthick[k].weight
-				* weights_fthick[l].weight
-				* pi * pow(weights_rad[i].value+weights_rthick[k].value,2)
-			*(weights_len[j].value+2.0*weights_fthick[l].value);
-			norm += weights_rad[i].weight
-				* weights_len[j].weight
-				* weights_rthick[k].weight
-				* weights_fthick[l].weight;
-        }
-      }
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  //convert to [cm-1]
-  sum *= 1.0e8;
-  sum *= dp[0];
-  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 CoreShellBicelleModel :: operator()(double qx, double qy) {
-  CoreShellBicelleParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.radius     = radius();
-  dp.rim_thick  = rim_thick();
-  dp.face_thick  = face_thick();
-  dp.length     = length();
-  dp.core_sld   = core_sld();
-  dp.rim_sld  = rim_sld();
-  dp.face_sld  = face_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_rthick;
-  rim_thick.get_weights(weights_rthick);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_fthick;
-  face_thick.get_weights(weights_fthick);
-
-  // 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_rthick.size(); m++) {
-        dp.rim_thick = weights_rthick[m].value;
-
-        // Loop over thickness weight points
-        for(size_t n=0; n<weights_fthick.size(); n++) {
-          dp.face_thick = weights_fthick[n].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_rthick[m].weight
-					* weights_fthick[n].weight
-					* weights_theta[k].weight
-					* weights_phi[l].weight
-					* core_shell_bicelle_analytical_2DXY(&dp, qx, qy)
-				* pow(weights_rad[i].value+weights_rthick[m].value,2)
-				*(weights_len[j].value+2.0*weights_fthick[n].value);
-
-				if (weights_theta.size()>1) {
-				  _ptvalue *= fabs(cos(weights_theta[k].value*pi/180.0));
-				}
-				sum += _ptvalue;
-
-				//Find average volume
-				vol += weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_rthick[m].weight
-					* weights_fthick[n].weight
-					* pow(weights_rad[i].value+weights_rthick[m].value,2)
-				*(weights_len[j].value+2.0*weights_fthick[n].value);
-				//Find norm for volume
-				norm_vol += weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_rthick[m].weight
-					* weights_fthick[n].weight;
-
-				norm += weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_rthick[m].weight
-					* weights_fthick[n].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 CoreShellBicelleModel :: 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 CoreShellBicelleModel :: calculate_ER() {
-  CoreShellBicelleParameters dp;
-
-  dp.radius     = radius();
-  dp.rim_thick  = rim_thick();
-  dp.face_thick  = face_thick();
-  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_rthick;
-  rim_thick.get_weights(weights_rthick);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_fthick;
-  face_thick.get_weights(weights_fthick);
-
-  // 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_rthick.size(); j++) {
-      dp.rim_thick = weights_rthick[j].value;
-      for(int l=0; l< (int)weights_fthick.size(); l++) {
-          dp.face_thick = weights_fthick[l].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_rthick[j].weight * weights_fthick[l].weight
-				* weights_radius[k].weight*DiamCyl(dp.length+2.0*dp.face_thick,dp.radius+dp.rim_thick)/2.0;
-			norm += weights_length[i].weight* weights_rthick[j].weight * weights_fthick[l].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.face_thick,dp.radius+dp.rim_thick)/2.0;}
-
-  return rad_out;
-}
-double CoreShellBicelleModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/coreshellcylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/coreshellcylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,393 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "core_shell_cylinder.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double thickness;
-  double length;
-  double core_sld;
-  double shell_sld;
-  double solvent_sld;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} CoreShellCylinderParameters;
-
-
-/**
- * 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
- */
-static 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 = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // 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);
-    cos_val = 1.0;
-  }
-
-  alpha = acos( cos_val );
-  if (alpha == 0.0){
-  	alpha = 1.0e-26;
-  }
-  // 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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-
-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(cos(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;
-}
-double CoreShellCylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/coreshellsphere.cpp
===================================================================
--- src/sas/models/c_extension/c_models/coreshellsphere.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,386 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "core_shell.h"
-
-extern "C" {
-#include "libSphere.h"
-#include "libmultifunc/libfunc.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double thickness;
-  double core_sld;
-  double shell_sld;
-  double solvent_sld;
-  double background;
-  double M0_sld_shell;
-  double M_theta_shell;
-  double M_phi_shell;
-  double M0_sld_core;
-  double M_theta_core;
-  double M_phi_core;
-  double M0_sld_solv;
-  double M_theta_solv;
-  double M_phi_solv;
-  double Up_frac_i;
-  double Up_frac_f;
-  double Up_theta;
-} CoreShellParameters;
-
-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);
-  M0_sld_shell = Parameter(0.0e-6);
-  M_theta_shell = Parameter(0.0);
-  M_phi_shell = Parameter(0.0);
-  M0_sld_core = Parameter(0.0e-6);
-  M_theta_core = Parameter(0.0);
-  M_phi_core = Parameter(0.0);
-  M0_sld_solv = Parameter(0.0e-6);
-  M_theta_solv = Parameter(0.0);
-  M_phi_solv = Parameter(0.0);
-  Up_frac_i = Parameter(0.5);
-  Up_frac_f = Parameter(0.5);
-  Up_theta = 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;
-
-  //im
-  ///dp[7] = 0.0;
-  ///dp[8] = 0.0;
-  ///dp[9] = 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 pars: parameters
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-
-static double coreshell_analytical_2D_scaled(CoreShellParameters *pars, double q, double q_x, double q_y) {
-	double dp[7];
-	//convert angle degree to radian
-	dp[0] = pars->scale;
-	dp[1] = pars->radius;
-	dp[2] = pars->thickness;
-	dp[3] = 0.0;
-	dp[4] = 0.0;
-	dp[5] = 0.0;
-	dp[6] = 0.0;
-	//im
-	///dp[7] = 0.0;
-	///dp[8] = 0.0;
-	///dp[9] = 0.0;
-
-    double sld_core = pars->core_sld;
-    double sld_shell = pars->shell_sld;
-	double sld_solv = pars->solvent_sld;
-	double answer = 0.0;
-	double m_max = pars->M0_sld_core;
-	double m_max_shell = pars->M0_sld_shell;
-	double m_max_solv = pars->M0_sld_solv;
-
-	if (m_max < 1.0e-32 && m_max_solv < 1.0e-32 && m_max_shell < 1.0e-32){
-		dp[3] = sld_core;
-		dp[4] = sld_shell;
-		dp[5] = sld_solv;
-		answer = CoreShellForm(dp, q);
-	}
-	else{
-		double qx = q_x;
-		double qy = q_y;
-		double s_theta = pars->Up_theta;
-		double m_phi = pars->M_phi_core;
-		double m_theta = pars->M_theta_core;
-		double m_phi_shell = pars->M_phi_shell;
-		double m_theta_shell = pars->M_theta_shell;
-		double m_phi_solv = pars->M_phi_solv;
-		double m_theta_solv = pars->M_theta_solv;
-		double in_spin = pars->Up_frac_i;
-		double out_spin = pars->Up_frac_f;
-		polar_sld p_sld_core;
-		polar_sld p_sld_shell;
-		polar_sld p_sld_solv;
-		//Find (b+m) slds
-		p_sld_core = cal_msld(1, qx, qy, sld_core, m_max, m_theta, m_phi,
-								in_spin, out_spin, s_theta);
-		p_sld_shell = cal_msld(1, qx, qy, sld_shell, m_max_shell, m_theta_shell, m_phi_shell,
-								in_spin, out_spin, s_theta);
-		p_sld_solv = cal_msld(1, qx, qy, sld_solv, m_max_solv, m_theta_solv, m_phi_solv,
-						 		in_spin, out_spin, s_theta);
-		//up_up
-		if (in_spin > 0.0 && out_spin > 0.0){
-			dp[3] = p_sld_core.uu;
-			dp[4] = p_sld_shell.uu;
-			dp[5] = p_sld_solv.uu;
-			answer += CoreShellForm(dp, q);
-			}
-		//down_down
-		if (in_spin < 1.0 && out_spin < 1.0){
-			dp[3] = p_sld_core.dd;
-			dp[4] = p_sld_shell.dd;
-			dp[5] = p_sld_solv.dd;
-			answer += CoreShellForm(dp, q);
-			}
-		//up_down
-		if (in_spin > 0.0 && out_spin < 1.0){
-			dp[3] = p_sld_core.re_ud;
-			dp[4] = p_sld_shell.re_ud;
-			dp[5] = p_sld_solv.re_ud;
-			answer += CoreShellForm(dp, q);
-			dp[3] = p_sld_core.im_ud;
-			dp[4] = p_sld_shell.im_ud;
-			dp[5] = p_sld_solv.im_ud;
-			answer += CoreShellForm(dp, q);
-			}
-		//down_up
-		if (in_spin < 1.0 && out_spin > 0.0){
-			dp[3] = p_sld_core.re_du;
-			dp[4] = p_sld_shell.re_du;
-			dp[5] = p_sld_solv.re_du;
-			answer += CoreShellForm(dp, q);
-			dp[3] = p_sld_core.im_du;
-			dp[4] = p_sld_shell.im_du;
-			dp[5] = p_sld_solv.im_du;
-			answer += CoreShellForm(dp, q);
-			}
-	}
-	// Already normalized
-	// add in the background
-	answer += pars->background;
-	return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @return: function value
- */
-static double coreshell_analytical_2DXY(CoreShellParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return coreshell_analytical_2D_scaled(pars, q, qx/q, qy/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 CoreShellModel :: operator()(double qx, double qy) {
-	CoreShellParameters dp;
-    dp.scale = scale();
-    dp.radius = radius();
-    dp.thickness = thickness();
-    dp.core_sld = core_sld();
-    dp.shell_sld = shell_sld();
-    dp.solvent_sld = solvent_sld();
-    dp.background = 0.0;
-    dp.M0_sld_shell = M0_sld_shell();
-    dp.M_theta_shell = M_theta_shell();
-    dp.M_phi_shell = M_phi_shell();
-    dp.M0_sld_core = M0_sld_core();
-    dp.M_theta_core = M_theta_core();
-    dp.M_phi_core = M_phi_core();
-    dp.M0_sld_solv = M0_sld_solv();
-    dp.M_theta_solv = M_theta_solv();
-    dp.M_phi_solv = M_phi_solv();
-    dp.Up_frac_i = Up_frac_i();
-    dp.Up_frac_f = Up_frac_f();
-    dp.Up_theta = Up_theta();
-
-	// 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.radius = weights_rad[i].value;
-
-	// Loop over thickness weight points
-	for(size_t j=0; j<weights_thick.size(); j++) {
-	  dp.thickness = weights_thick[j].value;
-	  //Un-normalize SphereForm by volume
-	  sum += weights_rad[i].weight
-		  * weights_thick[j].weight * coreshell_analytical_2DXY(&dp, qx, qy) *
-		  	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 pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellModel :: 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 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;
-}
-double CoreShellModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/csparallelepiped.cpp
===================================================================
--- src/sas/models/c_extension/c_models/csparallelepiped.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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 2010, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-#include "csparallelepiped.h"
-
-// Convenience parameter structure
-typedef struct {
-  double scale;
-  double shortA;
-  double midB;
-  double longC;
-  double rimA;
-  double rimB;
-  double rimC;
-  double sld_rimA;
-  double sld_rimB;
-  double sld_rimC;
-  double sld_pcore;
-  double sld_solv;
-  double background;
-  double parallel_theta;
-  double parallel_phi;
-  double parallel_psi;
-} CSParallelepipedParameters;
-
-static 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
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double csparallelepiped_analytical_2D_scaled(CSParallelepipedParameters *pars, double q, double q_x, double q_y) {
-  double dp[13];
-  double cparallel_x, cparallel_y, bparallel_x, bparallel_y, parallel_x, parallel_y;
-  //double q_z;
-  double 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 = cos(theta) * cos(phi);
-  cparallel_y = sin(theta);
-  //cparallel_z = -cos(theta) * sin(phi);
-
-  // 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 = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  parallel_y = sin(psi)*cos(theta);
-
-  cos_val_a = parallel_x*q_x + parallel_y*q_y;
-
-
-
-  // parallelepiped b axis orientation
-  bparallel_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  bparallel_y = cos(theta)*cos(psi);
-  // axis of the parallelepiped
-  cos_val_b = bparallel_x*q_x + bparallel_y*q_y;
-
-  // The following test should always pass
-  if (fabs(cos_val_c)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_c = 1.0;
-  }
-  if (fabs(cos_val_a)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_a = 1.0;
-  }
-  if (fabs(cos_val_b)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_b = 1.0;
-  }
-  // Call the IGOR library function to get the kernel
-  answer = cspkernel( dp, q, cos_val_a, 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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the CSparallelepiped
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-
-
-
-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(cos(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;
-
-}
-double CSParallelepipedModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/cylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/cylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,420 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "libmultifunc/libfunc.h"
-}
-#include "cylinder.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double radius;
-    double length;
-    double sldCyl;
-    double sldSolv;
-    double background;
-    double cyl_theta;
-    double cyl_phi;
-    double M0_sld_cyl;
-    double M_theta_cyl;
-    double M_phi_cyl;
-    double M0_sld_solv;
-    double M_theta_solv;
-    double M_phi_solv;
-    double Up_frac_i;
-	double Up_frac_f;
-	double Up_theta;
-} CylinderParameters;
-
-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);
-	M0_sld_cyl = Parameter(0.0e-6);
-	M_theta_cyl = Parameter(0.0);
-	M_phi_cyl = Parameter(0.0); 
-	M0_sld_solv = Parameter(0.0e-6);
-	M_theta_solv = Parameter(0.0);
-	M_phi_solv = Parameter(0.0); 
-	Up_frac_i = Parameter(0.5); 
-	Up_frac_f = Parameter(0.5);
-	Up_theta = 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 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 pars: parameters of the cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static 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 = 0.0;
-    double form = 0.0;
-    //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 sld_solv = pars->sldSolv;
-    double sld_cyl = pars->sldCyl;
-    double m_max = pars->M0_sld_cyl;
-    double m_max_solv = pars->M0_sld_solv;
-    double contrast = 0.0;
-
-    // Cylinder orientation
-	cyl_x = cos(theta) * cos(phi);
-    cyl_y = sin(theta);
-    //cyl_z = -cos(theta) * sin(phi);
-    // 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("cyl_ana_2D: Unexpected error: |cos(alpha)=%g|>1\n", cos_val);
-      printf("cyl_ana_2D: at theta=%g and phi=%g.", theta, phi);
-      return 1.0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-  alpha = acos( cos_val );
-  if (alpha == 0.0){
-  	alpha = 1.0e-26;
-  	}
-  // Call the IGOR library function to get the kernel
-  //answer = CylKernel(q, pars->radius, pars->length/2.0, alpha) / sin(alpha);
-
-    // Call the IGOR library function to get the kernel
-    form = CylKernel(q, pars->radius, pars->length/2.0, alpha) / sin(alpha);
-
-	if (m_max < 1.0e-32 && m_max_solv < 1.0e-32){
-		// Multiply by contrast^2
-		contrast = (pars->sldCyl - pars->sldSolv);
-  		answer = contrast * contrast * form;
-	}
-	else{
-		double qx = q_x;
-		double qy = q_y;
-		double s_theta = pars->Up_theta;
-		double m_phi = pars->M_phi_cyl;
-		double m_theta = pars->M_theta_cyl;
-		double m_phi_solv = pars->M_phi_solv;
-		double m_theta_solv = pars->M_theta_solv;
-		double in_spin = pars->Up_frac_i;
-		double out_spin = pars->Up_frac_f;
-		polar_sld p_sld;
-		polar_sld p_sld_solv;
-		p_sld = cal_msld(1, qx, qy, sld_cyl, m_max, m_theta, m_phi, 
-			 			in_spin, out_spin, s_theta);
-		p_sld_solv = cal_msld(1, qx, qy, sld_solv, m_max_solv, m_theta_solv, m_phi_solv, 
-			 			in_spin, out_spin, s_theta);
-		//up_up	
-		if (in_spin > 0.0 && out_spin > 0.0){			 
-			answer += ((p_sld.uu- p_sld_solv.uu) * (p_sld.uu- p_sld_solv.uu) * form);
-			}
-		//down_down
-		if (in_spin < 1.0 && out_spin < 1.0){
-			answer += ((p_sld.dd - p_sld_solv.dd) * (p_sld.dd - p_sld_solv.dd) * form);
-			}
-		//up_down
-		if (in_spin > 0.0 && out_spin < 1.0){
-			answer += ((p_sld.re_ud - p_sld_solv.re_ud) * (p_sld.re_ud - p_sld_solv.re_ud) * form);
-			answer += ((p_sld.im_ud - p_sld_solv.im_ud) * (p_sld.im_ud - p_sld_solv.im_ud) * form);
-			}
-		//down_up	
-		if (in_spin < 1.0 && out_spin > 0.0){
-			answer += ((p_sld.re_du - p_sld_solv.re_du) * (p_sld.re_du - p_sld_solv.re_du) * form);
-			answer += ((p_sld.im_du - p_sld_solv.im_du) * (p_sld.im_du - p_sld_solv.im_du) * form);
-			}
-	}
-
-    //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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @return: function value
- */
-static 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 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();
-	dp.Up_theta =  Up_theta();
-	dp.M_phi_cyl =  M_phi_cyl();
-	dp.M_theta_cyl =  M_theta_cyl();
-	dp.M0_sld_cyl =  M0_sld_cyl();
-	dp.M_phi_solv =  M_phi_solv();
-	dp.M_theta_solv =  M_theta_solv();
-	dp.M0_sld_solv =  M0_sld_solv();
-	dp.Up_frac_i =  Up_frac_i();
-	dp.Up_frac_f =  Up_frac_f();
-	
-	// 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(cos(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;
-}
-double CylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/dabmodel.cpp
===================================================================
--- src/sas/models/c_extension/c_models/dabmodel.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-/**
-
-   Scattering model class for the DAB (Debye Anderson Brumberger) Model
-
-**/
-
-
-
-#include <math.h>
-#include "parameters.hh"
-#include "dabmodel.h"
-
-DABModel::DABModel() {
-  length = Parameter(50.0);
-  scale = Parameter(1.0);
-  background = Parameter(0.0);
-
-}
-
-double DABModel::operator()(double q) {
-  double d_length = length();
-  double d_scale = scale();
-  double d_background = background();
-
-  double numerator = d_scale*pow(d_length,3);
-  double denominator = pow(1 + pow(q*d_length,2),2);
-
-  return numerator / denominator + d_background;
-  
-
-
-}
-
-double DABModel::operator()(double qx,double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return this->operator()(q);
-}
-
-double DABModel::calculate_ER() {
-  // not implemented yet
-  return 0.0;
-}
-
-double DABModel::calculate_VR() {
-  return 1.0;
-}
-
-double DABModel::evaluate_rphi(double q,double phi) {
-  double qx = q * cos(phi);
-  double qy = q * sin(phi);
-  return this->operator()(qx,qy);
-}
Index: c/sas/models/c_extension/c_models/dispersion_visitor.cpp
===================================================================
--- src/sas/models/c_extension/c_models/dispersion_visitor.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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: c/sas/models/c_extension/c_models/ellipsoid.cpp
===================================================================
--- src/sas/models/c_extension/c_models/ellipsoid.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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 2008, University of Tennessee
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "ellipsoid.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double radius_a;
-  double radius_b;
-  double sldEll;
-  double sldSolv;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} EllipsoidParameters;
-
-/**
- * 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
- */
-static 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 = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // 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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the ellipsoid
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-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(cos(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;
-}
-double EllipsoidModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/ellipticalcylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/ellipticalcylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,466 +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 "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "elliptical_cylinder.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double r_minor;
-  double r_ratio;
-  double length;
-  double sldCyl;
-  double sldSolv;
-  double background;
-  double cyl_theta;
-  double cyl_phi;
-  double cyl_psi;
-} EllipticalCylinderParameters;
-
-
-static double elliptical_cylinder_kernel(EllipticalCylinderParameters *pars, double q, double cos_val, double cos_nu, double cos_mu) {
-  double qr;
-  double qL;
-  double Be,Si;
-  double r_major;
-  double kernel;
-
-  r_major = pars->r_ratio * pars->r_minor;
-
-  qr = q*sqrt( r_major*r_major*cos_nu*cos_nu + pars->r_minor*pars->r_minor*cos_mu*cos_mu );
-  qL = q*pars->length*cos_val/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
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double elliptical_cylinder_analytical_2D_scaled(EllipticalCylinderParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y;//, cyl_z;
-  double ella_x, ella_y, ellb_x, ellb_y;
-  //double q_z;
-  double vol, cos_val;
-  double cos_mu, 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 = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // q vector
-  //q_z = 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.
-  ella_x =  -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  ella_y =  sin(psi)*cos(theta);
-  ellb_x =  -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  ellb_y =  cos(theta)*cos(psi);
-  
-  // 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;
-
-  // calculate the axis of the ellipse wrt q-coord.
-  cos_nu = ella_x*q_x + ella_y*q_y;
-  cos_mu = ellb_x*q_x + ellb_y*q_y;
-  
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    //printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val = 1.0;
-  }
-  if (fabs(cos_nu)>1.0) {
-    //printf("cyl_ana_2D: Unexpected error: cos(nu)>1\n");
-    cos_nu = 1.0;
-  }
-  if (fabs(cos_mu)>1.0) {
-    //printf("cyl_ana_2D: Unexpected error: cos(nu)>1\n");
-    cos_mu = 1.0;
-  }
-  answer = elliptical_cylinder_kernel(pars, q, cos_val, cos_nu, cos_mu);
-
-  // 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;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-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(cos(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;
-}
-double EllipticalCylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/fcc.cpp
===================================================================
--- src/sas/models/c_extension/c_models/fcc.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,338 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "fcc.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-// Convenience parameter structure
-typedef struct {
-  double scale;
-  double dnn;
-  double d_factor;
-  double radius;
-  double sldSph;
-  double sldSolv;
-  double background;
-  double theta;
-  double phi;
-  double psi;
-} FCParameters;
-
-/**
- * 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
- */
-static double fc_analytical_2D_scaled(FCParameters *pars, double q, double q_x, double q_y) {
-  double b3_x, b3_y, b1_x, b1_y, b2_x, b2_y; //, b3_z
-  double q_z;
-  double 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 = cos(theta) * cos(phi);
-  b3_y = sin(theta);
-  //b3_z = -cos(theta) * sin(phi);
-  cos_val_b3 =  b3_x*q_x + b3_y*q_y;// + b3_z*q_z;
-  
-  // b1 axis orientation
-  b1_x = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  b1_y = sin(psi)*cos(theta);
-  cos_val_b1 = b1_x*q_x + b1_y*q_y;
-  
-  // b2 axis orientation
-  b2_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  b2_y = cos(theta)*cos(psi);
-  cos_val_b2 =  b2_x*q_x + b2_y*q_y;
-  
-  // The following test should always pass
-  if (fabs(cos_val_b3)>1.0) {
-    //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-    cos_val_b3 = 1.0;
-  }
-  if (fabs(cos_val_b2)>1.0) {
-    //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-    cos_val_b2 = 1.0;
-  }
-  if (fabs(cos_val_b1)>1.0) {
-    //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-    cos_val_b1 = 1.0;
-  }
-  // 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);
-
-
-  // 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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the FCC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-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(cos(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;
-}
-double FCCrystalModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/flexcyl_ellipX.cpp
===================================================================
--- src/sas/models/c_extension/c_models/flexcyl_ellipX.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,216 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "flexcyl_ellipX.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double length;
-  double kuhn_length;
-  double radius;
-  double axis_ratio;
-  double sldCyl;
-  double sldSolv;
-  double background;
-} FlexCylEXParameters;
-
-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;
-}
-double FlexCylEllipXModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/flexiblecylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/flexiblecylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,195 +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: add 2d
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "flexible_cylinder.h"
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double length;
-  double kuhn_length;
-  double radius;
-  double sldCyl;
-  double sldSolv;
-  double background;
-} FlexibleCylinderParameters;
-
-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;
-}
-double FlexibleCylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/fractal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/fractal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "fractal.h"
-
-extern "C" {
-#include "libTwoPhase.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;
-}
-double FractalModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/fuzzysphere.cpp
===================================================================
--- src/sas/models/c_extension/c_models/fuzzysphere.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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
- */
-
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "fuzzysphere.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-// scattering from a uniform sphere w/ fuzzy surface
-// Modified from FuzzySpheres in libigor/libSphere.c without polydispersion: JHC
-static 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
-}
-
-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;
-}
-double FuzzySphereModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/gaussian.cpp
===================================================================
--- src/sas/models/c_extension/c_models/gaussian.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,82 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "gaussian.h"
-
-Gaussian :: Gaussian() {
-  scale  = Parameter(1.0, true);
-  sigma  = Parameter(1.0, true);
-  center = Parameter(0.0, true);
-}
-
-/**
- * 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 q: q-value
- * @return: function value
- */
-double Gaussian :: operator()(double q) {
-  double sigma2 = pow(sigma(), 2);
-  return scale() / sigma2 * exp( -pow((q-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 q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double Gaussian :: operator()(double qx, double qy) {
-  return (*this).operator()(qx) * (*this).operator()(qy);
-}
-
-/**
- * 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 q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Gaussian :: 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 Gaussian :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double Gaussian :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/hollowcylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/hollowcylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,423 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "hollow_cylinder.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double core_radius;
-  double radius;
-  double length;
-  double sldCyl;
-  double sldSolv;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} HollowCylinderParameters;
-
-/**
- * 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
- */
-static 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 = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // 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;
-}
-
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the Hollow cylinder
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-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(cos(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;
-}
-/**
- * Function to calculate volf_ratio for shell
- * @return: volf_ratio value
- */
-double HollowCylinderModel :: calculate_VR() {
-  HollowCylinderParameters dp;
-  dp.core_radius = core_radius();
-  dp.radius  = radius();
-  dp.length  = length();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum_tot = 0.0;
-  double sum_shell = 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);
-
-  // Get the dispersion points for the core radius
-  vector<WeightPoint> weights_core_radius;
-  core_radius.get_weights(weights_core_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;
-      for(int j=0; j<(int)weights_core_radius.size(); j++) {
-    	  dp.core_radius = weights_core_radius[j].value;
-		  sum_tot +=weights_length[i].weight* weights_core_radius[j].weight
-			  * weights_radius[k].weight*pow(dp.radius, 2);
-		  sum_shell += weights_length[i].weight* weights_core_radius[j].weight
-			  * weights_radius[k].weight*(pow(dp.radius, 2)-pow(dp.core_radius, 2));
-      }
-    }
-  }
-    if (sum_tot == 0.0){
-      //return the default value
-      rad_out =  1.0;}
-    else{
-      //return ratio value
-      return sum_shell/sum_tot;
-    }
-}
Index: c/sas/models/c_extension/c_models/lamellar.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellar.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,134 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "lamellar.h"
-
-/*  LamellarFFX  :  calculates the form factor of a lamellar structure - no S(q) effects included
-            -NO polydispersion included
-*/
-static 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);
-}
-
-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;
-}
-double LamellarModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/lamellarFF_HG.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellarFF_HG.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "lamellarFF_HG.h"
-
-extern "C" {
-#include "libCylinder.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;
-}
-double LamellarFFHGModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/lamellarPC.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellarPC.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "lamellarPC.h"
-
-extern "C" {
-#include "libCylinder.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;
-}
-double LamellarPCrystalModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/lamellarPS.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellarPS.cpp	(revision 37649847151eecf7e862b5e7e11d0449a0941b2e)
+++ 	(revision )
@@ -1,188 +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 "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "lamellarPS.h"
-
-extern "C" {
-#include "libCylinder.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!!
-
- */
-static 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);
-}
-
-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++) {    BUGS fixed March 2015
-    for(int j=0; j< (int)weights_delta.size(); j++) {
-      //dp[2] = weights_delta[i].value;        BUG
-      dp[2] = weights_delta[j].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;
-}
-double LamellarPSModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/lamellarPS_HG.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellarPS_HG.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,139 +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: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "lamellarPS_HG.h"
-
-extern "C" {
-	#include "libCylinder.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 :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/linearpearls.cpp
===================================================================
--- src/sas/models/c_extension/c_models/linearpearls.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,219 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "linearpearls.h"
-
-extern "C" {
-#include "libmultifunc/libfunc.h"
-}
-
-static double linear_pearls_kernel(double dp[], double q) {
-  //fit parameters
-  double scale = dp[0];
-  double radius = dp[1];
-  double edge_separation = dp[2];
-  double num_pearls = dp[3];
-  double sld_pearl = dp[4];
-  double sld_solv = dp[5];
-  double background = dp[6];
-  //others
-  double psi = 0.0;
-  double n_contrib = 0.0;
-  double form_factor = 0.0;
-  //Pi
-  double pi = 4.0 * atan(1.0);
-  //relative sld
-  double contrast_pearl = sld_pearl - sld_solv;
-  //each volume
-  double pearl_vol = 4.0 /3.0 * pi * pow(radius, 3.0);
-  //total volume
-  double tot_vol = num_pearls * pearl_vol;
-  //mass
-  double m_s = contrast_pearl * pearl_vol;
-  //center to center distance between the neighboring pearls
-  double separation = edge_separation + 2.0 * radius;
-  //integer
-  int num = 0;
-  int n_max = 0;
-  // constraints
-  if (scale<=0 || radius<=0 || edge_separation<0 || num_pearls<=0){
-	  return 0.0;
-  }
-  //sine functions of a pearl
-  psi = sin(q * radius);
-  psi -= q * radius * cos(q * radius);
-  psi /= pow((q * radius), 3.0);
-
-  // N pearls contribution
-  n_max = num_pearls - 1;
-  for(num=0; num<=n_max; num++) {
-
-	  if (num == 0){
-		  n_contrib = num_pearls;
-		  continue;
-	  }
-	  n_contrib += (2.0*(num_pearls-double(num))*sinc(q*separation*double(num)));
-  }
-  // form factor for num_pearls
-  form_factor = n_contrib;
-  form_factor *= pow((m_s*psi*3.0), 2.0);
-  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);
-}
-
-LinearPearlsModel :: LinearPearlsModel() {
-  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);
-  num_pearls = Parameter(3);
-  num_pearls.set_min(0.0);
-  sld_pearl = Parameter(1.0e-06);
-  sld_solv = Parameter(6.3e-06);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D LinearPearlsModel function
- * @param q: q-value
- * @return: function value
- */
-double LinearPearlsModel :: operator()(double q) {
-  double dp[7];
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = edge_separation();
-  dp[3] = num_pearls();
-  dp[4] = sld_pearl();
-  dp[5] = sld_solv();
-  dp[6] = 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 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);
-      tot_vol += dp[3] * pearl_vol;
-      //Un-normalize Sphere by volume
-      sum += weights_radius[i].weight * weights_edge_separation[j].weight
-          * linear_pearls_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 LinearPearlsModel function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double LinearPearlsModel :: operator()(double qx, double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate LinearPearlsModel function
- * @param pars: parameters of the StringOfPearlsModel
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LinearPearlsModel :: 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 LinearPearlsModel :: calculate_ER() {
-	LinearPearlsParameters dp;
-
-  dp.scale = scale();
-  dp.radius = radius();
-  dp.edge_separation = edge_separation();
-  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);
-  // 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 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);
-      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);
-    tot_vol = dp.num_pearls * pearl_vol;
-
-    rad_out =  pow((3.0*tot_vol/4.0/pi), 0.33333);
-  }
-
-  return rad_out;
-
-}
-double LinearPearlsModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/logNormal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/logNormal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,82 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "logNormal.h"
-
-LogNormal :: LogNormal() {
-  scale  = Parameter(1.0, true);
-  sigma  = Parameter(1.0, true);
-  center = Parameter(0.0, true);
-}
-
-/**
- * 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 q: q-value
- * @return: function value
- */
-double LogNormal :: operator()(double q) {
-  double sigma2 = pow(sigma(), 2);
-  return scale() / (q*sigma2) * exp( -pow((log(q) - center()), 2) / (2*sigma2));
-}
-
-/**
- * Function to evaluate 2D LogNormal  function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = LogNormal(x) * LogNormal(y)
- *
- * where both LogNormals share the same parameters.
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double LogNormal :: operator()(double qx, double qy) {
-  return (*this).operator()(qx) * (*this).operator()(qy);
-}
-
-/**
- * Function to evaluate 2D LogNormal  function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = LogNormal(x) * LogNormal(y)
- *
- * where both LogNormals share the same parameters.
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LogNormal :: 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 LogNormal :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double LogNormal :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/lorentzian.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lorentzian.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,69 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "lorentzian.h"
-
-Lorentzian :: Lorentzian() {
-  scale  = Parameter(1.0, true);
-  gamma  = Parameter(1.0, true);
-  center = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double Lorentzian :: operator()(double q) {
-  double delta2 = pow( (q-center()), 2);
-  return scale() / acos(-1.0) * 0.5*gamma() /
-      (delta2 + 0.25*gamma()*gamma());
-}
-
-/**
- * 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 Lorentzian :: operator()(double qx, double qy) {
-  return (*this).operator()(qx) * (*this).operator()(qy);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Lorentzian :: 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 Lorentzian :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double Lorentzian :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/massfractal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/massfractal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,129 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "massfractal.h"
-extern "C" {
-#include "libmultifunc/libfunc.h"
-}
-
-static double mass_fractal_kernel(double dp[], double q) {
-  //fit parameters
-  double scale = dp[0];
-  double radius = dp[1];
-  double mass_dim = dp[2];
-  double co_length = dp[3];
-  double background = dp[4];
-  //others
-  double pq = 0.0;
-  double sq = 0.0;
-  double mmo = 0.0;
-  //result
-  double result = 0.0;
-  if( (q*radius) == 0.0){
-		pq = 1.0;
-  }
-  else{
-	//calculate P(q) for the spherical subunits; not normalized
-	pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2);
-  }
-  mmo = mass_dim-1.0;
-  //calculate S(q)
-  sq = exp(gamln(mmo))*sin((mmo)*atan(q*co_length));
-  sq *= pow(co_length, mmo);
-  sq /= pow((1.0 + (q*co_length)*(q*co_length)),(mmo/2.0));
-
-
-  sq /= q;
-  //combine and return
-  result = pq * sq;
-  result *= scale;
-  result += background;
-
-  return(result);
-}
-
-MassFractalModel :: MassFractalModel() {
-  scale      = Parameter(1.0);
-  radius = Parameter(10.0);
-  mass_dim = Parameter(1.9);
-  co_length = Parameter(100.0);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double MassFractalModel :: operator()(double q) {
-  double dp[5];
-
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = mass_dim();
-  dp[3] = co_length();
-  dp[4] = 0.0;
-
-  // Perform the computation
-  double sum = 0.0;
-
-  sum = mass_fractal_kernel(dp, fabs(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 MassFractalModel :: 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 MassFractalModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double MassFractalModel :: calculate_ER() {
-  //NOT implemented yet!!! 'cause None shape Model
-  return 0.0;
-}
-double MassFractalModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/masssurfacefractal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/masssurfacefractal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "masssurfacefractal.h"
-
-
-
-static double mass_surface_fractal_kernel(double dp[], double q) {
-  //fit parameters
-  double scale = dp[0];
-  double mass_dim = dp[1];
-  double surface_dim = dp[2];
-  double cluster_rg = dp[3];
-  double primary_rg = dp[4];
-  double background = dp[5];
-
-  //others
-  double tot_dim = 0.0;
-  double rc_norm = 0.0;
-  double rp_norm = 0.0;
-  double x_val1 = 0.0;
-  double x_val2 = 0.0;
-  double form_factor = 0.0;
-  double inv_form = 0.0;
-
-  // This model is valid only for 0<dm<=6 and 0<ds<=6
-  // Not valid values => reject as 0.0
-  if (mass_dim < 1e-16){
-	  return background;
-  }
-  if (mass_dim > 6.0){
-	  return background;
-  }
-  if (surface_dim < 1e-16){
-	  return background;
-  }
-  if (surface_dim > 6.0){
-	  return background;
-  }
-  tot_dim = 6.0 - surface_dim - mass_dim;
-  //singulars
-  if (tot_dim < 0.0){
-	  return background;
-  }
-
-  //computation
-  mass_dim /= 2.0;
-  tot_dim /= 2.0;
-  rc_norm = cluster_rg * cluster_rg / (3.0 * mass_dim);
-  if (tot_dim < 1.0e-16){
-	  tot_dim = 1.0e-16;
-  }
-  rp_norm = primary_rg * primary_rg / (3.0 * tot_dim);
-
-  //x for P
-  x_val1 = 1.0 +  q * q * rc_norm;
-  x_val2 = 1.0 +  q * q * rp_norm;
-
-  inv_form = pow(x_val1, mass_dim) * pow(x_val2, tot_dim);
-
-  //another singular
-  if (inv_form == 0.0) return background;
-
-  form_factor = 1.0;
-  form_factor /= inv_form;
-
-  //scale and background
-  form_factor *= scale;
-  form_factor += background;
-  return (form_factor);
-}
-
-MassSurfaceFractal :: MassSurfaceFractal() {
-  scale      = Parameter(1.0);
-  mass_dim = Parameter(1.8);
-  surface_dim = Parameter(2.3);
-  cluster_rg = Parameter(86.7);
-  primary_rg = Parameter(4000.0);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double MassSurfaceFractal :: operator()(double q) {
-  double dp[6];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = mass_dim();
-  dp[2] = surface_dim();
-  dp[3] = cluster_rg();
-  dp[4] = primary_rg();
-  dp[5] = 0.0;
-
-  //computation: no polydispersion
-  double sum = 0.0;
-  sum = mass_surface_fractal_kernel(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 MassSurfaceFractal :: 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 MassSurfaceFractal :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double MassSurfaceFractal :: calculate_ER() {
-  //NOT implemented yet!!! 'cause None shape Model
-  return 0.0;
-}
-double MassSurfaceFractal :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/micelleSphCore.cpp
===================================================================
--- src/sas/models/c_extension/c_models/micelleSphCore.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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
- */
-
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/src/libigor
- *
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <iostream>
-using namespace std;
-#include "micelleSphCore.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-
-MicelleSphCoreModel :: MicelleSphCoreModel() {
-    scale      = Parameter(1.0);
-    ndensity   = Parameter(8.94e15);
-    ndensity.set_min(0.0);
-    v_core     = Parameter(62624.0);
-    v_core.set_min(0.0);
-    v_corona   = Parameter(61940.0);
-    v_corona.set_min(0.0);
-    rho_solv   = Parameter(6.4e-6);
-    rho_core   = Parameter(3.4e-7);
-    rho_corona = Parameter(8.0e-7);
-    radius_core = Parameter(45.0, true);
-    radius_core.set_min(0.0);
-    radius_gyr = Parameter(20.0, true);
-    radius_gyr.set_min(0.0);
-    d_penetration = Parameter(1.0);
-    d_penetration.set_min(0.0);
-    n_aggreg = Parameter(6.0);
-    n_aggreg.set_min(1.0);
-    background = Parameter(0.0);
-}
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double MicelleSphCoreModel :: operator()(double q) {
-	double dp[12];
-	
-	// Fill parameter array
-	// Add the background after averaging
-        dp[0] = scale();
-        dp[1] = ndensity();
-        dp[2] = v_core();
-        dp[3] = v_corona();
-        dp[4] = rho_solv();
-        dp[5] = rho_core();
-        dp[6] = rho_corona();
-        dp[7] = radius_core();
-        dp[8] = radius_gyr();
-        dp[9] = d_penetration();
-        dp[10] = n_aggreg();
-        dp[11] = 0.0;
-
-
-        // Get the dispersion points for the core radius
-        vector<WeightPoint> weights_rcore;
-        radius_core.get_weights(weights_rcore);
-
-         // Get the dispersion points for the gyration radius
-        vector<WeightPoint> weights_rgyr;
-        radius_gyr.get_weights(weights_rgyr);
-
-       // Perform the computation, with all weight points
-        double sum = 0.0;
-        double norm = 0.0;
-        double vol = 0.0;
-	double vol_micelle = 0.0;
-
-        // Loop over core radius weight points
-        for(int i=0; i< (int)weights_rcore.size(); i++) {
-
-            dp[7] = weights_rcore[i].value;
-
-            // Loop over gyration radius weight points
-            for(int j=0; j< (int)weights_rgyr.size(); j++) {
-
-                dp[8] = weights_rgyr[j].value;
-		
-		//cout << "\n loop i,j = " << i << "  " << j;
-		//cout << "\n radius_core: value weight = " << weights_rcore[i].value << "  " << weights_rcore[i].weight;
-		//cout << "\n radius_gyr:  value weight = " << weights_rgyr[j].value << "  " << weights_rgyr[j].weight;
-                //cout << "\n";
-
-                vol_micelle = pow(weights_rcore[i].value+weights_rgyr[j].value,3);
-
-                //Un-normalize SphereForm by volume
-                sum += weights_rcore[i].weight *  weights_rgyr[j].weight *
-		       MicelleSphericalCore(dp, q) *
-                       vol_micelle;
-      
-                //Find average volume
-                vol += weights_rcore[i].weight * weights_rgyr[j].weight * vol_micelle;
-
-                norm += weights_rcore[i].weight * weights_rgyr[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 MicelleSphCoreModel :: 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 model
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double MicelleSphCoreModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double MicelleSphCoreModel :: calculate_ER() {
-	return 1.0;
-}
-
-
-/**
- * Function to calculate particle volume/total volume for shape models:
- *	Most case returns 1 but for example for the vesicle model it is 
- *	(total volume - core volume)/total volume 
- *	(< 1 depending on the thickness).
- * @return: effective radius value
- */
-double MicelleSphCoreModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/multishell.cpp
===================================================================
--- src/sas/models/c_extension/c_models/multishell.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,199 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "multishell.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-typedef struct {
-  double scale;
-  double core_radius;
-  double s_thickness;
-  double w_thickness;
-  double core_sld;
-  double shell_sld;
-  double n_pairs;
-  double background;
-
-} MultiShellParameters;
-
-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;
-}
-double MultiShellModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/onion.cpp
===================================================================
--- src/sas/models/c_extension/c_models/onion.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,679 +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 "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "onion.h"
-
-// Convenience parameter structure
-typedef struct {
-  int n_shells;
-  double scale;
-  double rad_core0;
-  double sld_core0;
-  double sld_solv;
-  double background;
-  double sld_out_shell1;
-  double sld_out_shell2;
-  double sld_out_shell3;
-  double sld_out_shell4;
-  double sld_out_shell5;
-  double sld_out_shell6;
-  double sld_out_shell7;
-  double sld_out_shell8;
-  double sld_out_shell9;
-  double sld_out_shell10;
-  double sld_in_shell1;
-  double sld_in_shell2;
-  double sld_in_shell3;
-  double sld_in_shell4;
-  double sld_in_shell5;
-  double sld_in_shell6;
-  double sld_in_shell7;
-  double sld_in_shell8;
-  double sld_in_shell9;
-  double sld_in_shell10;
-
-  double A_shell1;
-  double A_shell2;
-  double A_shell3;
-  double A_shell4;
-  double A_shell5;
-  double A_shell6;
-  double A_shell7;
-  double A_shell8;
-  double A_shell9;
-  double A_shell10;
-
-  double thick_shell1;
-  double thick_shell2;
-  double thick_shell3;
-  double thick_shell4;
-  double thick_shell5;
-  double thick_shell6;
-  double thick_shell7;
-  double thick_shell8;
-  double thick_shell9;
-  double thick_shell10;
-
-  int func_shell1;
-  int func_shell2;
-  int func_shell3;
-  int func_shell4;
-  int func_shell5;
-  int func_shell6;
-  int func_shell7;
-  int func_shell8;
-  int func_shell9;
-  int func_shell10;
-} OnionParameters;
-
-// some details can be found in sld_cal.c
-static 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);
-}
-
-
-OnionModel :: OnionModel() {
-  n_shells = Parameter(1.0);
-  scale = Parameter(1.0);
-  rad_core0 = Parameter(200.0);
-  rad_core0.set_min(0.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_shell1.set_min(0.0);
-  thick_shell2 = Parameter(50.0);
-  thick_shell2.set_min(0.0);
-  thick_shell3 = Parameter(50.0);
-  thick_shell3.set_min(0.0);
-  thick_shell4 = Parameter(50.0);
-  thick_shell4.set_min(0.0);
-  thick_shell5 = Parameter(50.0);
-  thick_shell5.set_min(0.0);
-  thick_shell6 = Parameter(50.0);
-  thick_shell6.set_min(0.0);
-  thick_shell7 = Parameter(50.0);
-  thick_shell7.set_min(0.0);
-  thick_shell8 = Parameter(50.0);
-  thick_shell8.set_min(0.0);
-  thick_shell9 = Parameter(50.0);
-  thick_shell9.set_min(0.0);
-  thick_shell10 = Parameter(50.0);
-  thick_shell10.set_min(0.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;
-}
-double OnionModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/parallelepiped.cpp
===================================================================
--- src/sas/models/c_extension/c_models/parallelepiped.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,543 +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: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "libmultifunc/libfunc.h"
-}
-#include "parallelepiped.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double short_a;
-    double short_b;
-    double long_c;
-    double sldPipe;
-    double sldSolv;
-    double background;
-    double parallel_theta;
-    double parallel_phi;
-    double parallel_psi;
-    double M0_sld_pipe;
-    double M_theta_pipe;
-    double M_phi_pipe;
-    double M0_sld_solv;
-    double M_theta_solv;
-    double M_phi_solv;
-    double Up_frac_i;
-	double Up_frac_f;
-	double Up_theta;
-} ParallelepipedParameters;
-
-
-static 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 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
- */
-static double parallelepiped_analytical_2D_scaled(ParallelepipedParameters *pars, double q, double q_x, double q_y) {
-  double cparallel_x, cparallel_y, bparallel_x, bparallel_y, parallel_x, parallel_y;
-  //double q_z;
-  double vol, cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC;
-
-  double answer = 0.0;
-  double form = 0.0;
-  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;
-  double sld_solv = pars->sldSolv;
-  double sld_pipe = pars->sldPipe;
-  double m_max = pars->M0_sld_pipe;
-  double m_max_solv = pars->M0_sld_solv;
-  double contrast = 0.0;
-    
-  edgeA = pars->short_a;
-  edgeB = pars->short_b;
-  edgeC = pars->long_c;
-
-
-    // parallelepiped c axis orientation
-    cparallel_x = cos(theta) * cos(phi);
-    cparallel_y = sin(theta);
-    //cparallel_z = -cos(theta) * sin(phi);
-
-    // 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 = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-    parallel_y = sin(psi)*cos(theta);
-	//parallel_z = sin(theta)*sin(phi)*sin(psi)+cos(phi)*cos(psi);
-	
-    cos_val_a = parallel_x*q_x + parallel_y*q_y;
-
-    // parallelepiped b axis orientation
-    bparallel_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-    bparallel_y = cos(theta)*cos(psi);
-    //bparallel_z = sin(theta)*sin(phi)*cos(psi)-sin(psi)*cos(phi);
-    
-    // axis of the parallelepiped
-    cos_val_b = bparallel_x*q_x + bparallel_y*q_y;
-
-    // The following test should always pass
-    if (fabs(cos_val_c)>1.0) {
-      //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-      cos_val_c = 1.0;
-    }
-    if (fabs(cos_val_a)>1.0) {
-      //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-      cos_val_a = 1.0;
-    }
-    if (fabs(cos_val_b)>1.0) {
-      //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-      cos_val_b = 1.0;
-    }
-  // Call the IGOR library function to get the kernel
-  form = pkernel( q*edgeA, q*edgeB, q*edgeC, cos_val_a, cos_val_b, cos_val_c);
-  
-  if (m_max < 1.0e-32 && m_max_solv < 1.0e-32){
-      // Multiply by contrast^2
-      contrast = (pars->sldPipe - pars->sldSolv);
- 	  answer = contrast * contrast * form;
-  }
-  else{
-	  double qx = q_x;
-	  double qy = q_y;
-	  double s_theta = pars->Up_theta;
-	  double m_phi = pars->M_phi_pipe;
-	  double m_theta = pars->M_theta_pipe;
-	  double m_phi_solv = pars->M_phi_solv;
-	  double m_theta_solv = pars->M_theta_solv;
-	  double in_spin = pars->Up_frac_i;
-	  double out_spin = pars->Up_frac_f;
-	  polar_sld p_sld;
-	  polar_sld p_sld_solv;
-	  p_sld = cal_msld(1, qx, qy, sld_pipe, m_max, m_theta, m_phi, 
-	  	 			in_spin, out_spin, s_theta);
-	  p_sld_solv = cal_msld(1, qx, qy, sld_solv, m_max_solv, m_theta_solv, m_phi_solv, 
-			 			in_spin, out_spin, s_theta);
-	  //up_up	
-	  if (in_spin > 0.0 && out_spin > 0.0){			 
-		  answer += ((p_sld.uu- p_sld_solv.uu) * (p_sld.uu- p_sld_solv.uu) * form);
-		  }
-	  //down_down
-	  if (in_spin < 1.0 && out_spin < 1.0){
-		  answer += ((p_sld.dd - p_sld_solv.dd) * (p_sld.dd - p_sld_solv.dd) * form);
-		  }
-	  //up_down
-	  if (in_spin > 0.0 && out_spin < 1.0){
-		  answer += ((p_sld.re_ud - p_sld_solv.re_ud) * (p_sld.re_ud - p_sld_solv.re_ud) * form);
-		  answer += ((p_sld.im_ud - p_sld_solv.im_ud) * (p_sld.im_ud - p_sld_solv.im_ud) * form);
-		  }
-	  //down_up	
-	  if (in_spin < 1.0 && out_spin > 0.0){
-		  answer += ((p_sld.re_du - p_sld_solv.re_du) * (p_sld.re_du - p_sld_solv.re_du) * form);
-		  answer += ((p_sld.im_du - p_sld_solv.im_du) * (p_sld.im_du - p_sld_solv.im_du) * form);
-		  }
-  }
-  
-
-  //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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the parallelepiped
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-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);
-	M0_sld_pipe = Parameter(0.0e-6);
-	M_theta_pipe = Parameter(0.0);
-	M_phi_pipe = Parameter(0.0); 
-	M0_sld_solv = Parameter(0.0e-6);
-	M_theta_solv = Parameter(0.0);
-	M_phi_solv = Parameter(0.0); 
-	Up_frac_i = Parameter(0.5); 
-	Up_frac_f = Parameter(0.5);
-	Up_theta = 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 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();
-	dp.Up_theta =  Up_theta();
-	dp.M_phi_pipe =  M_phi_pipe();
-	dp.M_theta_pipe =  M_theta_pipe();
-	dp.M0_sld_pipe =  M0_sld_pipe();
-	dp.M_phi_solv =  M_phi_solv();
-	dp.M_theta_solv =  M_theta_solv();
-	dp.M0_sld_solv =  M0_sld_solv();
-	dp.Up_frac_i =  Up_frac_i();
-	dp.Up_frac_f =  Up_frac_f();
-
-
-	// 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(cos(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;
-
-}
-double ParallelepipedModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/parameters.cpp
===================================================================
--- src/sas/models/c_extension/c_models/parameters.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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  = 35;
-	width = 0.0;
-	nsigmas = 3;
-};
-
-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 = 3;
-	}
-
-	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  = 35;
-	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  = 80;
-	width = 0.0;
-	nsigmas = 8.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 = 8.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  = 80;
-	width = 0.0;
-	nsigmas = 8.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 = 8.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: c/sas/models/c_extension/c_models/pearlnecklace.cpp
===================================================================
--- src/sas/models/c_extension/c_models/pearlnecklace.cpp	(revision 422e7e87d1b13cc3f1c0d788f448ca9d50f417a8)
+++ 	(revision )
@@ -1,286 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "pearlnecklace.h"
-
-extern "C" {
-#include "libmultifunc/libfunc.h"
-}
-
-static 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 = floor(dp[4]+0.5);  // Force integer number of pearls
-  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);
-}
-
-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;
-
-}
-double PearlNecklaceModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/polygausscoil.cpp
===================================================================
--- src/sas/models/c_extension/c_models/polygausscoil.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "polygausscoil.h"
-
-extern "C" {
-	#include "libTwoPhase.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;
-}
-double Poly_GaussCoil :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/pringles.cpp
===================================================================
--- src/sas/models/c_extension/c_models/pringles.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,351 +1,0 @@
-/**
- * PringlesModel
- *
- * (c) 2013 / Andrew J Jackson / andrew.jackson@esss.se
- *
- * Model for "pringles" particle from K. Edler @ Bath University
- *
- */
-#include <math.h>
-#include "parameters.hh"
-#include "pringles.h"
-#include "cephes.h"
-using namespace std;
-
-extern "C"
-{
-#include "GaussWeights.h"
-#include "libStructureFactor.h"
-}
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double radius;
-    double thickness;
-    double alpha;
-    double beta;
-    double sldCyl;
-    double sldSolv;
-    double background;
-    double cyl_theta;
-    double cyl_phi;
-} PringleParameters;
-
-
-PringlesModel::PringlesModel() {
-	scale = Parameter(1.0);
-	radius = Parameter(60.0,true);
-	radius.set_min(0.0);
-	thickness = Parameter(10.0,true);
-	thickness.set_min(0.0);
-	alpha = Parameter(0.001,true);
-	beta = Parameter(0.02,true);
-	sld_pringle = Parameter(1.0e-6);
-	sld_solvent = Parameter(6.35e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double PringlesModel::operator()(double q) {
-	double dp[8];
-	// Fill parameter array
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = thickness();
-	dp[3] = alpha();
-	dp[4] = beta();
-	dp[5] = sld_pringle();
-	dp[6] = sld_solvent();
-	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 alpha
-	vector<WeightPoint> weights_alpha;
-	alpha.get_weights(weights_alpha);
-
-	// Get the dispersion points for beta
-	vector<WeightPoint> weights_beta;
-	beta.get_weights(weights_beta);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double volnorm = 0.0;
-	double vol = 0.0;
-	double Pi;
-
-	Pi = 4.0 * atan(1.0);
-
-	// Loop over alpha weight points
-	for (size_t i = 0; i < weights_alpha.size(); i++) {
-		dp[3] = weights_alpha[i].value;
-
-		//Loop over beta weight points
-		for (size_t j = 0; j < weights_beta.size(); j++) {
-			dp[4] = weights_beta[j].value;
-
-			// Loop over thickness weight points
-			for (size_t k = 0; k < weights_thick.size(); k++) {
-				dp[2] = weights_thick[k].value;
-
-				// Loop over radius weight points
-				for (size_t l = 0; l < weights_rad.size(); l++) {
-					dp[1] = weights_rad[l].value;
-					sum += weights_rad[l].weight * weights_thick[k].weight
-							* weights_alpha[i].weight * weights_beta[j].weight
-							* pringle_form(dp, q);
-					//Find average volume
-					vol += weights_rad[l].weight * weights_thick[k].weight * Pi * pow(weights_rad[l].value, 2) * weights_thick[k].value;
-					volnorm += weights_rad[l].weight * weights_thick[k].weight;
-					norm +=  weights_rad[l].weight * weights_thick[k].weight * weights_alpha[i].weight * weights_beta[j].weight;
-
-				}
-			}
-		}
-	}
-
-	if (vol > 0.0 && norm > 0.0) {
-		//normalize by avg volume
-		sum = sum * (vol/volnorm);
-		return sum/norm + background();
-	} else {
-		return 0.0;
-	}
-}
-
-/**
- * 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 PringlesModel::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 model
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double PringlesModel::evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double PringlesModel::calculate_ER() {
-	PringleParameters 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_thick;
-	thickness.get_weights(weights_thick);
-
-	// 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_thick.size(); i++) {
-		dp.thickness = weights_thick[i].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			//Note: output of "DiamCyl(dp.thick,dp.radius)" is DIAMETER.
-			sum +=weights_thick[i].weight
-				* weights_radius[k].weight*DiamCyl(dp.thickness,dp.radius)/2.0;
-			norm += weights_thick[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.thickness,dp.radius)/2.0;}
-
-	return rad_out;
-}
-/**
- * Function to calculate particle volume/total volume for shape models:
- *    Most case returns 1 but for example for the vesicle model it is
- *    (total volume - core volume)/total volume
- *    (< 1 depending on the thickness).
- * @return: effective radius value
- */
-double PringlesModel::calculate_VR() {
-	return 1.0;
-}
-
-/*
- * Useful work functions start here!
- *
- */
-
-static double pringle_form(double dp[], double q) {
-
-	double Pi;
-	int nord = 76, i=0;			//order of integration
-	double uplim, lolim;		//upper and lower integration limits
-	double summ, phi, yyy, answer, vcyl;			//running tally of integration
-	double delrho;
-
-	Pi = 4.0 * atan(1.0);
-	lolim = 0.0;
-	uplim = Pi / 2.0;
-
-	summ = 0.0;			//initialize integral
-
-	delrho = dp[5] - dp[6] ; //make contrast term
-
-	for (i = 0; i < nord; i++) {
-		phi = (Gauss76Z[i] * (uplim - lolim) + uplim + lolim) / 2.0;
-		yyy = Gauss76Wt[i] * pringle_kernel(dp, q, phi);
-		summ += yyy;
-	}
-
-	answer = (uplim - lolim) / 2.0 * summ;
-
-	answer *= delrho*delrho;
-
-    //normalize by cylinder volume
-	//vcyl=Pi*dp[1]*dp[1]*dp[2];
-	//answer *= vcyl;
-
-    //convert to [cm-1]
-	answer *= 1.0e8;
-
-    //Scale by volume fraction
-	answer *= dp[0];
-
-	return answer;
-}
-
-static double pringle_kernel(double dp[], double q, double phi) {
-
-	double sumterm, sincarg, sincterm, nn, retval;
-
-	sincarg = q * dp[2] * cos(phi) / 2.0; //dp[2] = thickness
-	sincterm = pow(sin(sincarg) / sincarg, 2.0);
-
-	//calculate sum term from n = -3 to 3
-	sumterm = 0;
-	for (nn = -3; nn <= 3; nn = nn + 1) {
-		sumterm = sumterm
-				+ (pow(pringleC(dp, q, phi, nn), 2.0)
-						+ pow(pringleS(dp, q, phi, nn), 2.0));
-	}
-
-	retval = 4.0 * sin(phi) * sumterm * sincterm;
-
-	return retval;
-
-}
-
-static double pringleC(double dp[], double q, double phi, double n) {
-
-	double nord, va, vb, summ;
-	double bessargs, cosarg, bessargcb;
-	double r, retval, yyy;
-	int ii;
-	// set up the integration
-	// end points and weights
-	nord = 76;
-	va = 0;
-	vb = dp[1]; //radius
-
-	// evaluate at Gauss points
-	// remember to index from 0,size-1
-
-	summ = 0.0;		// initialize integral
-	ii = 0;
-	do {
-		// Using 76 Gauss points
-		r = (Gauss76Z[ii] * (vb - va) + vb + va) / 2.0;
-
-		bessargs = q * r * sin(phi);
-		cosarg = q * r * r * dp[3] * cos(phi);
-		bessargcb = q * r * r * dp[4] * cos(phi);
-
-		yyy = Gauss76Wt[ii] * r * cos(cosarg) * jn(n, bessargcb)
-				* jn(2 * n, bessargs);
-		summ += yyy;
-
-		ii += 1;
-	} while (ii < nord);			// end of loop over quadrature points
-	//
-	// calculate value of integral to return
-
-	retval = (vb - va) / 2.0 * summ;
-
-	retval = retval / pow(r, 2.0);
-
-	return retval;
-}
-
-static double pringleS(double dp[], double q, double phi, double n) {
-
-	double nord, va, vb, summ;
-	double bessargs, sinarg, bessargcb;
-	double r, retval, yyy;
-	int ii;
-	// set up the integration
-	// end points and weights
-	nord = 76;
-	va = 0;
-	vb = dp[1]; //radius
-
-	// evaluate at Gauss points
-	// remember to index from 0,size-1
-
-	summ = 0.0;		// initialize integral
-	ii = 0;
-	do {
-		// Using 76 Gauss points
-		r = (Gauss76Z[ii] * (vb - va) + vb + va) / 2.0;
-
-		bessargs = q * r * sin(phi);
-		sinarg = q * r * r * dp[3] * cos(phi);
-		bessargcb = q * r * r * dp[4] * cos(phi);
-
-		yyy = Gauss76Wt[ii] * r * sin(sinarg) * jn(n, bessargcb)
-				* jn(2 * n, bessargs);
-
-		summ += yyy;
-
-		ii += 1;
-	} while (ii < nord);			// end of loop over quadrature points
-	//
-	// calculate value of integral to return
-
-	retval = (vb - va) / 2.0 * summ;
-
-	retval = retval / pow(r, 2.0);
-
-	return retval;
-}
Index: c/sas/models/c_extension/c_models/raspberry.cpp
===================================================================
--- src/sas/models/c_extension/c_models/raspberry.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,245 +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 "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "raspberry.h"
-
-// scattering
-// Modified from igor model: JHC - May 04, 2012
-//
-// you should write your function to calculate the intensity
-// for a single q-value (that's the input parameter x)
-// based on the wave (array) of parameters that you send it (w)
-// Ref: J. coll. inter. sci. (2010) vol. 343 (1) pp. 36-41.
-//  model calculation
-//
-static double raspberry_func(double dp[], double q){
-	// variables are:							
-	//[0] volume fraction large spheres
-	//[1] radius large sphere (A)
-	//[2] sld large sphere (A-2)
-	//[3] volume fraction small spheres
-	//[4] radius small sphere (A)
-	//[5] fraction of small spheres at surface
-	//[6] sld small sphere
-	//[7] small sphere penetration (A) 
-	//[8] sld solvent
-	//[9] background (cm-1)
-	double vfL, rL, sldL, vfS, rS, sldS, deltaS, delrhoL, delrhoS, bkg, sldSolv, aSs;
-	vfL = dp[0];
-	rL = dp[1];
-	sldL = dp[2];
-	vfS = dp[3];
-	rS = dp[4];
-	aSs = dp[5];
-	sldS = dp[6];
-	deltaS = dp[7];
-	sldSolv = dp[8];
-	bkg = dp[9];
-	
-	delrhoL = fabs(sldL - sldSolv);
-	delrhoS = fabs(sldS - sldSolv);	
-	
-	double VL, VS, Np, f2, fSs;
-	double pi = 4.0*atan(1.0);
-	  
-	VL = 4*pi/3*pow(rL,3.0);
-	VS = 4*pi/3*pow(rS,3.0);
-	Np = aSs*4.0*pow(((rL+deltaS)/rS), 2.0);
-	fSs = Np*vfL*VS/vfS/VL;
-	
-	double rasp_temp[8];
-	rasp_temp[0] = dp[0];
-	rasp_temp[1] = dp[1];
-	rasp_temp[2] = delrhoL;
-	rasp_temp[3] = dp[3];
-	rasp_temp[4] = dp[4];
-	rasp_temp[5] = dp[5];
-	rasp_temp[6] = delrhoS;
-	rasp_temp[7] = dp[7];
-
-	f2 = raspberry_kernel(rasp_temp,q);
-	f2+= vfS*(1.0-fSs)*pow(delrhoS, 2)*VS*rasp_bes(q,rS)*rasp_bes(q,rS);
-	
-	// normalize to single particle volume and convert to 1/cm
-	f2 *= 1.0e8;		// [=] 1/cm
-	
-	return (f2+bkg);	// Scale, then add in the background
-}
-
-double raspberry_kernel(double dp[], double q){
-	// variables are:							
-	//[0] volume fraction large spheres
-	//[1] radius large sphere (A)
-	//[2] sld large sphere (A-2)
-	//[3] volume fraction small spheres
-	//[4] radius small sphere (A)
-	//[5] fraction of small spheres at surface
-	//[6] sld small sphere
-	//[7] small sphere penetration (A) 
-
-	double vfL, rL, vfS, rS, deltaS;
-	double delrhoL, delrhoS, qval, aSs;
-	vfL = dp[0];
-	rL = dp[1];
-	delrhoL = dp[2];
-	vfS = dp[3];
-	rS = dp[4];
-	aSs = dp[5];
-	delrhoS = dp[6];
-	deltaS = dp[7];
-			
-	qval = q;		//rename the input q-value, purely for readability
-	double pi = 4.0*atan(1.0);
-		
-	double psiL,psiS,f2;
-	double sfLS,sfSS;
-	double VL,VS,slT,Np,fSs;
-
-	VL = 4.0*pi/3.0*pow(rL,3.0);
-	VS = 4.0*pi/3.0*pow(rS,3.0);
-
-	Np = aSs*4.0*(rS/(rL+deltaS))*VL/VS; 
-
-	fSs = Np*vfL*VS/vfS/VL;
-
-	slT = delrhoL*VL + Np*delrhoS*VS;
-
-	psiL = rasp_bes(qval,rL);
-	psiS = rasp_bes(qval,rS);
-
-	sfLS = psiL*psiS*(sin(qval*(rL+deltaS*rS))/qval/(rL+deltaS*rS));
-	sfSS = psiS*psiS*pow((sin(qval*(rL+deltaS*rS))/qval/(rL+deltaS*rS)),2);
-		
-	f2 = delrhoL*delrhoL*VL*VL*psiL*psiL; 
-	f2 += Np*delrhoS*delrhoS*VS*VS*psiS*psiS; 
-	f2 += Np*(Np-1)*delrhoS*delrhoS*VS*VS*sfSS; 
-	f2 += 2*Np*delrhoL*delrhoS*VL*VS*sfLS;
-	if (f2 != 0.0){
-		f2 = f2/slT/slT;
-	}
-
-	f2 = f2*(vfL*delrhoL*delrhoL*VL + vfS*fSs*Np*delrhoS*delrhoS*VS);
-
-	return f2;
-}
-
-double rasp_bes(double qval, double rad){
-	double retval;
-	retval = 3.0*(sin(qval*rad)-qval*rad*cos(qval*rad))/(qval*qval*qval)/(rad*rad*rad);
-	return retval;
-}
-
-RaspBerryModel :: RaspBerryModel() {
-	volf_Lsph = Parameter(0.05);
-	radius_Lsph = Parameter(5000.0, true);
-	radius_Lsph.set_min(0.0);
-	sld_Lsph = Parameter(-4.0e-7);
-	volf_Ssph = Parameter(0.005);
-	radius_Ssph = Parameter(100.0, true);
-	radius_Ssph.set_min(0.0);
-	surfrac_Ssph = Parameter(0.4);
-	sld_Ssph = Parameter(3.5e-6);
-	delta_Ssph = Parameter(0.0);
-	sld_solv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double RaspBerryModel :: operator()(double q) {
-	double dp[10];
-	// Add the background after averaging
-	dp[0] = volf_Lsph();
-	dp[1] = radius_Lsph();
-	dp[2] = sld_Lsph();
-	dp[3] = volf_Ssph();
-	dp[4] = radius_Ssph();
-	dp[5] = surfrac_Ssph();
-	dp[6] = sld_Ssph();
-	dp[7] = delta_Ssph();
-	dp[8] = sld_solv();
-	dp[9] = 0.0;
-
-	// Get the dispersion points for the radius_Lsph
-	vector<WeightPoint> weights_radius_Lsph;
-	radius_Lsph.get_weights(weights_radius_Lsph);
-
-	// 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_Lsph weight points
-	for(size_t i=0; i<weights_radius_Lsph.size(); i++) {
-		dp[1] = weights_radius_Lsph[i].value;
-			//Un-normalize by volume
-			sum += weights_radius_Lsph[i].weight
-				* raspberry_func(dp, q);// * pow(weights_radius_Lsph[i].value,3.0);
-			//Find average volume 
-			//vol += weights_radius_Lsph[i].weight
-			//	* pow(weights_radius_Lsph[i].value,3.0);
-			norm += weights_radius_Lsph[i].weight;
-			//norm_vol += weights_radius_Lsph[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 RaspBerryModel :: 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 
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RaspBerryModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double RaspBerryModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double RaspBerryModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/refl.cpp
===================================================================
--- src/sas/models/c_extension/c_models/refl.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,303 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-#include "refl.h"
-using namespace std;
-
-extern "C" {
-#include "libmultifunc/librefl.h"
-}
-
-#define lamda 4.62
-
-static 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;
-
-}
-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;
-}
-double ReflModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/refl_adv.cpp
===================================================================
--- src/sas/models/c_extension/c_models/refl_adv.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,381 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-#include "refl_adv.h"
-
-extern "C" {
-#include "libmultifunc/librefl.h"
-}
-
-using namespace std;
-
-#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;
-
-}
-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;
-}
-double ReflAdvModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/rpa.cpp
===================================================================
--- src/sas/models/c_extension/c_models/rpa.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,542 +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 "parameters.hh"
-#include <stdio.h>
-#include "rpa.h"
-
-using namespace std;
-
-static 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;
-
-}
-
-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;
-}
-double RPAModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/sc.cpp
===================================================================
--- src/sas/models/c_extension/c_models/sc.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,338 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "sc.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-// Convenience structure
-typedef struct {
-  double scale;
-  double dnn;
-  double d_factor;
-  double radius;
-  double sldSph;
-  double sldSolv;
-  double background;
-  double theta;
-  double phi;
-  double psi;
-} SCParameters;
-
-/**
- * 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
- */
-static double sc_analytical_2D_scaled(SCParameters *pars, double q, double q_x, double q_y) {
-  double a3_x, a3_y, a2_x, a2_y, a1_x, a1_y; //, a3_z
-  double q_z;
-  double 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 = cos(theta) * cos(phi);
-  a3_y = sin(theta);
-  //a3_z = -cos(theta) * sin(phi);
-  // 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;
-
-  // a1 axis orientation
-  a1_x = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  a1_y = sin(psi)*cos(theta);
-
-  cos_val_a1 = a1_x*q_x + a1_y*q_y;
-
-  // a2 axis orientation
-  a2_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  a2_y = cos(theta)*cos(psi);
-  // a2 axis
-  cos_val_a2 =  a2_x*q_x + a2_y*q_y;
-
-  // The following test should always pass
-  if (fabs(cos_val_a3)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_a3 = 1.0;
-  }
-   if (fabs(cos_val_a1)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_a1 = 1.0;
-  }
-   if (fabs(cos_val_a2)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_a3 = 1.0;
-  }
-  a3_dot_q = aa*q*cos_val_a3;
-  a1_dot_q = aa*q*cos_val_a1;//*sin(alpha);
-  a2_dot_q = aa*q*cos_val_a2;
-  
-  // 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 *= (1.0-exp(-qDa_2))/(1.0-2.0*exp(-0.5*qDa_2)*cos(a2_dot_q)+exp(-qDa_2));
-  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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-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(cos(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;
-}
-double SCCrystalModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/schulz.cpp
===================================================================
--- src/sas/models/c_extension/c_models/schulz.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,95 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "schulz.h"
-
-#if defined(_MSC_VER)
-#include "gamma_win.h"
-#endif
-
-Schulz :: Schulz() {
-  scale  = Parameter(1.0, true);
-  sigma  = Parameter(1.0, true);
-  center = Parameter(0.0, true);
-}
-
-/**
- * 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 q: q-value
- * @return: function value
- */
-double Schulz :: operator()(double q) {
-  double z = pow(center()/ sigma(), 2)-1;
-  double R= q/center();
-  double zz= z+1;
-  double expo;
-  expo = log(scale())+zz*log(zz)+z*log(R)-R*zz-log(center())-lgamma(zz);
-
-  return exp(expo);//scale * pow(zz,zz) * pow(R,z) * exp(-1*R*zz)/((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 q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double Schulz :: operator()(double qx, double qy) {
-  return (*this).operator()(qx) * (*this).operator()(qy);
-}
-
-/**
- * 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Schulz :: 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 Schulz :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double Schulz :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/sld_cal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/sld_cal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/c_extensions/libmultifunc/librefl.h
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "sld_cal.h"
-
-extern "C" {
-#include "libmultifunc/librefl.h"
-}
-
-// Convenience structure
-typedef struct {
-    double fun_type;
-    double npts_inter;
-    double shell_num;
-    double nu_inter;
-    double sld_left;
-    double sld_right;
-} SLDCalParameters;
-
-/**
- * Function to calculate sld
- * @param pars: parameters
- * @param x: independent param-value
- * @return: sld value
- */
-static 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;
-}
-
-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;
-}
-double SLDCalFunc :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/sphere.cpp
===================================================================
--- src/sas/models/c_extension/c_models/sphere.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,308 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "sphere.h"
-
-extern "C" {
-	#include "libSphere.h"
-	#include "libmultifunc/libfunc.h"
-}
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double radius;
-    double sldSph;
-    double sldSolv;
-    double background;
-    double M0_sld_sph;
-    double M_theta_sph;
-    double M_phi_sph;
-    double M0_sld_solv;
-    double M_theta_solv;
-    double M_phi_solv;
-    double Up_frac_i;
-	double Up_frac_f;
-	double Up_theta;
-} SphereParameters;
-
-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);
-	M0_sld_sph = Parameter(0.0e-6);
-	M_theta_sph = Parameter(0.0);
-	M_phi_sph = Parameter(0.0); 
-	M0_sld_solv = Parameter(0.0e-6);
-	M_theta_solv = Parameter(0.0);
-	M_phi_solv = Parameter(0.0); 
-	Up_frac_i = Parameter(0.5); 
-	Up_frac_f = Parameter(0.5);
-	Up_theta = 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 pars: parameters
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-
-static double sphere_analytical_2D_scaled(SphereParameters *pars, double q, double q_x, double q_y) {
-	double dp[5];
-	//convert angle degree to radian
-	dp[0] = 1.0;
-	dp[1] = pars->radius;
-	dp[2] = 0.0;
-	dp[3] = 0.0;
-	dp[4] = 0.0;
-
-    double sldSph = pars->sldSph;
-    double sldSolv = pars->sldSolv;
-	double answer = 0.0;
-	double m_max = pars->M0_sld_sph;
-	double m_max_solv = pars->M0_sld_solv;
-
-	if (m_max < 1.0e-32 && m_max_solv < 1.0e-32){
-		dp[2] = sldSph;
-		dp[3] = sldSolv;
-		answer = SphereForm(dp, q);
-	}
-	else{
-		//double contrast = sldSph - sldSolv;
-		double qx = q_x;
-		double qy = q_y;
-		double s_theta = pars->Up_theta;
-		double m_phi = pars->M_phi_sph;
-		double m_theta = pars->M_theta_sph;
-		double m_phi_solv = pars->M_phi_solv;
-		double m_theta_solv = pars->M_theta_solv;
-		double in_spin = pars->Up_frac_i;
-		double out_spin = pars->Up_frac_f;
-		polar_sld p_sld;
-		polar_sld p_sld_solv;
-		p_sld = cal_msld(1, qx, qy, sldSph, m_max, m_theta, m_phi, 
-			 				in_spin, out_spin, s_theta);
-		p_sld_solv = cal_msld(1, qx, qy, sldSolv, m_max_solv, m_theta_solv, m_phi_solv, 
-								in_spin, out_spin, s_theta);
-		//up_up	
-		if (in_spin > 0.0 && out_spin > 0.0){			 
-			dp[2] = p_sld.uu;
-			dp[3] = p_sld_solv.uu;
-			answer += SphereForm(dp, q);
-			}
-		//down_down
-		if (in_spin < 1.0 && out_spin < 1.0){
-			dp[2] = p_sld.dd;
-			dp[3] = p_sld_solv.dd;
-			answer += SphereForm(dp, q);
-			}
-		//up_down
-		if (in_spin > 0.0 && out_spin < 1.0){
-			dp[2] = p_sld.re_ud;
-			dp[3] = p_sld_solv.re_ud;
-			answer += SphereForm(dp, q);	
-			dp[2] = p_sld.im_ud;
-			dp[3] = p_sld_solv.im_ud;
-			answer += SphereForm(dp, q);
-			}
-		//down_up	
-		if (in_spin < 1.0 && out_spin > 0.0){
-			dp[2] = p_sld.re_du;
-			dp[3] = p_sld_solv.re_du;
-			answer += SphereForm(dp, q);	
-			dp[2] = p_sld.im_du;
-			dp[3] = p_sld_solv.im_du;
-			answer += SphereForm(dp, q);
-			}
-	}
-	
-	// add in the background
-	answer *= pars->scale;
-	answer += pars->background;
-	return answer;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @return: function value
- */
-static double sphere_analytical_2DXY(SphereParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return sphere_analytical_2D_scaled(pars, q, qx/q, qy/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 SphereModel :: operator()(double qx, double qy) {
-	SphereParameters dp;
-	dp.scale = scale();
-	dp.radius = radius();
-	dp.sldSph = sldSph();
-	dp.sldSolv = sldSolv();
-	dp.background = 0.0;
-	dp.Up_theta =  Up_theta();
-	dp.M_phi_sph =  M_phi_sph();
-	dp.M_theta_sph =  M_theta_sph();
-	dp.M0_sld_sph =  M0_sld_sph();
-	dp.M_phi_solv =  M_phi_solv();
-	dp.M_theta_solv =  M_theta_solv();
-	dp.M0_sld_solv =  M0_sld_solv();
-	dp.Up_frac_i =  Up_frac_i();
-	dp.Up_frac_f =  Up_frac_f();
-
-	// 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.radius = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		sum += weights_rad[i].weight
-			* sphere_analytical_2DXY(&dp, qx, qy) * 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 pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SphereModel :: 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 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;
-}
-double SphereModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/spheresld.cpp
===================================================================
--- src/sas/models/c_extension/c_models/spheresld.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,634 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-
-extern "C" {
-#include "libmultifunc/librefl.h"
-}
-
-#include "spheresld.h"
-
-using namespace std;
-
-// Convenience structure
-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;
-
-
-static double sphere_sld_kernel(double dp[], double q) {
-  int n = dp[0];
-  int i,j,k;
-
-  double scale = dp[1];
-  double thick_inter_core = dp[2];
-  double sld_core = dp[4];
-  double sld_solv = dp[5];
-  double background = dp[6];
-  double npts = dp[57]; //number of sub_layers in each interface
-  double nsl=npts;//21.0; //nsl = Num_sub_layer:  MUST ODD number in double //no other number works now
-  int n_s;
-
-  double sld_i,sld_f,dz,bes,fun,f,vol,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);
-}
-
-
-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;
-
-}
-double SphereSLDModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/spheroid.cpp
===================================================================
--- src/sas/models/c_extension/c_models/spheroid.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,417 +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 "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "spheroid.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double equat_core;
-  double polar_core;
-  double equat_shell;
-  double polar_shell;
-  double sld_core;
-  double sld_shell;
-  double sld_solvent;
-  double background;
-  double axis_theta;
-  double axis_phi;
-
-} SpheroidParameters;
-
-/**
- * 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
- */
-static 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 = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-  //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;
-}
-
-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 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @return: function value
- */
-static 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 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(cos(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;
-}
-double CoreShellEllipsoidModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/spheroidXT.cpp
===================================================================
--- src/sas/models/c_extension/c_models/spheroidXT.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,452 +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
- *
- */
-// RKH 03Apr2014 a re-parametrised CoreShellEllipsoid with core axial ratio X and shell thickness T
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "spheroidXT.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double equat_core;
-  double X_core;
-  double T_shell;
-  double XpolarShell;
-  double sld_core;
-  double sld_shell;
-  double sld_solvent;
-  double background;
-  double axis_theta;
-  double axis_phi;
-
-} SpheroidXTParameters;
-
-/**
- * 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
- */
-static double spheroidXT_analytical_2D_scaled(SpheroidXTParameters *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 = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-  //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.
- // was    answer = gfn4(cos_val,pars->equat_core,pars->polar_core,pars->equat_shell,pars->polar_shell,sldcs,sldss,q);
-  answer = gfn4(cos_val,pars->equat_core,  pars->equat_core*pars->X_core,   pars->equat_core + pars->T_shell,   pars->equat_core*pars->X_core + pars->T_shell*pars->XpolarShell ,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
-  // was vol = 4.0*Pi/3.0*pars->equat_shell*pars->equat_shell*pars->polar_shell;
-  vol = 4.0*Pi/3.0*(pars->equat_core + pars->T_shell)* (pars->equat_core + pars->T_shell) * ( pars->equat_core*pars->X_core + pars->T_shell*pars->XpolarShell);
-  answer /= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-CoreShellEllipsoidXTModel :: CoreShellEllipsoidXTModel() {
-  scale      = Parameter(1.0);
-  equat_core     = Parameter(20.0, true);
-  equat_core.set_min(0.0);
-  X_core     = Parameter(3.0, true);
-  X_core.set_min(0.001);
-  T_shell   = Parameter(30.0, true);
-  T_shell.set_min(0.0);
-  XpolarShell    = Parameter(1.0, true);
-  XpolarShell.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 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @return: function value
- */
-
-static double spheroidXT_analytical_2DXY(SpheroidXTParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return spheroidXT_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellEllipsoidXTModel :: 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[2] = equat_core()*X_core();
-  dp[3] = equat_core() + T_shell();
-  dp[4] = equat_core()*X_core() + T_shell()*XpolarShell();
-  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
-  vector<WeightPoint> weights_X_core;
-  X_core.get_weights(weights_X_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_T_shell;
-  T_shell.get_weights(weights_T_shell);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_XpolarShell;
-  XpolarShell.get_weights(weights_XpolarShell);
-
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-  double wproduct = 0.0;
-
-  // Loop over equat core weight points
-  for(int i=0; i<(int)weights_equat_core.size(); i++) {
-    dp[1] = weights_equat_core[i].value;
-
-    // Loop over polar core weight points
-    for(int j=0; j<(int)weights_X_core.size(); j++) {
-      dp[2] = dp[1]*weights_X_core[j].value;
-
-      // Loop over equat outer weight points
-      for(int k=0; k<(int)weights_T_shell.size(); k++) {
-        dp[3] = dp[1] + weights_T_shell[k].value;
-
-        // Loop over polar outer weight points
-        for(int l=0; l<(int)weights_XpolarShell.size(); l++) {
-          dp[4] = dp[2] + weights_XpolarShell[l].value*weights_T_shell[k].value;
-
-          //Un-normalize  by volume
-          wproduct =weights_equat_core[i].weight* weights_X_core[j].weight * weights_T_shell[k].weight
-                  * weights_XpolarShell[l].weight;
-          sum +=  wproduct * OblateForm(dp, q) * dp[3]*dp[3]*dp[4];
-          //Find average volume
-          vol += wproduct * dp[3]*dp[3]*dp[4];
-          // was pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-          norm += wproduct;
-        }
-      }
-    }
-  }
-  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 CoreShellEllipsoidXTModel :: 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 CoreShellEllipsoidXTModel :: operator()(double qx, double qy) {
-  SpheroidXTParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.equat_core = equat_core();
-  dp.X_core = X_core();
-  dp.T_shell = T_shell();
-  dp.XpolarShell = XpolarShell();
-  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
-  vector<WeightPoint> weights_X_core;
-  X_core.get_weights(weights_X_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_T_shell;
-  T_shell.get_weights(weights_T_shell);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_XpolarShell;
-  XpolarShell.get_weights(weights_XpolarShell);
-
-
-  // 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);
-  double equat_outer = 0.0;
-  double polar_outer = 0.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_X_core.size(); j++) {
-      dp.X_core = weights_X_core[j].value;
-
-      // Loop over equat outer weight points
-      for(int k=0; k< (int)weights_T_shell.size(); k++) {
-        dp.T_shell = weights_T_shell[k].value;
-        equat_outer = weights_equat_core[i].value + weights_T_shell[k].value;
-
-        // Loop over polar outer weight points
-        for(int l=0; l< (int)weights_XpolarShell.size(); l++) {
-          dp.XpolarShell = weights_XpolarShell[l].value;
-          polar_outer = weights_equat_core[i].value*weights_X_core[j].value + weights_T_shell[k].value*weights_XpolarShell[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_X_core[j].weight
-                  * weights_T_shell[k].weight * weights_XpolarShell[l].weight
-                  * weights_theta[m].weight
-                  * weights_phi[n].weight
-                  // rkh NOTE this passes the NEW parameters
-                  * spheroidXT_analytical_2DXY(&dp, qx, qy) * pow(equat_outer,2)*polar_outer;
-              if (weights_theta.size()>1) {
-                _ptvalue *= fabs(cos(weights_theta[m].value*pi/180.0));
-              }
-              sum += _ptvalue;
-              //Find average volume
-              // rkh had to change this, original weighted by outer shell volume weights only, see spheroid.cpp, which looks odd,
-              // (as has to assume that weights of other loops sume to unity) and here we need all four loops to get the outer size.
-              vol += weights_equat_core[i].weight *weights_X_core[j].weight
-                      * weights_T_shell[k].weight * weights_XpolarShell[l].weight
-                      * pow(equat_outer,2)*polar_outer;
-              //Find norm for volume
-              norm_vol += weights_equat_core[i].weight *weights_X_core[j].weight
-                      * weights_T_shell[k].weight * weights_XpolarShell[l].weight;
-
-              norm += weights_equat_core[i].weight *weights_X_core[j].weight
-                  * weights_T_shell[k].weight * weights_XpolarShell[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
- * rkh This now needs to integrate over all four variables as above not just two
- */
-double CoreShellEllipsoidXTModel :: calculate_ER() {
-  SpheroidXTParameters dp;
-
-  dp.equat_core = equat_core();
-  dp.X_core = X_core();
-  dp.T_shell = T_shell();
-  dp.XpolarShell = XpolarShell();
-
-  double rad_out = 0.0;
-  double equat_outer = 0.0;
-  double polar_outer = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the core
-  vector<WeightPoint> weights_equat_core;
-  equat_core.get_weights(weights_equat_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_X_core;
-  X_core.get_weights(weights_X_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_T_shell;
-  T_shell.get_weights(weights_T_shell);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_XpolarShell;
-  XpolarShell.get_weights(weights_XpolarShell);
-
-
-  // Loop over core weight points
-  for(int i=0; i< (int)weights_equat_core.size(); i++) {
-    dp.equat_core = weights_equat_core[i].value;
-    // Loop over weight points
-    for(int j=0; j< (int)weights_X_core.size(); j++) {
-      // Loop over weight points
-      for(int k=0; k< (int)weights_T_shell.size(); k++) {
-        equat_outer = weights_equat_core[i].value + weights_T_shell[k].value;
-        // Loop over polar outer weight points
-        for(int l=0; l< (int)weights_XpolarShell.size(); l++) {
-          polar_outer = weights_equat_core[i].value*weights_X_core[j].value + weights_T_shell[k].value*weights_XpolarShell[l].value;
-        //Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER.
-          sum +=weights_equat_core[i].weight *weights_X_core[j].weight
-                  * weights_T_shell[k].weight * weights_XpolarShell[l].weight*DiamEllip(polar_outer,equat_outer)/2.0;
-          norm += weights_equat_core[i].weight *weights_X_core[j].weight
-                  * weights_T_shell[k].weight * weights_XpolarShell[l].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.equat_core + dp.T_shell, dp.equat_core * dp.X_core + dp.T_shell*dp.XpolarShell)/2.0;}
-
-  return rad_out;
-}
-double CoreShellEllipsoidXTModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/stackeddisks.cpp
===================================================================
--- src/sas/models/c_extension/c_models/stackeddisks.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,396 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "stacked_disks.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double core_thick;
-  double layer_thick;
-  double core_sld;
-  double layer_sld;
-  double solvent_sld;
-  double n_stacking;
-  double sigma_d;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} StackedDisksParameters;
-
-
-/**
- * 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
- */
-static 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;
-  double pi = 4.0*atan(1.0);
-  double theta = pars->axis_theta * pi/180.0;
-  double phi = pars->axis_phi * pi/180.0;
-
-
-  // parallelepiped orientation
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the staked disks
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-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;
-  double pi = 4.0*atan(1.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(cos(weights_theta[l].value*pi/180.0));
-            }
-            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;
-}
-double StackedDisksModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/starpolymer.cpp
===================================================================
--- src/sas/models/c_extension/c_models/starpolymer.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-#include <math.h>
-#include "parameters.hh"
-#include "starpolymer.h"
-
-StarPolymer::StarPolymer() {
- 
-  arms = Parameter(3.0);
-  R2 = Parameter(100.0);
-  scale = Parameter(1.0);
-  background = Parameter(0.0);
-
-}
-
-double StarPolymer::operator()(double q) {
-
-  double d_arms = arms();
-  double d_R2 = R2();
-  double d_scale = scale();
-  double d_background = background();
-
-  double u_2 = d_R2 * pow(q,2);
-  double v = u_2 * d_arms / (3.0 * d_arms - 2.0);
-
-  double term1 = v - 1.0 + exp(-v);
-  double term2 = ((d_arms - 1.0)/2.0)* pow((1.0 - exp(-v)),2.0);
-
-  return 2.0 * d_scale / (d_arms * pow(v,2.0)) * (term1 + term2) + d_background;
-
-}
-
-double StarPolymer::operator()(double qx, double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return this->operator()(q);
-}
-
-double StarPolymer::calculate_ER() {
-  // not implemented yet
-  return 0.0;
-}
-
-double StarPolymer::calculate_VR() {
-  return 1.0;
-}
-
-double StarPolymer::evaluate_rphi(double q, double phi) {
-  double qx = q * cos(phi);
-  double qy = q * sin(phi);
-  return this->operator()(qx, qy);
-}
-
-
Index: c/sas/models/c_extension/c_models/surfacefractal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/surfacefractal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,128 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "surfacefractal.h"
-extern "C" {
-#include "libmultifunc/libfunc.h"
-}
-
-static double surface_fractal_kernel(double dp[], double q) {
-  //fit parameters
-  double scale = dp[0];
-  double radius = dp[1];
-  double surface_dim = dp[2];
-  double co_length = dp[3];
-  double background = dp[4];
-  //others
-  double pq = 0.0;
-  double sq = 0.0;
-  double mmo = 0.0;
-  //result
-  double result = 0.0;
-  if( (q*radius) == 0.0){
-		pq = 1.0;
-  }
-  else{
-	//calculate P(q) for the spherical subunits; not normalized
-	pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2);
-  }
-  mmo = 5.0 - surface_dim;
-
-  //calculate S(q)
-  sq = exp(gamln(mmo))*sin(-(mmo)*atan(q*co_length));
-  sq *= pow(co_length, mmo);
-  sq /= pow((1.0 + (q*co_length)*(q*co_length)),(mmo/2.0));
-  sq /= q;
-  //combine and return
-  result = pq * sq;
-  result *= scale;
-  result += background;
-
-  return(result);
-}
-
-SurfaceFractalModel :: SurfaceFractalModel() {
-  scale      = Parameter(1.0);
-  radius = Parameter(10.0);
-  surface_dim = Parameter(2.0);
-  co_length = Parameter(500.0);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double SurfaceFractalModel :: operator()(double q) {
-  double dp[5];
-
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = surface_dim();
-  dp[3] = co_length();
-  dp[4] = 0.0;
-
-  // Perform the computation
-  double sum = 0.0;
-
-  sum = surface_fractal_kernel(dp, fabs(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 SurfaceFractalModel :: 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 SurfaceFractalModel
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SurfaceFractalModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SurfaceFractalModel :: calculate_ER() {
-  //NOT implemented yet!!! 'cause None shape Model
-  return 0.0;
-}
-double SurfaceFractalModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/teubner_strey.cpp
===================================================================
--- src/sas/models/c_extension/c_models/teubner_strey.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-#include <math.h>
-#include "parameters.hh"
-#include "teubner_strey.h"
-
-TeubnerStreyModel::TeubnerStreyModel() {
-  scale = Parameter(0.1);
-  c1 = Parameter(-30.0);
-  c2 = Parameter(5000.0);
-  background = Parameter(0.0);
-}
-
-double TeubnerStreyModel::operator()(double q) { 
-  double d_scale = scale();
-  double d_c1 = c1();
-  double d_c2 = c2();
-  double d_background = background();
-
-  double term1 = d_c1 * pow(q,2);
-  double term2 = d_c2 * pow(q,4);
-
-  return 1/(d_scale + term1 + term2) + d_background;
-
-}
-
-
-double TeubnerStreyModel::operator()(double qx,double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return this->operator()(q);
-}
-
-double TeubnerStreyModel::calculate_ER() {
-  // not implemented yet
-  return 0.0;
-}
-
-double TeubnerStreyModel::calculate_VR() {
-  return 1.0;
-}
-
-double TeubnerStreyModel::evaluate_rphi(double q,double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return this->operator()(qx, qy);
-}
-
-
-
-/***
-    Notes
-
-    This file was ported from python to C++ at ILL Grenoble in
-    July 2012. In the original python file were two functions,
-    teubnerStreyLengths and teubnerStreyDistance that did not appear
-    to be used anywhere in the code. The source for them is below:
-
-    def teubnerStreyLengths(self):
-        """
-            Calculate the correlation length (L) 
-            @return L: the correlation distance 
-        """
-        return  math.pow( 1/2 * math.pow( (self.params['scale']/self.params['c2']), 1/2 )\
-                            +(self.params['c1']/(4*self.params['c2'])),-1/2 )
-    def teubnerStreyDistance(self):
-        """
-            Calculate the quasi-periodic repeat distance (D/(2*pi)) 
-            @return D: quasi-periodic repeat distance
-        """
-        return  math.pow( 1/2 * math.pow( (self.params['scale']/self.params['c2']), 1/2 )\
-                            -(self.params['c1']/(4*self.params['c2'])),-1/2 )
-
-
-***/
Index: c/sas/models/c_extension/c_models/triaxialellipsoid.cpp
===================================================================
--- src/sas/models/c_extension/c_models/triaxialellipsoid.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,462 +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 "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "triaxial_ellipsoid.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double semi_axisA;
-  double semi_axisB;
-  double semi_axisC;
-  double sldEll;
-  double sldSolv;
-  double background;
-  double axis_theta;
-  double axis_phi;
-  double axis_psi;
-
-} TriaxialEllipsoidParameters;
-
-static double triaxial_ellipsoid_kernel(TriaxialEllipsoidParameters *pars, double q, double cos_val, double cos_nu, double cos_mu) {
-  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*cos_mu*cos_mu+c*c*cos_val*cos_val);
-  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
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double triaxial_ellipsoid_analytical_2D_scaled(TriaxialEllipsoidParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y, ella_x, ella_y, ellb_x, ellb_y;
-  //double q_z;
-  double cos_nu, cos_mu;
-  double 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 = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // 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 of a-axis on the detector plane.
-  ella_x =  -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  ella_y =  sin(psi)*cos(theta);
-  
-  //x- y- component of b-axis on the detector plane.
-  ellb_x =  -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  ellb_y =  cos(theta)*cos(psi);
-  
-  // calculate the axis of the ellipse wrt q-coord.
-  cos_nu = ella_x*q_x + ella_y*q_y;
-  cos_mu = ellb_x*q_x + ellb_y*q_y;
-  
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val = 1.0;
-  }
-   if (fabs(cos_nu)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_nu = 1.0;
-  }
-   if (fabs(cos_mu)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_mu = 1.0;
-  } 
-  // Call the IGOR library function to get the kernel
-  answer = triaxial_ellipsoid_kernel(pars, q, cos_val, cos_nu, cos_mu);
-
-  // 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;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @return: function value
- */
-static 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);
-}
-
-
-
-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(cos(weights_theta[l].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;
-}
-double TriaxialEllipsoidModel :: calculate_VR() {
-  return 1.0;
-}
Index: c/sas/models/c_extension/c_models/vesicle.cpp
===================================================================
--- src/sas/models/c_extension/c_models/vesicle.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,213 +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 "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "vesicle.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double thickness;
-  double solv_sld;
-  double shell_sld;
-  double background;
-} VesicleParameters;
-
-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);
-  solv_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] = solv_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;
-}
-/**
- * Function to calculate volf_ratio for shell
- * @return: volf_ratio value
- */
-double VesicleModel :: calculate_VR() {
-  VesicleParameters dp;
-
-  dp.radius     = radius();
-  dp.thickness  = thickness();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum_tot = 0.0;
-  double sum_shell = 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_tot += weights_thickness[j].weight
-          * weights_radius[k].weight*pow((dp.radius+dp.thickness), 3);
-      sum_shell += weights_thickness[j].weight
-		  * weights_radius[k].weight*(pow((dp.radius+dp.thickness), 3)
-				  - pow((dp.radius), 3));
-    }
-  }
-  if (sum_tot == 0.0){
-    //return the default value
-    rad_out =  1.0;}
-  else{
-    //return ratio value
-    return sum_shell/sum_tot;
-  }
-}
Index: c/sas/models/c_extension/libigor/2Y_OneYukawa.c
===================================================================
--- src/sas/models/c_extension/libigor/2Y_OneYukawa.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,370 +1,0 @@
-/*
- *  Yukawa.c
- *  twoyukawa
- *
- *  Created by Marcus Hennig on 5/12/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-
-#include "2Y_OneYukawa.h"
-#include "2Y_cpoly.h"
-#include "2Y_utility.h"
-#include "2Y_PairCorrelation.h"
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-
-/*
-================================================================================================== 
- 
- Structure factor for the potential 
- 
- V(r) = -kB * T * K * exp[ -Z * (r - 1)] / r for r > 1
- V(r) = inf for r <= 1
- 
- The structure factor is parametrized by (a, b, c, d) 
- which depend on (Z, K, phi).  
- 
-================================================================================================== 
-*/
-
-double Y_sigma( double s, double Z, double a, double b, double c, double d )
-{
-	return -(a / 2. + b + c * exp( -Z )) / s + a * pow( s, -3 ) + b * pow( s, -2 ) + ( c + d ) * pow( s + Z, -1 );
-}
-
-double Y_tau( double s, double Z, double a, double b, double c )
-{
-	return b * pow( s, -2 ) + a * ( pow( s, -3 ) + pow( s, -2 ) ) - pow( s, -1 ) * c * Z * exp( -Z ) * pow( s + Z, -1 );
-} 
-
-double Y_q( double s, double Z, double a, double b, double c, double d )
-{
-	return Y_sigma(s, Z, a, b, c, d ) - exp( -s ) * Y_tau( s, Z, a, b, c );
-}
-
-double Y_g( double s, double phi, double Z, double a, double b, double c, double d )
-{
-	return s * Y_tau( s, Z, a, b, c ) * exp( -s ) / ( 1 - 12 * phi * Y_q( s, Z, a, b, c, d ) );
-}
-
-double Y_hq( double q, double Z, double K, double v )
-{
-	double t1, t2, t3, t4;
-
-	if ( q == 0) 
-	{
-		return (exp(-2*Z)*(v + (v*(-1 + Z) - 2*K*Z)*exp(Z))*(-(v*(1 + Z)) + (v + 2*K*Z*(1 + Z))*exp(Z))*pow(K,-1)*pow(Z,-4))/4.;
-	}
-	else 
-	{
-		
-		t1 = ( 1 - v / ( 2 * K * Z * exp( Z ) ) ) * ( ( 1 - cos( q ) ) / ( q*q ) - 1 / ( Z*Z + q*q ) );
-		t2 = ( v*v * ( q * cos( q ) - Z * sin( q ) ) ) / ( 4 * K * Z*Z * q * ( Z*Z + q*q ) );
-		t3 = ( q * cos( q ) + Z * sin( q ) ) / ( q * ( Z*Z + q*q ) );
-		t4 = v / ( Z * exp( Z ) ) - v*v / ( 4 * K * Z*Z * exp( 2 * Z ) ) - K;
-		
-		return v / Z * t1 - t2 + t3 * t4;
-	}
-}
-
-double Y_pc( double q, 
-			double Z, double K, double phi,
-			double a, double b, double c, double d )
-{	
-	double v = 24 * phi * K * exp( Z ) * Y_g( Z, phi, Z, a, b, c, d );
-	
-	double a0 = a * a;
-	double b0 = -12 * phi *( pow( a + b,2 ) / 2 + a * c * exp( -Z ) );
-	
-	double t1, t2, t3, t4;
-	
-	if ( q == 0 ) 
-	{
-		t1 = a0 / 3;
-		t2 = b0 / 4;
-		t3 = a0 * phi / 12;
-	}
-	else 
-	{
-		t1 = a0 * ( sin( q ) - q * cos( q ) ) / pow( q, 3 );
-		t2 = b0 * ( 2 * q * sin( q ) - ( q * q - 2 ) * cos( q ) - 2 ) / pow( q, 4 );
-		t3 = a0 * phi * ( ( q*q - 6 ) * 4 * q * sin( q ) - ( pow( q, 4 ) - 12 * q*q + 24) * cos( q ) + 24 ) / ( 2 * pow( q, 6 ) );
-	}
-	t4 = Y_hq( q, Z, K, v );
-	return -24 * phi * ( t1 + t2 + t3 + t4 );
-}
-
-double SqOneYukawa( double q, 
-				 double Z, double K, double phi,
-				 double a, double b, double c, double d )
-{
-	//structure factor one-yukawa potential
-	return 1. / ( 1. - Y_pc( q, Z, K, phi, a, b, c, d ) );
-}
-
-
-/*
-================================================================================================== 
-
- The structure factor S(q) for the one-Yukawa potential is parameterized by a,b,c,d which are
- the solution of a system of non-linear equations given Z,K, phi. There are at most 4 solutions 
- from which the physical one is chosen
- 
-================================================================================================== 
- */
-
-double Y_LinearEquation_1( double Z, double K, double phi, double a, double b, double c, double d )
-{
-	return b - 12*phi*(-a/8. - b/6. + d*pow(Z,-2) + c*(pow(Z,-2) - exp(-Z)*(0.5 + (1 + Z)*pow(Z,-2))));
-}
-
-double Y_LinearEquation_2( double Z, double K, double phi, double a, double b, double c, double d )
-{
-	return 1 - a - 12*phi*(-a/3. - b/2. + d*pow(Z,-1) + c*(pow(Z,-1) - (1 + Z)*exp(-Z)*pow(Z,-1)));
-}
-
-double Y_LinearEquation_3( double Z, double K, double phi, double a, double b, double c, double d )
-{
-	return K*exp(Z) - Z*d*(1-12*phi*Y_q(Z, Z, a, b, c, d));
-}
-
-double Y_NonlinearEquation( double Z, double K, double phi, double a, double b, double c, double d )
-{
-	return c + d - 12*phi*((c + d)*Y_sigma(Z, Z, a, b, c, d) - c*exp(-Z)*Y_tau(Z, Z, a, b, c));
-}
-
-// Check the computed solutions satisfy the system of equations 
-int Y_CheckSolution( double Z, double K, double phi, 
-					 double a, double b, double c, double d )
-{
-	double eq_1 = chop( Y_LinearEquation_1 ( Z, K, phi, a, b, c, d ) );
-	double eq_2 = chop( Y_LinearEquation_2 ( Z, K, phi, a, b, c, d ) );
-	double eq_3 = chop( Y_LinearEquation_3 ( Z, K, phi, a, b, c, d ) );
-	double eq_4 = chop( Y_NonlinearEquation( Z, K,  phi, a, b, c, d ) );
-	
-	// check if all equation are zero
-	return eq_1 == 0 && eq_2 == 0 && eq_3 == 0 && eq_4 == 0;
-}
-
-int Y_SolveEquations( double Z, double K, double phi, double* a, double* b, double* c, double* d, int debug )
-{
-	char buf[256];
-
-	// at most there are 4 solutions for a,b,c,d
-	double sol_a[4], sol_b[4], sol_c[4], sol_d[4];
-	
-	double m11 = (3*phi)/2.;
-	double m13 = 6*phi*exp(-Z)*(2 + Z*(2 + Z) - 2*exp(Z))*pow(Z,-2);
-	double m23 = -12*phi*exp(-Z)*(-1 - Z + exp(Z))*pow(Z,-1);
-	double m31 = -6*phi*exp(-Z)*pow(Z,-2)*(2*(1 + Z) + exp(Z)*(-2 + pow(Z,2)));
-	double m32 = -12*phi*(-1 + Z + exp(-Z))*pow(Z,-1);
-	double m33 = 6*phi*exp(-2*Z)*pow(-1 + exp(Z),2);
-	
-	double delta = m23*m31 - m13*m32 + m11*(-4*m13*m31 + (4*m23*m31)/3. + (8*m13*m32)/3. - m23*m32) + m33 + (4*(-3 + m11)*m11*m33)/9.;
-	double a1 = -(K*(m23 + (4*m11*(-3*m13 + m23))/3.)*exp(Z));
-	double a2 = -(m13*(m32 + 4*m11*Z)) + ((3 + 4*m11)*(m33 + m23*Z))/3.;
-	double a3 = -2*phi*pow(Z,-2)*(6*m23*m32 - 24*m11*m33 + 2*Z*((3 + 4*m11)*m33 - 3*m13*(m32 + 2*m11*Z)) + (3 + 4*m11)*m23*pow(Z,2));
-	
-	double b1 = -(K*((-3 + 8*m11)*m13 - 3*m11*m23)*exp(Z))/3.;
-	double b2 = m13*(m31 - Z + (8*m11*Z)/3.) - m11*(m33 + m23*Z);
-	double b3 = 2*phi*pow(Z,-2)*(m13*Z*(-6*m31 + 3*Z - 8*m11*Z) + 2*m33*(3 - 8*m11 + 3*m11*Z) + 3*m23*(2*m31 + m11*pow(Z,2)));
-	
-	double c1 = -(K*exp(Z)*pow(3 - 2*m11,2))/9.;
-	double c2 = -((3 + 4*m11)*m31)/3. + m11*m32 + Z + (4*(-3 + m11)*m11*Z)/9.;
-	double c3 = (-2*phi*pow(Z,-2)*(6*(12*m11*m31 + 3*m32 - 8*m11*m32) - 6*((3 + 4*m11)*m31 - 3*m11*m32)*Z + pow(3 - 2*m11,2)*pow(Z,2)))/3.;
-	
-	// determine d, as roots of the polynomial, from that build a,b,c
-	
-	double real_coefficient[5];
-	double imag_coefficient[5];
-	
-	double real_root[4];
-	double imag_root[4];
-	
-	double zeta = 24*phi*pow(-6*phi*Z*cosh(Z/2.) + (12*phi + (-1 + phi)*pow(Z,2))*sinh(Z/2.),2);	
-	double A[5];
-	int degree,i,j,n_roots;
-	double x,y;
-	int n,selected_root;
-	double qmax,q,dq,min,sum,dr;
-	double *sq,*gr;
-	
-	
-	A[0] = -(exp(3*Z)*pow(K,2)*pow(-1 + phi,2)*pow(Z,3) / zeta );
-	A[1] = K*Z*exp(Z)*(6*phi*(2 + 4*phi + (2 + phi)*Z) + exp(Z)*
-					   ((-24 + Z*(18 + (-6 + Z)*Z))*pow(phi,2) - 2*phi*(6 + (-3 + Z)*pow(Z,2)) + pow(Z,3))) / zeta;
-	A[2] = -12*K*phi*exp(Z)*pow(-1 + phi,2)*pow(Z,3)/zeta;
-	A[3] = 6*phi*Z*exp(-Z)*(-12*phi*(1 + 2*phi)*(-1 + exp(Z)) + 6*phi*Z*(3*phi + (2 + phi)*exp(Z)) + 
-							6*(-1 + phi)*phi*pow(Z,2) + pow(-1 + phi,2)*pow(Z,3))/zeta;
-	A[4] = -36*exp(-Z)*pow(-1 + phi,2)*pow(phi,2)*pow(Z,3)/zeta;
-/*	
-	if ( debug )
-	{
-		sprintf (buf, "(Z,K,phi) = (%g, %g, %g)\r", K, Z, phi );
-		XOPNotice(buf);
-		sprintf (buf, "A = (%g, %g, %g, %g, %g)\r", A[0], A[1], A[2], A[3], A[4] );
-		XOPNotice(buf);
-	}
-*/	
-	//integer degree of polynomial
-	degree = 4;
-	
-	// vector of real and imaginary coefficients in order of decreasing powers
-	for ( i = 0; i <= degree; i++ )
-	{
-		real_coefficient[i] = A[4-i];
-		imag_coefficient[i] = 0.;
-	}
-	
-	// Jenkins-Traub method to approximate the roots of the polynomial
-	cpoly( real_coefficient, imag_coefficient, degree, real_root, imag_root );
-	
-	// show the result if in debug mode
-/*
-	if ( debug )
-	{
-		for ( i = 0; i < degree; i++ )
-		{
-			x = real_root[i];
-			y = imag_root[i];
-			sprintf(buf, "root(%d) = %g + %g i\r", i+1, x, y );
-			XOPNotice(buf);
-		}
-		sprintf(buf, "\r" );
-		XOPNotice(buf);
-	}
- */
-	// determine the set of solutions for a,b,c,d,
-	j = 0;
-	for ( i = 0; i < degree; i++ ) 
-	{
-		x = real_root[i];
-		y = imag_root[i];
-		
-		if ( chop( y ) == 0 ) 
-		{
-			sol_a[j] = ( a1 + a2 * x + a3 * x * x ) / ( delta * x );
-			sol_b[j] = ( b1 + b2 * x + b3 * x * x ) / ( delta * x );
-			sol_c[j] = ( c1 + c2 * x + c3 * x * x ) / ( delta * x );
-			sol_d[j] = x;
-	
-			j++;
-		}
-	}
-
-	// number  remaining roots 
-	n_roots = j;
-	
-//	sprintf(buf, "inside Y_solveEquations OK, before malloc: n_roots = %d\r",n_roots);
-//	XOPNotice(buf);	
-	
-	// if there is still more than one root left, than choose the one with the minimum
-	// average value inside the hardcore
-	
-	
-	
-	if ( n_roots > 1 )
-	{
-		// the number of q values should be a power of 2
-		// in order to speed up the FFT
-		n = 1 << 14;		//= 16384
-		
-		// the maximum q value should be large enough 
-		// to enable a reasoble approximation of g(r)
-		qmax = 1000.;
-		dq = qmax / ( n - 1 );
-		
-		// step size for g(r) = dr
-		
-		// allocate memory for pair correlation function g(r)
-		// and structure factor S(q)
-		// (note that sq and gr are pointers)
-		sq = malloc( sizeof( double ) * n );
-		gr = malloc( sizeof( double ) * n );
-		
-		// loop over all remaining roots
-		min = 1e99;
-		selected_root=0;	
-		
-//		sprintf(buf, "after malloc: n,dq = %d  %g\r",n,dq);
-//		XOPNotice(buf);
-				
-		for ( j = 0; j < n_roots; j++) 
-		{
-			// calculate structure factor at different q values
-			for ( i = 0; i < n ; i++) 
-			{
-				q = dq * i;
-				sq[i] = SqOneYukawa( q, Z, K, phi, sol_a[j], sol_b[j], sol_c[j], sol_d[j] );
-/*				
-				if(i<20 && debug) {
-					sprintf(buf, "after SqOneYukawa: s(q) = %g\r",sq[i] );
-					XOPNotice(buf);	
-				}
- */
-			}
-						
-			// calculate pair correlation function for given
-			// structure factor, g(r) is computed at values
-			// r(i) = i * dr
-			PairCorrelation( phi, dq, sq, &dr, gr, n );
-			
-//			sprintf(buf, "after PairCorrelation: \r");
-//			XOPNotice(buf);
-			
-			// determine sum inside the hardcore 
-			// 0 =< r < 1 of the pair-correlation function
-			sum = 0;
-			for (i = 0; i < floor( 1. / dr ); i++ ) 
-			{
-				sum += fabs( gr[i] );
-/*				
-				if(i<20 && debug) {
-					sprintf(buf, "g(r) in core = %g\r",fabs(gr[i]));
-					XOPNotice(buf);
-				}
- */
-			}
-			
-//			sprintf(buf, "after hard core: sum, min = %g %g\r",sum,min);
-//			XOPNotice(buf);
-			
-			if ( sum < min )
-			{
-				min = sum;
-				selected_root = j;
-			}
-			
-			
-		}	
-		free( gr );
-		free( sq );
-		
-//		sprintf(buf, "after free: selected root = %d\r",selected_root);
-//		XOPNotice(buf);
-		
-		// physical solution was found
-		*a = sol_a[ selected_root ];
-		*b = sol_b[ selected_root ];
-		*c = sol_c[ selected_root ];
-		*d = sol_d[ selected_root ];
-		
-//		sprintf(buf, "after solution found (ret 1): \r");
-//		XOPNotice(buf);
-		
-		return 1;
-	}
-	else if ( n_roots == 1 ) 
-	{
-		*a = sol_a[0];
-		*b = sol_b[0];
-		*c = sol_c[0];
-		*d = sol_d[0];
-		
-		return 1;
-	}
-	// no solution was found
-	return 0;
-}
Index: c/sas/models/c_extension/libigor/2Y_OneYukawa.h
===================================================================
--- src/sas/models/c_extension/libigor/2Y_OneYukawa.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,14 +1,0 @@
-/*
- *  Yukawa.h
- *  twoyukawa
- *
- *  Created by Marcus Hennig on 5/12/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-int Y_CheckSolution( double Z, double K, double phi, double a, double b, double c, double d );
-int Y_SolveEquations( double Z, double K, double phi, 
-					  double* a, double* b, double* c, double* d, int debug );
-double SqOneYukawa( double q, 
-				double Z, double K, double phi,
-				double a, double b, double c, double d );
Index: c/sas/models/c_extension/libigor/2Y_PairCorrelation.c
===================================================================
--- src/sas/models/c_extension/libigor/2Y_PairCorrelation.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,226 +1,0 @@
-/*
- *  PairCorrelation.c
- *  twoyukawa
- *
- *  Created by Marcus Hennig on 5/9/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-
-#include "2Y_PairCorrelation.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-//#include <gsl/gsl_errno.h> 
-//#include <gsl/gsl_fft_real.h>
-
-/*
-=================================================================================================== 
-
- Source: J.B.Hayter: A Program for the fast bi-directional transforms
- between g(r) and S(Q), ILL internal scientific report, October 1979
- 
- The transformation between structure factor and pair correlation 
- function is given by 
- 
- g(x) = 1 + 1 / (12*pi*phi*x) * int( [S(q)-q]*q*sin(q*x), { 0, inf } )
- 
- where phi is the volume frcation, x and q are dimensionless variables, 
- scaled by the radius a of the particles:
- 
- r = x * a;
- Q = q / a
- 
- Discretizing the integral leads to
- 
- x[k] = 2*pi*k / (N * dq)
- g(x[k]) = 1 + N*dq^3 / (24*pi^2*phi*k) * Im{ sum(S[n]*exp(2*pi*i*n*k/N),{n,0,N-1}) }
- 
- where S[n] = n*(S(q[n])-1) with q[n]=n * dq
-
-=================================================================================================== 
-*/
-
-/*
-int PairCorrelation_GSL( double phi, double dq, double* Sq, double* dr, double* gr, int N )
-{
-	double* data = malloc( sizeof(double) * N );
-	int n;
-	for ( n = 0; n < N; n++ )
-		data[n] = n * ( Sq[n] - 1 );
-	
-	// data[k] -> sum( data[n] * exp(-2*pi*i*n*k/N), {n, 0, N-1 })
-	int stride = 1;
-	int error  = gsl_fft_real_radix2_transform( data, stride, N );
-	
-	// if no errors detected 
-	if ( error == GSL_SUCCESS ) 
-	{
-		double alpha = N * pow( dq, 3 ) / ( 24 * M_PI * M_PI * phi );
-	
-	
-		*dr = 2 * M_PI / ( N * dq );  
-		int k;
-		double real, imag;
-		for ( k = 0; k < N; k++ )
-		{
-			// the solutions of the transform is stored in data, 
-			// consult GSL manual for more details
-			if ( k == 0 || k == N / 2)
-			{ 
-				real = data[k];
-				imag = 0;
-			}
-			else if ( k < N / 2 ) 
-			{
-				real = data[k];
-				imag = data[N-k];
-			}
-			else if ( k > N / 2 )
-			{
-				real =  data[N-k];
-				imag = -data[k];	
-			}
-			
-			if ( k == 0 ) 
-				gr[k] = 0;
-			else
-				gr[k] = 1. + alpha / k * (-imag);
-		} 
-	} 
-	// if N is not a power of two
-	else if ( error == GSL_EDOM )
-	{
-		printf( "N is not a power of 2\n" );
-	}
-	else
-	{
-		printf( "Could not perform DFT (discrete fourier transform)\n" );
-	}
-	// release allocated memory
-	free( data );
-	
-	// return error value
-	return error;
-}
- */
-
-
-// this uses numerical recipes for the FFT
-//
-int PairCorrelation( double phi, double dq, double* Sq, double* dr, double* gr, int N )
-{
-	double* data = malloc( sizeof(double) * N * 2);
-	int n,error,k;
-	double alpha,real,imag;
-	double Pi = 3.14159265358979323846264338327950288;   /* pi */
-
-	
-	for ( n = 0; n < N; n++ ) {
-		data[2*n] = n * ( Sq[n] - 1 );
-		data[2*n+1] = 0;
-	}
-	//	printf("start of new fft\n");
-	
-	// data[k] -> sum( data[n] * exp(-2*pi*i*n*k/N), {n, 0, N-1 })
-	//	int error  = gsl_fft_real_radix2_transform( data, stride, N );
-	error  = 1;
-	dfour1( data-1, N, 1 );		//N is the number of complex points
-	
-	//	printf("dfour1 is done\n");
-	
-	// if no errors detected 
-	if ( error == 1 ) 
-	{
-		alpha = N * pow( dq, 3 ) / ( 24 * Pi * Pi * phi );
-		
-		*dr = 2 * Pi / ( N * dq );  
-		for ( k = 0; k < N; k++ )
-		{
-			// the solutions of the transform is stored in data, 
-			// consult GSL manual for more details
-			if ( 2*k == 0 || 2*k == 2*N / 2)
-			{ 
-				real = data[2*k];
-				imag = 0;
-			}
-			else if ( 2*k < 2*N / 2 ) 
-			{
-				real = data[2*k];
-				imag = data[2*k+1];
-			}
-			else if ( 2*k > 2*N / 2 )
-			{
-				real =  data[2*k];
-				imag = -data[2*k+1];	
-			}
-			
-			if ( k == 0 ) 
-				gr[k] = 0;
-			else
-//				gr[k] = 1. + alpha / k * (-imag);		//if using GSL
-				gr[k] = 1. + alpha / k * (imag);		//if using NR
-		} 
-	} 
-	
-	// release allocated memory
-	free( data );
-	
-//	printf(" done with FFT assignment -- Using Numerical Recipes, not GSL\n");
-	
-	// return error value
-	return error;
-}
-
-
-// isign == 1 means no scaling of output. isign == -1 multiplies output by nn
-//
-//
-#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr
-
-void dfour1(double data[], unsigned long nn, int isign)
-{
-	unsigned long n,mmax,m,j,istep,i;
-	double wtemp,wr,wpr,wpi,wi,theta;
-	double tempr,tempi;
-	
-	n=nn << 1;
-	j=1;
-	for (i=1;i<n;i+=2) {
-		if (j > i) {
-			SWAP(data[j],data[i]);
-			SWAP(data[j+1],data[i+1]);
-		}
-		m=n >> 1;
-		while (m >= 2 && j > m) {
-			j -= m;
-			m >>= 1;
-		}
-		j += m;
-	}
-	mmax=2;
-	while (n > mmax) {
-		istep=mmax << 1;
-		theta=isign*(6.28318530717959/mmax);
-		wtemp=sin(0.5*theta);
-		wpr = -2.0*wtemp*wtemp;
-		wpi=sin(theta);
-		wr=1.0;
-		wi=0.0;
-		for (m=1;m<mmax;m+=2) {
-			for (i=m;i<=n;i+=istep) {
-				j=i+mmax;
-				tempr=wr*data[j]-wi*data[j+1];
-				tempi=wr*data[j+1]+wi*data[j];
-				data[j]=data[i]-tempr;
-				data[j+1]=data[i+1]-tempi;
-				data[i] += tempr;
-				data[i+1] += tempi;
-			}
-			wr=(wtemp=wr)*wpr-wi*wpi+wr;
-			wi=wi*wpr+wtemp*wpi+wi;
-		}
-		mmax=istep;
-	}
-}
-#undef SWAP
Index: c/sas/models/c_extension/libigor/2Y_PairCorrelation.h
===================================================================
--- src/sas/models/c_extension/libigor/2Y_PairCorrelation.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,13 +1,0 @@
-/*
- *  PairCorrelation.h
- *  twoyukawa
- *
- *  Created by Marcus Hennig on 5/9/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-
-//int PairCorrelation_GSL( double phi, double dq, double* Sq, double* dr, double* gr, int N );
-int PairCorrelation( double phi, double dq, double* Sq, double* dr, double* gr, int N );
-
-void dfour1(double data[], unsigned long nn, int isign);
Index: c/sas/models/c_extension/libigor/2Y_TwoYukawa.c
===================================================================
--- src/sas/models/c_extension/libigor/2Y_TwoYukawa.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,1113 +1,0 @@
-/*
- *  twoyukawa.c
- *  twoyukawa
- *
- *  Created by Marcus Hennig on 5/7/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-
-#include "2Y_TwoYukawa.h"
-#include "2Y_cpoly.h"
-#include "2Y_utility.h"
-#include "2Y_PairCorrelation.h"
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-
-/*
- ================================================================================================== 
- 
- The two-yukawa structure factor is uniquley determined by 6 parameters a, b, c1, c2, d1, d2,
- which are the solution of a system of 6 equations ( 4 linear, 2 nonlinear ). The solution can 
- constructed by the roots of a polynomial of 22nd degree. For more details see attached 
- Mathematica snotebook, where a derivation is given
- 
- ================================================================================================== 
- */
-
-double TY_q22;
-double TY_qa12, TY_qa21, TY_qa22, TY_qa23, TY_qa32;
-double TY_qb12, TY_qb21, TY_qb22, TY_qb23, TY_qb32;
-double TY_qc112, TY_qc121, TY_qc122, TY_qc123, TY_qc132;
-double TY_qc212, TY_qc221, TY_qc222, TY_qc223, TY_qc232;
-double TY_A12, TY_A21, TY_A22, TY_A23, TY_A32, TY_A41, TY_A42, TY_A43, TY_A52;
-double TY_B12, TY_B14, TY_B21, TY_B22, TY_B23, TY_B24, TY_B25, TY_B32, TY_B34;
-double TY_F14, TY_F16, TY_F18, TY_F23, TY_F24, TY_F25, TY_F26, TY_F27, TY_F28, TY_F29, TY_F32, TY_F33, TY_F34, TY_F35, TY_F36, TY_F37, TY_F38, TY_F39, TY_F310;
-double TY_G13, TY_G14, TY_G15, TY_G16, TY_G17, TY_G18, TY_G19, TY_G110, TY_G111, TY_G112, TY_G113, TY_G22, TY_G23, TY_G24, TY_G25, TY_G26, TY_G27, TY_G28, TY_G29, TY_G210, TY_G211, TY_G212, TY_G213, TY_G214;
-double TY_w[23];
-
-double TY_sigma( double s, 
-				 double Z1, double Z2, 
-			     double a, double b, double c1, double c2, double d1, double d2 )
-{
-	return -(a / 2. + b + c1 * exp( -Z1 ) + c2 * exp( -Z2 )) / s + a * pow( s, -3 ) + b * pow( s, -2 ) + 
-	( c1 + d1 ) * pow( s + Z1, -1 ) + ( c2 + d2 ) * pow( s + Z2, -1 );
-}
-
-double TY_tau( double s, 
-			   double Z1, double Z2, 
-		       double a, double b, double c1, double c2 )
-{
-	return b * pow( s, -2 ) + a * ( pow( s, -3 ) + pow( s, -2 ) ) - pow( s, -1 ) * ( c1 * Z1 * exp( -Z1 ) * 
-																					pow( s + Z1, -1 ) + c2 * Z2 * exp( -Z2 ) * pow( s + Z2, -1 ) );
-} 
-
-double TY_q( double s, 
-			     double Z1, double Z2, 
-			     double a, double b, double c1, double c2, double d1, double d2 )
-{
-	return TY_sigma(s, Z1, Z2, a, b, c1, c2, d1, d2) - exp( -s ) * TY_tau(s, Z1, Z2, a,b, c1, c2);
-}
-
-double TY_g( double s, 
-		     double phi, double Z1, double Z2, 
-		     double a, double b, double c1, double c2, double d1, double d2 )
-{
-	return s * TY_tau( s, Z1, Z2, a, b, c1, c2 ) * exp( -s ) / ( 1 - 12 * phi * TY_q( s, Z1, Z2, a, b, c1, c2, d1, d2 ) );
-}
-
-/*
- ================================================================================================== 
- 
- Structure factor for the potential 
- 
- V(r) = -kB * T * ( K1 * exp[ -Z1 * (r - 1)] / r + K2 * exp[ -Z2 * (r - 1)] / r ) for r > 1
- V(r) = inf for r <= 1
- 
- The structure factor is parametrized by (a, b, c1, c2, d1, d2) 
- which depend on (K1, K2, Z1, Z2, phi).  
- 
- ================================================================================================== 
- */
-
-double TY_hq( double q, double Z, double K, double v )
-{
-	double t1, t2, t3, t4;
-
-	if ( q == 0) 
-	{
-		return (exp(-2*Z)*(v + (v*(-1 + Z) - 2*K*Z)*exp(Z))*(-(v*(1 + Z)) + (v + 2*K*Z*(1 + Z))*exp(Z))*pow(K,-1)*pow(Z,-4))/4.;
-	}
-	else 
-	{
-		
-		t1 = ( 1 - v / ( 2 * K * Z * exp( Z ) ) ) * ( ( 1 - cos( q ) ) / ( q*q ) - 1 / ( Z*Z + q*q ) );
-		t2 = ( v*v * ( q * cos( q ) - Z * sin( q ) ) ) / ( 4 * K * Z*Z * q * ( Z*Z + q*q ) );
-		t3 = ( q * cos( q ) + Z * sin( q ) ) / ( q * ( Z*Z + q*q ) );
-		t4 = v / ( Z * exp( Z ) ) - v*v / ( 4 * K * Z*Z * exp( 2 * Z ) ) - K;
-		
-		return v / Z * t1 - t2 + t3 * t4;
-	}
-}
-
-double TY_pc( double q, 
-			  double Z1, double Z2,double K1, double K2, double phi,
-			  double a, double b, double c1, double c2, double d1, double d2 )
-{	
-	double v1 = 24 * phi * K1 * exp( Z1 ) * TY_g( Z1, phi, Z1, Z2, a, b, c1, c2, d1, d2 );
-	double v2 = 24 * phi * K2 * exp( Z2 ) * TY_g( Z2, phi, Z1, Z2, a, b, c1, c2, d1, d2 );
-	
-	double a0 = a * a;
-	double b0 = -12 * phi *( pow( a + b,2 ) / 2 + a * ( c1 * exp( -Z1 ) + c2 * exp( -Z2 ) ) );
-	
-	double t1, t2, t3,t4;
-	
-	if ( q == 0 ) 
-	{
-		t1 = a0 / 3;
-		t2 = b0 / 4;
-		t3 = a0 * phi / 12;
-	}
-	else 
-	{
-		t1 = a0 * ( sin( q ) - q * cos( q ) ) / pow( q, 3 );
-		t2 = b0 * ( 2 * q * sin( q ) - ( q * q - 2 ) * cos( q ) - 2 ) / pow( q, 4 );
-		t3 = a0 * phi * ( ( q*q - 6 ) * 4 * q * sin( q ) - ( pow( q, 4 ) - 12 * q*q + 24) * cos( q ) + 24 ) / ( 2 * pow( q, 6 ) );
-	}
-	t4 = TY_hq( q, Z1, K1, v1 ) + TY_hq( q, Z2, K2, v2 );
-	return -24 * phi * ( t1 + t2 + t3 + t4 );
-}
-
-double SqTwoYukawa( double q, 
-				    double Z1, double Z2, double K1, double K2, double phi,
-				    double a, double b, double c1, double c2, double d1, double d2 )
-{
-	if ( Z1 == Z2 ) 
-	{
-		// one-yukawa potential
-		return 0;
-	} 
-	else 
-	{
-		// two-yukawa potential
-		return 1. / ( 1. - TY_pc( q, Z1, Z2, K1, K2, phi, a, b, c1, c2, d1, d2 ) );
-	}
-}
-
-/*
-================================================================================================== 
-
- Non-linear eqaution system that determines the parameter for structure factor
-  
-================================================================================================== 
-*/
-
-double TY_LinearEquation_1( double Z1, double Z2, double K1, double K2, double phi, 
-						    double a, double b, double c1, double c2, double d1, double d2 )
-{
-	return b - 12 * phi * ( -a / 8. - b / 6. + d1 * pow( Z1, -2 ) + c1 * ( pow( Z1, -2 )  - exp( -Z1 ) * 
-		    ( 0.5 + ( 1 + Z1 ) * pow( Z1, -2 ) ) ) + d2 * pow( Z2, -2 ) + c2 * ( pow( Z2, -2 ) - exp( -Z2 )
-			* ( 0.5 + ( 1 + Z2 ) * pow( Z2, -2 ) ) ) );
-}
-
-double TY_LinearEquation_2( double Z1, double Z2, double K1, double K2, double phi, 
-							double a, double b, double c1, double c2, double d1, double d2 )
-{
-	return 1 - a - 12 * phi * ( -a / 3. - b / 2. + d1 * pow( Z1, -1 ) + c1 * ( pow( Z1, -1 ) - ( 1 + Z1 ) * 
-		   exp( -Z1 ) * pow( Z1, -1 ) ) + d2 * pow( Z2, -1 ) + c2 * ( pow( Z2, -1 ) - ( 1 + Z2 ) * exp( -Z2 ) * pow( Z2, -1 ) ) );
-}	
-
-double TY_LinearEquation_3( double Z1, double Z2, double K1, double K2, double phi, 
-						    double a, double b, double c1, double c2, double d1, double d2 )
-{								
-	return K1 * exp( Z1 ) - d1 * Z1 * ( 1 - 12 * phi * TY_q( Z1, Z1, Z2, a, b, c1, c2, d1, d2 ) ); 
-}
-
-double TY_LinearEquation_4( double Z1, double Z2, double K1, double K2, double phi, 
-						    double a, double b, double c1, double c2, double d1, double d2 )
-{
-	return K2 * exp( Z2 ) - d2 * Z2 * ( 1 - 12 * phi * TY_q( Z2, Z1, Z2, a, b, c1, c2, d1, d2 ) );
-}
-
-double TY_NonlinearEquation_1( double Z1, double Z2, double K1, double K2, double phi, 
-						       double a, double b, double c1, double c2, double d1, double d2 )
-{
-	return c1 + d1 - 12 * phi * ( ( c1 + d1 ) * TY_sigma( Z1, Z1, Z2, a, b, c1, c2, d1, d2 ) 
-								 - c1 * TY_tau( Z1, Z1, Z2, a, b, c1, c2 ) * exp( -Z1 ) );
-}
-
-double TY_NonlinearEquation_2( double Z1, double Z2, double K1, double K2, double phi, 
-						       double a, double b, double c1, double c2, double d1, double d2 )
-{
-	return c2 + d2 - 12 * phi * ( ( c2 + d2 ) * TY_sigma( Z2, Z1, Z2, a, b, c1, c2, d1, d2 ) 
-								 - c2 * TY_tau( Z2, Z1, Z2, a, b, c1, c2 ) * exp( -Z2 ) );
-}
-
-// Check the computed solutions satisfy the system of equations 
-int TY_CheckSolution( double Z1, double Z2, double K1, double K2, double phi, 
-				      double a, double b, double c1, double c2, double d1, double d2 )
-{
-	double eq_1 = chop( TY_LinearEquation_1( Z1, Z2, K1, K2, phi, a, b, c1, c2, d1, d2 ) );
-	double eq_2 = chop( TY_LinearEquation_2( Z1, Z2, K1, K2, phi, a, b, c1, c2, d1, d2 ) );
-	double eq_3 = chop( TY_LinearEquation_3( Z1, Z2, K1, K2, phi, a, b, c1, c2, d1, d2 ) );
-	double eq_4 = chop( TY_LinearEquation_4( Z1, Z2, K1, K2, phi, a, b, c1, c2, d1, d2 ) );
-	double eq_5 = chop( TY_NonlinearEquation_1( Z1, Z2, K1, K2, phi, a, b, c1, c2, d1, d2 ) );
-	double eq_6 = chop( TY_NonlinearEquation_2( Z1, Z2, K1, K2, phi, a, b, c1, c2, d1, d2 ) );
-	
-	// check if all equation are zero
-	return eq_1 == 0 && eq_2 == 0 && eq_3 == 0 && eq_4 == 0 && eq_5 == 0 && eq_6 == 0;
-}
-
-void TY_ReduceNonlinearSystem( double Z1, double Z2, double K1, double K2, double phi, int debug )
-{
-	/* solution of the 4 linear equations depending on d1 and d2, the solution is polynomial
-	 in d1, d2. We represend the solution as determiants obtained by Cramer's rule
-	 which can be expressed by their coefficient matrices
-	 */
-	char buf[256];
-	
-	double m11 = (3*phi)/2.;
-	double m13 = 6*phi*exp(-Z1)*(2 + Z1*(2 + Z1) - 2*exp(Z1))*pow(Z1,-2);
-	double m14 = 6*phi*exp(-Z2)*(2 + Z2*(2 + Z2) - 2*exp(Z2))*pow(Z2,-2);
-	double m23 = -12*phi*exp(-Z1)*(-1 - Z1 + exp(Z1))*pow(Z1,-1);
-	double m24 = -12*phi*exp(-Z2)*(-1 - Z2 + exp(Z2))*pow(Z2,-1);
-	double m31 = -6*phi*exp(-Z1)*pow(Z1,-2)*(2*(1 + Z1) + exp(Z1)*(-2 + pow(Z1,2)));
-	double m32 = -12*phi*(-1 + Z1 + exp(-Z1))*pow(Z1,-1);
-	double m33 = 6*phi*exp(-2*Z1)*pow(-1 + exp(Z1),2);
-	double m34 = 12*phi*exp(-Z1 - Z2)*(Z2 - (Z1 + Z2)*exp(Z1) + Z1*exp(Z1 + Z2))*pow(Z1 + Z2,-1);
-	double m41 = -6*phi*exp(-Z2)*pow(Z2,-2)*(2*(1 + Z2) + exp(Z2)*(-2 + pow(Z2,2)));
-	double m42 = -12*phi*(-1 + Z2 + exp(-Z2))*pow(Z2,-1);
-	double m43 = 12*phi*exp(-Z1 - Z2)*(Z1 - (Z1 + Z2 - Z2*exp(Z1))*exp(Z2))*pow(Z1 + Z2,-1);	
-	double m44 = 6*phi*exp(-2*Z2)*pow(-1 + exp(Z2),2);
-	
-	/* determinant of the linear system expressed as coefficient matrix in d1, d2 */
-	
-	TY_q22 = m14*(-(m33*m42) + m23*(m32*m41 - m31*m42) + m32*m43 + (4*m11*(-3*m33*m41 + 2*m33*m42 + 3*m31*m43 - 2*m32*m43))/3.) + 
-		  m13*(m34*m42 + m24*(-(m32*m41) + m31*m42) - m32*m44 + (4*m11*(3*m34*m41 - 2*m34*m42 - 3*m31*m44 + 2*m32*m44))/3.) + (3*m24*
-		  (m33*(3*m41 + 4*m11*m41 - 3*m11*m42) + (-3*m31 - 4*m11*m31 + 3*m11*m32)*m43) + 3*m23*(-3*m34*m41 - 4*m11*m34*m41 + 
-		  3*m11*m34*m42 + 3*m31*m44 + 4*m11*m31*m44 - 3*m11*m32*m44) - (m34*m43 - m33*m44)*pow(3 - 2*m11,2))/9.;
-/*	
-	if( debug ) 
-	{
-		sprintf(buf,"\rDet = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t%f\r%f\t%f\r", 0., 0., 0., TY_q22 );
-		XOPNotice(buf);
-	}
-*/
-	
-	/* Matrix representation of the determinant of the of the system where row refering to 
-	 the variable a is replaced by solution vector */
-	
-	TY_qa12 = (K1*(3*m14*(m23*m42 - 4*m11*m43) - 3*m13*(m24*m42 - 4*m11*m44) + (3 + 4*m11)*(m24*m43 - m23*m44))*exp(Z1))/3.;
-	
-	TY_qa21 = -(K2*(3*m14*(m23*m32 - 4*m11*m33) - 3*m13*(m24*m32 - 4*m11*m34) + (3 + 4*m11)*(m24*m33 - m23*m34))*exp(Z2))/3.;
-	
-	TY_qa22 = m14*(-(m23*m42*Z1) + 4*m11*m43*Z1 - m33*(m42 + 4*m11*Z2) + m32*(m43 + m23*Z2)) + 
-		   (3*m13*(m24*m42*Z1 - 4*m11*m44*Z1 + m34*(m42 + 4*m11*Z2) - m32*(m44 + m24*Z2)) + 
-		   (3 + 4*m11)*(-(m24*m43*Z1) + m23*m44*Z1 - m34*(m43 + m23*Z2) + m33*(m44 + m24*Z2)))/3.;	
-	
-	TY_qa23 = 2*phi*pow(Z2,-2)*(m24*(2*(-3*m13*m42 + 3*m43 + 4*m11*m43)*Z1*pow(Z2,2) - m33*(Z1 + Z2)*(6*m42 + (3 + 4*m11)*pow(Z2,2)) + 
-		   3*m32*(Z1 + Z2)*(2*m43 + m13*pow(Z2,2))) + 
-		   m23*(2*(3*m14*m42 - 3*m44 - 4*m11*m44)*Z1*pow(Z2,2) + m34*(Z1 + Z2)*(6*m42 + (3 + 4*m11)*pow(Z2,2)) - 
-		   3*m32*(Z1 + Z2)*(2*m44 + m14*pow(Z2,2))) + 
-		   2*(3*(m14*m33*m42 - m13*m34*m42 - m14*m32*m43 + m34*m43 + m13*m32*m44 - m33*m44)*Z2*(Z1 + Z2) + 
-		   2*m11*(6*(-(m14*m43) + m13*m44)*Z1*pow(Z2,2) + m34*(Z1 + Z2)*(2*m43*(-3 + Z2) - 3*m13*pow(Z2,2)) + 
-		  m33*(Z1 + Z2)*(6*m44 - 2*m44*Z2 + 3*m14*pow(Z2,2)))))*pow(Z1 + Z2,-1);	
-	
-	TY_qa32 = 2*phi*pow(Z1,-2)*(m24*((-3*m13*m42 + (3 + 4*m11)*m43)*(Z1 + Z2)*pow(Z1,2) - 
-		   2*m33*(3*m42*(Z1 + Z2) + (3 + 4*m11)*Z2*pow(Z1,2)) + 6*m32*(m43*(Z1 + Z2) + m13*Z2*pow(Z1,2))) + 
-		   m23*((3*m14*m42 - (3 + 4*m11)*m44)*(Z1 + Z2)*pow(Z1,2) + m34*(6*m42*(Z1 + Z2) + 2*(3 + 4*m11)*Z2*pow(Z1,2)) - 
-		   6*m32*(m44*(Z1 + Z2) + m14*Z2*pow(Z1,2))) + 
-		   2*(3*(m14*m33*m42 - m13*m34*m42 - m14*m32*m43 + m34*m43 + m13*m32*m44 - m33*m44)*Z1*(Z1 + Z2) + 
-		   2*m11*(-3*(m14*m43 - m13*m44)*(Z1 + Z2)*pow(Z1,2) + 2*m34*(m43*(-3 + Z1)*(Z1 + Z2) - 3*m13*Z2*pow(Z1,2)) + 
-		  m33*(-2*m44*(-3 + Z1)*(Z1 + Z2) + 6*m14*Z2*pow(Z1,2)))))*pow(Z1 + Z2,-1);
-/*		
-	if( debug ) 
-	{
-		sprintf(buf,"\rDet_a = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t%f\t%f\r%f\t%f\t%f\r%f\t%f\t%f\r", 
-			   0., TY_qa12, 0., 
-			   TY_qa21, TY_qa22, TY_qa23, 
-			   0.,    TY_qa32, 0. );
-		XOPNotice(buf);
-	}
-*/
-	
-	/* Matrix representation of the determinant of the of the system where row refering to 
-	 the variable b is replaced by solution vector */
-	
-	TY_qb12 = (K1*(-3*m11*m24*m43 + m14*(-3*m23*m41 + (-3 + 8*m11)*m43) + 3*m11*m23*m44 + m13*(3*m24*m41 + 3*m44 - 8*m11*m44))*exp(Z1))/3.;
-	
-	TY_qb21 = (K2*(-3*m13*m24*m31 + 3*m11*m24*m33 + m14*(3*m23*m31 + (3 - 8*m11)*m33) - 3*m13*m34 + 8*m11*m13*m34 - 3*m11*m23*m34)*
-			exp(Z2))/3.;
-	
-	TY_qb22 = m13*(m31*m44 - m24*m41*Z1 - m44*Z1 + (8*m11*m44*Z1)/3. + m24*m31*Z2 + m34*(-m41 + Z2 - (8*m11*Z2)/3.)) + 
-		   m14*(m23*m41*Z1 + m43*Z1 - (8*m11*m43*Z1)/3. + m33*(m41 - Z2 + (8*m11*Z2)/3.) - m31*(m43 + m23*Z2)) + 
-		   m11*(m24*m43*Z1 - m23*m44*Z1 + m34*(m43 + m23*Z2) - m33*(m44 + m24*Z2));	
-	
-	TY_qb23 = 2*phi*(3*m14*m23*m31 - 3*m13*m24*m31 + 3*m14*m33 - 8*m11*m14*m33 + 3*m11*m24*m33 - 3*m13*m34 + 8*m11*m13*m34 - 
-		   3*m11*m23*m34 + 2*(3*m24*(m33*m41 - m31*m43) + m23*(-3*m34*m41 + 3*m31*m44) + (-3 + 8*m11)*(m34*m43 - m33*m44))*
-		   pow(Z2,-2) + 6*(-(m14*m33*m41) + m13*m34*m41 + m14*m31*m43 - m11*m34*m43 - m13*m31*m44 + m11*m33*m44)*pow(Z2,-1) + 
-		   2*(-3*m11*m24*m43 + m14*(-3*m23*m41 + (-3 + 8*m11)*m43) + 3*m11*m23*m44 + m13*(3*m24*m41 + 3*m44 - 8*m11*m44))*Z1*
-		   pow(Z1 + Z2,-1));
-	
-	TY_qb32 = 2*phi*pow(Z1,-2)*(6*(-(m34*(m23*m41 + m43)) + m24*(m33*m41 - m31*m43) + (m23*m31 + m33)*m44) + 
-		   6*(-(m14*m33*m41) + m13*m34*m41 + m14*m31*m43 - m13*m31*m44)*Z1 + 
-		   3*(m14*(2*m23*m31 + 2*m33 - m23*m41 - m43) + m13*(-2*m34 + m24*(-2*m31 + m41) + m44))*pow(Z1,2) + 
-		   (m11*Z2*(16*m34*m43 - 16*m33*m44 - 6*m34*m43*Z1 + 6*m33*m44*Z1 + 
-		   (6*m24*m33 - 3*m24*m43 + 8*m14*(-2*m33 + m43) + (8*m13 - 3*m23)*(2*m34 - m44))*pow(Z1,2)) + 
-		   m11*Z1*(2*m34*m43*(8 - 3*Z1) + 2*m33*m44*(-8 + 3*Z1) + (8*m14*m43 - 3*m24*m43 - 8*m13*m44 + 3*m23*m44)*pow(Z1,2)))*
-		   pow(Z1 + Z2,-1) + 6*(-(m14*(m23*m31 + m33)) + m13*(m24*m31 + m34))*pow(Z1,3)*pow(Z1 + Z2,-1));
-/*		
-	if( debug ) 
-	{
-		sprintf(buf,"\rDet_b = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t%f\t%f\r%f\t%f\t%f\r%f\t%f\t%f\r", 
-			   0., TY_qb12, 0.,
-			   TY_qb21, TY_qb22, TY_qb23,
-			   0., TY_qb32, 0. );
-		XOPNotice(buf);
-	}
-*/
-	
-	/* Matrix representation of the determinant of the of the system where row refering to 
-	 the variable c1 is replaced by solution vector */
-	
-	TY_qc112 = -(K1*exp(Z1)*(9*m24*m41 - 9*m14*m42 + 3*m11*(-12*m14*m41 + 4*m24*m41 + 8*m14*m42 - 3*m24*m42) + m44*pow(3 - 2*m11,2)))/9.;
-	
-	TY_qc121 = (K2*exp(Z2)*(9*m24*m31 - 9*m14*m32 + 3*m11*(-12*m14*m31 + 4*m24*m31 + 8*m14*m32 - 3*m24*m32) + m34*pow(3 - 2*m11,2)))/9.;
-	
-	TY_qc122 = m14*(-4*m11*m41*Z1 - m42*Z1 + (8*m11*m42*Z1)/3. + m32*(-m41 + Z2 - (8*m11*Z2)/3.) + m31*(m42 + 4*m11*Z2)) + 
-			(3*m34*((3 + 4*m11)*m41 - 3*m11*m42) + 9*m11*m32*m44 + 9*m24*m41*Z1 + 12*m11*m24*m41*Z1 - 9*m11*m24*m42*Z1 + 9*m44*Z1 - 
-			12*m11*m44*Z1 + 9*m11*m24*m32*Z2 - 3*(3 + 4*m11)*m31*(m44 + m24*Z2) - m34*Z2*pow(3 - 2*m11,2) + 4*m44*Z1*pow(m11,2))/9.;
-	
-	TY_qc123 = (2*phi*pow(Z2,-2)*(9*(m34*(Z1 + Z2)*(2*m42 + Z2*(-2*m41 + Z2)) - m32*(Z1 + Z2)*(2*m44 + m14*Z2*(-2*m41 + Z2)) - 
-			2*(m14*m42 - m44)*Z2*(-(Z1*Z2) + m31*(Z1 + Z2))) + 4*(-2*m44*Z1 + m34*(Z1 + Z2))*pow(m11,2)*pow(Z2,2) - 
-			3*m24*(2*(3*m41 + 4*m11*m41 - 3*m11*m42)*Z1*pow(Z2,2) + 3*m32*(Z1 + Z2)*(2*m41 + m11*pow(Z2,2)) - 
-			m31*(Z1 + Z2)*(6*m42 + (3 + 4*m11)*pow(Z2,2))) - 
-			6*m11*(-8*m32*m44*Z1 + m32*m44*(-8 + 3*Z1)*Z2 + (3*m32*m44 - 4*(m14*(m32 + 3*m41 - 2*m42) + m44)*Z1)*pow(Z2,2) + 
-			m34*(Z1 + Z2)*(8*m42 + 4*m41*(-3 + Z2) - 3*m42*Z2 + 2*pow(Z2,2)) + 2*m31*(Z1 + Z2)*(6*m44 - 2*m44*Z2 + 3*m14*pow(Z2,2)) - 
-			4*m14*m32*pow(Z2,3)))*pow(Z1 + Z2,-1))/3.;
-	
-	TY_qc132 = (-2*phi*pow(Z1,-2)*(9*((m14*m42 - m44)*(2*m31 - Z1)*Z1*(Z1 + Z2) - 2*m34*(m42*(Z1 + Z2) - Z1*(-(Z1*Z2) + m41*(Z1 + Z2))) + 
-			2*m32*(m44*(Z1 + Z2) - m14*Z1*(-(Z1*Z2) + m41*(Z1 + Z2)))) + 4*(-2*m34*Z2 + m44*(Z1 + Z2))*pow(m11,2)*pow(Z1,2) + 
-			3*m24*(((3 + 4*m11)*m41 - 3*m11*m42)*(Z1 + Z2)*pow(Z1,2) + 6*m32*(m41*(Z1 + Z2) + m11*Z2*pow(Z1,2)) - 
-			2*m31*(3*m42*(Z1 + Z2) + (3 + 4*m11)*Z2*pow(Z1,2))) + 
-			6*m11*(Z1*(-8*m32*m44 + m34*(m42*(8 - 3*Z1) + 4*m41*(-3 + Z1)) - 4*m31*m44*(-3 + Z1) + 3*m32*m44*Z1 - 
-			2*(3*m14*m41 - 2*m14*m42 + m44)*pow(Z1,2)) + 
-			Z2*(4*(3*m31 - 2*m32)*m44 + Z1*(-4*m31*m44 + 3*m32*m44 - 2*(m14*(-6*m31 + 4*m32 + 3*m41 - 2*m42) + m44)*Z1) + 
-			m34*(m42*(8 - 3*Z1) + 4*m41*(-3 + Z1) + 4*pow(Z1,2)))))*pow(Z1 + Z2,-1))/3.;
-/*		
-	if( debug ) 
-	{
-		sprintf(buf,"\rDet_c1 = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t%f\t%f\r%f\t%f\t%f\r%f\t%f\t%f\r", 
-			    0., TY_qc112, 0., 
-			   TY_qc121, TY_qc122, TY_qc123,
-			   0., TY_qc132, 0. );
-		XOPNotice(buf);
-	}
- */
-	/* Matrix representation of the determinant of the of the system where row refering to 
-	 the variable c1 is replaced by solution vector */
-	
-	TY_qc212 = (K1*exp(Z1)*(9*m23*m41 - 9*m13*m42 + 3*m11*(-12*m13*m41 + 4*m23*m41 + 8*m13*m42 - 3*m23*m42) + m43*pow(3 - 2*m11,2)))/9.;
-	
-	TY_qc221 = -(K2*exp(Z2)*(9*m23*m31 - 9*m13*m32 + 3*m11*(-12*m13*m31 + 4*m23*m31 + 8*m13*m32 - 3*m23*m32) + m33*pow(3 - 2*m11,2)))/9.;
-	
-	TY_qc222 = m13*(4*m11*m41*Z1 + m42*Z1 - (8*m11*m42*Z1)/3. + m32*(m41 - Z2 + (8*m11*Z2)/3.) - m31*(m42 + 4*m11*Z2)) + 
-			(9*m31*m43 - 9*(m23*m41 + m43)*Z1 + 9*m23*m31*Z2 + 3*m11*
-			((-4*m23*m41 + 3*m23*m42 + 4*m43)*Z1 + 4*m31*(m43 + m23*Z2) - 3*m32*(m43 + m23*Z2)) + 
-			m33*(-3*(3 + 4*m11)*m41 + 9*m11*m42 + Z2*pow(3 - 2*m11,2)) - 4*m43*Z1*pow(m11,2))/9.;
-	
-	TY_qc223 = (2*phi*pow(Z2,-2)*(9*(-(m33*(Z1 + Z2)*(2*m42 + Z2*(-2*m41 + Z2))) + m32*(Z1 + Z2)*(2*m43 + m13*Z2*(-2*m41 + Z2)) + 
-			2*(m13*m42 - m43)*Z2*(-(Z1*Z2) + m31*(Z1 + Z2))) - 4*(-2*m43*Z1 + m33*(Z1 + Z2))*pow(m11,2)*pow(Z2,2) + 
-			3*m23*(2*(3*m41 + 4*m11*m41 - 3*m11*m42)*Z1*pow(Z2,2) + 3*m32*(Z1 + Z2)*(2*m41 + m11*pow(Z2,2)) - 
-			m31*(Z1 + Z2)*(6*m42 + (3 + 4*m11)*pow(Z2,2))) + 
-			6*m11*(-8*m32*m43*Z1 + m32*m43*(-8 + 3*Z1)*Z2 + (3*m32*m43 - 4*(m13*(m32 + 3*m41 - 2*m42) + m43)*Z1)*pow(Z2,2) + 
-			m33*(Z1 + Z2)*(8*m42 + 4*m41*(-3 + Z2) - 3*m42*Z2 + 2*pow(Z2,2)) + 2*m31*(Z1 + Z2)*(6*m43 - 2*m43*Z2 + 3*m13*pow(Z2,2)) - 
-			4*m13*m32*pow(Z2,3)))*pow(Z1 + Z2,-1))/3.;
-	
-	TY_qc232 = (2*phi*pow(Z1,-2)*(9*((m13*m42 - m43)*(2*m31 - Z1)*Z1*(Z1 + Z2) - 2*m33*(m42*(Z1 + Z2) - Z1*(-(Z1*Z2) + m41*(Z1 + Z2))) + 
-			2*m32*(m43*(Z1 + Z2) - m13*Z1*(-(Z1*Z2) + m41*(Z1 + Z2)))) + 4*(-2*m33*Z2 + m43*(Z1 + Z2))*pow(m11,2)*pow(Z1,2) + 
-			3*m23*(((3 + 4*m11)*m41 - 3*m11*m42)*(Z1 + Z2)*pow(Z1,2) + 6*m32*(m41*(Z1 + Z2) + m11*Z2*pow(Z1,2)) - 
-			2*m31*(3*m42*(Z1 + Z2) + (3 + 4*m11)*Z2*pow(Z1,2))) + 
-			6*m11*(Z1*(-8*m32*m43 + m33*(m42*(8 - 3*Z1) + 4*m41*(-3 + Z1)) - 4*m31*m43*(-3 + Z1) + 3*m32*m43*Z1 - 
-			2*(3*m13*m41 - 2*m13*m42 + m43)*pow(Z1,2)) + 
-			Z2*(4*(3*m31 - 2*m32)*m43 + Z1*(-4*m31*m43 + 3*m32*m43 - 2*(m13*(-6*m31 + 4*m32 + 3*m41 - 2*m42) + m43)*Z1) + 
-			m33*(m42*(8 - 3*Z1) + 4*m41*(-3 + Z1) + 4*pow(Z1,2)))))*pow(Z1 + Z2,-1))/3.;
-/*		
-	if( debug ) 
-	{
-		sprintf(buf,"\rDet_c2 = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t%f\t%f\r%f\t%f\t%f\r%f\t%f\t%f\r", 
-			   0., TY_qc212, 0., 
-			   TY_qc221, TY_qc222, TY_qc223, 
-			   0., TY_qc232, 0. );
-		XOPNotice(buf);
-	}	
-*/
-	
-	/* coefficient matrices of nonlinear equation 1 */
-	
-	TY_A12 = 6*phi*TY_qc112*exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(2*TY_qc212*exp(Z1)*(-Z2 + (Z1 + Z2)*exp(Z1))*pow(Z1,2) + 
-		  exp(Z2)*(exp(2*Z1)*(Z1*(2*TY_qb12*(-1 + Z1)*(Z1 + Z2) - Z1*(2*TY_qc212*Z1 + TY_qc112*(Z1 + Z2))) + TY_qa12*(Z1 + Z2)*(-2 + pow(Z1,2))) - 
-		  TY_qc112*(Z1 + Z2)*pow(Z1,2) + 2*(Z1 + Z2)*exp(Z1)*(TY_qa12 + (TY_qa12 + TY_qb12)*Z1 + TY_qc112*pow(Z1,2))))*pow(Z1 + Z2,-1);
-	
-	TY_A21 = 6*phi*exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(2*(TY_qc121*TY_qc212 + TY_qc112*TY_qc221)*exp(Z1)*(-Z2 + (Z1 + Z2)*exp(Z1))*pow(Z1,2) + 
-		  exp(Z2)*(2*(TY_qa12*TY_qc121 + TY_qa21*TY_qc112*(1 + Z1) + Z1*(TY_qb21*TY_qc112 + TY_qc121*(TY_qa12 + TY_qb12 + 2*TY_qc112*Z1)))*(Z1 + Z2)*exp(Z1) + 
-		  exp(2*Z1)*(2*Z1*(TY_qb21*TY_qc112*(-1 + Z1)*(Z1 + Z2) + TY_qb12*TY_qc121*(-1 + Z1)*(Z1 + Z2) - 
-		  Z1*(TY_qc121*TY_qc212*Z1 + TY_qc112*(TY_qc121 + TY_qc221)*Z1 + TY_qc112*TY_qc121*Z2)) + TY_qa21*TY_qc112*(Z1 + Z2)*(-2 + pow(Z1,2)) + 
-		  TY_qa12*TY_qc121*(Z1 + Z2)*(-2 + pow(Z1,2))) - 2*TY_qc112*TY_qc121*(Z1 + Z2)*pow(Z1,2)))*pow(Z1 + Z2,-1);
-	
-	TY_A22 = exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(12*phi*(TY_qc122*TY_qc212 + TY_qc112*TY_qc222)*exp(Z1)*(-Z2 + (Z1 + Z2)*exp(Z1))*pow(Z1,2) + 
-		  exp(Z2)*(12*phi*(TY_qa12*TY_qc122 + TY_qa22*TY_qc112*(1 + Z1) + Z1*(TY_qb22*TY_qc112 + TY_qc122*(TY_qa12 + TY_qb12 + 2*TY_qc112*Z1)))*(Z1 + Z2)*exp(Z1) - 
-		  2*phi*TY_qc112*TY_qc122*(Z1 + Z2)*pow(Z1,2) + exp(2*Z1)*
-		  (6*phi*(2*Z1*(TY_qb22*TY_qc112*(-1 + Z1)*(Z1 + Z2) + TY_qb12*TY_qc122*(-1 + Z1)*(Z1 + Z2) - 
-		  Z1*(TY_qc122*TY_qc212*Z1 + TY_qc112*(TY_qc122 + TY_qc222)*Z1 + TY_qc112*TY_qc122*Z2)) + TY_qa22*TY_qc112*(Z1 + Z2)*(-2 + pow(Z1,2)) + 
-		  TY_qa12*TY_qc122*(Z1 + Z2)*(-2 + pow(Z1,2))) + TY_q22*TY_qc112*(Z1 + Z2)*pow(Z1,3))))*pow(Z1 + Z2,-1);
-	
-	TY_A23 = 6*phi*exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(2*(TY_qc123*TY_qc212 + TY_qc112*TY_qc223)*exp(Z1)*(-Z2 + (Z1 + Z2)*exp(Z1))*pow(Z1,2) + 
-		  exp(Z2)*(2*(TY_qa12*TY_qc123 + TY_qa23*TY_qc112*(1 + Z1) + Z1*(TY_qb23*TY_qc112 + TY_qc123*(TY_qa12 + TY_qb12 + 2*TY_qc112*Z1)))*(Z1 + Z2)*exp(Z1) + 
-		  exp(2*Z1)*(2*Z1*(TY_qb23*TY_qc112*(-1 + Z1)*(Z1 + Z2) + TY_qb12*TY_qc123*(-1 + Z1)*(Z1 + Z2) - 
-		  Z1*((TY_q22*TY_qc112 + TY_qc123*(TY_qc112 + TY_qc212) + TY_qc112*TY_qc223)*Z1 + TY_qc112*TY_qc123*Z2)) + TY_qa23*TY_qc112*(Z1 + Z2)*(-2 + pow(Z1,2)) + 
-		  TY_qa12*TY_qc123*(Z1 + Z2)*(-2 + pow(Z1,2))) - 2*TY_qc112*TY_qc123*(Z1 + Z2)*pow(Z1,2)))*pow(Z1 + Z2,-1);
-	
-	TY_A32 = exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(12*phi*(TY_qa23*TY_qc121 + TY_qa22*TY_qc122 + TY_qa21*TY_qc123 + TY_qa12*TY_qc132 + TY_qa32*TY_qc112*(1 + Z1) + 
-		  Z1*(TY_qb32*TY_qc112 + (TY_qa23 + TY_qb23)*TY_qc121 + (TY_qa21 + TY_qb21)*TY_qc123 + (TY_qa12 + TY_qb12)*TY_qc132 + TY_q22*TY_qc112*Z1 + 
-		  2*(TY_qc121*TY_qc123 + TY_qc112*TY_qc132)*Z1 + TY_qc122*(TY_qa22 + TY_qb22 + TY_qc122*Z1)))*(Z1 + Z2)*exp(Z1 + Z2) - 
-		  12*phi*(TY_qc132*TY_qc212 + TY_qc123*TY_qc221 + TY_qc122*TY_qc222 + TY_qc121*TY_qc223 + TY_qc112*TY_qc232)*Z2*exp(Z1)*pow(Z1,2) + 
-		  12*phi*((TY_q22 + TY_qc132)*TY_qc212 + TY_qc123*TY_qc221 + TY_qc122*TY_qc222 + TY_qc121*TY_qc223 + TY_qc112*TY_qc232)*(Z1 + Z2)*exp(2*Z1)*pow(Z1,2) - 
-		  6*phi*(Z1 + Z2)*exp(Z2)*(2*TY_qc121*TY_qc123 + 2*TY_qc112*TY_qc132 + pow(TY_qc122,2))*pow(Z1,2) + 
-		  exp(2*Z1 + Z2)*(TY_q22*(6*phi*(2*Z1*(TY_qb12*(-1 + Z1)*(Z1 + Z2) - Z1*((TY_qc112 + TY_qc121 + TY_qc212)*Z1 + TY_qc112*Z2)) + 
-		  TY_qa12*(Z1 + Z2)*(-2 + pow(Z1,2))) + TY_qc122*(Z1 + Z2)*pow(Z1,3)) + 
-		  6*phi*(-2*TY_qa22*TY_qc122*Z1 - 2*TY_qa21*TY_qc123*Z1 - 2*TY_qa12*TY_qc132*Z1 + TY_qa32*TY_qc112*(Z1 + Z2)*(-2 + pow(Z1,2)) + 
-		  TY_qa23*TY_qc121*(Z1 + Z2)*(-2 + pow(Z1,2)) - 2*TY_qb32*TY_qc112*pow(Z1,2) - 2*TY_qb23*TY_qc121*pow(Z1,2) - 2*TY_qb22*TY_qc122*pow(Z1,2) - 
-		  2*TY_qb21*TY_qc123*pow(Z1,2) - 2*TY_qb12*TY_qc132*pow(Z1,2) + 
-		  Z2*(-2*(TY_qa22*TY_qc122 + TY_qa21*TY_qc123 + TY_qa12*TY_qc132) - 2*(TY_qb32*TY_qc112 + TY_qb23*TY_qc121 + TY_qb22*TY_qc122 + TY_qb21*TY_qc123 + TY_qb12*TY_qc132)*Z1 + 
-		  (2*TY_qb32*TY_qc112 + 2*TY_qb23*TY_qc121 + (TY_qa22 + 2*TY_qb22 - TY_qc122)*TY_qc122 + (TY_qa21 + 2*TY_qb21 - 2*TY_qc121)*TY_qc123 + 
-		  (TY_qa12 + 2*TY_qb12 - 2*TY_qc112)*TY_qc132)*pow(Z1,2)) + 2*TY_qb32*TY_qc112*pow(Z1,3) + 2*TY_qb23*TY_qc121*pow(Z1,3) + TY_qa22*TY_qc122*pow(Z1,3) + 
-		  2*TY_qb22*TY_qc122*pow(Z1,3) + TY_qa21*TY_qc123*pow(Z1,3) + 2*TY_qb21*TY_qc123*pow(Z1,3) - 2*TY_qc121*TY_qc123*pow(Z1,3) + TY_qa12*TY_qc132*pow(Z1,3) + 
-		  2*TY_qb12*TY_qc132*pow(Z1,3) - 2*TY_qc112*TY_qc132*pow(Z1,3) - 2*TY_qc132*TY_qc212*pow(Z1,3) - 2*TY_qc123*TY_qc221*pow(Z1,3) - 
-		  2*TY_qc122*TY_qc222*pow(Z1,3) - 2*TY_qc121*TY_qc223*pow(Z1,3) - 2*TY_qc112*TY_qc232*pow(Z1,3) - pow(TY_qc122,2)*pow(Z1,3))))*pow(Z1 + Z2,-1);
-	
-	TY_A41 = 6*phi*exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(2*exp(Z1)*
-		  ((-(TY_qc132*TY_qc221) - TY_qc121*TY_qc232)*Z2 + ((TY_q22 + TY_qc132)*TY_qc221 + TY_qc121*TY_qc232)*(Z1 + Z2)*exp(Z1))*pow(Z1,2) + 
-		  exp(Z2)*(2*(TY_qa21*TY_qc132 + TY_qa32*TY_qc121*(1 + Z1) + Z1*(TY_qb32*TY_qc121 + (TY_qa21 + TY_qb21)*TY_qc132 + TY_qc121*(TY_q22 + 2*TY_qc132)*Z1))*(Z1 + Z2)*
-		  exp(Z1) - 2*TY_qc121*TY_qc132*(Z1 + Z2)*pow(Z1,2) + 
-		  exp(2*Z1)*(Z2*(-2*(TY_qa32*TY_qc121 + TY_qa21*(TY_q22 + TY_qc132)) - 2*(TY_qb32*TY_qc121 + TY_qb21*(TY_q22 + TY_qc132))*Z1 + 
-		  (TY_q22*(TY_qa21 + 2*TY_qb21 - 2*TY_qc121) + TY_qc121*(TY_qa32 + 2*TY_qb32 - 2*TY_qc132) + (TY_qa21 + 2*TY_qb21)*TY_qc132)*pow(Z1,2)) + 
-		  Z1*(-2*(TY_qa32*TY_qc121 + TY_qa21*(TY_q22 + TY_qc132)) - 2*(TY_qb32*TY_qc121 + TY_qb21*(TY_q22 + TY_qc132))*Z1 + 
-		  (TY_qa32*TY_qc121 + 2*TY_qb32*TY_qc121 + TY_qa21*TY_qc132 + 2*TY_qb21*TY_qc132 - 2*TY_qc121*TY_qc132 + TY_q22*(TY_qa21 + 2*TY_qb21 - 2*TY_qc121 - 2*TY_qc221) - 
-		  2*TY_qc132*TY_qc221 - 2*TY_qc121*TY_qc232)*pow(Z1,2)))))*pow(Z1 + Z2,-1);
-	
-	TY_A42 = exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(12*phi*(TY_qa22*TY_qc132 + TY_qa32*TY_qc122*(1 + Z1) + 
-		  Z1*(TY_qb32*TY_qc122 + (TY_qa22 + TY_qb22)*TY_qc132 + TY_qc122*(TY_q22 + 2*TY_qc132)*Z1))*(Z1 + Z2)*exp(Z1 + Z2) - 
-		  12*phi*(TY_qc132*TY_qc222 + TY_qc122*TY_qc232)*Z2*exp(Z1)*pow(Z1,2) + 
-		  12*phi*((TY_q22 + TY_qc132)*TY_qc222 + TY_qc122*TY_qc232)*(Z1 + Z2)*exp(2*Z1)*pow(Z1,2) - 12*phi*TY_qc122*TY_qc132*(Z1 + Z2)*exp(Z2)*pow(Z1,2) + 
-		  exp(2*Z1 + Z2)*(6*phi*(2*Z1*(TY_qb32*TY_qc122*(-1 + Z1)*(Z1 + Z2) + TY_qb22*TY_qc132*(-1 + Z1)*(Z1 + Z2) - 
-		  Z1*(TY_qc132*TY_qc222*Z1 + TY_qc122*(TY_qc132 + TY_qc232)*Z1 + TY_qc122*TY_qc132*Z2)) + TY_qa32*TY_qc122*(Z1 + Z2)*(-2 + pow(Z1,2)) + 
-		  TY_qa22*TY_qc132*(Z1 + Z2)*(-2 + pow(Z1,2))) + (Z1 + Z2)*pow(TY_q22,2)*pow(Z1,3) + 
-		  TY_q22*(6*phi*(2*Z1*(TY_qb22*(-1 + Z1)*(Z1 + Z2) - Z1*((TY_qc122 + TY_qc222)*Z1 + TY_qc122*Z2)) + TY_qa22*(Z1 + Z2)*(-2 + pow(Z1,2))) + 
-		  TY_qc132*(Z1 + Z2)*pow(Z1,3))))*pow(Z1 + Z2,-1);
-	
-	TY_A43 = -6*phi*exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(2*exp(Z1)*
-		  ((TY_qc132*TY_qc223 + TY_qc123*TY_qc232)*Z2 - ((TY_q22 + TY_qc132)*TY_qc223 + TY_qc123*TY_qc232)*(Z1 + Z2)*exp(Z1))*pow(Z1,2) + 
-		  exp(Z2)*(-2*(TY_qa23*TY_qc132 + TY_qa32*TY_qc123*(1 + Z1) + Z1*(TY_qb32*TY_qc123 + (TY_qa23 + TY_qb23)*TY_qc132 + TY_qc123*(TY_q22 + 2*TY_qc132)*Z1))*(Z1 + Z2)*
-		  exp(Z1) + 2*TY_qc123*TY_qc132*(Z1 + Z2)*pow(Z1,2) + 
-		  exp(2*Z1)*(Z2*(2*TY_qa32*TY_qc123 + 2*TY_qa23*(TY_q22 + TY_qc132) + 2*(TY_qb32*TY_qc123 + TY_qb23*(TY_q22 + TY_qc132))*Z1 - 
-		  (TY_q22*(TY_qa23 + 2*TY_qb23 - 2*TY_qc123) + TY_qc123*(TY_qa32 + 2*TY_qb32 - 2*TY_qc132) + (TY_qa23 + 2*TY_qb23)*TY_qc132)*pow(Z1,2)) + 
-		  Z1*(2*TY_qa32*TY_qc123 + 2*TY_qa23*(TY_q22 + TY_qc132) + 2*(TY_qb32*TY_qc123 + TY_qb23*(TY_q22 + TY_qc132))*Z1 + 
-		  (-(TY_qa32*TY_qc123) - (TY_qa23 + 2*TY_qb23)*TY_qc132 + TY_q22*(-TY_qa23 + 2*(-TY_qb23 + TY_qc123 + TY_qc132 + TY_qc223)) + 
-		  2*(-(TY_qb32*TY_qc123) + TY_qc132*(TY_qc123 + TY_qc223) + TY_qc123*TY_qc232) + 2*pow(TY_q22,2))*pow(Z1,2)))))*pow(Z1 + Z2,-1);
-	
-	TY_A52 = -6*phi*exp(-2*Z1 - Z2)*pow(TY_q22,-2)*pow(Z1,-3)*(2*TY_qc232*exp(Z1)*(TY_qc132*Z2 - (TY_q22 + TY_qc132)*(Z1 + Z2)*exp(Z1))*pow(Z1,2) + 
-		  exp(Z2)*((TY_q22 + TY_qc132)*exp(2*Z1)*(Z1*(-2*TY_qb32*(-1 + Z1)*(Z1 + Z2) + Z1*((TY_q22 + TY_qc132 + 2*TY_qc232)*Z1 + (TY_q22 + TY_qc132)*Z2)) - 
-		  TY_qa32*(Z1 + Z2)*(-2 + pow(Z1,2))) + (Z1 + Z2)*pow(TY_qc132,2)*pow(Z1,2) - 
-		  2*TY_qc132*(Z1 + Z2)*exp(Z1)*(TY_qa32 + (TY_qa32 + TY_qb32)*Z1 + (TY_q22 + TY_qc132)*pow(Z1,2))))*pow(Z1 + Z2,-1);
-	
-	// normalize A
-	/*double norm_A = sqrt(pow(TY_A52,2)+pow(TY_A43,2)+pow(TY_A42, 2)+pow(TY_A41, 2)+pow(TY_A32, 2)+
-						 pow(TY_A23,2)+pow(TY_A22,2)+pow(TY_A21, 2)+pow(TY_A12, 2));
-	TY_A12 /= norm_A;
-	TY_A21 /= norm_A;
-	TY_A22 /= norm_A;
-	TY_A23 /= norm_A;
-	TY_A32 /= norm_A;
-	TY_A41 /= norm_A;
-	TY_A42 /= norm_A;
-	TY_A43 /= norm_A;
-	TY_A52 /= norm_A;*/
-/*	
-	if( debug ) 
-	{
-		sprintf(buf,"\rNonlinear equation 1 = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\r", 0.,   TY_A12, 0.   );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\r", TY_A21, TY_A22, TY_A23 );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\r",  0.,  TY_A32, 0.   );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\r", TY_A41, TY_A42, TY_A43 );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\r", 0.,   TY_A52, 0. );		
-		XOPNotice(buf);
-	}
- */
-	
-	/* coefficient matrices of nonlinear equation 2 */
-	
-	TY_B12 = 6*phi*exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*(-2*TY_qc212*TY_qc221*(Z1 + Z2)*exp(Z1)*pow(Z2,2) + 
-		  2*exp(Z2)*((Z1 + Z2)*(TY_qa12*TY_qc221 + TY_qa21*TY_qc212*(1 + Z2) + Z2*(TY_qb21*TY_qc212 + TY_qc221*(TY_qa12 + TY_qb12 + 2*TY_qc212*Z2)))*exp(Z1) + 
-		  (-(TY_qc121*TY_qc212) - TY_qc112*TY_qc221)*Z1*pow(Z2,2)) + 
-		  exp(2*Z2)*(exp(Z1)*(2*Z2*(TY_qb21*TY_qc212*(-1 + Z2)*(Z1 + Z2) + TY_qb12*TY_qc221*(-1 + Z2)*(Z1 + Z2) - 
-		  Z2*(TY_qc212*TY_qc221*Z1 + TY_qc112*TY_qc221*Z2 + TY_qc212*(TY_qc121 + TY_qc221)*Z2)) + TY_qa21*TY_qc212*(Z1 + Z2)*(-2 + pow(Z2,2)) + 
-		  TY_qa12*TY_qc221*(Z1 + Z2)*(-2 + pow(Z2,2))) + 2*(TY_qc121*TY_qc212 + TY_qc112*TY_qc221)*(Z1 + Z2)*pow(Z2,2)))*pow(Z1 + Z2,-1);
-	
-	TY_B14 = 6*phi*exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*(-2*TY_qc212*TY_qc223*(Z1 + Z2)*exp(Z1)*pow(Z2,2) + 
-		  2*exp(Z2)*((Z1 + Z2)*(TY_qa12*TY_qc223 + TY_qa23*TY_qc212*(1 + Z2) + Z2*(TY_qb23*TY_qc212 + (TY_qa12 + TY_qb12)*TY_qc223 + TY_qc212*(TY_q22 + 2*TY_qc223)*Z2))*
-		  exp(Z1) + (-(TY_qc123*TY_qc212) - TY_qc112*TY_qc223)*Z1*pow(Z2,2)) + 
-		  exp(2*Z2)*(2*(TY_qc123*TY_qc212 + TY_qc112*(TY_q22 + TY_qc223))*(Z1 + Z2)*pow(Z2,2) + 
-		  exp(Z1)*(-2*(TY_qa23*TY_qc212 + TY_qa12*(TY_q22 + TY_qc223))*Z1 - 
-		  2*(TY_qa23*TY_qc212 + TY_qa12*(TY_q22 + TY_qc223) + (TY_qb23*TY_qc212 + TY_qb12*(TY_q22 + TY_qc223))*Z1)*Z2 + 
-		  (-2*(TY_qb23*TY_qc212 + TY_qb12*(TY_q22 + TY_qc223)) + (TY_q22*(TY_qa12 + 2*TY_qb12 - 2*TY_qc212) + TY_qc212*(TY_qa23 + 2*TY_qb23 - 2*TY_qc223) + 
-		  (TY_qa12 + 2*TY_qb12)*TY_qc223)*Z1)*pow(Z2,2) + 
-		  (TY_q22*(TY_qa12 + 2*TY_qb12 - 2*TY_qc112 - 2*TY_qc212) + TY_qc212*(TY_qa23 + 2*TY_qb23 - 2*TY_qc123 - 2*TY_qc223) + (TY_qa12 + 2*TY_qb12 - 2*TY_qc112)*TY_qc223)*
-		  pow(Z2,3))))*pow(Z1 + Z2,-1);
-	
-	TY_B21 = 6*phi*TY_qc221*exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*(-(TY_qc221*(Z1 + Z2)*exp(Z1)*pow(Z2,2)) + 
-		  exp(2*Z2)*(exp(Z1)*(Z2*(2*TY_qb21*(-1 + Z2)*(Z1 + Z2) - Z2*(2*TY_qc121*Z2 + TY_qc221*(Z1 + Z2))) + TY_qa21*(Z1 + Z2)*(-2 + pow(Z2,2))) + 
-		  2*TY_qc121*(Z1 + Z2)*pow(Z2,2)) + 2*exp(Z2)*(-(TY_qc121*Z1*pow(Z2,2)) + (Z1 + Z2)*exp(Z1)*(TY_qa21 + (TY_qa21 + TY_qb21)*Z2 + TY_qc221*pow(Z2,2)))
-		  )*pow(Z1 + Z2,-1);
-	
-	TY_B22 = exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*(-12*phi*TY_qc221*TY_qc222*(Z1 + Z2)*exp(Z1)*pow(Z2,2) + 
-		  12*phi*exp(Z2)*((Z1 + Z2)*(TY_qa21*TY_qc222 + TY_qa22*TY_qc221*(1 + Z2) + Z2*(TY_qb22*TY_qc221 + TY_qc222*(TY_qa21 + TY_qb21 + 2*TY_qc221*Z2)))*exp(Z1) + 
-		  (-(TY_qc122*TY_qc221) - TY_qc121*TY_qc222)*Z1*pow(Z2,2)) + 
-		  exp(2*Z2)*(12*phi*(TY_qc122*TY_qc221 + TY_qc121*TY_qc222)*(Z1 + Z2)*pow(Z2,2) + 
-		  exp(Z1)*(6*phi*(2*Z2*(TY_qb22*TY_qc221*(-1 + Z2)*(Z1 + Z2) + TY_qb21*TY_qc222*(-1 + Z2)*(Z1 + Z2) - 
-		  Z2*(TY_qc221*TY_qc222*Z1 + TY_qc121*TY_qc222*Z2 + TY_qc221*(TY_qc122 + TY_qc222)*Z2)) + TY_qa22*TY_qc221*(Z1 + Z2)*(-2 + pow(Z2,2)) + 
-		  TY_qa21*TY_qc222*(Z1 + Z2)*(-2 + pow(Z2,2))) + TY_q22*TY_qc221*(Z1 + Z2)*pow(Z2,3))))*pow(Z1 + Z2,-1);
-	
-	TY_B23 = exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*(-6*phi*(Z1 + Z2)*exp(Z1)*(2*TY_qc221*TY_qc223 + 2*TY_qc212*TY_qc232 + pow(TY_qc222,2))*pow(Z2,2) + 
-		  12*phi*exp(Z2)*((Z1 + Z2)*exp(Z1)*(TY_qa23*TY_qc221 + TY_qa22*TY_qc222 + TY_qa21*TY_qc223 + TY_qa12*TY_qc232 + TY_qa32*TY_qc212*(1 + Z2) + 
-		  Z2*(TY_qb32*TY_qc212 + (TY_qa23 + TY_qb23)*TY_qc221 + (TY_qa22 + TY_qb22)*TY_qc222 + (TY_qa21 + TY_qb21)*TY_qc223 + (TY_qa12 + TY_qb12)*TY_qc232 + 
-		  Z2*(TY_q22*TY_qc221 + 2*TY_qc221*TY_qc223 + 2*TY_qc212*TY_qc232 + pow(TY_qc222,2)))) + 
-		  (-(TY_qc132*TY_qc212) - TY_qc123*TY_qc221 - TY_qc122*TY_qc222 - TY_qc121*TY_qc223 - TY_qc112*TY_qc232)*Z1*pow(Z2,2)) + 
-		  exp(2*Z2)*(12*phi*(TY_qc132*TY_qc212 + TY_qc123*TY_qc221 + TY_qc122*TY_qc222 + TY_qc121*(TY_q22 + TY_qc223) + TY_qc112*TY_qc232)*(Z1 + Z2)*pow(Z2,2) + 
-		  exp(Z1)*(TY_q22*TY_qc222*(Z1 + Z2)*pow(Z2,3) - 6*phi*
-		  (2*(TY_qa32*TY_qc212 + TY_qa23*TY_qc221 + TY_qa22*TY_qc222 + TY_qa21*(TY_q22 + TY_qc223) + TY_qa12*TY_qc232)*Z1 + 
-		  2*(TY_qa32*TY_qc212 + TY_qa23*TY_qc221 + TY_qa22*TY_qc222 + TY_qa21*(TY_q22 + TY_qc223) + TY_qa12*TY_qc232 + 
-		  (TY_qb32*TY_qc212 + TY_qb23*TY_qc221 + TY_qb22*TY_qc222 + TY_qb21*(TY_q22 + TY_qc223) + TY_qb12*TY_qc232)*Z1)*Z2 - 
-		  (-2*(TY_qb32*TY_qc212 + TY_qb23*TY_qc221 + TY_qb22*TY_qc222 + TY_qb21*(TY_q22 + TY_qc223) + TY_qb12*TY_qc232) + 
-		  (TY_q22*(TY_qa21 + 2*TY_qb21 - 2*TY_qc221) + (TY_qa22 + 2*TY_qb22 - TY_qc222)*TY_qc222 + TY_qc221*(TY_qa23 + 2*TY_qb23 - 2*TY_qc223) + TY_qa21*TY_qc223 + 
-		  2*TY_qb21*TY_qc223 + TY_qc212*(TY_qa32 + 2*TY_qb32 - 2*TY_qc232) + TY_qa12*TY_qc232 + 2*TY_qb12*TY_qc232)*Z1)*pow(Z2,2) - 
-		  (TY_q22*(TY_qa21 + 2*TY_qb21 - 2*TY_qc121 - 2*TY_qc212 - 2*TY_qc221) + (TY_qa22 + 2*TY_qb22 - 2*TY_qc122 - TY_qc222)*TY_qc222 + 
-		  TY_qc221*(TY_qa23 + 2*TY_qb23 - 2*TY_qc123 - 2*TY_qc223) + (TY_qa21 + 2*TY_qb21 - 2*TY_qc121)*TY_qc223 + 
-		  TY_qc212*(TY_qa32 + 2*TY_qb32 - 2*TY_qc132 - 2*TY_qc232) + (TY_qa12 + 2*TY_qb12 - 2*TY_qc112)*TY_qc232)*pow(Z2,3)))))*pow(Z1 + Z2,-1);
-	
-	TY_B24 = exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*(12*phi*(Z1 + Z2)*
-		  (TY_qa22*TY_qc223 + TY_qa23*TY_qc222*(1 + Z2) + Z2*(TY_qb23*TY_qc222 + (TY_qa22 + TY_qb22)*TY_qc223 + TY_qc222*(TY_q22 + 2*TY_qc223)*Z2))*exp(Z1 + Z2) - 
-		  12*phi*TY_qc222*TY_qc223*(Z1 + Z2)*exp(Z1)*pow(Z2,2) - 12*phi*(TY_qc123*TY_qc222 + TY_qc122*TY_qc223)*Z1*exp(Z2)*pow(Z2,2) + 
-		  12*phi*(TY_qc123*TY_qc222 + TY_qc122*(TY_q22 + TY_qc223))*(Z1 + Z2)*exp(2*Z2)*pow(Z2,2) + 
-		  exp(Z1 + 2*Z2)*(6*phi*(2*Z2*(TY_qb23*TY_qc222*(-1 + Z2)*(Z1 + Z2) + TY_qb22*TY_qc223*(-1 + Z2)*(Z1 + Z2) - 
-		  Z2*(TY_qc222*TY_qc223*Z1 + TY_qc122*TY_qc223*Z2 + TY_qc222*(TY_qc123 + TY_qc223)*Z2)) + TY_qa23*TY_qc222*(Z1 + Z2)*(-2 + pow(Z2,2)) + 
-		  TY_qa22*TY_qc223*(Z1 + Z2)*(-2 + pow(Z2,2))) + (Z1 + Z2)*pow(TY_q22,2)*pow(Z2,3) + 
-		  TY_q22*(6*phi*(2*Z2*(TY_qb22*(-1 + Z2)*(Z1 + Z2) - Z2*(TY_qc222*Z1 + (TY_qc122 + TY_qc222)*Z2)) + TY_qa22*(Z1 + Z2)*(-2 + pow(Z2,2))) + 
-		  TY_qc223*(Z1 + Z2)*pow(Z2,3))))*pow(Z1 + Z2,-1);
-	
-	TY_B25 = -6*phi*exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*((Z1 + Z2)*exp(Z1)*pow(TY_qc223,2)*pow(Z2,2) + 
-		  (TY_q22 + TY_qc223)*exp(2*Z2)*(exp(Z1)*(Z2*(-2*TY_qb23*(-1 + Z2)*(Z1 + Z2) + Z2*((TY_q22 + TY_qc223)*Z1 + (TY_q22 + 2*TY_qc123 + TY_qc223)*Z2)) - 
-		  TY_qa23*(Z1 + Z2)*(-2 + pow(Z2,2))) - 2*TY_qc123*(Z1 + Z2)*pow(Z2,2)) + 
-		  2*TY_qc223*exp(Z2)*(TY_qc123*Z1*pow(Z2,2) - (Z1 + Z2)*exp(Z1)*(TY_qa23 + (TY_qa23 + TY_qb23)*Z2 + (TY_q22 + TY_qc223)*pow(Z2,2))))*pow(Z1 + Z2,-1);
-	
-	TY_B32 = 6*phi*exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*(-2*TY_qc221*TY_qc232*(Z1 + Z2)*exp(Z1)*pow(Z2,2) + 
-		  2*exp(Z2)*((Z1 + Z2)*(TY_qa21*TY_qc232 + TY_qa32*TY_qc221*(1 + Z2) + Z2*(TY_qb32*TY_qc221 + TY_qc232*(TY_qa21 + TY_qb21 + 2*TY_qc221*Z2)))*exp(Z1) + 
-		  (-(TY_qc132*TY_qc221) - TY_qc121*TY_qc232)*Z1*pow(Z2,2)) + 
-		  exp(2*Z2)*(exp(Z1)*(2*Z2*(TY_qb32*TY_qc221*(-1 + Z2)*(Z1 + Z2) + TY_qb21*TY_qc232*(-1 + Z2)*(Z1 + Z2) - 
-		  Z2*(TY_qc221*TY_qc232*Z1 + TY_qc121*TY_qc232*Z2 + TY_qc221*(TY_q22 + TY_qc132 + TY_qc232)*Z2)) + TY_qa32*TY_qc221*(Z1 + Z2)*(-2 + pow(Z2,2)) + 
-		  TY_qa21*TY_qc232*(Z1 + Z2)*(-2 + pow(Z2,2))) + 2*(TY_qc132*TY_qc221 + TY_qc121*TY_qc232)*(Z1 + Z2)*pow(Z2,2)))*pow(Z1 + Z2,-1);
-	
-	TY_B34 = -6*phi*exp(-Z1 - 2*Z2)*pow(TY_q22,-2)*pow(Z2,-3)*(2*TY_qc223*TY_qc232*(Z1 + Z2)*exp(Z1)*pow(Z2,2) + 
-		  2*exp(Z2)*(-((Z1 + Z2)*(TY_qa23*TY_qc232 + TY_qa32*TY_qc223*(1 + Z2) + Z2*(TY_qb32*TY_qc223 + TY_qc232*(TY_qa23 + TY_qb23 + TY_q22*Z2 + 2*TY_qc223*Z2)))*exp(Z1)) + 
-		  (TY_qc132*TY_qc223 + TY_qc123*TY_qc232)*Z1*pow(Z2,2)) + exp(2*Z2)*
-		  (-2*(TY_qc132*(TY_q22 + TY_qc223) + TY_qc123*TY_qc232)*(Z1 + Z2)*pow(Z2,2) + 
-		  exp(Z1)*(2*(TY_qa32*(TY_q22 + TY_qc223) + TY_qa23*TY_qc232)*Z1 + 
-		  2*(TY_qa32*(TY_q22 + TY_qc223) + TY_qa23*TY_qc232 + (TY_qb32*(TY_q22 + TY_qc223) + TY_qb23*TY_qc232)*Z1)*Z2 - 
-		  (-2*(TY_qb32*(TY_q22 + TY_qc223) + TY_qb23*TY_qc232) + ((TY_qa32 + 2*TY_qb32)*(TY_q22 + TY_qc223) + (-2*TY_q22 + TY_qa23 + 2*TY_qb23 - 2*TY_qc223)*TY_qc232)*Z1)*
-		  pow(Z2,2) + ((2*TY_q22 - TY_qa32 - 2*TY_qb32 + 2*TY_qc132)*(TY_q22 + TY_qc223) + (2*TY_q22 - TY_qa23 + 2*(-TY_qb23 + TY_qc123 + TY_qc223))*TY_qc232)*pow(Z2,3))))*pow(Z1 + Z2,-1);
-	
-	/*double norm_B = sqrt(pow(TY_B12, 2)+pow(TY_B14, 2)+pow(TY_B21, 2)+pow(TY_B22, 2)+pow(TY_B23, 2)+pow(TY_B24, 2)+pow(TY_B25, 2)+pow(TY_B32, 2)+pow(TY_B34, 2));
-	
-	TY_B12 /= norm_B;
-	TY_B14 /= norm_B;
-	TY_B21 /= norm_B;
-	TY_B22 /= norm_B;
-	TY_B23 /= norm_B;
-	TY_B24 /= norm_B;
-	TY_B25 /= norm_B;
-	TY_B32 /= norm_B;
-	TY_B34 /= norm_B; */
-/*	
-	if( debug ) 
-	{
-		sprintf(buf,"\rNonlinear equation 2 = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\t\t%f\t\t%f\r", 0.,  TY_B12, 0.,  TY_B14, 0.  );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\t\t%f\t\t%f\r", TY_B21, TY_B22, TY_B23, TY_B24, TY_B25 );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\t\t%f\t\t%f\r", 0.,  TY_B32, 0.,  TY_B34, 0.  );
-		XOPNotice(buf);
-	}
-*/
-	
-	/* decrease order of nonlinear equation 1 by means of equation 2 */
-	
-	TY_F14 = -(TY_A32*TY_B12*TY_B32) + TY_A52*pow(TY_B12,2) + TY_A12*pow(TY_B32,2);
-	TY_F16 = 2*TY_A52*TY_B12*TY_B14 - TY_A32*TY_B14*TY_B32 - TY_A32*TY_B12*TY_B34 + 2*TY_A12*TY_B32*TY_B34;
-	TY_F18 = -(TY_A32*TY_B14*TY_B34) + TY_A52*pow(TY_B14,2) + TY_A12*pow(TY_B34,2);
-	TY_F23 = 2*TY_A52*TY_B12*TY_B21 - TY_A41*TY_B12*TY_B32 - TY_A32*TY_B21*TY_B32 + TY_A21*pow(TY_B32,2);
-	TY_F24 = 2*TY_A52*TY_B12*TY_B22 - TY_A42*TY_B12*TY_B32 - TY_A32*TY_B22*TY_B32 + TY_A22*pow(TY_B32,2);
-	TY_F25 = 2*TY_A52*TY_B14*TY_B21 + 2*TY_A52*TY_B12*TY_B23 - TY_A43*TY_B12*TY_B32 - TY_A41*TY_B14*TY_B32 - TY_A32*TY_B23*TY_B32 - TY_A41*TY_B12*TY_B34 - TY_A32*TY_B21*TY_B34 + 2*TY_A21*TY_B32*TY_B34 + TY_A23*pow(TY_B32,2);
-	TY_F26 = 2*TY_A52*TY_B14*TY_B22 + 2*TY_A52*TY_B12*TY_B24 - TY_A42*TY_B14*TY_B32 - TY_A32*TY_B24*TY_B32 - TY_A42*TY_B12*TY_B34 - TY_A32*TY_B22*TY_B34 + 2*TY_A22*TY_B32*TY_B34;
-	TY_F27 = 2*TY_A52*TY_B14*TY_B23 + 2*TY_A52*TY_B12*TY_B25 - TY_A43*TY_B14*TY_B32 - TY_A32*TY_B25*TY_B32 - TY_A43*TY_B12*TY_B34 - TY_A41*TY_B14*TY_B34 - TY_A32*TY_B23*TY_B34 + 2*TY_A23*TY_B32*TY_B34 + TY_A21*pow(TY_B34,2);
-	TY_F28 = 2*TY_A52*TY_B14*TY_B24 - TY_A42*TY_B14*TY_B34 - TY_A32*TY_B24*TY_B34 + TY_A22*pow(TY_B34,2);
-	TY_F29 = 2*TY_A52*TY_B14*TY_B25 - TY_A43*TY_B14*TY_B34 - TY_A32*TY_B25*TY_B34 + TY_A23*pow(TY_B34,2);
-	TY_F32 = -(TY_A41*TY_B21*TY_B32) + TY_A52*pow(TY_B21,2);
-	TY_F33 = 2*TY_A52*TY_B21*TY_B22 - TY_A42*TY_B21*TY_B32 - TY_A41*TY_B22*TY_B32;
-	TY_F34 = 2*TY_A52*TY_B21*TY_B23 - TY_A43*TY_B21*TY_B32 - TY_A42*TY_B22*TY_B32 - TY_A41*TY_B23*TY_B32 - TY_A41*TY_B21*TY_B34 + TY_A52*pow(TY_B22,2);
-	TY_F35 = 2*TY_A52*TY_B22*TY_B23 + 2*TY_A52*TY_B21*TY_B24 - TY_A43*TY_B22*TY_B32 - TY_A42*TY_B23*TY_B32 - TY_A41*TY_B24*TY_B32 - TY_A42*TY_B21*TY_B34 - TY_A41*TY_B22*TY_B34;
-	TY_F36 = 2*TY_A52*TY_B22*TY_B24 + 2*TY_A52*TY_B21*TY_B25 - TY_A43*TY_B23*TY_B32 - TY_A42*TY_B24*TY_B32 - TY_A41*TY_B25*TY_B32 - TY_A43*TY_B21*TY_B34 - TY_A42*TY_B22*TY_B34 - TY_A41*TY_B23*TY_B34 + TY_A52*pow(TY_B23,2);
-	TY_F37 = 2*TY_A52*TY_B23*TY_B24 + 2*TY_A52*TY_B22*TY_B25 - TY_A43*TY_B24*TY_B32 - TY_A42*TY_B25*TY_B32 - TY_A43*TY_B22*TY_B34 - TY_A42*TY_B23*TY_B34 - TY_A41*TY_B24*TY_B34;
-	TY_F38 = 2*TY_A52*TY_B23*TY_B25 - TY_A43*TY_B25*TY_B32 - TY_A43*TY_B23*TY_B34 - TY_A42*TY_B24*TY_B34 - TY_A41*TY_B25*TY_B34 + TY_A52*pow(TY_B24,2);
-	TY_F39 = 2*TY_A52*TY_B24*TY_B25 - TY_A43*TY_B24*TY_B34 - TY_A42*TY_B25*TY_B34;
-	TY_F310 = -(TY_A43*TY_B25*TY_B34) + TY_A52*pow(TY_B25,2);
-
-/*
-	if( debug ) 
-	{
-		sprintf(buf,"\rF = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\r", 0., 0.,  0.,  TY_F14, 0.,  TY_F16, 0.,  TY_F18, 0.,  0.    );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\r", 0., 0.,  TY_F23, TY_F24, TY_F25, TY_F26, TY_F27, TY_F28, TY_F29, 0.    );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\r", 0., TY_F32, TY_F33, TY_F34, TY_F35, TY_F36, TY_F37, TY_F38, TY_F39, TY_F310 );
-		XOPNotice(buf);
-	}
-*/
- 
-	TY_G13  = -(TY_B12*TY_F32);
-	TY_G14  = -(TY_B12*TY_F33);
-	TY_G15  = TY_B32*TY_F14 - TY_B14*TY_F32 - TY_B12*TY_F34;
-	TY_G16  = -(TY_B14*TY_F33) - TY_B12*TY_F35;
-	TY_G17  = TY_B34*TY_F14 + TY_B32*TY_F16 - TY_B14*TY_F34 - TY_B12*TY_F36;
-	TY_G18  = -(TY_B14*TY_F35) - TY_B12*TY_F37;
-	TY_G19  = TY_B34*TY_F16 + TY_B32*TY_F18 - TY_B14*TY_F36 - TY_B12*TY_F38;
-	TY_G110 = -(TY_B14*TY_F37) - TY_B12*TY_F39;
-	TY_G111 = TY_B34*TY_F18 - TY_B12*TY_F310 - TY_B14*TY_F38;
-	TY_G112 = -(TY_B14*TY_F39);
-	TY_G113 = -(TY_B14*TY_F310);
-	TY_G22  = -(TY_B21*TY_F32);
-	TY_G23  = -(TY_B22*TY_F32) - TY_B21*TY_F33;
-	TY_G24  = TY_B32*TY_F23 - TY_B23*TY_F32 - TY_B22*TY_F33 - TY_B21*TY_F34;
-	TY_G25  = TY_B32*TY_F24 - TY_B24*TY_F32 - TY_B23*TY_F33 - TY_B22*TY_F34 - TY_B21*TY_F35;
-	TY_G26  = TY_B34*TY_F23 + TY_B32*TY_F25 - TY_B25*TY_F32 - TY_B24*TY_F33 - TY_B23*TY_F34 - TY_B22*TY_F35 - TY_B21*TY_F36;
-	TY_G27  = TY_B34*TY_F24 + TY_B32*TY_F26 - TY_B25*TY_F33 - TY_B24*TY_F34 - TY_B23*TY_F35 - TY_B22*TY_F36 - TY_B21*TY_F37;
-	TY_G28  = TY_B34*TY_F25 + TY_B32*TY_F27 - TY_B25*TY_F34 - TY_B24*TY_F35 - TY_B23*TY_F36 - TY_B22*TY_F37 - TY_B21*TY_F38;
-	TY_G29  = TY_B34*TY_F26 + TY_B32*TY_F28 - TY_B25*TY_F35 - TY_B24*TY_F36 - TY_B23*TY_F37 - TY_B22*TY_F38 - TY_B21*TY_F39;
-	TY_G210 = TY_B34*TY_F27 + TY_B32*TY_F29 - TY_B21*TY_F310 - TY_B25*TY_F36 - TY_B24*TY_F37 - TY_B23*TY_F38 - TY_B22*TY_F39;
-	TY_G211 = TY_B34*TY_F28 - TY_B22*TY_F310 - TY_B25*TY_F37 - TY_B24*TY_F38 - TY_B23*TY_F39;
-	TY_G212 = TY_B34*TY_F29 - TY_B23*TY_F310 - TY_B25*TY_F38 - TY_B24*TY_F39;
-	TY_G213 = -(TY_B24*TY_F310) - TY_B25*TY_F39;
-	TY_G214 = -(TY_B25*TY_F310);
-/*	
-	if( debug ) 
-	{
-		sprintf(buf,"\rG = \r" );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\r", 0., 0.,  TY_G13, TY_G14, TY_G15, TY_G16, TY_G17, TY_G18, TY_G19, TY_G110, TY_G111, TY_G112, TY_G113, 0. );
-		XOPNotice(buf);
-		sprintf(buf, "%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\t\t%f\r", 0., TY_G22, TY_G23, TY_G24, TY_G25, TY_G26, TY_G27, TY_G28, TY_G29, TY_G210, TY_G211, TY_G212, TY_G213, TY_G214 );
-		XOPNotice(buf);
-	}
-*/	
-	// coefficients for polynomial
-	TY_w[0] = (-(TY_A21*TY_B12) + TY_A12*TY_B21)*(TY_A52*TY_B21 - TY_A41*TY_B32)*pow(TY_B21,2)*pow(TY_B32,3);
-	
-	TY_w[1] = 2*TY_B32*TY_G13*TY_G14 - TY_B24*TY_G13*TY_G22 - TY_B23*TY_G14*TY_G22 - TY_B22*TY_G15*TY_G22 - TY_B21*TY_G16*TY_G22 - TY_B23*TY_G13*TY_G23 - TY_B22*TY_G14*TY_G23 - TY_B21*TY_G15*TY_G23 + 2*TY_B14*TY_G22*TY_G23 - 
-	TY_B22*TY_G13*TY_G24 - TY_B21*TY_G14*TY_G24 + 2*TY_B12*TY_G23*TY_G24 - TY_B21*TY_G13*TY_G25 + 2*TY_B12*TY_G22*TY_G25;
-	
-	TY_w[2] = -(TY_B25*TY_G13*TY_G22) - TY_B24*TY_G14*TY_G22 - TY_B23*TY_G15*TY_G22 - TY_B22*TY_G16*TY_G22 - TY_B21*TY_G17*TY_G22 - TY_B24*TY_G13*TY_G23 - TY_B23*TY_G14*TY_G23 - TY_B22*TY_G15*TY_G23 - TY_B21*TY_G16*TY_G23 - 
-	TY_B23*TY_G13*TY_G24 - TY_B22*TY_G14*TY_G24 - TY_B21*TY_G15*TY_G24 + 2*TY_B14*TY_G22*TY_G24 - TY_B22*TY_G13*TY_G25 - TY_B21*TY_G14*TY_G25 + 2*TY_B12*TY_G23*TY_G25 - TY_B21*TY_G13*TY_G26 + 2*TY_B12*TY_G22*TY_G26 + 
-	TY_B34*pow(TY_G13,2) + TY_B32*(2*TY_G13*TY_G15 + pow(TY_G14,2)) + TY_B14*pow(TY_G23,2) + TY_B12*pow(TY_G24,2);
-	
-	TY_w[3] = 2*TY_B34*TY_G13*TY_G14 + 2*TY_B32*(TY_G14*TY_G15 + TY_G13*TY_G16) - TY_B25*TY_G14*TY_G22 - TY_B24*TY_G15*TY_G22 - TY_B23*TY_G16*TY_G22 - TY_B22*TY_G17*TY_G22 - TY_B21*TY_G18*TY_G22 - TY_B25*TY_G13*TY_G23 - 
-	TY_B24*TY_G14*TY_G23 - TY_B23*TY_G15*TY_G23 - TY_B22*TY_G16*TY_G23 - TY_B21*TY_G17*TY_G23 - TY_B24*TY_G13*TY_G24 - TY_B23*TY_G14*TY_G24 - TY_B22*TY_G15*TY_G24 - TY_B21*TY_G16*TY_G24 + 2*TY_B14*TY_G23*TY_G24 - 
-	TY_B23*TY_G13*TY_G25 - TY_B22*TY_G14*TY_G25 - TY_B21*TY_G15*TY_G25 + 2*TY_B14*TY_G22*TY_G25 + 2*TY_B12*TY_G24*TY_G25 - TY_B22*TY_G13*TY_G26 - TY_B21*TY_G14*TY_G26 + 2*TY_B12*TY_G23*TY_G26 - TY_B21*TY_G13*TY_G27 + 
-	2*TY_B12*TY_G22*TY_G27;
-	
-	TY_w[4] = -(TY_B25*TY_G15*TY_G22) - TY_B24*TY_G16*TY_G22 - TY_B23*TY_G17*TY_G22 - TY_B22*TY_G18*TY_G22 - TY_B21*TY_G19*TY_G22 - TY_B25*TY_G14*TY_G23 - TY_B24*TY_G15*TY_G23 - TY_B23*TY_G16*TY_G23 - TY_B22*TY_G17*TY_G23 - 
-	TY_B21*TY_G18*TY_G23 - TY_B25*TY_G13*TY_G24 - TY_B24*TY_G14*TY_G24 - TY_B23*TY_G15*TY_G24 - TY_B22*TY_G16*TY_G24 - TY_B21*TY_G17*TY_G24 - TY_B24*TY_G13*TY_G25 - TY_B23*TY_G14*TY_G25 - TY_B22*TY_G15*TY_G25 - 
-	TY_B21*TY_G16*TY_G25 + 2*TY_B14*TY_G23*TY_G25 - TY_B23*TY_G13*TY_G26 - TY_B22*TY_G14*TY_G26 - TY_B21*TY_G15*TY_G26 + 2*TY_B14*TY_G22*TY_G26 + 2*TY_B12*TY_G24*TY_G26 - TY_B22*TY_G13*TY_G27 - TY_B21*TY_G14*TY_G27 + 
-	2*TY_B12*TY_G23*TY_G27 - TY_B21*TY_G13*TY_G28 + 2*TY_B12*TY_G22*TY_G28 + TY_B34*(2*TY_G13*TY_G15 + pow(TY_G14,2)) + TY_B32*(2*TY_G14*TY_G16 + 2*TY_G13*TY_G17 + pow(TY_G15,2)) + TY_B14*pow(TY_G24,2) + 
-	TY_B12*pow(TY_G25,2);
-	
-	TY_w[5] = 2*TY_B34*(TY_G14*TY_G15 + TY_G13*TY_G16) + 2*TY_B32*(TY_G15*TY_G16 + TY_G14*TY_G17 + TY_G13*TY_G18) - TY_B21*TY_G110*TY_G22 - TY_B25*TY_G16*TY_G22 - TY_B24*TY_G17*TY_G22 - TY_B23*TY_G18*TY_G22 - TY_B22*TY_G19*TY_G22 - 
-	TY_B25*TY_G15*TY_G23 - TY_B24*TY_G16*TY_G23 - TY_B23*TY_G17*TY_G23 - TY_B22*TY_G18*TY_G23 - TY_B21*TY_G19*TY_G23 - TY_B25*TY_G14*TY_G24 - TY_B24*TY_G15*TY_G24 - TY_B23*TY_G16*TY_G24 - TY_B22*TY_G17*TY_G24 - 
-	TY_B21*TY_G18*TY_G24 - TY_B25*TY_G13*TY_G25 - TY_B24*TY_G14*TY_G25 - TY_B23*TY_G15*TY_G25 - TY_B22*TY_G16*TY_G25 - TY_B21*TY_G17*TY_G25 + 2*TY_B14*TY_G24*TY_G25 - TY_B24*TY_G13*TY_G26 - TY_B23*TY_G14*TY_G26 - 
-	TY_B22*TY_G15*TY_G26 - TY_B21*TY_G16*TY_G26 + 2*TY_B14*TY_G23*TY_G26 + 2*TY_B12*TY_G25*TY_G26 - TY_B23*TY_G13*TY_G27 - TY_B22*TY_G14*TY_G27 - TY_B21*TY_G15*TY_G27 + 2*TY_B14*TY_G22*TY_G27 + 2*TY_B12*TY_G24*TY_G27 - 
-	TY_B22*TY_G13*TY_G28 - TY_B21*TY_G14*TY_G28 + 2*TY_B12*TY_G23*TY_G28 - TY_B21*TY_G13*TY_G29 + 2*TY_B12*TY_G22*TY_G29;
-	
-	TY_w[6] = -(TY_B22*TY_G110*TY_G22) - TY_B21*TY_G111*TY_G22 - TY_B25*TY_G17*TY_G22 - TY_B24*TY_G18*TY_G22 - TY_B23*TY_G19*TY_G22 + TY_G210*(-(TY_B21*TY_G13) + 2*TY_B12*TY_G22) - TY_B21*TY_G110*TY_G23 - TY_B25*TY_G16*TY_G23 - 
-	TY_B24*TY_G17*TY_G23 - TY_B23*TY_G18*TY_G23 - TY_B22*TY_G19*TY_G23 - TY_B25*TY_G15*TY_G24 - TY_B24*TY_G16*TY_G24 - TY_B23*TY_G17*TY_G24 - TY_B22*TY_G18*TY_G24 - TY_B21*TY_G19*TY_G24 - TY_B25*TY_G14*TY_G25 - 
-	TY_B24*TY_G15*TY_G25 - TY_B23*TY_G16*TY_G25 - TY_B22*TY_G17*TY_G25 - TY_B21*TY_G18*TY_G25 - TY_B25*TY_G13*TY_G26 - TY_B24*TY_G14*TY_G26 - TY_B23*TY_G15*TY_G26 - TY_B22*TY_G16*TY_G26 - TY_B21*TY_G17*TY_G26 + 
-	2*TY_B14*TY_G24*TY_G26 - TY_B24*TY_G13*TY_G27 - TY_B23*TY_G14*TY_G27 - TY_B22*TY_G15*TY_G27 - TY_B21*TY_G16*TY_G27 + 2*TY_B14*TY_G23*TY_G27 + 2*TY_B12*TY_G25*TY_G27 - TY_B23*TY_G13*TY_G28 - TY_B22*TY_G14*TY_G28 - 
-	TY_B21*TY_G15*TY_G28 + 2*TY_B14*TY_G22*TY_G28 + 2*TY_B12*TY_G24*TY_G28 - TY_B22*TY_G13*TY_G29 - TY_B21*TY_G14*TY_G29 + 2*TY_B12*TY_G23*TY_G29 + TY_B34*(2*TY_G14*TY_G16 + 2*TY_G13*TY_G17 + pow(TY_G15,2)) + 
-	TY_B32*(2*(TY_G15*TY_G17 + TY_G14*TY_G18 + TY_G13*TY_G19) + pow(TY_G16,2)) + TY_B14*pow(TY_G25,2) + TY_B12*pow(TY_G26,2);
-	
-	TY_w[7] = 2*TY_B34*(TY_G15*TY_G16 + TY_G14*TY_G17 + TY_G13*TY_G18) + 2*TY_B32*(TY_G110*TY_G13 + TY_G16*TY_G17 + TY_G15*TY_G18 + TY_G14*TY_G19) - TY_B22*TY_G13*TY_G210 - TY_B21*TY_G14*TY_G210 - TY_B23*TY_G110*TY_G22 - 
-	TY_B22*TY_G111*TY_G22 - TY_B21*TY_G112*TY_G22 - TY_B25*TY_G18*TY_G22 - TY_B24*TY_G19*TY_G22 + TY_G211*(-(TY_B21*TY_G13) + 2*TY_B12*TY_G22) - TY_B22*TY_G110*TY_G23 - TY_B21*TY_G111*TY_G23 - TY_B25*TY_G17*TY_G23 - 
-	TY_B24*TY_G18*TY_G23 - TY_B23*TY_G19*TY_G23 + 2*TY_B12*TY_G210*TY_G23 - TY_B21*TY_G110*TY_G24 - TY_B25*TY_G16*TY_G24 - TY_B24*TY_G17*TY_G24 - TY_B23*TY_G18*TY_G24 - TY_B22*TY_G19*TY_G24 - TY_B25*TY_G15*TY_G25 - 
-	TY_B24*TY_G16*TY_G25 - TY_B23*TY_G17*TY_G25 - TY_B22*TY_G18*TY_G25 - TY_B21*TY_G19*TY_G25 - TY_B25*TY_G14*TY_G26 - TY_B24*TY_G15*TY_G26 - TY_B23*TY_G16*TY_G26 - TY_B22*TY_G17*TY_G26 - TY_B21*TY_G18*TY_G26 + 
-	2*TY_B14*TY_G25*TY_G26 - TY_B25*TY_G13*TY_G27 - TY_B24*TY_G14*TY_G27 - TY_B23*TY_G15*TY_G27 - TY_B22*TY_G16*TY_G27 - TY_B21*TY_G17*TY_G27 + 2*TY_B14*TY_G24*TY_G27 + 2*TY_B12*TY_G26*TY_G27 - TY_B24*TY_G13*TY_G28 - 
-	TY_B23*TY_G14*TY_G28 - TY_B22*TY_G15*TY_G28 - TY_B21*TY_G16*TY_G28 + 2*TY_B14*TY_G23*TY_G28 + 2*TY_B12*TY_G25*TY_G28 - TY_B23*TY_G13*TY_G29 - TY_B22*TY_G14*TY_G29 - TY_B21*TY_G15*TY_G29 + 2*TY_B14*TY_G22*TY_G29 + 
-	2*TY_B12*TY_G24*TY_G29;
-	
-	TY_w[8] = -(TY_B23*TY_G13*TY_G210) - TY_B22*TY_G14*TY_G210 - TY_B21*TY_G15*TY_G210 - TY_B22*TY_G13*TY_G211 - TY_B21*TY_G14*TY_G211 - TY_B21*TY_G13*TY_G212 - TY_B24*TY_G110*TY_G22 - TY_B23*TY_G111*TY_G22 - TY_B22*TY_G112*TY_G22 - 
-	TY_B21*TY_G113*TY_G22 - TY_B25*TY_G19*TY_G22 + 2*TY_B14*TY_G210*TY_G22 + 2*TY_B12*TY_G212*TY_G22 - TY_B23*TY_G110*TY_G23 - TY_B22*TY_G111*TY_G23 - TY_B21*TY_G112*TY_G23 - TY_B25*TY_G18*TY_G23 - TY_B24*TY_G19*TY_G23 + 
-	2*TY_B12*TY_G211*TY_G23 - TY_B22*TY_G110*TY_G24 - TY_B21*TY_G111*TY_G24 - TY_B25*TY_G17*TY_G24 - TY_B24*TY_G18*TY_G24 - TY_B23*TY_G19*TY_G24 + 2*TY_B12*TY_G210*TY_G24 - TY_B21*TY_G110*TY_G25 - TY_B25*TY_G16*TY_G25 - 
-	TY_B24*TY_G17*TY_G25 - TY_B23*TY_G18*TY_G25 - TY_B22*TY_G19*TY_G25 - TY_B25*TY_G15*TY_G26 - TY_B24*TY_G16*TY_G26 - TY_B23*TY_G17*TY_G26 - TY_B22*TY_G18*TY_G26 - TY_B21*TY_G19*TY_G26 - TY_B25*TY_G14*TY_G27 - 
-	TY_B24*TY_G15*TY_G27 - TY_B23*TY_G16*TY_G27 - TY_B22*TY_G17*TY_G27 - TY_B21*TY_G18*TY_G27 + 2*TY_B14*TY_G25*TY_G27 - TY_B25*TY_G13*TY_G28 - TY_B24*TY_G14*TY_G28 - TY_B23*TY_G15*TY_G28 - TY_B22*TY_G16*TY_G28 - 
-	TY_B21*TY_G17*TY_G28 + 2*TY_B14*TY_G24*TY_G28 + 2*TY_B12*TY_G26*TY_G28 - TY_B24*TY_G13*TY_G29 - TY_B23*TY_G14*TY_G29 - TY_B22*TY_G15*TY_G29 - TY_B21*TY_G16*TY_G29 + 2*TY_B14*TY_G23*TY_G29 + 2*TY_B12*TY_G25*TY_G29 + 
-	TY_B34*(2*(TY_G15*TY_G17 + TY_G14*TY_G18 + TY_G13*TY_G19) + pow(TY_G16,2)) + TY_B32*(2*(TY_G111*TY_G13 + TY_G110*TY_G14 + TY_G16*TY_G18 + TY_G15*TY_G19) + pow(TY_G17,2)) + TY_B14*pow(TY_G26,2) + 
-	TY_B12*pow(TY_G27,2);
-	
-	TY_w[9] = 2*TY_B34*(TY_G110*TY_G13 + TY_G16*TY_G17 + TY_G15*TY_G18 + TY_G14*TY_G19) + 2*TY_B32*(TY_G112*TY_G13 + TY_G111*TY_G14 + TY_G110*TY_G15 + TY_G17*TY_G18 + TY_G16*TY_G19) - TY_B24*TY_G13*TY_G210 - TY_B23*TY_G14*TY_G210 - 
-	TY_B22*TY_G15*TY_G210 - TY_B21*TY_G16*TY_G210 - TY_B23*TY_G13*TY_G211 - TY_B22*TY_G14*TY_G211 - TY_B21*TY_G15*TY_G211 - TY_B22*TY_G13*TY_G212 - TY_B21*TY_G14*TY_G212 - TY_B25*TY_G110*TY_G22 - TY_B24*TY_G111*TY_G22 - 
-	TY_B23*TY_G112*TY_G22 - TY_B22*TY_G113*TY_G22 + 2*TY_B14*TY_G211*TY_G22 + TY_G213*(-(TY_B21*TY_G13) + 2*TY_B12*TY_G22) - TY_B24*TY_G110*TY_G23 - TY_B23*TY_G111*TY_G23 - TY_B22*TY_G112*TY_G23 - 
-	TY_B21*TY_G113*TY_G23 - TY_B25*TY_G19*TY_G23 + 2*TY_B14*TY_G210*TY_G23 + 2*TY_B12*TY_G212*TY_G23 - TY_B23*TY_G110*TY_G24 - TY_B22*TY_G111*TY_G24 - TY_B21*TY_G112*TY_G24 - TY_B25*TY_G18*TY_G24 - TY_B24*TY_G19*TY_G24 + 
-	2*TY_B12*TY_G211*TY_G24 - TY_B22*TY_G110*TY_G25 - TY_B21*TY_G111*TY_G25 - TY_B25*TY_G17*TY_G25 - TY_B24*TY_G18*TY_G25 - TY_B23*TY_G19*TY_G25 + 2*TY_B12*TY_G210*TY_G25 - TY_B21*TY_G110*TY_G26 - TY_B25*TY_G16*TY_G26 - 
-	TY_B24*TY_G17*TY_G26 - TY_B23*TY_G18*TY_G26 - TY_B22*TY_G19*TY_G26 - TY_B25*TY_G15*TY_G27 - TY_B24*TY_G16*TY_G27 - TY_B23*TY_G17*TY_G27 - TY_B22*TY_G18*TY_G27 - TY_B21*TY_G19*TY_G27 + 2*TY_B14*TY_G26*TY_G27 - 
-	TY_B25*TY_G14*TY_G28 - TY_B24*TY_G15*TY_G28 - TY_B23*TY_G16*TY_G28 - TY_B22*TY_G17*TY_G28 - TY_B21*TY_G18*TY_G28 + 2*TY_B14*TY_G25*TY_G28 + 2*TY_B12*TY_G27*TY_G28 - TY_B25*TY_G13*TY_G29 - TY_B24*TY_G14*TY_G29 - 
-	TY_B23*TY_G15*TY_G29 - TY_B22*TY_G16*TY_G29 - TY_B21*TY_G17*TY_G29 + 2*TY_B14*TY_G24*TY_G29 + 2*TY_B12*TY_G26*TY_G29;
-	
-	TY_w[10] = -(TY_B25*TY_G13*TY_G210) - TY_B24*TY_G14*TY_G210 - TY_B23*TY_G15*TY_G210 - TY_B22*TY_G16*TY_G210 - TY_B21*TY_G17*TY_G210 - TY_B24*TY_G13*TY_G211 - TY_B23*TY_G14*TY_G211 - TY_B22*TY_G15*TY_G211 - TY_B21*TY_G16*TY_G211 - 
-	TY_B23*TY_G13*TY_G212 - TY_B22*TY_G14*TY_G212 - TY_B21*TY_G15*TY_G212 - TY_B22*TY_G13*TY_G213 - TY_B21*TY_G14*TY_G213 - TY_B21*TY_G13*TY_G214 - TY_B25*TY_G111*TY_G22 - TY_B24*TY_G112*TY_G22 - TY_B23*TY_G113*TY_G22 + 
-	2*TY_B14*TY_G212*TY_G22 + 2*TY_B12*TY_G214*TY_G22 - TY_B25*TY_G110*TY_G23 - TY_B24*TY_G111*TY_G23 - TY_B23*TY_G112*TY_G23 - TY_B22*TY_G113*TY_G23 + 2*TY_B14*TY_G211*TY_G23 + 2*TY_B12*TY_G213*TY_G23 - 
-	TY_B24*TY_G110*TY_G24 - TY_B23*TY_G111*TY_G24 - TY_B22*TY_G112*TY_G24 - TY_B21*TY_G113*TY_G24 - TY_B25*TY_G19*TY_G24 + 2*TY_B14*TY_G210*TY_G24 + 2*TY_B12*TY_G212*TY_G24 - TY_B23*TY_G110*TY_G25 - 
-	TY_B22*TY_G111*TY_G25 - TY_B21*TY_G112*TY_G25 - TY_B25*TY_G18*TY_G25 - TY_B24*TY_G19*TY_G25 + 2*TY_B12*TY_G211*TY_G25 - TY_B22*TY_G110*TY_G26 - TY_B21*TY_G111*TY_G26 - TY_B25*TY_G17*TY_G26 - TY_B24*TY_G18*TY_G26 - 
-	TY_B23*TY_G19*TY_G26 + 2*TY_B12*TY_G210*TY_G26 - TY_B21*TY_G110*TY_G27 - TY_B25*TY_G16*TY_G27 - TY_B24*TY_G17*TY_G27 - TY_B23*TY_G18*TY_G27 - TY_B22*TY_G19*TY_G27 - TY_B25*TY_G15*TY_G28 - TY_B24*TY_G16*TY_G28 - 
-	TY_B23*TY_G17*TY_G28 - TY_B22*TY_G18*TY_G28 - TY_B21*TY_G19*TY_G28 + 2*TY_B14*TY_G26*TY_G28 - TY_B25*TY_G14*TY_G29 - TY_B24*TY_G15*TY_G29 - TY_B23*TY_G16*TY_G29 - TY_B22*TY_G17*TY_G29 - TY_B21*TY_G18*TY_G29 + 
-	2*TY_B14*TY_G25*TY_G29 + 2*TY_B12*TY_G27*TY_G29 + TY_B34*(2*(TY_G111*TY_G13 + TY_G110*TY_G14 + TY_G16*TY_G18 + TY_G15*TY_G19) + pow(TY_G17,2)) + 
-	TY_B32*(2*(TY_G113*TY_G13 + TY_G112*TY_G14 + TY_G111*TY_G15 + TY_G110*TY_G16 + TY_G17*TY_G19) + pow(TY_G18,2)) + TY_B14*pow(TY_G27,2) + TY_B12*pow(TY_G28,2);
-	
-	TY_w[11] = 2*TY_B34*(TY_G112*TY_G13 + TY_G111*TY_G14 + TY_G110*TY_G15 + TY_G17*TY_G18 + TY_G16*TY_G19) + 2*TY_B32*(TY_G113*TY_G14 + TY_G112*TY_G15 + TY_G111*TY_G16 + TY_G110*TY_G17 + TY_G18*TY_G19) - TY_B25*TY_G14*TY_G210 - 
-	TY_B24*TY_G15*TY_G210 - TY_B23*TY_G16*TY_G210 - TY_B22*TY_G17*TY_G210 - TY_B21*TY_G18*TY_G210 - TY_B25*TY_G13*TY_G211 - TY_B24*TY_G14*TY_G211 - TY_B23*TY_G15*TY_G211 - TY_B22*TY_G16*TY_G211 - TY_B21*TY_G17*TY_G211 - 
-	TY_B24*TY_G13*TY_G212 - TY_B23*TY_G14*TY_G212 - TY_B22*TY_G15*TY_G212 - TY_B21*TY_G16*TY_G212 - TY_B23*TY_G13*TY_G213 - TY_B22*TY_G14*TY_G213 - TY_B21*TY_G15*TY_G213 - TY_B25*TY_G112*TY_G22 - TY_B24*TY_G113*TY_G22 + 
-	2*TY_B14*TY_G213*TY_G22 - TY_B25*TY_G111*TY_G23 - TY_B24*TY_G112*TY_G23 - TY_B23*TY_G113*TY_G23 + 2*TY_B14*TY_G212*TY_G23 - TY_G214*(TY_B22*TY_G13 + TY_B21*TY_G14 - 2*TY_B12*TY_G23) - TY_B25*TY_G110*TY_G24 - 
-	TY_B24*TY_G111*TY_G24 - TY_B23*TY_G112*TY_G24 - TY_B22*TY_G113*TY_G24 + 2*TY_B14*TY_G211*TY_G24 + 2*TY_B12*TY_G213*TY_G24 - TY_B24*TY_G110*TY_G25 - TY_B23*TY_G111*TY_G25 - TY_B22*TY_G112*TY_G25 - 
-	TY_B21*TY_G113*TY_G25 - TY_B25*TY_G19*TY_G25 + 2*TY_B14*TY_G210*TY_G25 + 2*TY_B12*TY_G212*TY_G25 - TY_B23*TY_G110*TY_G26 - TY_B22*TY_G111*TY_G26 - TY_B21*TY_G112*TY_G26 - TY_B25*TY_G18*TY_G26 - TY_B24*TY_G19*TY_G26 + 
-	2*TY_B12*TY_G211*TY_G26 - TY_B22*TY_G110*TY_G27 - TY_B21*TY_G111*TY_G27 - TY_B25*TY_G17*TY_G27 - TY_B24*TY_G18*TY_G27 - TY_B23*TY_G19*TY_G27 + 2*TY_B12*TY_G210*TY_G27 - TY_B21*TY_G110*TY_G28 - TY_B25*TY_G16*TY_G28 - 
-	TY_B24*TY_G17*TY_G28 - TY_B23*TY_G18*TY_G28 - TY_B22*TY_G19*TY_G28 + 2*TY_B14*TY_G27*TY_G28 - TY_B25*TY_G15*TY_G29 - TY_B24*TY_G16*TY_G29 - TY_B23*TY_G17*TY_G29 - TY_B22*TY_G18*TY_G29 - TY_B21*TY_G19*TY_G29 + 
-	2*TY_B14*TY_G26*TY_G29 + 2*TY_B12*TY_G28*TY_G29;
-	
-	TY_w[12] = -(TY_B25*TY_G15*TY_G210) - TY_B24*TY_G16*TY_G210 - TY_B23*TY_G17*TY_G210 - TY_B22*TY_G18*TY_G210 - TY_B21*TY_G19*TY_G210 - TY_B25*TY_G14*TY_G211 - TY_B24*TY_G15*TY_G211 - TY_B23*TY_G16*TY_G211 - TY_B22*TY_G17*TY_G211 - 
-	TY_B21*TY_G18*TY_G211 - TY_B25*TY_G13*TY_G212 - TY_B24*TY_G14*TY_G212 - TY_B23*TY_G15*TY_G212 - TY_B22*TY_G16*TY_G212 - TY_B21*TY_G17*TY_G212 - TY_B24*TY_G13*TY_G213 - TY_B23*TY_G14*TY_G213 - TY_B22*TY_G15*TY_G213 - 
-	TY_B21*TY_G16*TY_G213 - TY_B25*TY_G113*TY_G22 - TY_B25*TY_G112*TY_G23 - TY_B24*TY_G113*TY_G23 + 2*TY_B14*TY_G213*TY_G23 - TY_B25*TY_G111*TY_G24 - TY_B24*TY_G112*TY_G24 - TY_B23*TY_G113*TY_G24 + 
-	2*TY_B14*TY_G212*TY_G24 - TY_G214*(TY_B23*TY_G13 + TY_B22*TY_G14 + TY_B21*TY_G15 - 2*TY_B14*TY_G22 - 2*TY_B12*TY_G24) - TY_B25*TY_G110*TY_G25 - TY_B24*TY_G111*TY_G25 - TY_B23*TY_G112*TY_G25 - 
-	TY_B22*TY_G113*TY_G25 + 2*TY_B14*TY_G211*TY_G25 + 2*TY_B12*TY_G213*TY_G25 - TY_B24*TY_G110*TY_G26 - TY_B23*TY_G111*TY_G26 - TY_B22*TY_G112*TY_G26 - TY_B21*TY_G113*TY_G26 - TY_B25*TY_G19*TY_G26 + 
-	2*TY_B14*TY_G210*TY_G26 + 2*TY_B12*TY_G212*TY_G26 - TY_B23*TY_G110*TY_G27 - TY_B22*TY_G111*TY_G27 - TY_B21*TY_G112*TY_G27 - TY_B25*TY_G18*TY_G27 - TY_B24*TY_G19*TY_G27 + 2*TY_B12*TY_G211*TY_G27 - 
-	TY_B22*TY_G110*TY_G28 - TY_B21*TY_G111*TY_G28 - TY_B25*TY_G17*TY_G28 - TY_B24*TY_G18*TY_G28 - TY_B23*TY_G19*TY_G28 + 2*TY_B12*TY_G210*TY_G28 - TY_B21*TY_G110*TY_G29 - TY_B25*TY_G16*TY_G29 - TY_B24*TY_G17*TY_G29 - 
-	TY_B23*TY_G18*TY_G29 - TY_B22*TY_G19*TY_G29 + 2*TY_B14*TY_G27*TY_G29 + TY_B34*(2*(TY_G113*TY_G13 + TY_G112*TY_G14 + TY_G111*TY_G15 + TY_G110*TY_G16 + TY_G17*TY_G19) + pow(TY_G18,2)) + 
-	TY_B32*(2*(TY_G113*TY_G15 + TY_G112*TY_G16 + TY_G111*TY_G17 + TY_G110*TY_G18) + pow(TY_G19,2)) + TY_B14*pow(TY_G28,2) + TY_B12*pow(TY_G29,2);
-	
-	TY_w[13] = 2*TY_B32*(TY_G113*TY_G16 + TY_G112*TY_G17 + TY_G111*TY_G18 + TY_G110*TY_G19) + 2*TY_B34*(TY_G113*TY_G14 + TY_G112*TY_G15 + TY_G111*TY_G16 + TY_G110*TY_G17 + TY_G18*TY_G19) - TY_B21*TY_G110*TY_G210 - 
-	TY_B25*TY_G16*TY_G210 - TY_B24*TY_G17*TY_G210 - TY_B23*TY_G18*TY_G210 - TY_B22*TY_G19*TY_G210 - TY_B25*TY_G15*TY_G211 - TY_B24*TY_G16*TY_G211 - TY_B23*TY_G17*TY_G211 - TY_B22*TY_G18*TY_G211 - TY_B21*TY_G19*TY_G211 - 
-	TY_B25*TY_G14*TY_G212 - TY_B24*TY_G15*TY_G212 - TY_B23*TY_G16*TY_G212 - TY_B22*TY_G17*TY_G212 - TY_B21*TY_G18*TY_G212 - TY_B25*TY_G13*TY_G213 - TY_B24*TY_G14*TY_G213 - TY_B23*TY_G15*TY_G213 - TY_B22*TY_G16*TY_G213 - 
-	TY_B21*TY_G17*TY_G213 - TY_B25*TY_G113*TY_G23 - TY_B25*TY_G112*TY_G24 - TY_B24*TY_G113*TY_G24 + 2*TY_B14*TY_G213*TY_G24 - TY_B25*TY_G111*TY_G25 - TY_B24*TY_G112*TY_G25 - TY_B23*TY_G113*TY_G25 + 
-	2*TY_B14*TY_G212*TY_G25 - TY_G214*(TY_B24*TY_G13 + TY_B23*TY_G14 + TY_B22*TY_G15 + TY_B21*TY_G16 - 2*TY_B14*TY_G23 - 2*TY_B12*TY_G25) - TY_B25*TY_G110*TY_G26 - TY_B24*TY_G111*TY_G26 - TY_B23*TY_G112*TY_G26 - 
-	TY_B22*TY_G113*TY_G26 + 2*TY_B14*TY_G211*TY_G26 + 2*TY_B12*TY_G213*TY_G26 - TY_B24*TY_G110*TY_G27 - TY_B23*TY_G111*TY_G27 - TY_B22*TY_G112*TY_G27 - TY_B21*TY_G113*TY_G27 - TY_B25*TY_G19*TY_G27 + 
-	2*TY_B14*TY_G210*TY_G27 + 2*TY_B12*TY_G212*TY_G27 - TY_B23*TY_G110*TY_G28 - TY_B22*TY_G111*TY_G28 - TY_B21*TY_G112*TY_G28 - TY_B25*TY_G18*TY_G28 - TY_B24*TY_G19*TY_G28 + 2*TY_B12*TY_G211*TY_G28 - 
-	TY_B22*TY_G110*TY_G29 - TY_B21*TY_G111*TY_G29 - TY_B25*TY_G17*TY_G29 - TY_B24*TY_G18*TY_G29 - TY_B23*TY_G19*TY_G29 + 2*TY_B12*TY_G210*TY_G29 + 2*TY_B14*TY_G28*TY_G29;
-	
-	TY_w[14] = -(TY_B22*TY_G110*TY_G210) - TY_B21*TY_G111*TY_G210 - TY_B25*TY_G17*TY_G210 - TY_B24*TY_G18*TY_G210 - TY_B23*TY_G19*TY_G210 - TY_B21*TY_G110*TY_G211 - TY_B25*TY_G16*TY_G211 - TY_B24*TY_G17*TY_G211 - 
-	TY_B23*TY_G18*TY_G211 - TY_B22*TY_G19*TY_G211 - TY_B25*TY_G15*TY_G212 - TY_B24*TY_G16*TY_G212 - TY_B23*TY_G17*TY_G212 - TY_B22*TY_G18*TY_G212 - TY_B21*TY_G19*TY_G212 - TY_B25*TY_G14*TY_G213 - TY_B24*TY_G15*TY_G213 - 
-	TY_B23*TY_G16*TY_G213 - TY_B22*TY_G17*TY_G213 - TY_B21*TY_G18*TY_G213 - TY_B25*TY_G113*TY_G24 - TY_B25*TY_G112*TY_G25 - TY_B24*TY_G113*TY_G25 + 2*TY_B14*TY_G213*TY_G25 - TY_B25*TY_G111*TY_G26 - TY_B24*TY_G112*TY_G26 - 
-	TY_B23*TY_G113*TY_G26 + 2*TY_B14*TY_G212*TY_G26 - TY_G214*(TY_B25*TY_G13 + TY_B24*TY_G14 + TY_B23*TY_G15 + TY_B22*TY_G16 + TY_B21*TY_G17 - 2*TY_B14*TY_G24 - 2*TY_B12*TY_G26) - TY_B25*TY_G110*TY_G27 - 
-	TY_B24*TY_G111*TY_G27 - TY_B23*TY_G112*TY_G27 - TY_B22*TY_G113*TY_G27 + 2*TY_B14*TY_G211*TY_G27 + 2*TY_B12*TY_G213*TY_G27 - TY_B24*TY_G110*TY_G28 - TY_B23*TY_G111*TY_G28 - TY_B22*TY_G112*TY_G28 - 
-	TY_B21*TY_G113*TY_G28 - TY_B25*TY_G19*TY_G28 + 2*TY_B14*TY_G210*TY_G28 + 2*TY_B12*TY_G212*TY_G28 - TY_B23*TY_G110*TY_G29 - TY_B22*TY_G111*TY_G29 - TY_B21*TY_G112*TY_G29 - TY_B25*TY_G18*TY_G29 - TY_B24*TY_G19*TY_G29 + 
-	2*TY_B12*TY_G211*TY_G29 + TY_B32*(2*(TY_G113*TY_G17 + TY_G112*TY_G18 + TY_G111*TY_G19) + pow(TY_G110,2)) + 
-	TY_B34*(2*(TY_G113*TY_G15 + TY_G112*TY_G16 + TY_G111*TY_G17 + TY_G110*TY_G18) + pow(TY_G19,2)) + TY_B12*pow(TY_G210,2) + TY_B14*pow(TY_G29,2); 
-	
-	TY_w[15] = 2*TY_B34*(TY_G113*TY_G16 + TY_G112*TY_G17 + TY_G111*TY_G18 + TY_G110*TY_G19) + 2*TY_B32*(TY_G110*TY_G111 + TY_G113*TY_G18 + TY_G112*TY_G19) - TY_B23*TY_G110*TY_G210 - TY_B22*TY_G111*TY_G210 - 
-	TY_B21*TY_G112*TY_G210 - TY_B25*TY_G18*TY_G210 - TY_B24*TY_G19*TY_G210 - TY_B22*TY_G110*TY_G211 - TY_B21*TY_G111*TY_G211 - TY_B25*TY_G17*TY_G211 - TY_B24*TY_G18*TY_G211 - TY_B23*TY_G19*TY_G211 + 
-	2*TY_B12*TY_G210*TY_G211 - TY_B21*TY_G110*TY_G212 - TY_B25*TY_G16*TY_G212 - TY_B24*TY_G17*TY_G212 - TY_B23*TY_G18*TY_G212 - TY_B22*TY_G19*TY_G212 - TY_B25*TY_G15*TY_G213 - TY_B24*TY_G16*TY_G213 - 
-	TY_B23*TY_G17*TY_G213 - TY_B22*TY_G18*TY_G213 - TY_B21*TY_G19*TY_G213 - TY_B25*TY_G113*TY_G25 - TY_B25*TY_G112*TY_G26 - TY_B24*TY_G113*TY_G26 + 2*TY_B14*TY_G213*TY_G26 - TY_B25*TY_G111*TY_G27 - TY_B24*TY_G112*TY_G27 - 
-	TY_B23*TY_G113*TY_G27 + 2*TY_B14*TY_G212*TY_G27 - TY_G214*(TY_B25*TY_G14 + TY_B24*TY_G15 + TY_B23*TY_G16 + TY_B22*TY_G17 + TY_B21*TY_G18 - 2*TY_B14*TY_G25 - 2*TY_B12*TY_G27) - TY_B25*TY_G110*TY_G28 - 
-	TY_B24*TY_G111*TY_G28 - TY_B23*TY_G112*TY_G28 - TY_B22*TY_G113*TY_G28 + 2*TY_B14*TY_G211*TY_G28 + 2*TY_B12*TY_G213*TY_G28 - TY_B24*TY_G110*TY_G29 - TY_B23*TY_G111*TY_G29 - TY_B22*TY_G112*TY_G29 - 
-	TY_B21*TY_G113*TY_G29 - TY_B25*TY_G19*TY_G29 + 2*TY_B14*TY_G210*TY_G29 + 2*TY_B12*TY_G212*TY_G29;
-	
-	TY_w[16] = -(TY_B24*TY_G110*TY_G210) - TY_B23*TY_G111*TY_G210 - TY_B22*TY_G112*TY_G210 - TY_B21*TY_G113*TY_G210 - TY_B25*TY_G19*TY_G210 - TY_B23*TY_G110*TY_G211 - TY_B22*TY_G111*TY_G211 - TY_B21*TY_G112*TY_G211 - 
-	TY_B25*TY_G18*TY_G211 - TY_B24*TY_G19*TY_G211 - TY_B22*TY_G110*TY_G212 - TY_B21*TY_G111*TY_G212 - TY_B25*TY_G17*TY_G212 - TY_B24*TY_G18*TY_G212 - TY_B23*TY_G19*TY_G212 + 2*TY_B12*TY_G210*TY_G212 - 
-	TY_B21*TY_G110*TY_G213 - TY_B25*TY_G16*TY_G213 - TY_B24*TY_G17*TY_G213 - TY_B23*TY_G18*TY_G213 - TY_B22*TY_G19*TY_G213 - TY_B25*TY_G113*TY_G26 - TY_B25*TY_G112*TY_G27 - TY_B24*TY_G113*TY_G27 + 
-	2*TY_B14*TY_G213*TY_G27 - TY_B25*TY_G111*TY_G28 - TY_B24*TY_G112*TY_G28 - TY_B23*TY_G113*TY_G28 + 2*TY_B14*TY_G212*TY_G28 - 
-	TY_G214*(TY_B25*TY_G15 + TY_B24*TY_G16 + TY_B23*TY_G17 + TY_B22*TY_G18 + TY_B21*TY_G19 - 2*TY_B14*TY_G26 - 2*TY_B12*TY_G28) - TY_B25*TY_G110*TY_G29 - TY_B24*TY_G111*TY_G29 - TY_B23*TY_G112*TY_G29 - 
-	TY_B22*TY_G113*TY_G29 + 2*TY_B14*TY_G211*TY_G29 + 2*TY_B12*TY_G213*TY_G29 + TY_B34*(2*(TY_G113*TY_G17 + TY_G112*TY_G18 + TY_G111*TY_G19) + pow(TY_G110,2)) + 
-	TY_B32*(2*TY_G110*TY_G112 + 2*TY_G113*TY_G19 + pow(TY_G111,2)) + TY_B14*pow(TY_G210,2) + TY_B12*pow(TY_G211,2);
-	
-	TY_w[17] = 2*TY_B32*(TY_G111*TY_G112 + TY_G110*TY_G113) + 2*TY_B34*(TY_G110*TY_G111 + TY_G113*TY_G18 + TY_G112*TY_G19) - TY_B25*TY_G110*TY_G210 - TY_B24*TY_G111*TY_G210 - TY_B23*TY_G112*TY_G210 - TY_B22*TY_G113*TY_G210 - 
-	TY_B24*TY_G110*TY_G211 - TY_B23*TY_G111*TY_G211 - TY_B22*TY_G112*TY_G211 - TY_B21*TY_G113*TY_G211 - TY_B25*TY_G19*TY_G211 + 2*TY_B14*TY_G210*TY_G211 - TY_B23*TY_G110*TY_G212 - TY_B22*TY_G111*TY_G212 - 
-	TY_B21*TY_G112*TY_G212 - TY_B25*TY_G18*TY_G212 - TY_B24*TY_G19*TY_G212 + 2*TY_B12*TY_G211*TY_G212 - TY_B22*TY_G110*TY_G213 - TY_B21*TY_G111*TY_G213 - TY_B25*TY_G17*TY_G213 - TY_B24*TY_G18*TY_G213 - 
-	TY_B23*TY_G19*TY_G213 + 2*TY_B12*TY_G210*TY_G213 - TY_B25*TY_G113*TY_G27 - TY_B25*TY_G112*TY_G28 - TY_B24*TY_G113*TY_G28 + 2*TY_B14*TY_G213*TY_G28 - TY_B25*TY_G111*TY_G29 - TY_B24*TY_G112*TY_G29 - 
-	TY_B23*TY_G113*TY_G29 + 2*TY_B14*TY_G212*TY_G29 - TY_G214*(TY_B21*TY_G110 + TY_B25*TY_G16 + TY_B24*TY_G17 + TY_B23*TY_G18 + TY_B22*TY_G19 - 2*TY_B14*TY_G27 - 2*TY_B12*TY_G29);
-	
-	TY_w[18] = -(TY_B25*TY_G111*TY_G210) - TY_B24*TY_G112*TY_G210 - TY_B23*TY_G113*TY_G210 - TY_B25*TY_G110*TY_G211 - TY_B24*TY_G111*TY_G211 - TY_B23*TY_G112*TY_G211 - TY_B22*TY_G113*TY_G211 - TY_B24*TY_G110*TY_G212 - 
-	TY_B23*TY_G111*TY_G212 - TY_B22*TY_G112*TY_G212 - TY_B21*TY_G113*TY_G212 - TY_B25*TY_G19*TY_G212 + 2*TY_B14*TY_G210*TY_G212 - TY_B23*TY_G110*TY_G213 - TY_B22*TY_G111*TY_G213 - TY_B21*TY_G112*TY_G213 - 
-	TY_B25*TY_G18*TY_G213 - TY_B24*TY_G19*TY_G213 + 2*TY_B12*TY_G211*TY_G213 - TY_B25*TY_G113*TY_G28 - 
-	TY_G214*(TY_B22*TY_G110 + TY_B21*TY_G111 + TY_B25*TY_G17 + TY_B24*TY_G18 + TY_B23*TY_G19 - 2*TY_B12*TY_G210 - 2*TY_B14*TY_G28) - TY_B25*TY_G112*TY_G29 - TY_B24*TY_G113*TY_G29 + 2*TY_B14*TY_G213*TY_G29 + 
-	TY_B34*(2*TY_G110*TY_G112 + 2*TY_G113*TY_G19 + pow(TY_G111,2)) + TY_B32*(2*TY_G111*TY_G113 + pow(TY_G112,2)) + TY_B14*pow(TY_G211,2) + TY_B12*pow(TY_G212,2);
-	
-	TY_w[19] = 2*TY_B32*TY_G112*TY_G113 + 2*TY_B34*(TY_G111*TY_G112 + TY_G110*TY_G113) - TY_B25*TY_G112*TY_G210 - TY_B24*TY_G113*TY_G210 - TY_B25*TY_G111*TY_G211 - TY_B24*TY_G112*TY_G211 - TY_B23*TY_G113*TY_G211 - 
-	TY_B25*TY_G110*TY_G212 - TY_B24*TY_G111*TY_G212 - TY_B23*TY_G112*TY_G212 - TY_B22*TY_G113*TY_G212 + 2*TY_B14*TY_G211*TY_G212 - TY_B24*TY_G110*TY_G213 - TY_B23*TY_G111*TY_G213 - TY_B22*TY_G112*TY_G213 - 
-	TY_B21*TY_G113*TY_G213 - TY_B25*TY_G19*TY_G213 + 2*TY_B14*TY_G210*TY_G213 + 2*TY_B12*TY_G212*TY_G213 - TY_B25*TY_G113*TY_G29 - 
-	TY_G214*(TY_B23*TY_G110 + TY_B22*TY_G111 + TY_B21*TY_G112 + TY_B25*TY_G18 + TY_B24*TY_G19 - 2*TY_B12*TY_G211 - 2*TY_B14*TY_G29);
-	
-	TY_w[20] = -(TY_B25*TY_G113*TY_G210) - TY_B25*TY_G112*TY_G211 - TY_B24*TY_G113*TY_G211 - TY_B25*TY_G111*TY_G212 - TY_B24*TY_G112*TY_G212 - TY_B23*TY_G113*TY_G212 - TY_B25*TY_G110*TY_G213 - TY_B24*TY_G111*TY_G213 - 
-	TY_B23*TY_G112*TY_G213 - TY_B22*TY_G113*TY_G213 + 2*TY_B14*TY_G211*TY_G213 - (TY_B24*TY_G110 + TY_B23*TY_G111 + TY_B22*TY_G112 + TY_B21*TY_G113 + TY_B25*TY_G19 - 2*TY_B14*TY_G210 - 2*TY_B12*TY_G212)*TY_G214 + 
-	TY_B34*(2*TY_G111*TY_G113 + pow(TY_G112,2)) + TY_B32*pow(TY_G113,2) + TY_B14*pow(TY_G212,2) + TY_B12*pow(TY_G213,2);
-	
-	TY_w[21] = TY_B25*(TY_A23*TY_B14*(-3*TY_A52*TY_B24*TY_B25 + (2*TY_A43*TY_B24 + TY_A42*TY_B25)*TY_B34) + TY_B25*(TY_A22*TY_B14*(-(TY_A52*TY_B25) + TY_A43*TY_B34) 
-																			 + TY_A12*(4*TY_A52*TY_B24*TY_B25 - (3*TY_A43*TY_B24 + TY_A42*TY_B25)*TY_B34)))*pow(TY_B34,3);
-	
-	TY_w[22] = (-(TY_A23*TY_B14) + TY_A12*TY_B25)*(TY_A52*TY_B25 - TY_A43*TY_B34)*pow(TY_B25,2)*pow(TY_B34,3);
-/*	
-	if( debug ) 
-	{
-		sprintf(buf,"\rCoefficients of polynomial\r");
-		XOPNotice(buf);
-		int i;
-		for ( i = 0; i < 23; i ++ ) {
-			sprintf(buf, "w[%d] = %f\r", i, TY_w[i] );
-			XOPNotice(buf);
-		}
-		sprintf(buf, "\r" );
-		XOPNotice(buf);
-	}
- */
-}
-
-double TY_Q( double d2 )
-{
-	return d2 * TY_B32 + pow( d2, 3 ) *  TY_B34;
-}
-
-double TY_V( double d2 )
-{
-	return	-( pow( d2, 2 ) * TY_G13 + pow( d2, 3 ) * TY_G14 + pow( d2, 4 ) * TY_G15 + pow( d2, 5 ) * TY_G16 + 
-			  pow( d2, 6 ) * TY_G17 + pow( d2, 7 ) *  TY_G18 + pow( d2, 8 ) * TY_G19 + pow( d2, 9 ) * TY_G110 + 
-			  pow( d2, 10 ) *  TY_G111 + pow( d2, 11 ) *  TY_G112 + pow( d2, 12 ) *  TY_G113 );
-}
-
-double TY_W( double d2 )
-{
-	return d2  * TY_G22 + pow( d2, 2 ) * TY_G23 + pow( d2, 3 ) * TY_G24 + pow( d2, 4 ) * TY_G25 + pow( d2, 5 ) * TY_G26 + 
-	pow( d2, 6 ) * TY_G27 + pow( d2, 7 ) *  TY_G28 + pow( d2, 8 ) *  TY_G29 + pow( d2, 9 ) * TY_G210 + 
-	pow( d2, 10 ) * TY_G211 + pow( d2, 11 ) * TY_G212 + pow( d2, 12 ) * TY_G213 + pow( d2, 13 ) * TY_G214;
-}
-
-double TY_X( double d2 )
-{
-	return TY_V( d2 ) / TY_W( d2 );
-}
-
-// solve the linear system depending on d1, d2 using Cramer's rule
-void TY_SolveLinearEquations( double d1, double d2, 
-						      double* a, double* b, double* c1, double* c2)
-{
-	double det    = TY_q22 * d1 * d2;
-	double det_a  = TY_qa12  * d2 + TY_qa21  * d1 + TY_qa22  * d1 * d2 + TY_qa23  * d1 * pow( d2, 2 ) + TY_qa32  * pow( d1, 2 ) * d2; 
-	double det_b  = TY_qb12  * d2 + TY_qb21  * d1 + TY_qb22  * d1 * d2 + TY_qb23  * d1 * pow( d2, 2 ) + TY_qb32  * pow( d1, 2 ) * d2; 
-	double det_c1 = TY_qc112 * d2 + TY_qc121 * d1 + TY_qc122 * d1 * d2 + TY_qc123 * d1 * pow( d2, 2 ) + TY_qc132 * pow( d1, 2 ) * d2; 
-	double det_c2 = TY_qc212 * d2 + TY_qc221 * d1 + TY_qc222 * d1 * d2 + TY_qc223 * d1 * pow( d2, 2 ) + TY_qc232 * pow( d1, 2 ) * d2;
-	
-	*a  = det_a  / det;
-	*b  = det_b  / det;
-	*c1 = det_c1 / det;
-	*c2 = det_c2 / det;
-}
-
-//Solve the system of linear and nonlinear equations for given Zi, Ki, phi which gives at 
-// most 22 solutions for the parameters a,b,ci,di. From the set of solutions choose the 
-// physical one and return it.
-int TY_SolveEquations( double Z1, double Z2, double K1, double K2, double phi, 
-					   double* a, double* b, double* c1, double* c2, double* d1, double* d2, 
-				       int debug )
-{
-	
-	// the two coupled non-linear eqautions were reduced to a
-	// 22nd order polynomial, the roots are give all possible solutions 
-	// for d2, than d1 can be computed by the function X 
-	char buf[256];
-	
- 	double real_coefficient[23];
-	double imag_coefficient[23];
-	
-	double real_root[22];
-	double imag_root[22];
-	
-	//integer degree of polynomial
-	int degree = 22;
-	int i;
-	double x,y;
-	double var_a, var_b, var_c1, var_c2, var_d1, var_d2;
-	double sol_a[22], sol_b[22], sol_c1[22], sol_c2[22], sol_d1[22], sol_d2[22];
-	
-	int j = 0;
-	
-	int n_roots,n,selected_root;
-	double dr,qmax,q,dq,min,sum;
-	double *sq,*gr;
-	double Pi = 3.14159265358979323846264338327950288;   /* pi */
-	
-	
-	// reduce system to a polynomial from which all solution are extracted
-	// by doing that a lot of global background variables are set
-	TY_ReduceNonlinearSystem( Z1, Z2, K1, K2, phi, debug );
-	
-	// vector of real and imaginary coefficients in order of decreasing powers
-	for ( i = 0; i <= degree; i++ )
-	{
-		// the global variablw TY_w was set by TY_ReduceNonlinearSystem
-		real_coefficient[i] = TY_w[ 22 - i ];
-		imag_coefficient[i] = 0.;
-	}
-	
-	// Jenkins-Traub method to approximate the roots of the polynomial
-	cpoly( real_coefficient, imag_coefficient, degree, real_root, imag_root );
-	
-	// show the result if in debug mode
-/*	
-	if ( debug )
-	{
-		for ( i = 0; i < degree; i++ )
-		{
-			x = real_root[i];
-			y = imag_root[i];
-			if ( chop( y ) == 0 )
-				sprintf(buf, "root(%d) = %g\r", i+1, x );
-			else
-				sprintf(buf, "root(%d) = %g + %g i\r", i+1, x, y );
-			XOPNotice(buf);
-		}
-		sprintf(buf, "\r" );
-		XOPNotice(buf);
-	}
- */
-	
-	// select real roots and those satisfying Q(x) != 0 and W(x) != 0
-	// Paper: Cluster formation in two-Yukawa Fluids, J. Chem. Phys. 122, 2005
-	// The right set of (a, b, c1, c2, d1, d2) should have the following properties:
-	// (1) a > 0 
-	// (2) d1, d2 are real
-	// (3) vi/Ki > 0 <=> g(Zi) > 0
-	// (4) if there is still more than root, calculate g(r) for each root
-	//     and g(r) of the correct root should have the minimum average value 
-	//	   inside the hardcore	
-
-	for ( i = 0; i < degree; i++ )
-	{
-		x = real_root[i];
-		y = imag_root[i];
-		
-		if ( chop( y ) == 0 && TY_W( x ) != 0 && TY_Q( x ) != 0 )
-		{
-			var_d1 = TY_X( x );
-			var_d2 = x;
-			
-			// solution of linear system for given d1, d2 to obtain a,b,ci,di
-			TY_SolveLinearEquations( var_d1, var_d2, &var_a, &var_b, &var_c1, &var_c2 );
-			
-			// select physical solutions, for details check paper: "Cluster formation in
-			// two-Yukawa fluids", J. Chem. Phys. 122 (2005)
-			if ( var_a > 0 && 
-				 TY_g( Z1, phi, Z1, Z2, var_a, var_b, var_c1, var_c2, var_d1, var_d2 ) > 0 &&
-	 			 TY_g( Z2, phi, Z1, Z2, var_a, var_b, var_c1, var_c2, var_d1, var_d2 ) > 0 )
-			{
-				sol_a[j]  = var_a;
-				sol_b[j]  = var_b;
-				sol_c1[j] = var_c1;
-				sol_c2[j] = var_c2;
-				sol_d1[j] = var_d1;
-				sol_d2[j] = var_d2;
-/*				
-				if ( debug )
-				{
-					double eq1 = chop( TY_LinearEquation_1( Z1, Z2, K1, K2, phi, sol_a[j], sol_b[j], sol_c1[j], sol_c2[j], sol_d1[j], sol_d2[j] ) );
-					double eq2 = chop( TY_LinearEquation_2( Z1, Z2, K1, K2, phi, sol_a[j], sol_b[j], sol_c1[j], sol_c2[j], sol_d1[j], sol_d2[j] ) );
-					double eq3 = chop( TY_LinearEquation_3( Z1, Z2, K1, K2, phi, sol_a[j], sol_b[j], sol_c1[j], sol_c2[j], sol_d1[j], sol_d2[j] ) );
-					double eq4 = chop( TY_LinearEquation_4( Z1, Z2, K1, K2, phi, sol_a[j], sol_b[j], sol_c1[j], sol_c2[j], sol_d1[j], sol_d2[j] ) );
-					double eq5 = chop( TY_NonlinearEquation_1( Z1, Z2, K1, K2, phi, sol_a[j], sol_b[j], sol_c1[j], sol_c2[j], sol_d1[j], sol_d2[j] ) );
-					double eq6 = chop( TY_NonlinearEquation_2( Z1, Z2, K1, K2, phi, sol_a[j], sol_b[j], sol_c1[j], sol_c2[j], sol_d1[j], sol_d2[j] ) );
-					
-					sprintf(buf, "solution[%d] = (%g, %g, %g, %g, %g, %g), ( eq == 0 ) = (%g, %g, %g, %g, %g, %g)\r", j, 
-						   sol_a[j], sol_b[j], sol_c1[j], sol_c2[j], sol_d1[j], sol_d2[j], 
-						   eq1 , eq2, eq3, eq4, eq5, eq6 );
-					XOPNotice(buf);
-				}
- */
-				j++;
-			}
-		}
-	}
-	// number  remaining roots 
-	n_roots = j;
-	
-	
-	// if there is still more than one root left, than choose the one with the minimum
-	// average value inside the hardcore
-	if ( n_roots > 1 )
-	{
-		// the number of q values should be a power of 2
-		// in order to speed up the FFT
-		n = 1 << 14;
-		
-		// the maximum q value should be large enough 
-		// to enable a reasoble approximation of g(r)
-		qmax = 16 * 10 * 2 * Pi;
-		dq = qmax / ( n - 1 );
-		
-		// step size for g(r) = dr
-		
-		// allocate memory for pair correlation function g(r)
-		// and structure factor S(q)
-		sq = malloc( sizeof( double ) * n );
-		gr = malloc( sizeof( double ) * n );
-		
-		// loop over all remaining roots
-		min = 1e99;
-		selected_root = 10;	
-		sum = 0;
-		for ( j = 0; j < n_roots; j++) 
-		{
-			// calculate structure factor at different q values
-			for ( i = 0; i < n; i++) 
-			{
-				q = dq * i;
-				sq[i] = SqTwoYukawa( q, Z1, Z2, K1, K2, phi, sol_a[j], sol_b[j], sol_c1[j], sol_c2[j], sol_d1[j], sol_d2[j] );
-/*				
-				if(i<20 && debug) {
-					sprintf(buf, "after SqTwoYukawa: s(q) = %g\r",sq[i] );
-					XOPNotice(buf);	
-				}
- */
-			}
-			
-			// calculate pair correlation function for given
-			// structure factor, g(r) is computed at values
-			// r(i) = i * dr
-			PairCorrelation( phi, dq, sq, &dr, gr, n );
-			// determine sum inside the hardcore 
-			// 0 =< r < 1 of the pair-correlation function
-			sum = 0;
-			for (i = 0; i < floor( 1. / dr ); i++ )  {
-				sum += fabs( gr[i] );
-/*				
-				if(i<20 && debug) {
-					sprintf(buf, "g(r) in core = %g\r",fabs(gr[i]));
-					XOPNotice(buf);
-				}
-*/				
-			}
-
-			if ( sum < min )
-			{
-				min = sum;
-				selected_root = j;
-			}
-		}	
-		free( gr );
-		free( sq );
-		
-		// physical solution was found
-		*a  = sol_a [ selected_root ];//sol_a [ selected_root ];
-		*b  = sol_b [ selected_root ];
-		*c1 = sol_c1[ selected_root ];
-		*c2 = sol_c2[ selected_root ];
-		*d1 = sol_d1[ selected_root ];
-		*d2 = sol_d2[ selected_root ];
-		
-		return 1;
-	}
-	else if ( n_roots == 1 ) 
-	{
-		*a  = sol_a [0];
-		*b  = sol_b [0];
-		*c1 = sol_c1[0];
-		*c2 = sol_c2[0];
-		*d1 = sol_d1[0];
-		*d2 = sol_d2[0];
-		
-		return 1;
-	}
-
-	// no solution was found
-	return 0;
-}
Index: c/sas/models/c_extension/libigor/2Y_TwoYukawa.h
===================================================================
--- src/sas/models/c_extension/libigor/2Y_TwoYukawa.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,18 +1,0 @@
-/*
- *  TwoYukawa.h
- *  TwoYukawa
- *
- *  Created by Marcus Hennig on 5/8/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-int TY_SolveEquations( double Z1, double Z2, double K1, double K2, double phi, 
-				       double a[], double b[], double c1[], double c2[], double d1[], double d2[], 
-				       int debug );
-
-int TY_CheckSolution( double Z1, double Z2, double K1, double K2, double phi, 
-				      double a, double b, double c1, double c2, double d1, double d2 );
-
-double SqTwoYukawa( double q, 
-			        double Z1, double Z2, double K1, double K2, double phi,
-			        double a, double b, double c1, double c2, double d1, double d2 );
Index: c/sas/models/c_extension/libigor/2Y_cpoly.c
===================================================================
--- src/sas/models/c_extension/libigor/2Y_cpoly.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,660 +1,0 @@
-/*
- *******************************************************************************
- *
- *
- *                       Copyright (c) 2002
- *                       Henrik Vestermark
- *                       Denmark
- *
- *                       All Rights Reserved
- *
- *   This source file is subject to the terms and conditions of the
- *   Henrik Vestermark Software License Agreement which restricts the manner
- *   in which it may be used.
- *
- *******************************************************************************
- *
- *
- * Module name     :   cpoly.cpp
- * Module ID Nbr   :   
- * Description     :   cpoly.cpp -- Jenkins-Traub real polynomial root finder.
- *                     Translation of TOMS493 from FORTRAN to C. This
- *                     implementation of Jenkins-Traub partially adapts
- *                     the original code to a C environment by restruction
- *                     many of the 'goto' controls to better fit a block
- *                     structured form. It also eliminates the global memory
- *                     allocation in favor of local, dynamic memory management.
- *
- *                     The calling conventions are slightly modified to return
- *                     the number of roots found as the function value.
- *
- *                     INPUT:
- *                     opr - double precision vector of real coefficients in order of
- *                          decreasing powers.
- *                     opi - double precision vector of imaginary coefficients in order of
- *                          decreasing powers.
- *                     degree - integer degree of polynomial
- *
- *                     OUTPUT:
- *                     zeror,zeroi - output double precision vectors of the
- *                          real and imaginary parts of the zeros.
- *                            to be consistent with rpoly.cpp the zeros is inthe index
- *                            [0..max_degree-1]
- *
- *                     RETURN:
- *                     returnval:   -1 if leading coefficient is zero, otherwise
- *                          number of roots found. 
- * --------------------------------------------------------------------------
- * Change Record   :   
- *
- * Version	Author/Date		Description of changes
- * -------  -----------		----------------------
- * 01.01		HVE/021101		Initial release
- *
- * -- SRK changed name of *pi to *piw (and all occurances in this file) to avoid the conflict with pi in Apple's fp.h
- *
- * End of Change Record
- * --------------------------------------------------------------------------
- */
-
-
-/* define version string */
-
-#include <stdlib.h>
-#include <math.h>
-#include <float.h>
-
-static double sr, si, tr, ti, pvr, pvi, are, mre, eta, infin;
-static int nn;
-static double *pr, *piw, *hr, *hi, *qpr, *qpi, *qhr, *qhi, *shr, *shi; 
-
-static void noshft( const int l1 );
-static void fxshft( const int l2, double *zr, double *zi, int *conv );
-static void vrshft( const int l3, double *zr, double *zi, int *conv );
-static void calct( int *bol );
-static void nexth( const int bol );
-static void polyev( const int nn, const double sr, const double si, const double pr[], const double piw[], double qr[], double qi[], double *pvr, double *pvi );
-static double errev( const int nn, const double qr[], const double qi[], const double ms, const double mp, const double are, const double mre );
-static void cauchy( const int nn, double pt[], double q[], double *fn_val );
-static double scale( const int nn, const double pt[], const double eta, const double infin, const double smalno, const double base );
-static void cdivid( const double ar, const double ai, const double br, const double bi, double *cr, double *ci );
-static double cmod( const double r, const double i );
-static void mcon( double *eta, double *infiny, double *smalno, double *base );
-
-int cpoly( const double *opr, const double *opi, int degree, double *zeror, double *zeroi ) 
-{
-	int cnt1, cnt2, idnn2, i, conv;
-	double xx, yy, cosr, sinr, smalno, base, xxx, zr, zi, bnd;
-	
-	mcon( &eta, &infin, &smalno, &base );
-	are = eta;
-	mre = 2.0 * sqrt( 2.0 ) * eta;
-	xx = 0.70710678;
-	yy = -xx;
-	cosr = -0.060756474;
-	sinr = -0.99756405;
-	nn = degree;  
-	
-	// Algorithm fails if the leading coefficient is zero
-	if( opr[ 0 ] == 0 && opi[ 0 ] == 0 )
-		return -1;
-	
-	// Allocate arrays
-	pr = malloc( sizeof( double ) * ( degree + 1 ) );
-	piw = malloc( sizeof( double ) * ( degree + 1 ) );
-	hr =malloc( sizeof( double ) * ( degree + 1 ) );
-	hi = malloc( sizeof( double ) * ( degree + 1 ) );
-	qpr= malloc( sizeof( double ) * ( degree + 1 ) );
-	qpi= malloc( sizeof( double ) * ( degree + 1 ) );
-	qhr= malloc( sizeof( double ) * ( degree + 1 ) );
-	qhi= malloc( sizeof( double ) * ( degree + 1 ) );
-	shr= malloc( sizeof( double ) * ( degree + 1 ) );
-	shi= malloc( sizeof( double ) * ( degree + 1 ) );
-	
-	// Remove the zeros at the origin if any
-	while( opr[ nn ] == 0 && opi[ nn ] == 0 )
-	{
-		idnn2 = degree - nn;
-		zeror[ idnn2 ] = 0;
-		zeroi[ idnn2 ] = 0;
-		nn--;
-	}
-	
-	// Make a copy of the coefficients
-	for( i = 0; i <= nn; i++ )
-	{
-		pr[ i ] = opr[ i ];
-		piw[ i ] = opi[ i ];
-		shr[ i ] = cmod( pr[ i ], piw[ i ] );
-	}
-	
-	// Scale the polynomial
-	bnd = scale( nn, shr, eta, infin, smalno, base );
-	if( bnd != 1 )
-		for( i = 0; i <= nn; i++ )
-		{
-			pr[ i ] *= bnd;
-			piw[ i ] *= bnd;
-		}
-	
-search: 
-	if( nn <= 1 )
-	{
-		cdivid( -pr[ 1 ], -piw[ 1 ], pr[ 0 ], piw[ 0 ], &zeror[ degree-1 ], &zeroi[ degree-1 ] );
-		goto finish;
-	}
-	
-	// Calculate bnd, alower bound on the modulus of the zeros
-	for( i = 0; i<= nn; i++ )
-		shr[ i ] = cmod( pr[ i ], piw[ i ] );
-	
-	cauchy( nn, shr, shi, &bnd );
-	
-	// Outer loop to control 2 Major passes with different sequences of shifts
-	for( cnt1 = 1; cnt1 <= 2; cnt1++ )
-	{
-		// First stage  calculation , no shift
-		noshft( 5 );
-		
-		// Inner loop to select a shift
-		for( cnt2 = 1; cnt2 <= 9; cnt2++ )
-		{
-			// Shift is chosen with modulus bnd and amplitude rotated by 94 degree from the previous shif
-			xxx = cosr * xx - sinr * yy;
-			yy = sinr * xx + cosr * yy;
-			xx = xxx;
-			sr = bnd * xx;
-			si = bnd * yy;
-			
-			// Second stage calculation, fixed shift
-			fxshft( 10 * cnt2, &zr, &zi, &conv );
-			if( conv )
-            {
-				// The second stage jumps directly to the third stage ieration
-				// If successful the zero is stored and the polynomial deflated
-				idnn2 = degree - nn;
-				zeror[ idnn2 ] = zr;
-				zeroi[ idnn2 ] = zi;
-				nn--;
-				for( i = 0; i <= nn; i++ )
-				{
-					pr[ i ] = qpr[ i ];
-					piw[ i ] = qpi[ i ];
-				}
-				goto search;
-            }
-			// If the iteration is unsuccessful another shift is chosen
-		}
-		// if 9 shifts fail, the outer loop is repeated with another sequence of shifts
-	}
-	
-	// The zerofinder has failed on two major passes
-	// return empty handed with the number of roots found (less than the original degree)
-	degree -= nn;
-	
-finish:
-	// Deallocate arrays
-	free( pr );
-	free( piw );
-	free( hr );
-	free( hi );
-	free( qpr );
-	free( qpi );
-	free( qhr );
-	free( qhi );
-	free( shr );
-	free( shi );
-	
-	return degree;       
-}
-
-
-// COMPUTES  THE DERIVATIVE  POLYNOMIAL AS THE INITIAL H
-// POLYNOMIAL AND COMPUTES L1 NO-SHIFT H POLYNOMIALS.
-//
-static void noshft( const int l1 )
-{
-	int i, j, jj, n, nm1;
-	double xni, t1, t2;
-	
-	n = nn;
-	nm1 = n - 1;
-	for( i = 0; i < n; i++ )
-	{
-		xni = nn - i;
-		hr[ i ] = xni * pr[ i ] / n;
-		hi[ i ] = xni * piw[ i ] / n;
-	}
-	for( jj = 1; jj <= l1; jj++ )
-	{
-		if( cmod( hr[ n - 1 ], hi[ n - 1 ] ) > eta * 10 * cmod( pr[ n - 1 ], piw[ n - 1 ] ) )
-		{
-			cdivid( -pr[ nn ], -piw[ nn ], hr[ n - 1 ], hi[ n - 1 ], &tr, &ti );
-			for( i = 0; i < nm1; i++ )
-            {
-				j = nn - i - 1;
-				t1 = hr[ j - 1 ];
-				t2 = hi[ j - 1 ];
-				hr[ j ] = tr * t1 - ti * t2 + pr[ j ];
-				hi[ j ] = tr * t2 + ti * t1 + piw[ j ];
-            }
-			hr[ 0 ] = pr[ 0 ];
-			hi[ 0 ] = piw[ 0 ];
-		}
-		else
-		{
-			// If the constant term is essentially zero, shift H coefficients
-			for( i = 0; i < nm1; i++ )
-            {
-				j = nn - i - 1;
-				hr[ j ] = hr[ j - 1 ];
-				hi[ j ] = hi[ j - 1 ];
-            }
-			hr[ 0 ] = 0;
-			hi[ 0 ] = 0;
-		}
-	}
-}
-
-// COMPUTES L2 FIXED-SHIFT H POLYNOMIALS AND TESTS FOR CONVERGENCE.
-// INITIATES A VARIABLE-SHIFT ITERATION AND RETURNS WITH THE
-// APPROXIMATE ZERO IF SUCCESSFUL.
-// L2 - LIMIT OF FIXED SHIFT STEPS
-// ZR,ZI - APPROXIMATE ZERO IF CONV IS .TRUE.
-// CONV  - LOGICAL INDICATING CONVERGENCE OF STAGE 3 ITERATION
-//
-static void fxshft( const int l2, double *zr, double *zi, int *conv )
-{
-	int i, j, n;
-	int test, pasd, bol;
-	double otr, oti, svsr, svsi;
-	
-	n = nn;
-	polyev( nn, sr, si, pr, piw, qpr, qpi, &pvr, &pvi );
-	test = 1;
-	pasd = 0;
-	
-	// Calculate first T = -P(S)/H(S)
-	calct( &bol );
-	
-	// Main loop for second stage
-	for( j = 1; j <= l2; j++ )
-	{
-		otr = tr;
-		oti = ti;
-		
-		// Compute the next H Polynomial and new t
-		nexth( bol );
-		calct( &bol );
-		*zr = sr + tr;
-		*zi = si + ti;
-		
-		// Test for convergence unless stage 3 has failed once or this
-		// is the last H Polynomial
-		if( !( bol || !test || j == 12 ) )
-			if( cmod( tr - otr, ti - oti ) < 0.5 * cmod( *zr, *zi ) )
-            {
-				if( pasd )
-				{
-					// The weak convergence test has been passwed twice, start the third stage
-					// Iteration, after saving the current H polynomial and shift
-					for( i = 0; i < n; i++ )
-					{
-						shr[ i ] = hr[ i ];
-						shi[ i ] = hi[ i ];
-					}
-					svsr = sr;
-					svsi = si;
-					vrshft( 10, zr, zi, conv );
-					if( *conv ) return;
-					
-					//The iteration failed to converge. Turn off testing and restore h,s,pv and T
-					test = 0;
-					for( i = 0; i < n; i++ )
-					{
-						hr[ i ] = shr[ i ];
-						hi[ i ] = shi[ i ];
-					}
-					sr = svsr;
-					si = svsi;
-					polyev( nn, sr, si, pr, piw, qpr, qpi, &pvr, &pvi );
-					calct( &bol );
-					continue;
-				}
-				pasd = 1;
-            }
-			else
-				pasd = 0;
-	}
-	
-	// Attempt an iteration with final H polynomial from second stage
-	vrshft( 10, zr, zi, conv );
-}
-
-// CARRIES OUT THE THIRD STAGE ITERATION.
-// L3 - LIMIT OF STEPS IN STAGE 3.
-// ZR,ZI   - ON ENTRY CONTAINS THE INITIAL ITERATE, IF THE
-//           ITERATION CONVERGES IT CONTAINS THE FINAL ITERATE ON EXIT.
-// CONV    -  .TRUE. IF ITERATION CONVERGES
-//
-static void vrshft( const int l3, double *zr, double *zi, int *conv )
-{
-	int b, bol;
-	int i, j;
-	double mp, ms, omp, relstp, r1, r2, tp;
-	
-	*conv = 0;
-	b = 0;
-	sr = *zr;
-	si = *zi;
-	
-	// Main loop for stage three
-	for( i = 1; i <= l3; i++ )
-	{
-		// Evaluate P at S and test for convergence
-		polyev( nn, sr, si, pr, piw, qpr, qpi, &pvr, &pvi );
-		mp = cmod( pvr, pvi );
-		ms = cmod( sr, si );
-		if( mp <= 20 * errev( nn, qpr, qpi, ms, mp, are, mre ) )
-		{
-			// Polynomial value is smaller in value than a bound onthe error
-			// in evaluationg P, terminate the ietartion
-			*conv = 1;
-			*zr = sr;
-			*zi = si;
-			return;
-		}
-		if( i != 1 )
-		{
-			if( !( b || mp < omp || relstp >= 0.05 ) )
-            {
-				// Iteration has stalled. Probably a cluster of zeros. Do 5 fixed 
-				// shift steps into the cluster to force one zero to dominate
-				tp = relstp;
-				b = 1;
-				if( relstp < eta ) tp = eta;
-				r1 = sqrt( tp );
-				r2 = sr * ( 1 + r1 ) - si * r1;
-				si = sr * r1 + si * ( 1 + r1 );
-				sr = r2;
-				polyev( nn, sr, si, pr, piw, qpr, qpi, &pvr, &pvi );
-				for( j = 1; j <= 5; j++ )
-				{
-					calct( &bol );
-					nexth( bol );
-				}
-				omp = infin;
-				goto _20;
-            }
-			
-			// Exit if polynomial value increase significantly
-			if( mp *0.1 > omp ) return;
-		}
-		
-		omp = mp;
-		
-		// Calculate next iterate
-	_20:  calct( &bol );
-		nexth( bol );
-		calct( &bol );
-		if( !bol )
-		{
-			relstp = cmod( tr, ti ) / cmod( sr, si );
-			sr += tr;
-			si += ti;
-		}
-	}
-}
-
-// COMPUTES  T = -P(S)/H(S).
-// BOOL   - LOGICAL, SET TRUE IF H(S) IS ESSENTIALLY ZERO.
-static void calct( int *bol )
-{
-	int n;
-	double hvr, hvi;
-	
-	n = nn;
-	
-	// evaluate h(s)
-	polyev( n - 1, sr, si, hr, hi, qhr, qhi, &hvr, &hvi );
-	*bol = cmod( hvr, hvi ) <= are * 10 * cmod( hr[ n - 1 ], hi[ n - 1 ] ) ? 1 : 0;
-	if( !*bol )
-	{
-		cdivid( -pvr, -pvi, hvr, hvi, &tr, &ti );
-		return;
-	}
-	
-	tr = 0;
-	ti = 0;
-}
-
-// CALCULATES THE NEXT SHIFTED H POLYNOMIAL.
-// BOOL   -  LOGICAL, IF .TRUE. H(S) IS ESSENTIALLY ZERO
-//
-static void nexth( const int bol )
-{
-	int j, n;
-	double t1, t2;
-	
-	n = nn;
-	if( !bol )
-	{
-		for( j = 1; j < n; j++ )
-		{
-			t1 = qhr[ j - 1 ];
-			t2 = qhi[ j - 1 ];
-			hr[ j ] = tr * t1 - ti * t2 + qpr[ j ];
-			hi[ j ] = tr * t2 + ti * t1 + qpi[ j ];
-		}
-		hr[ 0 ] = qpr[ 0 ];
-		hi[ 0 ] = qpi[ 0 ];
-		return;
-	}
-	
-	// If h[s] is zero replace H with qh
-	for( j = 1; j < n; j++ )
-	{
-		hr[ j ] = qhr[ j - 1 ];
-		hi[ j ] = qhi[ j - 1 ];
-	}
-	hr[ 0 ] = 0;
-	hi[ 0 ] = 0;
-}
-
-// EVALUATES A POLYNOMIAL  P  AT  S  BY THE HORNER RECURRENCE
-// PLACING THE PARTIAL SUMS IN Q AND THE COMPUTED VALUE IN PV.
-//  
-static void polyev( const int nn, const double sr, const double si, const double pr[], const double piw[], double qr[], double qi[], double *pvr, double *pvi )  
-{
-	int i;
-	double t;
-	
-	qr[ 0 ] = pr[ 0 ];
-	qi[ 0 ] = piw[ 0 ];
-	*pvr = qr[ 0 ];
-	*pvi = qi[ 0 ];
-	
-	for( i = 1; i <= nn; i++ )
-	{
-		t = ( *pvr ) * sr - ( *pvi ) * si + pr[ i ];
-		*pvi = ( *pvr ) * si + ( *pvi ) * sr + piw[ i ];
-		*pvr = t;
-		qr[ i ] = *pvr;
-		qi[ i ] = *pvi;
-	}
-}
-
-// BOUNDS THE ERROR IN EVALUATING THE POLYNOMIAL BY THE HORNER RECURRENCE.
-// QR,QI - THE PARTIAL SUMS
-// MS    -MODULUS OF THE POINT
-// MP    -MODULUS OF POLYNOMIAL VALUE
-// ARE, MRE -ERROR BOUNDS ON COMPLEX ADDITION AND MULTIPLICATION
-//
-static double errev( const int nn, const double qr[], const double qi[], const double ms, const double mp, const double are, const double mre )
-{
-	int i;
-	double e;
-	
-	e = cmod( qr[ 0 ], qi[ 0 ] ) * mre / ( are + mre );
-	for( i = 0; i <= nn; i++ )
-		e = e * ms + cmod( qr[ i ], qi[ i ] );
-	
-	return e * ( are + mre ) - mp * mre;
-}
-
-// CAUCHY COMPUTES A LOWER BOUND ON THE MODULI OF THE ZEROS OF A
-// POLYNOMIAL - PT IS THE MODULUS OF THE COEFFICIENTS.
-//
-static void cauchy( const int nn, double pt[], double q[], double *fn_val )
-{
-	int i, n;
-	double x, xm, f, dx, df;
-	
-	pt[ nn ] = -pt[ nn ];
-	
-	// Compute upper estimate bound
-	n = nn;
-	x = exp( log( -pt[ nn ] ) - log( pt[ 0 ] ) ) / n;
-	if( pt[ n - 1 ] != 0 )
-	{
-		// Newton step at the origin is better, use it
-		xm = -pt[ nn ] / pt[ n - 1 ];
-		if( xm < x ) x = xm;
-	}
-	
-	// Chop the interval (0,x) until f < 0
-	while(1)
-	{
-		xm = x * 0.1;
-		f = pt[ 0 ];
-		for( i = 1; i <= nn; i++ )
-			f = f * xm + pt[ i ];
-		if( f <= 0 )
-			break;
-		x = xm;
-	}
-	dx = x;
-	
-	// Do Newton iteration until x converges to two decimal places
-	while( fabs( dx / x ) > 0.005 )
-	{
-		q[ 0 ] = pt[ 0 ];
-		for( i = 1; i <= nn; i++ )
-			q[ i ] = q[ i - 1 ] * x + pt[ i ];
-		f = q[ nn ];
-		df = q[ 0 ];
-		for( i = 1; i < n; i++ )
-			df = df * x + q[ i ];
-		dx = f / df;
-		x -= dx;
-	}
-	
-	*fn_val = x;
-}
-
-// RETURNS A SCALE FACTOR TO MULTIPLY THE COEFFICIENTS OF THE POLYNOMIAL.
-// THE SCALING IS DONE TO AVOID OVERFLOW AND TO AVOID UNDETECTED UNDERFLOW
-// INTERFERING WITH THE CONVERGENCE CRITERION.  THE FACTOR IS A POWER OF THE
-// BASE.
-// PT - MODULUS OF COEFFICIENTS OF P
-// ETA, INFIN, SMALNO, BASE - CONSTANTS DESCRIBING THE FLOATING POINT ARITHMETIC.
-//
-static double scale( const int nn, const double pt[], const double eta, const double infin, const double smalno, const double base )
-{
-	int i, l;
-	double hi, lo, max, min, x, sc;
-	double fn_val;
-	
-	// Find largest and smallest moduli of coefficients
-	hi = sqrt( infin );
-	lo = smalno / eta;
-	max = 0;
-	min = infin;
-	
-	for( i = 0; i <= nn; i++ )
-	{
-		x = pt[ i ];
-		if( x > max ) max = x;
-		if( x != 0 && x < min ) min = x;
-	}
-	
-	// Scale only if there are very large or very small components
-	fn_val = 1;
-	if( min >= lo && max <= hi ) return fn_val;
-	x = lo / min;
-	if( x <= 1 )
-		sc = 1 / ( sqrt( max )* sqrt( min ) );
-	else
-	{
-		sc = x;
-		if( infin / sc > max ) sc = 1;
-	}
-	l = (int)( log( sc ) / log(base ) + 0.5 );
-	fn_val = pow( base , l );
-	return fn_val;
-}
-
-// COMPLEX DIVISION C = A/B, AVOIDING OVERFLOW.
-//
-static void cdivid( const double ar, const double ai, const double br, const double bi, double *cr, double *ci )
-{
-	double r, d, t, infin;
-	
-	if( br == 0 && bi == 0 )
-	{
-		// Division by zero, c = infinity
-		mcon( &t, &infin, &t, &t );
-		*cr = infin;
-		*ci = infin;
-		return;
-	}
-	
-	if( fabs( br ) < fabs( bi ) )
-	{
-		r = br/ bi;
-		d = bi + r * br;
-		*cr = ( ar * r + ai ) / d;
-		*ci = ( ai * r - ar ) / d;
-		return;
-	}
-	
-	r = bi / br;
-	d = br + r * bi;
-	*cr = ( ar + ai * r ) / d;
-	*ci = ( ai - ar * r ) / d;
-}
-
-// MODULUS OF A COMPLEX NUMBER AVOIDING OVERFLOW.
-//
-static double cmod( const double r, const double i )
-{
-	double ar, ai;
-	
-	ar = fabs( r );
-	ai = fabs( i );
-	if( ar < ai )
-		return ai * sqrt( 1.0 + pow( ( ar / ai ), 2.0 ) );
-	
-	if( ar > ai )
-		return ar * sqrt( 1.0 + pow( ( ai / ar ), 2.0 ) );
-	
-	return ar * sqrt( 2.0 );
-}
-
-// MCON PROVIDES MACHINE CONSTANTS USED IN VARIOUS PARTS OF THE PROGRAM.
-// THE USER MAY EITHER SET THEM DIRECTLY OR USE THE STATEMENTS BELOW TO
-// COMPUTE THEM. THE MEANING OF THE FOUR CONSTANTS ARE -
-// ETA       THE MAXIMUM RELATIVE REPRESENTATION ERROR WHICH CAN BE DESCRIBED
-//           AS THE SMALLEST POSITIVE FLOATING-POINT NUMBER SUCH THAT
-//           1.0_dp + ETA &gt; 1.0.
-// INFINY    THE LARGEST FLOATING-POINT NUMBER
-// SMALNO    THE SMALLEST POSITIVE FLOATING-POINT NUMBER
-// BASE      THE BASE OF THE FLOATING-POINT NUMBER SYSTEM USED
-//
-static void mcon( double *eta, double *infiny, double *smalno, double *base )
-{
-	*base = 10;//DBL_RADIX;
-	*eta = DBL_EPSILON;
-	*infiny = DBL_MAX;
-	*smalno = DBL_MIN;
-}
Index: c/sas/models/c_extension/libigor/2Y_cpoly.h
===================================================================
--- src/sas/models/c_extension/libigor/2Y_cpoly.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-/*
- *  cpoly.h
- *  TwoYukawa
- *
- *  Created by Marcus Hennig on 5/8/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-int cpoly( const double *opr, const double *opi, int degree, double *zeror, double *zeroi ); 
Index: c/sas/models/c_extension/libigor/2Y_utility.c
===================================================================
--- src/sas/models/c_extension/libigor/2Y_utility.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,17 +1,0 @@
-/*
- *  utility.c
- *  twoyukawa
- *
- *  Created by Marcus Hennig on 5/13/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-
-#include "2Y_utility.h"
-double chop( double x )
-{
-	if ( fabs(x) < 1E-6 )
-		return 0;
-	else 
-		return x;
-}
Index: c/sas/models/c_extension/libigor/2Y_utility.h
===================================================================
--- src/sas/models/c_extension/libigor/2Y_utility.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-/*
- *  utility.h
- *  twoyukawa
- *
- *  Created by Marcus Hennig on 5/13/10.
- *  Copyright 2010 __MyCompanyName__. All rights reserved.
- *
- */
-#include <math.h>
-
-double chop( double x );
Index: c/sas/models/c_extension/libigor/GaussWeights.c
===================================================================
--- src/sas/models/c_extension/libigor/GaussWeights.c	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,520 +1,0 @@
-/*
- *  GaussWeights.c
- *  SASAnalysis
- *
- *  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: c/sas/models/c_extension/libigor/GaussWeights.h
===================================================================
--- src/sas/models/c_extension/libigor/GaussWeights.h	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,24 +1,0 @@
-#ifndef GAUSSWEIGHTS_H
-#define GAUSSWEIGHTS_H
-/*
- *  GaussWeights.h
- *  SASAnalysis
- *
- *  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: c/sas/models/c_extension/libigor/libCylinder.c
===================================================================
--- src/sas/models/c_extension/libigor/libCylinder.c	(revision 8d302cdc162557c8a5f087402b860273c53602b7)
+++ 	(revision )
@@ -1,3616 +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;
-}
-
-
-/*
- * Massive rectangular prism (a <= b <=c) 
- * using eqns. (12)+(16) from Nayuk & Huber, Z. Phys. Chem. 226, 837 (2012).
- * It is totally equivalent to the Parallelepiped model in this library,
- * but instead of using as input the a, b, and c sides of the prism,
- * it uses a and the ratios (b/a) and (c/a).
- * This allows to keep the shape when using the polydispersity.
- */
-
-double
-RectangularPrism(double dp[], double q)
-{
-    int i, j;
-    double scale, aa, bb, cc, delrho, bkg;		
-    int nordi=76;			        //order of integration
-    int nordj=76;
-    double Pi;
-    double sumi, sumj;
-    double v1a, v1b, v2a, v2b;		// upper and lower integration limits
-    double answer;
-    double theta, phi, arg, termA, termB, termC, AP, ahalf, bhalf, chalf;
-    double vol, sldp, sld;
-
-    Pi = 4.0*atan(1.0);
-
-    scale = dp[0];	
-    aa = dp[1];          // parameter short_side
-    bb = aa * dp[2];     // parameter b/a ratio
-    cc = aa * dp[3];     // parameter c/a ratio
-    sldp = dp[4];        // scattering length density of the object
-    sld = dp[5];         // scattering length density of the solvent
-    delrho = sldp - sld;
-    bkg = dp[6];
-
-    vol = aa*bb*cc;
-    ahalf = 0.5 * aa;
-    bhalf = 0.5 * bb;
-    chalf = 0.5 * cc;
-
-   //Integration limits to use in Gaussian quadrature
-    v1a = 0.;
-    v1b = Pi/2.;  //theta integration limits
-    v2a = 0.;
-    v2b = Pi/2.;  //phi integration limits
-
-    sumi = 0.0;
-    for(i=0;i<nordi;i++) {
-
-	    theta = ( Gauss76Z[i]*(v1b-v1a) + v1a + v1b )/2.0;	//z values for gaussian quadrature
-
-	    arg = q*chalf*cos(theta);
-	    if (fabs(arg) > 1.e-16) {termC = sin(arg) / arg;} else {termC = 1.0;}  
-
-	    sumj = 0.0;
-	    for(j=0;j<nordj;j++) {
-
-                phi = ( Gauss76Z[j]*(v2b-v2a) + v2a + v2b )/2.0; //z values for gaussian quadrature
-
-	        // Amplitude AP from eqn. (12), rewritten to avoid round-off effects when arg=0
-
-	        arg = q*ahalf*sin(theta)*sin(phi); 
-	        if (fabs(arg) > 1.e-16) {termA = sin(arg) / arg;} else {termA = 1.0;}
-	       
-	        arg = q*bhalf*sin(theta)*cos(phi); 
-	        if (fabs(arg) > 1.e-16) {termB = sin(arg) / arg;} else {termB = 1.0;}	  
-               
-	        AP = termA * termB * termC;  
-
-	        sumj += Gauss76Wt[j] * (AP*AP);
-
-	    }
-
-	    sumj = (v2b-v2a) * sumj / 2.0;
-	    sumi += Gauss76Wt[i] * sumj * sin(theta);
-
-    }
-
-    answer = (v1b-v1a)/2.0*sumi;
-
-    // Normalize by Pi (Eqn. 16). 
-    // The term (ABC)^2 does not appear because it was introduced before from the defs of termA, termB, termC
-    // The factor 2 appears because the theta integral has been defined between 0 and pi/2, instead of 0 to pi
-    answer = 2.0 * answer / Pi; //Form factor P(q)
-
-    // 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;
-}
-
-
-/*
- * Hollow rectangular prism (a <= b <=c) with infinitely thin walls
- * using eqn. (7-11) from Nayuk & Huber, Z. Phys. Chem. 226, 837 (2012)
- */
-
-double
-RectangularHollowPrismInfThinWalls(double dp[], double q)
-{
-    int i,j;
-    double scale,aa,bb,cc,delrho,bkg;
-    int nordi=76;
-    int nordj=76;
-    double Pi;
-    double sumi, sumj;
-    double v1a, v1b, v2a, v2b;		//upper and lower integration limits
-    double answer;
-    double theta, phi, termAL_theta, termAT_theta, AL, AT, ahalf, bhalf, chalf, vol;
-    double sldp, sld ;
-
-    Pi = 4.0*atan(1.0);
-
-    scale = dp[0];		  //make local copies in case memory moves
-    aa = dp[1];
-    bb = aa * dp[2];
-    cc = aa * dp[3];
-    sldp = dp[4];        // scattering length density of the object
-    sld = dp[5];         // scattering length density of the solvent
-    delrho = sldp - sld;
-    bkg = dp[6];
-
-    ahalf = 0.5 * aa;
-    bhalf = 0.5 * bb;
-    chalf = 0.5 * cc;
-
-    //Integration limits to use in Gaussian quadrature
-    v1a = 0.;
-    v1b = Pi/2;   //theta integration limits
-    v2a = 0.;
-    v2b = Pi/2.;  //phi integration limits
-
-    sumi = 0.0;
-    for(i=0;i<nordi;i++) {
-
-        theta = ( Gauss76Z[i]*(v1b-v1a) + v1a + v1b )/2.0;	//z values for gaussian quadrature
-
-        // To check potential problems if denominator goes to zero here !!!
-        termAL_theta = 8.0*cos(q*chalf*cos(theta)) / (q*q*sin(theta)*sin(theta));
-        termAT_theta = 8.0*sin(q*chalf*cos(theta)) / (q*q*sin(theta)*cos(theta));
-
-        sumj = 0.0;
-        for(j=0;j<nordj;j++) {
-
-            phi = ( Gauss76Z[j]*(v2b-v2a) + v2a + v2b )/2.0;	//z values for gaussian quadrature
-
-            // Amplitude AL from eqn. (7c)
-            AL = termAL_theta * sin(q*ahalf*sin(theta)*sin(phi)) * sin(q*bhalf*sin(theta)*cos(phi)) / (sin(phi)*cos(phi));
-
-            // Amplitude AT from eqn. (9)
-            AT = termAT_theta * (  (cos(q*ahalf*sin(theta)*sin(phi))*sin(q*bhalf*sin(theta)*cos(phi))/cos(phi)) + (cos(q*bhalf*sin(theta)*cos(phi))*sin(q*ahalf*sin(theta)*sin(phi))/sin(phi)) );
-
-            sumj += Gauss76Wt[j] * (AL+AT)*(AL+AT);
-
-        }
-
-        sumj = (v2b-v2a) * sumj / 2.0;
-        sumi += Gauss76Wt[i] * sumj * sin(theta);
-
-    }
-
-    answer = (v1b-v1a)/2.0*sumi;
-
-    // Normalize as in Eqn. (11). The factor 2 is due to the different theta integration limit (pi/2 instead of pi)
-    vol = 2.0*aa*bb+2.0*aa*cc+2.0*bb*cc;
-    answer = 2.0 * answer / Pi / vol / vol;
-
-    // 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;
-}
-
-
-/*
- * Hollow rectangular prism (a <= b <=c)
- * using eqn. (13-15) from Nayuk & Huber, Z. Phys. Chem. 226, 837 (2012)
- */
- 
-double
-RectangularHollowPrism(double dp[], double q)
-{
-    int i, j;
-    double scale, aa, bb, cc, thickness, delrho, bkg;
-    int nordi=76;
-    int nordj=76;
-    double Pi;
-    double sumi, sumj;
-    double v1a, v1b, v2a, v2b;		//upper and lower integration limits
-    double answer;
-    double theta, phi, arg, termA1, termB1, termC1, termA2, termB2, termC2, AP1, AP2, AP, ahalf, bhalf, chalf, vol;
-    double sldp, sld ;
-
-    Pi = 4.0*atan(1.0);
-
-    scale = dp[0];
-    aa = dp[1];
-    bb = aa * dp[2];
-    cc = aa * dp[3];
-    thickness = dp[4];
-    sldp = dp[5];        // scattering length density of the object
-    sld = dp[6];         // scattering length density of the solvent
-    delrho = sldp - sld;
-    bkg = dp[7];
-
-    ahalf = 0.5 * aa;
-    bhalf = 0.5 * bb;
-    chalf = 0.5 * cc;
-
-    //Integration limits to use in Gaussian quadrature
-    v1a = 0.;
-    v1b = Pi/2;    //theta integration limits
-    v2a = 0.;
-    v2b = Pi/2.;   //phi integration limits
-
-    sumi = 0.0;
-    for(i=0;i<nordi;i++) {
-
-        theta = ( Gauss76Z[i]*(v1b-v1a) + v1a + v1b )/2.0;	//z values for gaussian quadrature
-
-	    arg = q*chalf*cos(theta);
-	    if (fabs(arg) > 1.e-16) {termC1 = sin(arg) / arg;} else {termC1 = 1.0;}
-	    arg = q*(chalf-thickness)*cos(theta);
-	    if (fabs(arg) > 1.e-16) {termC2 = sin(arg) / arg;} else {termC2 = 1.0;}
-
-	    sumj = 0.0;
-	    for(j=0;j<nordj;j++) {
-
-            phi = ( Gauss76Z[j]*(v2b-v2a) + v2a + v2b )/2.0;	//z values for gaussian quadrature
-
-            // Amplitude AP from eqn. (13), rewritten to avoid round-off effects when arg=0
-
-	        arg = q*ahalf*sin(theta)*sin(phi);
-	        if (fabs(arg) > 1.e-16) {termA1 = sin(arg) / arg;} else {termA1 = 1.0;}
-	        arg = q*(ahalf-thickness)*sin(theta)*sin(phi);
-	        if (fabs(arg) > 1.e-16) {termA2 = sin(arg) / arg;} else {termA2 = 1.0;}
-
-	        arg = q*bhalf*sin(theta)*cos(phi);
-	        if (fabs(arg) > 1.e-16) {termB1 = sin(arg) / arg;} else {termB1 = 1.0;}
-	        arg = q*(bhalf-thickness)*sin(theta)*cos(phi);
-	        if (fabs(arg) > 1.e-16) {termB2 = sin(arg) / arg;} else {termB2 = 1.0;}
-
-            AP1 = (aa*bb*cc) * termA1 * termB1 * termC1;
-            AP2 = 8 * (ahalf-thickness) * (bhalf-thickness) * (chalf-thickness) * termA2 * termB2 * termC2;
-            AP = AP1 - AP2;
-
-            sumj += Gauss76Wt[j] * (AP*AP);
-
-	    }
-
-	    sumj = (v2b-v2a) * sumj / 2.0;
-	    sumi += Gauss76Wt[i] * sumj * sin(theta);
-
-    }
-
-    answer = (v1b-v1a)/2.0*sumi;
-
-    // Normalize as in Eqn. (15).
-    // The factor 2 is due to the different theta integration limit (pi/2 instead of pi)
-    vol = (aa*bb*cc-((aa-2*thickness)*(bb-2*thickness)*(cc-2*thickness)));
-    answer = 2.0 * answer / Pi / vol / vol;
-
-    // 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;
-}
-
-
Index: c/sas/models/c_extension/libigor/libCylinder.h
===================================================================
--- src/sas/models/c_extension/libigor/libCylinder.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,73 +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);
-double RectangularPrism(double dp[], double q);
-double RectangularHollowPrismInfThinWalls(double dp[], double q);
-double RectangularHollowPrism(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: c/sas/models/c_extension/libigor/libSASAnalysis.h
===================================================================
--- src/sas/models/c_extension/libigor/libSASAnalysis.h	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- *  libSASAnalysis.h
- *  SASAnalysis
- *
- *  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: c/sas/models/c_extension/libigor/libSphere.c
===================================================================
--- src/sas/models/c_extension/libigor/libSphere.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,2412 +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
-}
-
-// Micelle with spherical core 
-// J.S. Pedersen, J. Appl. Cryst. 33, 637 (2000)
-
-double
-MicelleSphericalCore(double dp[], double q)
-{
-	double x, pi;
-	double ndensity, v_core, v_corona, rho_solv, rho_core, rho_corona;      // local names of input params
-	double radius_core, radius_gyr, d_penetration, n_aggreg, bkg, scale;    // local names of input params
-	double beta_core, beta_corona, qr, qrg, qrg2, qrdrg, bes_core, bes_corona; 
-	double term1, term2, term3, term4, debye_chain, chain_ampl, i_micelle;
-
-	x = q;
-	
-	scale = dp[0];
-	ndensity = dp[1];      // number density [1/cm^3]
-	v_core = dp[2];        // volume block in core [A^3]
-	v_corona = dp[3];      // volume block in corona [A^3]
-	rho_solv = dp[4];      // sld of solvent [1/A^2]
-	rho_core = dp[5];      // sld of core [1/A^2]
-	rho_corona = dp[6];    // sld of corona [1/A^2]
-	radius_core = dp[7];   // radius of core [A]
-	radius_gyr = dp[8];    // radius of gyration of chains in corona [A]
-	d_penetration = dp[9]; // close to unity, mimics non-penetration of gaussian chains
-	n_aggreg = dp[10];     // aggregation number of the micelle
-	bkg = dp[11];          // background
-	
-	beta_core = v_core * (rho_core - rho_solv);
-	beta_corona = v_corona * (rho_corona - rho_solv);
-	
-	
-        // Self-correlation term of the core
-
-	qr = x*radius_core;
-	if(qr == 0){bes_core = 1.0;} else {bes_core = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);}
-	
-        term1 = n_aggreg * n_aggreg * beta_core * beta_core * bes_core * bes_core;
-
-        // Self-correlation term of the chains
-
-	qrg = x*radius_gyr;
-	qrg2 = qrg*qrg;
-	if(qrg2 == 0){debye_chain = 1.0;} else {debye_chain = 2.0*(exp(-qrg2)-1+qrg2)/(qrg2*qrg2);}
-	
-        term2 = n_aggreg * beta_corona * beta_corona * debye_chain;
-
-        // Interference cross-term between core and chains
-
-	if(qrg2 == 0){chain_ampl = 1.0;} else {chain_ampl = (1-exp(-qrg2))/qrg2;}
-
-	qrdrg = x * (radius_core + d_penetration * radius_gyr);
-	if(qrdrg == 0){bes_corona = 1.0;} else {bes_corona = sin(qrdrg)/qrdrg;}
-
-        term3 = 2 * n_aggreg * n_aggreg * beta_core * beta_corona * bes_core * chain_ampl * bes_corona;
-
-        // Interference cross-term between chains
-
-        term4 = n_aggreg * (n_aggreg - 1.0) * beta_corona * beta_corona * chain_ampl * chain_ampl * bes_corona * bes_corona;
-
-        // I(q)_micelle : Sum of 4 terms computed above
-	
-	i_micelle = term1 + term2 + term3 + term4 ; 
-
-	// rescale from [A^2] to [cm^2]
-	
-	i_micelle *= 1.0e-16;
-
-	// "normalize" by number density --> intensity in [cm-1]
-	
-	i_micelle *= ndensity;
-	
-	//scale if desired
-	i_micelle *= scale;
-
-	// add in the background
-	i_micelle += bkg;
-	
-	return(i_micelle);
-	
-}
-
Index: c/sas/models/c_extension/libigor/libSphere.h
===================================================================
--- src/sas/models/c_extension/libigor/libSphere.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,51 +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);
-double MicelleSphericalCore(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: c/sas/models/c_extension/libigor/libStructureFactor.c
===================================================================
--- src/sas/models/c_extension/libigor/libStructureFactor.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,758 +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"
-
-//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 gMSAWave[17]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
-	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, gMSAWave);
-	if (ierr>=0) {
-		SofQ=sqhcal(Qdiam, gMSAWave);
-	}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, double gMSAWave[])
-{	
-	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);
-		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,gMSAWave);
-			f1=gMSAWave[15];
-			e1=gMSAWave[16];
-			e2=gMSAWave[10]*1.01;
-			gMSAWave[15]=f2;
-			gMSAWave[16]=e2;
-			ix=2;
-			ir = sqfun(ix,ir,gMSAWave);
-			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);
-		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);
-	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 gMSAWave[])
-{	
-	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 gMSAWave[])
-{      	
-    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: c/sas/models/c_extension/libigor/libStructureFactor.h
===================================================================
--- src/sas/models/c_extension/libigor/libStructureFactor.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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, double gMSAWave[]);
-int sqfun(int ix, int ir, double gMSAWave[]);
-int sqcoef(int ir, double gMSAWave[]);
Index: c/sas/models/c_extension/libigor/libTwoPhase.c
===================================================================
--- src/sas/models/c_extension/libigor/libTwoPhase.c	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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: c/sas/models/c_extension/libigor/libTwoPhase.h
===================================================================
--- src/sas/models/c_extension/libigor/libTwoPhase.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(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: c/sas/models/dispersion_models.py
===================================================================
--- src/sas/models/dispersion_models.py	(revision 0e4e5544c592682046c086f1a922482f5159c525)
+++ 	(revision )
@@ -1,159 +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
-################################################################################
-
-"""
-Class definitions for python dispersion model for 
-model parameters. These classes are bridges to the C++
-dispersion object.
-
-The ArrayDispersion class takes in numpy arrays only.
-
-Usage:
-These classes can be used to set the dispersion model of a SAS model
-parameter:
-
-    cyl = CylinderModel()
-    cyl.set_dispersion('radius', GaussianDispersion())
-
-
-After the dispersion model is set, you can access it's
-parameter through the dispersion dictionary:
-
-    cyl.dispersion['radius']['width'] = 5.0
-
-:TODO: For backward compatibility, the model parameters are still kept in
-    a dictionary. The next iteration of refactoring work should involve moving
-    away from value-based parameters to object-based parameter. We want to
-    store parameters as objects so that we can unify the 'params' and 'dispersion'
-    dictionaries into a single dictionary of parameter objects that hold the
-    complete information about the parameter (units, limits, dispersion model, etc...).  
-
-    
-"""
-import sas_extension.c_models as c_models 
-
-
-
-class DispersionModel:
-    """
-    Python bridge class for a basic dispersion model 
-    class with a constant parameter value distribution
-    """
-    def __init__(self):
-        self.cdisp = c_models.new_dispersion_model()
-        
-    def set_weights(self, values, weights):
-        """
-        Set the weights of an array dispersion
-        """
-        message = "set_weights is not available for DispersionModel.\n"
-        message += "  Solution: Use an ArrayDispersion object"
-        raise "RuntimeError", message
-        
-class GaussianDispersion(DispersionModel):
-    """
-    Python bridge class for a dispersion model based 
-    on a Gaussian distribution.
-    """
-    def __init__(self):
-        self.cdisp = c_models.new_gaussian_model()
-        
-    def set_weights(self, values, weights):
-        """
-            Set the weights of an array dispersion
-        """
-        message = "set_weights is not available for GaussianDispersion.\n"
-        message += "  Solution: Use an ArrayDispersion object"
-        raise "RuntimeError", message
-        
-class RectangleDispersion(DispersionModel):
-    """
-    Python bridge class for a dispersion model based 
-    on a Gaussian distribution.
-    """
-    def __init__(self):
-        self.cdisp = c_models.new_rectangle_model()
-        
-    def set_weights(self, values, weights):
-        """
-            Set the weights of an array dispersion
-        """
-        message = "set_weights is not available for GaussianDispersion.\n"
-        message += "  Solution: Use an ArrayDispersion object"
-        raise "RuntimeError", message 
-    
-class SchulzDispersion(DispersionModel):
-    """
-        Python bridge class for a dispersion model based 
-        on a Schulz distribution.
-    """
-    def __init__(self):
-        """
-        """
-        self.cdisp = c_models.new_schulz_model()
-        
-    def set_weights(self, values, weights):
-        """
-        Set the weights of an array dispersion
-        """
-        message = "set_weights is not available for SchulzDispersion.\n"
-        message += "  Solution: Use an ArrayDispersion object"
-        raise "RuntimeError", message
-    
-class LogNormalDispersion(DispersionModel):
-    """
-    Python bridge class for a dispersion model based 
-    on a Log Normal distribution.
-    """
-    def __init__(self):
-        self.cdisp = c_models.new_lognormal_model()
-        
-    def set_weights(self, values, weights):
-        """
-        Set the weights of an array dispersion
-        """
-        message = "set_weights is not available for LogNormalDispersion.\n"
-        message += "  Solution: Use an ArrayDispersion object"
-        raise "RuntimeError", message
-        
-class ArrayDispersion(DispersionModel):
-    """
-    Python bridge class for a dispersion model based on arrays.
-    The user has to set a weight distribution that
-    will be used in the averaging the model parameter
-    it is applied to. 
-    """
-    def __init__(self):
-        self.cdisp = c_models.new_array_model()
-        
-    def set_weights(self, values, weights):
-        """
-        Set the weights of an array dispersion
-        Only accept numpy arrays.
-        
-        :param values: numpy array of values
-        :param weights: numpy array of weights for each value entry
-        
-        """
-        if len(values) != len(weights):
-            raise ValueError, "ArrayDispersion.set_weights: \
-            given arrays are of different lengths"
-        
-        c_models.set_dispersion_weights(self.cdisp, values, weights)
-        
-models = {"gaussian":GaussianDispersion,  "rectangular":RectangleDispersion,
-          "array":ArrayDispersion, "schulz":SchulzDispersion, 
-          "lognormal":LogNormalDispersion}       
-        
Index: c/sas/models/include/DiamCyl.h
===================================================================
--- src/sas/models/include/DiamCyl.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#if !defined(DiamCyl_h)
-#define DiamCyl_h
-#include "parameters.hh"
-
-/**
-* 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>
-**/
-
-class DiamCylFunc{
-public:
-  // Model parameters
-  /// Radius [A]
-  //  [DEFAULT]=radius=20.0 A
-  Parameter radius;
-  /// Length [A]
-  //  [DEFAULT]=length= 400 A
-  Parameter length;
-
-  // Constructor
-  DiamCylFunc();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/DiamEllip.h
===================================================================
--- src/sas/models/include/DiamEllip.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#if !defined(DiamEllip_h)
-#define DiamEllip_h
-#include "parameters.hh"
-
-/**
- * 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>
-
- **/
-
-class DiamEllipFunc{
-public:
-  // Model parameters
-  /// Polar radius [A]
-  //  [DEFAULT]=radius_a=20.0 A
-  Parameter radius_a;
-
-  /// Equatorial radius [A]
-  //  [DEFAULT]=radius_b= 400 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 calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/FractalQtoN.h
===================================================================
--- src/sas/models/include/FractalQtoN.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#if !defined(FractalQtoN_h)
-#define FractalQtoN_h
-#include "parameters.hh"
-
-/**
- * Structure definition for FractalO_Z (factor) parameters
- */
-//[PYTHONCLASS] = FractalO_Z
-//[DESCRIPTION] =<text>Structure factor for interacting particles:                   
-// Schmidt J Appl Cryst (1991), 24, 414-435 See equation (19)
-// Hurd; Schaefer; Martin, Phys Rev A (1987), 35, 2361-2364 See equation (2)
-// </text>.
-
-class FractalO_Z{
-public:
-
-  // Model parameters
-
-  /// Something scale
-  //  [DEFAULT]=scale= 10000.0
-  Parameter scale;
-
-  //  [DEFAULT]=m_fractal= 1.8
-  Parameter m_fractal;
-
-  //  [DEFAULT]=cluster_rg= 3520.0
-  Parameter cluster_rg;
-  
-  //  [DEFAULT]=s_fractal= 2.5
-  Parameter s_fractal;
-
-  //  [DEFAULT]=primary_rg= 82.0
-  Parameter primary_rg;
-
-  //  [DEFAULT]=background= 0.01
-  Parameter background;
-
-
-  // Constructor
-  FractalO_Z();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/GelFit.h
===================================================================
--- src/sas/models/include/GelFit.h	(revision 1d115ef0ea20114c0109dad8c815846e6281604a)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#if !defined(GelFit_h)
-#define GelFit_h
-#include "parameters.hh"
-
-/**
- * Structure definition for GelFitModel (factor) parameters
- */
-//[PYTHONCLASS] = GelFitModel
-//[DESCRIPTION] =<text>Structure factor for interacting particles:                   .
-//  Shibayama-Geissler Two-Length Scale Fit for Gels
-//  (GelFit)
-//
-//  Sibayama; Tanaka; Han J Chem Phys(1992), 97(9), 6829-6841
-//  Mallam; Horkay; Hecht; Rennie; Geissler, Macromol(1991), 24, 543
-//	 </text>
-
-class GelFitModel{
-public:
-
-  // Model parameters
-
-  /// Something lScale
-  //  [DEFAULT]=lScale= 3.5
-  Parameter lScale;
-
-  //  [DEFAULT]=gScale= 1.7
-  Parameter gScale;
-
-  //  [DEFAULT]=zeta= 16
-  Parameter zeta;
-  
-  //  [DEFAULT]=radius= 104
-  Parameter radius;
-
-  //  [DEFAULT]=FractalExp= 2
-  Parameter FractalExp;
-
-  //  [DEFAULT]=background= 0.01
-  Parameter background;
-
-
-  // Constructor
-  GelFitModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/Hardsphere.h
===================================================================
--- src/sas/models/include/Hardsphere.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#if !defined(Hardsphere_h)
-#define Hardsphere_h
-#include "parameters.hh"
-
-/**
- * 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
-
-class HardsphereStructure{
-public:
-  // Model parameters
-  /// effect radius of hardsphere [A]
-  //  [DEFAULT]=effect_radius=50.0 [A]
-  Parameter effect_radius;
-
-  /// Volume fraction
-  //  [DEFAULT]=volfraction= 0.2
-  Parameter volfraction;
-
-  // Constructor
-  HardsphereStructure();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/HayterMSA.h
===================================================================
--- src/sas/models/include/HayterMSA.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-#if !defined(HayterMSA_h)
-#define HayterMSA_h
-#include "parameters.hh"
-
-/**
- * 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
-
-class HayterMSAStructure{
-public:
-  // Model parameters
-  /// effetitve radius of particle [A]
-  //  [DEFAULT]=effect_radius=20.75 [A]
-  Parameter effect_radius;
-
-  /// charge
-  //  [DEFAULT]=charge= 19
-  Parameter charge;
-
-  /// Volume fraction
-  //  [DEFAULT]=volfraction= 0.0192
-  Parameter volfraction;
-
-  /// Temperature [K]
-  //  [DEFAULT]=temperature= 318.16 [K]
-  Parameter temperature;
-
-  /// Monovalent salt concentration [M]
-  //  [DEFAULT]=saltconc= 0 [M]
-  Parameter saltconc;
-
-  /// Dielectric constant of solvent
-  //  [DEFAULT]=dielectconst= 71.08
-  Parameter dielectconst;
-
-  // Constructor
-  HayterMSAStructure();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/RectangularHollowPrism.h
===================================================================
--- src/sas/models/include/RectangularHollowPrism.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-#if !defined(RectangularHollowPrism_h)
-#define RectangularHollowPrism_h
-#include "parameters.hh"
-
-/** Structure definition for RectangularHollowPrism parameters
- * [PYTHONCLASS] = RectangularHollowPrismModel
- * [DISP_PARAMS] = short_side, b2a_ratio, c2a_ratio, thickness
-   [DESCRIPTION] = <text> Form factor for a hollow rectangular prism with uniform scattering length density.
-		scale:Scale factor
-		short_side: shortest side of the rectangular prism  [A]
-		b2a_ratio: ratio b/a [adim]
-		c2a_ratio: ratio c/a [adim]
-		thickness: thickness of the walls [A]
-		sldPipe: Pipe_sld
-		sldSolv: solvent_sld
-		background:Incoherent Background [1/cm]
-		</text>
-	[FIXED]= <text> short_side.width; b2a_ratio.width; c2a_ratio.width; thicness.width; </text>
-
- **/
-
-class RectangularHollowPrismModel{
-public:
-  // Model parameters
-  
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  
-  ///  Shortest side of rectangular prism [A]
-  //  [DEFAULT]=short_side=35 [A]
-  Parameter short_side;
-  
-  ///  Ratio b/a [adim]
-  //  [DEFAULT]=b2a_ratio=1 [adim]
-  Parameter b2a_ratio;
-  
-  ///  Ratio c/a [adim]
-  //  [DEFAULT]=c2a_ratio=1 [adim]
-  Parameter c2a_ratio;
-  
-  ///  Thickness of walls [A]
-  //  [DEFAULT]=thickness=1 [A]
-  Parameter thickness;
-  
-  /// SLD_Pipe [1/A^(2)]
-  //  [DEFAULT]=sldPipe=6.3e-6 [1/A^(2)]
-  Parameter sldPipe;
-  
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-  
-  // Constructor
-  RectangularHollowPrismModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-#endif
Index: c/sas/models/include/RectangularHollowPrismInfThinWalls.h
===================================================================
--- src/sas/models/include/RectangularHollowPrismInfThinWalls.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#if !defined(RectangularHollowPrismInfThinWalls_h)
-#define RectangularHollowPrismInfThinWalls_h
-#include "parameters.hh"
-
-/** Structure definition for RectangularHollowPrismInfThinWalls parameters
- * [PYTHONCLASS] = RectangularHollowPrismInfThinWallsModel
- * [DISP_PARAMS] = short_side, b2a_ratio, c2a_ratio
-   [DESCRIPTION] = <text> Form factor for a hollow rectangular prism with uniform scattering length density and infinitely thin walls.
-		scale:Scale factor
-		short_side: shortest side of the rectangular prism  [A]
-		b2a_ratio: ratio b/a [adim]
-		c2a_ratio: ratio c/a [adim]
-		sldPipe: Pipe_sld
-		sldSolv: solvent_sld
-		background:Incoherent Background [1/cm]
-		</text>
-	[FIXED]= <text> short_side.width; b2a_ratio.width; c2a_ratio.width; </text>
-
- **/
-
-class RectangularHollowPrismInfThinWallsModel{
-public:
-  // Model parameters
-  
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  
-  ///  Shortest side of rectangular prism [A]
-  //  [DEFAULT]=short_side=35 [A]
-  Parameter short_side;
-  
-  ///  Ratio b/a [adim]
-  //  [DEFAULT]=b2a_ratio=1 [adim]
-  Parameter b2a_ratio;
-  
-  ///  Ratio c/a [adim]
-  //  [DEFAULT]=c2a_ratio=1 [adim]
-  Parameter c2a_ratio;
-  
-  /// SLD_Pipe [1/A^(2)]
-  //  [DEFAULT]=sldPipe=6.3e-6 [1/A^(2)]
-  Parameter sldPipe;
-  
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-  
-  // Constructor
-  RectangularHollowPrismInfThinWallsModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-#endif
Index: c/sas/models/include/RectangularPrism.h
===================================================================
--- src/sas/models/include/RectangularPrism.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#if !defined(RectangularPrism_h)
-#define RectangularPrism_h
-#include "parameters.hh"
-
-/** Structure definition for RectangularPrism parameters
- * [PYTHONCLASS] = RectangularPrismModel
- * [DISP_PARAMS] = short_side, b2a_ratio, c2a_ratio
-   [DESCRIPTION] = <text> Form factor for a massive rectangular prism with uniform scattering length density.
-		scale:Scale factor
-		short_side: shortest side of the rectangular prism  [A]
-		b2a_ratio: ratio b/a [adim]
-		c2a_ratio: ratio c/a [adim]
-		sldPipe: Pipe_sld
-		sldSolv: solvent_sld
-		background:Incoherent Background [1/cm]
-		</text>
-	[FIXED]= <text> short_side.width; b2a_ratio.width; c2a_ratio.width; </text>
-
- **/
-
-class RectangularPrismModel{
-public:
-  // Model parameters
-  
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  
-  ///  Shortest side of rectangular prism [A]
-  //  [DEFAULT]=short_side=35 [A]
-  Parameter short_side;
-  
-  ///  Ratio b/a [adim]
-  //  [DEFAULT]=b2a_ratio=1 [adim]
-  Parameter b2a_ratio;
-  
-  ///  Ratio c/a [adim]
-  //  [DEFAULT]=c2a_ratio=1 [adim]
-  Parameter c2a_ratio;
-  
-  /// SLD_Pipe [1/A^(2)]
-  //  [DEFAULT]=sldPipe=6.3e-6 [1/A^(2)]
-  Parameter sldPipe;
-  
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-  
-  // Constructor
-  RectangularPrismModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-#endif
Index: c/sas/models/include/SquareWell.h
===================================================================
--- src/sas/models/include/SquareWell.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#if !defined(SquareWell_h)
-#define SquareWell_h
-#include "parameters.hh"
-
-/**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>
-
-class SquareWellStructure{
-public:
-  // Model parameters
-  /// effective radius of particle [A]
-  //  [DEFAULT]=effect_radius=50.0 [A]
-  Parameter effect_radius;
-
-  /// Volume fraction
-  //  [DEFAULT]=volfraction= 0.040
-  Parameter volfraction;
-
-  /// Well depth [kT]
-  //  [DEFAULT]=welldepth= 1.50 [kT]
-  Parameter welldepth;
-
-  /// Well width
-  //  [DEFAULT]=wellwidth= 1.20
-  Parameter wellwidth;
-
-  // Constructor
-  SquareWellStructure();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/StickyHS.h
===================================================================
--- src/sas/models/include/StickyHS.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#if !defined(StickyHS_h)
-#define StickyHS_h
-#include "parameters.hh"
-
-/**
- * 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
-
-class StickyHSStructure{
-public:
-  // Model parameters
-  /// effect radius of hardsphere [A]
-  //  [DEFAULT]=effect_radius=50.0 [A]
-  Parameter effect_radius;
-
-  /// Volume fraction
-  //  [DEFAULT]=volfraction= 0.1
-  Parameter volfraction;
-
-  /// Perturbation Parameter ( between 0.01 - 0.1)
-  //  [DEFAULT]=perturb=0.05
-  Parameter perturb;
-
-  /// Stickiness
-  //  [DEFAULT]=stickiness= 0.2
-  Parameter stickiness;
-
-  // Constructor
-  StickyHSStructure();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/TwoYukawa.h
===================================================================
--- src/sas/models/include/TwoYukawa.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#if !defined(TwoYukawa_h)
-#define TwoYukawa_h
-#include "parameters.hh"
-
-/**
- * Structure definition for TwoYukawaModel (factor) parameters
- */
-//[PYTHONCLASS] = TwoYukawaModel
-//[DESCRIPTION] =<text>Structure factor for interacting particles:                   .
-//
-//  Calculates the structure factor, S(q), for a monodisperse spherical particle interacting 
-//  through a two-Yukawa potential. The Mean Spherical Approximation is used as the 
-//  closure to solve the Ornstein-Zernicke equations.
-//
-//  The function calculated is S(q), based on the solution of the Ornstein-Zernicke equations 
-//  using the Two-Yukawa potential (in its scaled form, r=r/diam):
-//
-//  Radius is that of the hard core. The returned value is dimensionless.
-//	 </text>
-
-
-class TwoYukawaModel{
-public:
-
-  // Model parameters
-
-  /// Something volfraction
-  //  [DEFAULT]=volfraction= 0.2
-  Parameter volfraction;
-  
-  //  [DEFAULT]=effect_radius= 50.0 [A]
-  Parameter effect_radius;
-  
-  //  [DEFAULT]=scale_K1= 6.0
-  Parameter scale_K1;
-  
-  //  [DEFAULT]=decayConst_Z1= 10.0
-  Parameter decayConst_Z1;
-  
-  //  [DEFAULT]=scale_K2= -1.0
-  Parameter scale_K2;
-  
-  //  [DEFAULT]=decayConst_Z2= 2.0
-  Parameter decayConst_Z2;
-
-  // Constructor
-  TwoYukawaModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/barbell.h
===================================================================
--- src/sas/models/include/barbell.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-#if !defined(barbell_h)
-#define barbell_h
-#include "parameters.hh"
-/**
- * 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>
-
-class BarBellModel {
-public:
-  // Model parameters
-
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// rad_bar [A]
-  //  [DEFAULT]=rad_bar=20.0 [A]
-  Parameter rad_bar;
-
-  /// length of the bar [A]
-  //  [DEFAULT]=len_bar=400.0 [A]
-  Parameter len_bar;
-
-  /// Radius of sphere [A]
-  //  [DEFAULT]=rad_bell=40.0 [A]
-  Parameter rad_bell;
-
-  /// sld_barbell [1/A^(2)]
-  //  [DEFAULT]=sld_barbell= 1.0e-6 [1/A^(2)]
-  Parameter sld_barbell;
-
-  /// sld_solv [1/A^(2)]
-  //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)]
-  Parameter sld_solv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-
-  /// Angle of the main axis against z-axis in detector plane [deg]
-  //  [DEFAULT]=theta=0.0 [deg]
-  Parameter theta;
-
-  /// Azimuthal angle around z-axis in detector plane [deg]
-  //  [DEFAULT]=phi=0.0 [deg]
-  Parameter phi;
-
-  // Constructor
-  BarBellModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/bcc.h
===================================================================
--- src/sas/models/include/bcc.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#if !defined(bcc_h)
-#define bcc_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class BCCrystalModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Nearest neighbor distance [A]
-  //  [DEFAULT]=dnn=220.0 [A]
-  Parameter dnn;
-
-  /// Paracrystal distortion factor g
-  //  [DEFAULT]=d_factor=0.06
-  Parameter d_factor;
-
-  /// Radius of sphere [A]
-  //  [DEFAULT]=radius=40.0 [A]
-  Parameter radius;
-
-  /// sldSph [1/A^(2)]
-  //  [DEFAULT]=sldSph= 3.0e-6 [1/A^(2)]
-  Parameter sldSph;
-
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv= 6.3e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-  /// Orientation of the a1 axis w/respect incoming beam [deg]
-  //  [DEFAULT]=theta=0.0 [deg]
-  Parameter theta;
-  /// Orientation of the a2 in the plane of the detector [deg]
-  //  [DEFAULT]=phi=0.0 [deg]
-  Parameter phi;
-  /// Orientation of the a3 in the plane of the detector [deg]
-  //  [DEFAULT]=psi=0.0 [deg]
-  Parameter psi;
-
-  // Constructor
-  BCCrystalModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-
-#endif
Index: c/sas/models/include/binaryHS.h
===================================================================
--- src/sas/models/include/binaryHS.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-#if !defined(binaryHS_h)
-#define binaryHS_h
-#include "parameters.hh"
-
-/**
- * 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>
- */
-
-class BinaryHSModel{
-public:
-  // Model parameters
-  /// large radius of the binary hard sphere [A]
-  //  [DEFAULT]=l_radius= 100.0 [A]
-  Parameter l_radius;
-
-  /// small radius of the binary hard sphere [A]
-  //  [DEFAULT]=s_radius= 25.0 [A]
-  Parameter s_radius;
-
-  /// volume fraction of large spheres
-  //  [DEFAULT]=vol_frac_ls= 0.1
-  Parameter vol_frac_ls;
-
-  /// volume fraction of small spheres
-  //  [DEFAULT]=vol_frac_ss= 0.2
-  Parameter vol_frac_ss;
-
-  /// large sphere scattering length density [1/A^(2)]
-  //  [DEFAULT]=ls_sld= 3.5e-6 [1/A^(2)]
-  Parameter ls_sld;
-
-  /// lsmall sphere scattering length density [1/A^(2)]
-  //  [DEFAULT]=ss_sld= 5e-7 [1/A^(2)]
-  Parameter ss_sld;
-
-  /// solvent scattering length density [1/A^(2)]
-  //  [DEFAULT]=solvent_sld= 6.36e-6 [1/A^(2)]
-  Parameter solvent_sld;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.001 [1/cm]
-  Parameter background;
-
-  //Constructor
-  BinaryHSModel();
-
-  //Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx , double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/capcyl.h
===================================================================
--- src/sas/models/include/capcyl.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-#if !defined(capcyl_h)
-#define capcyl_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class CappedCylinderModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// rad_cyl [A]
-  //  [DEFAULT]=rad_cyl=20.0 [A]
-  Parameter rad_cyl;
-
-  /// length of the cylinder
-  //  [DEFAULT]=len_cyl=400.0 [A]
-  Parameter len_cyl;
-
-  /// Radius of sphere [A]
-  //  [DEFAULT]=rad_cap=40.0 [A]
-  Parameter rad_cap;
-
-  /// sld_capcyl [1/A^(2)]
-  //  [DEFAULT]=sld_capcyl= 1.0e-6 [1/A^(2)]
-  Parameter sld_capcyl;
-
-  /// sld_solv [1/A^(2)]
-  //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)]
-  Parameter sld_solv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-
-  /// Angle of the main axis against z-axis in detector plane [deg]
-  //  [DEFAULT]=theta=0.0 [deg]
-  Parameter theta;
-
-  /// Azimuthal angle around z-axis in detector plane [deg]
-  //  [DEFAULT]=phi=0.0 [deg]
-  Parameter phi;
-
-  // Constructor
-  CappedCylinderModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/core_shell.h
===================================================================
--- src/sas/models/include/core_shell.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-#if !defined(core_shell_h)
-#define core_shell_h
-#include "parameters.hh"
-
-/**
- * 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>
- //[ORIENTATION_PARAMS]= <text> M0_sld_shell; M_theta_shell; M_phi_shell; M0_sld_core; M_theta_core; M_phi_core;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
- //[MAGNETIC_PARAMS]= <text>  M0_sld_shell; M_theta_shell; M_phi_shell;M0_sld_core; M_theta_core; M_phi_core; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
-
-
-class CoreShellModel{
-public:
-  // Model parameters
-
-  /// Core Radius [A] 60.0
-  //  [DEFAULT]=radius=60.0 [A]
-  Parameter radius;
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Shell Thickness [A] 10.0
-  //  [DEFAULT]=thickness=10 [A]
-  Parameter thickness;
-  /// Core SLD [1/A^(2)] 1.0e-6
-  //  [DEFAULT]=core_sld=1.0e-6 [1/A^(2)]
-  Parameter core_sld;
-/// Shell SLD [1/A^(2)] 2.0e-6
-//  [DEFAULT]=shell_sld=2.0e-6 [1/A^(2)]
-  Parameter shell_sld;
-/// Solvent SLD [1/A^(2)] 3.0e-6
-//  [DEFAULT]=solvent_sld=3.0e-6 [1/A^(2)]
-  Parameter solvent_sld;
-/// Incoherent Background [1/cm] 0.000
-//  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-/// M0_sld_shell
-//  [DEFAULT]=M0_sld_shell=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_shell;
-
-/// M_theta_shell
-//  [DEFAULT]=M_theta_shell=0.0 [deg]
-  Parameter M_theta_shell;
-
-/// M_phi_shell
-//  [DEFAULT]=M_phi_shell=0.0 [deg]
-  Parameter M_phi_shell;
-
-/// M0_sld_core
-//  [DEFAULT]=M0_sld_core=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_core;
-
-/// M_theta_core
-//  [DEFAULT]=M_theta_core=0.0 [deg]
-  Parameter M_theta_core;
-
-/// M_phi_core
-//  [DEFAULT]=M_phi_core=0.0 [deg]
-  Parameter M_phi_core;
-
-/// M0_sld_solv
-//  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_solv;
-
-/// M_theta_solv
-//  [DEFAULT]=M_theta_solv=0.0 [deg]
-  Parameter M_theta_solv;
-
-/// M_phi_solv
-//  [DEFAULT]=M_phi_solv=0.0 [deg]
-  Parameter M_phi_solv;
-
-/// Up_frac_i
-//  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
-  Parameter Up_frac_i;
-
-/// Up_frac_f
-//  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
-  Parameter Up_frac_f;
-
-/// Up_theta
-//  [DEFAULT]=Up_theta=0.0 [deg]
-  Parameter Up_theta;
-
-  // Constructor
-  CoreShellModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-
-#endif
Index: c/sas/models/include/core_shell_bicelle.h
===================================================================
--- src/sas/models/include/core_shell_bicelle.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-#if !defined(core_shell_bicelle_h)
-#define core_shell_bicelle_h
-#include "parameters.hh"
-
-/**
- * Structure definition for core-shell bicelle parameters
- */
-//[PYTHONCLASS] = CoreShellBicelleModel
-//[DISP_PARAMS] = radius, rim_thick, length, face_thick, 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; rim_thick.width;face_thick.width</text>
-//[ORIENTATION_PARAMS]= axis_phi; axis_theta;axis_phi.width; axis_theta.width
-
-class CoreShellBicelleModel{
-public:
-  // Model parameters
-
-  /// Core radius [A]
-  //  [DEFAULT]=radius=20.0 [A]
-  Parameter radius;
-
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-
-  /// Shell rim thickness [A]
-  //  [DEFAULT]=rim_thick=10.0 [A]
-  Parameter rim_thick;
-
-  /// Shell face_thick [A]
-  //  [DEFAULT]=face_thick=10.0 [A]
-  Parameter face_thick;
-
-  /// Core length [A]
-  //  [DEFAULT]=length=400.0 [A]
-  Parameter length;
-
-  /// Core SLD [1/A^(2)]
-  //  [DEFAULT]=core_sld=1.0e-6 [1/A^(2)]
-  Parameter core_sld;
-
-  /// Shell face SLD [1/A^(2)]
-  //  [DEFAULT]=face_sld=4.0e-6 [1/A^(2)]
-  Parameter face_sld;
-
-  /// Shell rim SLD [1/A^(2)]
-  //  [DEFAULT]=rim_sld=4.0e-6 [1/A^(2)]
-  Parameter rim_sld;
-
-  /// Solvent SLD [1/A^(2)]
-  //  [DEFAULT]=solvent_sld=1.0e-6 [1/A^(2)]
-  Parameter solvent_sld;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-  /// Orientation of the long axis of the core-shell cylinder w/respect incoming beam [deg]
-  //  [DEFAULT]=axis_theta=90.0 [deg]
-  Parameter 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]
-  Parameter axis_phi;
-
-  // Constructor
-  CoreShellBicelleModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/core_shell_cylinder.h
===================================================================
--- src/sas/models/include/core_shell_cylinder.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-#if !defined(core_shell_cylinder_h)
-#define core_shell_cylinder_h
-#include "parameters.hh"
-
-/**
- * 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
-
-class CoreShellCylinderModel{
-public:
-  // Model parameters
-
-  /// Core radius [A]
-  //  [DEFAULT]=radius=20.0 [A]
-  Parameter radius;
-
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-
-  /// Shell thickness [A]
-  //  [DEFAULT]=thickness=10.0 [A]
-  Parameter thickness;
-
-  /// Core length [A]
-  //  [DEFAULT]=length=400.0 [A]
-  Parameter length;
-
-  /// Core SLD [1/A^(2)]
-  //  [DEFAULT]=core_sld=1.0e-6 [1/A^(2)]
-  Parameter core_sld;
-
-  /// Shell SLD [1/A^(2)]
-  //  [DEFAULT]=shell_sld=4.0e-6 [1/A^(2)]
-  Parameter shell_sld;
-
-  /// Solvent SLD [1/A^(2)]
-  //  [DEFAULT]=solvent_sld=1.0e-6 [1/A^(2)]
-  Parameter solvent_sld;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-  /// Orientation of the long axis of the core-shell cylinder w/respect incoming beam [deg]
-  //  [DEFAULT]=axis_theta=90.0 [deg]
-  Parameter 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]
-  Parameter axis_phi;
-
-  // Constructor
-  CoreShellCylinderModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/corefourshell.h
===================================================================
--- src/sas/models/include/corefourshell.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,174 +1,0 @@
-#if !defined(corefourshell_h)
-#define corefourshell_h
-#include "parameters.hh"
-
-/**
- * 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> M0_sld_shell4; M_theta_shell4; M_phi_shell4;M0_sld_shell3; M_theta_shell3; M_phi_shell3; M0_sld_shell2; M_theta_shell2; M_phi_shell2;M0_sld_shell1; M_theta_shell1; M_phi_shell1; M0_sld_core0; M_theta_core0; M_phi_core0;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
-//[MAGNETIC_PARAMS]= <text>  M0_sld_shell4; M_theta_shell4; M_phi_shell4;M0_sld_shell3; M_theta_shell3; M_phi_shell3;M0_sld_shell2; M_theta_shell2; M_phi_shell2;M0_sld_shell1; M_theta_shell1; M_phi_shell1; M0_sld_core0; M_theta_core0; M_phi_core0; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
-
-
-class CoreFourShellModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Radius of the core0 [A]
-  //  [DEFAULT]=rad_core0=60. [A]
-  Parameter rad_core0;
-
-  /// sld of core0 [1/A^(2)]
-  //  [DEFAULT]=sld_core0= 6.4e-6 [1/A^(2)]
-  Parameter sld_core0;
-
-  /// thickness of the shell1 [A]
-  //  [DEFAULT]=thick_shell1=10.0 [A]
-  Parameter thick_shell1;
-
-  ///  sld of shell1 [1/A^(2)]
-  //  [DEFAULT]=sld_shell1= 1.0e-6 [1/A^(2)]
-  Parameter sld_shell1;
-
-  ///  thickness of the shell2 [A]
-  //  [DEFAULT]=thick_shell2=10.0 [A]
-  Parameter thick_shell2;
-
-  /// sld of shell2 [1/A^(2)]
-  //  [DEFAULT]=sld_shell2= 2.0e-6 [1/A^(2)]
-  Parameter sld_shell2;
-
-  /// thickness of the shell3 [A]
-  //  [DEFAULT]=thick_shell3=10.0 [A]
-  Parameter thick_shell3;
-
-  ///  sld of shell3 [1/A^(2)]
-  //  [DEFAULT]=sld_shell3= 3.0e-6 [1/A^(2)]
-  Parameter sld_shell3;
-
-  ///  thickness of the shell4 [A]
-  //  [DEFAULT]=thick_shell4=10.0 [A]
-  Parameter thick_shell4;
-
-  /// sld of shell4 [1/A^(2)]
-  //  [DEFAULT]=sld_shell4= 4.0e-6 [1/A^(2)]
-  Parameter sld_shell4;
-
-  /// sld_solv[1/A^(2)]
-  //  [DEFAULT]=sld_solv= 6.4e-6 [1/A^(2)]
-  Parameter sld_solv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.001 [1/cm]
-  Parameter background;
-
-  /// M0_sld_shell1
-  //  [DEFAULT]=M0_sld_shell1=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_shell1;
-
-  /// M_theta_shell1
-  //  [DEFAULT]=M_theta_shell1=0.0 [deg]
-  Parameter M_theta_shell1;
-
-  /// M_phi_shell1
-  //  [DEFAULT]=M_phi_shell1=0.0 [deg]
-  Parameter M_phi_shell1;
-
-  /// M0_sld_shell2
-  //  [DEFAULT]=M0_sld_shell2=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_shell2;
-
-  /// M_theta_shell2
-  //  [DEFAULT]=M_theta_shell2=0.0 [deg]
-  Parameter M_theta_shell2;
-
-  /// M_phi_shell2
-  //  [DEFAULT]=M_phi_shell2=0.0 [deg]
-  Parameter M_phi_shell2;
-
-  /// M0_sld_shell3
-  //  [DEFAULT]=M0_sld_shell3=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_shell3;
-
-  /// M_theta_shell3
-  //  [DEFAULT]=M_theta_shell3=0.0 [deg]
-  Parameter M_theta_shell3;
-
-  /// M_phi_shell3
-  //  [DEFAULT]=M_phi_shell3=0.0 [deg]
-  Parameter M_phi_shell3;
-
-  /// M0_sld_shell4
-  //  [DEFAULT]=M0_sld_shell4=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_shell4;
-
-  /// M_theta_shell4
-  //  [DEFAULT]=M_theta_shell4=0.0 [deg]
-  Parameter M_theta_shell4;
-
-  /// M_phi_shell4
-  //  [DEFAULT]=M_phi_shell4=0.0 [deg]
-  Parameter M_phi_shell4;
-
-  /// M0_sld_core0
-  //  [DEFAULT]=M0_sld_core0=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_core0;
-
-  /// M_theta_core0
-  //  [DEFAULT]=M_theta_core0=0.0 [deg]
-  Parameter M_theta_core0;
-
-  /// M_phi_core0
-  //  [DEFAULT]=M_phi_core0=0.0 [deg]
-  Parameter M_phi_core0;
-
-  /// M0_sld_solv
-  //  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_solv;
-
-  /// M_theta_solv
-  //  [DEFAULT]=M_theta_solv=0.0 [deg]
-  Parameter M_theta_solv;
-
-  /// M_phi_solv
-  //  [DEFAULT]=M_phi_solv=0.0 [deg]
-  Parameter M_phi_solv;
-
-  /// Up_frac_i
-  //  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
-  Parameter Up_frac_i;
-
-  /// Up_frac_f
-  //  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
-  Parameter Up_frac_f;
-
-  /// Up_theta
-  //  [DEFAULT]=Up_theta=0.0 [deg]
-  Parameter Up_theta;
-
-  // Constructor
-  CoreFourShellModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/coresecondmoment.h
===================================================================
--- src/sas/models/include/coresecondmoment.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-#if !defined(coresecondmoment_h)
-#define coresecondmoment_h
-#include "parameters.hh"
-
-/**
- * Structure definition for sphere parameters
- */
- //[PYTHONCLASS] = Core2ndMomentModel
- //[DISP_PARAMS] = radius_core
- //[DESCRIPTION] =<text>Calculate CoreSecondMoment Model
- //
- //				scale:calibration factor,
- //				density_poly: density of the layer
- //				sld_poly: the SLD of the layer
- //				volf_cores: volume fraction of cores
- //				ads_amount: adsorbed amount
- //				second_moment: second moment of the layer
- //				sld_solv: the SLD of the solvent
- //				background
- //
- //		</text>
- //[FIXED]=  radius_core.width
- //[ORIENTATION_PARAMS]= <text> </text>
-
-class Core2ndMomentModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Density of layer[g/cm^(3)]
-  //  [DEFAULT]=density_poly=0.7 [g/cm^(3)]
-  Parameter density_poly;
-
-  /// sld_poly [1/A^(2)]
-  //  [DEFAULT]=sld_poly= 1.5e-6 [1/A^(2)]
-  Parameter sld_poly;
-
-  /// radius_core [A]
-  //  [DEFAULT]=radius_core= 500.0 [A]
-  Parameter radius_core;
-
-  // Model parameters
-  /// volume fraction of_cores
-  //  [DEFAULT]=volf_cores= 0.14
-  Parameter volf_cores;
-
-  /// adsorbed amount [mg/m^(2)]
-  //  [DEFAULT]=ads_amount=1.9 [mg/m^(2)]
-  Parameter ads_amount;
-
-  /// sld_solv [1/A^(2)]
-  //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)]
-  Parameter sld_solv;
-
-  /// second_moment [A]
-  //  [DEFAULT]=second_moment=23.0 [A]
-  Parameter second_moment;
-
- /// Incoherent Background [1/cm]
- //  [DEFAULT]=background=0 [1/cm]
- Parameter background;
-
-  // Constructor
- Core2ndMomentModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-
-#endif
Index: c/sas/models/include/csparallelepiped.h
===================================================================
--- src/sas/models/include/csparallelepiped.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
-	TODO: Add 2D model
-*/
-
-#if !defined(csparallelepiped_h)
-#define csparallelepiped_h
-#include "parameters.hh"
-/** 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>
-
-
- **/
-
-class CSParallelepipedModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  ///  Length of short edge of the parallelepiped [A]
-  //  [DEFAULT]=shortA=35 [A]
-  Parameter shortA;
-  /// Length of mid edge of the parallelepiped [A]
-  //  [DEFAULT]=midB=75 [A]
-  Parameter midB;
-  /// Length of long edge of the parallelepiped [A]
-  //  [DEFAULT]=longC=400 [A]
-  Parameter longC;
-  ///  Thickness of rimA [A]
-  //  [DEFAULT]=rimA=10 [A]
-  Parameter rimA;
-  /// Thickness of rimB [A] [A]
-  //  [DEFAULT]=rimB=10 [A]
-  Parameter rimB;
-  /// Thickness of rimC [A] [A]
-  //  [DEFAULT]=rimC=10 [A]
-  Parameter rimC;
-  /// SLD_rimA [1/A^(2)]
-  //  [DEFAULT]=sld_rimA=2e-6 [1/A^(2)]
-  Parameter sld_rimA;
-  /// SLD_rimB [1/A^(2)]
-  //  [DEFAULT]=sld_rimB=4e-6 [1/A^(2)]
-  Parameter sld_rimB;
-  /// SLD_rimC [1/A^(2)]
-  //  [DEFAULT]=sld_rimC=2e-6 [1/A^(2)]
-  Parameter sld_rimC;
-  /// SLD_pcore [1/A^(2)]
-  //  [DEFAULT]=sld_pcore=1e-6 [1/A^(2)]
-  Parameter sld_pcore;
-  /// sld_solv [1/A^(2)]
-  //  [DEFAULT]=sld_solv=6e-6 [1/A^(2)]
-  Parameter sld_solv;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.06 [1/cm]
-  Parameter background;
-  /// Orientation of the parallelepiped axis w/respect incoming beam [deg]
-  //  [DEFAULT]=parallel_theta=0.0 [deg]
-  Parameter parallel_theta;
-  /// Orientation of the longitudinal axis of the parallelepiped in the plane of the detector [deg]
-  //  [DEFAULT]=parallel_phi=0.0 [deg]
-  Parameter 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]
-  Parameter parallel_psi;
-
-  // Constructor
-  CSParallelepipedModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/cylinder.h
===================================================================
--- src/sas/models/include/cylinder.h	(revision 8836849f414ec4eb13aaff7f52fbae5909bddd0b)
+++ 	(revision )
@@ -1,110 +1,0 @@
-#if !defined(cylinder_h)
-#define cylinder_h
-#include "parameters.hh"
-
-/** 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;M0_sld_cyl; M_theta_cyl; M_phi_cyl;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta;</text>
-	[MAGNETIC_PARAMS]= <text> M0_sld_cyl; M_theta_cyl; M_phi_cyl; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
-
- **/
-class CylinderModel{
-public:
-  // Model parameters
-
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-
-  /// Radius of the cylinder [A]
-  //  [DEFAULT]=radius=20.0 [A] 0.0 inf
-  Parameter radius;
-
-  /// Length of the cylinder [A]
-  //  [DEFAULT]=length=400.0 [A] 0.0 inf
-  Parameter length;
-
-  /// Contrast [1/A^(2)]
-  //  [DEFAULT]=sldCyl=4.0e-6 [1/A^(2)]
-  Parameter sldCyl;
-
-  /// sldCyl [1/A^(2)]
-  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm] 0.00
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-
-  /// Orientation of the cylinder axis w/respect incoming beam [deg]
-  //  [DEFAULT]=cyl_theta=60.0 [deg]
-  Parameter cyl_theta;
-
-  /// Orientation of the cylinder in the plane of the detector [deg]
-  //  [DEFAULT]=cyl_phi=60.0 [deg]
-  Parameter cyl_phi;
-
-  /// M0_sld_cyl
-  //  [DEFAULT]=M0_sld_cyl=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_cyl;
-
-  /// M_theta_cyl
-  //  [DEFAULT]=M_theta_cyl=0.0 [deg]
-  Parameter M_theta_cyl;
-
-  /// M_phi_cyl
-  //  [DEFAULT]=M_phi_cyl=0.0 [deg]
-  Parameter M_phi_cyl;
-
-  /// M0_sld_solv
-  //  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_solv;
-
-  /// M_theta_solv
-  //  [DEFAULT]=M_theta_solv=0.0 [deg]
-  Parameter M_theta_solv;
-
-  /// M_phi_solv
-  //  [DEFAULT]=M_phi_solv=0.0 [deg]
-  Parameter M_phi_solv;
-
-  /// Up_frac_i
-  //  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
-  Parameter Up_frac_i;
-
-  /// Up_frac_f
-  //  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
-  Parameter Up_frac_f;
-
-  /// Up_theta
-  //  [DEFAULT]=Up_theta=0.0 [deg]
-  Parameter Up_theta;
-
-  // Constructor
-  CylinderModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/dabmodel.h
===================================================================
--- src/sas/models/include/dabmodel.h	(revision f008ee25abcc6518da3fa5cb3efabb05e64c9c98)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#ifndef DAB_MODEL_H
-#define DAB_MODEL_H
-
-#include "parameters.hh"
-
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-
-// definition for model parameters
-
-// [PYTHONCLASS] = DABModel
-// [DISP_PARAMS] = length, scale, background
-// [DESCRIPTION] = <text>DAB (Debye Anderson Brumberger) Model
-//    F(x) = scale * L^3/( 1 + (q*L)^2 )^2 + background
-//    L: the correlation length
-//     </text>
-// [FIXED] = 
-// [ORIENTATION_PARAMS] =
-
-
-class DABModel {
-
-public:
-  // Model parameters
-
-  /// Correlation length [A]
-  // [DEFAULT]=length=50.0 [A]
-  Parameter length;
-
-  /// Scale factor
-  // [DEFAULT]=scale=1.0
-  Parameter scale;
-
-  /// Background [1/cm]
-  // [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-  DABModel();
-
-    // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-
-#endif
-
Index: c/sas/models/include/ellipsoid.h
===================================================================
--- src/sas/models/include/ellipsoid.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-#if !defined(ellipsoid_h)
-#define ellipsoid_h
-#include "parameters.hh"
-
-/**
- * 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
-
-class EllipsoidModel{
-public:
-  // Model parameters
-  /// Rotation axis radius_a [A]
-  //  [DEFAULT]=radius_a=20.0 [A]
-  Parameter radius_a;
-
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-
-  /// Radius_b [A]
-  //  [DEFAULT]=radius_b=400 [A]
-  Parameter radius_b;
-
-  /// sldEll [1/A^(2)]
-  //  [DEFAULT]=sldEll=4.0e-6 [1/A^(2)]
-  Parameter sldEll;
-
-  /// sld of solvent [1/A^(2)]
-  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-  /// Orientation of the long axis of the ellipsoid w/respect incoming beam [deg]
-  //  [DEFAULT]=axis_theta=90.0 [deg]
-  Parameter axis_theta;
-  /// Orientation of the long axis of the ellipsoid in the plane of the detector [deg]
-  //  [DEFAULT]=axis_phi=0.0 [deg]
-  Parameter axis_phi;
-
-  // Constructor
-  EllipsoidModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-
-#endif
Index: c/sas/models/include/elliptical_cylinder.h
===================================================================
--- src/sas/models/include/elliptical_cylinder.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-#if !defined(ell_cylinder_h)
-#define ell_cylinder_h
-#include "parameters.hh"
-
-/** 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
- * */
-
-class EllipticalCylinderModel{
-public:
-  // Model parameters
-  /// Minor radius [A]
-  //  [DEFAULT]=r_minor=20.0 [A]
-  Parameter r_minor;
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Ratio of major/minor radii
-  //  [DEFAULT]=r_ratio=1.5
-  Parameter r_ratio;
-  /// Length of the cylinder [A]
-  //  [DEFAULT]=length=400.0 [A]
-  Parameter length;
-  /// SLD of cylinder [1/A^(2)]
-  //  [DEFAULT]=sldCyl=4.0e-6 [1/A^(2)]
-  Parameter sldCyl;
-  /// SLD of solvent [1/A^(2)]
-  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-  /// Incoherent Background [1/cm] 0.000
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-  /// Orientation of the cylinder axis w/respect incoming beam [deg]
-  //  [DEFAULT]=cyl_theta=90.0 [deg]
-  Parameter cyl_theta;
-  /// Orientation of the cylinder in the plane of the detector [deg]
-  //  [DEFAULT]=cyl_phi=0.0 [deg]
-  Parameter cyl_phi;
-  /// Orientation of major radius of the cross-section w/respect vector q [deg]
-  //  [DEFAULT]=cyl_psi=0.0 [deg]
-  Parameter cyl_psi;
-
-  // Constructor
-  EllipticalCylinderModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-#endif
Index: c/sas/models/include/fcc.h
===================================================================
--- src/sas/models/include/fcc.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-#if !defined(fcc_h)
-#define fcc_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class FCCrystalModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Nearest neighbor distance [A]
-  //  [DEFAULT]=dnn=220.0 [A]
-  Parameter dnn;
-
-  /// Paracrystal distortion factor g
-  //  [DEFAULT]=d_factor=0.06
-  Parameter d_factor;
-
-  /// Radius of sphere [A]
-  //  [DEFAULT]=radius=40.0 [A]
-  Parameter radius;
-
-  /// sldSph [1/A^(2)]
-  //  [DEFAULT]=sldSph= 3.0e-6 [1/A^(2)]
-  Parameter sldSph;
-
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv= 6.3e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-/// Incoherent Background [1/cm]
-//  [DEFAULT]=background=0 [1/cm]
-Parameter background;
-  /// Orientation of the a1 axis w/respect incoming beam [deg]
-  //  [DEFAULT]=theta=0.0 [deg]
-  Parameter theta;
-  /// Orientation of the a2 in the plane of the detector [deg]
-  //  [DEFAULT]=phi=0.0 [deg]
-  Parameter phi;
-  /// Orientation of the a3 in the plane of the detector [deg]
-  //  [DEFAULT]=psi=0.0 [deg]
-  Parameter psi;
-
-  // Constructor
-  FCCrystalModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/flexcyl_ellipX.h
===================================================================
--- src/sas/models/include/flexcyl_ellipX.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#if !defined(flexcyl_ellipX_h)
-#define flexcyl_ellipX_h
-#include "parameters.hh"
-
-/** 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>
- **/
-
-class FlexCylEllipXModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Length of the flexible cylinder [A]
-  //  [DEFAULT]=length=1000 [A]
-  Parameter length;
-  /// Kuhn length of the flexible cylinder [A]
-  //  [DEFAULT]=kuhn_length=100 [A]
-  Parameter kuhn_length;
-  /// Radius of the flexible cylinder [A]
-  //  [DEFAULT]=radius=20.0 [A]
-  Parameter radius;
-  /// axis_ratio (major_radius/radius
-  //  [DEFAULT]=axis_ratio=1.5
-  Parameter axis_ratio;
-  /// SLD of cylinder [1/A^(2)]
-  //  [DEFAULT]=sldCyl=1.0e-6 [1/A^(2)]
-  Parameter sldCyl;
-  /// SLD of solvent [1/A^(2)]
-  //  [DEFAULT]=sldSolv=6.3e-6 [1/A^(2)]
-  Parameter sldSolv;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0001 [1/cm]
-  Parameter background;
-
-  // Constructor
-  FlexCylEllipXModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/flexible_cylinder.h
===================================================================
--- src/sas/models/include/flexible_cylinder.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
-	TODO: Add 2D model
- */
-#if !defined(flexible_cylinder_h)
-#define flexible_cylinder_h
-#include "parameters.hh"
-
-/** 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>
- **/
-
-class FlexibleCylinderModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Length of the flexible cylinder [A]
-  //  [DEFAULT]=length=1000 [A]
-  Parameter length;
-  /// Kuhn length of the flexible cylinder [A]
-  //  [DEFAULT]=kuhn_length=100 [A]
-  Parameter kuhn_length;
-  /// Radius of the flexible cylinder [A]
-  //  [DEFAULT]=radius=20.0 [A]
-  Parameter radius;
-  /// SLD of cylinder [1/A^(2)]
-  //  [DEFAULT]=sldCyl=1.0e-6 [1/A^(2)]
-  Parameter sldCyl;
-  /// SLD of solvent [1/A^(2)]
-  //  [DEFAULT]=sldSolv=6.3e-6 [1/A^(2)]
-  Parameter sldSolv;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0001 [1/cm]
-  Parameter background;
-
-  // Constructor
-  FlexibleCylinderModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/fractal.h
===================================================================
--- src/sas/models/include/fractal.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-#if !defined(fractal_h)
-#define fractal_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class FractalModel{
-public:
-  // Model parameters
-  /// Radius of gyration [A]
-  //  [DEFAULT]=radius=5.0 [A]
-  Parameter radius;
-
-  /// Scale factor
-  //  [DEFAULT]=scale= 0.05
-  Parameter scale;
-
-  /// Fractal dimension
-  //  [DEFAULT]=fractal_dim=2.0
-  Parameter fractal_dim;
-
-  /// Correlation Length [A]
-  //  [DEFAULT]=cor_length=100.0 [A]
-  Parameter cor_length;
-
-  /// SDL block [1/A^(2)]
-  //  [DEFAULT]=sldBlock=2.0e-6 [1/A^(2)]
-  Parameter sldBlock;
-
-  /// SDL solvent [1/A^(2)]
-  //  [DEFAULT]=sldSolv= 6.35e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-
-  // Constructor
-  FractalModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/fuzzysphere.h
===================================================================
--- src/sas/models/include/fuzzysphere.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-#if !defined(fuzzysphere_h)
-#define fuzzysphere_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class FuzzySphereModel{
-public:
-  // Model parameters
-  /// Radius of sphere [A]
-  //  [DEFAULT]=radius=60.0 [A]
-  Parameter radius;
-  /// Scale factor
-  //  [DEFAULT]=scale= 0.01
-  Parameter scale;
-
-
-  /// surface roughness [A]
-  //  [DEFAULT]=fuzziness= 10.0 [A]
-  Parameter fuzziness;
-
-  /// sldSph [1/A^(2)]
-  //  [DEFAULT]=sldSph= 1.0e-6 [1/A^(2)]
-  Parameter sldSph;
-
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv= 3.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.001 [1/cm]
-  Parameter background;
-
-  // Constructor
-  FuzzySphereModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/gaussian.h
===================================================================
--- src/sas/models/include/gaussian.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#if !defined(gaussian_h)
-#define gaussian_h
-#include "parameters.hh"
-
-/** 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>
- */
-
-class Gaussian{
-public:
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Standard deviation
-  //  [DEFAULT]=sigma=1
-  Parameter sigma;
-  /// Center of the Gaussian distribution
-  //  [DEFAULT]=center=0.0
-  Parameter center;
-
-  // Constructor
-  Gaussian();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/hollow_cylinder.h
===================================================================
--- src/sas/models/include/hollow_cylinder.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-#if !defined(hollow_cylinder_h)
-#define hollow_cylinder_h
-#include "parameters.hh"
-
-/**
- * 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
-
-class HollowCylinderModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-
-  /// Core radius [A]
-  //  [DEFAULT]=core_radius=20.0 [A]
-  Parameter core_radius;
-
-  /// Shell radius [A]
-  //  [DEFAULT]=radius=30.0 [A]
-  Parameter radius;
-
-  /// Hollow cylinder length [A]
-  //  [DEFAULT]=length=400.0 [A]
-  Parameter length;
-
-  /// SLD_cylinder  [1/A^(2)]
-  //  [DEFAULT]=sldCyl=6.3e-6 [1/A^(2)]
-  Parameter sldCyl;
-
-  /// SLD_solvent  [1/A^(2)]
-  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.01 [1/cm]
-  Parameter background;
-
-  /// Orientation of the long axis of the hollow cylinder w/respect incoming beam [deg]
-  //  [DEFAULT]=axis_theta=90.0 [deg]
-  Parameter axis_theta;
-
-  /// Orientation of the long axis of the hollow cylinder in the plane of the detector [deg]
-  //  [DEFAULT]=axis_phi=0.0 [deg]
-  Parameter axis_phi;
-  //Constructor
-  HollowCylinderModel();
-
-  //Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx , double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/lamellar.h
===================================================================
--- src/sas/models/include/lamellar.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#if !defined(lamellar_h)
-#define lamellar_h
-#include "parameters.hh"
-
-/** 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>
- **/
-
-class LamellarModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// delta bilayer thickness [A]
-  //  [DEFAULT]=bi_thick=50.0 [A]
-  Parameter bi_thick;
-  /// SLD of bilayer [1/A^(2)]
-  //  [DEFAULT]=sld_bi=1.0e-6 [1/A^(2)]
-  Parameter sld_bi;
-  /// SLD of solvent [1/A^(2)]
-  //  [DEFAULT]=sld_sol=6.3e-6 [1/A^(2)]
-  Parameter sld_sol;
-  /// Incoherent Background [1/cm] 0.00
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-  // Constructor
-  LamellarModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/lamellarFF_HG.h
===================================================================
--- src/sas/models/include/lamellarFF_HG.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#if !defined(lamellarFF_HG_h)
-#define lamellarFF_HG_h
-#include "parameters.hh"
-
-/** 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]=
- **/
-
-class LamellarFFHGModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// tail length [A]
-  //  [DEFAULT]=t_length=15.0 [A]
-  Parameter t_length;
-  /// head thickness
-  //  [DEFAULT]=h_thickness=10.0 [A]
-  Parameter h_thickness;
-  /// tail scrattering length density[1/A^(2)]
-  //  [DEFAULT]=sld_tail=4e-7 [1/A^(2)]
-  Parameter sld_tail;
-  /// head group scrattering length density[1/A^(2)]
-  //  [DEFAULT]=sld_head=3e-6 [1/A^(2)]
-  Parameter sld_head;
-  /// solvent scrattering length density[1/A^(2)]
-  //  [DEFAULT]=sld_solvent=6e-6 [1/A^(2)]
-  Parameter sld_solvent;
-  /// Incoherent Background [1/cm] 0.00
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-
-  // Constructor
-  LamellarFFHGModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/lamellarPC.h
===================================================================
--- src/sas/models/include/lamellarPC.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#if !defined(lamellarPC_h)
-#define lamellarPC_h
-#include "parameters.hh"
-
-/** 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]=
- **/
-
-class LamellarPCrystalModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// thickness
-  //  [DEFAULT]=thickness=33.0 [A]
-  Parameter thickness;
-  /// Nlayers
-  //  [DEFAULT]=Nlayers=20.0
-  Parameter Nlayers;
-  /// spacing
-  //  [DEFAULT]=spacing=250.0 [A]
-  Parameter spacing;
-  /// poly-dispersity of spacing
-  //  [DEFAULT]=pd_spacing=0.0
-  Parameter pd_spacing;
-  /// layer scrattering length density[1/A^(2)]
-  //  [DEFAULT]=sld_layer=1.0e-6 [1/A^(2)]
-  Parameter sld_layer;
-  /// solvent scrattering length density[1/A^(2)]
-  //  [DEFAULT]=sld_solvent=6.34e-6 [1/A^(2)]
-  Parameter sld_solvent;
-  /// Incoherent Background [1/cm] 0.00
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-
-  // Constructor
-  LamellarPCrystalModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/lamellarPS.h
===================================================================
--- src/sas/models/include/lamellarPS.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
-	TODO: Add 2D model
- */
-
-#if !defined(lamellarPS_h)
-#define lamellarPS_h
-#include "parameters.hh"
-
-/** 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]=
-
- **/
-
-class LamellarPSModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// repeat spacing of the lamellar [A]
-  //  [DEFAULT]=spacing=400 [A]
-  Parameter spacing;
-  /// bilayer thicknes [A]
-  //  [DEFAULT]=delta=30 [A]
-  Parameter delta;
-  /// SLD of bilayer [1/A^(2)]
-  //  [DEFAULT]=sld_bi=6.3e-6 [1/A^(2)]
-  Parameter sld_bi;
-  /// SLD of solvent [1/A^(2)]
-  //  [DEFAULT]=sld_sol=1.0e-6 [1/A^(2)]
-  Parameter sld_sol;
-  /// Number of lamellar plates
-  //  [DEFAULT]=n_plates=20
-  Parameter n_plates;
-  /// caille parameters
-  //  [DEFAULT]=caille=0.1
-  Parameter caille;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-  // Constructor
-  LamellarPSModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/lamellarPS_HG.h
===================================================================
--- src/sas/models/include/lamellarPS_HG.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
-	TODO: Add 2D model
- */
-
-#if !defined(lamellarPS_HG_h)
-#define lamellarPS_HG_h
-#include "parameters.hh"
-
-/** 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]=
- **/
-
-class LamellarPSHGModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// repeat spacing of the lamellar [A]
-  //  [DEFAULT]=spacing=40 [A]
-  Parameter spacing;
-  ///  tail thickness [A]
-  //  [DEFAULT]=deltaT=10 [A]
-  Parameter deltaT;
-  ///  head thickness [A]
-  //  [DEFAULT]=deltaH=2.0 [A]
-  Parameter deltaH;
-  /// scattering density length of tails [1/A^(2)]
-  //  [DEFAULT]=sld_tail=0.4e-6 [1/A^(2)]
-  Parameter sld_tail;
-  /// scattering density length of head [1/A^(2)]
-  //  [DEFAULT]=sld_head=2e-6 [1/A^(2)]
-  Parameter sld_head;
-  /// scattering density length of solvent [1/A^(2)]
-  //  [DEFAULT]=sld_solvent=6e-6 [1/A^(2)]
-  Parameter sld_solvent;
-  /// Number of lamellar plates
-  //  [DEFAULT]=n_plates=30
-  Parameter n_plates;
-  /// caille parameters
-  //  [DEFAULT]=caille=0.001
-  Parameter caille;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.001 [1/cm]
-  Parameter background;
-
-  // Constructor
-  LamellarPSHGModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/linearpearls.h
===================================================================
--- src/sas/models/include/linearpearls.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-#if !defined(o_h)
-#define linearpearls_h
-#include "parameters.hh"
-
-/**
- * Structure definition for the parameters
- */
-//[PYTHONCLASS] = LinearPearlsModel
-//[DISP_PARAMS] = radius, edge_separation
-//[DESCRIPTION] =<text>Calculate form factor for Pearl Necklace Model
-//				[Macromol. 1996, 29, 2974-2979]
-//				Parameters:
-//				background:background
-//				scale: scale factor
-//				sld_pearl: the SLD of the pearl spheres
-//				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
-//		</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;
-  ///	num_pearls
-  //  [DEFAULT]=num_pearls= 3
-  double num_pearls;
-  ///	sld_pearl
-  //  [DEFAULT]=sld_pearl= 1.0e-06 [1/A^(2)]
-  double sld_pearl;
-  ///	sld_solv
-  //  [DEFAULT]=sld_solv= 6.3e-06 [1/A^(2)]
-  double sld_solv;
-  /// Background
-  //  [DEFAULT]=background=0
-  double background;
-
-}LinearPearlsParameters;
-
-
-
-class LinearPearlsModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-  /// radius [A]
-  //  [DEFAULT]=radius=80.0 [A]
-  Parameter radius;
-  /// edge_separation
-  //  [DEFAULT]=edge_separation= 350 [A]
-  Parameter edge_separation;
-  /// num_pearls
-  //  [DEFAULT]=num_pearls= 3
-  Parameter num_pearls;
-  /// sld_pearl
-  //  [DEFAULT]=sld_pearl= 1.0e-06 [1/A^(2)]
-  Parameter sld_pearl;
-  /// sld_solv
-  //  [DEFAULT]=sld_solv= 6.3e-06 [1/A^(2)]
-  Parameter sld_solv;
-  /// Background
-  //  [DEFAULT]=background=0
-  Parameter background;
-
-  // Constructor
-  LinearPearlsModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/logNormal.h
===================================================================
--- src/sas/models/include/logNormal.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#if !defined(logNormal_h)
-#define logNormal_h
-#include "parameters.hh"
-
-/** 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>
- */
-
-class LogNormal{
-public:
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Standard deviation
-  //  [DEFAULT]=sigma=1
-  Parameter sigma;
-  /// Center of the Log Normal distribution
-  //  [DEFAULT]=center=0.0
-  Parameter center;
-
-  // Constructor
-  LogNormal();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/lorentzian.h
===================================================================
--- src/sas/models/include/lorentzian.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#if !defined(lorentzian_h)
-#define lorentzian_h
-#include "parameters.hh"
-
-/** 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>
- * [ORIENTATION_PARAMS]= <text> </text>
- */
-
-class Lorentzian{
-public:
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Width
-  //  [DEFAULT]=gamma=1.0
-  Parameter gamma;
-  /// Center of the Lorentzian distribution
-  //  [DEFAULT]=center=0.0
-  Parameter center;
-
-  // Constructor
-  Lorentzian();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/massfractal.h
===================================================================
--- src/sas/models/include/massfractal.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-#if !defined(massfractal_h)
-#define massfractal_h
-#include "parameters.hh"
-
-/**
- * Structure definition for sphere parameters
- */
-//[PYTHONCLASS] = MassFractalModel
-//[DESCRIPTION] =<text> The scattering intensity  I(x) = scale*P(x)*S(x) + background, where
-//		 scale = scale_factor  * V * delta^(2)
-//       p(x)=  F(x*radius)^(2)
-//       F(x) = 3*[sin(x)-x cos(x)]/x**3
-//       S(x) = [(gamma(Dm-1)*colength^(Dm-1)*[1+(x^2*colength^2)]^((1-Dm)/2)
-//						* sin[(Dm-1)*arctan(x*colength)])/x]
-//       where delta = sldParticle -sldSolv.
-//       radius       =  Particle radius
-//       mass_dim  =  Mass fractal dimension
-//       co_length  =  Cut-off length
-//       background   =  background
-//		Ref.:Mildner, Hall,J Phys D Appl Phys(1986), 9, 1535-1545
-//		Note I: This model is valid for 1<mass_dim<6.
-//		Note II: This model is not in absolute scale.
-//		</text>
-//[ORIENTATION_PARAMS]= <text> </text>
-
-class MassFractalModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Radius [A]
-  //  [DEFAULT]=radius=10.0 [A]
-  Parameter radius;
-
-  /// Mass fractal dimension
-  //  [DEFAULT]=mass_dim=1.9
-  Parameter mass_dim;
-
-  /// Cut-off Length [A]
-  //  [DEFAULT]=co_length=100.0 [A]
-  Parameter co_length;
-
-  /// Incoherent Background
-  //  [DEFAULT]=background=0.0
-  Parameter background;
-
-  // Constructor
-  MassFractalModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/masssurfacefractal.h
===================================================================
--- src/sas/models/include/masssurfacefractal.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#if !defined(masssurfacefractal_h)
-#define masssurfacefractal_h
-#include "parameters.hh"
-
-/**
- * Structure definition for sphere parameters
- */
-//[PYTHONCLASS] = MassSurfaceFractal
-//[DESCRIPTION] =<text> The scattering intensity  I(x) = scale*P(x) + background,
-//       p(x)= {[1+(x^2*a)]^(Dm/2) * [1+(x^2*b)]^(6-Ds-Dm)/2}^(-1)
-//       a = Rg^2/(3*Dm/2)
-//       b = rg^2/(3*(6-Ds-Dm)/2)
-//       scale        =  scale factor * N*Volume^2*contrast^2
-//       mass_dim       =  Dm (mass fractal dimension)
-//       surface_dim  =  Ds
-//       cluster_rg  =  Rg
-//       primary_rg    =  rg
-//       background   =  background
-//	Ref: Schmidt, J Appl Cryst, eq(19), (1991), 24, 414-435
-//       : Hurd, Schaefer, Martin, Phys Rev A, eq(2),(1987),35, 2361-2364
-//  Note that 0 < Ds< 6 and 0 < Dm < 6.
-//		</text>
-//[ORIENTATION_PARAMS]= <text> </text>
-
-class MassSurfaceFractal{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Mass fractal dimension
-  //  [DEFAULT]=mass_dim=1.8
-  Parameter mass_dim;
-
-  /// Surface fractal dimension
-  //  [DEFAULT]=surface_dim=2.3
-  Parameter surface_dim;
-
-  /// cluster_rg [A]
-  //  [DEFAULT]=cluster_rg=86.7 [A]
-  Parameter cluster_rg;
-
- /// primary_rg [A]
-  //  [DEFAULT]=primary_rg=4000.0 [A]
-  Parameter primary_rg;
-
-  /// Incoherent Background
-  //  [DEFAULT]=background=0.0
-  Parameter background;
-
-  // Constructor
-  MassSurfaceFractal();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/micelleSphCore.h
===================================================================
--- src/sas/models/include/micelleSphCore.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-#if !defined(micelleSphCore_h)
-#define micelleSphCore_h
-#include "parameters.hh"
-
-/**
-[PYTHONCLASS] = MicelleSphCoreModel
-[DISP_PARAMS] = radius_core, radius_gyr
-[DESCRIPTION] = <text>
-                Model parameters:   
-                ndensity : number density of micelles
-                v_core: volume block in core
-                v_corona: volume block in corona
-                rho_solv: sld of solvent 
-                rho_core: sld of core
-                rho_corona: sld of corona
-                radius_core: radius of core
-                radius_gyr: radius of gyration of chains in corona 
-                d_penetration: close to unity, mimics non-penetration of gaussian chains
-                n_aggreg: aggregation number of the micelle
-                background: incoherent background
-                scale : scale factor
-		</text>
-[FIXED]= <text> radius_core.width; radius_gyr.width </text>
-[ORIENTATION_PARAMS]= <text> </text>
-**/
-
-class MicelleSphCoreModel{
-public:
-
-    // Model parameters
-  
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-    Parameter scale;
-
-    /// Number density of micelles [1/cm^(3)]
-    //  [DEFAULT]=ndensity= 8.94e15 [1/cm^(3)]
-    Parameter ndensity;
-
-    /// Core volume [A]
-    //  [DEFAULT]=v_core= 62624. [A^3]
-    Parameter v_core;
-
-    /// Corona volume [A^(3)]
-    //  [DEFAULT]=v_corona= 61940. [A^(3)]
-    Parameter v_corona;
-
-    /// solvent scattering length density [1/A^(2)]
-    //  [DEFAULT]=rho_solv= 6.4e-6 [1/A^(2)]
-    Parameter rho_solv;
-
-    /// core scattering length density [1/A^(2)]
-    //  [DEFAULT]=rho_core= 3.4e-7 [1/A^(2)]
-    Parameter rho_core;
-
-    /// corona scattering length density [1/A^(2)]
-    //  [DEFAULT]=rho_corona= 8.0e-7 [1/A^(2)]
-    Parameter rho_corona;
-
-    /// core radius [A]
-    //  [DEFAULT]=radius_core= 45.0 [A]
-    Parameter radius_core;
-
-    /// radius of gyration of chains in corona[A]
-    //  [DEFAULT]=radius_gyr= 20.0 [A]
-    Parameter radius_gyr;
-
-    /// d factor to mimic non-penetration of Gaussian chains, close to unity 
-    //  [DEFAULT]=d_penetration= 1.0 
-    Parameter d_penetration;
-
-    /// aggregation number of the micelle 
-    //  [DEFAULT]=n_aggreg= 6.0 
-    Parameter n_aggreg;
-
-    /// Incoherent Background [1/cm]
-    //  [DEFAULT]=background=0 [1/cm]
-    Parameter background;
-
-    //Constructor
-    MicelleSphCoreModel();
-    
-    // Operators to get I(Q)
-    double operator()(double q);
-    double operator()(double qx, double qy);
-    double calculate_ER();
-    double calculate_VR();
-    double evaluate_rphi(double q, double phi);
-};
-#endif
Index: c/sas/models/include/multishell.h
===================================================================
--- src/sas/models/include/multishell.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-#if !defined(multishell_h)
-#define multishell_h
-#include "parameters.hh"
-
-/**
- * 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>
- */
-
-class MultiShellModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Core radius of the multishell [A]
-  //  [DEFAULT]=core_radius=60.0 [A]
-  Parameter core_radius;
-
-  /// shell thickness [A]
-  //  [DEFAULT]=s_thickness= 10.0 [A]
-  Parameter s_thickness;
-
-  /// water thickness [A]
-  //  [DEFAULT]=w_thickness= 10.0 [A]
-  Parameter w_thickness;
-
-  /// core scattering length density [1/A^(2)]
-  //  [DEFAULT]=core_sld= 6.4e-6 [1/A^(2)]
-  Parameter core_sld;
-
-  /// shell scattering length density [1/A^(2)]
-  //  [DEFAULT]=shell_sld= 4.0e-7 [1/A^(2)]
-  Parameter shell_sld;
-
-  /// number of pairs of water and shell
-  //  [DEFAULT]=n_pairs= 2
-  Parameter n_pairs;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-  //Constructor
-  MultiShellModel();
-
-  //Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx , double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/onion.h
===================================================================
--- src/sas/models/include/onion.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-#if !defined(o_h)
-#define onion_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class OnionModel{
-public:
-    // Model parameters
-    /// number of shells
-    //  [DEFAULT]=n_shells=1
-    Parameter n_shells;
-      /// Scale factor
-      //  [DEFAULT]=scale= 1.0
-    Parameter scale;
-      /// Radius of sphere [A]
-      //  [DEFAULT]=rad_core0=200.0 [A]
-    Parameter rad_core0;
-    /// sld_core [1/A^(2)]
-    //  [DEFAULT]=sld_core0= 1.0e-6 [1/A^(2)]
-    Parameter sld_core0;
-    /// sld_solv [1/A^(2)]
-    //  [DEFAULT]=sld_solv= 6.4e-6 [1/A^(2)]
-    Parameter sld_solv;
-    /// Incoherent Background [1/cm]
-    //  [DEFAULT]=background=0 [1/cm]
-    Parameter background;
-
-    //  [DEFAULT]=sld_out_shell1=2.0e-06 [1/A^(2)]
-    Parameter sld_out_shell1;
-    //  [DEFAULT]=sld_out_shell2=2.5e-06 [1/A^(2)]
-    Parameter sld_out_shell2;
-    //  [DEFAULT]=sld_out_shell3=3.0e-06 [1/A^(2)]
-    Parameter sld_out_shell3;
-    //  [DEFAULT]=sld_out_shell4=3.5e-06 [1/A^(2)]
-    Parameter sld_out_shell4;
-    //  [DEFAULT]=sld_out_shell5=4.0e-06 [1/A^(2)]
-    Parameter sld_out_shell5;
-    //  [DEFAULT]=sld_out_shell6=4.5e-06 [1/A^(2)]
-    Parameter sld_out_shell6;
-    //  [DEFAULT]=sld_out_shell7=5.0e-06 [1/A^(2)]
-    Parameter sld_out_shell7;
-    //  [DEFAULT]=sld_out_shell8=5.5e-06 [1/A^(2)]
-    Parameter sld_out_shell8;
-    //  [DEFAULT]=sld_out_shell9=6.0e-06 [1/A^(2)]
-    Parameter sld_out_shell9;
-    //  [DEFAULT]=sld_out_shell10=6.2e-06 [1/A^(2)]
-    Parameter sld_out_shell10;
-
-    //  [DEFAULT]=sld_in_shell1=1.7e-06 [1/A^(2)]
-    Parameter sld_in_shell1;
-    //  [DEFAULT]=sld_in_shell2=2.2e-06 [1/A^(2)]
-    Parameter sld_in_shell2;
-    //  [DEFAULT]=sld_in_shell3=2.7e-06 [1/A^(2)]
-    Parameter sld_in_shell3;
-    //  [DEFAULT]=sld_in_shell4=3.2e-06 [1/A^(2)]
-    Parameter sld_in_shell4;
-    //  [DEFAULT]=sld_in_shell5=3.7e-06 [1/A^(2)]
-    Parameter sld_in_shell5;
-    //  [DEFAULT]=sld_in_shell6=4.2e-06 [1/A^(2)]
-    Parameter sld_in_shell6;
-    //  [DEFAULT]=sld_in_shell7=4.7e-06 [1/A^(2)]
-    Parameter sld_in_shell7;
-    //  [DEFAULT]=sld_in_shell8=5.2e-06 [1/A^(2)]
-    Parameter sld_in_shell8;
-    //  [DEFAULT]=sld_in_shell9=5.7e-06 [1/A^(2)]
-    Parameter sld_in_shell9;
-    //  [DEFAULT]=sld_in_shell10=6.0e-06 [1/A^(2)]
-    Parameter sld_in_shell10;
-
-    //  [DEFAULT]=A_shell1=1.0
-    Parameter A_shell1;
-    //  [DEFAULT]=A_shell2=1.0
-    Parameter A_shell2;
-    //  [DEFAULT]=A_shell3=1.0
-    Parameter A_shell3;
-    //  [DEFAULT]=A_shell4=1.0
-    Parameter A_shell4;
-    //  [DEFAULT]=A_shell5=1.0
-    Parameter A_shell5;
-    //  [DEFAULT]=A_shell6=1.0
-    Parameter A_shell6;
-    //  [DEFAULT]=A_shell7=1.0
-    Parameter A_shell7;
-    //  [DEFAULT]=A_shell8=1.0
-    Parameter A_shell8;
-    //  [DEFAULT]=A_shell9=1.0
-    Parameter A_shell9;
-    //  [DEFAULT]=A_shell10=1.0
-    Parameter A_shell10;
-
-    //  [DEFAULT]=thick_shell1=50.0 [A]
-    Parameter thick_shell1;
-    //  [DEFAULT]=thick_shell2=50.0 [A]
-    Parameter thick_shell2;
-    //  [DEFAULT]=thick_shell3=50.0 [A]
-    Parameter thick_shell3;
-    //  [DEFAULT]=thick_shell4=50.0 [A]
-    Parameter thick_shell4;
-    //  [DEFAULT]=thick_shell5=50.0 [A]
-    Parameter thick_shell5;
-    //  [DEFAULT]=thick_shell6=50.0 [A]
-    Parameter thick_shell6;
-    //  [DEFAULT]=thick_shell7=50.0 [A]
-    Parameter thick_shell7;
-    //  [DEFAULT]=thick_shell8=50.0 [A]
-    Parameter thick_shell8;
-    //  [DEFAULT]=thick_shell9=50.0 [A]
-    Parameter thick_shell9;
-    //  [DEFAULT]=thick_shell10=50.0 [A]
-    Parameter thick_shell10;
-
-    //  [DEFAULT]=func_shell1=2
-    Parameter func_shell1;
-    //  [DEFAULT]=func_shell2=2
-    Parameter func_shell2;
-    //  [DEFAULT]=func_shell3=2
-    Parameter func_shell3;
-    //  [DEFAULT]=func_shell4=2
-    Parameter func_shell4;
-    //  [DEFAULT]=func_shell5=2
-    Parameter func_shell5;
-    //  [DEFAULT]=func_shell6=2
-    Parameter func_shell6;
-    //  [DEFAULT]=func_shell7=2
-    Parameter func_shell7;
-    //  [DEFAULT]=func_shell8=2
-    Parameter func_shell8;
-    //  [DEFAULT]=func_shell9=2
-    Parameter func_shell9;
-    //  [DEFAULT]=func_shell10=2
-    Parameter func_shell10;
-
-  // Constructor
-  OnionModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/parallelepiped.h
===================================================================
--- src/sas/models/include/parallelepiped.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-#if !defined(parallelepiped_h)
-#define parallelepiped_h
-#include "parameters.hh"
-
-/** 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; M0_sld_pipe; M_theta_pipe; M_phi_pipe;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta;</text>
-	[MAGNETIC_PARAMS]= <text> M0_sld_pipe; M_theta_pipe; M_phi_pipe; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
-
- **/
-
-class ParallelepipedModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  ///  Length of short edge of the parallelepiped [A]
-  //  [DEFAULT]=short_a=35 [A]
-  Parameter short_a;
-  /// Length of short edge edge of the parallelepiped [A]
-  //  [DEFAULT]=short_b=75 [A]
-  Parameter short_b;
-  /// Length of long edge of the parallelepiped [A]
-  //  [DEFAULT]=long_c=400 [A]
-  Parameter long_c;
-  /// SLD_Pipe [1/A^(2)]
-  //  [DEFAULT]=sldPipe=6.3e-6 [1/A^(2)]
-  Parameter sldPipe;
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-  /// Orientation of the parallelepiped axis w/respect incoming beam [deg]
-  //  [DEFAULT]=parallel_theta=0.0 [deg]
-  Parameter parallel_theta;
-  /// Orientation of the longitudinal axis of the parallelepiped in the plane of the detector [deg]
-  //  [DEFAULT]=parallel_phi=0.0 [deg]
-  Parameter 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]
-  Parameter parallel_psi;
-
-  /// M0_sld_pipe
-  //  [DEFAULT]=M0_sld_pipe=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_pipe;
-
-  /// M_theta_pipe
-  //  [DEFAULT]=M_theta_pipe=0.0 [deg]
-  Parameter M_theta_pipe;
-
-  /// M_phi_pipe
-  //  [DEFAULT]=M_phi_pipe=0.0 [deg]
-  Parameter M_phi_pipe;
-
-  /// M0_sld_solv
-  //  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
-  Parameter M0_sld_solv;
-
-  /// M_theta_solv
-  //  [DEFAULT]=M_theta_solv=0.0 [deg]
-  Parameter M_theta_solv;
-
-  /// M_phi_solv
-  //  [DEFAULT]=M_phi_solv=0.0 [deg]
-  Parameter M_phi_solv;
-
-  /// Up_frac_i
-  //  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
-  Parameter Up_frac_i;
-
-  /// Up_frac_f
-  //  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
-  Parameter Up_frac_f;
-
-  /// Up_theta
-  //  [DEFAULT]=Up_theta=0.0 [deg]
-  Parameter Up_theta;
-  
-  // Constructor
-  ParallelepipedModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-#endif
Index: c/sas/models/include/pearlnecklace.h
===================================================================
--- src/sas/models/include/pearlnecklace.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-#if !defined(o_h)
-#define pearl_necklace_h
-#include "parameters.hh"
-
-/**
- * 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;
-
-
-
-class PearlNecklaceModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-  /// radius [A]
-  //  [DEFAULT]=radius=80.0 [A]
-  Parameter radius;
-  /// edge_separation
-  //  [DEFAULT]=edge_separation= 350 [A]
-  Parameter edge_separation;
-  /// thick_string [A]
-  //  [DEFAULT]=thick_string= 2.5 [A]
-  Parameter thick_string;
-  /// num_pearls
-  //  [DEFAULT]=num_pearls= 3
-  Parameter num_pearls;
-  /// sld_pearl
-  //  [DEFAULT]=sld_pearl= 1.0e-06 [1/A^(2)]
-  Parameter sld_pearl;
-  /// sld_string
-  //  [DEFAULT]=sld_string= 1.0e-06 [1/A^(2)]
-  Parameter sld_string;
-  /// sld_solv
-  //  [DEFAULT]=sld_solv= 6.3e-06 [1/A^(2)]
-  Parameter sld_solv;
-  /// Background
-  //  [DEFAULT]=background=0
-  Parameter background;
-
-  // Constructor
-  PearlNecklaceModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/polygausscoil.h
===================================================================
--- src/sas/models/include/polygausscoil.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#if !defined(polygausscoil_h)
-#define polygausscoil_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class Poly_GaussCoil{
-public:
-  // Model parameters
-  /// Radius of gyration [A]
-  //  [DEFAULT]=rg=60.0 [A]
-  Parameter rg;
-
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// polydispersity of molecular weight
-  //  [DEFAULT]=poly_m= 2.0 [Mw/Mn]
-  Parameter poly_m;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.001 [1/cm]
-  Parameter background;
-
-  // Constructor
-  Poly_GaussCoil();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/pringles.h
===================================================================
--- src/sas/models/include/pringles.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/**
- * (c) 2013 / Andrew J Jackson / andrew.jackson@esss.se
- *
- * Model for "pringles" particle from K. Edler @ Bath University
- *
- */
-
-#if !defined(pringles_h)
-#define pringles_h
-#include "parameters.hh"
-
-//[PYTHONCLASS] = PringlesModel
-//[DISP_PARAMS] = radius,thickness,alpha,beta,
-//[DESCRIPTION] = <text> Pringles model for K Edler. Represents a disc that is bent in two directions. </text>
-//[FIXED]= <text> radius.width; thickness.width; alpha.width; beta.width</text>
-//[ORIENTATION_PARAMS]= <text> </text>
-
-class PringlesModel {
-public:
-	//[DEFAULT]=scale=1.0
-	Parameter scale;
-	//[DEFAULT]=radius=60.0 [A]
-	Parameter radius;
-	//[DEFAULT]=thickness=10.00 [A]
-	Parameter thickness;
-	//[DEFAULT]=alpha=0.001 [rad]
-	Parameter alpha;
-	//[DEFAULT]=beta=0.02 [rad]
-	Parameter beta;
-	//[DEFAULT]=sld_pringle=1.0e-6 [A^(-2)]
-	Parameter sld_pringle;
-	//[DEFAULT]=sld_solvent=6.35e-6 [A^(-2)]
-	Parameter sld_solvent;
-	//[DEFAULT]=background=0.0 [1/cm]
-	Parameter background;
-	//Constructor
-	PringlesModel();
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double calculate_VR();
-	double evaluate_rphi(double q, double phi);
-};
-
-static double pringle_form(double dp[], double q);
-static double pringle_kernel(double dp[], double q, double phi);
-static double pringleC(double dp[], double q, double n, double phi);
-static double pringleS(double dp[], double q, double n, double phi);
-#endif
Index: c/sas/models/include/raspberry.h
===================================================================
--- src/sas/models/include/raspberry.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-#if !defined(raspberry_h)
-#define raspberry_h
-#include "parameters.hh"
-
-/**
- * Structure definition for RaspBerryModel parameters
- */
-//[PYTHONCLASS] = RaspBerryModel
-//[DISP_PARAMS] = radius_Lsph
-//[DESCRIPTION] =<text> RaspBerryModel:
-//				volf_Lsph = volume fraction large spheres
-//				radius_Lsph = radius large sphere (A)
-//				sld_Lsph = sld large sphere (A-2)
-//				volf_Ssph = volume fraction small spheres
-//				radius_Ssph = radius small sphere (A)
-//				surfrac_Ssph = fraction of small spheres at surface
-//				sld_Ssph = sld small sphere
-//				delta_Ssph = small sphere penetration (A) 
-//				sld_solv   = sld solvent
-//				background = background (cm-1)
-//			Ref: J. coll. inter. sci. (2010) vol. 343 (1) pp. 36-41.
-//		</text>
-//[FIXED]=  radius_Lsph.width
-//[ORIENTATION_PARAMS]= <text> </text>
-
-class RaspBerryModel{
-public:
-  // Model parameters
-  /// volf_Lsph 
-  //  [DEFAULT]=volf_Lsph=0.05
-  Parameter volf_Lsph;
-  /// radius_Lsph [A]
-  //  [DEFAULT]=radius_Lsph= 5000.0 [A]
-  Parameter radius_Lsph;
-  /// sld_Lsph [1/A^(2)]
-  //  [DEFAULT]=sld_Lsph= -4.0e-7 [1/A^(2)]
-  Parameter sld_Lsph;
-  /// volf_Ssph 
-  //  [DEFAULT]=volf_Ssph=0.005
-  Parameter volf_Ssph;
-  /// radius_Ssph [A]
-  //  [DEFAULT]=radius_Ssph= 100.0 [A]
-  Parameter radius_Ssph;
-  /// surfrac_Ssph 
-  //  [DEFAULT]=surfrac_Ssph=0.4
-  Parameter surfrac_Ssph;
-  /// sld_Ssph [1/A^(2)]
-  //  [DEFAULT]=sld_Ssph= 3.5e-6 [1/A^(2)]
-  Parameter sld_Ssph;  
-  /// delta_Ssph [A]
-  //  [DEFAULT]=delta_Ssph= 0.0
-  Parameter delta_Ssph;
-  /// sld_solv [1/A^(2)]
-  //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)]
-  Parameter sld_solv;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-
-  // Constructor
-  RaspBerryModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-double raspberry_kernel(double dp[], double q);
-double rasp_bes(double qval, double rad);
-#endif
Index: c/sas/models/include/refl.h
===================================================================
--- src/sas/models/include/refl.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,155 +1,0 @@
-// The original code, of which work was not DANSE funded,
-// was provided by J. Cho.
-#if !defined(o_h)
-#define refl_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class ReflModel{
-public:
-  // Model parameters
-  /// number of layers
-  //  [DEFAULT]=n_layers=1
-  Parameter n_layers;
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-    /// thick_inter0 [A]
-    //  [DEFAULT]=thick_inter0=1.0 [A]
-  Parameter thick_inter0;
-  /// func_inter0
-  //  [DEFAULT]=func_inter0= 0
-  Parameter func_inter0;
-  /// sld_bottom0 [1/A^(2)]
-  //  [DEFAULT]=sld_bottom0= 2.07e-6 [1/A^(2)]
-  Parameter sld_bottom0;
-  /// sld_medium [1/A^(2)]
-  //  [DEFAULT]=sld_medium= 1.0e-6 [1/A^(2)]
-  Parameter sld_medium;
-  /// Background
-  //  [DEFAULT]=background=0
-  Parameter background;
-
-    //  [DEFAULT]=sld_flat1=4.0e-06 [1/A^(2)]
-    Parameter sld_flat1;
-    //  [DEFAULT]=sld_flat2=3.5e-06 [1/A^(2)]
-    Parameter sld_flat2;
-    //  [DEFAULT]=sld_flat3=4.0e-06 [1/A^(2)]
-    Parameter sld_flat3;
-    //  [DEFAULT]=sld_flat4=3.5e-06 [1/A^(2)]
-    Parameter sld_flat4;
-    //  [DEFAULT]=sld_flat5=4.0e-06 [1/A^(2)]
-    Parameter sld_flat5;
-    //  [DEFAULT]=sld_flat6=3.5e-06 [1/A^(2)]
-    Parameter sld_flat6;
-    //  [DEFAULT]=sld_flat7=4.0e-06 [1/A^(2)]
-    Parameter sld_flat7;
-    //  [DEFAULT]=sld_flat8=3.5e-06 [1/A^(2)]
-    Parameter sld_flat8;
-    //  [DEFAULT]=sld_flat9=4.0e-06 [1/A^(2)]
-    Parameter sld_flat9;
-    //  [DEFAULT]=sld_flat10=3.5e-06 [1/A^(2)]
-    Parameter sld_flat10;
-
-    //  [DEFAULT]=thick_inter1=1 [A]
-    Parameter thick_inter1;
-    //  [DEFAULT]=thick_inter2=1 [A]
-    Parameter thick_inter2;
-    //  [DEFAULT]=thick_inter3=1 [A]
-    Parameter thick_inter3;
-    //  [DEFAULT]=thick_inter4=1 [A]
-    Parameter thick_inter4;
-    //  [DEFAULT]=thick_inter5=1 [A]
-    Parameter thick_inter5;
-    //  [DEFAULT]=thick_inter6=1 [A]
-    Parameter thick_inter6;
-    //  [DEFAULT]=thick_inter7=1 [A]
-    Parameter thick_inter7;
-    //  [DEFAULT]=thick_inter8=1 [A]
-    Parameter thick_inter8;
-    //  [DEFAULT]=thick_inter9=1 [A]
-    Parameter thick_inter9;
-    //  [DEFAULT]=thick_inter10=1 [A]
-    Parameter thick_inter10;
-
-    //  [DEFAULT]=thick_flat1=10 [A]
-    Parameter thick_flat1;
-    //  [DEFAULT]=thick_flat2=100 [A]
-    Parameter thick_flat2;
-    //  [DEFAULT]=thick_flat3=100 [A]
-    Parameter thick_flat3;
-    //  [DEFAULT]=thick_flat4=100 [A]
-    Parameter thick_flat4;
-    //  [DEFAULT]=thick_flat5=100 [A]
-    Parameter thick_flat5;
-    //  [DEFAULT]=thick_flat6=100 [A]
-    Parameter thick_flat6;
-    //  [DEFAULT]=thick_flat7=100 [A]
-    Parameter thick_flat7;
-    //  [DEFAULT]=thick_flat8=100 [A]
-    Parameter thick_flat8;
-    //  [DEFAULT]=thick_flat9=100 [A]
-    Parameter thick_flat9;
-    //  [DEFAULT]=thick_flat10=100 [A]
-    Parameter thick_flat10;
-
-    //  [DEFAULT]=func_inter1=0
-    Parameter func_inter1;
-    //  [DEFAULT]=func_inter2=0
-    Parameter func_inter2;
-    //  [DEFAULT]=func_inter3=0
-    Parameter func_inter3;
-    //  [DEFAULT]=func_inter4=0
-    Parameter func_inter4;
-    //  [DEFAULT]=func_inter5=0
-    Parameter func_inter5;
-    //  [DEFAULT]=func_inter6=0
-    Parameter func_inter6;
-    //  [DEFAULT]=func_inter7=0
-    Parameter func_inter7;
-    //  [DEFAULT]=func_inter8=0
-    Parameter func_inter8;
-    //  [DEFAULT]=func_inter9=0
-    Parameter func_inter9;
-    //  [DEFAULT]=func_inter10=0
-    Parameter func_inter10;
-
-
-  // Constructor
-  ReflModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/refl_adv.h
===================================================================
--- src/sas/models/include/refl_adv.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,207 +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
-#include "parameters.hh"
-
-/**
- * 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>
-
-class ReflAdvModel{
-public:
-  // Model parameters
-  /// number of layers
-  //  [DEFAULT]=n_layers=1
-  Parameter n_layers;
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-  /// thick_inter0 [A]
-  //  [DEFAULT]=thick_inter0=50.0 [A]
-  Parameter thick_inter0;
-  /// func_inter0
-  //  [DEFAULT]=func_inter0= 0
-  Parameter func_inter0;
-  /// sld_bottom0 [1/A^(2)]
-  //  [DEFAULT]=sld_bottom0= 2.07e-6 [1/A^(2)]
-  Parameter sld_bottom0;
-  /// sld_medium [1/A^(2)]
-  //  [DEFAULT]=sld_medium= 1.0e-6 [1/A^(2)]
-  Parameter sld_medium;
-  /// Background
-  //  [DEFAULT]=background=0
-  Parameter background;
-
-  //  [DEFAULT]=sld_flat1=4.0e-06 [1/A^(2)]
-  Parameter sld_flat1;
-  //  [DEFAULT]=sld_flat2=3.5e-06 [1/A^(2)]
-  Parameter sld_flat2;
-  //  [DEFAULT]=sld_flat3=4.0e-06 [1/A^(2)]
-  Parameter sld_flat3;
-  //  [DEFAULT]=sld_flat4=3.5e-06 [1/A^(2)]
-  Parameter sld_flat4;
-  //  [DEFAULT]=sld_flat5=4.0e-06 [1/A^(2)]
-  Parameter sld_flat5;
-  //  [DEFAULT]=sld_flat6=3.5e-06 [1/A^(2)]
-  Parameter sld_flat6;
-  //  [DEFAULT]=sld_flat7=4.0e-06 [1/A^(2)]
-  Parameter sld_flat7;
-  //  [DEFAULT]=sld_flat8=3.5e-06 [1/A^(2)]
-  Parameter sld_flat8;
-  //  [DEFAULT]=sld_flat9=4.0e-06 [1/A^(2)]
-  Parameter sld_flat9;
-  //  [DEFAULT]=sld_flat10=3.5e-06 [1/A^(2)]
-  Parameter sld_flat10;
-
-  //  [DEFAULT]=thick_inter1=50 [A]
-  Parameter thick_inter1;
-  //  [DEFAULT]=thick_inter2=50 [A]
-  Parameter thick_inter2;
-  //  [DEFAULT]=thick_inter3=50 [A]
-  Parameter thick_inter3;
-  //  [DEFAULT]=thick_inter4=50 [A]
-  Parameter thick_inter4;
-  //  [DEFAULT]=thick_inter5=50 [A]
-  Parameter thick_inter5;
-  //  [DEFAULT]=thick_inter6=50 [A]
-  Parameter thick_inter6;
-  //  [DEFAULT]=thick_inter7=50 [A]
-  Parameter thick_inter7;
-  //  [DEFAULT]=thick_inter8=50 [A]
-  Parameter thick_inter8;
-  //  [DEFAULT]=thick_inter9=50 [A]
-  Parameter thick_inter9;
-  //  [DEFAULT]=thick_inter10=50 [A]
-  Parameter thick_inter10;
-
-  //  [DEFAULT]=thick_flat1=100 [A]
-  Parameter thick_flat1;
-  //  [DEFAULT]=thick_flat2=100 [A]
-  Parameter thick_flat2;
-  //  [DEFAULT]=thick_flat3=100 [A]
-  Parameter thick_flat3;
-  //  [DEFAULT]=thick_flat4=100 [A]
-  Parameter thick_flat4;
-  //  [DEFAULT]=thick_flat5=100 [A]
-  Parameter thick_flat5;
-  //  [DEFAULT]=thick_flat6=100 [A]
-  Parameter thick_flat6;
-  //  [DEFAULT]=thick_flat7=100 [A]
-  Parameter thick_flat7;
-  //  [DEFAULT]=thick_flat8=100 [A]
-  Parameter thick_flat8;
-  //  [DEFAULT]=thick_flat9=100 [A]
-  Parameter thick_flat9;
-  //  [DEFAULT]=thick_flat10=100 [A]
-  Parameter thick_flat10;
-
-  //  [DEFAULT]=func_inter1=0
-  Parameter func_inter1;
-  //  [DEFAULT]=func_inter2=0
-  Parameter func_inter2;
-  //  [DEFAULT]=func_inter3=0
-  Parameter func_inter3;
-  //  [DEFAULT]=func_inter4=0
-  Parameter func_inter4;
-  //  [DEFAULT]=func_inter5=0
-  Parameter func_inter5;
-  //  [DEFAULT]=func_inter6=0
-  Parameter func_inter6;
-  //  [DEFAULT]=func_inter7=0
-  Parameter func_inter7;
-  //  [DEFAULT]=func_inter8=0
-  Parameter func_inter8;
-  //  [DEFAULT]=func_inter9=0
-  Parameter func_inter9;
-  //  [DEFAULT]=func_inter10=0
-  Parameter func_inter10;
-
-  //  [DEFAULT]=sldIM_flat1=0 [1/A^(2)]
-  Parameter sldIM_flat1;
-  //  [DEFAULT]=sldIM_flat2=0 [1/A^(2)]
-  Parameter sldIM_flat2;
-  //  [DEFAULT]=sldIM_flat3=0 [1/A^(2)]
-  Parameter sldIM_flat3;
-  //  [DEFAULT]=sldIM_flat4=0 [1/A^(2)]
-  Parameter sldIM_flat4;
-  //  [DEFAULT]=sldIM_flat5=0 [1/A^(2)]
-  Parameter sldIM_flat5;
-  //  [DEFAULT]=sldIM_flat6=0 [1/A^(2)]
-  Parameter sldIM_flat6;
-  //  [DEFAULT]=sldIM_flat7=0 [1/A^(2)]
-  Parameter sldIM_flat7;
-  //  [DEFAULT]=sldIM_flat8=0 [1/A^(2)]
-  Parameter sldIM_flat8;
-  //  [DEFAULT]=sldIM_flat9=0 [1/A^(2)]
-  Parameter sldIM_flat9;
-  //  [DEFAULT]=sldIM_flat10=0 [1/A^(2)]
-  Parameter sldIM_flat10;
-
-  //  [DEFAULT]=nu_inter1=2.5
-  Parameter nu_inter1;
-  //  [DEFAULT]=nu_inter2=2.5
-  Parameter nu_inter2;
-  //  [DEFAULT]=nu_inter3=2.5
-  Parameter nu_inter3;
-  //  [DEFAULT]=nu_inter4=2.5
-  Parameter nu_inter4;
-  //  [DEFAULT]=nu_inter5=2.5
-  Parameter nu_inter5;
-  //  [DEFAULT]=nu_inter6=2.5
-  Parameter nu_inter6;
-  //  [DEFAULT]=nu_inter7=2.5
-  Parameter nu_inter7;
-  //  [DEFAULT]=nu_inter8=2.5
-  Parameter nu_inter8;
-  //  [DEFAULT]=nu_inter9=2.5
-  Parameter nu_inter9;
-  //  [DEFAULT]=nu_inter10=2.5
-  Parameter nu_inter10;
-
-
-  //  [DEFAULT]=sldIM_sub0=0
-  Parameter sldIM_sub0;
-  //  [DEFAULT]=sldIM_medium=0
-  Parameter sldIM_medium;
-  //  [DEFAULT]=npts_inter=21.0
-  Parameter npts_inter;
-  //  [DEFAULT]=nu_inter0=2.5
-  Parameter nu_inter0;
-
-  // Constructor
-  ReflAdvModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/rpa.h
===================================================================
--- src/sas/models/include/rpa.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-#if !defined(o_h)
-#define rpa_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class RPAModel{
-public:
-  // Model parameters
-  /// The Case number
-  //  [DEFAULT]=lcase_n=0
-  Parameter lcase_n;
-
-  /// Segment Length ba
-  //  [DEFAULT]=ba= 5.0
-  Parameter ba;
-  /// Segment Length bb
-  //  [DEFAULT]=bb=5.0
-  Parameter bb;
-  /// Segment Length bc
-  //  [DEFAULT]=bc= 5.0
-  Parameter bc;
-  /// Segment Length bd
-  //  [DEFAULT]=bd= 5.0
-  Parameter bd;
-
-  /// Chi Param ab
-  //  [DEFAULT]=Kab=-0.0004
-  Parameter Kab;
-  /// Chi Param ac
-  //  [DEFAULT]=Kac=-0.0004
-  Parameter Kac;
-  /// Chi Param ad
-  //  [DEFAULT]=Kad=-0.0004
-  Parameter Kad;
-  /// Chi Param bc
-  //  [DEFAULT]=Kbc=-0.0004
-  Parameter Kbc;
-  /// Chi Param bd
-  //  [DEFAULT]=Kbd=-0.0004
-  Parameter Kbd;
-  /// Chi Param cd
-  //  [DEFAULT]=Kcd=-0.0004
-  Parameter Kcd;
-
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-  /// Degree OF POLYMERIZATION of a
-  //  [DEFAULT]=Na=1000.0
-  Parameter Na;
-  /// Volume Fraction of a
-  //  [DEFAULT]=Phia=0.25
-  Parameter Phia;
-  /// Specific Volume of a
-  //  [DEFAULT]=va=100.0
-  Parameter va;
-  /// Scattering Length of a
-  //  [DEFAULT]=La=1.0e-012
-  Parameter La;
-
-  /// Degree OF POLYMERIZATION of b
-  //  [DEFAULT]=Nb=1000.0
-  Parameter Nb;
-  /// Volume Fraction of b
-  //  [DEFAULT]=Phib=0.25
-  Parameter Phib;
-  /// Specific Volume of b
-  //  [DEFAULT]=vb=100.0
-  Parameter vb;
-  /// Scattering Length of b
-  //  [DEFAULT]=Lb=1.0e-012
-  Parameter Lb;
-
-  /// Degree OF POLYMERIZATION of c
-  //  [DEFAULT]=Nc=1000.0
-  Parameter Nc;
-  /// Volume Fraction of c
-  //  [DEFAULT]=Phic=0.25
-  Parameter Phic;
-  /// Specific Volume of c
-  //  [DEFAULT]=vc=100.0
-  Parameter vc;
-  /// Scattering Length of c
-  //  [DEFAULT]=Lc=1.0e-012
-  Parameter Lc;
-
-  /// Degree OF POLYMERIZATION of d
-  //  [DEFAULT]=Nd=1000.0
-  Parameter Nd;
-  /// Volume Fraction of d
-  //  [DEFAULT]=Phid=0.25
-  Parameter Phid;
-  /// Specific Volume of d
-  //  [DEFAULT]=vd=100.0
-  Parameter vd;
-  /// Scattering Length of d
-  //  [DEFAULT]=Ld=0.0e-012
-  Parameter Ld;
-
-  // Constructor
-  RPAModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-#endif
Index: c/sas/models/include/sc.h
===================================================================
--- src/sas/models/include/sc.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#if !defined(sc_h)
-#define sc_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-
-
-class SCCrystalModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Nearest neighbor distance [A]
-  //  [DEFAULT]=dnn=220.0 [A]
-  Parameter dnn;
-
-  /// Paracrystal distortion factor g
-  //  [DEFAULT]=d_factor=0.06
-  Parameter d_factor;
-
-  /// Radius of sphere [A]
-  //  [DEFAULT]=radius=40.0 [A]
-  Parameter radius;
-
-  /// sldSph [1/A^(2)]
-  //  [DEFAULT]=sldSph= 3.0e-6 [1/A^(2)]
-  Parameter sldSph;
-
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv= 6.3e-6 [1/A^(2)]
-  Parameter sldSolv;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-  /// Orientation of the a1 axis w/respect incoming beam [deg]
-  //  [DEFAULT]=theta=0.0 [deg]
-  Parameter theta;
-  /// Orientation of the a2 in the plane of the detector [deg]
-  //  [DEFAULT]=phi=0.0 [deg]
-  Parameter phi;
-  /// Orientation of the a3 in the plane of the detector [deg]
-  //  [DEFAULT]=psi=0.0 [deg]
-  Parameter psi;
-
-  // Constructor
-  SCCrystalModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/schulz.h
===================================================================
--- src/sas/models/include/schulz.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#if !defined(schulz_h)
-#define schulz_h
-#include "parameters.hh"
-
-/** 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>
- */
-
-class Schulz{
-public:
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Standard deviation
-  //  [DEFAULT]=sigma=1
-  Parameter sigma;
-  /// Center of the Schulz distribution
-  //  [DEFAULT]=center=0.0
-  Parameter center;
-
-  // Constructor
-  Schulz();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/sld_cal.h
===================================================================
--- src/sas/models/include/sld_cal.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#if !defined(sld_cal_h)
-#define sld_cal_h
-#include "parameters.hh"
-
-/**
- * To calculate the sld value
-* [PYTHONCLASS] = SLDCalFunc
-* [DISP_PARAMS] = npts_inter
-  [DESCRIPTION] =<text>To calculate sld values
- 				</text>
-	[FIXED]= <text>
-			</text>
-
- **/
-
-class SLDCalFunc{
-public:
-  // Model parameters
-  /// fun_type
-  //  [DEFAULT]=fun_type=0
-  Parameter fun_type;
-
-  /// npts_inter
-  //  [DEFAULT]=npts_inter= 21
-  Parameter npts_inter;
-
-  /// shell_num
-  //  [DEFAULT]=shell_num= 0
-  Parameter shell_num;
-
-  /// nu_inter
-  //  [DEFAULT]=nu_inter= 2.5
-  Parameter nu_inter;
-
-  /// sld_left [1/A^(2)]
-  //  [DEFAULT]=sld_left= 0 [1/A^(2)]
-  Parameter sld_left;
-
-  /// sld_right [1/A^(2)]
-  //  [DEFAULT]=sld_right= 0 [1/A^(2)]
-  Parameter sld_right;
-
-  // Constructor
-  SLDCalFunc();
-
-  // Operators to get SLD
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-
-
-#endif
Index: c/sas/models/include/sphere.h
===================================================================
--- src/sas/models/include/sphere.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-#if !defined(sphere_h)
-#define sphere_h
-#include "parameters.hh"
-
-/**
- * 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> M0_sld_sph; M_theta_sph; M_phi_sph;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
- //[MAGNETIC_PARAMS]= <text> M0_sld_sph; M_theta_sph; M_phi_sph; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
- //[CATEGORY] = Shapes & Spheres
- 
-class SphereModel{
-public:
-	// Model parameters
-	/// Scale factor
-	//  [DEFAULT]=scale= 1.0
-	Parameter scale;
-
-	/// Radius of sphere [A]
-	//  [DEFAULT]=radius=60.0 [A]
-	Parameter radius;
-
-	/// sldSph [1/A^(2)]
-	//  [DEFAULT]=sldSph= 2.0e-6 [1/A^(2)]
-	Parameter sldSph;
-
-	/// sldSolv [1/A^(2)]
-	//  [DEFAULT]=sldSolv= 1.0e-6 [1/A^(2)]
-	Parameter sldSolv;
-
-	/// Incoherent Background [1/cm]
-	//  [DEFAULT]=background=0 [1/cm]
-	Parameter background;
-
-	/// M0_sld_sph
-	//  [DEFAULT]=M0_sld_sph=0.0e-6 [1/A^(2)]
-	Parameter M0_sld_sph;
-
-	/// M_theta_sph
-	//  [DEFAULT]=M_theta_sph=0.0 [deg]
-	Parameter M_theta_sph;
-
-	/// M_phi_sph
-	//  [DEFAULT]=M_phi_sph=0.0 [deg]
-	Parameter M_phi_sph;
-
-	/// M0_sld_solv
-	//  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
-	Parameter M0_sld_solv;
-
-	/// M_theta_solv
-	//  [DEFAULT]=M_theta_solv=0.0 [deg]
-	Parameter M_theta_solv;
-
-	/// M_phi_solv
-	//  [DEFAULT]=M_phi_solv=0.0 [deg]
-	Parameter M_phi_solv;
-	
-	/// Up_frac_i
-	//  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
-	Parameter Up_frac_i;
-
-	/// Up_frac_f
-	//  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
-	Parameter Up_frac_f;
-
-	/// Up_theta
-	//  [DEFAULT]=Up_theta=0.0 [deg]
-	Parameter Up_theta;
-
-
-	// Constructor
-	SphereModel();
-
-	// Operators to get I(Q)
-	double operator()(double q);
-	double operator()(double qx, double qy);
-	double calculate_ER();
-	double calculate_VR();
-	double evaluate_rphi(double q, double phi);
-};
-
-
-#endif
Index: c/sas/models/include/spheresld.h
===================================================================
--- src/sas/models/include/spheresld.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,182 +1,0 @@
-#if !defined(o_h)
-#define sphere_sld_h
-#include "parameters.hh"
-
-/**
- * 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>
-
-class SphereSLDModel{
-public:
-  // Model parameters
-  /// number of shells
-  //  [DEFAULT]=n_shells=1
-  Parameter n_shells;
-    /// Scale factor
-    //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-    /// thick_inter0 [A]
-    //  [DEFAULT]=thick_inter0=50.0 [A]
-  Parameter thick_inter0;
-  /// func_inter0
-  //  [DEFAULT]=func_inter0= 0
-  Parameter func_inter0;
-  /// sld_core0 [1/A^(2)]
-  //  [DEFAULT]=sld_core0= 2.07e-6 [1/A^(2)]
-  Parameter sld_core0;
-  /// sld_solv [1/A^(2)]
-  //  [DEFAULT]=sld_solv= 1.0e-6 [1/A^(2)]
-  Parameter sld_solv;
-  /// Background
-  //  [DEFAULT]=background=0
-  Parameter background;
-
-    //  [DEFAULT]=sld_flat1=4.0e-06 [1/A^(2)]
-    Parameter sld_flat1;
-    //  [DEFAULT]=sld_flat2=3.5e-06 [1/A^(2)]
-    Parameter sld_flat2;
-    //  [DEFAULT]=sld_flat3=4.0e-06 [1/A^(2)]
-    Parameter sld_flat3;
-    //  [DEFAULT]=sld_flat4=3.5e-06 [1/A^(2)]
-    Parameter sld_flat4;
-    //  [DEFAULT]=sld_flat5=4.0e-06 [1/A^(2)]
-    Parameter sld_flat5;
-    //  [DEFAULT]=sld_flat6=3.5e-06 [1/A^(2)]
-    Parameter sld_flat6;
-    //  [DEFAULT]=sld_flat7=4.0e-06 [1/A^(2)]
-    Parameter sld_flat7;
-    //  [DEFAULT]=sld_flat8=3.5e-06 [1/A^(2)]
-    Parameter sld_flat8;
-    //  [DEFAULT]=sld_flat9=4.0e-06 [1/A^(2)]
-    Parameter sld_flat9;
-    //  [DEFAULT]=sld_flat10=3.5e-06 [1/A^(2)]
-    Parameter sld_flat10;
-
-    //  [DEFAULT]=thick_inter1=50.0 [A]
-    Parameter thick_inter1;
-    //  [DEFAULT]=thick_inter2=50.0 [A]
-    Parameter thick_inter2;
-    //  [DEFAULT]=thick_inter3=50.0 [A]
-    Parameter thick_inter3;
-    //  [DEFAULT]=thick_inter4=50.0 [A]
-    Parameter thick_inter4;
-    //  [DEFAULT]=thick_inter5=50.0 [A]
-    Parameter thick_inter5;
-    //  [DEFAULT]=thick_inter6=50.0 [A]
-    Parameter thick_inter6;
-    //  [DEFAULT]=thick_inter7=50.0 [A]
-    Parameter thick_inter7;
-    //  [DEFAULT]=thick_inter8=50.0 [A]
-    Parameter thick_inter8;
-    //  [DEFAULT]=thick_inter9=50.0 [A]
-    Parameter thick_inter9;
-    //  [DEFAULT]=thick_inter10=50.0 [A]
-    Parameter thick_inter10;
-
-    //  [DEFAULT]=thick_flat1=100 [A]
-    Parameter thick_flat1;
-    //  [DEFAULT]=thick_flat2=100 [A]
-    Parameter thick_flat2;
-    //  [DEFAULT]=thick_flat3=100 [A]
-    Parameter thick_flat3;
-    //  [DEFAULT]=thick_flat4=100 [A]
-    Parameter thick_flat4;
-    //  [DEFAULT]=thick_flat5=100 [A]
-    Parameter thick_flat5;
-    //  [DEFAULT]=thick_flat6=100 [A]
-    Parameter thick_flat6;
-    //  [DEFAULT]=thick_flat7=100 [A]
-    Parameter thick_flat7;
-    //  [DEFAULT]=thick_flat8=100 [A]
-    Parameter thick_flat8;
-    //  [DEFAULT]=thick_flat9=100 [A]
-    Parameter thick_flat9;
-    //  [DEFAULT]=thick_flat10=100 [A]
-    Parameter thick_flat10;
-
-    //  [DEFAULT]=func_inter1=0
-    Parameter func_inter1;
-    //  [DEFAULT]=func_inter2=0
-    Parameter func_inter2;
-    //  [DEFAULT]=func_inter3=0
-    Parameter func_inter3;
-    //  [DEFAULT]=func_inter4=0
-    Parameter func_inter4;
-    //  [DEFAULT]=func_inter5=0
-    Parameter func_inter5;
-    //  [DEFAULT]=func_inter6=0
-    Parameter func_inter6;
-    //  [DEFAULT]=func_inter7=0
-    Parameter func_inter7;
-    //  [DEFAULT]=func_inter8=0
-    Parameter func_inter8;
-    //  [DEFAULT]=func_inter9=0
-    Parameter func_inter9;
-    //  [DEFAULT]=func_inter10=0
-    Parameter func_inter10;
-
-    //  [DEFAULT]=nu_inter1=2.5
-    Parameter nu_inter1;
-    //  [DEFAULT]=nu_inter2=2.5
-    Parameter nu_inter2;
-    //  [DEFAULT]=nu_inter3=2.5
-    Parameter nu_inter3;
-    //  [DEFAULT]=nu_inter4=2.5
-    Parameter nu_inter4;
-    //  [DEFAULT]=nu_inter5=2.5
-    Parameter nu_inter5;
-    //  [DEFAULT]=nu_inter6=2.5
-    Parameter nu_inter6;
-    //  [DEFAULT]=nu_inter7=2.5
-    Parameter nu_inter7;
-    //  [DEFAULT]=nu_inter8=2.5
-    Parameter nu_inter8;
-    //  [DEFAULT]=nu_inter9=2.5
-    Parameter nu_inter9;
-    //  [DEFAULT]=nu_inter10=2.5
-    Parameter nu_inter10;
-
-    //  [DEFAULT]=npts_inter=35.0
-    Parameter npts_inter;
-    //  [DEFAULT]=nu_inter0=2.5
-    Parameter nu_inter0;
-    //  [DEFAULT]=rad_core0=50.0 [A]
-    Parameter rad_core0;
-
-  // Constructor
-  SphereSLDModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-
-#endif
Index: c/sas/models/include/spheroid.h
===================================================================
--- src/sas/models/include/spheroid.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#if !defined(spheroid_h)
-#define spheroid_h
-#include "parameters.hh"
-
-/** 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>
-
- **/
-
-class CoreShellEllipsoidModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// Equatorial radius of core [A]
-  //  [DEFAULT]=equat_core=200.0 [A]
-  Parameter equat_core;
-  /// Polar radius of core [A]
-  //  [DEFAULT]=polar_core=20.0 [A]
-  Parameter polar_core;
-  /// equatorial radius of shell [A]
-  //  [DEFAULT]=equat_shell=250.0 [A]
-  Parameter equat_shell;
-  /// polar radius of shell [A]
-  //  [DEFAULT]=polar_shell=30.0 [A]
-  Parameter polar_shell;
-  ///  Core scattering length density [1/A^(2)]
-  //  [DEFAULT]=sld_core=2.0e-6 [1/A^(2)]
-  Parameter sld_core;
-  ///  Shell scattering length density [1/A^(2)]
-  //  [DEFAULT]=sld_shell=1.0e-6 [1/A^(2)]
-  Parameter sld_shell;
-  /// Solvent scattering length density  [1/A^(2)]
-  //  [DEFAULT]=sld_solvent=6.3e-6 [1/A^(2)]
-  Parameter sld_solvent;
-  /// Incoherent Background [1/cm] 0.001
-  //  [DEFAULT]=background=0.001 [1/cm]
-  Parameter background;
-  //Disable for now
-  /// Orientation of the oblate axis w/respect incoming beam [deg]
-  //  [DEFAULT]=axis_theta=0.0 [deg]
-  Parameter axis_theta;
-  /// Orientation of the oblate in the plane of the detector [deg]
-  //  [DEFAULT]=axis_phi=0.0 [deg]
-  Parameter axis_phi;
-
-  // Constructor
-  CoreShellEllipsoidModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/spheroidXT.h
===================================================================
--- src/sas/models/include/spheroidXT.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-#if !defined(spheroidXT_h)
-#define spheroidXT_h
-#include "parameters.hh"
-// RKH 03Apr2014 a re-parametrised model
-
-/** Structure definition for oblate parameters
- * [PYTHONCLASS] = CoreShellEllipsoidXTModel
- * [DISP_PARAMS] = equat_core, X_core, T_shell, XpolarShell,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_core*X_core,
-			equat_shell = equatorial radius of outer surface = equat_core + T_shell,
-			polar_shell = polar radius (revolution axis) of outer surface =  equat_core*X_core + XpolarShell*T_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 - this new model will make this easier
-			and polydispersity integrals more logical (as previously the shell could disappear).
-			</text>
-
-   [FIXED] = <text>equat_core.width;X_core.width; T_shell.width; Xpolarshell.width; axis_phi.width; axis_theta.width</text>
-   [ORIENTATION_PARAMS]= <text>axis_phi; axis_theta; axis_phi.width; axis_theta.width</text>
-
- **/
-
-class CoreShellEllipsoidXTModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=0.05
-  Parameter scale;
-  /// Equatorial radius of core [A]
-  //  [DEFAULT]=equat_core=20.0 [A]
-  Parameter equat_core;
-  /// X (polar core)/ (equat_shell)
-  //  [DEFAULT]=X_core=3.0
-  Parameter X_core;
-  /// thickness of equatorial shell [A]
-  //  [DEFAULT]=T_shell=30.0 [A]
-  Parameter T_shell;
-  /// ratio (TpolarShell/Tequat_Shell
-  //  [DEFAULT]=XpolarShell=1.0
-  Parameter XpolarShell;
-  ///  Core scattering length density [1/A^(2)]
-  //  [DEFAULT]=sld_core=2.0e-6 [1/A^(2)]
-  Parameter sld_core;
-  ///  Shell scattering length density [1/A^(2)]
-  //  [DEFAULT]=sld_shell=1.0e-6 [1/A^(2)]
-  Parameter sld_shell;
-  /// Solvent scattering length density  [1/A^(2)]
-  //  [DEFAULT]=sld_solvent=6.3e-6 [1/A^(2)]
-  Parameter sld_solvent;
-  /// Incoherent Background [1/cm] 0.001
-  //  [DEFAULT]=background=0.001 [1/cm]
-  Parameter background;
-  //Disable for now
-  /// Orientation of the oblate axis w/respect incoming beam [deg]
-  //  [DEFAULT]=axis_theta=0.0 [deg]
-  Parameter axis_theta;
-  /// Orientation of the oblate in the plane of the detector [deg]
-  //  [DEFAULT]=axis_phi=0.0 [deg]
-  Parameter axis_phi;
-
-  // Constructor
-  CoreShellEllipsoidXTModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/stacked_disks.h
===================================================================
--- src/sas/models/include/stacked_disks.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
-	TODO: Add 2D model
- */
-
-#if !defined(stacked_disks_h)
-#define stacked_disks_h
-#include "parameters.hh"
-
-/** 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>
-
-
- **/
-
-class StackedDisksModel{
-public:
-  // Model parameters
-
-  /// Scale factor
-  //  [DEFAULT]=scale=0.01
-  Parameter scale;
-  /// Thickness of the core disk [A]
-  //  [DEFAULT]=core_thick=10.0 [A]
-  Parameter core_thick;
-  /// radius of the staked disk [A]
-  //  [DEFAULT]=radius=3000 [A]
-  Parameter radius;
-  /// Thickness of the staked disk [A]
-  //  [DEFAULT]=layer_thick=15.0 [A]
-  Parameter layer_thick;
-  /// Core scattering length density[1/A^(2)]
-  //  [DEFAULT]=core_sld=4e-6 [1/A^(2)]
-  Parameter core_sld;
-  /// layer scattering length density[1/A^(2)]
-  //  [DEFAULT]=layer_sld=-4e-7 [1/A^(2)]
-  Parameter layer_sld;
-  /// solvent scattering length density[1/A^(2)]
-  //  [DEFAULT]=solvent_sld=5.0e-6 [1/A^(2)]
-  Parameter solvent_sld;
-  /// number of stacking
-  //  [DEFAULT]=n_stacking=1
-  Parameter n_stacking;
-  /// GSD of disks sigma_d
-  //  [DEFAULT]=sigma_d=0
-  Parameter sigma_d;
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0.001 [1/cm]
-  Parameter background;
-  /// Orientation of the staked disk axis w/respect incoming beam [rad]
-  //  [DEFAULT]=axis_theta=0.0 [rad]
-  Parameter axis_theta;
-  /// Orientation of the  staked disk in the plane of the detector [rad]
-  //  [DEFAULT]=axis_phi=0.0 [rad]
-  Parameter axis_phi;
-
-  // Constructor
-  StackedDisksModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/starpolymer.h
===================================================================
--- src/sas/models/include/starpolymer.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-#ifndef STAR_POLYMER_H
-#define STAR_POLYMER_H
-
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-/**
-   Scattering model class for 'Star polymer with Gaussian statistics'
-   with
-   P(q) = 2/{fv^2} * (v - (1-exp(-v)) + {f-1}/2 * (1-exp(-v))^2)
-   where
-   - v = u^2f/(3f-2)
-   - u = <R_g^2>q^2, where <R_g^2> is the ensemble average radius of 
-   gyration squared of an arm
-   - f is the number of arms on the star
-
-**/
-
-// [PYTHONCLASS] = StarPolymer
-// [DISP_PARAMS] = arms, R2, scale, background
-// [DESCRIPTION] = <text>  Scattering model class for 'Star polymer with Gaussian statistics'
-// with
-// P(q) = 2/{fv^2} * (v - (1-exp(-v)) + {f-1}/2 * (1-exp(-v))^2)
-// where
-// - v = u^2f/(3f-2)
-// - u = <R_g^2>q^2, where <R_g^2> is the ensemble average radius of 
-// giration squared of an arm
-// - f is the number of arms on the star
-// </text>
-// [FIXED] = 
-// [ORIENTATION_PARAMS] = 
-
-#include "parameters.hh"
-
-class StarPolymer {
-
-public:
-
-  // Model parameters
-
-  /// Number of arms in the model
-  // [DEFAULT]=arms=3
-  Parameter arms;
-
-  /// Ensemble radius of gyration squared of an arm [A]
-  // [DEFAULT]=R2=100.0 [A]
-  Parameter R2;
-
-  /// Scale factor
-  // [DEFAULT]=scale=1.0
-  Parameter scale;
-
-  /// Background [1/cm]
-  // [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-  StarPolymer();
-
-  // Operators to get I(q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-
-};
-
-
-
-#endif
Index: c/sas/models/include/surfacefractal.h
===================================================================
--- src/sas/models/include/surfacefractal.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-#if !defined(surfacefractal_h)
-#define surfacefractal_h
-#include "parameters.hh"
-
-/**
- * Structure definition for parameters
- */
-//[PYTHONCLASS] = SurfaceFractalModel
-//[DESCRIPTION] =<text> The scattering intensity  I(x) = scale*P(x)*S(x) + background, where
-//		 scale = scale_factor  * V * delta^(2)
-//       p(x)=  F(x*radius)^(2)
-//       F(x) = 3*[sin(x)-x cos(x)]/x**3
-//       S(x) = [(gamma(5-Ds)*colength^(5-Ds)*[1+(x^2*colength^2)]^((Ds-5)/2)
-//						* sin[(Ds-5)*arctan(x*colength)])/x]
-//       where delta = sldParticle -sldSolv.
-//       radius       =  Particle radius
-//       surface_dim  =  Surface fractal dimension (Ds)
-//       co_length  =  Cut-off length
-//       background   =  background
-//		Ref.:Mildner, Hall,J Phys D Appl Phys(1986), 19, 1535-1545
-//		Note I: This model is valid for 1<surface_dim<3 with limited q range.
-//		Note II: This model is not in absolute scale.
-//		</text>
-//[ORIENTATION_PARAMS]= <text> </text>
-
-class SurfaceFractalModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Radius [A]
-  //  [DEFAULT]=radius=10.0 [A]
-  Parameter radius;
-
-  /// Surface fractal dimension
-  //  [DEFAULT]=surface_dim=2.0
-  Parameter surface_dim;
-
-  /// Cut-off Length [A]
-  //  [DEFAULT]=co_length=500.0 [A]
-  Parameter co_length;
-
-  /// Incoherent Background
-  //  [DEFAULT]=background=0.0
-  Parameter background;
-
-  // Constructor
-  SurfaceFractalModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/include/teubner_strey.h
===================================================================
--- src/sas/models/include/teubner_strey.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#ifndef TEUBNER_STREY_H
-#define TEUBNER_STREY_H
-
-#include "parameters.hh"
-
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-/**
-   Scattering model class for the Teubner-Strey model given by 
-    Provide F(x) = 1/( scale + c1*(x)^(2)+  c2*(x)^(4)) + bkd
-**/
-
-
-// definition for model parameters
-
-// [PYTHONCLASS] = TeubnerStreyModel
-// [DISP_PARAMS] = scale, c1, c2, background
-// [DESCRIPTION] = <text>F(x) = 1/( scale + c1*(x)^(2)+  c2*(x)^(4)) + bkd </text>
-//       </text>
-// [FIXED] = 
-// [ORIENTATION_PARAMS] =
-
-class TeubnerStreyModel {
-
-public:
-  // Model parameters
-
-  /// Scale factor
-  // [DEFAULT]=scale=0.1
-  Parameter scale;
-
-  /// c1
-  // [DEFAULT]=c1=-30.0
-  Parameter c1;
-
-  /// c2
-  // [DEFAULT]=c2=5000.0
-  Parameter c2;
-
-  /// Background
-  // [DEFAULT]=background=0.0
-  Parameter background;
-
-  TeubnerStreyModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-
-#endif
-
-
-
Index: c/sas/models/include/triaxial_ellipsoid.h
===================================================================
--- src/sas/models/include/triaxial_ellipsoid.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-#if !defined(triaxial_ellipsoid_h)
-#define triaxial_ellipsoid_h
-#include "parameters.hh"
-
-/** 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>
- **/
-
-class TriaxialEllipsoidModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale=1.0
-  Parameter scale;
-  /// semi -axis A of the triaxial_ellipsoid [A]
-  //  [DEFAULT]=semi_axisA= 35.0 [A]
-  Parameter semi_axisA;
-  /// semi -axis B of the triaxial_ellipsoid [A]
-  //  [DEFAULT]=semi_axisB=100.0 [A]
-  Parameter semi_axisB;
-  /// semi -axis C of the triaxial_ellipsoid [A]
-  //  [DEFAULT]=semi_axisC=400.0 [A]
-  Parameter semi_axisC;
-  /// sldEll [1/A^(2)]
-  //  [DEFAULT]=sldEll=1.0e-6 [1/A^(2)]
-  Parameter sldEll;
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv=6.3e-6 [1/A^(2)]
-  Parameter sldSolv;
-  /// Incoherent Background [1/cm] 0.00
-  //  [DEFAULT]=background=0.0 [1/cm]
-  Parameter background;
-  /// Orientation of the triaxial_ellipsoid axis w/respect incoming beam [deg]
-  //  [DEFAULT]=axis_theta=57.325 [deg]
-  Parameter axis_theta;
-  /// Orientation of the triaxial_ellipsoid in the plane of the detector [deg]
-  //  [DEFAULT]=axis_phi=57.325 [deg]
-  Parameter axis_phi;
-  /// Orientation of the cross section of the triaxial_ellipsoid in the plane of the detector [deg]
-  //  [DEFAULT]=axis_psi=0.0 [deg]
-  Parameter axis_psi;
-
-  // Constructor
-  TriaxialEllipsoidModel();
-
-  // Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx, double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-#endif
Index: c/sas/models/include/vesicle.h
===================================================================
--- src/sas/models/include/vesicle.h	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#if !defined(vesicle_h)
-#define vesicle_h
-#include "parameters.hh"
-
-/**
- * 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>
- */
-
-class VesicleModel{
-public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
-
-  /// Core radius of the vesicle [A]
-  //  [DEFAULT]=radius= 100.0 [A]
-  Parameter radius;
-
-  /// shell thickness [A]
-  //  [DEFAULT]=thickness= 30.0 [A]
-  Parameter thickness;
-
-  /// core_solv scattering length density [1/A^(2)]
-  //  [DEFAULT]=solv_sld= 6.36e-6 [1/A^(2)]
-  Parameter solv_sld;
-
-  /// shell scattering length density [1/A^(2)]
-  //  [DEFAULT]=shell_sld= 5.0e-7 [1/A^(2)]
-  Parameter shell_sld;
-
-  /// Incoherent Background [1/cm]
-  //  [DEFAULT]=background=0 [1/cm]
-  Parameter background;
-
-  //Constructor
-  VesicleModel();
-
-  //Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx , double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-#endif
Index: c/sas/models/pluginmodel.py
===================================================================
--- src/sas/models/pluginmodel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-
-from sas.models.BaseComponent import BaseComponent
-import math
-
-class Model1DPlugin(BaseComponent):
-    ## Name of the model
-   
-    def __init__(self , name="Plugin Model" ):
-        """ Initialization """
-        BaseComponent.__init__(self)
-        self.name = name
-        self.details = {}
-        self.params  = {}
-        self.description = 'plugin model'
-        
-    def function(self, x):
-        """
-        Function to be implemented by the plug-in writer
-        """
-        return x
-        
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input x, or [x, phi] [radian]
-        
-        :return: function value
-        
-        """
-        if x.__class__.__name__ == 'list':
-            x_val = x[0]*math.cos(x[1])
-            y_val = x[0]*math.sin(x[1])
-            return self.function(x_val)*self.function(y_val)
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self.function(x)
-        
-   
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input x, or [x, y] 
-        
-        :return: function value
-        
-        """
-        if x.__class__.__name__ == 'list':
-            return self.function(x[0])*self.function(x[1])
-        elif x.__class__.__name__ == 'tuple':
-            raise ValueError, "Tuples are not allowed as input to BaseComponent models"
-        else:
-            return self.function(x)
-        
-    def set_details(self):
-        """
-        Set default details
-        """
-        if not self.params:
-            return {}
-            
-        for key in self.params.keys():
-            self.details[key] = ['', None, None]
Index: c/sas/sasgui/perspectives/fitting/plugin_models/polynomial5.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/plugin_models/polynomial5.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ 	(revision )
@@ -1,117 +1,0 @@
-"""
-Test plug-in model
-These are links of available functions:
-
-http://docs.python.org/library/math.html
-http://www.scipy.org/Numpy_Functions_by_Category
-"""
-
-"""
-## *****************************************************************************
-Please select the 'Compile' from the menubar after the modification and saving.
-Note that we recommend to save the file as a different file name.
-Otherwise, it could be removed in the future on re-installation of the SasView.
-## *****************************************************************************
-"""
-from sas.models.pluginmodel import Model1DPlugin  ##DO NOT CHANGE THIS LINE!!!
-
-## FOR MORE INFORMATION CHECK http://docs.python.org/library/math.html      
-## AND http://www.scipy.org/Numpy_Functions_by_Category
-import math                    ##DO NOT CHANGE THIS LINE!!!
-import numpy                   ##DO NOT CHANGE THIS LINE!!!
-import os
-import sys
-## <-----  SIGN DEFINES WHERE YOU CAN MODIFY THE CODE
-
-class Model(Model1DPlugin): ##DO NOT CHANGE THIS LINE!!!
-    """
-    ##YOU CAN BE MODIFY ANYTHING BETWEEN """ """
-    ##DESCRIPTION OF MODEL PLUG-IN GOES HERE
-    
-    ##EXAMPLE: Class that evaluates a polynomial model. 
-    """
-    name = ""  
-                                
-    def __init__(self):      ##DO NOT CHANGE THIS LINE!!!
-        """
-        Initialization
-        """
-        Model1DPlugin.__init__(self, name=self.name) ##DO NOT CHANGE THIS LINE!!!
-        
-        ## HERE WE DEFINE THE PARAM NAME AND ITS INITIAL VALUE 
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER                                                      
-        self.params['A'] = 0.1       ## <-----                
-        self.params['B'] = 10.0      ## <-----                 
-        self.params['C'] = 0.0       ## <-----                
-        self.params['D'] = 0.0       ## <-----                    
-        self.params['E'] = 0.0       ## <-----                  
-        self.params['F'] = 0.0       ## <-----   
-        # Set the name same as the file name
-        self.name = self.get_fname()     ##DO NOT CHANGE THIS LINE!!!
-        ## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN """   """  ONLY!!!!
-        self.description = """
-            a + b * x + c * math.pow(x,2) + d * math.pow(x,3) \n
-             + e * math.pow(x,4) + f * math.pow(x,5)  
-        """                        ## <-----   
-        ## DEFINE DEFAULT DETAILS
-        self.set_details()      ##DO NOT DELETE OR CHANGE THIS LINE!!!
-        
-        ## IN THIS EXAMPLE THE FUNTION IS:
-        ## F(x)=A+B*x+C*x^2+D*x^3+E*x^4+F*x^5             
-   
-    def function(self, x = 0.0): ##DO NOT CHANGE THIS LINE!!!
-        """ 
-        Evaluate the model
-        :param x: input x
-        :return: function value
-        """
-        ## DEFINE YOUR FUNCTION HERE.
-        ## YOU CAN ERASE EVERYTHING BELLOW FOR YOUR OWN FUNCTION
-        #Redefine parameters as local parameters, or skip and use long name
-        a = self.params['A']       ## <-----   
-        b = self.params['B']       ## <-----   
-        c = self.params['C']       ## <-----   
-        d = self.params['D']       ## <-----   
-        e = self.params['E']       ## <-----   
-        f = self.params['F']       ## <-----   
- 
-        ##THIS OUR FUNCTION TEMPLATE
-        poly = a + b * x + c * math.pow(x,2) + d * math.pow(x,3) \
-                + e * math.pow(x,4) + f * math.pow(x,5)              ## <-----                
-        
-        #(Just note: In Python, indentation defines the belongings 
-        # of 'if', 'for', and so on..)
-        #(lim x --> 0) 
-        if x == 0:                          ## <-----   
-            result = a                      ## <-----   
-        else:                               ## <-----   
-            result = poly                   ## <-----    
-
-        return result       ## MODIFY ONLY RESULT. DON'T DELETE RETURN!!!!
-    
-    ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       
-    def get_fname(self):
-        """
-        Get the model name same as the file name
-        """
-        path = sys._getframe().f_code.co_filename
-        basename  = os.path.basename(path)
-        name, _ = os.path.splitext(basename)
-        return name
-            
-###############################################################################
-## THIS IS FOR TEST. DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       
-if __name__ == "__main__": 
-    m= Model() 
-    out1 = m.runXY(0.0)
-    out2 = m.runXY(0.01)
-    isfine1 = numpy.isfinite(out1)
-    isfine2 = numpy.isfinite(out2)
-    print "Testing the value at Q = 0.0:"
-    print out1, " : finite? ", isfine1
-    print "Testing the value at Q = 0.01:"
-    print out2, " : finite? ", isfine2
-    if isfine1 and isfine2:
-        print "===> Simple Test: Passed!"
-    else:
-        print "===> Simple Test: Failed!"
Index: c/sas/sasgui/perspectives/fitting/plugin_models/sph_bessel_jn.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/plugin_models/sph_bessel_jn.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ 	(revision )
@@ -1,140 +1,0 @@
-"""
-Test plug-in model
-These are links of available functions:
-
-http://docs.python.org/library/math.html
-http://www.scipy.org/Numpy_Functions_by_Category
-"""
-
-"""
-## *****************************************************************************
-Please select the 'Compile' from the menubar after the modification and saving.
-Note that we recommend to save the file as a different file name.
-Otherwise, it could be removed in the future on re-installation of the SasView.
-## *****************************************************************************
-"""
-
-from sas.models.pluginmodel import Model1DPlugin  ##DO NOT CHANGE THIS LINE!!!
-import math                  ##DO NOT CHANGE THIS LINE!!!
-import numpy                 ##DO NOT CHANGE THIS LINE!!!
-import scipy.special            ##CHANGE THIS LINE WITH CAUTION!!!
-import os
-import sys
-##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ##
-## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE
-## CONFORTABLE ENOUGH WITH OUR MODEL PLUGIN OPTION
-
-
-## <-----  SIGN DEFINES WHERE YOU CAN MODIFY THE CODE
-
-class Model(Model1DPlugin): ##DO NOT CHANGE THIS LINE!!!
-    """
-    ##YOU CAN BE MODIFY ANYTHING BETWEEN """ """
-    ##DESCRIPTION OF MODEL PLUG-IN GOES HERE
-    
-    ##EXAMPLE: Class that evaluates a polynomial model. 
-    """
-    name = "" 
-                                
-    def __init__(self):      ##DO NOT CHANGE THIS LINE!!!
-        """
-        Initialization
-        """
-        Model1DPlugin.__init__(self, name=self.name) ##DO NOT CHANGE THIS LINE!!!
-        
-        ## EDIT PARAMETERS' NAMES AND VALUE
-        ## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS
-        self.params = {}                ##DO NOT CHANGE THIS LINE!!!
-        # Set the name same as the file name
-        self.name = self.get_fname()     ##DO NOT CHANGE THIS LINE!!!
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE
-        self.params['C'] = 1.0   ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                                                      
-        self.params['A'] = 1.0       ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                 
-        self.params['B'] = 0.0      ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                 
-        self.params['D'] = 0.0      ## <-----   
-        ## YOU CAN ALSO DELETE THIS LINE                 
-        self.params['n'] = 1      ## <----- 
- 
-        ## DEFINE DEFAULT DETAILS
-        self.set_details()      ##DO NOT DELETE OR CHANGE THIS LINE!!!
-        
-        ## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN """   """  ONLY!!!!
-        self.description = """
-            Spherical Bessel Function: C*sph_jn(n, Ax+B)+D
-                 """                        ## <-----   
-   
-    def function(self, x = 0.0): ##DO NOT CHANGE THIS LINE!!!
-        """ 
-        Evaluate the model
-        
-        :param x: input x
-        
-        :return: function value
-        
-        """
-        ## ADD YOUR FUNCTION HERE.
-        ## REUSE THE PARAMETERS DEFINED PREVIOUSLY TO WRITE YOUR FUNCTION.
-        
-        ## IN THIS EXAMPLE THE FUNTION IS:
-        ## C*sph_jn(Ax+B)+D
-         
-        ## NOTE: pow IS A FUNCTION IMPORTED FROM PYTHON MATH LIBRARY
-        ## FOR MORE INFORMATION CHECK http://docs.python.org/library/math.html      
-        ## OTHER FUNCTIONS ARE ALSO 
-        ###  AVAILABLE http://www.scipy.org/Numpy_Functions_by_Category
-        ## numpy FUNCTIONS ARE FOR EXPERT USER
-        
-        ## YOU CAN ERASE EVERYTHING BELLOW FOR YOUR OWN FUNCTION
-        #Redefine parameters as local parameters
-        a = self.params['A']       ## <-----   
-        b = self.params['B']       ## <-----   
-        c = self.params['C']       ## <-----   
-        d = self.params['D']       ## <-----   
-        # Take integer value only
-        n = int(self.params['n'])      ## <-----   
-
-        ##THIS OUR FUNCTION TEMPLATE
-        #Remove a singular point (lim poly --> 0) for sin(poly)/poly
-        #(Just note: In Python, indentation defines the belongings of 'if', 'for', and so on..)
-        input = a * x + b
-        # sph_out and _ are in array types from scipy upto n'th order
-        # where _ is not used for this function.
-        sph_out, _ = scipy.special.sph_jn(n, input)
-        # Take only n'th value
-        result = c * sph_out[n] + d      ## <-----                
-
-        return result ## MODIFY ONLY RESULT. DON'T DELETE RETURN!!!!
-    
-    ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!      
-    def get_fname(self):
-        """
-        Get the model name same as the file name
-        """
-        path = sys._getframe().f_code.co_filename
-        basename  = os.path.basename(path)
-        name, _ = os.path.splitext(basename)
-        return name
-            
-###############################################################################   
-## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       
-if __name__ == "__main__": 
-    m= Model() 
-    out1 = m.runXY(0.0)
-    out2 = m.runXY(0.01)
-    isfine1 = numpy.isfinite(out1)
-    isfine2 = numpy.isfinite(out2)
-    print "Testing the value at Q = 0.0:"
-    print out1, " : finite? ", isfine1
-    print "Testing the value at Q = 0.01:"
-    print out2, " : finite? ", isfine2
-    if isfine1 and isfine2:
-        print "===> Simple Test: Passed!"
-    else:
-        print "===> Simple Test: Failed!"
Index: c/sas/sasgui/perspectives/fitting/plugin_models/sum_Ap1_1_Ap2.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/plugin_models/sum_Ap1_1_Ap2.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ 	(revision )
@@ -1,422 +1,0 @@
-# A sample of an experimental model function for Sum(APmodel1,(1-A)Pmodel2)
-import copy
-from sas.models.pluginmodel import Model1DPlugin
-import os
-import sys
-"""
-## *****************************************************************************
-Please select the 'Compile' from the menubar after the modification and saving.
-Note that we recommend to save the file as a different file name.
-Otherwise, it could be removed in the future on re-installation of the SasView.
-## *****************************************************************************
-"""
-
-# Available model names for this sum model
-"""
-BCCrystalModel, BEPolyelectrolyte, BarBellModel, BinaryHSModel, BroadPeakModel,
-CSParallelepipedModel, CappedCylinderModel, CoreShellCylinderModel,
-CoreShellEllipsoidModel, CoreShellModel, CorrLengthModel, CylinderModel, 
-DABModel, DebyeModel, EllipsoidModel, EllipticalCylinderModel, FCCrystalModel,
-FlexCylEllipXModel, FlexibleCylinderModel, FractalCoreShellModel, FractalModel,
-FuzzySphereModel, GaussLorentzGelModel, GuinierModel, GuinierPorodModel,
-HardsphereStructure, HayterMSAStructure, HollowCylinderModel, LamellarFFHGModel,
-LamellarModel, LamellarPCrystalModel, LamellarPSHGModel, LamellarPSModel,
-LineModel, LorentzModel, MultiShellModel, ParallelepipedModel, PeakGaussModel,
-PeakLorentzModel, PearlNecklaceModel, Poly_GaussCoil, PolymerExclVolume,
-PorodModel, PowerLawAbsModel, SCCrystalModel, SphereModel, SquareWellStructure,
-StackedDisksModel, StickyHSStructure, TeubnerStreyModel, TriaxialEllipsoidModel,
-TwoLorentzianModel, TwoPowerLawModel, VesicleModel
-"""
-## This model is DIFFERENT from the Easy Custom Sum(p1 + p2) 
-## by definition of the scale factor *****************************************
-#
-#     Custom model = scale_factor * P1 + (1 - scale_factor) * P2
-#
-## User can REPLACE model names below arrowed two lines (twice per line)
-from sas.models.CylinderModel import CylinderModel as P1          #<========
-from sas.models.PolymerExclVolume import PolymerExclVolume as P2  #<========
-
-#####DO NOT CHANGE ANYTHING BELOW THIS LINE 
-#####---------------------------------------------------------------------------
-class Model(Model1DPlugin):
-    """
-    Use for A*p1(Q)+(1-A)*p2(Q); 
-    Note: P(Q) refers to 'form factor' model.
-    """
-    name = ""  
-    def __init__(self):
-        Model1DPlugin.__init__(self, name=self.name)
-        """
-        :param p_model1: a form factor, P(Q)
-        :param p_model2: another form factor, P(Q)
-        """
-        p_model1 = P1()
-        p_model2 = P2()
-        ## Setting  model name model description
-        self.description = ""
-        self.fill_description(p_model1, p_model2)
-        # Set the name same as the file name
-        self.name = self.get_fname()     ##DO NOT CHANGE THIS LINE!!!
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        ## Magnetic Panrameters
-        self.magnetic_params = []
-        
-        # non-fittable parameters
-        self.non_fittable = p_model1.non_fittable  
-        self.non_fittable += p_model2.non_fittable  
-            
-        ##models 
-        self.p_model1= p_model1
-        self.p_model2= p_model2
-        
-       
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        ## New parameter:Scaling factor
-        self.params['scale_factor'] = 0.5
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        self.details['scale_factor'] = ['',     None, None]
-
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        ## parameters with orientation
-        for item in self.p_model1.orientation_params:
-            new_item = "p1_" + item
-            if not new_item in self.orientation_params:
-                self.orientation_params.append(new_item)
-            
-        for item in self.p_model2.orientation_params:
-            new_item = "p2_" + item
-            if not new_item in self.orientation_params:
-                self.orientation_params.append(new_item)
-        ## magnetic params
-        for item in self.p_model1.magnetic_params:
-            new_item = "p1_" + item
-            if not new_item in self.magnetic_params:
-                self.magnetic_params.append(new_item)
-            
-        for item in self.p_model2.magnetic_params:
-            new_item = "p2_" + item
-            if not new_item in self.magnetic_params:
-                self.magnetic_params.append(new_item)
-        # set multiplicity 1: muti_func Not supported.
-        multiplicity1 = 1
-        multiplicity2 = 1
-        ## functional multiplicity of the model
-        self.multiplicity1 = multiplicity1  
-        self.multiplicity2 = multiplicity2    
-        self.multiplicity_info = []   
-        
-    def _clone(self, obj):
-        """
-            Internal utility function to copy the internal
-            data members to a fresh copy.
-        """
-        obj.params     = copy.deepcopy(self.params)
-        obj.description     = copy.deepcopy(self.description)
-        obj.details    = copy.deepcopy(self.details)
-        obj.dispersion = copy.deepcopy(self.dispersion)
-        obj.p_model1  = self.p_model1.clone()
-        obj.p_model2  = self.p_model2.clone()
-        #obj = copy.deepcopy(self)
-        return obj
-    
-    def _get_name(self, name1, name2):
-        """
-        Get combined name from two model names
-        """
-        name = "A*"
-        p1_name = self._get_upper_name(name1)
-        if not p1_name:
-            p1_name = name1
-        name += p1_name
-        name += "+(1-A)*"
-        p2_name = self._get_upper_name(name2)
-        if not p2_name:
-            p2_name = name2
-        name += p2_name
-        return name
-    
-    def _get_upper_name(self, name=None):
-        """
-        Get uppercase string from model name
-        """
-        if name == None:
-            return ""
-        upper_name = ""
-        str_name = str(name)
-        for index in range(len(str_name)):
-            if str_name[index].isupper():
-                upper_name += str_name[index]
-        return upper_name
-        
-    def _set_dispersion(self):
-        """
-           combined the two models dispersions
-           Polydispersion should not be applied to s_model
-        """
-        ##set dispersion only from p_model 
-        for name , value in self.p_model1.dispersion.iteritems():
-            #if name.lower() not in self.p_model1.orientation_params:
-            new_name = "p1_" + name
-            self.dispersion[new_name]= value 
-        for name , value in self.p_model2.dispersion.iteritems():
-            #if name.lower() not in self.p_model2.orientation_params:
-            new_name = "p2_" + name
-            self.dispersion[new_name]= value 
-            
-    def function(self, x=0.0): 
-        """
-        """
-        return 0
-                               
-    def getProfile(self):
-        """
-        Get SLD profile of p_model if exists
-        
-        : return: (r, beta) where r is a list of radius of the transition points
-                beta is a list of the corresponding SLD values 
-        : Note: This works only for func_shell# = 2 (exp function)
-                and is not supporting for p2
-        """
-        try:
-            x,y = self.p_model1.getProfile()
-        except:
-            x = None
-            y = None
-            
-        return x, y
-    
-    def _set_params(self):
-        """
-            Concatenate the parameters of the two models to create
-            this model parameters 
-        """
-
-        for name , value in self.p_model1.params.iteritems():
-            # No 2D-supported
-            #if name not in self.p_model1.orientation_params:
-            new_name = "p1_" + name
-            self.params[new_name]= value
-            
-        for name , value in self.p_model2.params.iteritems():
-            # No 2D-supported
-            #if name not in self.p_model2.orientation_params:
-            new_name = "p2_" + name
-            self.params[new_name]= value
-                
-        # Set "scale" as initializing
-        self._set_scale_factor()
-      
-            
-    def _set_details(self):
-        """
-            Concatenate details of the two models to create
-            this model details 
-        """
-        for name ,detail in self.p_model1.details.iteritems():
-            new_name = "p1_" + name
-            #if new_name not in self.orientation_params:
-            self.details[new_name]= detail
-            
-        for name ,detail in self.p_model2.details.iteritems():
-            new_name = "p2_" + name
-            #if new_name not in self.orientation_params:
-            self.details[new_name]= detail
-    
-    def _set_scale_factor(self):
-        """
-        Not implemented
-        """
-        pass
-        
-                
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        :param name: name of the parameter
-        :param value: value of the parameter
-        """
-        # set param to p1+p2 model
-        self._setParamHelper(name, value)
-        
-        ## setParam to p model 
-        model_pre = name.split('_', 1)[0]
-        new_name = name.split('_', 1)[1]
-        if model_pre == "p1":
-            if new_name in self.p_model1.getParamList():
-                self.p_model1.setParam(new_name, value)
-        elif model_pre == "p2":
-             if new_name in self.p_model2.getParamList():
-                self.p_model2.setParam(new_name, value)
-        elif name.lower() == 'scale_factor':
-            self.params['scale_factor'] = value
-        else:
-            raise ValueError, "Model does not contain parameter %s" % name
-            
-    def getParam(self, name):
-        """ 
-        Set the value of a model parameter
-
-        :param name: name of the parameter
-        
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2:
-            for item in self.dispersion.keys():
-                # 2D not supported
-                if item.lower()==toks[0].lower():# and \
-                            #item.lower() not in self.orientation_params \
-                            #and toks[0].lower() not in self.orientation_params:
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            return self.dispersion[item][par]
-        else:
-            # Look for standard parameter
-            for item in self.params.keys():
-                if item.lower()==name.lower():#and \
-                            #item.lower() not in self.orientation_params \
-                            #and toks[0].lower() not in self.orientation_params:
-                    return self.params[item]
-        return  
-        #raise ValueError, "Model does not contain parameter %s" % name
-       
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setparam
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)== 2:
-            for item in self.dispersion.keys():
-                if item.lower()== toks[0].lower():# and \
-                            #item.lower() not in self.orientation_params:
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():#and \
-                                #item.lower() not in self.orientation_params:
-                            self.dispersion[item][par] = value
-                            return
-        else:
-            # Look for standard parameter
-            for item in self.params.keys():
-                if item.lower()== name.lower():#and \
-                            #item.lower() not in self.orientation_params:
-                    self.params[item] = value
-                    return
-            
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-             fill the self.fixed list with the p_model fixed list
-        """
-        for item in self.p_model1.fixed:
-            new_item = "p1" + item
-            self.fixed.append(new_item)
-        for item in self.p_model2.fixed:
-            new_item = "p2" + item
-            self.fixed.append(new_item)
-
-        self.fixed.sort()
-                
-                    
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q-value (float or [float, float] as [r, theta])
-        :return: (scattering function value)
-        """
-        self._set_scale_factor()
-        return (self.params['scale_factor'] * self.p_model1.run(x) + \
-                (1 - self.params['scale_factor']) * self.p_model2.run(x))
-    
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q-value (float or [float, float] as [qx, qy])
-        :return: scattering function value
-        """  
-        self._set_scale_factor()
-        return (self.params['scale_factor'] * self.p_model1.runXY(x) + \
-                (1 - self.params['scale_factor']) * self.p_model2.runXY(x))
-    
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x = []):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        :param x: input q[], or [qx[], qy[]]
-        :return: scattering function P(q[])
-        """
-        self._set_scale_factor()
-        return (self.params['scale_factor'] * self.p_model1.evalDistribution(x) + \
-                (1 - self.params['scale_factor']) * self.p_model2.evalDistribution(x))
-
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        :param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        value= None
-        new_pre = parameter.split("_", 1)[0]
-        new_parameter = parameter.split("_", 1)[1]
-        try:
-            if new_pre == 'p1' and \
-                            new_parameter in self.p_model1.dispersion.keys():
-                value= self.p_model1.set_dispersion(new_parameter, dispersion)
-            if new_pre == 'p2' and \
-                             new_parameter in self.p_model2.dispersion.keys():
-                value= self.p_model2.set_dispersion(new_parameter, dispersion)
-            self._set_dispersion()
-            return value
-        except:
-            raise 
-
-    def fill_description(self, p_model1, p_model2):
-        """
-        Fill the description for P(Q)+P(Q)
-        """
-        description = ""
-        description +="This model gives the summation of (A*%s) and ((1-A)*%s).\n"% \
-                                        ( p_model1.name, p_model2.name )
-        self.description += description
-    
-    ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       
-    def get_fname(self):
-        """
-        Get the model name same as the file name
-        """
-        path = sys._getframe().f_code.co_filename
-        basename  = os.path.basename(path)
-        name, _ = os.path.splitext(basename)
-        return name
-            
-### FOR TEST                
-if __name__ == "__main__": 
-    m1= Model() 
-    out1 = m1.runXY(0.01)
-    m2= Model()
-    out2 = 0.5 * m2.p_model1.runXY(0.01) + 0.5 * m2.p_model2.runXY(0.01)
-    print "Testing at Q = 0.01:"
-    print out1, " = ", out2
-    if out1 == out2:
-        print "===> Simple Test: Passed!"
-    else:
-        print "===> Simple Test: Failed!"
Index: c/sas/sasgui/perspectives/fitting/plugin_models/sum_p1_p2.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/plugin_models/sum_p1_p2.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ 	(revision )
@@ -1,437 +1,0 @@
-# A sample of an experimental model function for Sum(Pmodel1,Pmodel2)
-import copy
-from sas.models.pluginmodel import Model1DPlugin
-import os
-import sys
-"""
-## *****************************************************************************
-Please select the 'Compile' from the menubar after the modification and saving.
-Note that we recommend to save the file as a different file name.
-Otherwise, it could be removed in the future on re-installation of the SasView.
-## *****************************************************************************
-"""
-
-# Available model names for this sum model
-"""
-BCCrystalModel, BEPolyelectrolyte, BarBellModel, BinaryHSModel, BroadPeakModel,
-CSParallelepipedModel, CappedCylinderModel, CoreShellCylinderModel,
-CoreShellEllipsoidModel, CoreShellModel, CorrLengthModel, CylinderModel, 
-DABModel, DebyeModel, EllipsoidModel, EllipticalCylinderModel, FCCrystalModel,
-FlexCylEllipXModel, FlexibleCylinderModel, FractalCoreShellModel, FractalModel,
-FuzzySphereModel, GaussLorentzGelModel, GuinierModel, GuinierPorodModel,
-HardsphereStructure, HayterMSAStructure, HollowCylinderModel, LamellarFFHGModel,
-LamellarModel, LamellarPCrystalModel, LamellarPSHGModel, LamellarPSModel,
-LineModel, LorentzModel, MultiShellModel, ParallelepipedModel, PeakGaussModel,
-PeakLorentzModel, PearlNecklaceModel, Poly_GaussCoil, PolymerExclVolume,
-PorodModel, PowerLawAbsModel, SCCrystalModel, SphereModel, SquareWellStructure,
-StackedDisksModel, StickyHSStructure, TeubnerStreyModel, TriaxialEllipsoidModel,
-TwoLorentzianModel, TwoPowerLawModel, VesicleModel
-"""
-## This is same as the Easy Custom Sum(p1 + p2) 
-#
-#     Custom model = scale_factor * (P1 + P2)
-#
-## User can REPLACE model names below two arrowed lines (two names per line)
-from sas.models.CylinderModel import CylinderModel as P1          #<========
-from sas.models.PolymerExclVolume import PolymerExclVolume as P2  #<========
-
-# If you want to add your custom model, change the filename to your custom model
-# FILE NAME without the extension(.py). And un-comment the line(ie., remove '#')
-
-# from filename import Model as P2      #<========
-
-
-#####DO NOT CHANGE ANYTHING BELOW THIS LINE 
-#####---------------------------------------------------------------------------
-class Model(Model1DPlugin):
-    """
-    Use for p1(Q)+p2(Q); 
-    Note: P(Q) refers to 'form factor' model.
-    """
-    name = "" 
-    def __init__(self):
-        Model1DPlugin.__init__(self, name=self.name)
-        """
-        :param p_model1: a form factor, P(Q)
-        :param p_model2: another form factor, P(Q)
-        """
-        p_model1 = P1()
-        p_model2 = P2()
-        ## Setting  model name model description
-        self.description=""
-        
-        self.description = p_model1.name+"\n"
-        self.description += p_model2.name+"\n"
-        self.fill_description(p_model1, p_model2)
-        # Set the name same as the file name
-        self.name = self.get_fname()     ##DO NOT CHANGE THIS LINE!!!
-        ## Define parameters
-        self.params = {}
-
-        ## Parameter details [units, min, max]
-        self.details = {}
-        
-        # non-fittable parameters
-        self.non_fittable = p_model1.non_fittable  
-        self.non_fittable += p_model2.non_fittable  
-            
-        ##models 
-        self.p_model1= p_model1
-        self.p_model2= p_model2
-        
-       
-        ## dispersion
-        self._set_dispersion()
-        ## Define parameters
-        self._set_params()
-        ## New parameter:Scaling factor
-        self.params['scale_factor'] = 1
-        
-        ## Parameter details [units, min, max]
-        self._set_details()
-        self.details['scale_factor'] = ['',  None, None]
-        ## Magnetic Panrameters
-        self.magnetic_params = []
-        
-        #list of parameter that can be fitted
-        self._set_fixed_params()  
-        ## parameters with orientation
-        for item in self.p_model1.orientation_params:
-            new_item = "p1_" + item
-            if not new_item in self.orientation_params:
-                self.orientation_params.append(new_item)
-            
-        for item in self.p_model2.orientation_params:
-            new_item = "p2_" + item
-            if not new_item in self.orientation_params:
-                self.orientation_params.append(new_item)
-        ## magnetic params
-        for item in self.p_model1.magnetic_params:
-            new_item = "p1_" + item
-            if not new_item in self.magnetic_params:
-                self.magnetic_params.append(new_item)
-            
-        for item in self.p_model2.magnetic_params:
-            new_item = "p2_" + item
-            if not new_item in self.magnetic_params:
-                self.magnetic_params.append(new_item)
-        # set multiplicity 1: muti_func Not supported.
-        multiplicity1 = 1
-        multiplicity2 = 1
-        ## functional multiplicity of the model
-        self.multiplicity1 = multiplicity1  
-        self.multiplicity2 = multiplicity2    
-        self.multiplicity_info = []   
-        
-    def _clone(self, obj):
-        """
-            Internal utility function to copy the internal
-            data members to a fresh copy.
-        """
-        obj.params     = copy.deepcopy(self.params)
-        obj.description     = copy.deepcopy(self.description)
-        obj.details    = copy.deepcopy(self.details)
-        obj.dispersion = copy.deepcopy(self.dispersion)
-        obj.p_model1  = self.p_model1.clone()
-        obj.p_model2  = self.p_model2.clone()
-        #obj = copy.deepcopy(self)
-        return obj
-    
-    def _get_name(self, name1, name2):
-        """
-        Get combined name from two model names
-        """
-        p1_name = self._get_upper_name(name1)
-        if not p1_name:
-            p1_name = name1
-        name = p1_name
-        name += "+"
-        p2_name = self._get_upper_name(name2)
-        if not p2_name:
-            p2_name = name2
-        name += p2_name
-        return name
-    
-    def _get_upper_name(self, name=None):
-        """
-        Get uppercase string from model name
-        """
-        if name == None:
-            return ""
-        upper_name = ""
-        str_name = str(name)
-        for index in range(len(str_name)):
-            if str_name[index].isupper():
-                upper_name += str_name[index]
-        return upper_name
-        
-    def _set_dispersion(self):
-        """
-           combined the two models dispersions
-           Polydispersion should not be applied to s_model
-        """
-        ##set dispersion only from p_model 
-        for name , value in self.p_model1.dispersion.iteritems():
-            #if name.lower() not in self.p_model1.orientation_params:
-            new_name = "p1_" + name
-            self.dispersion[new_name]= value 
-        for name , value in self.p_model2.dispersion.iteritems():
-            #if name.lower() not in self.p_model2.orientation_params:
-            new_name = "p2_" + name
-            self.dispersion[new_name]= value 
-            
-    def function(self, x=0.0): 
-        """
-        """
-        return 0
-                               
-    def getProfile(self):
-        """
-        Get SLD profile of p_model if exists
-        
-        : return: (r, beta) where r is a list of radius of the transition points
-                beta is a list of the corresponding SLD values 
-        : Note: This works only for func_shell# = 2 (exp function)
-                and is not supporting for p2
-        """
-        try:
-            x,y = self.p_model1.getProfile()
-        except:
-            x = None
-            y = None
-            
-        return x, y
-    
-    def _set_params(self):
-        """
-            Concatenate the parameters of the two models to create
-            this model parameters 
-        """
-
-        for name , value in self.p_model1.params.iteritems():
-            # No 2D-supported
-            #if name not in self.p_model1.orientation_params:
-            new_name = "p1_" + name
-            self.params[new_name]= value
-            
-        for name , value in self.p_model2.params.iteritems():
-            # No 2D-supported
-            #if name not in self.p_model2.orientation_params:
-            new_name = "p2_" + name
-            self.params[new_name]= value
-                
-        # Set "scale" as initializing
-        self._set_scale_factor()
-      
-            
-    def _set_details(self):
-        """
-            Concatenate details of the two models to create
-            this model details 
-        """
-        for name ,detail in self.p_model1.details.iteritems():
-            new_name = "p1_" + name
-            #if new_name not in self.orientation_params:
-            self.details[new_name]= detail
-            
-        for name ,detail in self.p_model2.details.iteritems():
-            new_name = "p2_" + name
-            #if new_name not in self.orientation_params:
-            self.details[new_name]= detail
-    
-    def _set_scale_factor(self):
-        """
-        Not implemented
-        """
-        pass
-        
-                
-    def setParam(self, name, value):
-        """ 
-        Set the value of a model parameter
-    
-        :param name: name of the parameter
-        :param value: value of the parameter
-        """
-        # set param to p1+p2 model
-        self._setParamHelper(name, value)
-        
-        ## setParam to p model 
-        model_pre = name.split('_', 1)[0]
-        new_name = name.split('_', 1)[1]
-        if model_pre == "p1":
-            if new_name in self.p_model1.getParamList():
-                self.p_model1.setParam(new_name, value)
-        elif model_pre == "p2":
-             if new_name in self.p_model2.getParamList():
-                self.p_model2.setParam(new_name, value)
-        elif name.lower() == 'scale_factor':
-            self.params['scale_factor'] = value
-        else:
-            raise ValueError, "Model does not contain parameter %s" % name
-            
-    def getParam(self, name):
-        """ 
-        Set the value of a model parameter
-
-        :param name: name of the parameter
-        
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)==2:
-            for item in self.dispersion.keys():
-                # 2D not supported
-                if item.lower()==toks[0].lower():# and \
-                            #item.lower() not in self.orientation_params \
-                            #and toks[0].lower() not in self.orientation_params:
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():
-                            return self.dispersion[item][par]
-        else:
-            # Look for standard parameter
-            for item in self.params.keys():
-                if item.lower()==name.lower():#and \
-                            #item.lower() not in self.orientation_params \
-                            #and toks[0].lower() not in self.orientation_params:
-                    return self.params[item]
-        return  
-        #raise ValueError, "Model does not contain parameter %s" % name
-       
-    def _setParamHelper(self, name, value):
-        """
-        Helper function to setparam
-        """
-        # Look for dispersion parameters
-        toks = name.split('.')
-        if len(toks)== 2:
-            for item in self.dispersion.keys():
-                if item.lower()== toks[0].lower():# and \
-                            #item.lower() not in self.orientation_params:
-                    for par in self.dispersion[item]:
-                        if par.lower() == toks[1].lower():#and \
-                                #item.lower() not in self.orientation_params:
-                            self.dispersion[item][par] = value
-                            return
-        else:
-            # Look for standard parameter
-            for item in self.params.keys():
-                if item.lower()== name.lower():#and \
-                            #item.lower() not in self.orientation_params:
-                    self.params[item] = value
-                    return
-            
-        raise ValueError, "Model does not contain parameter %s" % name
-             
-   
-    def _set_fixed_params(self):
-        """
-             fill the self.fixed list with the p_model fixed list
-        """
-        for item in self.p_model1.fixed:
-            new_item = "p1" + item
-            self.fixed.append(new_item)
-        for item in self.p_model2.fixed:
-            new_item = "p2" + item
-            self.fixed.append(new_item)
-
-        self.fixed.sort()
-                
-                    
-    def run(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q-value (float or [float, float] as [r, theta])
-        :return: (scattering function value)
-        """
-        self._set_scale_factor()
-        return self.params['scale_factor'] * \
-                (self.p_model1.run(x) + self.p_model2.run(x))
-    
-    def runXY(self, x = 0.0):
-        """ 
-        Evaluate the model
-        
-        :param x: input q-value (float or [float, float] as [qx, qy])
-        :return: scattering function value
-        """  
-        self._set_scale_factor()
-        return self.params['scale_factor'] * \
-                (self.p_model1.runXY(x) + self.p_model2.runXY(x))
-    
-    ## Now (May27,10) directly uses the model eval function 
-    ## instead of the for-loop in Base Component.
-    def evalDistribution(self, x = []):
-        """ 
-        Evaluate the model in cartesian coordinates
-        
-        :param x: input q[], or [qx[], qy[]]
-        :return: scattering function P(q[])
-        """
-        self._set_scale_factor()
-        return self.params['scale_factor'] * \
-                    (self.p_model1.evalDistribution(x) + \
-                                 self.p_model2.evalDistribution(x))
-
-    def set_dispersion(self, parameter, dispersion):
-        """
-        Set the dispersion object for a model parameter
-        
-        :param parameter: name of the parameter [string]
-        :dispersion: dispersion object of type DispersionModel
-        """
-        value= None
-        new_pre = parameter.split("_", 1)[0]
-        new_parameter = parameter.split("_", 1)[1]
-        try:
-            if new_pre == 'p1' and \
-                            new_parameter in self.p_model1.dispersion.keys():
-                value= self.p_model1.set_dispersion(new_parameter, dispersion)
-            if new_pre == 'p2' and \
-                             new_parameter in self.p_model2.dispersion.keys():
-                value= self.p_model2.set_dispersion(new_parameter, dispersion)
-            self._set_dispersion()
-            return value
-        except:
-            raise 
-
-    def fill_description(self, p_model1, p_model2):
-        """
-        Fill the description for P(Q)+P(Q)
-        """
-        description = ""
-        description +="This model gives the summation of  %s and %s.\n"% \
-                                        ( p_model1.name, p_model2.name )
-        self.description += description
-    
-    ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       
-    def get_fname(self):
-        """
-        Get the model name same as the file name
-        """
-        path = sys._getframe().f_code.co_filename
-        basename  = os.path.basename(path)
-        name, _ = os.path.splitext(basename)
-        return name
-            
-if __name__ == "__main__": 
-    m1= Model() 
-    #m1.setParam("p1_scale", 25)  
-    #m1.setParam("p1_length", 1000)
-    #m1.setParam("p2_scale", 100) 
-    #m1.setParam("p2_rg", 100) 
-    out1 = m1.runXY(0.01)
-
-    m2= Model()
-    #m2.p_model1.setParam("scale", 25) 
-    #m2.p_model1.setParam("length", 1000) 
-    #m2.p_model2.setParam("scale", 100)
-    #m2.p_model2.setParam("rg", 100)
-    out2 = m2.p_model1.runXY(0.01) + m2.p_model2.runXY(0.01)
-    print "Testing at Q = 0.01:"
-    print out1, " = ", out2
-    if out1 == out2:
-        print "===> Simple Test: Passed!"
-    else:
-        print "===> Simple Test: Failed!"
Index: c/sas/sasgui/perspectives/fitting/plugin_models/testmodel.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/plugin_models/testmodel.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ 	(revision )
@@ -1,112 +1,0 @@
-"""
-Test plug-in model
-These are links of available functions:
-
-http://docs.python.org/library/math.html
-http://www.scipy.org/Numpy_Functions_by_Category
-"""
-
-"""
-## *****************************************************************************
-Please select the 'Compile' from the menubar after the modification and saving.
-Note that we recommend to save the file as a different file name.
-Otherwise, it could be removed in the future on re-installation of the SasView.
-## *****************************************************************************
-"""
-
-from sas.models.pluginmodel import Model1DPlugin  ##DO NOT CHANGE THIS LINE!!!
-import math                  ##DO NOT CHANGE THIS LINE!!!
-import numpy               ##DO NOT CHANGE THIS LINE!!!
-import os
-import sys
-##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ##
-## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE
-## CONFORTABLE ENOUGH WITH OUR MODEL PLUGIN OPTION
-
-
-## <-----  SIGN DEFINES WHERE YOU CAN MODIFY THE CODE
-
-class Model(Model1DPlugin):##DO NOT CHANGE THIS LINE!!!
-    """
-    ##YOU CAN BE MODIFY ANYTHING BETWEEN """ """
-    ##DESCRIPTION OF MODEL PLUG-IN GOES HERE
-    
-    ##EXAMPLE:Class that evaluates a cos(x) model. 
-    """
-    name = ""     
-    
-    def __init__(self):
-        """
-        Initialization
-        """
-        Model1DPlugin.__init__(self, name= self.name)##DO NOT CHANGE THIS LINE!!!
-        
-        ## EDIT PARAMETERS' NAMES AND VALUE
-        ## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS
-        self.params = {}                        ##DO NOT CHANGE THIS LINE!!!
-        # Set the name same as the file name
-        self.name = self.get_fname()     ##DO NOT CHANGE THIS LINE!!!
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE
-        self.params['A'] = 1.0       ## <-----  
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE   
-        self.params['B'] = 1.0       ## <----- 
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE    
-        self.params['C'] = 10.0      ## <-----  
-
-        ## DEFINE DEFAULT DETAILS
-        self.set_details()      ##DO NOT DELETE OR CHANGE THIS LINE!!!
-        
-        ## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN """   """  ONLY!!!!
-        self.description = "F(x)=A+Bcos(2x)+Csin(2x) "     ## <----- 
-   
-    def function(self, x = 0.0):  ##DO NOT CHANGE THIS LINE!!!
-        """
-        Evaluate the model
-        
-        :param x: input x
-        
-        :return: function value
-        
-        """
-        ## ADD YOUR FUNCTION HERE.
-        ## REUSE THE PARAMETERS DEFINED PREVIOUSLY TO WRITE YOUR FUNCTION.
-        
-        ## IN THIS EXAMPLE THE FUNTION IS:
-        ## A+Bcos(2x)+Csin(2x)
-        ## YOU CAN USE math.sin or sin directly
-        ## NOTE: sin, cos ARE FUNCTIONS  IMPORTED FROM PYTHON MATH LIBRARY
-        ## FOR MORE INFORMATION CHECK http://docs.python.org/library/math.html      
-        ## OTHER FUNCTIONS ARE ALSO 
-        ##  AVAILABLE http://www.scipy.org/Numpy_Functions_by_Category
-        ## numpy FUNCTIONS ARE FOR EXPERT USER
-        
-        return self.params['A']+self.params['B']*math.cos(2.0*x)+self.params['C']*math.sin(2.0*x)
-    
-    ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!   
-    def get_fname(self):
-        """
-        Get the model name same as the file name
-        """
-        path = sys._getframe().f_code.co_filename
-        basename  = os.path.basename(path)
-        name, _ = os.path.splitext(basename)
-        return name
-    
-## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       
-if __name__ == "__main__": 
-    m= Model() 
-    out1 = m.runXY(0.0)
-    out2 = m.runXY(0.01)
-    isfine1 = numpy.isfinite(out1)
-    isfine2 = numpy.isfinite(out2)
-    print "Testing the value at Q = 0.0:"
-    print out1, " : finite? ", isfine1
-    print "Testing the value at Q = 0.01:"
-    print out2, " : finite? ", isfine2
-    if isfine1 and isfine2:
-        print "===> Simple Test: Passed!"
-    else:
-        print "===> Simple Test: Failed!"
Index: c/sas/sasgui/perspectives/fitting/plugin_models/testmodel_2.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/plugin_models/testmodel_2.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ 	(revision )
@@ -1,175 +1,0 @@
-"""
-Test plug-in model
-These are links of available functions:
-
-http://docs.python.org/library/math.html
-http://www.scipy.org/Numpy_Functions_by_Category
-"""
-
-"""
-## *****************************************************************************
-Please select the 'Compile' from the menubar after the modification and saving.
-Note that we recommend to save the file as a different file name.
-Otherwise, it could be removed in the future on re-installation of the SasView.
-## *****************************************************************************
-"""
-
-from sas.models.pluginmodel import Model1DPlugin  ##DO NOT CHANGE THIS LINE!!!
-import math                     ##DO NOT CHANGE THIS LINE!!!
-import numpy                    ##DO NOT CHANGE THIS LINE!!!
-import os
-import sys
-##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ##
-## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE
-## CONFORTABLE ENOUGH WITH OUR MODEL PLUGIN OPTION
-
-
-## <-----  SIGN DEFINES WHERE YOU CAN MODIFY THE CODE
-
-class Model(Model1DPlugin): ##DO NOT CHANGE THIS LINE!!!
-    """
-    ##YOU CAN BE MODIFY ANYTHING BETWEEN """ """
-    ##DESCRIPTION OF MODEL PLUG-IN GOES HERE
-    
-    ##EXAMPLE: Class that evaluates a polynomial model. 
-    """
-    name = "" 
-                                
-    def __init__(self):      ##DO NOT CHANGE THIS LINE!!!
-        """
-        Initialization
-        """
-        Model1DPlugin.__init__(self, name=self.name) ##DO NOT CHANGE THIS LINE!!!
-        
-        ## EDIT PARAMETERS' NAMES AND VALUE
-        ## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS
-        self.params = {}                ##DO NOT CHANGE THIS LINE!!!
-        # Set the name same as the file name
-        self.name = self.get_fname()     ##DO NOT CHANGE THIS LINE!!!
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE
-        self.params['scale'] = 1.0   ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                                                      
-        self.params['A'] = 0.0       ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                 
-        self.params['B'] = 10.0      ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                  
-        self.params['C'] = 0.0       ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                
-        self.params['D'] = 0.0     ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                   
-        self.params['E'] = 0.0     ## <-----   
-        ## YOU CAN MODIFY THELINE BELLOW.CHANGE WORD BETWEEN ' ' AND NUMBER 
-        ## YOU CAN ALSO DELETE THIS LINE                  
-        self.params['F'] = 0.0     ## <-----          
-
-        ## STORING PARAMETERS  [UNIT, MINIMUM VALUE, MAXIMUM VALUE]
-        self.details = {}    ##DO NOT CHANGE THIS LINE!!!
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ',WORD BETWEEN
-        ## ' ', TWO OTHER NUMBESR TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE      
-        self.details['scale'] = ['',None, None]    ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ',WORD BETWEEN
-        ## ' ', TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     
-        self.details['A'] = ['', None, None]        ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ',WORD BETWEEN
-        ## ' ', TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     
-        self.details['B'] = ['', None, None]        ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ',WORD BETWEEN
-        ## ' ', TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     
-        self.details['C'] = ['', None, None]        ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ',WORD BETWEEN
-        ## ' ', TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     
-        self.details['D'] = ['', None, None]        ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ',WORD BETWEEN
-        ## ' ', TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     
-        self.details['E'] = ['', None, None]        ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN ' ',WORD BETWEEN
-        ## ' ', TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     
-        self.details['F'] = ['', 0, 1e16]           ## <-----   
-        ## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN """   """  ONLY!!!!
-        self.description = """
-            scale * sin(F(x)/F(x)) \n where F(x)=A+B*x+C*x^2+D*x^3+E*x^4+F*x^5
-                 """                        ## <-----   
-   
-    def function(self, x = 0.0): ##DO NOT CHANGE THIS LINE!!!
-        """ 
-        Evaluate the model
-        
-        :param x: input x
-        
-        :return: function value
-        
-        """
-        ## ADD YOUR FUNCTION HERE.
-        ## REUSE THE PARAMETERS DEFINED PREVIOUSLY TO WRITE YOUR FUNCTION.
-        
-        ## IN THIS EXAMPLE THE FUNTION IS:
-        ## scale * sin(F(x)/F(x)) \n where F(x)=A+B*x+C*x^2+D*x^3+E*x^4+F*x^5
-        
-        ## YOU CAN REWRITE OUR EXAMPLE WITH EVERYTING INSIDE " " :
-        ## "RETURN self.params['scale']* (self.params['A'] + self.params['B']*x + \
-        ##   self.params['C']* pow(x,2) + self.params['D']*pow(x,3)+\
-        ## self.params['E']*pow(x,4) +self.params['F']*pow(x,5)  ) "  
-         
-        ## NOTE: pow IS A FUNCTION IMPORTED FROM PYTHON MATH LIBRARY
-        ## FOR MORE INFORMATION CHECK http://docs.python.org/library/math.html      
-        ## OTHER FUNCTIONS ARE ALSO 
-        ###  AVAILABLE http://www.scipy.org/Numpy_Functions_by_Category
-        ## numpy FUNCTIONS ARE FOR EXPERT USER
-        
-         
-        ## YOU CAN ERASE EVERYTHING BELLOW FOR YOUR OWN FUNCTION
-        #Redefine parameters as local parameters
-        a = self.params['A']       ## <-----   
-        b = self.params['B']       ## <-----   
-        c = self.params['C']       ## <-----   
-        d = self.params['D']       ## <-----   
-        e = self.params['E']       ## <-----   
-        f = self.params['F']        ## <-----   
-        scl = self.params['scale']   ## <-----   
-        ##THIS OUR FUNCTION TEMPLATE
-        poly = a + b*x + c*math.pow(x,2) + d*math.pow(x,3) \
-             + e*math.pow(x,4) +f*math.pow(x,5)      ## <-----                
-        
-        #Remove a singular point (lim poly --> 0) for sin(poly)/poly
-        #(Just note: In Python, indentation defines the belongings of 'if', 'for', and so on..)
-        if poly == 0:                       ## <-----   
-            result = 1                      ## <-----   
-        else:                               ## <-----   
-            result = math.sin(poly)/poly    ## <-----   
-            
-        #Re-scale                          ## <-----   
-        result *=scl                       ## <-----   
-
-        return result ## MODIFY ONLY RESULT. DON'T DELETE RETURN!!!!
-
-    ## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!   
-    def get_fname(self):
-        """
-        Get the model name same as the file name
-        """
-        path = sys._getframe().f_code.co_filename
-        basename  = os.path.basename(path)
-        name, _ = os.path.splitext(basename)
-        return name
-                
-## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       
-if __name__ == "__main__": 
-    m= Model() 
-    out1 = m.runXY(0.0)
-    out2 = m.runXY(0.01)
-    isfine1 = numpy.isfinite(out1)
-    isfine2 = numpy.isfinite(out2)
-    print "Testing the value at Q = 0.0:"
-    print out1, " : finite? ", isfine1
-    print "Testing the value at Q = 0.01:"
-    print out2, " : finite? ", isfine2
-    if isfine1 and isfine2:
-        print "===> Simple Test: Passed!"
-    else:
-        print "===> Simple Test: Failed!"
Index: st/sasdataloader/test/utest_smearing.py
===================================================================
--- test/sasdataloader/test/utest_smearing.py	(revision ef908db37c9eb600c4448e9e4633b500a40c6361)
+++ 	(revision )
@@ -1,96 +1,0 @@
-"""
-    Unit tests for data manipulations
-"""
-
-
-import unittest
-import numpy, math
-from sas.sascalc.dataloader.loader import  Loader
-from sas.sascalc.dataloader.data_info import Data1D, Data2D
-#from DataLoader.qsmearing import SlitSmearer, QSmearer, smear_selection
-from sas.sascalc.data_util.qsmearing import SlitSmearer, QSmearer, smear_selection
-import os.path
-from time import time
-class smear_tests(unittest.TestCase):
-    
-    def setUp(self):
-        data = Loader().load("cansas1d_slit.xml")
-        self.data = data[0]
-        
-        x = 0.001*numpy.arange(1,11)
-        y = 12.0-numpy.arange(1,11)
-        dxl = 0.00*numpy.ones(10)
-        dxw = 0.00*numpy.ones(10)
-        dx = 0.00*numpy.ones(10)
-        
-        self.data.dx = dx
-        self.data.x = x
-        self.data.y = y
-        self.data.dxl = dxl
-        self.data.dxw = dxw
-        
-    def test_slit(self):
-        """
-            Test identity smearing
-        """
-        # Create smearer for our data
-        s = SlitSmearer(self.data)
-        
-        input = 12.0-numpy.arange(1,11)
-        output = s(input)
-        for i in range(len(input)):
-            self.assertEquals(input[i], output[i])
-
-    def test_slit2(self):
-        """
-            Test basic smearing
-        """
-        dxl = 0.005*numpy.ones(10)
-        dxw = 0.0*numpy.ones(10)
-        self.data.dxl = dxl
-        self.data.dxw = dxw
-        # Create smearer for our data
-        s = SlitSmearer(self.data)
-        
-        input = 12.0-numpy.arange(1,11)
-        output = s(input)
-        # The following commented line was the correct output for even bins [see smearer.cpp for details] 
-        #answer = [ 9.666,  9.056,  8.329,  7.494,  6.642,  5.721,  4.774,  3.824,  2.871, 2.   ]
-        answer = [ 9.0618,  8.6401,  8.1186,  7.1391,  6.1528,  5.5555,     4.5584,  3.5606,  2.5623, 2.    ]
-        for i in range(len(input)):
-            self.assertAlmostEqual(answer[i], output[i], 3)
-        
-    def test_q(self):
-        """
-            Test identity resolution smearing
-        """
-        # Create smearer for our data
-        s = QSmearer(self.data)
-        
-        input = 12.0-numpy.arange(1,11)
-        output = s(input)
-        for i in range(len(input)):
-            self.assertAlmostEquals(input[i], output[i], 5)
-
-    def test_q2(self):
-        """
-            Test basic smearing
-        """
-        dx = 0.001*numpy.ones(10)
-        self.data.dx = dx
-
-        # Create smearer for our data
-        s = QSmearer(self.data)
-        
-        input = 12.0-numpy.arange(1,11)
-        output = s(input)
-        
-        answer = [ 10.44785079,   9.84991299,   8.98101708,   
-                  7.99906585,   6.99998311,   6.00001689,
-                  5.00093415,   4.01898292,   3.15008701,   2.55214921]
-        for i in range(len(input)):
-            self.assertAlmostEqual(answer[i], output[i], 2)
-        
-if __name__ == '__main__':
-    unittest.main()
-   
Index: st/sasfit/test/testdata_cst.txt
===================================================================
--- test/sasfit/test/testdata_cst.txt	(revision efa5e4440f169b2894993f4f1db9691ecdd9bc2e)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#y=A
-#A=2.5
-0  2.5852  0.375
-0.204082  2.19143  0.375
-0.408163  2.57106  0.375
-0.612245  2.51277  0.375
-0.816327  2.26897  0.375
-1.02041  2.20776  0.375
-1.22449  2.45739  0.375
-1.42857  2.15075  0.375
-1.63265  1.86874  0.375
-1.83673  2.33998  0.375
-2.04082  1.62786  0.375
-2.2449  2.72658  0.375
-2.44898  2.48138  0.375
-2.65306  2.81075  0.375
-2.85714  2.25486  0.375
-3.06122  2.17361  0.375
-3.26531  2.1977  0.375
-3.46939  3.16184  0.375
-3.67347  3.00213  0.375
-3.87755  2.1984  0.375
-4.08163  2.76865  0.375
-4.28571  2.35003  0.375
-4.4898  2.98548  0.375
-4.69388  3.15354  0.375
-4.89796  2.87848  0.375
-5.10204  2.00554  0.375
-5.30612  2.384  0.375
-5.5102  2.56871  0.375
-5.71429  2.57468  0.375
-5.91837  2.02424  0.375
-6.12245  2.81453  0.375
-6.32653  1.79367  0.375
-6.53061  2.23765  0.375
-6.73469  2.36467  0.375
-6.93878  2.89383  0.375
-7.14286  2.43143  0.375
-7.34694  2.66729  0.375
-7.55102  2.85271  0.375
-7.7551  2.23553  0.375
-7.95918  2.37953  0.375
-8.16327  2.55255  0.375
-8.36735  1.83512  0.375
-8.57143  2.82562  0.375
-8.77551  2.36114  0.375
-8.97959  2.58935  0.375
-9.18367  2.19231  0.375
-9.38776  2.92396  0.375
-9.59184  2.48175  0.375
-9.79592  1.90806  0.375
-10  3.02146  0.375
Index: st/sasfit/test/testdata_line.txt
===================================================================
--- test/sasfit/test/testdata_line.txt	(revision efa5e4440f169b2894993f4f1db9691ecdd9bc2e)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#y=A+x*B
-#B=2.5
-#A=4
-0  2.83954  0.6
-0.204082  3.44938  0.676531
-0.408163  5.82026  0.753061
-0.612245  5.27591  0.829592
-0.816327  5.2781  0.906122
-1.02041  5.22531  0.982653
-1.22449  7.47487  1.05918
-1.42857  7.85852  1.13571
-1.63265  10.2278  1.21224
-1.83673  8.33195  1.28878
-2.04082  9.22407  1.36531
-2.2449  7.95013  1.44184
-2.44898  10.0289  1.51837
-2.65306  11.0736  1.5949
-2.85714  12.2957  1.67143
-3.06122  12.3108  1.74796
-3.26531  12.6916  1.82449
-3.46939  12.5859  1.90102
-3.67347  14.5972  1.97755
-3.87755  10.9443  2.05408
-4.08163  11.4356  2.13061
-4.28571  19.3213  2.20714
-4.4898  14.3191  2.28367
-4.69388  14.6961  2.3602
-4.89796  19.27  2.43673
-5.10204  12.1831  2.51327
-5.30612  21.4745  2.5898
-5.5102  20.0393  2.66633
-5.71429  13.2472  2.74286
-5.91837  14.9428  2.81939
-6.12245  22.1974  2.89592
-6.32653  17.3418  2.97245
-6.53061  19.8174  3.04898
-6.73469  17.6186  3.12551
-6.93878  21.329  3.20204
-7.14286  20.2873  3.27857
-7.34694  23.4112  3.3551
-7.55102  26.063  3.43163
-7.7551  29.8775  3.50816
-7.95918  19.0027  3.58469
-8.16327  19.4248  3.66122
-8.36735  27.4876  3.73776
-8.57143  33.8399  3.81429
-8.77551  24.2611  3.89082
-8.97959  29.8796  3.96735
-9.18367  24.6149  4.04388
-9.38776  35.7664  4.12041
-9.59184  32.145  4.19694
-9.79592  24.8085  4.27347
-10  31.3767  4.35
Index: st/sasfit/test/testdata_line1.txt
===================================================================
--- test/sasfit/test/testdata_line1.txt	(revision efa5e4440f169b2894993f4f1db9691ecdd9bc2e)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#y=A+x*B
-#B=2.5
-#A=4
-0  2.83954  0.6
-0.204082  3.44938  0.6
-0.408163  5.82026  0.7
-0.612245  5.27591  0.8
-0.816327  5.2781  0.906122
-1.02041  5.22531  0.982653
-1.22449  7.47487  1
-1.42857  7.85852  1.13571
-1.63265  10.2278  1.21224
-1.83673  8.33195  1.28878
-2.04082  9.22407  1.36
-2.2449  7.95013  1.44184
-2.44898  10.0289  1.51837
-2.65306  11.0736  1.5949
-2.85714  12.2957  1.67143
-3.06122  12.3108  1.74796
-3.26531  12.6916  1.82449
-3.46939  12.5859  1.90102
-3.67347  14.5972  1.97755
-
-5.30612  21.4745  2.5898
-5.5102  20.0393  2.66633
-5.71429  13.2472  2.74286
-5.91837  14.9428  2.81939
-6.12245  22.1974  2.89592
-6.32653  17.3418  2.97245
-6.53061  19 3.04898
-6.73469  17.6186  3.12551
-6.93878  21  3.20204
-7.14286  20.2873  3.27857
-7.34694  23.4112  3.3551
-7.55102  26.063  3.43163
-7.7551  29.8775  3.50816
-7.95918  19.0027  3.58469
-8.16327  19.4248  3.66122
-8.36735  27.4876  3.73776
-8.57143  33.8399  3.81429
-8.77551  24.2611  3.89082
-8.97959  29.8796  3.96735
-9.18367  24.6149  4.04388
-9.38776  35.7664  4.12041
-9.59184  32.145  4.19694
-9.79592  24.8085  4.27347
-
Index: st/sasfit/test/testdata_line3.txt
===================================================================
--- test/sasfit/test/testdata_line3.txt	(revision efa5e4440f169b2894993f4f1db9691ecdd9bc2e)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#y=A*x+B
-#A=2.5
-#B=4
-0  2.83954  0.6
-1  3.44938  0.676531
-0.408163  5.82026  0.753061
-0.612245  5.27591  0.829592
-45  5.2781  0.906122
-1.02041  5.22531  0.982653
-1.22449  7.47487  1.05918
-1.42857  7.85852  1.13571
-1.63265  10.2278  1.21224
-1.83673  8.33195  1.28878
-3  9.22407  1.36531
-2.2449  7.95013  1.44184
-2.44898  10.0289  1.51837
-0 11.0736  1.5949
-2.85714  12.2957  1.67143
-3.06122  12.3108  1.74796
-3.26531  12.6916  1.82449
-4  12.5859  1.90102
-3.67347  14.5972  1.97755
-3.87755  10.9443  2.05408
-4.08163  11.4356  2.13061
-4.28571  19.3213  2.20714
-4.4898  14.3191  2.28367
-4.69388  14.6961  2.3602
-4.89796  19.27  2.43673
--1  12.1831  2.51327
-5.30612  21.4745  2.5898
-5.5102  20.0393  2.66633
-5.71429  13.2472  2.74286
-5.91837  14.9428  2.81939
-6.12245  22.1974  2.89592
-6.32653  17.3418  2.97245
-4  19.8174  3.04898
-6.73469  17.6186  3.12551
-6.93878  21.329  3.20204
-7.14286  20.2873  3.27857
-7.34694  23.4112  3.3551
-7.55102  26.063  3.43163
-7.7551  29.8775  3.50816
-7.95918  19.0027  3.58469
-8.16327  19.4248  3.66122
-8.36735  27.4876  3.73776
-8.57143  33.8399  3.81429
-0.2  24.2611  3.89082
-8.97959  29.8796  3.96735
-9.18367  24.6149  4.04388
-0.1  35.7664  4.12041
-0.3  32.145  4.19694
-9.79592  24.8085  4.27347
-10  31.3767  4.35
Index: st/sasfit/test/utest_fit_line.py
===================================================================
--- test/sasfit/test/utest_fit_line.py	(revision b699768550de9d4b35b087234ec1d2a461922bab)
+++ 	(revision )
@@ -1,220 +1,0 @@
-"""
-    Unit tests for fitting module 
-    @author Gervaise Alina
-"""
-import unittest
-import math
-
-from sas.sascalc.fit.AbstractFitEngine import Model, FitHandler
-from sas.sascalc.dataloader.loader import Loader
-from sas.sascalc.fit.BumpsFitting import BumpsFit as Fit
-from sas.models.LineModel import LineModel
-from sas.models.Constant import Constant
-
-from bumps import fitters
-try:
-    from bumps.options import FIT_CONFIG
-    def set_fitter(alg, opts):
-        FIT_CONFIG.selected_id = alg
-        FIT_CONFIG.values[alg].update(opts, monitors=[])
-except:
-    # CRUFT: Bumps changed its handling of fit options around 0.7.5.6
-    def set_fitter(alg, opts):
-        #print "fitting",alg,opts
-        #print "options",fitters.FIT_OPTIONS[alg].__dict__
-        fitters.FIT_DEFAULT = alg
-        fitters.FIT_OPTIONS[alg].options.update(opts, monitors=[])
-
-
-class testFitModule(unittest.TestCase):
-    """ test fitting """
-
-    def test_bad_pars(self):
-        fitter = Fit()
-
-        data = Loader().load("testdata_line.txt")
-        data.name = data.filename
-        fitter.set_data(data,1)
-
-        model1  = LineModel()
-        model1.name = "M1"
-        model = Model(model1, data)
-        pars1= ['param1','param2']
-        try:
-            fitter.set_model(model,1,pars1)
-        except ValueError,exc:
-            #print "ValueError was correctly raised: "+str(msg)
-            assert str(exc).startswith('parameter param1')
-        else:
-            raise AssertionError("No error raised for fitting with wrong parameters name to fit")
-
-    def fit_single(self, isdream=False):
-        fitter = Fit()
-
-        data = Loader().load("testdata_line.txt")
-        data.name = data.filename
-        fitter.set_data(data,1)
-
-        # Receives the type of model for the fitting
-        model1  = LineModel()
-        model1.name = "M1"
-        model = Model(model1,data)
-
-        pars1= ['A','B']
-        fitter.set_model(model,1,pars1)
-        fitter.select_problem_for_fit(id=1,value=1)
-        result1, = fitter.fit(handler=FitHandler())
-
-        # The target values were generated from the following statements
-        p,s,fx = result1.pvec, result1.stderr, result1.fitness
-        #print "p0,p1,s0,s1,fx = %g, %g, %g, %g, %g"%(p[0],p[1],s[0],s[1],fx)
-        p0,p1,s0,s1,fx_ = 3.68353, 2.61004, 0.336186, 0.105244, 1.20189
-
-        if isdream:
-            # Dream is not a minimizer: just check that the fit is within
-            # uncertainty
-            self.assertTrue( abs(p[0]-p0) <= s0 )
-            self.assertTrue( abs(p[1]-p1) <= s1 )
-        else:
-            self.assertTrue( abs(p[0]-p0) <= 1e-5 )
-            self.assertTrue( abs(p[1]-p1) <= 1e-5 )
-            self.assertTrue( abs(fx-fx_) <= 1e-5 )
-
-    def fit_bumps(self, alg, **opts):
-        set_fitter(alg, opts)
-        self.fit_single(isdream=(alg=='dream'))
-
-    def test_bumps_de(self):
-        self.fit_bumps('de')
-
-    def test_bumps_dream(self):
-        self.fit_bumps('dream', burn=500, steps=100)
-
-    def test_bumps_amoeba(self):
-        self.fit_bumps('amoeba')
-
-    def test_bumps_newton(self):
-        self.fit_bumps('newton')
-
-    def test_bumps_lm(self):
-        self.fit_bumps('lm')
-
-    def test2(self):
-        """ fit 2 data and 2 model with no constrainst"""
-        #load data
-        l = Loader()
-        data1=l.load("testdata_line.txt")
-        data1.name = data1.filename
-      
-        data2=l.load("testdata_line1.txt")
-        data2.name = data2.filename
-     
-        #Importing the Fit module
-        fitter = Fit()
-        # Receives the type of model for the fitting
-        model11  = LineModel()
-        model11.name= "M1"
-        model22  = LineModel()
-        model11.name= "M2"
-      
-        model1 = Model(model11,data1)
-        model2 = Model(model22,data2)
-        pars1= ['A','B']
-        fitter.set_data(data1,1)
-        fitter.set_model(model1,1,pars1)
-        fitter.select_problem_for_fit(id=1,value=0)
-        fitter.set_data(data2,2)
-        fitter.set_model(model2,2,pars1)
-        fitter.select_problem_for_fit(id=2,value=0)
-
-        try: result1, = fitter.fit(handler=FitHandler())
-        except RuntimeError,msg:
-            assert str(msg)=="Nothing to fit"
-        else: raise AssertionError,"No error raised for fitting with no model"
-        fitter.select_problem_for_fit(id=1,value=1)
-        fitter.select_problem_for_fit(id=2,value=1)
-        R1,R2 = fitter.fit(handler=FitHandler())
-        
-        self.assertTrue( math.fabs(R1.pvec[0]-4)/3 <= R1.stderr[0] )
-        self.assertTrue( math.fabs(R1.pvec[1]-2.5)/3 <= R1.stderr[1] )
-        self.assertTrue( R1.fitness/(len(data1.x)+len(data2.x)) < 2)
-        
-        
-    def test_constraints(self):
-        """ fit 2 data and 2 model with 1 constrainst"""
-        #load data
-        l = Loader()
-        data1= l.load("testdata_line.txt")
-        data1.name = data1.filename
-        data2= l.load("testdata_cst.txt")
-        data2.name = data2.filename
-       
-        # Receives the type of model for the fitting
-        model11  = LineModel()
-        model11.name= "line"
-        model11.setParam("A", 1.0)
-        model11.setParam("B",1.0)
-        
-        model22  = Constant()
-        model22.name= "cst"
-        model22.setParam("value", 1.0)
-        
-        model1 = Model(model11,data1)
-        model2 = Model(model22,data2)
-        model1.set(A=4)
-        model1.set(B=3)
-        # Constraint the constant value to be equal to parameter B (the real value is 2.5)
-        #model2.set(value='line.B')
-        pars1= ['A','B']
-        pars2= ['value']
-        
-        #Importing the Fit module
-        fitter = Fit()
-        fitter.set_data(data1,1)
-        fitter.set_model(model1,1,pars1)
-        fitter.set_data(data2,2,smearer=None)
-        fitter.set_model(model2,2,pars2,constraints=[("value","line.B")])
-        fitter.select_problem_for_fit(id=1,value=1)
-        fitter.select_problem_for_fit(id=2,value=1)
-        
-        R1,R2 = fitter.fit(handler=FitHandler())
-        self.assertTrue( math.fabs(R1.pvec[0]-4.0)/3. <= R1.stderr[0])
-        self.assertTrue( math.fabs(R1.pvec[1]-2.5)/3. <= R1.stderr[1])
-        self.assertTrue( R1.fitness/(len(data1.x)+len(data2.x)) < 2)
-        
-        
-    def test4(self):
-        """ fit 2 data concatenates with limited range of x and  one model """
-            #load data
-        l = Loader()
-        data1 = l.load("testdata_line.txt")
-        data1.name = data1.filename
-        data2 = l.load("testdata_line1.txt")
-        data2.name = data2.filename
-
-        # Receives the type of model for the fitting
-        model1  = LineModel()
-        model1.name= "M1"
-        model1.setParam("A", 1.0)
-        model1.setParam("B",1.0)
-        model = Model(model1,data1)
-      
-        pars1= ['A','B']
-        #Importing the Fit module
-
-        fitter = Fit()
-        fitter.set_data(data1,1,qmin=0, qmax=7)
-        fitter.set_model(model,1,pars1)
-        fitter.set_data(data2,1,qmin=1,qmax=10)
-        fitter.select_problem_for_fit(id=1,value=1)
-        result2, = fitter.fit(handler=FitHandler())
-        
-        self.assert_(result2)
-        self.assertTrue( math.fabs(result2.pvec[0]-4)/3 <= result2.stderr[0] )
-        self.assertTrue( math.fabs(result2.pvec[1]-2.5)/3 <= result2.stderr[1] )
-        self.assertTrue( result2.fitness/len(data1.x) < 2)
-
-
-if __name__ == "__main__":
-    unittest.main()
-    
