Home - Previous: 1. Introduction
2.1 Required Input
2.2 Get the phases
2.3 From phases to electron density
This chapter describes how to get you started with pyanpha. It will outline the path from your experimental data to extracted atomic positions. This tutorial does not provide you with the best possible solutions to tweak parameters, but should bring you up to speed with the program functionality. If you want to know more about all the functions and possibilities included, have a look in Chapter 3. If you have no recorded data yet and simply want to try out the program, have a look at section 3.3 and simulate a dataset, or use the files provided in the tutorial
directory.
It is recommended that you create a project directory in the pyanpha-root directory, where all your project related files are thus stored. Before you can start with your analysis, you need three data files:
Your datafile (.dat
) should consist of 6 columns: h k l In Ia Ib, whereby h, k, and l are the Miller indices of the intensities, and In, Ia, and Ib are the intensities recorded at normal energy, first and second anomalous energy, respectively.
Both the bulk and anomalous scatterer positions are provided with an atom-file (.atm
). In the bulk atomfile, all the atoms of the bulk unit-cell have to be provided. While this file will remain constant during the processing, the anomalous scatterer file will change. This file should be your guess of both the position and occupation of your anomalous scatterers in the film. The atom-file consists of 7 columns: Label Type x y z Q U. Within an atom-file the label per atom has to be unique, but it will not matter if it includes the elements name. The Type should be an element or an ion of the element (plus/minus denoted p/m i.e., 2m for O2−). x, y, z are the coordinates of the atom within the unit-cell, Q is the occupation of the site and U is the Debye-Waller factor. For more information about the atom-file consult either section 3.2 or chapter 4. An example (bulk.atm
from the tutorial
directory) is given below:
#Label atom x y z occ u
GaB Ga3p 0.500 0.500 0.000 1.00 0.00557
NdB Nd3p 0.000 0.000 0.500 1.00 0.00787
OB1 O2m 0.500 0.000 0.000 1.00 0.00927
OB2 O2m 0.500 0.500 0.500 1.00 0.00927
OB3 O2m 0.000 0.500 0.000 1.00 0.00927
Lastly, you can provide a config file (.cfg
). This is not necessary and can also be generated within the program, or you can change the file user_vars_template.cfg
in the root directory for your purpose. In section 4.1, all the parameters within the config file are described one-by-one. We start here without predefining a config file.
You now have all the required input and you are ready to start with your analysis. Open a shell and enter $ python pyanpha.py
. In the main menu enter >> z
and change to your project directory. Next enter >> c
to enter the menu system to calculate the phases. Now we will set up the config file for the phase calculation. Enter >> e
and provide all the information for your sample. Below is our input shown. Not all the fields asked need an input at this time and can just be returned blank. First you need to provide the three files which have been
prepared in the last section:
Bulkfilename (’bulk.atm’) : bulk.atm
Anomfilename (’anom.atm’) : anom.atm
Datafilename (’ctrs.dat’) : data.dat
Afterwards, the unit cell parameters are defined. In our tutorial, we have a cubic system:
a (3.9045) : 3.8
b (3.9045) : 3.8
c (3.9045) : 3.8
alp (90.000000) : 90
bet (90.000000) : 90
gam (90.000000) : 90
Then you have to enter the three energies, which belong to In, Ia, and Ib. For the tutorial datafile, we have recorded around the Sr edge at 16.105 keV.
E_n (16.00) : 16.0
E_a (16.11) : 16.11
E_b (16.50) : 16.5
The incidence angle is then requested:
[Instrument]
Incidence angle (0.500000) : 1.0
Next some information on the anomalous scatterer is defined. It does not matter, if you have entered a different ion in the anomalous atom-file than you enter here. It also asks you to specify f′ and f′′, the energy dependent part of the form factor of your specified element. If you made a measurement of them, you can enter them here. If you leave it as zeros, it will use the tabulated values.
Anomalous Atom (’Sr’) : Sr
Measured anomalous form factor of Sr
f1, f2 @ 16.00(’0.0, 0.0’) :
f1, f2 @ 16.11(’0.0, 0.0’) :
f1, f2 @ 16.50(’0.0, 0.0’) :
Lastly you have to provide an output filename for the phase-file (.phs
).
Filename (’data.phs’): data.phs
Now you can run the phase calculation by typing >> r
and it will produce the phase-file.
The resulting file data.phs
contains the h, k, and l indices and the amplitude and phase of the surface structure factors, which pyanpha was able to retrieve. With this file we can now calculate the electron density (ED). Go back to the root-menu and enter >> e
. You are now in the ED calculation menu. Again, we need to further specify things in the config file. We do this manually and enter >> e
again.
Make sure that you have the correct phase-filename:
Datafilename (’data.phs’) : data.phs
Afterwards, you will be asked again about the unit cell parameters, the energies, and the incidence angle, which we have provided already before in the calculate phase menu. You can leave these blank, carriage return for each. Next, you will be asked about the dimensions and symmetry of your diffraction pattern. We have recorded from h = 0 ... 4 and k = 0 ... 4 and up to l = 4.5 were it was possible, with a stepsize of 0.02 r.l.u.:
h_max (4) : 4
k_max (4) : 4
l_max (4.5): 4.5
# L points (226) : 226
Symmetry : S_1 = 0
S_2 = 1
S_m = 2
S_2mm = 3
S_4 = 4
S_4mm = 5
S_m2 =10
(5) : 5
After some other inputs, which we can skip with carriage returns, we have to enter the support. This is the part of the retrieved ED which is not vacuum. It has to be given in voxels. The support’s size is determined by hmax, kmax, and lmax. We only have to provide the support in the z-direction, so lmax = 4.5 is relevant for us.
Since the program completes the dataset also down to −lmax, we get a total l-range of 9. This means, a unit-cell has a size of 9 voxels. We want to retrieve 6 unit cells, therefore we need to enter at least 54. It is recommended to make it a bit larger, so we enter 60.
Support (70) : 60
Finally, we have to give an ED filename (.zip
):
Filename (’ed.zip’): data.zip
We are now able to run the ED calculation by entering >> r
. If you have entered everything correctly, you should have generated an ED file. You can either look at this now in the plot ED menu (cf. Section 3.8) or extract the atomic positions (cf. Section 3.9. With this, all the steps from the anomalous intensities datafile to an ED file are complete. It is now up to you to tweak the input parameters such that you get a better looking ED. Change your anomalous scatterers, interpolate missing datapoints, add simulated data, and repeat described procedure.
Wiki: Introduction
Wiki: Program Source
Wiki: Pyanpha User Guide
Wiki: The Menu System