schrodinger.application.matsci.xrd module

Module to generate powder diffraction.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.xrd.XRDCalculator(wavelength='CuKa', symprec=0, debye_waller_factors=None)

Bases: pymatgen.analysis.diffraction.xrd.XRDCalculator

See parent documentation. The main change is in get_pattern, to allow atom-less structure.

get_pattern(structure, scaled=True, two_theta_range=(0, 90), compute_intensities=True)

Calculates the diffraction pattern for a structure.

Parameters
  • structure (schrodinger.structure.Structure) – Input structure

  • scaled (bool) – Whether to return scaled intensities. The maximum peak is set to a value of 100. Defaults to True. Use False if you need the absolute values to combine XRD plots.

  • two_theta_range (list[float]) – Two member list for range of two_thetas to calculate in degrees. Defaults to (0, 90). Set to None if you want all diffracted beams within the limiting sphere of radius 2 / wavelength.

  • compute_intensities (bool) – If True, compute peaks intensities (requires atoms in the structure), otherwise only peak locations

Returns

XRDPattern

AVAILABLE_RADIATION = ('CuKa', 'CuKa2', 'CuKa1', 'CuKb1', 'MoKa', 'MoKa2', 'MoKa1', 'MoKb1', 'CrKa', 'CrKa2', 'CrKa1', 'CrKb1', 'FeKa', 'FeKa2', 'FeKa1', 'FeKb1', 'CoKa', 'CoKa2', 'CoKa1', 'CoKb1', 'AgKa', 'AgKa2', 'AgKa1', 'AgKb1')
SCALED_INTENSITY_TOL = 0.001
TWO_THETA_TOL = 1e-05
__init__(wavelength='CuKa', symprec=0, debye_waller_factors=None)

Initializes the XRD calculator with a given radiation.

Args:
wavelength (str/float): The wavelength can be specified as either a

float or a string. If it is a string, it must be one of the supported definitions in the AVAILABLE_RADIATION class variable, which provides useful commonly used wavelengths. If it is a float, it is interpreted as a wavelength in angstroms. Defaults to “CuKa”, i.e, Cu K_alpha radiation.

symprec (float): Symmetry precision for structure refinement. If

set to 0, no refinement is done. Otherwise, refinement is performed using spglib with provided precision.

debye_waller_factors ({element symbol: float}): Allows the

specification of Debye-Waller factors. Note that these factors are temperature dependent.

get_plot(structure, two_theta_range=(0, 90), annotate_peaks=True, ax=None, with_labels=True, fontsize=16)

Returns the diffraction plot as a matplotlib.pyplot.

Args:

structure: Input structure two_theta_range ([float of length 2]): Tuple for range of

two_thetas to calculate in degrees. Defaults to (0, 90). Set to None if you want all diffracted beams within the limiting sphere of radius 2 / wavelength.

annotate_peaks: Whether to annotate the peaks with plane

information.

ax: matplotlib Axes or None if a new figure should be created. with_labels: True to add xlabels and ylabels to the plot. fontsize: (int) fontsize for peak labels.

Returns:

(matplotlib.pyplot)

plot_structures(structures, fontsize=6, **kwargs)

Plot diffraction patterns for multiple structures on the same figure.

Args:

structures (Structure): List of structures two_theta_range ([float of length 2]): Tuple for range of

two_thetas to calculate in degrees. Defaults to (0, 90). Set to None if you want all diffracted beams within the limiting sphere of radius 2 / wavelength.

annotate_peaks (bool): Whether to annotate the peaks with plane

information.

fontsize: (int) fontsize for peak labels.

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

show_plot(structure, **kwargs)

Shows the diffraction plot.

Args:

structure (Structure): Input structure two_theta_range ([float of length 2]): Tuple for range of

two_thetas to calculate in degrees. Defaults to (0, 90). Set to None if you want all diffracted beams within the limiting sphere of radius 2 / wavelength.

annotate_peaks (bool): Whether to annotate the peaks with plane

information.