matador.fingerprints package¶
Submodules¶
matador.fingerprints.fingerprint module¶
This file implements the base class for all “fingerprints”, which here refers to any object derived from purely structural features of a crystal, e.g. pair distribution functions (PDF) or simulated powder X-ray diffraction (PXRD) spectra.
- matador.fingerprints.fingerprint.njit(f)¶
- class matador.fingerprints.fingerprint.Fingerprint(doc, lazy=True, *args, **kwargs)[source]¶
Bases:
ABC- fingerprint = None¶
- default_key = None¶
- class matador.fingerprints.fingerprint.FingerprintFactory(cursor, required_inds=None, debug=False, **fprint_args)[source]¶
Bases:
ABCThis class computes Fingerprint objects from a list of structures, using multiprocessing to perform calculations concurrently. The computed fingerprints are stored in each structure’s dictionary under the default key defined by the Fingerprint objects.
Note
The number of processes used to concurrency is set by the following hierarchy:
$SLURM_NTASKS -> $OMP_NUM_THREADS -> psutil.cpu_count(logical=False).Compute PDFs over n processes, where n is set by either
$SLURM_NTASKS,$OMP_NUM_THREADSor physical core count.- Parameters:
fingerprint (Fingerprint) – class to compute for each structure
- Keyword Arguments:
- fingerprint = None¶
- default_key = None¶
matador.fingerprints.pdf module¶
This submodule defines classes for computing, combining and convolving pair distribution functions.
- matador.fingerprints.pdf.njit(f)¶
- class matador.fingerprints.pdf.PDF(doc, lazy=False, **kwargs)[source]¶
Bases:
FingerprintThis class implements the calculation and comparison of pair distribution functions.
- r_space¶
1-D array containing real space grid
- Type:
ndarray
- gr¶
1-D array containing total PDF
- Type:
ndarray
- elem_gr¶
dict with pairs of element symbol keys, containing 1-D arrays of projected PDFs (if calculated)
- Type:
Initialise parameters and run PDF (unless lazy=True).
- Parameters:
doc (dict) – matador document to calculate PDF of
- Keyword Arguments:
dr (float) – bin width for PDF (Angstrom) (DEFAULT: 0.01)
gaussian_width (float) – width of Gaussian smearing (Angstrom) (DEFAULT: 0.01)
num_images (int/str) – number of unit cell images include in PDF calculation (DEFAULT: ‘auto’)
max_num_images (int) – cutoff number of unit cells before crashing (DEFAULT: 50)
rmax (float) – maximum distance cutoff for PDF (Angstrom) (DEFAULT: 15)
projected (bool) – optionally calculate the element-projected PDF
standardize (bool) – standardize cell before calculating PDF
lazy (bool) – if True, calculator is not called when initializing PDF object
timing (bool) – if True, print the total time taken to calculate the PDF
- class matador.fingerprints.pdf.PDFFactory(cursor, required_inds=None, debug=False, **fprint_args)[source]¶
Bases:
FingerprintFactoryThis class computes PDF objects from a list of structures, as concurrently as possible. The PDFs are stored under the
pdfkey inside each structure dict.Compute PDFs over n processes, where n is set by either
$SLURM_NTASKS,$OMP_NUM_THREADSor physical core count.- Parameters:
fingerprint (Fingerprint) – class to compute for each structure
- Keyword Arguments:
- default_key = 'pdf'¶
- class matador.fingerprints.pdf.PDFOverlap(pdf_a, pdf_b, projected=False)[source]¶
Bases:
objectCalculate the PDFOverlap between two PDF objects, pdf_a and pdf_b, with number density rescaling.
Perform the overlap and similarity distance calculations.
- Parameters:
- Keyword Arguments:
projected – if True, attempt to use projected PDFs.
- pdf_overlap()[source]¶
Calculate the overlap of two PDFs via a simple meshed sum of their difference.