| ## This simulation module is available through the Apache-licensed Pysimxrd package. | |
| ### Running under | |
| `Python==3.9.19` | |
| ``` javascript | |
| # pip install Pysimxrd | |
| Example: | |
| from Pysimxrd import generator | |
| from ase.db import connect | |
| database = connect('demo.db') | |
| entry_id = 1 | |
| x, y = generator.parser(database, entry_id) | |
| import matplotlib.pyplot as plt | |
| plt.plot(x,y) | |
| ``` | |
| # params | |
| ``` javascript | |
| Simulate X-ray diffraction patterns based on a given database file and data ID. | |
| Parameters: | |
| db_file (str): Path to the database file (e.g., 'cif.db'). | |
| data_id (int): The ID of the data entry to be processed. | |
| Optional Parameters: | |
| deformation (bool, optional): Whether to apply deformation to the lattice. Defaults to False. | |
| sim_model (str, optional): The simulation model to use. Defaults to None. | |
| xrd (str, optional): The type of X-ray diffraction to simulate. Can be 'reciprocal' or 'real'. Defaults to 'reciprocal'. | |
| Sample Parameters: | |
| grainsize (float, optional): Grain size of the specimen in Angstroms. Defaults to 20.0. | |
| prefect_orientation (list of float, optional): Perfect orientation of the specimen in degrees. Defaults to [0.1, 0.1]. | |
| lattice_extinction_ratio (float, optional): Ratio of lattice extinction in deformation. Defaults to 0.01. | |
| lattice_torsion_ratio (float, optional): Ratio of lattice torsion in deformation. Defaults to 0.01. | |
| Testing Condition Parameters: | |
| thermo_vibration (float, optional): Thermodynamic vibration, the average offset of atoms, in Angstroms. Defaults to 0.1. | |
| background_order (int, optional): The order of the background. Can be 4 or 6. Defaults to 6. | |
| background_ratio (float, optional): Ratio of scattering background intensity to peak intensity. Defaults to 0.05. | |
| mixture_noise_ratio (float, optional): Ratio of mixture vibration noise to peak intensity. Defaults to 0.02. | |
| Instrument Parameters: | |
| dis_detector2sample (int, optional): Distance between the detector and the sample in mm. Defaults to 500. | |
| half_height_slit_detector_H (int, optional): Half height of the slit-shaped detector in mm. Defaults to 50 (2H = 100 mm). | |
| half_height_sample_S (int, optional): Half height of the sample in mm. Defaults to 25 (height = 50 mm). | |
| zero_shift (float, optional): Zero shift of angular position in degrees. Defaults to 0.1. | |
| Returns: | |
| tuple: A tuple containing the following elements: | |
| - 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'. | |
| - y: Corresponding diffraction intensity in the y-direction (arbitrary units). | |
| ``` |