Index: calculatorview/doc/sld_calculator_help.html
===================================================================
--- calculatorview/doc/sld_calculator_help.html	(revision 39e49a1c627b191bebc99cb33ec034b9e82abb90)
+++ calculatorview/doc/sld_calculator_help.html	(revision 39e49a1c627b191bebc99cb33ec034b9e82abb90)
@@ -0,0 +1,42 @@
+<html>
+<body>
+<h4>Scattering Length Density (SLD) Calculator</h4>
+<ul>
+<li><a href="#SLD_calculator">Description</a></li>
+<li><a href="#How to use">How to format the compound name?</a></li>
+</ul>
+<h5><a name="SLD_calculator">Description</a></h5>
+<p>
+The neutron scattering length density is defined as: <br> 
+SLD = (b_c1 +b_c2+...+b_cn )/Vm  <br> where b_ci is the bound coherent scattering length of ith of 
+n atoms in a molecule with the molecular volume Vm
+</p>
+
+
+<h5><a name="How to use">How to format the compound name?</a></h5>
+<p>
+To calculate scattering length densities enter a compound and
+a mass density and click "Calculate". Enter a wavelength value is optional and its default 
+value will be 6.0A.
+</p> 
+<p>
+<ul>
+<li>Formula strings consist of counts and atoms such as "CaCO3+6H2O".</li>
+<li>Groups can be separated by <b>'+'</b> or <b>space</b>, so "CaCO3 6H2O" works as well.</li>
+<li>Groups and be defined using parentheses, such as "CaCO3(H2O)6".</li>
+<li>Parentheses can nest: "(CaCO3(H2O)6)1".</li>
+<li>Isotopes are represented by index, e.g., "CaCO[18]3+6H2O".</li>
+More examples: H[1], H[2].
+<li>Counts can be integer or decimal, e.g. "CaCO3+(3HO0.5)2".</li>
+Other compositions can be calculated as well,<br>
+for example a 70-30 mixture of H2O/D2O can be written as <b>H14O7+ D6O3</b><br>
+or more simply <b>H7D3O5 <\b>(i.e. 7 hydrogens, 3 deuteriums, and 5 oxygens)<br>
+and the mass density calculated based on the percentages of H and D. 
+Type for example "C[13]6 H[2]12 O[18]6" for C(13)6H(2)12O(18)6 (6 Carbon-13 atoms, 12 deuterium atoms, and 6 Oxygen-18 atoms) 
+
+</ul>
+</p>
+
+</body>
+
+<\html>
Index: calculatorview/perspectives/calculator/sld_panel.py
===================================================================
--- calculatorview/perspectives/calculator/sld_panel.py	(revision 383eeaa5bd34d93a19c4a505968cb5a66b5002c1)
+++ calculatorview/perspectives/calculator/sld_panel.py	(revision 39e49a1c627b191bebc99cb33ec034b9e82abb90)
@@ -16,5 +16,5 @@
 
 #SLD panel size 
-if sys.platform.count("darwin")==0:
+if sys.platform.count("win32")>0:
     _STATICBOX_WIDTH = 350
     PANEL_SIZE = 400
@@ -41,5 +41,5 @@
         
         # Object that receive status event
-        self.base= base
+        self.base = base
         self.calculator = SldCalculator()
         self.wavelength = self.calculator.wavelength
@@ -56,7 +56,7 @@
         unit_a = '[A]'
         unit_density = '[g/cm^(3)]'
-        unit_sld= '[1/A^(2)]'
-        unit_cm1='[1/cm]'
-        unit_cm='[cm]'
+        unit_sld = '[1/A^(2)]'
+        unit_cm1 ='[1/cm]'
+        unit_cm ='[cm]'
         sizer_input = wx.GridBagSizer(5,5)
         sizer_output = wx.GridBagSizer(5,5)
