File size: 3,276 Bytes
56c956f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.11.5
kernelspec:
display_name: Python 3
language: python
name: python3
---
# The tutorial 6th
Demonstrates how to determine solid solution structures using powder XRD.
## coding
> **1. Save your diffraction data to the root directory and rename the file to `intensity.csv`.**
```{code-cell}
# import PyXplore package
from PyXplore import WPEM
import pandas as pd
```
> **2. Parse your diffraction data (`2θ`, intensity) and perform background processing.**
```{code-cell}
intensity_csv = pd.read_csv(r'intensity.csv',header=None )
var = WPEM.BackgroundFit(intensity_csv,lowAngleRange=17,poly_n=13,bac_split=16,bac_num=300)
```
> **3. After running the code, a new folder named `ConvertedDocuments` will be created in the root directory. This folder contains the background information.**
> **Copy the two important files — `bac.csv` and `no_bac_intensity.csv` — from `ConvertedDocuments` into the root directory, as they are required for the next steps.**
> **4. After background subtraction, the next step is to parse the reference structure.**
>
> Save the reference `.cif` file in the root directory. For example, if the structure is Mn₂O₃, place a file named `Mn2O3.cif` in the root directory as the reference phase.
>
> If you are unsure of the reference phase, you must perform phase identification first. Please visit our website for assistance: [https://xqueryer.caobin.asia/](https://xqueryer.caobin.asia/)
```{code-cell}
latt, AtomCoordinates,des = WPEM.CIFpreprocess(filepath='Mn2O3.cif',two_theta_range=(15,75))
```
> **5. After running the code, a new folder named `output_xrd` will be created.**
>
> Inside this folder, locate the file named `xxxHKL.csv`, copy it to the root directory, and rename it to `peak0.csv`. This file will be used in the refinement step.
```{code-cell}
# The wavelength is set according to the actual light source
wavelength = [1.540593, 1.544414]
# The file name of non-background data (2theta-intensity data)
no_bac_intensity_file = "no_bac_intensity.csv"
# The file name of raw/original data (2theta-intensity data)
original_file = "intensity.csv"
# The file name of background data (2theta-intensity data)
bacground_file = "bac.csv"
# Input the initial lattice constants {a, b, c, α, β, γ}, whose values need to be assumed at initialization.
Lattice_constants = [latt,]
# Execute the model
WPEM.XRDfit(
wavelength, var, Lattice_constants,no_bac_intensity_file, original_file, bacground_file,
subset_number=11,low_bound=20,up_bound=70,bta = 0.85,iter_max = 5, asy_C = 0,InitializationEpoch=0,
)
```
> Copy the decomposed file `CrystalSystem0_WPEMout.csv` from the `WPEMFittingResults` folder to the root directory.
```{code-cell}
WPEM.SubstitutionalSearch(
xrd_pattern='CrystalSystem0_WPEMout_2025.7.20_17.27.csv', cif_file='Mn2O3.cif',
random_num=20, wavelength='CuKa',search_cap=5,SolventAtom = 'Mn3+', SoluteAtom= 'Ru2+',max_iter = 15,cal_extinction=True,
)
```
```{seealso}
After searching the solid solution configurations, the one that provides the best fit to the experimental PXRD data is selected.
```
|