Computational Sciences and Engineering Division

**Spallation Neutron Source Data Analysis**

Jessica A. Travierso

Research Alliance in Math and Science (RAMS)

Austin Peay State University

August 2007

Vickie E. Lynch

Prepared for

(Office of Science, U.S. Department of Energy)

Prepared by

OAK RIDGE NATIONAL LABORATORY

Oak Ridge, Tennessee 37831-6285

managed by

UT-BATTELLE, LLC

for the

U.S. DEPARTMENT OF ENERGY

under contract DE-AC05-00OR22725

**Table of Contents**

I.  Introduction..............................................................................1

II. Methods...................................................................................2

III. Future
     work..............................................................................3

IV. Discussion................................................................................4

V.  Acknowledgements.....................................................................5

VI. References................................................................................6

VII. List of
     Figures...........................................................................7

**Spallation Neutron Source Data Analysis**

Jessica A. Travierso

**Abstract**

The Spallation Neutron Source (SNS) portal was developed to give virtual
access to SNS data as well as access to tools to reduce and analyze that
data. The purpose of this project is to make a graphical user interface
(GUI) for the instrument scientists at the SNS to use to analyze their
data. The GUI is for the NL2SOL fitting code which is being tested to
fit experimental backscattering data from the SNS. The GUI was created
using NetBeans IDE 6.0 software and made functional with Java coding.
The program will first be tested fitting fabricated data and will
eventually be added to the simulation tab in the SNS portal to fit real
data from the SNS instruments.

**I. INTRODUCTION**

The SNS is a state-of-the-art accelerator-based neutron source at Oak
Ridge National Laboratory that was officially completed in May of 2006.
When at full power, the SNS will produce the most intense pulsed neutron
beams in the world which will make it the best facility for conducting
neutron scattering research. It will be used by scientists and engineers
from universities, industries, and laboratories around the world. With
neutron scattering, scientists are able to study the arrangement,
motion, and interaction of atoms in materials. Neutron scattering
research has led to improvements in medicine, food, electronics, cars,
airplanes, and improvements in materials used in high temperature
superconductors, powerful light weight magnets, aluminum bridge decks,
and stronger, lighter plastic products \[1\]. These types of
improvements would not be possible without a means to analyze the data
obtained. The fitting GUI created in this project will be added to the
simulation tab in the SNS portal. It will be used to fit experimental
data from the SNS instruments. Data fitting can be useful in finding
trends in data. Once the trends are known, they can be used to create
simulations. Data fitting of results from simulations will also be
possible.

The TeraGrid is a network of supercomputers funded by the National
Science Foundation that began in 2001. It consists of nine partner
facilities. These facilities, Figure 1, are the San Diego Supercomputer
Center (SDSC), the National Center for Atmospheric Research (NCAR), the
National Center for Supercomputing Applications (NCSA), the University
of Chicago/Argonne National Laboratory (UC/ANL), Purdue University (PU),
Texas Advanced Computing Center (TACC), Indiana University (IU),
Pittsburg Supercomputing Center (PCU), and Oak Ridge National Laboratory
(ORNL) \[2\].

ORNL was added to the TeraGrid along with Indiana University, Purdue
University, and Texas Advanced Computing Center in 2003. ORNL's TeraGrid
machine is the NSTG cluster. The cluster has 28 nodes, each of which has
two 3.06 GHz Intel Pentium4 Xeon CPUs and 2.5 GB of memory \[2\].

The TeraGrid is useful for this project because some of the data is
hundreds of thousands of lines long. Running on a regular PC would take
much longer than running on a supercomputer. Although this resource will
be located in the SNS portal at ORNL, it can be accessed by anyone with
access to the SNS portal and will be run on the machines at TACC, NCSA,
SDSC, and ORNL.

**II. METHODS**

A first attempt at developing the fitting GUI for this project was made
using NetBeans IDE 5.5.1 \[3\]. This software was new to the group;
therefore, many tutorials \[4\] were necessary to become familiar enough
to develop the GUI. Because Java coding is required to customize and
make the GUI functional Java tutorials \[5\] were necessary as well.
After much practice, pain, and frustration, the decision was made to
upgrade to NetBeans IDE 6.0 \[6\]. This newer version includes many more
options that do not require custom coding, so the lack of Java
programming knowledge was not as cumbersome.

The GUI was created from scratch using NetBeans IDE 6.0. GUI development
is made easy by the \"drag-and-drop\" method used in the NetBeans
software. The developer simply selects a component from the \"palette
window,\" drags it to the GUI frame, and drops it in place. Java code is
generated in a source file each time a component is added to the GUI. If
a mistake is made, the developer can simply remove the component from
the GUI frame and the code for that component is automatically removed
from the source file. The \"properties window\" is used to customize the
properties of the components, such as maximums, minimums, etc. To add
functionality to the GUI, the developer types custom Java code in the
source file.

