D4

Disordered Materials Diffractometer

# Manual

D4 is a two-axis diffractometer and its operation does not differ too much from that of similar instruments at ILL. In this manual the basic instructions for operation are given.

There are four levels of operation:

## 1. Monochromator

At present the monochromator operation is controlled by the IN1's computer under IN1BeF configuration. The control program is MAD and can only be used by the instrument responsible or the local contact. In the future, the monochromator should be controlled by the D4 computer and NOMAD

## 2. Acquisition data

There is a dedicated computer (d4.ill.fr) for data acquisition, under Linux and running NOMAD. This program allows you to control the sample environment, the detector scans and to produce the raw data (numors).

## 3. Raw data treatment

There is a dedicated computer (d4lnx.ill.fr) for data treatment under Linux. In this computer you have a set of programs allowing you to produce a single diffractogramme from a series of numors, and to perform simple calculations. As output you obtain a three-columns ASCII diffractogram, in scattering angle (2θ) or modulus of the scattering vector (Q).
The word "numor" means "NUMber Of Run", and the numor files have filenames which are simply the 6 digits of the numor (with padded leading zeros). In the following the outpout files will be named regfiles.

Starting a session

To start a session at d4lnx.ill.fr you need the login and password for the d4 account (this information is written near the computer). Then the system will ask you your surname; in fact this is the name you give to your experiment and will be the name of your working directory.
Note: You can always return to this home directory (/home/vis/d4/yourname) with the simple command 'cd' .

D4 software

d4creg: reads raw data (numors) and produces a single diffractogramme
d4cget: reads raw data and extract information as function of numors (or any other parameter)
gnuplot: plots and prints the diffractogrammes
d4opr: performs simple operations with regrouped files (regfiles)
d4rebin: performs a rebinning of a regfiles (in angle or in Q)
d4nifit: fits Ni diffractogramme for calibration (based on polyfit)

Script files

In general, it is advantageous to put the d4creg commands (along with other commands for processing D4c data) in a Linux/UNIX script file (by convention at D4c, the filenames of these scripts begin with "do_" and they are called "dofiles").  In this way, the user doesn't need to keep typing the 6-digit numors nor continue to remember the numor range for each scan.
These script files can contain all Linux commands and should be executed using the "source" command. For example, for a dofile named "do_sample" the command should be:

prompt> source do_sample

The lines starting with # are comments in script files, so the dofiles with proper comments could also serve as logfiles for your experiment.

## 4. Data treatment

In this step the diffractogrammes should be corrected by inelasticity, multiple scattering, absorption, instrumental resolution and background. This part of the data treatment is under the responsability of the users, but there is a running version of the program CORRECT allowing to perform all these corrections.

d4fou: performs the Fourier transformation of the srtucture factor
polyfit: performs fittings on experimental data
lorgaun: is a version of polyfit dedicated to fit a convolution of a Lorentzian and a Gaussian
correct: performs multiple scattering, absorption and inelasticity corrections, plus absolute scale normalization

This program regroups data for the D4 instrument (version D4c).  Each  numor file for D4c corresponds to one counting acquisition (usually defined by a monitor preset) and one angular position for the 9-detector ensemble.  The counts in a numor file are identified by detector and detector cell number.  After reading in one or several numor files, d4creg regroups or rebins the counts of all the 9*64 detector cells so as to produce one diffractogramme file (*.reg) giving counts as a function of the scattering angle 2theta.

d4creg is written in C, uses a command-line input syntax, and runs on most Linux (SuSE or Ubuntu) workstations at the ILL, including d4lnx of course. The program can be run by anyone logging in as "d4", even for remote logins across the ILL/ESRF firewall.

## Syntax

prompt> d4creg
[-h(elp) -b -u -t -o file.out -e file.eff -d file.dec -i file.ign -a anglebeg anglefin anglestep -w wavelength -q qbeg qfin qstep
-z zeroangle -x minangle maxangle -9 -C -Q -n normflag -V] numorbeg [numorfin dets disk instr]

where [args] are optional and the defaults are:

-o numorfin.reg    - e effd4c.eff    -d dec.dec    -i ign.ign

-z 0.0    -n 1000000    numorfin=numorbeg    dets=9
disk=/net/serdon/illdata/data/d4      instr=.null.

## Examples

prompt> d4creg -o sample.reg 175568 175579
This command produces a three-column output file (sample.reg), with 2theta, intensity and error, after regrouping numors from 175568 to 175579.

prompt> d4creg -z 0.5 -o sample.reg 175568 175579
This command produces a diffractogramme where the 2theta values are corrected by the zero angle, i.e. 2theta= 2theta_read - 0.5

