Index: sansmodels/src/sans/models/BarBellModel.py
===================================================================
--- sansmodels/src/sans/models/BarBellModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/BarBellModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,181 @@
+#!/usr/bin/env python
+
+##############################################################################
+#	This software was developed by the University of Tennessee as part of the
+#	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+#	project funded by the US National Science Foundation.
+#
+#	If you use DANSE applications to do scientific research that leads to
+#	publication, we ask that you acknowledge the use of the software with the
+#	following sentence:
+#
+#	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+#
+#	copyright 2008, University of Tennessee
+##############################################################################
+
+
+""" 
+Provide functionality for a C extension model
+
+:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
+         DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\barbell.h
+         AND RE-RUN THE GENERATOR SCRIPT
+
+"""
+
+from sans.models.BaseComponent import BaseComponent
+from sans_extension.c_models import CBarBellModel
+import copy    
+    
+class BarBellModel(CBarBellModel, BaseComponent):
+    """ 
+    Class that evaluates a BarBellModel model. 
+    This file was auto-generated from ..\c_extensions\barbell.h.
+    Refer to that file and the structure it contains
+    for details of the model.
+    List of default parameters:
+         scale           = 1.0 
+         rad_bar         = 20.0 [A]
+         len_bar         = 400.0 [A]
+         rad_bell        = 40.0 [A]
+         sld_barbell     = 1e-006 [1/A^(2)]
+         sld_solv        = 6.3e-006 [1/A^(2)]
+         background      = 0.0 [1/cm]
+         theta           = 0.0 [rad]
+         phi             = 0.0 [rad]
+
+    """
+        
+    def __init__(self):
+        """ Initialization """
+        
+        # Initialize BaseComponent first, then sphere
+        BaseComponent.__init__(self)
+        CBarBellModel.__init__(self)
+        
+        ## Name of the model
+        self.name = "BarBellModel"
+        ## Model description
+        self.description ="""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."""
+       
+        ## Parameter details [units, min, max]
+        self.details = {}
+        self.details['scale'] = ['', None, None]
+        self.details['rad_bar'] = ['[A]', None, None]
+        self.details['len_bar'] = ['[A]', None, None]
+        self.details['rad_bell'] = ['[A]', None, None]
+        self.details['sld_barbell'] = ['[1/A^(2)]', None, None]
+        self.details['sld_solv'] = ['[1/A^(2)]', None, None]
+        self.details['background'] = ['[1/cm]', None, None]
+        self.details['theta'] = ['[rad]', None, None]
+        self.details['phi'] = ['[rad]', None, None]
+
+        ## fittable parameters
+        self.fixed=['rad_bar.width', 'len_bar', 'rad_bell', 'phi.width', 'theta.width']
+        
+        ## non-fittable parameters
+        self.non_fittable=[]
+        
+        ## parameters with orientation
+        self.orientation_params =['phi', 'theta', 'phi.width', 'theta.width']
+   
+    def clone(self):
+        """ Return a identical copy of self """
+        return self._clone(BarBellModel())   
+        
+    def __getstate__(self):
+        """
+        return object state for pickling and copying
+        """
+        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log}
+        
+        return self.__dict__, model_state
+        
+    def __setstate__(self, state):
+        """
+        create object from pickled state
+        
+        :param state: the state of the current model
+        
+        """
+        
+        self.__dict__, model_state = state
+        self.params = model_state['params']
+        self.dispersion = model_state['dispersion']
+        self.log = model_state['log']
+       	
+   
+    def run(self, x=0.0):
+        """ 
+        Evaluate the model
+        
+        :param x: input q, or [q,phi]
+        
+        :return: scattering function P(q)
+        
+        """
+        
+        return CBarBellModel.run(self, x)
+   
+    def runXY(self, x=0.0):
+        """ 
+        Evaluate the model in cartesian coordinates
+        
+        :param x: input q, or [qx, qy]
+        
+        :return: scattering function P(q)
+        
+        """
+        
+        return CBarBellModel.runXY(self, x)
+        
+    def evalDistribution(self, x=[]):
+        """ 
+        Evaluate the model in cartesian coordinates
+        
+        :param x: input q[], or [qx[], qy[]]
+        
+        :return: scattering function P(q[])
+        
+        """
+        return CBarBellModel.evalDistribution(self, x)
+        
+    def calculate_ER(self):
+        """ 
+        Calculate the effective radius for P(q)*S(q)
+        
+        :return: the value of the effective radius
+        
+        """       
+        return CBarBellModel.calculate_ER(self)
+        
+    def set_dispersion(self, parameter, dispersion):
+        """
+        Set the dispersion object for a model parameter
+        
+        :param parameter: name of the parameter [string]
+        :param dispersion: dispersion object of type DispersionModel
+        
+        """
+        return CBarBellModel.set_dispersion(self, parameter, dispersion.cdisp)
+        
+   
+# End of file
Index: sansmodels/src/sans/models/CappedCylinderModel.py
===================================================================
--- sansmodels/src/sans/models/CappedCylinderModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/CappedCylinderModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,179 @@
+#!/usr/bin/env python
+
+##############################################################################
+#	This software was developed by the University of Tennessee as part of the
+#	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+#	project funded by the US National Science Foundation.
+#
+#	If you use DANSE applications to do scientific research that leads to
+#	publication, we ask that you acknowledge the use of the software with the
+#	following sentence:
+#
+#	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+#
+#	copyright 2008, University of Tennessee
+##############################################################################
+
+
+""" 
+Provide functionality for a C extension model
+
+:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
+         DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\capcyl.h
+         AND RE-RUN THE GENERATOR SCRIPT
+
+"""
+
+from sans.models.BaseComponent import BaseComponent
+from sans_extension.c_models import CCappedCylinderModel
+import copy    
+    
+class CappedCylinderModel(CCappedCylinderModel, BaseComponent):
+    """ 
+    Class that evaluates a CappedCylinderModel model. 
+    This file was auto-generated from ..\c_extensions\capcyl.h.
+    Refer to that file and the structure it contains
+    for details of the model.
+    List of default parameters:
+         scale           = 1.0 
+         rad_cyl         = 20.0 [A]
+         len_cyl         = 400.0 [A]
+         rad_cap         = 40.0 [A]
+         sld_capcyl      = 1e-006 [1/A^(2)]
+         sld_solv        = 6.3e-006 [1/A^(2)]
+         background      = 0.0 [1/cm]
+         theta           = 0.0 [rad]
+         phi             = 0.0 [rad]
+
+    """
+        
+    def __init__(self):
+        """ Initialization """
+        
+        # Initialize BaseComponent first, then sphere
+        BaseComponent.__init__(self)
+        CCappedCylinderModel.__init__(self)
+        
+        ## Name of the model
+        self.name = "CappedCylinderModel"
+        ## Model description
+        self.description ="""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."""
+       
+        ## Parameter details [units, min, max]
+        self.details = {}
+        self.details['scale'] = ['', None, None]
+        self.details['rad_cyl'] = ['[A]', None, None]
+        self.details['len_cyl'] = ['[A]', None, None]
+        self.details['rad_cap'] = ['[A]', None, None]
+        self.details['sld_capcyl'] = ['[1/A^(2)]', None, None]
+        self.details['sld_solv'] = ['[1/A^(2)]', None, None]
+        self.details['background'] = ['[1/cm]', None, None]
+        self.details['theta'] = ['[rad]', None, None]
+        self.details['phi'] = ['[rad]', None, None]
+
+        ## fittable parameters
+        self.fixed=['rad_cyl.width', 'len_cyl', 'rad_cap', 'phi.width', 'theta.width']
+        
+        ## non-fittable parameters
+        self.non_fittable=[]
+        
+        ## parameters with orientation
+        self.orientation_params =['phi', 'theta', 'phi.width', 'theta.width']
+   
+    def clone(self):
+        """ Return a identical copy of self """
+        return self._clone(CappedCylinderModel())   
+        
+    def __getstate__(self):
+        """
+        return object state for pickling and copying
+        """
+        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log}
+        
+        return self.__dict__, model_state
+        
+    def __setstate__(self, state):
+        """
+        create object from pickled state
+        
+        :param state: the state of the current model
+        
+        """
+        
+        self.__dict__, model_state = state
+        self.params = model_state['params']
+        self.dispersion = model_state['dispersion']
+        self.log = model_state['log']
+       	
+   
+    def run(self, x=0.0):
+        """ 
+        Evaluate the model
+        
+        :param x: input q, or [q,phi]
+        
+        :return: scattering function P(q)
+        
+        """
+        
+        return CCappedCylinderModel.run(self, x)
+   
+    def runXY(self, x=0.0):
+        """ 
+        Evaluate the model in cartesian coordinates
+        
+        :param x: input q, or [qx, qy]
+        
+        :return: scattering function P(q)
+        
+        """
+        
+        return CCappedCylinderModel.runXY(self, x)
+        
+    def evalDistribution(self, x=[]):
+        """ 
+        Evaluate the model in cartesian coordinates
+        
+        :param x: input q[], or [qx[], qy[]]
+        
+        :return: scattering function P(q[])
+        
+        """
+        return CCappedCylinderModel.evalDistribution(self, x)
+        
+    def calculate_ER(self):
+        """ 
+        Calculate the effective radius for P(q)*S(q)
+        
+        :return: the value of the effective radius
+        
+        """       
+        return CCappedCylinderModel.calculate_ER(self)
+        
+    def set_dispersion(self, parameter, dispersion):
+        """
+        Set the dispersion object for a model parameter
+        
+        :param parameter: name of the parameter [string]
+        :param dispersion: dispersion object of type DispersionModel
+        
+        """
+        return CCappedCylinderModel.set_dispersion(self, parameter, dispersion.cdisp)
+        
+   
+# End of file
Index: sansmodels/src/sans/models/CoreFourShellModel.py
===================================================================
--- sansmodels/src/sans/models/CoreFourShellModel.py	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/CoreFourShellModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -37,6 +37,6 @@
     List of default parameters:
          scale           = 1.0 
-         rad_core        = 60.0 [A]
-         sld_core        = 6.4e-006 [1/A^(2)]
+         rad_core0       = 60.0 [A]
+         sld_core0       = 6.4e-006 [1/A^(2)]
          thick_shell1    = 10.0 [A]
          sld_shell1      = 1e-006 [1/A^(2)]
@@ -64,6 +64,6 @@
         self.description =""" Calculates the scattering intensity from a core-4 shell structure.
 		scale = scale factor * volume fraction
-		rad_core: the radius of the core
-		sld_core: the SLD of the core
+		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
@@ -74,6 +74,6 @@
         self.details = {}
         self.details['scale'] = ['', None, None]
-        self.details['rad_core'] = ['[A]', None, None]
-        self.details['sld_core'] = ['[1/A^(2)]', None, None]
+        self.details['rad_core0'] = ['[A]', None, None]
+        self.details['sld_core0'] = ['[1/A^(2)]', None, None]
         self.details['thick_shell1'] = ['[A]', None, None]
         self.details['sld_shell1'] = ['[1/A^(2)]', None, None]
@@ -88,5 +88,5 @@
 
         ## fittable parameters
-        self.fixed=['thick_shell4.width', 'thick_shell1.width', 'thick_shell2.width', 'thick_shell3.width', 'rad_core.width']
+        self.fixed=['thick_shell4.width', 'thick_shell1.width', 'thick_shell2.width', 'thick_shell3.width', 'rad_core0.width']
         
         ## non-fittable parameters
Index: sansmodels/src/sans/models/CoreMultiShellModel.py
===================================================================
--- sansmodels/src/sans/models/CoreMultiShellModel.py	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/CoreMultiShellModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -3,5 +3,5 @@
 from sans.models.CoreFourShellModel import CoreFourShellModel
 import copy
-max_nshells = 4
+max_nshells = 5
 class CoreMultiShellModel(BaseComponent):
     """
@@ -42,6 +42,9 @@
         self._set_fixed_params()  
         
-        ## functional multiplicity of the model
-        self.multiplicity = 5
+        ## 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:
@@ -91,5 +94,5 @@
             nshell = 0
             if name.split('_')[0] == 'thick' or name.split('_')[0] == 'sld':
-                if name.split('_')[1] == 'solv' or name.split('_')[1] == 'core':
+                if name.split('_')[1] == 'solv' or name.split('_')[1] == 'core0':
                     self.params[name]= value
                     continue
@@ -146,8 +149,8 @@
         # for core at r=0
         r.append(0)
-        beta.append(self.params['sld_core'])
+        beta.append(self.params['sld_core0'])
         # for core at r=rad_core
-        r.append(self.params['rad_core'])
-        beta.append(self.params['sld_core'])
+        r.append(self.params['rad_core0'])
+        beta.append(self.params['sld_core0'])
         
         # for shells
Index: sansmodels/src/sans/models/OnionModel.py
===================================================================
--- sansmodels/src/sans/models/OnionModel.py	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/OnionModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -38,6 +38,6 @@
          n_shells        = 1.0 
          scale           = 1.0 
-         rad_core        = 200.0 [A]
-         sld_core        = 1e-006 [1/A^(2)]
+         rad_core0       = 200.0 [A]
+         sld_core0       = 1e-006 [1/A^(2)]
          sld_solv        = 6.4e-006 [1/A^(2)]
          background      = 0.0 [1/cm]
@@ -122,7 +122,7 @@
 		
 		background:background,
-		rad_core: radius of sphere(core)
+		rad_core0: radius of sphere(core)
 		thick_shell#:the thickness of the shell#
-		sld_core: the SLD of the sphere
+		sld_core0: the SLD of the sphere
 		sld_solv: the SLD of the solvent
 		sld_shell: the SLD of the shell#
@@ -133,6 +133,6 @@
         self.details['n_shells'] = ['', None, None]
         self.details['scale'] = ['', None, None]
-        self.details['rad_core'] = ['[A]', None, None]
-        self.details['sld_core'] = ['[1/A^(2)]', None, None]
+        self.details['rad_core0'] = ['[A]', None, None]
+        self.details['sld_core0'] = ['[1/A^(2)]', None, None]
         self.details['sld_solv'] = ['[1/A^(2)]', None, None]
         self.details['background'] = ['[1/cm]', None, None]
@@ -189,5 +189,5 @@
 
         ## fittable parameters
-        self.fixed=['rad_core.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']
+        self.fixed=['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']
         
         ## non-fittable parameters
Index: sansmodels/src/sans/models/RPA10Model.py
===================================================================
--- sansmodels/src/sans/models/RPA10Model.py	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/RPA10Model.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -46,5 +46,15 @@
         
         ## functional multiplicity of the model