GUIs are useful because they allow users to run programs without any
knowledge of the code behind them. They are especially useful for long
or complicated codes that would be confusing or difficult to understand
by non-experts. The GUI in this project was created for the NL2SOL
fitting code. NL2SOL is an adaptive non-linear least-squares algorithm.
NL2SOL is a complicated algorithm. It is necessary for the instrument
scientists to have a way to use it without having to spend hours trying
to figure out how it works or what the parameters mean. NL2SOL has been
tested using a Gaussian fit on fabricated data.

The first page of the GUI, Figure 2, is the input page. This page is
where the user inputs information about the instrument and the data that
is to be fit. The instrument name, number of CPUs, TeraGrid computer,
and the type of fit all have drop-down menus the user can select from.
The instrument list includes Backscattering Spectrometer (BASIS),
Fine-Resolution Fermi Spectrometer (SEQUOIA), Hybrid Spectrometer
(HYSPEC), and Gaussian. Gaussian is just for the fabricated test. The
fitting GUI is not available for any instruments at SNS yet, but these
are expected to be the first three. The TeraGrid resources that are
available for use with the project include machines at TACC, NCSA, SDSC,
and ORNL. The filename, directory, and output file are all in editable
textboxes so that the user can type in the information needed. The data
array size and x dimension are adjustable, but have set minimums,
maximums, and step sizes. Functionality for the "submit" button was
added using custom code. In the "properties window" for the button, an
"action performed" event was selected. When this event was selected, the
source file was brought to the screen with the cursor located in the
place where the code was to be added. Java statements such as "getText"
and "getValue" were used. When clicked, the \"submit\" button gets the
text and values from each component, including those on the parameters
page, and sends them to a configuration file that is read by NL2SOL. The
parameters page, Figure 3, allows the user to make initial guesses and
adjust the parameters used by NL2SOL. At this time, only three
parameters are being used for the fit. Therefore, the user only inputs
three initial guesses. These guesses have default values to show the
user what kinds of values are expected. In the future, many more
parameters may be needed to fit data. The user can also change other
parameters such as maximum number of evaluations allowed, maximum number
of iterations, the scale vector, D, initial values, and the initial
values of all of the components in D. All of these have set minimums,
maximums, and step sizes. In the future many other parameters will be
editable; these are just there now to serve as a template to add more
parameters. A \"reset defaults\" button has been added to the parameters
page in case the user makes a mistake and needs to go back. This button
was made functional in the same was as the "submit" button on the user
input page, with the exception of using "setValue" statements to set the
values of the parameters back to the defaults.

When the configuration file has been successfully written, it will be
used as input for NL2SOL. Figure 4 shows what the configuration file
will look like. It will include comment statements, lines that start
with #, that will let the code know what values are located on the
lines. The file will also include all of the values and text from the
components that the user submits. The data will be sent to the SNS
portal from an instrument. The instrument scientists can visualize the
raw data in the SNS portal. They can then select a resource in the
portal they would like to use, such as our fitting GUI. When they hit
"submit" the input will be written to the configuration file which will
be read by NL2SOL. Then NL2SOL will run on the TeraGrid on parallel
processors on a community account. The data will then be sent back to
the portal where the instrument scientists can then visualize the fitted
data.

**IV. FUTURE WORK**

Future goals for the project include making more fitting types
available, making more components editable, and making the fitting GUI
available on more instruments. Adding more fitting types will allow the
scientists to fit different kinds of data with different behavior
trends. When more components are editable, the scientists will be able
to customize the fit as much as needed. For the time being, only a few
components are editable which does not allow for much customization.
Instruments that may be added in the near future include BASIS, SEQUOIA,
and HYSPEC.

BASIS, Figure 5, is the backscattering spectrometer at the SNS. "This
instrument features very high flux and a dynamic range in energy
transfer that is approximately five times greater than what is available
on comparable instruments today." Applications for BASIS include probing
dynamic processes in various systems on the pico- to nano-second time
scale, probing diffusive and relaxational motions, and studying some
types of collective excitations in condensed matter \[7\].

