From 25ea60d0480ec1c36f17d2adfce6dbf9c893a485 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Thu, 8 Aug 2024 12:09:37 -0400 Subject: [PATCH] convert .txt to .rst in TUTORIAL --- doc/TUTORIAL.rst | 148 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/doc/TUTORIAL.rst b/doc/TUTORIAL.rst index e69de29b..8d1e9787 100644 --- a/doc/TUTORIAL.rst +++ b/doc/TUTORIAL.rst @@ -0,0 +1,148 @@ +=============================================================================== += Welcome to the PDFgui tutorial = +=============================================================================== + +The latest version of this document is available online at + +`http://danse.us/trac/diffraction/browser/diffraction/diffpy/diffpy/pdfgui/doc`_ + +Please, have your co-workers or students try it out and let us know if you +have any comments. We want to make it really easy for the new users to get +started with PDFgui. + +------------------------------------------------------------------------------- + +Lesson 1: Creating simple fit of Ni PDF +---------------------------------------- + +Input files: + +- `tutorial/Ni-xray.gr` - experimental X-ray PDF data +- `tutorial/Ni.stru` - Ni f.c.c. structure in PDFfit format + +Procedure: + +1. Open a terminal and type ``pdfgui`` to start the program. + +2. Create a new Fit: + (a) Select "FITTING" in the left-most vertical tab. + (b) Click right mouse button in the left panel and choose "New Fit" in the pop-up menu. + +3. Load structure model: + (a) Place the cursor of the mouse onto the title of the Fit, click the right button and choose "Insert Phase" in the pop-up menu. + (b) Click the "Open" button and load the `Ni.stru` file. + + The right panel has 3 tabs for the initial configuration, constraints panel for expressing structure properties as functions of tunable parameters, and Results panel for refined structure. + +4. Load experimental PDF data: + (a) Select the title of "Fit 1", click the right button and choose "Insert Data Set" in the pop-up menu. + (b) Load the `Ni-xray.gr` file. + + Again, the right panel shows 3 tabs for properties of this dataset. + +5. Define what is refined: + (a) Click on the `Ni-xray.gr` data and select the "Constraints" tab. + (b) Type ``@1`` into "Scale Factor" edit box. + (c) Select the `Ni.stru` phase and its "Constraints" tab. + (d) Fill "a", "b", "c" boxes with ``@5``. + + A refined variable can be expressed as a math expression: + ``f(@n1, @n2, @n3, ...)`` where + ``@n1`` stands for fitted parameter and + ``n1, n2, ...`` are arbitrary positive integers. + This allows simple linking of related variables - for example, since + cell lengths a, b, c are all expressed as ``@5``, the refined structure will remain cubic. + +6. Start the refinement: + (a) Select "Fit 1" in the left panel. The parameters panel shows a list of used parameters and their initial values. + (b) Click the "gear" icon on the toolbar and watch the fit progress in the terminal window. + +7. Plot the results: + (a) Select "PLOTTING" in the left-most vertical tab. + (b) Select the `Ni-xray.gr` dataset. + (c) Select "r" as the X plotting variable. + (d) Hold down shift and select "Gcalc" and "Gtrunc" as the Y plotting variables. + (e) Click "Plot" button. + + A new window pops up with plots. You can try out the buttons in the toolbar below. + +8. Save your project for later use. + +------------------------------------------------------------------------------- + +Lesson 2: Build structure model using crystal symmetry +------------------------------------------------------ + +In the previous example the initial structure was defined by an existing file. However, PDFgui makes it very easy to build a structure model from scratch and constrain it with arbitrary crystal symmetry. + +1. Create a blank structure: + (a) Click the FITTING tab. + (b) Repeat steps 1-3a from Lesson 1, but choose the "New" button. Rename "New Phase" to "Ni fcc". + +2. Define asymmetric unit: + (a) Right click the header of the empty atoms grid in the "Configure" page. + (b) Insert 1 atom using the popup menu. + (c) Change the elem cell to "Ni". + (d) Select the u11-u33 cells and type "0.004" and press Enter. + +3. Expand to all equivalent positions: + (a) Right click the first Ni atom and select "Expand space group". A "Space Group Expansion" dialog should open. + (b) In the dialog, select Fm-3m or just type 225 in the "Space Group" box and hit "OK". + + You should now have four atoms in the atoms grid. + +4. Generate symmetry constraints: + (a) Select the "Constraints" tab. + (b) Select all atoms. This can be done by dragging the mouse over the atom names or by clicking on the "elem" header. + (c) Right click in a selected cell and select "Symmetry constraints." A "Space Group Constraints" dialog should open. + (d) "Fm-3m" should already appear in the "Space Group" box. If it does not, select it as you did in step 3 and hit "OK". + + The u11-u33 cells should all read the same value. The "x", "y" and "z" cells should be all empty because Ni atoms are at special positions in Fm-3m. You may try to select lower-symmetry space and check what happens with the constraints. The space group constraints may be mixed by selecting different groups of atoms, for example, when only certain species show lowered symmetry. + +5. Continue the fit as in Lesson 1. + +------------------------------------------------------------------------------- + +Lesson 3: Multi-stage fitting +----------------------------- + +Learn how to string together fits. + +1. Create a fit as in Lesson 1. + +2. Copy the fit: + (a) Right click on the fit name "Fit 1" in the right panel (the fit tree). + (b) Select "Copy" from the pop-up menu. + +3. Paste the fit: + (a) Right click in the empty space between the first fit in the fit tree. + (b) Select "Paste Fit." This will create "Fit 1_copy", a copy of "Fit 1" in the fit tree. + +4. Link the fits: + (a) Click on "Fit 1_copy" in the fit tree. + (b) In the "Parameters" panel, select the entire "Initial" column. + (c) Type ``=Fit 1`` and then press Enter. The "Initial" values of the parameters should now read ``=Fit1:n``, where "n" is the index of the parameter. + + This is the linking syntax: ``=name:index``. + "name" is the name of another fit. + "index" is the index of a parameter in that fit. + If you omit "index", it will default to the index of the parameter you are linking from. A linked parameter uses the refined value of the link as its initial value. This is useful when you are running several related fits. + +5. Add more fit parameters: + (a) Select the "Constraints" tab of the `Ni.stru` phase below "Fit 1_copy". + (b) Write ``@9`` in the "delta2" box. + +6. Run the fit and plot the results: + (a) Run the fit as in Lesson 1. + (b) Plot the fit as in Lesson 1, but this time hold down Control and select the data sets from "Fit 1" and "Fit 1_copy". You can change the "offset" in the plotting window to 0 to place the plots on top of each other. + +------------------------------------------------------------------------------- + +References: +----------- + +1. `Proffen-jac-1999.pdf`_ + Th. Proffen and S. J. L. Billinge, PDFFIT a program for full profile structural refinement of the atomic pair distribution function, J. Appl. Crystallogr. 32, 572-575 (1999) + +2. `Farrow-jpcm-2007.pdf`_ + C. L. Farrow, P. Juhas, J. W. Liu, D. Bryndin, J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and PDFgui: Computer programs for studying nanostructure in crystals, J. Phys.: Condens. Matter 19, 335219 (2007)