-        self.multiplicity = max_case_n
+        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):
Index: sansmodels/src/sans/models/ReflModel.py
===================================================================
--- sansmodels/src/sans/models/ReflModel.py	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/ReflModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -83,4 +83,16 @@
          func_inter9     = 0.0 
          func_inter10    = 0.0 
+         sldIM_flat1     = 0.0 
+         sldIM_flat2     = 0.0 
+         sldIM_flat3     = 0.0 
+         sldIM_flat4     = 0.0 
+         sldIM_flat5     = 0.0 
+         sldIM_flat6     = 0.0 
+         sldIM_flat7     = 0.0 
+         sldIM_flat8     = 0.0 
+         sldIM_flat9     = 0.0 
+         sldIM_flat10    = 0.0 
+         sldIM_sub0      = 0.0 
+         sldIM_medium    = 0.0 
 
     """
@@ -169,4 +181,16 @@
         self.details['func_inter9'] = ['', None, None]
         self.details['func_inter10'] = ['', None, None]
+        self.details['sldIM_flat1'] = ['', None, None]
+        self.details['sldIM_flat2'] = ['', None, None]
+        self.details['sldIM_flat3'] = ['', None, None]
+        self.details['sldIM_flat4'] = ['', None, None]
+        self.details['sldIM_flat5'] = ['', None, None]
+        self.details['sldIM_flat6'] = ['', None, None]
+        self.details['sldIM_flat7'] = ['', None, None]
+        self.details['sldIM_flat8'] = ['', None, None]
+        self.details['sldIM_flat9'] = ['', None, None]
+        self.details['sldIM_flat10'] = ['', None, None]
+        self.details['sldIM_sub0'] = ['', None, None]
+        self.details['sldIM_medium'] = ['', None, None]
 
         ## fittable parameters
Index: sansmodels/src/sans/models/ReflectivityModel.py
===================================================================
--- sansmodels/src/sans/models/ReflectivityModel.py	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/ReflectivityModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -49,6 +49,9 @@
         self.model.params['n_layers'] = self.n_layers
         
-        ## functional multiplicity of the model
-        self.multiplicity = max_nshells
+        ## 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']]
+
     
     def _clone(self, obj):
@@ -84,5 +87,7 @@
             n = 0
             pos = len(name.split('_'))-1
-            if name.split('_')[0] == 'func':
+            if name.split('_')[0] == 'sldIM':
+                continue
+            elif name.split('_')[0] == 'func':
                 n= -1
                 while n<self.n_layers:
@@ -141,5 +146,8 @@
                     if key.split('_')[1] == 'flat%s' % str(nshell+1):
                         try:
-                            value = self.model.params['sld_medium']
+                            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: pass
Index: sansmodels/src/sans/models/SphereExpShellModel.py
===================================================================
--- sansmodels/src/sans/models/SphereExpShellModel.py	(revision fbae8817f74c42a391633060105ffce089adeff9)
+++ sansmodels/src/sans/models/SphereExpShellModel.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -39,4 +39,9 @@
         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:
@@ -146,8 +151,8 @@
         # for core at r=0
         r.append(0)
-        beta.append(self.params['sld_core'])
+        beta.append(self.params['sld_core0'])
         # for core at r=rad_core
-        r.append(self.params['rad_core'])
-        beta.append(self.params['sld_core'])
+        r.append(self.params['rad_core0'])
+        beta.append(self.params['sld_core0'])
         
         # for shells
Index: sansmodels/src/sans/models/c_extensions/barbell.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/barbell.c	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_extensions/barbell.c	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,174 @@
+/*
+ * Scattering model for a BarBell
+ */
+#include "barbell.h"
+#include <math.h>
+#include "GaussWeights.h"
+#include "libCylinder.h"
+
+/**
+ * Function to evaluate 1D scattering function
+ * @param pars: parameters of the BarBell
+ * @param q: q-value
+ * @return: function value
+ */
+double barbell_analytical_1D(BarBellParameters *pars, double q) {
+	double dp[7];
+	double result;
+
+	dp[0] = pars->scale;
+	dp[1] = pars->rad_bar;
+	dp[2] = pars->len_bar;
+	dp[3] = pars->rad_bell;
+	dp[4] = pars->sld_barbell;
+	dp[5] = pars->sld_solv;
+	dp[6] = pars->background;
+
+	result = Barbell(dp, q);
+	// Make Sure it never goes to inf/nan.
+	if ( result == INFINITY || result == NAN){
+		result = pars->background;
+	}
+	return result;
+}
+
+
+double bar2d_kernel(double dp[], double q, double alpha) {
+	int i,j;
+	double Pi;
+	double scale,contr,bkg,sldc,slds;
+	double len,rad,hDist,endRad;
+	int nordj=76;
+	double zi=alpha,yyy,answer;			//running tally of integration
+	double summj,vaj,vbj,zij;			//for the inner integration
+	double arg1,arg2,inner,be;
+
+
+	scale = dp[0];
+	rad = dp[1];
+	len = dp[2];
+	endRad = dp[3];
+	sldc = dp[4];
+	slds = dp[5];
+	bkg = dp[6];
+
+	hDist = sqrt(fabs(endRad*endRad-rad*rad));		//by definition for this model
+
+	contr = sldc-slds;
+
+	Pi = 4.0*atan(1.0);
+	vaj = -1.0*hDist/endRad;
+	vbj = 1.0;		//endpoints of inner integral
+
+	summj=0.0;
+
+	for(j=0;j<nordj;j++) {
+		//20 gauss points for the inner integral
+		zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
+		yyy = Gauss76Wt[j] * Dumb_kernel(dp,q,zij,zi);		//uses the same Kernel as the Dumbbell, here L>0
+		summj += yyy;
+	}
+	//now calculate the value of the inner integral
+	inner = (vbj-vaj)/2.0*summj;
+	inner *= 4.0*Pi*endRad*endRad*endRad;
+
+	//now calculate outer integrand
+	arg1 = q*len/2.0*cos(zi);
+	arg2 = q*rad*sin(zi);
+	yyy = inner;
+
+	if(arg2 == 0) {
+		be = 0.5;
+	} else {
+		be = NR_BessJ1(arg2)/arg2;
+	}
+
+	if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
+		yyy += Pi*rad*rad*len*2.0*be;
+	} else {
+		yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
+	}
+	yyy *= yyy;   //sin(zi);
+	answer = yyy;
+
+
+	answer /= Pi*rad*rad*len + 2.0*Pi*(2.0*endRad*endRad*endRad/3.0+endRad*endRad*hDist-hDist*hDist*hDist/3.0);		//divide by volume
+	answer *= 1.0e8;		//convert to cm^-1
+	answer *= contr*contr;
+	answer *= scale;
+	answer += bkg;
+
+	return answer;
+}
+
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the BarBell
+ * @param q: q-value
+ * @return: function value
+ */
+double barbell_analytical_2DXY(BarBellParameters *pars, double qx, double qy){
+	double q;
+	q = sqrt(qx*qx+qy*qy);
+	return barbell_analytical_2D_scaled(pars, q, qx/q, qy/q);
+}
+
+double barbell_analytical_2D(BarBellParameters *pars, double q, double phi) {
+	return barbell_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the BarBell
+ * @param q: q-value
+ * @param q_x: q_x / q
+ * @param q_y: q_y / q
+ * @return: function value
+ */
+double barbell_analytical_2D_scaled(BarBellParameters *pars, double q, double q_x, double q_y) {
+	double cyl_x, cyl_y, cyl_z;
+	double q_z;
+	double alpha, vol, cos_val;
+	double answer;
+	double dp[7];
+
+	dp[0] = pars->scale;
+	dp[1] = pars->rad_bar;
+	dp[2] = pars->len_bar;
+	dp[3] = pars->rad_bell;
+	dp[4] = pars->sld_barbell;
+	dp[5] = pars->sld_solv;
+	dp[6] = pars->background;
+
+
+	//double Pi = 4.0*atan(1.0);
+    // Cylinder orientation
+    cyl_x = sin(pars->theta) * cos(pars->phi);
+    cyl_y = sin(pars->theta) * sin(pars->phi);
+    cyl_z = cos(pars->theta);
+
+    // q vector
+    q_z = 0;
+
+    // Compute the angle btw vector q and the
+    // axis of the cylinder
+    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
+
+    // The following test should always pass
+    if (fabs(cos_val)>1.0) {
+    	printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
+     	return 0;
+    }
+
+    // Note: cos(alpha) = 0 and 1 will get an
+    // undefined value from CylKernel
+	alpha = acos( cos_val );
+
+	// Call the IGOR library function to get the kernel
+	answer = bar2d_kernel(dp, q, alpha)/sin(alpha);
+
+
+	return answer;
+
+}
Index: sansmodels/src/sans/models/c_extensions/barbell.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/barbell.h	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_extensions/barbell.h	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,79 @@
+#if !defined(barbell_h)
+#define barbell_h
+
+/**
+ * Structure definition for BarBell parameters
+ */
+ //[PYTHONCLASS] = BarBellModel
+ //[DISP_PARAMS] = rad_bar,len_bar,rad_bell,phi,  theta
+ //[DESCRIPTION] =<text>Calculates the scattering from a barbell-shaped cylinder. That is
+ //				a sphereocylinder with spherical end caps
+ //				that have a radius larger than that of
+ //				the cylinder and the center of the end cap
+ //				radius lies outside of the cylinder.
+ //				Note: As the length of cylinder(bar) -->0,
+ //				it becomes a dumbbell.
+ //				And when rad_bar = rad_bell,
+ //				it is a spherocylinder.
+ //				It must be that rad_bar <(=) rad_bell.
+ //				[Parameters];
+ //				scale: volume fraction of spheres,
+ //				background:incoherent background,
+ //				rad_bar: radius of the cylindrical bar,
+ //				len_bar: length of the cylindrical bar,
+ //				rad_bell: radius of the spherical bell,
+ //				sld_barbell: SLD of the barbell,
+ //				sld_solv: SLD of the solvent.
+ //		</text>
+ //[FIXED]=  rad_bar.width;len_bar;rad_bell;phi.width; theta.width
+ //[ORIENTATION_PARAMS]= <text> phi; theta; phi.width; theta.width</text>
+
+typedef struct {
+    /// Scale factor
+    //  [DEFAULT]=scale= 1.0
+    double scale;
+
+    ///	rad_bar [A]
+    //  [DEFAULT]=rad_bar=20.0 [A]
+    double rad_bar;
+
+    ///	length of the bar [A]
+    //  [DEFAULT]=len_bar=400.0 [A]
+    double len_bar;
+
+    ///	Radius of sphere [A]
+    //  [DEFAULT]=rad_bell=40.0 [A]
+    double rad_bell;
+
+    ///	sld_barbell [1/A^(2)]
+    //  [DEFAULT]=sld_barbell= 1.0e-6 [1/A^(2)]
+    double sld_barbell;
+
+    ///	sld_solv [1/A^(2)]
+    //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)]
+    double sld_solv;
+
+	/// Incoherent Background [1/cm]
+	//  [DEFAULT]=background=0.0 [1/cm]
+	double background;
+
+    /// Angle of the main axis against z-axis in detector plane [rad]
+    //  [DEFAULT]=theta=0.0 [rad]
+    double theta;
+    /// Azimuthal angle around z-axis in detector plane [rad]
+    //  [DEFAULT]=phi=0.0 [rad]
+    double phi;
+
+} BarBellParameters;
+
+
+
+/// 1D scattering function
+double barbell_analytical_1D(BarBellParameters *pars, double q);
+
+/// 2D scattering function
+double barbell_analytical_2D(BarBellParameters *pars, double q, double phi);
+double barbell_analytical_2DXY(BarBellParameters *pars, double qx, double qy);
+double barbell_analytical_2D_scaled(BarBellParameters *pars, double q, double q_x, double q_y);
+
+#endif
Index: sansmodels/src/sans/models/c_extensions/capcyl.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/capcyl.c	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_extensions/capcyl.c	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,174 @@
+/*
+ * Scattering model for a Capped Cylinder
+ */
+#include "capcyl.h"
+#include <math.h>
+#include "GaussWeights.h"
+#include "libCylinder.h"
+
+/**
+ * Function to evaluate 1D scattering function
+ * @param pars: parameters of the CappedCylinder
+ * @param q: q-value
+ * @return: function value
+ */
+double capcyl_analytical_1D(CapCylParameters *pars, double q) {
+	double dp[7];
+	double result;
+
+	dp[0] = pars->scale;
+	dp[1] = pars->rad_cyl;
+	dp[2] = pars->len_cyl;
+	dp[3] = pars->rad_cap;
+	dp[4] = pars->sld_capcyl;
+	dp[5] = pars->sld_solv;
+	dp[6] = pars->background;
+
+	result = CappedCylinder(dp, q);
+	// Make Sure it never goes to inf/nan.
+	if ( result == INFINITY || result == NAN){
+		result = pars->background;
+	}
+	return result;
+}
+
+
+double capcyl2d_kernel(double dp[], double q, double alpha) {
+	int i,j;
+	double Pi;
+	double scale,contr,bkg,sldc,slds;
+	double len,rad,hDist,endRad;
+	int nordj=76;
+	double zi=alpha,yyy,answer;			//running tally of integration
+	double summj,vaj,vbj,zij;			//for the inner integration
+	double arg1,arg2,inner,be;
+
+
+	scale = dp[0];
+	rad = dp[1];
+	len = dp[2];
+	endRad = dp[3];
+	sldc = dp[4];
+	slds = dp[5];
+	bkg = dp[6];
+
+	hDist = -1.0*sqrt(fabs(endRad*endRad-rad*rad));		//by definition for this model
+
+	contr = sldc-slds;
+
+	Pi = 4.0*atan(1.0);
+	vaj = -1.0*hDist/endRad;
+	vbj = 1.0;		//endpoints of inner integral
+
+	summj=0.0;
+
+	for(j=0;j<nordj;j++) {
+		//20 gauss points for the inner integral
+		zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;		//the "t" dummy
+		yyy = Gauss76Wt[j] * ConvLens_kernel(dp,q,zij,zi);		//uses the same Kernel as the Dumbbell, here L>0
+		summj += yyy;
+	}
+	//now calculate the value of the inner integral
+	inner = (vbj-vaj)/2.0*summj;
+	inner *= 4.0*Pi*endRad*endRad*endRad;
+
+	//now calculate outer integrand
+	arg1 = q*len/2.0*cos(zi);
+	arg2 = q*rad*sin(zi);
+	yyy = inner;
+
+	if(arg2 == 0) {
+		be = 0.5;
+	} else {
+		be = NR_BessJ1(arg2)/arg2;
+	}
+
+	if(arg1 == 0.0) {		//limiting value of sinc(0) is 1; sinc is not defined in math.h
+		yyy += Pi*rad*rad*len*2.0*be;
+	} else {
+		yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
+	}
+	yyy *= yyy;   //sin(zi);
+	answer = yyy;
+
+
+	answer /= Pi*rad*rad*len + 2.0*Pi*(2.0*endRad*endRad*endRad/3.0+endRad*endRad*hDist-hDist*hDist*hDist/3.0);		//divide by volume
+	answer *= 1.0e8;		//convert to cm^-1
+	answer *= contr*contr;
+	answer *= scale;
+	answer += bkg;
+
+	return answer;
+}
+
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the BarBell
+ * @param q: q-value
+ * @return: function value
+ */
+double capcyl_analytical_2DXY(CapCylParameters *pars, double qx, double qy){
+	double q;
+	q = sqrt(qx*qx+qy*qy);
+	return capcyl_analytical_2D_scaled(pars, q, qx/q, qy/q);
+}
+
+double capcyl_analytical_2D(CapCylParameters *pars, double q, double phi) {
+	return capcyl_analytical_2D_scaled(pars, q, cos(phi), sin(phi));
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the BarBell
+ * @param q: q-value
+ * @param q_x: q_x / q
+ * @param q_y: q_y / q
+ * @return: function value
+ */
+double capcyl_analytical_2D_scaled(CapCylParameters *pars, double q, double q_x, double q_y) {
+	double cyl_x, cyl_y, cyl_z;
+	double q_z;
+	double alpha, vol, cos_val;
+	double answer;
+	double dp[7];
+
+	dp[0] = pars->scale;
+	dp[1] = pars->rad_cyl;
+	dp[2] = pars->len_cyl;
+	dp[3] = pars->rad_cap;
+	dp[4] = pars->sld_capcyl;
+	dp[5] = pars->sld_solv;
+	dp[6] = pars->background;
+
+
+	//double Pi = 4.0*atan(1.0);
+    // Cylinder orientation
+    cyl_x = sin(pars->theta) * cos(pars->phi);
+    cyl_y = sin(pars->theta) * sin(pars->phi);
+    cyl_z = cos(pars->theta);
+
+    // q vector
+    q_z = 0;
+
+    // Compute the angle btw vector q and the
+    // axis of the cylinder
+    cos_val = cyl_x*q_x + cyl_y*q_y + cyl_z*q_z;
+
+    // The following test should always pass
+    if (fabs(cos_val)>1.0) {
+    	printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
+     	return 0;
+    }
+
+    // Note: cos(alpha) = 0 and 1 will get an
+    // undefined value from CylKernel
+	alpha = acos( cos_val );
+
+	// Call the IGOR library function to get the kernel
+	answer = capcyl2d_kernel(dp, q, alpha)/sin(alpha);
+
+
+	return answer;
+
+}
Index: sansmodels/src/sans/models/c_extensions/capcyl.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/capcyl.h	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_extensions/capcyl.h	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,77 @@
+#if !defined(capcyl_h)
+#define capcyl_h
+
+/**
+ * Structure definition for CappedCylinder parameters
+ */
+ //[PYTHONCLASS] = CappedCylinderModel
+ //[DISP_PARAMS] = rad_cyl,len_cyl,rad_cap,phi,  theta
+ //[DESCRIPTION] =<text>Calculates the scattering from a cylinder with spherical
+ //				section end-caps. That is, a sphereocylinder
+ //				with end caps that have a radius larger than
+ //				that of the cylinder and the center of the
+ //				end cap radius lies within the cylinder.
+ //				Note: As the length of cylinder -->0,
+ //				it becomes a ConvexLens.
+ //				It must be that rad_cyl <(=) rad_cap.
+ //				[Parameters];
+ //				scale: volume fraction of spheres,
+ //				background:incoherent background,
+ //				rad_cyl: radius of the cylinder,
+ //				len_cyl: length of the cylinder,
+ //				rad_cap: radius of the semi-spherical cap,
+ //				sld_capcyl: SLD of the capped cylinder,
+ //				sld_solv: SLD of the solvent.
+ //		</text>
+ //[FIXED]=  rad_cyl.width;len_cyl;rad_cap;phi.width; theta.width
+ //[ORIENTATION_PARAMS]= <text> phi; theta; phi.width; theta.width</text>
+
+typedef struct {
+    /// Scale factor
+    //  [DEFAULT]=scale= 1.0
+    double scale;
+
+    ///	rad_cyl [A]
+    //  [DEFAULT]=rad_cyl=20.0 [A]
+    double rad_cyl;
+
+    ///	length of the cylinder
+    //  [DEFAULT]=len_cyl=400.0 [A]
+    double len_cyl;
+
+    ///	Radius of sphere [A]
+    //  [DEFAULT]=rad_cap=40.0 [A]
+    double rad_cap;
+
+    ///	sld_capcyl [1/A^(2)]
+    //  [DEFAULT]=sld_capcyl= 1.0e-6 [1/A^(2)]
+    double sld_capcyl;
+
+    ///	sld_solv [1/A^(2)]
+    //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)]
+    double sld_solv;
+
+	/// Incoherent Background [1/cm]
+	//  [DEFAULT]=background=0.0 [1/cm]
+	double background;
+
+    /// Angle of the main axis against z-axis in detector plane [rad]
+    //  [DEFAULT]=theta=0.0 [rad]
+    double theta;
+    /// Azimuthal angle around z-axis in detector plane [rad]
+    //  [DEFAULT]=phi=0.0 [rad]
+    double phi;
+
+} CapCylParameters;
+
+
+
+/// 1D scattering function
+double capcyl_analytical_1D(CapCylParameters *pars, double q);
+
+/// 2D scattering function
+double capcyl_analytical_2D(CapCylParameters *pars, double q, double phi);
+double capcyl_analytical_2DXY(CapCylParameters *pars, double qx, double qy);
+double capcyl_analytical_2D_scaled(CapCylParameters *pars, double q, double q_x, double q_y);
+
+#endif
Index: sansmodels/src/sans/models/c_extensions/corefourshell.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/corefourshell.c	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ sansmodels/src/sans/models/c_extensions/corefourshell.c	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -18,6 +18,6 @@
 
 	dp[0] = pars->scale;
-	dp[1] = pars->rad_core;
-	dp[2] = pars->sld_core;
+	dp[1] = pars->rad_core0;
+	dp[2] = pars->sld_core0;
 	dp[3] = pars->thick_shell1;
 	dp[4] = pars->sld_shell1;
Index: sansmodels/src/sans/models/c_extensions/corefourshell.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/corefourshell.h	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ sansmodels/src/sans/models/c_extensions/corefourshell.h	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -6,9 +6,9 @@
  */
  //[PYTHONCLASS] = CoreFourShellModel
- //[DISP_PARAMS] = rad_core, thick_shell1,thick_shell2,thick_shell3,thick_shell4
+ //[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_core: the radius of the core
- //				sld_core: the SLD of the core
+ //				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
@@ -16,5 +16,5 @@
  //				background: incoherent background
  //		</text>
- //[FIXED]=<text>  thick_shell4.width; thick_shell1.width;thick_shell2.width;thick_shell3.width;rad_core.width </text>
+ //[FIXED]=<text>  thick_shell4.width; thick_shell1.width;thick_shell2.width;thick_shell3.width;rad_core0.width </text>
  //[ORIENTATION_PARAMS]= <text> </text>
 
@@ -24,11 +24,11 @@
     double scale;
 
-    ///	Radius of the core [A]
-    //  [DEFAULT]=rad_core=60. [A]
-    double rad_core;
+    ///	Radius of the core0 [A]
+    //  [DEFAULT]=rad_core0=60. [A]
+    double rad_core0;
 
-    ///	sld of core [1/A^(2)]
-    //  [DEFAULT]=sld_core= 6.4e-6 [1/A^(2)]
-    double sld_core;
+    ///	sld of core0 [1/A^(2)]
+    //  [DEFAULT]=sld_core0= 6.4e-6 [1/A^(2)]
+    double sld_core0;
 
     ///	thickness of the shell1 [A]
Index: sansmodels/src/sans/models/c_extensions/fcc.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/fcc.c	(revision d5b6a9d7cd9e26b5f9e28e55e8cf848a40de6ae9)
+++ sansmodels/src/sans/models/c_extensions/fcc.c	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -65,5 +65,5 @@
 	double answer;
 	double Pi = 4.0*atan(1.0);
-	double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2;
+	double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2,contrast;
 
 	double dp[5];
@@ -77,4 +77,5 @@
 	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);
@@ -133,5 +134,5 @@
 
 	// Use SphereForm directly from libigor
-	answer = SphereForm(dp,q)*Zq;
+	answer = SphereForm_Paracrystal(pars->radius,contrast,q)*Zq;
 
 	//consider scales
Index: sansmodels/src/sans/models/c_extensions/onion.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/onion.c	(revision a1b247163dd00d4b19fd556819b00a9ccf638299)
+++ sansmodels/src/sans/models/c_extensions/onion.c	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -11,6 +11,6 @@
 	int n = dp[0];
 	double scale = dp[1];
-	double rad_core = dp[2];
-	double sld_core = dp[3];
+	double rad_core0 = dp[2];
+	double sld_core0 = dp[3];
 	double sld_solv = dp[4];
 	double background = dp[5];
@@ -30,9 +30,9 @@
 		fun_type[i] = dp[i+45];
 	}
-	sld_out[0] = sld_core;
+	sld_out[0] = sld_core0;
 	sld_out[n+1] = sld_solv;
-	sld_in[0] = sld_core;
+	sld_in[0] = sld_core0;
 	sld_in[n+1] = sld_solv;
-	thick[0] = rad_core;
+	thick[0] = rad_core0;
 	thick[n+1] = 1e+10;
 	A[0] = 0.0;
@@ -69,5 +69,5 @@
 					}
 					else{
-						slope[i] = (sld_out[i]-sld_in[i])/(exp(A[i])-1);
+						slope[i] = (sld_out[i]-sld_in[i])/(exp(A[i])-1.0);
 					}
                     for (j=0; j<2; j++){
@@ -174,6 +174,6 @@
 	dp[0] = pars->n_shells;
 	dp[1] = pars->scale;
-	dp[2] = pars->rad_core;
-	dp[3] = pars->sld_core;
+	dp[2] = pars->rad_core0;
+	dp[3] = pars->sld_core0;
 	dp[4] = pars->sld_solv;
 	dp[5] = pars->background;
Index: sansmodels/src/sans/models/c_extensions/onion.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/onion.h	(revision 7381f345e4f06f419f41279b0c7ddf73d3d8c755)
+++ sansmodels/src/sans/models/c_extensions/onion.h	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -6,5 +6,5 @@
  */
  //[PYTHONCLASS] = OnionModel
- //[DISP_PARAMS] = rad_core, thick_shell1,thick_shell2,thick_shell3,thick_shell4, thick_shell5,thick_shell6,thick_shell7,thick_shell8,thick_shell9,thick_shell10
+ //[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;
@@ -24,12 +24,12 @@
  //
  //				background:background,
- //				rad_core: radius of sphere(core)
+ //				rad_core0: radius of sphere(core)
  //				thick_shell#:the thickness of the shell#
- //				sld_core: the SLD of the sphere
+ //				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_core.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>
+ //[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>
 
@@ -42,9 +42,9 @@
 	double scale;
     ///	Radius of sphere [A]
-    //  [DEFAULT]=rad_core=200.0 [A]
-	double rad_core;
+    //  [DEFAULT]=rad_core0=200.0 [A]
+	double rad_core0;
 	///	sld_core [1/A^(2)]
-	//  [DEFAULT]=sld_core= 1.0e-6 [1/A^(2)]
-	double sld_core;
+	//  [DEFAULT]=sld_core0= 1.0e-6 [1/A^(2)]
+	double sld_core0;
 	///	sld_solv [1/A^(2)]
 	//  [DEFAULT]=sld_solv= 6.4e-6 [1/A^(2)]
Index: sansmodels/src/sans/models/c_extensions/refl.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/refl.c	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/c_extensions/refl.c	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -268,5 +268,5 @@
 	double background = dp[6];
 
-	double sld[n+2],sld_nul[n+2],thick_inter[n+2],thick[n+2],total_thick;
+	double sld[n+2],sld_im[n+2],thick_inter[n+2],thick[n+2],total_thick;
 	fun_type[0] = dp[3];
 	for (i =1; i<=n; i++){
@@ -275,4 +275,5 @@
 		thick[i] = dp[i+26];
 		fun_type[i] = dp[i+36];
+		sld_im[i] = dp[i+46];
 
 		total_thick += thick[i] + thick_inter[i];
@@ -280,4 +281,6 @@
 	sld[0] = sld_sub;
 	sld[n+1] = sld_super;
+	sld_im[0] = fabs(dp[0+56]);
+	sld_im[n+1] = fabs(dp[1+56]);
 	thick[0] = total_thick/5.0;
 	thick[n+1] = total_thick/5.0;
@@ -287,5 +290,5 @@
 	double nsl=21.0; //nsl = Num_sub_layer:  MUST ODD number in double //no other number works now
 	int n_s, floor_nsl;
-    double sld_i,dz,phi,R,ko2;
+    double sld_i,sldim_i,dz,phi,R,ko2;
     double sign,erfunc;
     double pi;
@@ -300,6 +303,6 @@
 	//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);
+    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);
 
@@ -323,10 +326,22 @@
 					dz = thick[i];
 					sld_i = sld[i];
+					sldim_i = sld_im[i];
 				}
 				else{
 					dz = thick_inter[i-1]/nsl;
-					sld_i = interfunc(fun_type[i-1],nsl, n_s, sld[i-1], sld[i]);
+					if (sld[i-1] == sld[i]){
+						sld_i = sld[i];
+					}
+					else{
+						sld_i = interfunc(fun_type[i-1],nsl, n_s, sld[i-1], sld[i]);
+					}
+					if (sld_im[i-1] == sld_im[i]){
+						sldim_i = sld_im[i];
+					}
+					else{
+						sldim_i = interfunc(fun_type[i-1],nsl, n_s, sld_im[i-1], sld_im[i]);
+					}
 				}
-				nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),0.0);
+				nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sldim_i);
 				nn2=cmult(nn,nn);
 
@@ -366,5 +381,5 @@
  */
 double refl_analytical_1D(ReflParameters *pars, double q) {
-	double dp[47];
+	double dp[59];
 
 	dp[0] = pars->n_layers;
@@ -420,4 +435,18 @@
 	dp[46] = pars->func_inter10;
 
+	dp[47] = pars->sldIM_flat1;
+	dp[48] = pars->sldIM_flat2;
+	dp[49] = pars->sldIM_flat3;
+	dp[50] = pars->sldIM_flat4;
+	dp[51] = pars->sldIM_flat5;
+	dp[52] = pars->sldIM_flat6;
+	dp[53] = pars->sldIM_flat7;
+	dp[54] = pars->sldIM_flat8;
+	dp[55] = pars->sldIM_flat9;
+	dp[56] = pars->sldIM_flat10;
+
+	dp[57] = pars->sldIM_sub0;
+	dp[58] = pars->sldIM_medium;
+
 	return re_kernel(dp, q);
 }
Index: sansmodels/src/sans/models/c_extensions/refl.h
===================================================================
--- sansmodels/src/sans/models/c_extensions/refl.h	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/c_extensions/refl.h	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -142,4 +142,28 @@
     double func_inter10;
 
+    //  [DEFAULT]=sldIM_flat1=0
+    double sldIM_flat1;
+    //  [DEFAULT]=sldIM_flat2=0
+    double sldIM_flat2;
+    //  [DEFAULT]=sldIM_flat3=0
+    double sldIM_flat3;
+    //  [DEFAULT]=sldIM_flat4=0
+    double sldIM_flat4;
+    //  [DEFAULT]=sldIM_flat5=0
+    double sldIM_flat5;
+    //  [DEFAULT]=sldIM_flat6=0
+    double sldIM_flat6;
+    //  [DEFAULT]=sldIM_flat7=0
+    double sldIM_flat7;
+    //  [DEFAULT]=sldIM_flat8=0
+    double sldIM_flat8;
+    //  [DEFAULT]=sldIM_flat9=0
+    double sldIM_flat9;
+    //  [DEFAULT]=sldIM_flat10=0
+    double sldIM_flat10;
+    //  [DEFAULT]=sldIM_sub0=0
+    double sldIM_sub0;
+    //  [DEFAULT]=sldIM_medium=0
+    double sldIM_medium;
 
 } ReflParameters;
Index: sansmodels/src/sans/models/c_models/CBarBellModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CBarBellModel.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_models/CBarBellModel.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,625 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/** CBarBellModel
+ *
+ * C extension 
+ *
+ * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
+ *          DO NOT MODIFY THIS FILE, MODIFY barbell.h
+ *          AND RE-RUN THE GENERATOR SCRIPT
+ *
+ */
+#define NO_IMPORT_ARRAY
+#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
+ 
+extern "C" {
+#include <Python.h>
+#include <arrayobject.h>
+#include "structmember.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+#include "barbell.h"
+}
+
+#include "models.hh"
+#include "dispersion_visitor.hh"
+
+/// Error object for raised exceptions
+static PyObject * CBarBellModelError = NULL;
+
+
+// Class definition
+typedef struct {
+    PyObject_HEAD
+    /// Parameters
+    PyObject * params;
+    /// Dispersion parameters
+    PyObject * dispersion;
+    /// Underlying model object
+    BarBellModel * model;
+    /// Log for unit testing
+    PyObject * log;
+} CBarBellModel;
+
+
+static void
+CBarBellModel_dealloc(CBarBellModel* self)
+{
+    Py_DECREF(self->params);
+    Py_DECREF(self->dispersion);
+    Py_DECREF(self->log);
+    delete self->model;
+    self->ob_type->tp_free((PyObject*)self);
+    
+
+}
+
+static PyObject *
+CBarBellModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+    CBarBellModel *self;
+    
+    self = (CBarBellModel *)type->tp_alloc(type, 0);
+   
+    return (PyObject *)self;
+}
+
+static int
+CBarBellModel_init(CBarBellModel *self, PyObject *args, PyObject *kwds)
+{
+    if (self != NULL) {
+    	
+    	// Create parameters
+        self->params = PyDict_New();
+        self->dispersion = PyDict_New();
+        self->model = new BarBellModel();
+        
+        // Initialize parameter dictionary
+        PyDict_SetItemString(self->params,"phi",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
+        PyDict_SetItemString(self->params,"sld_barbell",Py_BuildValue("d",0.000001000000));
+        PyDict_SetItemString(self->params,"len_bar",Py_BuildValue("d",400.000000000000));
+        PyDict_SetItemString(self->params,"rad_bell",Py_BuildValue("d",40.000000000000));
+        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"theta",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"rad_bar",Py_BuildValue("d",20.000000000000));
+        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006300000));
+        // Initialize dispersion / averaging parameter dict
+        DispersionVisitor* visitor = new DispersionVisitor();
+        PyObject * disp_dict;
+        disp_dict = PyDict_New();
+        self->model->rad_bar.dispersion->accept_as_source(visitor, self->model->rad_bar.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "rad_bar", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->len_bar.dispersion->accept_as_source(visitor, self->model->len_bar.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "len_bar", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->rad_bell.dispersion->accept_as_source(visitor, self->model->rad_bell.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "rad_bell", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->phi.dispersion->accept_as_source(visitor, self->model->phi.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "phi", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->theta.dispersion->accept_as_source(visitor, self->model->theta.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "theta", disp_dict);
+
+
+         
+        // Create empty log
+        self->log = PyDict_New();
+        
+        
+
+    }
+    return 0;
+}
+
+static PyMemberDef CBarBellModel_members[] = {
+    {"params", T_OBJECT, offsetof(CBarBellModel, params), 0,
+     "Parameters"},
+	{"dispersion", T_OBJECT, offsetof(CBarBellModel, dispersion), 0,
+	  "Dispersion parameters"},     
+    {"log", T_OBJECT, offsetof(CBarBellModel, log), 0,
+     "Log"},
+    {NULL}  /* Sentinel */
+};
+
+/** Read double from PyObject
+    @param p PyObject
+    @return double
+*/
+double CBarBellModel_readDouble(PyObject *p) {
+    if (PyFloat_Check(p)==1) {
+        return (double)(((PyFloatObject *)(p))->ob_fval);
+    } else if (PyInt_Check(p)==1) {
+        return (double)(((PyIntObject *)(p))->ob_ival);
+    } else if (PyLong_Check(p)==1) {
+        return (double)PyLong_AsLong(p);
+    } else {
+        return 0.0;
+    }
+}
+/**
+ * Function to call to evaluate model
+ * @param args: input numpy array q[] 
+ * @return: numpy array object 
+ */
+ 
+static PyObject *evaluateOneDim(BarBellModel* model, PyArrayObject *q){
+    PyArrayObject *result;
+   
+    // Check validity of array q , q must be of dimension 1, an array of double
+    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
+    {
+        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
+        //PyErr_SetString(PyExc_ValueError , message);
+        return NULL;
+    }
+    result = (PyArrayObject *)PyArray_FromDims(q->nd, (int *)(q->dimensions), 
+										  PyArray_DOUBLE);
+	if (result == NULL) {
+        const char * message= "Could not create result ";
+        PyErr_SetString(PyExc_RuntimeError , message);
+		return NULL;
+	}
+	 for (int i = 0; i < q->dimensions[0]; i++){
+      double q_value  = *(double *)(q->data + i*q->strides[0]);
+      double *result_value = (double *)(result->data + i*result->strides[0]);
+      *result_value =(*model)(q_value);
+	}
+    return PyArray_Return(result); 
+ }
+
+ /**
+ * Function to call to evaluate model
+ * @param args: input numpy array  [x[],y[]]
+ * @return: numpy array object 
+ */
+ static PyObject * evaluateTwoDimXY( BarBellModel* model, 
+                              PyArrayObject *x, PyArrayObject *y)
+ {
+    PyArrayObject *result;
+    int i,j, x_len, y_len, dims[1];
+    //check validity of input vectors
+    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
+        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
+        || y->dimensions[0] != x->dimensions[0]){
+        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
+        PyErr_SetString(PyExc_ValueError , message); 
+        return NULL;
+    }
+   
+	if (PyArray_Check(x) && PyArray_Check(y)) {
+		
+	    x_len = dims[0]= x->dimensions[0];
+        y_len = dims[0]= y->dimensions[0];
+	    
+	    // Make a new double matrix of same dims
+        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
+        if (result == NULL){
+	    const char * message= "Could not create result ";
+        PyErr_SetString(PyExc_RuntimeError , message);
+	    return NULL;
+	    }
+       
+        /* Do the calculation. */
+        for ( i=0; i< x_len; i++) {
+            double x_value = *(double *)(x->data + i*x->strides[0]);
+  		    double y_value = *(double *)(y->data + i*y->strides[0]);
+  			double *result_value = (double *)(result->data +
+  			      i*result->strides[0]);
+  			*result_value = (*model)(x_value, y_value);
+        }           
+        return PyArray_Return(result); 
+        
+        }else{
+		    PyErr_SetString(CBarBellModelError, 
+                   "CBarBellModel.evaluateTwoDimXY couldn't run.");
+	        return NULL;
+		}      	
+}
+/**
+ *  evalDistribution function evaluate a model function with input vector
+ *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
+ *
+ */ 
+static PyObject * evalDistribution(CBarBellModel *self, PyObject *args){
+	PyObject *qx, *qy;
+	PyArrayObject * pars;
+	int npars ,mpars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->sld_barbell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_barbell") );
+    self->model->len_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_bar") );
+    self->model->rad_bell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bell") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+    self->model->rad_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bar") );
+    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bar");
+    self->model->rad_bar.dispersion->accept_as_destination(visitor, self->model->rad_bar.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "len_bar");
+    self->model->len_bar.dispersion->accept_as_destination(visitor, self->model->len_bar.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bell");
+    self->model->rad_bell.dispersion->accept_as_destination(visitor, self->model->rad_bell.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
+    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
+    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CBarBellModelError, 
+	    	"CBarBellModel.evalDistribution expects a q value.");
+		return NULL;
+	}
+    // Check params
+	
+    if(PyArray_Check(pars)==1) {
+		
+	    // Length of list should 1 or 2
+	    npars = pars->nd; 
+	    if(npars==1) {
+	        // input is a numpy array
+	        if (PyArray_Check(pars)) {
+		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
+		    }
+		}else{
+		    PyErr_SetString(CBarBellModelError, 
+                   "CBarBellModel.evalDistribution expect numpy array of one dimension.");
+	        return NULL;
+		}
+    }else if( PyList_Check(pars)==1) {
+    	// Length of list should be 2 for I(qx,qy)
+	    mpars = PyList_GET_SIZE(pars); 
+	    if(mpars!=2) {
+	    	PyErr_SetString(CBarBellModelError, 
+	    		"CBarBellModel.evalDistribution expects a list of dimension 2.");
+	    	return NULL;
+	    }
+	     qx = PyList_GET_ITEM(pars,0);
+	     qy = PyList_GET_ITEM(pars,1);
+	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
+	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
+		           (PyArrayObject*)qy);
+		 }else{
+		    PyErr_SetString(CBarBellModelError, 
+                   "CBarBellModel.evalDistribution expect 2 numpy arrays in list.");
+	        return NULL;
+	     }
+	}
+	PyErr_SetString(CBarBellModelError, 
+                   "CBarBellModel.evalDistribution couln't be run.");
+	return NULL;
+	
+}
+
+/**
+ * Function to call to evaluate model
+ * @param args: input q or [q,phi]
+ * @return: function value
+ */
+static PyObject * run(CBarBellModel *self, PyObject *args) {
+	double q_value, phi_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->sld_barbell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_barbell") );
+    self->model->len_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_bar") );
+    self->model->rad_bell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bell") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+    self->model->rad_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bar") );
+    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bar");
+    self->model->rad_bar.dispersion->accept_as_destination(visitor, self->model->rad_bar.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "len_bar");
+    self->model->len_bar.dispersion->accept_as_destination(visitor, self->model->len_bar.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bell");
+    self->model->rad_bell.dispersion->accept_as_destination(visitor, self->model->rad_bell.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
+    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
+    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CBarBellModelError, 
+	    	"CBarBellModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(q,phi)
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CBarBellModelError, 
+	    		"CBarBellModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the q and phi values at which
+	    // to evaluate I(q,phi)
+	    q_value = CBarBellModel_readDouble(PyList_GET_ITEM(pars,0));
+	    phi_value = CBarBellModel_readDouble(PyList_GET_ITEM(pars,1));
+	    // Skip zero
+	    if (q_value==0) {
+	    	return Py_BuildValue("d",0.0);
+	    }
+		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		q_value = CBarBellModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(q_value));
+	}	
+}
+/**
+ * Function to call to calculate_ER
+ * @return: effective radius value 
+ */
+static PyObject * calculate_ER(CBarBellModel *self) {
+
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->sld_barbell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_barbell") );
+    self->model->len_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_bar") );
+    self->model->rad_bell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bell") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+    self->model->rad_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bar") );
+    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bar");
+    self->model->rad_bar.dispersion->accept_as_destination(visitor, self->model->rad_bar.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "len_bar");
+    self->model->len_bar.dispersion->accept_as_destination(visitor, self->model->len_bar.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bell");
+    self->model->rad_bell.dispersion->accept_as_destination(visitor, self->model->rad_bell.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
+    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
+    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
+
+		
+	return Py_BuildValue("d",(*(self->model)).calculate_ER());
+
+}
+/**
+ * Function to call to evaluate model in cartesian coordinates
+ * @param args: input q or [qx, qy]]
+ * @return: function value
+ */
+static PyObject * runXY(CBarBellModel *self, PyObject *args) {
+	double qx_value, qy_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->sld_barbell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_barbell") );
+    self->model->len_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_bar") );
+    self->model->rad_bell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bell") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+    self->model->rad_bar = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_bar") );
+    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bar");
+    self->model->rad_bar.dispersion->accept_as_destination(visitor, self->model->rad_bar.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "len_bar");
+    self->model->len_bar.dispersion->accept_as_destination(visitor, self->model->len_bar.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_bell");
+    self->model->rad_bell.dispersion->accept_as_destination(visitor, self->model->rad_bell.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
+    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
+    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CBarBellModelError, 
+	    	"CBarBellModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(qx, qy))
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CBarBellModelError, 
+	    		"CBarBellModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the qx and qy values at which
+	    // to evaluate I(qx,qy)
+	    qx_value = CBarBellModel_readDouble(PyList_GET_ITEM(pars,0));
+	    qy_value = CBarBellModel_readDouble(PyList_GET_ITEM(pars,1));
+	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		qx_value = CBarBellModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(qx_value));
+	}	
+}
+
+static PyObject * reset(CBarBellModel *self, PyObject *args) {
+    
+
+    return Py_BuildValue("d",0.0);
+}
+
+static PyObject * set_dispersion(CBarBellModel *self, PyObject *args) {
+	PyObject * disp;
+	const char * par_name;
+
+	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
+	    PyErr_SetString(CBarBellModelError,
+	    	"CBarBellModel.set_dispersion expects a DispersionModel object.");
+		return NULL;
+	}
+	void *temp = PyCObject_AsVoidPtr(disp);
+	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
+
+
+	// Ugliness necessary to go from python to C
+	    // TODO: refactor this
+    if (!strcmp(par_name, "rad_bar")) {
+        self->model->rad_bar.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "len_bar")) {
+        self->model->len_bar.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "rad_bell")) {
+        self->model->rad_bell.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "phi")) {
+        self->model->phi.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "theta")) {
+        self->model->theta.dispersion = dispersion;
+    } else {
+	    PyErr_SetString(CBarBellModelError,
+	    	"CBarBellModel.set_dispersion expects a valid parameter name.");
+		return NULL;
+	}
+
+	DispersionVisitor* visitor = new DispersionVisitor();
+	PyObject * disp_dict = PyDict_New();
+	dispersion->accept_as_source(visitor, dispersion, disp_dict);
+	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
+    return Py_BuildValue("i",1);
+}
+
+
+static PyMethodDef CBarBellModel_methods[] = {
+    {"run",      (PyCFunction)run     , METH_VARARGS,
+      "Evaluate the model at a given Q or Q, phi"},
+    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
+      "Evaluate the model at a given Q or Qx, Qy"},
+    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
+      "Evaluate the model at a given Q or Q, phi"},
+      
+    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
+      "Evaluate the model at a given Q or Qx, Qy vector "},
+    {"reset",    (PyCFunction)reset   , METH_VARARGS,
+      "Reset pair correlation"},
+    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
+      "Set the dispersion model for a given parameter"},
+   {NULL}
+};
+
+static PyTypeObject CBarBellModelType = {
+    PyObject_HEAD_INIT(NULL)
+    0,                         /*ob_size*/
+    "CBarBellModel",             /*tp_name*/
+    sizeof(CBarBellModel),             /*tp_basicsize*/
+    0,                         /*tp_itemsize*/
+    (destructor)CBarBellModel_dealloc, /*tp_dealloc*/
+    0,                         /*tp_print*/
+    0,                         /*tp_getattr*/
+    0,                         /*tp_setattr*/
+    0,                         /*tp_compare*/
+    0,                         /*tp_repr*/
+    0,                         /*tp_as_number*/
+    0,                         /*tp_as_sequence*/
+    0,                         /*tp_as_mapping*/
+    0,                         /*tp_hash */
+    0,                         /*tp_call*/
+    0,                         /*tp_str*/
+    0,                         /*tp_getattro*/
+    0,                         /*tp_setattro*/
+    0,                         /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    "CBarBellModel objects",           /* tp_doc */
+    0,		               /* tp_traverse */
+    0,		               /* tp_clear */
+    0,		               /* tp_richcompare */
+    0,		               /* tp_weaklistoffset */
+    0,		               /* tp_iter */
+    0,		               /* tp_iternext */
+    CBarBellModel_methods,             /* tp_methods */
+    CBarBellModel_members,             /* tp_members */
+    0,                         /* tp_getset */
+    0,                         /* tp_base */
+    0,                         /* tp_dict */
+    0,                         /* tp_descr_get */
+    0,                         /* tp_descr_set */
+    0,                         /* tp_dictoffset */
+    (initproc)CBarBellModel_init,      /* tp_init */
+    0,                         /* tp_alloc */
+    CBarBellModel_new,                 /* tp_new */
+};
+
+
+//static PyMethodDef module_methods[] = {
+//    {NULL} 
+//};
+
+/**
+ * Function used to add the model class to a module
+ * @param module: module to add the class to
+ */ 
+void addCBarBellModel(PyObject *module) {
+	PyObject *d;
+	
+    if (PyType_Ready(&CBarBellModelType) < 0)
+        return;
+
+    Py_INCREF(&CBarBellModelType);
+    PyModule_AddObject(module, "CBarBellModel", (PyObject *)&CBarBellModelType);
+    
+    d = PyModule_GetDict(module);
+    CBarBellModelError = PyErr_NewException("CBarBellModel.error", NULL, NULL);
+    PyDict_SetItemString(d, "CBarBellModelError", CBarBellModelError);
+}
+
Index: sansmodels/src/sans/models/c_models/CCappedCylinderModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCappedCylinderModel.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_models/CCappedCylinderModel.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,625 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/** CCappedCylinderModel
+ *
+ * C extension 
+ *
+ * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
+ *          DO NOT MODIFY THIS FILE, MODIFY capcyl.h
+ *          AND RE-RUN THE GENERATOR SCRIPT
+ *
+ */
+#define NO_IMPORT_ARRAY
+#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
+ 
+extern "C" {
+#include <Python.h>
+#include <arrayobject.h>
+#include "structmember.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+#include "capcyl.h"
+}
+
+#include "models.hh"
+#include "dispersion_visitor.hh"
+
+/// Error object for raised exceptions
+static PyObject * CCappedCylinderModelError = NULL;
+
+
+// Class definition
+typedef struct {
+    PyObject_HEAD
+    /// Parameters
+    PyObject * params;
+    /// Dispersion parameters
+    PyObject * dispersion;
+    /// Underlying model object
+    CappedCylinderModel * model;
+    /// Log for unit testing
+    PyObject * log;
+} CCappedCylinderModel;
+
+
+static void
+CCappedCylinderModel_dealloc(CCappedCylinderModel* self)
+{
+    Py_DECREF(self->params);
+    Py_DECREF(self->dispersion);
+    Py_DECREF(self->log);
+    delete self->model;
+    self->ob_type->tp_free((PyObject*)self);
+    
+
+}
+
+static PyObject *
+CCappedCylinderModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+    CCappedCylinderModel *self;
+    
+    self = (CCappedCylinderModel *)type->tp_alloc(type, 0);
+   
+    return (PyObject *)self;
+}
+
+static int
+CCappedCylinderModel_init(CCappedCylinderModel *self, PyObject *args, PyObject *kwds)
+{
+    if (self != NULL) {
+    	
+    	// Create parameters
+        self->params = PyDict_New();
+        self->dispersion = PyDict_New();
+        self->model = new CappedCylinderModel();
+        
+        // Initialize parameter dictionary
+        PyDict_SetItemString(self->params,"phi",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"len_cyl",Py_BuildValue("d",400.000000000000));
+        PyDict_SetItemString(self->params,"sld_capcyl",Py_BuildValue("d",0.000001000000));
+        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
+        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"theta",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"rad_cap",Py_BuildValue("d",40.000000000000));
+        PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006300000));
+        PyDict_SetItemString(self->params,"rad_cyl",Py_BuildValue("d",20.000000000000));
+        // Initialize dispersion / averaging parameter dict
+        DispersionVisitor* visitor = new DispersionVisitor();
+        PyObject * disp_dict;
+        disp_dict = PyDict_New();
+        self->model->rad_cyl.dispersion->accept_as_source(visitor, self->model->rad_cyl.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "rad_cyl", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->len_cyl.dispersion->accept_as_source(visitor, self->model->len_cyl.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "len_cyl", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->rad_cap.dispersion->accept_as_source(visitor, self->model->rad_cap.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "rad_cap", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->phi.dispersion->accept_as_source(visitor, self->model->phi.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "phi", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->theta.dispersion->accept_as_source(visitor, self->model->theta.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "theta", disp_dict);
+
+
+         
+        // Create empty log
+        self->log = PyDict_New();
+        
+        
+
+    }
+    return 0;
+}
+
+static PyMemberDef CCappedCylinderModel_members[] = {
+    {"params", T_OBJECT, offsetof(CCappedCylinderModel, params), 0,
+     "Parameters"},
+	{"dispersion", T_OBJECT, offsetof(CCappedCylinderModel, dispersion), 0,
+	  "Dispersion parameters"},     
+    {"log", T_OBJECT, offsetof(CCappedCylinderModel, log), 0,
+     "Log"},
+    {NULL}  /* Sentinel */
+};
+
+/** Read double from PyObject
+    @param p PyObject
+    @return double
+*/
+double CCappedCylinderModel_readDouble(PyObject *p) {
+    if (PyFloat_Check(p)==1) {
+        return (double)(((PyFloatObject *)(p))->ob_fval);
+    } else if (PyInt_Check(p)==1) {
+        return (double)(((PyIntObject *)(p))->ob_ival);
+    } else if (PyLong_Check(p)==1) {
+        return (double)PyLong_AsLong(p);
+    } else {
+        return 0.0;
+    }
+}
+/**
+ * Function to call to evaluate model
+ * @param args: input numpy array q[] 
+ * @return: numpy array object 
+ */
+ 
+static PyObject *evaluateOneDim(CappedCylinderModel* model, PyArrayObject *q){
+    PyArrayObject *result;
+   
+    // Check validity of array q , q must be of dimension 1, an array of double
+    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
+    {
+        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
+        //PyErr_SetString(PyExc_ValueError , message);
+        return NULL;
+    }
+    result = (PyArrayObject *)PyArray_FromDims(q->nd, (int *)(q->dimensions), 
+										  PyArray_DOUBLE);
+	if (result == NULL) {
+        const char * message= "Could not create result ";
+        PyErr_SetString(PyExc_RuntimeError , message);
+		return NULL;
+	}
+	 for (int i = 0; i < q->dimensions[0]; i++){
+      double q_value  = *(double *)(q->data + i*q->strides[0]);
+      double *result_value = (double *)(result->data + i*result->strides[0]);
+      *result_value =(*model)(q_value);
+	}
+    return PyArray_Return(result); 
+ }
+
+ /**
+ * Function to call to evaluate model
+ * @param args: input numpy array  [x[],y[]]
+ * @return: numpy array object 
+ */
+ static PyObject * evaluateTwoDimXY( CappedCylinderModel* model, 
+                              PyArrayObject *x, PyArrayObject *y)
+ {
+    PyArrayObject *result;
+    int i,j, x_len, y_len, dims[1];
+    //check validity of input vectors
+    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
+        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
+        || y->dimensions[0] != x->dimensions[0]){
+        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
+        PyErr_SetString(PyExc_ValueError , message); 
+        return NULL;
+    }
+   
+	if (PyArray_Check(x) && PyArray_Check(y)) {
+		
+	    x_len = dims[0]= x->dimensions[0];
+        y_len = dims[0]= y->dimensions[0];
+	    
+	    // Make a new double matrix of same dims
+        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
+        if (result == NULL){
+	    const char * message= "Could not create result ";
+        PyErr_SetString(PyExc_RuntimeError , message);
+	    return NULL;
+	    }
+       
+        /* Do the calculation. */
+        for ( i=0; i< x_len; i++) {
+            double x_value = *(double *)(x->data + i*x->strides[0]);
+  		    double y_value = *(double *)(y->data + i*y->strides[0]);
+  			double *result_value = (double *)(result->data +
+  			      i*result->strides[0]);
+  			*result_value = (*model)(x_value, y_value);
+        }           
+        return PyArray_Return(result); 
+        
+        }else{
+		    PyErr_SetString(CCappedCylinderModelError, 
+                   "CCappedCylinderModel.evaluateTwoDimXY couldn't run.");
+	        return NULL;
+		}      	
+}
+/**
+ *  evalDistribution function evaluate a model function with input vector
+ *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
+ *
+ */ 
+static PyObject * evalDistribution(CCappedCylinderModel *self, PyObject *args){
+	PyObject *qx, *qy;
+	PyArrayObject * pars;
+	int npars ,mpars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model->len_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_cyl") );
+    self->model->sld_capcyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_capcyl") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+    self->model->rad_cap = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cap") );
+    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
+    self->model->rad_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cyl") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cyl");
+    self->model->rad_cyl.dispersion->accept_as_destination(visitor, self->model->rad_cyl.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "len_cyl");
+    self->model->len_cyl.dispersion->accept_as_destination(visitor, self->model->len_cyl.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cap");
+    self->model->rad_cap.dispersion->accept_as_destination(visitor, self->model->rad_cap.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
+    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
+    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CCappedCylinderModelError, 
+	    	"CCappedCylinderModel.evalDistribution expects a q value.");
+		return NULL;
+	}
+    // Check params
+	
+    if(PyArray_Check(pars)==1) {
+		
+	    // Length of list should 1 or 2
+	    npars = pars->nd; 
+	    if(npars==1) {
+	        // input is a numpy array
+	        if (PyArray_Check(pars)) {
+		        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
+		    }
+		}else{
+		    PyErr_SetString(CCappedCylinderModelError, 
+                   "CCappedCylinderModel.evalDistribution expect numpy array of one dimension.");
+	        return NULL;
+		}
+    }else if( PyList_Check(pars)==1) {
+    	// Length of list should be 2 for I(qx,qy)
+	    mpars = PyList_GET_SIZE(pars); 
+	    if(mpars!=2) {
+	    	PyErr_SetString(CCappedCylinderModelError, 
+	    		"CCappedCylinderModel.evalDistribution expects a list of dimension 2.");
+	    	return NULL;
+	    }
+	     qx = PyList_GET_ITEM(pars,0);
+	     qy = PyList_GET_ITEM(pars,1);
+	     if (PyArray_Check(qx) && PyArray_Check(qy)) {
+	         return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
+		           (PyArrayObject*)qy);
+		 }else{
+		    PyErr_SetString(CCappedCylinderModelError, 
+                   "CCappedCylinderModel.evalDistribution expect 2 numpy arrays in list.");
+	        return NULL;
+	     }
+	}
+	PyErr_SetString(CCappedCylinderModelError, 
+                   "CCappedCylinderModel.evalDistribution couln't be run.");
+	return NULL;
+	
+}
+
+/**
+ * Function to call to evaluate model
+ * @param args: input q or [q,phi]
+ * @return: function value
+ */
+static PyObject * run(CCappedCylinderModel *self, PyObject *args) {
+	double q_value, phi_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model->len_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_cyl") );
+    self->model->sld_capcyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_capcyl") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+    self->model->rad_cap = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cap") );
+    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
+    self->model->rad_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cyl") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cyl");
+    self->model->rad_cyl.dispersion->accept_as_destination(visitor, self->model->rad_cyl.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "len_cyl");
+    self->model->len_cyl.dispersion->accept_as_destination(visitor, self->model->len_cyl.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cap");
+    self->model->rad_cap.dispersion->accept_as_destination(visitor, self->model->rad_cap.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
+    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
+    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CCappedCylinderModelError, 
+	    	"CCappedCylinderModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(q,phi)
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CCappedCylinderModelError, 
+	    		"CCappedCylinderModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the q and phi values at which
+	    // to evaluate I(q,phi)
+	    q_value = CCappedCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
+	    phi_value = CCappedCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
+	    // Skip zero
+	    if (q_value==0) {
+	    	return Py_BuildValue("d",0.0);
+	    }
+		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		q_value = CCappedCylinderModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(q_value));
+	}	
+}
+/**
+ * Function to call to calculate_ER
+ * @return: effective radius value 
+ */
+static PyObject * calculate_ER(CCappedCylinderModel *self) {
+
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model->len_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_cyl") );
+    self->model->sld_capcyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_capcyl") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+    self->model->rad_cap = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cap") );
+    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
+    self->model->rad_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cyl") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cyl");
+    self->model->rad_cyl.dispersion->accept_as_destination(visitor, self->model->rad_cyl.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "len_cyl");
+    self->model->len_cyl.dispersion->accept_as_destination(visitor, self->model->len_cyl.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cap");
+    self->model->rad_cap.dispersion->accept_as_destination(visitor, self->model->rad_cap.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
+    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
+    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
+
+		
+	return Py_BuildValue("d",(*(self->model)).calculate_ER());
+
+}
+/**
+ * Function to call to evaluate model in cartesian coordinates
+ * @param args: input q or [qx, qy]]
+ * @return: function value
+ */
+static PyObject * runXY(CCappedCylinderModel *self, PyObject *args) {
+	double qx_value, qy_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model->len_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "len_cyl") );
+    self->model->sld_capcyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_capcyl") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+    self->model->rad_cap = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cap") );
+    self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
+    self->model->rad_cyl = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_cyl") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cyl");
+    self->model->rad_cyl.dispersion->accept_as_destination(visitor, self->model->rad_cyl.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "len_cyl");
+    self->model->len_cyl.dispersion->accept_as_destination(visitor, self->model->len_cyl.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_cap");
+    self->model->rad_cap.dispersion->accept_as_destination(visitor, self->model->rad_cap.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "phi");
+    self->model->phi.dispersion->accept_as_destination(visitor, self->model->phi.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "theta");
+    self->model->theta.dispersion->accept_as_destination(visitor, self->model->theta.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CCappedCylinderModelError, 
+	    	"CCappedCylinderModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(qx, qy))
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CCappedCylinderModelError, 
+	    		"CCappedCylinderModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the qx and qy values at which
+	    // to evaluate I(qx,qy)
+	    qx_value = CCappedCylinderModel_readDouble(PyList_GET_ITEM(pars,0));
+	    qy_value = CCappedCylinderModel_readDouble(PyList_GET_ITEM(pars,1));
+	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		qx_value = CCappedCylinderModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(qx_value));
+	}	
+}
+
+static PyObject * reset(CCappedCylinderModel *self, PyObject *args) {
+    
+
+    return Py_BuildValue("d",0.0);
+}
+
+static PyObject * set_dispersion(CCappedCylinderModel *self, PyObject *args) {
+	PyObject * disp;
+	const char * par_name;
+
+	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
+	    PyErr_SetString(CCappedCylinderModelError,
+	    	"CCappedCylinderModel.set_dispersion expects a DispersionModel object.");
+		return NULL;
+	}
+	void *temp = PyCObject_AsVoidPtr(disp);
+	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
+
+
+	// Ugliness necessary to go from python to C
+	    // TODO: refactor this
+    if (!strcmp(par_name, "rad_cyl")) {
+        self->model->rad_cyl.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "len_cyl")) {
+        self->model->len_cyl.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "rad_cap")) {
+        self->model->rad_cap.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "phi")) {
+        self->model->phi.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "theta")) {
+        self->model->theta.dispersion = dispersion;
+    } else {
+	    PyErr_SetString(CCappedCylinderModelError,
+	    	"CCappedCylinderModel.set_dispersion expects a valid parameter name.");
+		return NULL;
+	}
+
+	DispersionVisitor* visitor = new DispersionVisitor();
+	PyObject * disp_dict = PyDict_New();
+	dispersion->accept_as_source(visitor, dispersion, disp_dict);
+	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
+    return Py_BuildValue("i",1);
+}
+
+
+static PyMethodDef CCappedCylinderModel_methods[] = {
+    {"run",      (PyCFunction)run     , METH_VARARGS,
+      "Evaluate the model at a given Q or Q, phi"},
+    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
+      "Evaluate the model at a given Q or Qx, Qy"},
+    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
+      "Evaluate the model at a given Q or Q, phi"},
+      
+    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
+      "Evaluate the model at a given Q or Qx, Qy vector "},
+    {"reset",    (PyCFunction)reset   , METH_VARARGS,
+      "Reset pair correlation"},
+    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
+      "Set the dispersion model for a given parameter"},
+   {NULL}
+};
+
+static PyTypeObject CCappedCylinderModelType = {
+    PyObject_HEAD_INIT(NULL)
+    0,                         /*ob_size*/
+    "CCappedCylinderModel",             /*tp_name*/
+    sizeof(CCappedCylinderModel),             /*tp_basicsize*/
+    0,                         /*tp_itemsize*/
+    (destructor)CCappedCylinderModel_dealloc, /*tp_dealloc*/
+    0,                         /*tp_print*/
+    0,                         /*tp_getattr*/
+    0,                         /*tp_setattr*/
+    0,                         /*tp_compare*/
+    0,                         /*tp_repr*/
+    0,                         /*tp_as_number*/
+    0,                         /*tp_as_sequence*/
+    0,                         /*tp_as_mapping*/
+    0,                         /*tp_hash */
+    0,                         /*tp_call*/
+    0,                         /*tp_str*/
+    0,                         /*tp_getattro*/
+    0,                         /*tp_setattro*/
+    0,                         /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    "CCappedCylinderModel objects",           /* tp_doc */
+    0,		               /* tp_traverse */
+    0,		               /* tp_clear */
+    0,		               /* tp_richcompare */
+    0,		               /* tp_weaklistoffset */
+    0,		               /* tp_iter */
+    0,		               /* tp_iternext */
+    CCappedCylinderModel_methods,             /* tp_methods */
+    CCappedCylinderModel_members,             /* tp_members */
+    0,                         /* tp_getset */
+    0,                         /* tp_base */
+    0,                         /* tp_dict */
+    0,                         /* tp_descr_get */
+    0,                         /* tp_descr_set */
+    0,                         /* tp_dictoffset */
+    (initproc)CCappedCylinderModel_init,      /* tp_init */
+    0,                         /* tp_alloc */
+    CCappedCylinderModel_new,                 /* tp_new */
+};
+
+
+//static PyMethodDef module_methods[] = {
+//    {NULL} 
+//};
+
+/**
+ * Function used to add the model class to a module
+ * @param module: module to add the class to
+ */ 
+void addCCappedCylinderModel(PyObject *module) {
+	PyObject *d;
+	
+    if (PyType_Ready(&CCappedCylinderModelType) < 0)
+        return;
+
+    Py_INCREF(&CCappedCylinderModelType);
+    PyModule_AddObject(module, "CCappedCylinderModel", (PyObject *)&CCappedCylinderModelType);
+    
+    d = PyModule_GetDict(module);
+    CCappedCylinderModelError = PyErr_NewException("CCappedCylinderModel.error", NULL, NULL);
+    PyDict_SetItemString(d, "CCappedCylinderModelError", CCappedCylinderModelError);
+}
+
Index: sansmodels/src/sans/models/c_models/CCoreFourShellModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CCoreFourShellModel.cpp	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/c_models/CCoreFourShellModel.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -97,8 +97,8 @@
         PyDict_SetItemString(self->params,"thick_shell2",Py_BuildValue("d",10.000000000000));
         PyDict_SetItemString(self->params,"sld_shell1",Py_BuildValue("d",0.000001000000));
-        PyDict_SetItemString(self->params,"rad_core",Py_BuildValue("d",60.000000000000));
-        PyDict_SetItemString(self->params,"sld_core",Py_BuildValue("d",0.000006400000));
+        PyDict_SetItemString(self->params,"thick_shell3",Py_BuildValue("d",10.000000000000));
+        PyDict_SetItemString(self->params,"sld_core0",Py_BuildValue("d",0.000006400000));
         PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000000000));
-        PyDict_SetItemString(self->params,"thick_shell3",Py_BuildValue("d",10.000000000000));
+        PyDict_SetItemString(self->params,"rad_core0",Py_BuildValue("d",60.000000000000));
         PyDict_SetItemString(self->params,"sld_solv",Py_BuildValue("d",0.000006400000));
         PyDict_SetItemString(self->params,"sld_shell3",Py_BuildValue("d",0.000003000000));
@@ -107,6 +107,6 @@
         PyObject * disp_dict;
         disp_dict = PyDict_New();
-        self->model->rad_core.dispersion->accept_as_source(visitor, self->model->rad_core.dispersion, disp_dict);
-        PyDict_SetItemString(self->dispersion, "rad_core", disp_dict);
+        self->model->rad_core0.dispersion->accept_as_source(visitor, self->model->rad_core0.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "rad_core0", disp_dict);
         disp_dict = PyDict_New();
         self->model->thick_shell1.dispersion->accept_as_source(visitor, self->model->thick_shell1.dispersion, disp_dict);
@@ -257,8 +257,8 @@
     self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
     self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") );
-    self->model->rad_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core") );
-    self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );
+    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
+    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
+    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
     self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
     self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") );
@@ -266,6 +266,6 @@
     PyObject* disp_dict;
     DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core");
-    self->model->rad_core.dispersion->accept_as_destination(visitor, self->model->rad_core.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
+    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
     disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
     self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
@@ -345,8 +345,8 @@
     self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
     self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") );
-    self->model->rad_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core") );
-    self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );
+    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
+    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
+    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
     self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
     self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") );
@@ -354,6 +354,6 @@
     PyObject* disp_dict;
     DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core");
-    self->model->rad_core.dispersion->accept_as_destination(visitor, self->model->rad_core.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
+    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
     disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
     self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
@@ -420,8 +420,8 @@
     self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
     self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") );
-    self->model->rad_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core") );
-    self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );
+    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
+    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
+    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
     self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
     self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") );
@@ -429,6 +429,6 @@
     PyObject* disp_dict;
     DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core");
-    self->model->rad_core.dispersion->accept_as_destination(visitor, self->model->rad_core.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
+    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
     disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
     self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
@@ -464,8 +464,8 @@
     self->model->thick_shell2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell2") );
     self->model->sld_shell1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell1") );
-    self->model->rad_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core") );
-    self->model->sld_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core") );
+    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
+    self->model->sld_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_core0") );
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
-    self->model->thick_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_shell3") );
+    self->model->rad_core0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "rad_core0") );
     self->model->sld_solv = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solv") );
     self->model->sld_shell3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_shell3") );
@@ -473,6 +473,6 @@
     PyObject* disp_dict;
     DispersionVisitor* visitor = new DispersionVisitor();
-    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core");
-    self->model->rad_core.dispersion->accept_as_destination(visitor, self->model->rad_core.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "rad_core0");
+    self->model->rad_core0.dispersion->accept_as_destination(visitor, self->model->rad_core0.dispersion, disp_dict);
     disp_dict = PyDict_GetItemString(self->dispersion, "thick_shell1");
     self->model->thick_shell1.dispersion->accept_as_destination(visitor, self->model->thick_shell1.dispersion, disp_dict);
@@ -538,6 +538,6 @@
 	// Ugliness necessary to go from python to C
 	    // TODO: refactor this
-    if (!strcmp(par_name, "rad_core")) {
-        self->model->rad_core.dispersion = dispersion;
+    if (!strcmp(par_name, "rad_core0")) {
+        self->model->rad_core0.dispersion = dispersion;
     } else    if (!strcmp(par_name, "thick_shell1")) {
         self->model->thick_shell1.dispersion = dispersion;
Index: sansmodels/src/sans/models/c_models/CReflModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CReflModel.cpp	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/c_models/CReflModel.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -90,6 +90,10 @@
         
         // Initialize parameter dictionary
+        PyDict_SetItemString(self->params,"sldIM_flat4",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"thick_flat8",Py_BuildValue("d",100.000000000000));
         PyDict_SetItemString(self->params,"thick_flat9",Py_BuildValue("d",100.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_flat7",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_flat10",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_flat5",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"thick_flat1",Py_BuildValue("d",10.000000000000));
         PyDict_SetItemString(self->params,"thick_flat3",Py_BuildValue("d",100.000000000000));
@@ -109,7 +113,10 @@
         PyDict_SetItemString(self->params,"thick_inter8",Py_BuildValue("d",1.000000000000));
         PyDict_SetItemString(self->params,"thick_inter9",Py_BuildValue("d",1.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_flat1",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_flat2",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"func_inter9",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"thick_inter10",Py_BuildValue("d",1.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_flat3",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"func_inter8",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"thick_flat2",Py_BuildValue("d",100.000000000000));
@@ -129,10 +136,15 @@
         PyDict_SetItemString(self->params,"sld_flat2",Py_BuildValue("d",0.000003500000));
         PyDict_SetItemString(self->params,"sld_flat3",Py_BuildValue("d",0.000004000000));
+        PyDict_SetItemString(self->params,"sldIM_flat8",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"sld_flat8",Py_BuildValue("d",0.000003500000));
         PyDict_SetItemString(self->params,"sld_flat9",Py_BuildValue("d",0.000004000000));
+        PyDict_SetItemString(self->params,"sldIM_flat9",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"func_inter1",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_sub0",Py_BuildValue("d",0.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_medium",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"sld_flat10",Py_BuildValue("d",0.000003500000));
         PyDict_SetItemString(self->params,"thick_inter0",Py_BuildValue("d",1.000000000000));
+        PyDict_SetItemString(self->params,"sldIM_flat6",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"func_inter4",Py_BuildValue("d",0.000000000000));
         PyDict_SetItemString(self->params,"func_inter10",Py_BuildValue("d",0.000000000000));
@@ -272,6 +284,10 @@
 	
 	    // Reader parameter dictionary
+    self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );
     self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
     self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
+    self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );
+    self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );
+    self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );
     self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
     self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
@@ -291,7 +307,10 @@
     self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
     self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
+    self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );
     self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );
     self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
     self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
+    self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );
     self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
     self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
@@ -311,10 +330,15 @@
     self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
     self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
+    self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );
     self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
     self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
+    self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
     self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
+    self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );
+    self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );
     self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
     self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
+    self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );
     self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
     self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
@@ -386,6 +410,10 @@
 	
 	    // Reader parameter dictionary
+    self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );
     self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
     self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
+    self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );
+    self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );
+    self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );
     self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
     self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
@@ -405,7 +433,10 @@
     self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
     self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
+    self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );
     self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );
     self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
     self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
+    self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );
     self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
     self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
@@ -425,10 +456,15 @@
     self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
     self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
+    self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );
     self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
     self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
+    self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
     self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
+    self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );
+    self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );
     self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
     self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
+    self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );
     self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
     self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
@@ -487,6 +523,10 @@
 	
 	    // Reader parameter dictionary
+    self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );
     self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
     self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
+    self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );
+    self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );
+    self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );
     self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
     self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
@@ -506,7 +546,10 @@
     self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
     self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
+    self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );
     self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );
     self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
     self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
+    self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );
     self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
     self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
@@ -526,10 +569,15 @@
     self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
     self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
+    self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );
     self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
     self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
+    self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
     self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
+    self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );
+    self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );
     self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
     self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
+    self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );
     self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
     self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
@@ -557,6 +605,10 @@
 	
 	    // Reader parameter dictionary
+    self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );
     self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") );
     self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") );
+    self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );
+    self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );
+    self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );
     self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") );
     self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") );
@@ -576,7 +628,10 @@
     self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") );
     self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") );
+    self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );
     self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );
     self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") );
     self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") );
+    self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );
     self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") );
     self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") );
@@ -596,10 +651,15 @@
     self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") );
     self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") );
+    self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );
     self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") );
     self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") );
+    self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );
     self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
     self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") );
+    self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );
+    self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );
     self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") );
     self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );
+    self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );
     self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") );
     self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") );
Index: sansmodels/src/sans/models/c_models/barbell.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/barbell.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_models/barbell.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,253 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ */
+
+#include <math.h>
+#include "models.hh"
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+
+extern "C" {
+	#include "libCylinder.h"
+	#include "barbell.h"
+}
+
+BarBellModel :: BarBellModel() {
+	scale      = Parameter(1.0);
+	rad_bar		= Parameter(20.0);
+	rad_bar.set_min(0.0);
+	len_bar     = Parameter(400.0, true);
+	len_bar.set_min(0.0);
+	rad_bell = Parameter(40.0);
+	rad_bell.set_min(0.0);
+	sld_barbell   = Parameter(1.0e-6);
+	sld_solv   = Parameter(6.3e-6);
+	background = Parameter(0.0);
+	theta  = Parameter(0.0, true);
+	phi    = Parameter(0.0, true);
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * The NIST IGOR library is used for the actual calculation.
+ * @param q: q-value
+ * @return: function value
+ */
+double BarBellModel :: operator()(double q) {
+	double dp[7];
+
+	// Fill parameter array for IGOR library
+	// Add the background after averaging
+	dp[0] = scale();
+	dp[1] = rad_bar();
+	dp[2] = len_bar();
+	dp[3] = rad_bell();
+	dp[4] = sld_barbell();
+	dp[5] = sld_solv();
+	dp[6] = 0.0;
+
+	// Get the dispersion points for the rad_bar
+	vector<WeightPoint> weights_rad_bar;
+	rad_bar.get_weights(weights_rad_bar);
+	// Get the dispersion points for the len_bar
+	vector<WeightPoint> weights_len_bar;
+	len_bar.get_weights(weights_len_bar);
+	// Get the dispersion points for the rad_bell
+	vector<WeightPoint> weights_rad_bell;
+	rad_bell.get_weights(weights_rad_bell);
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+	double vol = 0.0;
+	double pi,hDist,result;
+	double vol_i = 0.0;
+	pi = 4.0*atan(1.0);
+	// Loop over radius weight points
+	for(int i=0; i<weights_rad_bar.size(); i++) {
+		dp[1] = weights_rad_bar[i].value;
+		for(int j=0; j<weights_len_bar.size(); j++) {
+			dp[2] = weights_len_bar[j].value;
+			for(int 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;
+
+	double q = sqrt(qx*qx + qy*qy);
+	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,result;
+	double vol_i = 0.0;
+	pi = 4.0*atan(1.0);
+
+	// Loop over radius weight points
+	for(int i=0; i<weights_rad_bar.size(); i++) {
+		dp.rad_bar = weights_rad_bar[i].value;
+		for(int j=0; j<weights_len_bar.size(); j++) {
+			dp.len_bar = weights_len_bar[j].value;
+			for(int k=0; k<weights_rad_bell.size(); k++) {
+				dp.rad_bell = weights_rad_bell[k].value;
+				// Average over theta distribution
+				for(int l=0; l< weights_theta.size(); l++) {
+					dp.theta = weights_theta[l].value;
+					// Average over phi distribution
+					for(int m=0; m< weights_phi.size(); m++) {
+						dp.phi = weights_phi[m].value;
+						//Un-normalize Form by volume
+						hDist = sqrt(fabs(dp.rad_bell*dp.rad_bell-dp.rad_bar*dp.rad_bar));
+						vol_i = pi*dp.rad_bar*dp.rad_bar*dp.len_bar+2.0*pi*(2.0*dp.rad_bell*dp.rad_bell*dp.rad_bell/3.0
+										+dp.rad_bell*dp.rad_bell*hDist-hDist*hDist*hDist/3.0);
+
+						double _ptvalue = weights_rad_bar[i].weight
+											* weights_len_bar[j].weight
+											* weights_rad_bell[k].weight
+											* weights_theta[l].weight
+											* weights_phi[m].weight
+											* vol_i
+											* barbell_analytical_2DXY(&dp, qx, qy);
+											//* pow(weights_rad[i].value,3.0);
+						// Consider when there is infinte or nan.
+						if ( _ptvalue == INFINITY || _ptvalue == NAN){
+							_ptvalue = 0.0;
+						}
+						if (weights_theta.size()>1) {
+							_ptvalue *= sin(weights_theta[l].value);
+						}
+						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!!!
+}
Index: sansmodels/src/sans/models/c_models/capcyl.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/capcyl.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_models/capcyl.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,253 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ */
+
+#include <math.h>
+#include "models.hh"
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+
+extern "C" {
+	#include "libCylinder.h"
+	#include "capcyl.h"
+}
+
+CappedCylinderModel :: CappedCylinderModel() {
+	scale      = Parameter(1.0);
+	rad_cyl		= Parameter(20.0);
+	rad_cyl.set_min(0.0);
+	len_cyl     = Parameter(400.0, true);
+	len_cyl.set_min(0.0);
+	rad_cap = Parameter(40.0);
+	rad_cap.set_min(0.0);
+	sld_capcyl  = Parameter(1.0e-6);
+	sld_solv   = Parameter(6.3e-6);
+	background = Parameter(0.0);
+	theta  = Parameter(0.0, true);
+	phi    = Parameter(0.0, true);
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * The NIST IGOR library is used for the actual calculation.
+ * @param q: q-value
+ * @return: function value
+ */
+double CappedCylinderModel :: operator()(double q) {
+	double dp[7];
+
+	// Fill parameter array for IGOR library
+	// Add the background after averaging
+	dp[0] = scale();
+	dp[1] = rad_cyl();
+	dp[2] = len_cyl();
+	dp[3] = rad_cap();
+	dp[4] = sld_capcyl();
+	dp[5] = sld_solv();
+	dp[6] = 0.0;
+
+	// Get the dispersion points for the rad_cyl
+	vector<WeightPoint> weights_rad_cyl;
+	rad_cyl.get_weights(weights_rad_cyl);
+	// Get the dispersion points for the len_cyl
+	vector<WeightPoint> weights_len_cyl;
+	len_cyl.get_weights(weights_len_cyl);
+	// Get the dispersion points for the rad_cap
+	vector<WeightPoint> weights_rad_cap;
+	rad_cap.get_weights(weights_rad_cap);
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+	double vol = 0.0;
+	double pi,hDist,result;
+	double vol_i = 0.0;
+	pi = 4.0*atan(1.0);
+	// Loop over radius weight points
+	for(int i=0; i<weights_rad_cyl.size(); i++) {
+		dp[1] = weights_rad_cyl[i].value;
+		for(int j=0; j<weights_len_cyl.size(); j++) {
+			dp[2] = weights_len_cyl[j].value;
+			for(int k=0; k<weights_rad_cap.size(); k++) {
+				dp[3] = weights_rad_cap[k].value;
+
+				//Un-normalize SphereForm by volume
+				hDist = -1.0*sqrt(fabs(dp[3]*dp[3]-dp[1]*dp[1]));
+				vol_i = pi*dp[1]*dp[1]*dp[2]+2.0*pi/3.0*((dp[3]-hDist)*(dp[3]-hDist)*
+								(2.0*(dp[3]+hDist)));
+				result =  CappedCylinder(dp, q) * vol_i;
+				// This FIXES a singualrity the kernel in libigor.
+				if ( result == INFINITY || result == NAN){
+					result = 0.0;
+				}
+				sum += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight
+					* result;
+				//Find average volume
+				vol += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight
+					* vol_i;
+
+				norm += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight;
+			}
+		}
+	}
+
+	if (vol != 0.0 && norm != 0.0) {
+		//Re-normalize by avg volume
+		sum = sum/(vol/norm);}
+	return sum/norm + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+double CappedCylinderModel :: operator()(double qx, double qy) {
+	CapCylParameters dp;
+
+	double q = sqrt(qx*qx + qy*qy);
+	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,result;
+	double vol_i = 0.0;
+	pi = 4.0*atan(1.0);
+
+	// Loop over radius weight points
+	for(int i=0; i<weights_rad_cyl.size(); i++) {
+		dp.rad_cyl = weights_rad_cyl[i].value;
+		for(int j=0; j<weights_len_cyl.size(); j++) {
+			dp.len_cyl = weights_len_cyl[j].value;
+			for(int k=0; k<weights_rad_cap.size(); k++) {
+				dp.rad_cap = weights_rad_cap[k].value;
+				// Average over theta distribution
+				for(int l=0; l< weights_theta.size(); l++) {
+					dp.theta = weights_theta[l].value;
+					// Average over phi distribution
+					for(int m=0; m< weights_phi.size(); m++) {
+						dp.phi = weights_phi[m].value;
+						//Un-normalize Form by volume
+						hDist = -1.0*sqrt(fabs(dp.rad_cap*dp.rad_cap-dp.rad_cyl*dp.rad_cyl));
+						vol_i = pi*dp.rad_cyl*dp.rad_cyl*dp.len_cyl+2.0*pi/3.0*((dp.rad_cap-hDist)*(dp.rad_cap-hDist)*
+										(2*dp.rad_cap+hDist));
+
+						double _ptvalue = weights_rad_cyl[i].weight
+											* weights_len_cyl[j].weight
+											* weights_rad_cap[k].weight
+											* weights_theta[l].weight
+											* weights_phi[m].weight
+											* vol_i
+											* capcyl_analytical_2DXY(&dp, qx, qy);
+											//* pow(weights_rad[i].value,3.0);
+						// Consider when there is infinte or nan.
+						if ( _ptvalue == INFINITY || _ptvalue == NAN){
+							_ptvalue = 0.0;
+						}
+						if (weights_theta.size()>1) {
+							_ptvalue *= sin(weights_theta[l].value);
+						}
+						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!!!
+}
Index: sansmodels/src/sans/models/c_models/corefourshell.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/corefourshell.cpp	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ sansmodels/src/sans/models/c_models/corefourshell.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -33,7 +33,7 @@
 CoreFourShellModel :: CoreFourShellModel() {
 	scale      = Parameter(1.0);
-	rad_core     = Parameter(60.0, true);
-	rad_core.set_min(0.0);
-	sld_core   = Parameter(6.4e-6);
+	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);
@@ -64,6 +64,6 @@
 	// Add the background after averaging
 	dp[0] = scale();
-	dp[1] = rad_core();
-	dp[2] = sld_core();
+	dp[1] = rad_core0();
+	dp[2] = sld_core0();
 	dp[3] = thick_shell1();
 	dp[4] = sld_shell1();
@@ -79,5 +79,5 @@
 	// Get the dispersion points for the radius
 	vector<WeightPoint> weights_rad;
-	rad_core.get_weights(weights_rad);
+	rad_core0.get_weights(weights_rad);
 
 	// Get the dispersion points for the thick 1
@@ -167,6 +167,6 @@
 
 	dp.scale = scale();
-	dp.rad_core = rad_core();
-	dp.sld_core = sld_core();
+	dp.rad_core0 = rad_core0();
+	dp.sld_core0 = sld_core0();
 	dp.thick_shell1 = thick_shell1();
 	dp.sld_shell1 = sld_shell1();
@@ -182,5 +182,5 @@
 	// Get the dispersion points for the radius
 	vector<WeightPoint> weights_rad;
-	rad_core.get_weights(weights_rad);
+	rad_core0.get_weights(weights_rad);
 
 	// Get the dispersion points for the thick 1
@@ -207,5 +207,5 @@
 	// Loop over radius weight points
 	for(int i=0; i<weights_rad.size(); i++) {
-		dp.rad_core = weights_rad[i].value;
+		dp.rad_core0 = weights_rad[i].value;
 		// Loop over radius weight points
 		for(int j=0; j<weights_s1.size(); j++) {
@@ -222,5 +222,5 @@
 						//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_core+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4);
+							* (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;
 					}
@@ -234,5 +234,5 @@
 	else{
 		//return normal value
-		rad_out = dp.rad_core+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4;}
+		rad_out = dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4;}
 
 	return rad_out;
Index: sansmodels/src/sans/models/c_models/lamellarPC.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPC.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_models/lamellarPC.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -0,0 +1,120 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ */
+
+#include <math.h>
+#include "models.hh"
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+
+extern "C" {
+	#include "libCylinder.h"
+	#include "lamellarPC.h"
+}
+
+LamellarPCrystalModel :: LamellarPCrystalModel() {
+	scale      = Parameter(1.0);
+	thickness     = Parameter(33.0, true);
+	thickness.set_min(0.0);
+	Nlayers    = Parameter(20.0, true);
+	Nlayers.set_min(0.0);
+	spacing   = Parameter(250);
+	pd_spacing   = Parameter(0.0);
+	sld_layer  = Parameter(1.0e-6);
+	sld_solvent    = Parameter(6.34e-6);
+	background = Parameter(0.0);
+
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * The NIST IGOR library is used for the actual calculation.
+ * @param q: q-value
+ * @return: function value
+ */
+double LamellarPCrystalModel :: operator()(double q) {
+	double dp[8];
+
+	// Fill parameter array for IGOR library
+	// Add the background after averaging
+	dp[0] = scale();
+	dp[1] = thickness();
+	dp[2] = Nlayers();
+	dp[3] = spacing();
+	dp[4] = pd_spacing();
+	dp[5] = sld_layer();
+	dp[6] = sld_solvent();
+	dp[7] = 0.0; // Do not apply background here.
+
+	// Get the dispersion points for the head thickness
+	vector<WeightPoint> weights_thickness;
+	thickness.get_weights(weights_thickness);
+
+	// Let's provide from the func which is more accurate especially for small q region.
+	// Get the dispersion points for the tail length
+	//vector<WeightPoint> weights_spacing;
+	//spacing.get_weights(weights_spacing);
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+
+	// Loop over thickness and spacing weight points
+	for(int i=0; i< (int)weights_thickness.size(); i++) {
+		dp[1] = weights_thickness[i].value;
+		//for (int j=0; j< (int)weights_spacing.size(); j++){
+			//dp[3] = weights_spacing[j].value;
+			sum += weights_thickness[i].weight*Lamellar_ParaCrystal(dp, q);
+			norm += weights_thickness[i].weight;
+		//}
+	}
+	//apply norm and background
+	return sum/norm + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+
+double LamellarPCrystalModel :: operator()(double qx, double qy) {
+	double q = sqrt(qx*qx + qy*qy);
+	return (*this).operator()(q);
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the lamellar
+ * @param q: q-value
+ * @param phi: angle phi
+ * @return: function value
+ */
+double LamellarPCrystalModel :: evaluate_rphi(double q, double phi) {
+	return (*this).operator()(q);
+}
+/**
+ * Function to calculate effective radius
+ * @return: effective radius value
+ */
+double LamellarPCrystalModel :: calculate_ER() {
+//NOT implemented yet!!!
+}
Index: sansmodels/src/sans/models/c_models/models.hh
===================================================================
--- sansmodels/src/sans/models/c_models/models.hh	(revision d5b6a9d7cd9e26b5f9e28e55e8cf848a40de6ae9)
+++ sansmodels/src/sans/models/c_models/models.hh	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -49,4 +49,51 @@
 };
 
+class BarBellModel{
+public:
+	// Model parameters
+	Parameter scale;
+	Parameter rad_bar;
+	Parameter len_bar;
+	Parameter rad_bell;
+	Parameter sld_barbell;
+	Parameter sld_solv;
+	Parameter background;
+	Parameter theta;
+	Parameter phi;
+
+	// Constructor
+	BarBellModel();
+
+	// Operators to get I(Q)
+	double operator()(double q);
+	double operator()(double qx, double qy);
+	double calculate_ER();
+	double evaluate_rphi(double q, double phi);
+};
+
+class CappedCylinderModel{
+public:
+	// Model parameters
+	Parameter scale;
+	Parameter rad_cyl;
+	Parameter len_cyl;
+	Parameter rad_cap;
+	Parameter sld_capcyl;
+	Parameter sld_solv;
+	Parameter background;
+	Parameter theta;
+	Parameter phi;
+
+	// Constructor
+	CappedCylinderModel();
+
+	// Operators to get I(Q)
+	double operator()(double q);
+	double operator()(double qx, double qy);
+	double calculate_ER();
+	double evaluate_rphi(double q, double phi);
+};
+
+
 class ParallelepipedModel{
 public:
@@ -80,6 +127,6 @@
 	Parameter n_shells;
 	Parameter scale;
-	Parameter rad_core;
-	Parameter sld_core;
+	Parameter rad_core0;
+	Parameter sld_core0;
 	Parameter sld_solv;
 	Parameter background;
@@ -256,4 +303,18 @@
 	Parameter func_inter10;
 
+	Parameter sldIM_flat1;
+	Parameter sldIM_flat2;
+	Parameter sldIM_flat3;
+	Parameter sldIM_flat4;
+	Parameter sldIM_flat5;
+	Parameter sldIM_flat6;
+	Parameter sldIM_flat7;
+	Parameter sldIM_flat8;
+	Parameter sldIM_flat9;
+	Parameter sldIM_flat10;
+
+	Parameter sldIM_sub0;
+	Parameter sldIM_medium;
+
 	// Constructor
 	ReflModel();
@@ -511,6 +572,6 @@
 	// Model parameters
 	Parameter scale;
-	Parameter rad_core;
-	Parameter sld_core;
+	Parameter rad_core0;
+	Parameter sld_core0;
 	Parameter thick_shell1;
 	Parameter sld_shell1;
Index: sansmodels/src/sans/models/c_models/onion.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/onion.cpp	(revision e096270047b0757e07e7187aa5de071c857a7e13)
+++ sansmodels/src/sans/models/c_models/onion.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -33,6 +33,6 @@
 	n_shells = Parameter(1.0);
 	scale = Parameter(1.0);
-	rad_core = Parameter(200.0);
-	sld_core = Parameter(1e-06);
+	rad_core0 = Parameter(200.0);
+	sld_core0 = Parameter(1e-06);
 	sld_solv = Parameter(6.4e-06);
     background = Parameter(0.0);
@@ -112,6 +112,6 @@
 	dp[0] = n_shells();
 	dp[1] = scale();
-	dp[2] = rad_core();
-	dp[3] = sld_core();
+	dp[2] = rad_core0();
+	dp[3] = sld_core0();
 	dp[4] = sld_solv();
 	dp[5] = 0.0;
@@ -175,5 +175,5 @@
 	// Get the dispersion points for the radius
 	vector<WeightPoint> weights_rad;
-	rad_core.get_weights(weights_rad);
+	rad_core0.get_weights(weights_rad);
 
 	// Get the dispersion points for the thick 1
@@ -313,5 +313,5 @@
 double OnionModel :: calculate_ER() {
 	OnionParameters dp;
-	dp.rad_core = rad_core();
+	dp.rad_core0 = rad_core0();
 	dp.thick_shell1 = thick_shell1();
 	dp.thick_shell2 = thick_shell2();
@@ -333,5 +333,5 @@
 	// Get the dispersion points for the radius
 	vector<WeightPoint> weights_rad;
-	rad_core.get_weights(weights_rad);
+	rad_core0.get_weights(weights_rad);
 
 	// Get the dispersion points for the thick 1
@@ -376,5 +376,5 @@
 	// Loop over radius weight points
 	for(int i=0; i<weights_rad.size(); i++) {
-		dp.rad_core = weights_rad[i].value;
+		dp.rad_core0 = weights_rad[i].value;
 		// Loop over radius weight points
 		for(int j=0; j<weights_s1.size(); j++) {
@@ -411,5 +411,5 @@
 													*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_core+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4+dp.thick_shell5
+													* (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
@@ -433,5 +433,5 @@
 	else{
 		//return normal value
-		rad_out = dp.rad_core+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4
+		rad_out = dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4
 					+dp.thick_shell5+dp.thick_shell6+dp.thick_shell7+dp.thick_shell8+dp.thick_shell9+dp.thick_shell10;}
 	return rad_out;
Index: sansmodels/src/sans/models/c_models/refl.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/refl.cpp	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/c_models/refl.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -67,4 +67,17 @@
     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);
+
+    sldIM_sub0 = Parameter(0);
+    sldIM_medium = Parameter(0);
 }
 
@@ -75,5 +88,5 @@
  */
 double ReflModel :: operator()(double q) {
-	double dp[47];
+	double dp[59];
 	// Fill parameter array for IGOR library
 	// Add the background after averaging
@@ -130,4 +143,18 @@
 	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] = sldIM_sub0();
+	dp[58] = sldIM_medium();
+
 	// Get the dispersion points for the radius
 	//vector<WeightPoint> weights_thick;
Index: sansmodels/src/sans/models/test/utest_extra_models.py
===================================================================
--- sansmodels/src/sans/models/test/utest_extra_models.py	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/test/utest_extra_models.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -1,9 +1,11 @@
 """