SEQUOIA, Figure 6, is a fine resolution Fermi chopper spectrometer. With
SEQUOIA, scientists can study excitations from a few hundredths of an
electron volt to a couple electron volts and "the spectrometer is
capable of selecting incident energies over the full energy spectrum of
neutrons." "SEQUOIA can help scientists understand excitations in many
materials for example, magnetic materials, novel oxides, and
high-temperature superconductors. SEQUOIA is a collaboration between the
Oak Ridge National Laboratory and the Canadian Institute for Neutron
Scattering." Applications for SEQUOIA include single crystals and novel
systems, "high-temperature superconductivity: spin dynamics in
superconductors and precur­sor compounds," "incommensurate spin
fluctuations at varying doping levels, model magnetic systems, such as
one-dimensional spin chains and spin ladders, and crossover effects from
one- to three-dimensional magnetism," "excitations in quantum fluids,
quantum critical phenomena, and non-Fermi liquid systems,"
"high-resolution crystal field spectroscopy reaching into the 1-eV
range," "coupling of electronic and spin systems in correlated-electron
materials," and colossal magneto resistive materials \[8\].

HYSPEC, Figure 7, is "a high-intensity, direct-geometry instrument
optimized for measurement of excitations in small single-crystal
specimens." Applications for HYSPEC include studies in superconductors,
strongly correlated electron materials, ferroelectrics, lattice and
magnetic dynamics, phase transitions, quantum critical points, complex
phases in intermetallic compounds, frustrated magnets, low-dimensional
magnetic excitations, transition metal oxides, and spin and lattice
dynamics in nanostructures \[9\].

**III. DISCUSSION**

This project is just a small part of an effort to try to make data and
resources from the SNS available to scientists that need them. The SNS
portal has been created, McSTAS has been added to the simulation tab in
the portal, and soon this fitting GUI will be added as well. The goals
of these projects are not only to make the data and resources available,
but also to make them easier to use. The fitting GUI makes it possible
for the instrument scientists to fit their data without having to know
anything about the NL2SOL algorithm, the TeraGrid, or parallel
computing. When the resources are easier to use, the scientists can
spend less time figuring out how to use the resources and more time
analyzing and making conclusions from the results obtained.

**IV. ACKNOWLEDGEMENTS**

This project was completed at Oak Ridge National Laboratory under the
Research Alliance in Math and Science program (RAMS). RAMS is sponsored
by the Office of Science, U.S. Department of Energy. I would like to
thank my mentor, Vickie E. Lynch, RAMS, and DOE for giving me this
opportunity and Meili Chen for sharing her knowledge of NL2SOL and
designing the configuration input file. It has been an amazing
experience that I will never forget. A special thank you to Austin Peay
State University and my advisors, Dr. Jaime Taylor and Dr. Alex King for
their continued encouragement and support. And finally, I would like to
thank my mother who has encouraged and inspired me throughout my life to
always live up to my potential and never believe something cannot be
accomplished.

V. **REFERENCES**

1.  \[1\] Website for Spallation Neutron Source information.
    <http://neutrons.ornl.gov/aboutsns/aboutsns.shtml>

```{=html}
<!-- -->
```
1.  \[2\] Website for TeraGrid information.
    [http://teragrid.org](http://teragrid.org/)

```{=html}
<!-- -->
```
1.  \[3\] NetBeans IDE 5.5.1.

    \[4\] Website for NetBeans information and tutorials.
    http://www.netbeans.org

> \[5\] Website for Java tutorials.
> <http://java.sun.com/docs/books/tutorial>

\[6\] NetBeans IDE 6.0.

> \[7\] BASIS fact sheet.
> <http://neutrons.ornl.gov/instrument_systems/fs_Instrument_02_BSS_05-03083.pdf>
>
> \[8\] SEQUOIA fact sheet.
> <http://neutrons.ornl.gov/instrument_systems/fs_Instrument_17_SEQUOIA_06_G00806.pdf>
>
> \[9\] HYSPEC fact sheet.
> <http://neutrons.ornl.gov/instrument_systems/fs_Instrument_14B_HYSPEC_06_G01632.pdf>

**VI. LIST of FIGURES**

![](media/image1.jpeg){width="5.3381944444444445in"
height="3.182638888888889in"}**Figure 1. TeraGrid Facilities**

![](media/image2.png){width="7.529166666666667in"
height="7.396527777777778in"}**Figure 2. Fitting GUI: user input page**

![](media/image3.png){width="7.420833333333333in"
height="7.441666666666666in"}

**Figure 3. Fitting GUI: parameters page**

![](media/image4.png){width="7.886111111111111in"
height="6.263888888888889in"}

**Figure 4. Configuration file example**

![](media/image5.wmf){width="3.377083333333333in"
height="2.8201388888888888in"}

**Figure 5. BASIS**

![](media/image6.wmf){width="4.132638888888889in"
height="2.3513888888888888in"}

**Figure 6. SEQUOIA**

![](media/image7.wmf){width="3.634027777777778in"
height="2.397222222222222in"}

**Figure 7. HYSPEC**