Index: sansmodels/src/sans/models/CoreMultiShellModel.py
===================================================================
--- sansmodels/src/sans/models/CoreMultiShellModel.py	(revision 4523b6854d1499ab35e8e024eeddfffd99dfe319)
+++ sansmodels/src/sans/models/CoreMultiShellModel.py	(revision a1b247163dd00d4b19fd556819b00a9ccf638299)
@@ -129,5 +129,43 @@
                         except: pass
 
-   
+    def getProfile(self):
+        """
+        Get SLD profile 
+        
+        : return: (r, beta) where r is a list of radius of the transition points
+                beta is a list of the corresponding SLD values 
+        : Note: This works only for func_shell# = 2.
+        """
+        r = []
+        beta = []
+        # for core at r=0
+        r.append(0)
+        beta.append(self.params['sld_core'])
+        # for core at r=rad_core
+        r.append(self.params['rad_core'])
+        beta.append(self.params['sld_core'])
+        
+        # for shells
+        for n in range(1,self.n_shells+1):
+            # Left side of each shells
+            r0 = r[len(r)-1]            
+            r.append(r0)
+            exec "beta.append(self.params['sld_shell%s'% str(n)])"
+
+            # Right side of each shells
+            exec "r0 += self.params['thick_shell%s'% str(n)]"
+            r.append(r0)
+            exec "beta.append(self.params['sld_shell%s'% str(n)])"
+            
+        # for solvent
+        r0 = r[len(r)-1]            
+        r.append(r0)
+        beta.append(self.params['sld_solv'])
+        r_solv = 5*r0/4
+        r.append(r_solv)
+        beta.append(self.params['sld_solv'])
+        
+        return r, beta
+
     def setParam(self, name, value):
         """ 
Index: sansmodels/src/sans/models/MultiplicationModel.py
===================================================================
--- sansmodels/src/sans/models/MultiplicationModel.py	(revision 06c7fccf253fa949304f3a45af96578196911cf6)
+++ sansmodels/src/sans/models/MultiplicationModel.py	(revision a1b247163dd00d4b19fd556819b00a9ccf638299)
@@ -82,6 +82,22 @@
         ##set dispersion only from p_model 
         for name , value in self.p_model.dispersion.iteritems():
-            self.dispersion[name]= value                           
-
+            self.dispersion[name]= value 
+                                      
+    def getProfile(self):
+        """
+        Get SLD profile of p_model if exists
+        
+        : return: (r, beta) where r is a list of radius of the transition points
+                beta is a list of the corresponding SLD values 
+        : Note: This works only for func_shell# = 2 (exp function).
+        """
+        try:
+            x,y = self.p_model.getProfile()
+        except:
+            x = None
+            y = None
+            
+        return x, y
+    
     def _set_params(self):
         """
Index: sansmodels/src/sans/models/SphereExpShellModel.py
===================================================================
--- sansmodels/src/sans/models/SphereExpShellModel.py	(revision e096270047b0757e07e7187aa5de071c857a7e13)
+++ sansmodels/src/sans/models/SphereExpShellModel.py	(revision a1b247163dd00d4b19fd556819b00a9ccf638299)
@@ -42,5 +42,5 @@
         for item in self.model.orientation_params:
             self.orientation_params.append(item)
-                
+        self.getProfile()        
     def _clone(self, obj):
         """
@@ -133,6 +133,61 @@
                             self.model.setParam(key, value)
                         except: pass
-
-   
+    def getProfile(self):
+        """
+        Get SLD profile 
+        
+        : return: (r, beta) where r is a list of radius of the transition points
+                beta is a list of the corresponding SLD values 
+        : Note: This works only for func_shell# = 2.
+        """
+        # max_pts for each shells
+        max_pts = 10
+        r = []
+        beta = []
+        # for core at r=0
+        r.append(0)
+        beta.append(self.params['sld_core'])
+        # for core at r=rad_core
+        r.append(self.params['rad_core'])
+        beta.append(self.params['sld_core'])
+        
+        # for shells
+        for n in range(1,self.n_shells+1):
+            # Left side of each shells
+            r0 = r[len(r)-1]            
+            r.append(r0)
+            exec "beta.append(self.params['sld_in_shell%s'% str(n)])"
+            
+            exec "A = self.params['A_shell%s'% str(n)]"
+            if A ==0:
+                # Right side of each shells
+                exec "r0 += self.params['thick_shell%s'% str(n)]"
+                r.append(r0)
+                exec "beta.append(self.params['sld_in_shell%s'% str(n)])"
+            else:
+                from math import exp
+                rn = r0
+                for n_sub in range(0,max_pts):
+                    # Right side of each sub_shells
+                    exec "rn += self.params['thick_shell%s'% str(n)]/10.0"
+                    r.append(rn)
+                    exec "slope = (self.params['sld_out_shell%s'% str(n)] \
+                                        -self.params['sld_in_shell%s'% str(n)]) \
+                                        /(exp(self.params['A_shell%s'% str(n)])-1)"
+                    exec "const = (self.params['sld_in_shell%s'% str(n)]-slope)"
+                    exec "beta_n = slope*exp((self.params['A_shell%s'% str(n)]*(rn-r0) \
+                                        /self.params['thick_shell%s'% str(n)])) + const"
+                    beta.append(beta_n)
+            
+        # for solvent
+        r0 = r[len(r)-1]            
+        r.append(r0)
+        beta.append(self.params['sld_solv'])
+        r_solv = 5*r0/4
+        r.append(r_solv)
+        beta.append(self.params['sld_solv'])
+        
+        return r, beta
+    
     def setParam(self, name, value):
         """ 