prompt> d4creg -z 0.5 -w 0.495 -o sample.qreg 175568 175579
This command produces a diffractogramme as a function of Q. Data are corrected by zero angle and then converted into Q using the Bragg law and the neutron wavelength (0.495 A).

prompt> d4creg -help
This command lists the help file.

prompt> d4creg 141414
This command regroups the single numor file "141414" using the default efficiency file "eff.eff", the default ignore file "ign.ign", and the default output filename "141414.reg".

prompt> d4creg -e efftest.eff -o sample1.reg 141414 141455
This command regroups a range of numor files using a particular efficiency file and a particular output filename.

prompt> d4creg -b -o alldata.reg 141414 141465 < extra.numors
This command regroups 4 separate ranges of numors files together. The file "extra.numors" contains the 4 following ASCII lines:

142233 142266
142297
147822 147855

Note the dot at the end of the file.

prompt> d4creg -u -o samp1.reg 79411 79450

## Help

Execution:  prompt> d4creg (+ command-line options)

Input:
command-line options
D4c ASCII numor files

Output:
3-column ASCII output file of the "regfile" format:
scattering_angle
counts
sigma

taking into account the detector efficiencies and possible bad cells, and optionally taking into account the zeroangle of the detectors. The counts and sigma columns are normalized to either monitor counts or time. The sigma column is calculated by first taking the square root of the detector-efficiency-corrected counts, and then applying any normalization factors in parallel with the counts column -- i.e. sigma always remains the true counting statistics standard deviation.

By default, d4creg produces one output file having ".reg" as a suffix and which is a concatenation of 9 output files, one for each detector. Specifying the -9 option of d4creg will produce all 10 output files:

"outfile.reg1" (regrouped data of detector 1)
"outfile.reg2" (regrouped data of detector 2)
"outfile.reg3" (regrouped data of detector 3)
"outfile.reg4" (regrouped data of detector 4)
"outfile.reg5" (regrouped data of detector 5)
"outfile.reg6" (regrouped data of detector 6)
"outfile.reg7" (regrouped data of detector 7)
"outfile.reg8" (regrouped data of detector 8)
"outfile.reg9" (regrouped data of detector 9)
"outfile.reg" (simple concatenation of the above 9 files)