@@ -90,6 +90,6 @@
         sizer_input.Add(density_txt,(iy, ix),(1,1),\
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        ix +=1
-        sizer_input.Add(self.density_ctl,(iy, ix),(1,1),\
+        ix += 1
+        sizer_input.Add(self.density_ctl, (iy, ix), (1,1),\
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix +=1
@@ -98,10 +98,10 @@
         iy += 1
         ix = 0
-        sizer_input.Add(wavelength_txt,(iy, ix),(1,1),\
-                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        ix +=1
+        sizer_input.Add(wavelength_txt, (iy, ix),(1,1),\
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
         sizer_input.Add(self.wavelength_ctl,(iy, ix),(1,1),\
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        ix +=1
+        ix += 1
         sizer_input.Add(unit_a_txt,(iy, ix),(1,1),\
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
@@ -113,5 +113,5 @@
         boxsizer2.SetMinSize((_STATICBOX_WIDTH,-1))
         
-        i_complex= '+ i'
+        i_complex = '+ i'
         neutron_sld_txt = wx.StaticText(self, -1, 'Neutron SLD')
         self.neutron_sld_reel_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1))
@@ -162,8 +162,8 @@
         sizer_output.Add(neutron_sld_txt,(iy, ix),(1,1),
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        ix +=1
+        ix += 1
         sizer_output.Add(self.neutron_sld_reel_ctl,(iy, ix),(1,1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        ix +=1
+        ix += 1
         sizer_output.Add(wx.StaticText(self, -1, i_complex)
                          ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
@@ -184,8 +184,8 @@
         sizer_output.Add(wx.StaticText(self, -1, i_complex)
                          ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix +=1
+        ix += 1
         sizer_output.Add(self.cu_ka_sld_im_ctl
                          ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
-        ix +=1
+        ix += 1
         sizer_output.Add(cu_ka_sld_units_txt
                          ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
@@ -200,5 +200,5 @@
         sizer_output.Add(wx.StaticText(self, -1, i_complex)
                          ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix +=1
+        ix += 1
         sizer_output.Add(self.mo_ka_sld_im_ctl
                          ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
@@ -210,32 +210,32 @@
         sizer_output.Add(neutron_inc_txt,(iy, ix),(1,1),
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        ix +=1
+        ix += 1
         sizer_output.Add(self.neutron_inc_ctl,(iy, ix),(1,1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix += 2
+        sizer_output.Add(neutron_inc_units_txt,(iy, ix),(1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        iy += 1
+        ix = 0
+        sizer_output.Add(neutron_abs_txt, (iy, ix), (1,1),
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_output.Add(self.neutron_abs_ctl, (iy, ix), (1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix +=2
-        sizer_output.Add(neutron_inc_units_txt,(iy, ix),(1,1),
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        iy += 1
-        ix = 0
-        sizer_output.Add(neutron_abs_txt,(iy, ix),(1,1),
-                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        ix +=1
-        sizer_output.Add(self.neutron_abs_ctl,(iy, ix),(1,1),
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        ix +=2
-        sizer_output.Add(neutron_abs_units_txt,(iy, ix),(1,1),
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        iy += 1
-        ix = 0
-        sizer_output.Add(neutron_length_txt,(iy, ix),(1,1),
-                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        ix +=1
-        sizer_output.Add(self.neutron_length_ctl,(iy, ix),(1,1),
+        sizer_output.Add(neutron_abs_units_txt, (iy, ix), (1,1),
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        iy += 1
+        ix = 0
+        sizer_output.Add(neutron_length_txt, (iy, ix), (1,1),
+                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix +=1
+        sizer_output.Add(self.neutron_length_ctl, (iy, ix), (1,1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix +=2
-        sizer_output.Add(neutron_length_units_txt,(iy, ix),(1,1),
+        ix += 2
+        sizer_output.Add(neutron_length_units_txt, (iy, ix), (1,1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
         boxsizer2.Add( sizer_output )
-        sizer2.Add(boxsizer2,0, wx.EXPAND | wx.ALL, 10)
+        sizer2.Add(boxsizer2,0, wx.EXPAND|wx.ALL, 10)
         #-----Button  sizer------------
     
@@ -259,24 +259,24 @@
     def check_inputs(self):
         """Check validity user inputs"""
-        flag= True
+        flag = True
        
         if check_float(self.density_ctl):
             self.density = float(self.density_ctl.GetValue())
         else:
-            flag=False
+            flag = False
             raise ValueError,"Error for Density value :expect float"
     
-        self.wavelength= self.wavelength_ctl.GetValue()
-        if self.wavelength.lstrip().rstrip()=="":
+        self.wavelength = self.wavelength_ctl.GetValue()
+        if self.wavelength.lstrip().rstrip() == "":
             self.wavelength = self.calculator.wavelength
         else:
             if check_float(self.wavelength_ctl):
-                self.wavelength= float(self.wavelength)
+                self.wavelength = float(self.wavelength)
             else:
                 flag = False
                 raise ValueError,"Error for wavelenth value :expect float"
                 
-        self.formulata_text= self.compound_ctl.GetValue().lstrip().rstrip()
-        if self.formulata_text!="":
+        self.formulata_text = self.compound_ctl.GetValue().lstrip().rstrip()
+        if self.formulata_text != "":
             self.compound_ctl.SetBackgroundColour(wx.WHITE)
             self.compound_ctl.Refresh()
@@ -284,5 +284,5 @@
             self.compound_ctl.SetBackgroundColour("pink")
             self.compound_ctl.Refresh()
-            flag=False
+            flag = False
             raise ValueError, "Enter a formula"
         return flag 
@@ -297,9 +297,10 @@
                 #get ready to compute
                 try:
-                    self.calculator.setValue(self.formulata_text,self.density,self.wavelength)
+                    self.calculator.set_value(self.formulata_text,
+                                              self.density, self.wavelength)
                 except:
-                    if self.base !=None:
-                        msg= "SLD Calculator: %s" % (sys.exc_value)
-                        wx.PostEvent(self.base, StatusEvent(status= msg ))
+                    if self.base is not None:
+                        msg = "SLD Calculator: %s" %(sys.exc_value)
+                        wx.PostEvent(self.base, StatusEvent(status=msg))
                     else:
                         raise
@@ -307,20 +308,20 @@
                 
                 # Compute the Cu SLD
-                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))
+                Cu_reel, Cu_im = self.calculator.calculate_xray_sld( "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.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))
+                Mo_reel, Mo_im = self.calculator.calculate_xray_sld( "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.calculator.calculateNSld()
-                im = self.calculator.calculateAbsorptionIm()
-                length = self.calculator.calculateLength()
+                coh,absorp,inc = self.calculator.calculate_neutron_sld()
+                im = self.calculator.calculate_coherence_im()
+                length = self.calculator.calculate_length()
                 # 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_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))
                 # Neutron length
@@ -329,7 +330,7 @@
                 self.wavelength_ctl.SetValue(str(self.wavelength))
         except:
-            if self.base !=None:
-                  msg= "SLD Calculator: %s" % (sys.exc_value)
-                  wx.PostEvent(self.base, StatusEvent(status= msg ))
+            if self.base is not None:
+                  msg = "SLD Calculator: %s"%(sys.exc_value)
+                  wx.PostEvent(self.base, StatusEvent(status=msg))
             else:
                 raise
