Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision 4faf4bad9d37a08d61abda7e341aad4fc88b1042)
+++ sansview/perspectives/fitting/fitting.py	(revision 1d67243f2f80eeeff35d9aedfa65a9e96ec651f5)
@@ -132,9 +132,9 @@
         wx.EVT_MENU(owner, id1, self.on_add_sim_page)
         #menu for SLD Calculator
-        self.menu1.AppendSeparator()
-        sld_menu = wx.Menu()
+        self.tool_menu = wx.Menu()
+        id_tool_menu = wx.NewId()
         sld_id = wx.NewId()
         sld_help= "Compute the scattering length density of molecules"
-        self.menu1.Append(sld_id, "SLD Calculator",sld_help)
+        self.tool_menu.Append(sld_id, "SLD Calculator",sld_help)
         wx.EVT_MENU(owner,sld_id,  self.onCalculateSld)
     
@@ -150,5 +150,5 @@
       
         #create  menubar items
-        return [(id, self.menu1, "Fitting"),
+        return [(id, self.menu1, "Fitting"),(id_tool_menu, self.tool_menu, "Tools"),
                 (id2, menu2, "Model")]
        
Index: sansview/perspectives/fitting/sldCalculator.py
===================================================================
--- sansview/perspectives/fitting/sldCalculator.py	(revision 1d67243f2f80eeeff35d9aedfa65a9e96ec651f5)
+++ sansview/perspectives/fitting/sldCalculator.py	(revision 1d67243f2f80eeeff35d9aedfa65a9e96ec651f5)
@@ -0,0 +1,104 @@
+"""
+    This module intends to compute the neutron scattering length density of molecule
+    @author: Gervaise B. Alina
+"""
+
+import periodictable
+from periodictable import formula
+from periodictable.xsf import xray_energy, xray_sld_from_atoms
+from periodictable.constants import avogadro_number
+import periodictable.nsf
+neutron_sld_from_atoms= periodictable.nsf.neutron_sld_from_atoms 
+
+class SldCalculator(object):
+    """
+        compute neutron SLD and related parameters
+    """
+    def __init__(self):
+        self.wavelength  = 6.0
+        self.coherence   = 0.0
+        self.absorption  = 0.0
+        self.incoherence = 0.0
+        self.sld_formula = None
+        self.volume = 0.0
+        self.density = None
+        self.length= 0.0
+        
+        
+    def setValue(self,user_formula, density, wavelength=6.0):
+        """
+            Store values of density and wavelength into the calculator 
+            and compute the volume
+        """
+        self.wavelength = wavelength
+        self.density    = float(density)
+        self.sld_formula = formula(str(user_formula), density= self.density)
+        if self.density==0:
+            raise ZeroDivisionError,"integer division or modulo by zero for density"
+            return 
+        self.volume = (self.sld_formula.mass /self.density)/avogadro_number*1.0e24   
+        
+        
+    def calculateXRaySld(self, element):
+        """
+            Get an element and compute the corresponding SLD for a given formula
+            @param element:  elementis a string of existing atom
+        """
+        myformula = formula(str (element))
+        if len(myformula.atoms)!=1:
+            return 
+        element= myformula.atoms.keys()[0] 
+        energy = xray_energy(element.K_alpha)
+        atom = self.sld_formula.atoms
+        atom_reel, atom_im = xray_sld_from_atoms( atom,
+                                              density= self.density,
+                                              energy= energy )
+        return atom_reel, atom_im
+      
+        
+    def calculateNSld(self):
+        """
+            Compute the neutron SLD for a given molecule
+            @return absorp: absorption
+            @return coh: coherence cross section
+            @return inc: incoherence cross section
+        """
+        if self.density ==0:
+            raise ZeroDivisionError,"integer division or modulo by zero for density"
+            return 
+        atom = self.sld_formula.atoms
+        coh,absorp,inc = neutron_sld_from_atoms(atom,self.density,self.wavelength)
+        #Don't know if value is return in cm or  cm^(-1).assume return in cm
+        # to match result of neutron inc of Alan calculator
+        self.incoherence = inc*1/10
+        #Doesn't match result of Alan calculator for absorption factor of 2
+        #multiplication of 100 is going around
+        self.absorption = absorp*2*100
+        self.coherence  = coh
+        return self.coherence, self.absorption, self.incoherence
+    
+    
+    def computeLength(self):
+        """
+            Compute the neutron 1/e length
+        """
+        self.length= (self.coherence+ self.absorption+ self.incoherence)/self.volume
+        return self.length
+        
+        
+    def absorptionIm(self):
+        """
+            Compute imaginary part of the absorption 
+        """
+        atom = self.sld_formula.atoms 
+        #im: imaginary part of neutron SLD
+        im=0
+        for el, count in atom.iteritems():
+            if el.neutron.b_c_i !=None:
+                im += el.neutron.b_c_i*count 
+        if self.volume !=0:
+            im = im/self.volume
+        else:
+            raise ZeroDivisionError,"integer division or modulo by zero for volume"
+        return im
+        
Index: sansview/perspectives/fitting/sldPanel.py
===================================================================
--- sansview/perspectives/fitting/sldPanel.py	(revision 4faf4bad9d37a08d61abda7e341aad4fc88b1042)
+++ sansview/perspectives/fitting/sldPanel.py	(revision 1d67243f2f80eeeff35d9aedfa65a9e96ec651f5)
@@ -1,4 +1,4 @@
 """
-    This module intends to compute the neutron scattering length density of molecule
+    This module provide GUI for the neutron scattering length density calculator
     @author: Gervaise B. Alina
 """
@@ -7,20 +7,11 @@
 import sys
 
-import periodictable
-from periodictable import formula
-from periodictable.xsf import xray_energy, xray_sld_from_atoms
-from periodictable.constants import avogadro_number
-import periodictable.nsf
-neutron_sld_from_atoms= periodictable.nsf.neutron_sld_from_atoms 
-
 from sans.guiframe.utils import format_number, check_float
 from sans.guicomm.events import StatusEvent  
-
+from sldCalculator import SldCalculator
 
 _BOX_WIDTH = 76
 _STATICBOX_WIDTH = 350
 _SCALE = 1e-6
-_DEFAULT_WAVELENGTH = 1.798
-
 
 class SldPanel(wx.Panel):
@@ -32,4 +23,7 @@
         # Object that receive status event
         self.base= base
+        self.calculator = SldCalculator()
+        self.wavelength = self.calculator.wavelength
+        
         self._do_layout()
         self.SetAutoLayout(True)
@@ -58,4 +52,5 @@
         wavelength_txt = wx.StaticText(self, -1, 'Wavelength (A)')
         self.wavelength_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
+        self.wavelength_ctl.SetValue(str(self.wavelength))
         iy = 0
         ix = 0
@@ -231,5 +226,4 @@
         #---------layout----------------
         vbox  = wx.BoxSizer(wx.VERTICAL)
-
         vbox.Add(sizer1)
         vbox.Add(sizer2)
@@ -237,4 +231,5 @@
         vbox.Fit(self) 
         self.SetSizer(vbox)
+        
         
     def check_inputs(self):
@@ -250,5 +245,5 @@
         self.wavelength= self.wavelength_ctl.GetValue()
         if self.wavelength.lstrip().rstrip()=="":
-            self.wavelength = _DEFAULT_WAVELENGTH
+            self.wavelength = self.calculator.wavelength
         else:
             if check_float(self.wavelength_ctl):
@@ -269,4 +264,5 @@
         return flag 
         
+        
     def onHelp(self, event):
         """
@@ -294,6 +290,5 @@
                 #get ready to compute
                 try:
-                    self.new_formula = formula(self.formulata_text, density= self.density)
-                    atom = self.new_formula.atoms
+                    self.calculator.setValue(self.formulata_text,self.density,self.wavelength)
                 except:
                     if self.base !=None:
@@ -303,39 +298,27 @@
                         raise
                     return
+                
                 # Compute the Cu SLD
-                Cu_reel, Cu_im = self.calculateXRaySld( "Cu", density= self.density,
-                                                        user_formula= self.new_formula)
+                Cu_reel, Cu_im = self.calculator.calculateXRaySld( "Cu")
                 self.cu_ka_sld_reel_ctl.SetValue(format_number(Cu_reel*_SCALE))
                 self.cu_ka_sld_im_ctl.SetValue(format_number(Cu_im*_SCALE))
+                
                 # Compute the Mo SLD
-                Mo_reel, Mo_im = self.calculateXRaySld( "Mo", density= self.density,
-                                                        user_formula= self.new_formula)
+                Mo_reel, Mo_im = self.calculator.calculateXRaySld( "Mo")
                 self.mo_ka_sld_reel_ctl.SetValue(format_number(Mo_reel*_SCALE))
                 self.mo_ka_sld_im_ctl.SetValue(format_number(Mo_im*_SCALE))
                
-                coh,absorp,inc= self.calculateNSld(self.density, wavelength= self.wavelength,
-                                                     user_formula= self.new_formula)
-                #Don't know if value is return in cm or  cm^(-1).assume return in cm
-                # to match result of neutron inc of Alan calculator
-                inc= inc*1/10
-                #Doesn't match result of Alan calculator for absorption factor of 2
-                #multiplication of 100 is going around
-                absorp= absorp *2*100
-                volume= (self.new_formula.mass /self.density)/avogadro_number*1.0e24
-                #im: imaginary part of neutron SLD
-                im=0
-                for el, count in atom.iteritems():
-                    if el.neutron.b_c_i !=None:
-                        im += el.neutron.b_c_i*count 
-                im = im/volume
-                
+                coh,absorp,inc= self.calculator.calculateNSld()
+                im = self.calculator.absorptionIm()
+                length = self.calculator.computeLength()
+                # Neutron SLD
                 self.neutron_sld_reel_ctl.SetValue(format_number(coh*_SCALE))
                 self.neutron_sld_im_ctl.SetValue(format_number(im*_SCALE))
                 self.neutron_inc_ctl.SetValue(format_number(inc ))
                 self.neutron_abs_ctl.SetValue(format_number(absorp))
-                #Don't know if value is return in cm or  cm^(-1).assume return in cm
-                # to match result of neutron inc of Alan calculator
-                length= (coh+ absorp+ inc)/volume
+                # Neutron length
                 self.neutron_length_ctl.SetValue(format_number(length))
+                # display wavelength
+                self.wavelength_ctl.SetValue(str(self.wavelength))
         except:
             if self.base !=None:
@@ -346,44 +329,7 @@
             return   
 
-    def calculateXRaySld(self, element, density,user_formula):
-        """
-            Get an element and compute the corresponding SLD for a given formula
-            @param element:  elementis a string of existing atom
-            @param formula: molecule enters by the user
-        """
-        try:
-            myformula = formula(str (element))
-            if len(myformula.atoms)!=1:
-                return 
-            element= myformula.atoms.keys()[0] 
-            energy = xray_energy(element.K_alpha)
-            atom = user_formula.atoms
-            atom_reel, atom_im = xray_sld_from_atoms( atom,
-                                                  density=density,
-                                                  energy= energy )
-            return atom_reel, atom_im
-        except:
-            if self.base !=None:
-                  msg= "SLD Calculator: %s" % (sys.exc_value)
-                  wx.PostEvent(self.base, StatusEvent(status= msg ))
-            else:
-                raise
-            return   
-        
-    def calculateNSld(self,density,wavelength,user_formula ):
-        """
-            Compute the neutron SLD for a given molecule
-            @return absorp: absorption
-            @return coh: coherence cross section
-            @return inc: incoherence cross section
-          
-        """
-        if density ==0:
-            raise ZeroDivisionError,"integer division or modulo by zero for density"
-            return 
-        atom = user_formula.atoms
-        coh,absorp,inc = neutron_sld_from_atoms(atom,density,wavelength)
-
-        return coh,absorp,inc
+   
+        
+  
     
    
