\(\renewcommand\AA{\unicode{x212B}}\)

SaveGSASInstrumentFile v1

../_images/SaveGSASInstrumentFile-v1_dlg.png

SaveGSASInstrumentFile dialog.

Summary

Generate a GSAS instrument file from either a table workspace containing profile parameters or a Fullprof’s instrument resolution file (.irf file).

Properties

Name Direction Type Default Description
InputWorkspace Input TableWorkspace   Name of the table workspace containing the parameters.
InputFileName Input string   Name of the input Fullprof resolution file (.irf). Allowed extensions: [‘.irf’]
OutputFileName Input string Mandatory Name of the output GSAS instrument file. Allowed extensions: [‘.iparam’, ‘.prm’]
BankIDs Input St6vectorIjSaIjEE   Bank IDs of the banks to be written to GSAS instrument file.
Instrument Input string powgen Name of the instrument that parameters are belonged to. So far, only PG3 and NOM are supported. Allowed values: [‘powgen’, ‘nomad’]
ChopperFrequency Input string 60 Frequency of the chopper. Allowed values: [‘10’, ‘30’, ‘60’]
IDLine Input string   ID line to be written in GSAS instrument file
Sample Input string   Sample information written to header (title)
L1 Input number Optional L1 (primary flight path) of the instrument.
L2 Input number Optional L2 (secondary flight path) of the instrument. It must be given if 2Theta is not given.
TwoTheta Input number Optional Angle of the detector bank. It must be given if L2 is not given.

Description

Convert Fullprof’s instrument resolution file (.irf) to GSAS’s instrument file (.iparm/.prm).

Supported peak profiles

  • Time-of-flight back-to-back exponential convoluted with pseudo-voigt (in future)
    • Fullprof: Profile 9;
    • GSAS: Type 3 TOF profile.
  • Thermal neutron time-of-flight back-to-back exponential convoluted with pseudo-voigt (implemented)
    • Fullprof: Profile 10;
    • GSAS: tabulated peak profile.

Supported input Fullprof file

There can be several types of Fullprof files as the input file

  • resolution file .irf (implemented)
  • configuration file .pcr (in future)

Set up \(2\theta\)

There are several places in this algorithm that can set the value of \(2\theta\). From the highest priority, here is the list how \(2\theta\) is set up.

  1. Algorithms’ input property TwoTheta;
  2. Either input TableWorkspace or input Fullprof resolution (.irf) file;
  3. Hard coded default “TwoTheta” of a certain instrument.

Set up \(L_1\)

There are 2 places in this algorithm that can set the value of \(L_1\). From the highest priority, here is the list how \(2\theta\) is set up.

  1. Algorithms’ input property L1;
  2. Hard coded default “TwoTheta” of a certain instrument.

Calculation of \(L_2\)

  • If “TwoTheta” (\(2\theta\)) is given, L2 will be calculated from given 2Theta and L1 by \(DIFC = 252.816\cdot2sin(\theta)\sqrt{L1+L2}\). Notice that \(2\theta\) given in input .irf file may have subtle difference to “2Theta”, which is input by user in order to calculate L2.
  • If “2Theta” (\(2\theta\)) is not given, L2 will be read from user input.

Usage

Example - save GSAS instrument file from a Fullprof .irf file:

# Run the algorithm to save for GSAS instrument file
SaveGSASInstrumentFile(InputFileName = "PG3_Bank1.irf", OutputFileName = "/tmp/PG3_Bank1.iparam",
  BankIDs = 1, Instrument = "powgen", ChopperFrequency = "60",
  IDLine = "60Hz 2011 Bank 1", Sample = "LaB6", L1 = 60.0, TwoTheta = 90.0)

# Load GSAS parameter files
gfile = open("/tmp/PG3_Bank1.iparam", "r")
lines = gfile.readlines()
gfile.close()

# Print out some result
print("Number of lines in GSAS instrument file:  {}".format(len(lines)))
print("Line 0:  {}".format(lines[0].strip()))
print("Line 1:  {}".format(lines[1].strip()))
print("Line 2:  {}".format(lines[2].strip()))
print("Line 3:  {}".format(lines[3].strip()))
print("Line 305:  {}".format(lines[305].strip()))

Output:

Number of lines in GSAS instrument file:  306
Line 0:  12345678901234567890123456789012345678901234567890123456789012345678
Line 1:  ID    60Hz 2011 Bank 1
Line 2:  INS   BANK      1
Line 3:  INS   FPATH1     60.000000
Line 305:  INS  1PAB590   0.00213   0.46016   1.99061  -3.12296

Categories: AlgorithmIndex | Diffraction\DataHandling

Source

C++ header: SaveGSASInstrumentFile.h (last modified: 2020-04-07)

C++ source: SaveGSASInstrumentFile.cpp (last modified: 2020-04-07)