Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
``` javascript
|
| 3 |
+
# pip install Pysimxrd
|
| 4 |
+
|
| 5 |
+
Example:
|
| 6 |
+
from Pysimxrd import generator
|
| 7 |
+
from ase.db import connect
|
| 8 |
+
|
| 9 |
+
database = connect('demo.db')
|
| 10 |
+
entry_id = 1
|
| 11 |
+
|
| 12 |
+
x, y = generator.parser(database, entry_id)
|
| 13 |
+
|
| 14 |
+
import matplotlib.pyplot as plt
|
| 15 |
+
plt.plot(x,y)
|
| 16 |
+
```
|
| 17 |
+
# params
|
| 18 |
+
``` javascript
|
| 19 |
+
Simulate X-ray diffraction patterns based on a given database file and data ID.
|
| 20 |
+
|
| 21 |
+
Parameters:
|
| 22 |
+
db_file (str): Path to the database file (e.g., 'cif.db').
|
| 23 |
+
data_id (int): The ID of the data entry to be processed.
|
| 24 |
+
|
| 25 |
+
Optional Parameters:
|
| 26 |
+
deformation (bool, optional): Whether to apply deformation to the lattice. Defaults to False.
|
| 27 |
+
sim_model (str, optional): The simulation model to use. Can be 'WPEM' for WPEM simulation or None for conventional simulation. Defaults to None.
|
| 28 |
+
xrd (str, optional): The type of X-ray diffraction to simulate. Can be 'reciprocal' or 'real'. Defaults to 'reciprocal'.
|
| 29 |
+
|
| 30 |
+
Sample Parameters:
|
| 31 |
+
grainsize (float, optional): Grain size of the specimen in Angstroms. Defaults to 20.0.
|
| 32 |
+
perfect_orientation (list of float, optional): Perfect orientation of the specimen in degrees. Defaults to [0.1, 0.1].
|
| 33 |
+
lattice_extinction_ratio (float, optional): Ratio of lattice extinction in deformation. Defaults to 0.01.
|
| 34 |
+
lattice_torsion_ratio (float, optional): Ratio of lattice torsion in deformation. Defaults to 0.01.
|
| 35 |
+
|
| 36 |
+
Testing Condition Parameters:
|
| 37 |
+
thermo_vibration (float, optional): Thermodynamic vibration, the average offset of atoms, in Angstroms. Defaults to 0.1.
|
| 38 |
+
background_order (int, optional): The order of the background. Can be 4 or 6. Defaults to 6.
|
| 39 |
+
background_ratio (float, optional): Ratio of scattering background intensity to peak intensity. Defaults to 0.05.
|
| 40 |
+
mixture_noise_ratio (float, optional): Ratio of mixture vibration noise to peak intensity. Defaults to 0.02.
|
| 41 |
+
|
| 42 |
+
Instrument Parameters:
|
| 43 |
+
dis_detector2sample (int, optional): Distance between the detector and the sample in mm. Defaults to 500.
|
| 44 |
+
half_height_slit_detector_H (int, optional): Half height of the slit-shaped detector in mm. Defaults to 50 (2H = 100 mm).
|
| 45 |
+
half_height_sample_S (int, optional): Half height of the sample in mm. Defaults to 25 (height = 50 mm).
|
| 46 |
+
zero_shift (float, optional): Zero shift of angular position in degrees. Defaults to 0.1.
|
| 47 |
+
|
| 48 |
+
Returns:
|
| 49 |
+
tuple: A tuple containing the following elements:
|
| 50 |
+
- x: Lattice plane distance in the x-direction (in Angstroms) if xrd='real', or diffraction angle in the x-direction (in degrees) if xrd='reciprocal'.
|
| 51 |
+
- y: Corresponding diffraction intensity in the y-direction (arbitrary units).
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
```
|