Index: src/sas/sasgui/perspectives/calculator/sld_panel.py
===================================================================
--- src/sas/sasgui/perspectives/calculator/sld_panel.py	(revision 8963a555171fcd15a1f53af25f63051ae31ca6eb)
+++ src/sas/sasgui/perspectives/calculator/sld_panel.py	(revision bd8411d5b1f4562959becd4ecaec4a73a2eebe8d)
@@ -61,5 +61,5 @@
         self.base = base
         self.neutron_wavelength = WAVELENGTH
-        self.xray_wavelength = WAVELENGTH
+        self.xray_source_input = WAVELENGTH
         self.parent = parent
         #layout attribute
@@ -69,5 +69,5 @@
         self.density = ""
         self.neutron_wavelength_ctl = None
-        self.xray_wavelength_ctl = None
+        self.xray_source_input_ctl = None
         self.xray_cbox = None
         self.neutron_sld_real_ctl = None
@@ -114,7 +114,7 @@
         self.neutron_wavelength_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1))
         self.neutron_wavelength_ctl.SetValue(str(self.neutron_wavelength))
-        xray_wavelength_txt = wx.StaticText(self, -1, 'X-ray wavelength')
-        self.xray_wavelength_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1))
-        self.xray_wavelength_ctl.SetValue(str(self.xray_wavelength))
+        xray_source_input_txt = wx.StaticText(self, -1, 'X-ray wavelength')
+        self.xray_source_input_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1))
+        self.xray_source_input_ctl.SetValue(str(self.xray_source_input))
         neutron_unit_a_txt = wx.StaticText(self, -1, unit_a)
 
@@ -153,8 +153,8 @@
         iy += 1
         ix = 0
-        sizer_input.Add(xray_wavelength_txt, (iy, ix), (1, 1),
-                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
-        ix += 1
-        sizer_input.Add(self.xray_wavelength_ctl, (iy, ix), (1, 1),
+        sizer_input.Add(xray_source_input_txt, (iy, ix), (1, 1),
+                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        sizer_input.Add(self.xray_source_input_ctl, (iy, ix), (1, 1),
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
@@ -309,5 +309,4 @@
         fill the x-ray combobox with the sources
         """
-        # source_list = ['Element', 'Energy (keV)', 'Wavelength (A)']
         source_list = ['[A]', '[keV]', 'Element']
         for source in source_list:
@@ -315,4 +314,5 @@
             self.xray_cbox.SetClientData(pos, str(source.strip()))
         self.xray_cbox.SetSelection(0)
+        self.xray_source = source_list[0]
 
     def on_select_xray(self, event=None):
@@ -377,5 +377,5 @@
 
         self.neutron_wavelength = self.neutron_wavelength_ctl.GetValue()
-        self.xray_wavelength = self.xray_wavelength_ctl.GetValue()
+        self.xray_source_input = self.xray_source_input_ctl.GetValue()
 
         if str(self.neutron_wavelength).lstrip().rstrip() == "":
@@ -392,16 +392,26 @@
                 msg += "Error for wavelength value :expect float"
 
-        if str(self.xray_wavelength).lstrip().rstrip() == "":
-            self.xray_wavelength = WAVELENGTH
-            self.xray_wavelength_ctl.SetValue(str(WAVELENGTH))
-            self.xray_wavelength_ctl.SetBackgroundColour(wx.WHITE)
-            self.xray_wavelength_ctl.Refresh()
+        if str(self.xray_source_input).lstrip().rstrip() == "":
+            self.xray_source_input = WAVELENGTH
+            self.xray_source_input_ctl.SetValue(str(WAVELENGTH))
+            self.xray_source_input_ctl.SetBackgroundColour(wx.WHITE)
+            self.xray_source_input_ctl.Refresh()
             msg += "Default value for wavelength is 6.0"
         else:
-            if check_float(self.xray_wavelength_ctl):
-                self.xray_wavelength = float(self.xray_wavelength)
-            else:
-                flag = False
-                msg += "Error for wavelength value :expect float"
+            if (self.xray_source == '[A]') or (self.xray_source == '[keV]'):
+                if check_float(self.xray_source_input_ctl):
+                    self.xray_source_input = float(self.xray_source_input)
+                else:
+                    flag = False
+                    msg += "Error for wavelength value :expect float"
+            elif (self.xray_source == 'Element'):
+                try:
+                    import periodictable
+                    exec("periodictable." + self.xray_source_input)
+                except AttributeError:
+                    flag = False
+                    msg += "X-ray element supplied isn't in the database"
+
+
 
         self.compound = self.compound_ctl.GetValue().lstrip().rstrip()
@@ -438,5 +448,4 @@
         return xray_sld_from_atoms(atom, density=density, energy=energy)
 
-
     def calculateSld(self, event):
         """
@@ -460,18 +469,16 @@
                                    wavelength=self.neutron_wavelength)
             if self.xray_source == "[A]":
-                # xray_real, xray_im = self.calculate_sld_helper(element=self.xray_wavelength,
-                #                                      density=self.density,
-                #                             molecule_formula=self.sld_formula)
-                pass
+                energy = xray_energy(self.xray_source_input)
+                xray_real, xray_im = xray_sld_from_atoms(self.sld_formula.atoms,
+                                                         density=self.density,
+                                                         energy=energy)
             elif self.xray_source == "[keV]":
-                # xray_real, xray_im = self.calculate_sld_helper(element=self.xray_wavelength,
-                #                                      density=self.density,
-                #                             molecule_formula=self.sld_formula)
-                pass
+                xray_real, xray_im = xray_sld_from_atoms(self.sld_formula.atoms,
+                                                         density=self.density,
+                                                         energy=self.xray_source_input)
             elif self.xray_source == "Element":
-                # xray_real, xray_im = self.calculate_sld_helper(element=self.xray_wavelength,
-                #                                      density=self.density,
-                #                             molecule_formula=self.sld_formula)
-                pass
+                xray_real, xray_im = self.calculate_sld_helper(element=self.xray_source_input,
+                                                               density=self.density,
+                                                               molecule_formula=self.sld_formula)
             # set neutron sld values
             val = format_number(sld_real * _SCALE)
@@ -504,8 +511,6 @@
         self.neutron_sld_real_ctl.SetValue("")
         self.neutron_sld_im_ctl.SetValue("")
-        self.mo_ka_sld_real_ctl.SetValue("")
-        self.mo_ka_sld_im_ctl.SetValue("")
-        self.cu_ka_sld_real_ctl.SetValue("")
-        self.cu_ka_sld_im_ctl.SetValue("")
+        self.xray_sld_real_ctl.SetValue("")
+        self.xray_sld_im_ctl.SetValue("")
         self.neutron_abs_ctl.SetValue("")
         self.neutron_inc_ctl.SetValue("")