Comments are included at the top of the output files (comment char = #) which describe how, when and by whom the file was produced. The regfile format is completely compatible with the "gnuplot" plotting program and with any of the "hfit" fitting programs like "polyfit" and "d4nifit".

The user of d4creg does not have to worry about where his ASCII numor files are -- d4creg automatically searches the data disks of the present and previous reactor cycles, trying both to uncompress numor.Z files and not to uncompress numor files, since either one might be the case for data of previous reactor cycles.

Numor files which are older than the previous reactor cycle (i.e. < data-1) must be regrouped using the "-u" option described below. The numor numbers have been increasing monotonically since D4c came on line in May/June 2000, so there is no problem with duplicate numor filenames.  When the -u option is used, d4creg will automatically search all the directories containing compressed or uncompressed data from all previous reactor cycles.

Bad numor files (e.g. due to erroneous detector positioning) can be listed in the ignore file (default: "ign.ign") and will be consequently skipped over by d4creg.

Bad cells can be identified in the efficiency file (default "effd4c.eff") by giving them an efficiency of -1, or in fact any negative efficiency.

The comand-line syntax of d4creg can be displayed by typing only "d4creg" without arguments.  The only non-optional argument on the command line is the beginning numor (i.e. a single numor can be regrouped).  Note that the hyphen-containing command-line options must come before the numor numbers.

### Command line options

• To display the help file:
-help    (or simply -h)
• To select a particular output filename (default: numorfin.reg):
-o filename
which produces the output file "filename", and also the files "filename1" ... "filename9" when the -9 option is used.
• To output not only the concatenated file for 9 detectors, but alsoa separate file for each detector:
-9
• To select a particular efficiency file (default: "effd4c.eff"):
-e efffilename
• To select a particular decalage file (default: "dec.dec"):
-d file.dec
• The decalage file contains the rangle (relative angle shift) values for each of the 9 D4c detectors.
• To set the zeroangle (i.e. direct beam angle) of the 9-detector ensemble:
-z zeroangle
• To regroup a discontinous list of numor files (see examples below):
-b (for "broken" input)
• To regroup older-than-previous-reactor-cycle numor files:
-u (for "uncompress")
although d4creg tries both uncompressing and not uncompressing.
• To select a particular ignore file (default: "ign.ign"):
-i file.ign
• To force normalisation:
-n 0   (by 1e6 monitor counts)
-n 1   (by 100 seconds monitor time)
-n <>0,1  (default --> normalisation by acquisition mode per usual)
• To NOT do the detector cell deadtime correction:
-t
• To specify the incident wavelength (necessary for converting to Q):
-w wavelength  (default is 0.0 A)
• To convert to Q = 4pi/lambda * sin(2theta/2) WITHOUT binning (default suffix is *.Qreg)
-Q
• To truncate data above and below (after zeroangle, rangle, of course): (defaults are -150 deg and +150 deg)
-x minangle maxangle
• To bin data by angle (selective binning, no interpolation): (default suffix is *.abin)
-a anglebeg anglefin anglestep
• To bin data by Q (selective binning, no interpolation): (default suffix is *.qbin)
-q qbeg qfin qstep
• To produce an output file in the (old) FULLPROF format for D4: (default suffix is *.ca)
-f
• To produce an output file suitable for input to CORRECT (D4c format): (default suffix is *.adat or *.qdat depending on mandatory binning)
-C
If only -C is specified, the default binning is by angle:
abeg=0.0, afin=140.0, astep=0.01 (deg)
NB: If one specifies both -C and -Q, the output will be in CORRECT format but using a default binning corresponding to the wavelength specified:
0.7 A defaults of qbeg=0.0, qfin=17.0, qstep=0.001 (A^-1)
0.5 A defaults of qbeg=0.0, qfin=24.0, qstep=0.001 (A^-1)
0.35 A defaults of qbeg=0.0, qfin=34.0, qstep=0.002 (A^-1)
• To bin with proportional division of a neutron count between neighboring bins, use the program "d4rebin", since d4creg performs only a "selective" binning whereby each neutron count goes into the closest bin, without being divided into two weighted counts.
• To get verbose output (i.e. the output before I abbreviated it):
-V
• To produce a monitor time output file (basically obsolete due to the program "d4cget"):
-m

The "dets", "disk" and "instr" options are mostly superfluous and can generally be ignored by the user.  The "dets" option can be used when only one detector is taking data, and the "disk" option can be used when the numor files are not located in the usual place.  At present, the "instr" option should always be set to a null string (the default) for D4c.
In general, it is advantageous to use particular output filenames, and to put the d4creg commands (along with other commands for processing D4c data) in a Linux/UNIX script file (by convention at D4c, the filenames of these scripts begin with "do_" and they are called "dofiles").  In this way, the user doesn't need to keep typing the 6-digit numors nor continue to remember the numor range for each scan.

This program extracts parameters from the numor files of the D4 instrument (version D4c).
d4creg is written in C, uses a command-line input syntax, and runs on most Linux (SuSE or Ubuntu) workstations at the ILL, including d4lnx of course. The program can be run by anyone logging in as "d4", even for remote logins across the ILL/ESRF firewall.

## Syntax

prompt> d4cget
[-h(elp) -V -b -u -o file.out -i file.ign -tTHBRncmdvesp -FIS m n -DA m n o] numorbeg [numorfin disk instr]

where [args] are optional and the defaults are:

-o numorfin.get    -i ign.ign    numorfin=numorbeg

disk=/net/serdon/illdata/data/d4      instr=.null.

## Examples

prompt> d4cget -o sample.get -nT 175568 175579
This command produces a four-column output file (sample.get), with numors as first column, and three columns with temperatures (Tsamp, Treg, Tset).

prompt> d4cget -o sample.get -tTn 175568 175579
This command produces a five-column output file (sample.get), similar to previous example, but this time with time, Tsamp, Treg, Tset and numor, as 1st to 5th columns.
This can then be plotted by gnuplot as Tsample(time):

gnuplot> plot "sample1.get"

or as Treg(numor):

gnuplot> plot "sample1.get" using 5:3

prompt> d4cget -o sample.get -nmc 175568 175579
This command produces a three-column output file (sample.get), with numors, monitor time and monitor counts as 1st to 3rd column.

prompt> d4cget -help
This command lists the help file

prompt> d4cget -t -n 141414 141455
prompt> d4cget -tn 141414 1414155
This command gets the numor range 141414 to 141455 using the default ignore file "ign.ign", the default output filename of "141455.get", and the "-t" and "-n" options.  This produces a 2-column output file where the first column is the time in minutes after the first numor file and the second column is the numor number itself (6 digits).

This file can then be plotted as numor(time) using the gnuplot command:

gnuplot> plot "141455.get"

or as time(numor) using the gnuplot command:

gnuplot> plot "141455.get" using 2:1

prompt> d4cget -b -o alldata.get -tTn 141414 1414155 < extra.numors
This command gets 3 separate ranges of numor files into one output file, and the "-t", "-T" (producing 3 columns) and "-n" options, where the file "extra.numors" contains the 3 following ASCII lines:

142233 142266

147822 147855

prompt>d4cget -u -o samp1.get 79411 79450
This command gets compressed (i.e. archived) numor files.

prompt> d4cget -o expinfo.get -dnvspel 172629 173333
This command gets a bunch of possibly useful expt info and then grep it to find e.g. the numors for a particular sample:

prompt> grep "Ni 7mm 300K xgas=50mbar" expinfo.get

## Help

Execution:
prompt>
d4cget   (+ command-line options)

Input:
command-line options
D4c ASCII numor files

Output:  multi-column ASCII output file where each column reports the values for each numor file of the desired parameters/data in the order chosen by the user in the command-line.

Available parameters are:

 -t time in minutes after the first numor -T temperatures (Tsamp,Treg,Tset) -H heating power percentage (DTI) -B beamstop positions in mm (BScloche,BSdet) -R reactor power in MW -n numor -c monitor counts -m monitor time (for selected monitor counts) -d start and stop date/time for numor (2 strings) -v visitor, i.e. User Name (10 chars) -l Local Contact (10 chars) -e (experiment) Title (40 chars) -s Subtitle, i.e. sample description (58 chars) -p Proposal Number (15 chars) -F m n the n'th entry of the m'th F (float) parameter field -I m n the n'th entry of the m'th I (integer) parameter field -S m n the n'th entry of the m'th S (data, integer) parameter field -D m n o sum from nth to oth entry (inclusive) of mth data (S) field -A m n o o chars, starting from the n'th char of the m'th A field

The -t token time is the average of the start and stop times of each numor (with t=0 for the first numor in the requested range).

Those parameters not requiring arguments can be concatenated and thus share a single hyphen (e.g. "-tTn"), as in standard Linux/UNIX syntax.

Comments are included at the top of the output files (comment char = #) which describe how, when and by whom the file was produced.  The output format is completely compatible with the "gnuplot" plotting program and with any of the "hfit" fitting programs like "polyfit" and "d4nifit".

The user of d4cget does not have to worry about where his ASCII numor files are -- d4cget automatically searches the data disks of the present and previous reactor cycles, trying both to uncompress numor.Z files and not to uncompress numor files, since either one might be the case for data of previous reactor cycles.

Numor files which are older than the previous reactor cycle (i.e. < data-1) must be "gotten" using the "-u" option described below.  The numor numbers have been increasing monotonically since D4c came on line in May/June 2000, so there is no problem with duplicate numor filenames.  When the -u option is used, d4cget will automatically search all the directories containing compressed or uncompressed data from all previous reactor cycles.

Bad numor files (e.g. due to erroneous detector positioning) can be listed in the ignore file (default: "ign.ign") and will be consequently skipped over by d4cget.

The "disk" and "instr" options are mostly superfluous and can generally be ignored by the user.  The "disk" option can be used when the numor files are not located in the usual place.  At present, the "instr" option should always be set to a null string (the default) for D4c.

The comand-line syntax of d4cget can be displayed by typing only "d4cget" without arguments.  There are only two non-optional arguments on the command line: the beginning numor (i.e. a single numor can be "gotten") and at least one parameter.  Note that the hyphen-containing command-line options must come before the numor numbers.

### Command line options

• To display the help file:
-help (or simply -h)
• To get verbose output (i.e. the output before I abbreviated it):
-V
• To select a particular output filename (default: numorfin.get):
-o filename
• To "get" a discontinous list of numor files (see examples below):
-b (for "broken" input)
• To "get" compressed (i.e. older than previous reactor cycle) numor files:
-u (for "uncompress")
• To select a particular ignore file (default: "ign.ign"):
-i file.ign

In general, it is advantageous to use particular output filenames, and to put the d4cget commands (along with other commands for processing D4c into a Linux/UNIX script file (by convention at D4c, the filenames of these scripts begin with "do_" and they are called "dofiles").  In this way, the user doesn't need to keep typing the 6-digit numors nor continue to remember the numor range for each scan.

This third-party program allows to plot the diffractogrammes. To execute it, just type gnuplot at the linux prompt.

prompt> gnuplot
gnuplot>

## Examples

gnuplot> plot 'data.dat'
Plots the file data.dat using first and second columns as x,y axis.

gnuplot> set data style l
gnuplot> set data style p
gnuplot> set data style d
gnuplot> set data style lp
Sets the symbol for plotting curves, with lines, points, dots, or combinations of them, like 'lp' for lines and points.

gnuplot> plot 'data.dat' u 1:($3/$2*100)