-    Unit tests for extra models,PolymerexclVolume, RPA10Model
+Unit tests for extra models,PolymerexclVolume, RPA10Model
+The reference values are calculated on IGOR/NIST package(Oct.,2010)
+@author: JHJ Cho / UTK
 """
 import unittest
 class TestPolymerExclVolume(unittest.TestCase):
     """
-        Unit tests for PolymerexclVolume (non-shape) function
+    Unit tests for PolymerexclVolume (non-shape) function
     """
     def setUp(self):
@@ -17,7 +19,7 @@
         self.assertAlmostEqual(self.model.runXY(0.41959), 0.000261302, 6)
         
-class TestPolymerExclVolume(unittest.TestCase):
+class TestRPA10Case(unittest.TestCase):
     """
-        Unit tests for RPA10Model (non-shape) function
+    Unit tests for RPA10Model (non-shape) function
     """
     def setUp(self):
@@ -83,6 +85,98 @@
         # case 9
         self.assertAlmostEqual(self.model9.run(0.001), 0.00839376, 6)
-        self.assertAlmostEqual(self.model9.runXY(0.414955), 0.00305777, 6)        
+        self.assertAlmostEqual(self.model9.runXY(0.414955), 0.00305777, 6)  
+              
+class TestBarBell(unittest.TestCase):
+    """
+    Unit tests for BarBell function
+    """
+    def setUp(self):
+        from sans.models.BarBellModel import BarBellModel
+        self.model= BarBellModel()
         
+    def test1D(self):          
+        # the values are from Igor pro calculation    
+        self.assertAlmostEqual(self.model.run(0.001), 2864.7, 1)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.526351, 4)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.0685892, 6)
+
+class TestCappedCylinder(unittest.TestCase):
+    """
+    Unit tests for CappedCylinder function
+    """
+    def setUp(self):
+        from sans.models.CappedCylinderModel import CappedCylinderModel
+        self.model= CappedCylinderModel()
+        
+    def test1D(self):          
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 1424.72, 2)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.360736, 4)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.110283, 5)
+
+class TestLamellarParaCrystal(unittest.TestCase):
+    """
+    Unit tests for LamellarParaCystal function
+    """
+    def setUp(self):
+        from sans.models.LamellarPCrystalModel import LamellarPCrystalModel
+        self.model= LamellarPCrystalModel()
+        
+    def test1D(self):    
+        self.model.setParam("pd_spacing", 0.2)      
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 21829.3, 1)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.00487686, 6)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.00062029, 6)
+
+
+class TestSCParaCrystal(unittest.TestCase):
+    """
+    Unit tests for Simple Cubic ParaCrystal Model function
+    """
+    def setUp(self):
+        from sans.models.SCCrystalModel import SCCrystalModel
+        self.model= SCCrystalModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 10.3038, 4)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.00714905, 6)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000313289, 6)
+
+class TestFCParaCrystal(unittest.TestCase):
+    """
+    Unit tests for Face Centered Cubic ParaCrystal Model function
+    """
+    def setUp(self):
+        from sans.models.FCCrystalModel import FCCrystalModel
+        self.model= FCCrystalModel()
+        
+    def test1D(self):       
+        self.model.setParam("d_factor", 0.05)  
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 0.121017, 6)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.0107218, 6)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000443282, 6)
+
+class TestBCParaCrystal(unittest.TestCase):
+    """
+    Unit tests for Body Centered Cubic ParaCrystal Model function
+    """
+    def setUp(self):
+        from sans.models.BCCrystalModel import BCCrystalModel
+        self.model= BCCrystalModel()
+        
+    def test1D(self):        
+        # the values are from Igor pro calculation  
+        # the different digits are due to precision of q values  
+        self.assertAlmostEqual(self.model.run(0.001), 1.77267, 4)
+        self.assertAlmostEqual(self.model.run(0.215268), 0.00927739, 6)
+        self.assertAlmostEqual(self.model.runXY(0.414467), 0.000406973, 6)
+                                                        
 if __name__ == '__main__':
     unittest.main()
Index: sansmodels/src/sans/models/test/utest_model_sphereexpshell.py
===================================================================
--- sansmodels/src/sans/models/test/utest_model_sphereexpshell.py	(revision 1e7de3879a0b2ff6e6fa055a97d34d6d554b2a95)
+++ sansmodels/src/sans/models/test/utest_model_sphereexpshell.py	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
@@ -42,7 +42,7 @@
         # model3: set param values as same as the model2
         self.model3.setParam("background", 0.0)
-        self.model3.setParam("rad_core", 200.0)
+        self.model3.setParam("rad_core0", 200.0)
         self.model3.setParam("scale", 1.0)
-        self.model3.setParam("sld_core", 1.0e-006)
+        self.model3.setParam("sld_core0", 1.0e-006)
         self.model3.setParam("sld_shell1", 1.7e-006)
         self.model3.setParam("sld_solv", 6.4e-006)
@@ -72,7 +72,7 @@
         # model: set param values as same as the model2
         self.model.setParam("background", 0.0)
-        self.model.setParam("rad_core", 100.0)
+        self.model.setParam("rad_core0", 100.0)
         self.model.setParam("scale", 1.0)
-        self.model.setParam("sld_core", 6.36e-006)
+        self.model.setParam("sld_core0", 6.36e-006)
         self.model.setParam("sld_in_shell1", 5e-007)
         self.model.setParam("sld_solv", 6.36e-006)
@@ -80,7 +80,7 @@
         # model2: set param values as same as the model2
         self.model2.setParam("background", 0.0)
-        self.model2.setParam("rad_core", 100.0)
+        self.model2.setParam("rad_core0", 100.0)
         self.model2.setParam("scale", 1.0)
-        self.model2.setParam("sld_core", 6.36e-006)
+        self.model2.setParam("sld_core0", 6.36e-006)
         self.model2.setParam("sld_in_shell1", 5e-007)
         self.model2.setParam("sld_solv", 6.36e-006)