Index: sansmodels/src/sans/models/c_extensions/onion.c
===================================================================
--- sansmodels/src/sans/models/c_extensions/onion.c	(revision e096270047b0757e07e7187aa5de071c857a7e13)
+++ sansmodels/src/sans/models/c_extensions/onion.c	(revision a1b247163dd00d4b19fd556819b00a9ccf638299)
@@ -41,5 +41,5 @@
 	fun_type[n+1] = 0;
 
-    double bes,fun,alpha,f,vol,qr,r,contr,f2;
+    double bes,fun,alpha,f,vol,vol_pre,vol_sub,qr,r,contr,f2;
     double sign;
     double pi;
@@ -48,4 +48,7 @@
     f = 0.0;
     r = 0.0;
+    vol = 0.0;
+    vol_pre = 0.0;
+    vol_sub = 0.0;
     double r0 = 0.0;
 
@@ -58,4 +61,5 @@
     		A[i] = 0.0;
     	}
+    	vol_pre = vol;
         switch(fun_type[i]){
             case 2 :
@@ -103,4 +107,7 @@
 
                         vol = 4.0 * pi / 3.0 * r * r * r;
+                        if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && A[i]==0.0){
+                        	vol_sub += (vol_pre - vol);
+                        }
                         f += vol * (contr * (fun) + (sld_in[i]-slope[i]) * bes);
                         }
@@ -141,4 +148,7 @@
                                 }
                             vol = 4.0 * pi / 3.0 * r * r * r;
+                            if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && fun_type[i]==0){
+                            	vol_sub += (vol_pre - vol);
+                            }
                             f += vol * (bes * contr + fun * slope[i]);
                             }
@@ -147,5 +157,5 @@
 
         }
-
+    vol += vol_sub;
     f2 = f * f / vol * 1.0e8;
 	f2 *= scale;
Index: sansmodels/src/sans/models/test/utest_model_sphereexpshell.py
===================================================================
--- sansmodels/src/sans/models/test/utest_model_sphereexpshell.py	(revision e096270047b0757e07e7187aa5de071c857a7e13)
+++ sansmodels/src/sans/models/test/utest_model_sphereexpshell.py	(revision a1b247163dd00d4b19fd556819b00a9ccf638299)
@@ -14,8 +14,10 @@
         from sans.models.SphereExpShellModel import SphereExpShellModel
         from sans.models.CoreMultiShellModel import CoreMultiShellModel
+        from sans.models.VesicleModel import VesicleModel 
 
         self.model = SphereExpShellModel(n_shells=1)
         self.model2 = SphereExpShellModel(n_shells=1).model
         self.model3 = CoreMultiShellModel(n_shells=1)
+        self.model4 = VesicleModel()
         
     def test_compare_Exp0_flat(self):
@@ -49,4 +51,40 @@
         self.assertAlmostEqual(self.model2.run(0.1),self.model3.run(0.1),10)
 
+    def test_compare_Exp0_flat_vesicle(self):
+        """
+        Check if Exp function with A_shell=0 gives the same value as Flat function of vesicle model when sld_solv=sld_core
+        """
+        print "\n*****Note: All tests (test_compare_Exp0_flat and test_compare_Expsmall_line) were passes since Sept. 18, 2010..."
+        # Exp: func_shell = 2, Line: func_shell =1 , Flat: func_shell = 0.
+        # A_shell = The coefficient of the exponential function: exp(A_shell*(r-ro)/thick_shell)
+        # exp function by default
+        # exp function crosses over to flat func at A_shell=0
+        self.model.setParam("A_shell1", 0)
+                # set A_shell=1
+        self.model2.setParam("A_shell1", 1)
+        # change the function to flat function
+        self.model2.setParam("func_shell1", 0)
+        
+        # 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("scale", 1.0)
+        self.model.setParam("sld_core", 6.36e-006)
+        self.model.setParam("sld_in_shell1", 5e-007)
+        self.model.setParam("sld_solv", 6.36e-006)
+        self.model.setParam("thick_shell1", 30.0)
+        # 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("scale", 1.0)
+        self.model2.setParam("sld_core", 6.36e-006)
+        self.model2.setParam("sld_in_shell1", 5e-007)
+        self.model2.setParam("sld_solv", 6.36e-006)
+        self.model2.setParam("thick_shell1", 30.0)
+        #Compare exp(A=0) to flat (where A_shell is null) function
+        self.assertEqual(self.model.run(0.1),self.model4.run(0.1))
+        self.assertEqual(self.model2.run(0.1),self.model4.run(0.1))
+        #self.assertAlmostEqual(self.model2.run(0.1),self.model3.run(0.1),10)
+
   
     def test_compare_Expsmall_line(self):
Index: sansmodels/src/sans/models/test/utest_models.py
===================================================================
--- sansmodels/src/sans/models/test/utest_models.py	(revision 9ce41c6f9cb652f9c0a81a779f2dd143382ac661)
+++ sansmodels/src/sans/models/test/utest_models.py	(revision a1b247163dd00d4b19fd556819b00a9ccf638299)
@@ -13,5 +13,15 @@
 # pylint: disable-msg=R0201
 
-
+class TestSpherew(unittest.TestCase):
+    """ Unit tests for sphere model """
+    
+    def setUp(self):
+        from sans.models.CoreFourShellModel import CoreFourShellModel
+        from sans.models.CoreMultiShellModel import CoreMultiShellModel
+        self.comp = CoreMultiShellModel(4)
+        
+    def test1D(self):
+        """ Test 1D model for a sphere """
+        self.comp._set_dispersion()
         
 class TestSphere(unittest.TestCase):
