mfisch
This is an example showing how the #List command of TOPAS-Academic V6 works
=======================================================
When dealing with a large number of sequentially collected diffraction patterns (e.g. time- and temperature-dependent data) it is often wise to first do a LeBail or Pawley and only afterwards a structural refinement. Doing this with hundreds of files can be tedious...
The attached file does the following:
RUN 1:
In the first run, a LeBail refinement is performed by refining the data file with the same name as the input file (here: "Filename1"). During the LeBail refinement, lattice, peakshape, background and specimen displacement parameters are refined.
At convergence, the unchanged input file is saved as "Filename1_Original.bak", an .out file with LeBail results is written ("Filename1_LeBail.out") and this file is copied to the new .inp file ("Filename1.inp").
RUN 2:
The new .inp (with updated LeBail results) is re-run but this time, a Rietveld refinement is performed. At this stage, lattice, peakshape, background and specimen displacement parameters are fixed to reduce the number of parameters. At convergence, an .out file ("Filename1.out") and a .cif file ("Filename1.cif") is written.
To continue such a series of sequential refinements, the resulting .out file ("Filename1.out") can be used for the next data file ("Filename2").
Re-running Filename1.inp re-runs the converged LeBail and then re-runs the Rietveld refinement.
#List command relevant keywords are colored in blue and commented in red.
Example files are attached and can be downloaded.
Many thanks go to Alan!
=======================================================
do_errors
r_wp 0 r_exp 0 r_p 0 gof 0
num_runs 2 'this input file runs two times
macro filename { INP_File } 'the filename of the input file is copied to the macro filename
#list File_Name DoLebail {
filename 1 'in the first run, the tag for doing LeBail is 1
filename 0 'in the second run, the tag for soing LeBail is 0
}
#if (DoLebail(Run_Number))
#define lebail 'if the LeBail tag is 1, then #ifdef lebail
#else
'#define lebail 'if the LeBail tag is 0, then not #ifdef lebail
#endif
xdd filename##.xy
rebin_with_dx_of 0.02
lam ymin_on_ymax 0.0001
Lam_recs
{ 0.0159 1.534753 3.6854
0.5691 1.540596 0.4370
0.0762 1.541058 0.6000
0.2517 1.544410 0.5200
0.0871 1.544721 0.6200
}
LP_Factor(0)
Rp 240
Rs 240
Slit_Width(0.07)
Divergence (0.5)
axial_conv
filament_length 12
sample_length 10
receiving_slit_length 15
primary_soller_angle 2.55
secondary_soller_angle 2.55
#ifdef lebail 'switch parameters on and off
macro refine_bg {@} 'if LeBail, then refine background and everything that has not## before a prm name
macro not { }
#else
macro not {!} 'if Rietveld, then fix background and everything that has not## before a prm name
macro refine_bg { }
#endif
bkg refine_bg 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Specimen_Displacement(not##displacement, 0 min -0.2 max 0.2)
prm not##lpa 4.76 min 4.74 max 4.78
prm not##lpc 12.99 min 12.99 max 13.1
prm not##strainl 0.001 min 0.001 max 1
prm not##csl 500 min 50 max 10000
prm not##csg 500 min 50 max 10000
#ifdef lebail 'RUN 1: LeBail refinement
chi2_convergence_criteria 0.01
hkl_Is
phase_name "LEBAIL"
a = lpa;: 0
b = lpa;: 0
c = lpc;: 0
ga 120
Strain_L(, strainl)
CS_L(, csl)
CS_G(, csg)
lebail 1
space_group "167" '{{{
load hkl_m_d_th2 I
{
1 0 -2 6 3.481050 25.56883 0.1
Lines missing here
5 -1 -6 12 0.830826 135.98870 0.1
}
system_before_save_OUT { type INP_File##.inp > INP_File##_Original.bak }
'copy filename.inp to filename_Original.bak
out_file = Concat(String(INP_File),"_LeBail", ".out") ;
'write filename_LeBail.out
system_after_save_OUT { type INP_File##_LeBail.out > INP_File##.inp }
'copy filename_LeBail.out to filename.inp
#else 'RUN 2: Rietveld refinement
str
phase_name "STRUCTURE"
space_group "167"
a = lpa;: 0
b = lpa;: 0
c = lpc;: 0
ga 120
Strain_L(, strainl)
CS_L(, csl)
CS_G(, csg)
scale scalefactor 0.001
site Al1 x 0 y 0 z z_Al 0.352 occ AL+3 1 beq B_Al 0.5
site O1 x x_O 0.693 y 0 z 0.250 occ O-2 1 beq B_O 0.5
Out_CIF_STR(INP_File##.cif) 'write filename.cif
out_file = Concat(String(INP_File), ".out") ; 'write filename.out
#endif