rgpycrumbs.eon.ptmdisp¶
Identifies non-crystalline atoms using polyhedral template matching.
Added in version 0.0.2.
Identifies atoms in a structure file that do not match a specified crystal structure (e.g., FCC) and prints their 0-based indices to standard output. By default, the script is quiet. Use –verbose for progress messages.
Attributes¶
Classes¶
Backport for Python 3.10. |
|
Enum where members are also (and must be) strings |
Functions¶
Import the Open Visualization Tool and the structure type map. |
|
|
The candidates whose centrosymmetry, in units of a**2, is in the window. |
|
The atoms closer than radius to the center of the defect atoms. |
|
Analyzes a structure file with PTM, identifies the interstitial defect, |
|
Analyzes FILENAME to find all atoms that are NOT the specified |
Module Contents¶
- class rgpycrumbs.eon.ptmdisp.CrystalStructure[source]¶
Bases:
enum.StrEnumEnum where members are also (and must be) strings
- rgpycrumbs.eon.ptmdisp._load_ovito()[source]¶
Import the Open Visualization Tool and the structure type map.
Help and import succeed without the package. Analysis imports it.
- rgpycrumbs.eon.ptmdisp._vacancy_neighbors(data, candidates: numpy.ndarray, csp_min_a2: float, csp_max_a2: float) numpy.ndarray[source]¶
The candidates whose centrosymmetry, in units of a**2, is in the window.
- rgpycrumbs.eon.ptmdisp._sphere_indices(atoms, defect: numpy.ndarray, radius: float) numpy.ndarray[source]¶
The atoms closer than radius to the center of the defect atoms.
The center is the mean of the defect atoms, each taken at its image nearest to the first of them. Each distance goes to the nearest image of an atom. Both take images along the periodic axes of the cell alone.
- rgpycrumbs.eon.ptmdisp.find_mismatch_indices(filename: str, target_structure: CrystalStructure, remove_fcc_vacancy: bool = False, view_selection: bool = False, selection_radius: float = 5, csp_vacancy_min: float = CSP_VACANCY_MIN_A2, csp_vacancy_max: float = CSP_VACANCY_MAX_A2, selection_image: str | pathlib.Path = 'selection.png') numpy.ndarray[source]¶
Analyzes a structure file with PTM, identifies the interstitial defect, and returns the indices of the interstitial atoms plus all atoms within a sphere of radius selection_radius.
The sphere is centered on the mean of the defect atoms. Along each periodic axis of the cell, the mean and the distances take the nearest periodic image of each atom. The structure analysis and the sphere take the periodic axes that the file declares. readcon reads a
.confile with the flags of its metadata line, and with all three axes periodic when that line has none. The eon reader of ase, which takes compressed.confiles, drops the flags, so those files are periodic along all three axes.With remove_fcc_vacancy set, atoms whose centrosymmetry marks them as vacancy neighbors are dropped from the defect atoms. Those are the mismatched atoms whose centrosymmetry, divided by the squared FCC lattice constant, lies from csp_vacancy_min to csp_vacancy_max. A vacancy neighbor has 1/2. Atoms in a stacking fault and around a relaxed octahedral interstitial sit near 1/2 too, so they are dropped as well. Without FCC atoms nothing is dropped. Otherwise every atom that does not match target_structure is a defect atom. With view_selection set, the atoms of the sphere are rendered to the PNG file selection_image. The render then removes its pipeline from the OVITO scene, so the scene keeps only the pipelines that it had before the call. With no defect atom, the result is empty and nothing is rendered.
Changed in version 1.14.0: Without remove_fcc_vacancy, the mismatched atoms are kept instead of all being dropped. With no defect atom, the empty result comes back before any averaging. The vacancy window is in units of the squared lattice constant, set by csp_vacancy_min and csp_vacancy_max, and the parameter is taken over all atoms. It used to be 70 to 95 square angstroms of a parameter taken over the mismatched atoms alone. The neighbors of a lone vacancy have 11/2 there, so that window caught them only for lattice constants from 3.57 to 4.16 angstroms. view_selection defaults to False, and selection_image names the file. By default, every call used to render
selection.pngin the working directory. Each render used to leave its pipeline in the OVITO scene, so every later render in the process drew those atoms as well. The center and the distances of the sphere used to ignore the periodic boundaries. So a defect on a face, an edge or a corner of the cell returned other atoms than the same defect inside it. The atoms used to be periodic along all three axes after the read, whatever the file declared. A file without a cell then failed in the structure analysis.
- rgpycrumbs.eon.ptmdisp.main(filename: str, structure: CrystalStructure, verbose: bool, no_fcc_vacancy: bool, csp_vacancy_min: float, csp_vacancy_max: float, selection_image: pathlib.Path | None)[source]¶
Analyzes FILENAME to find all atoms that are NOT the specified crystal structure type and prints their 0-based indices as a comma-separated list, suitable for use in other programs.
The vacancy filter drops atoms whose centrosymmetry, divided by the squared FCC lattice constant a**2, lies from –csp-vacancy-min to –csp-vacancy-max. A vacancy neighbor has 0.5.