Crystal#
- class de_ebsd.crystal.Crystal(a, b, c, alpha, beta, gamma, space_group, sites, origin=2)[source]#
Bases:
objectA crystal defined by its lattice, space group, and asymmetric unit.
Prefer the
from_parameters()constructor:crystal = Crystal.from_parameters( a=0.5431, space_group=227, atoms=[("Si", (0.125, 0.125, 0.125))] )
- Parameters:
- a, b, c
Lattice parameters in nm.
- alpha, beta, gamma
Lattice angles in degrees.
- space_group
International space-group number (1-230).
- sites
The asymmetric unit as a sequence of
AtomSite.- origin
Origin choice for the 24 centrosymmetric space groups that the International Tables list with two origins (e.g. Fd-3m). The default, 2, places the origin on an inversion center (the modern standard used by EMsoft and kikuchipy reference data); pass 1 for the tabulated diffpy setting. The choice-2 operators are derived by conjugating the tabulated operators with the smallest inversion-center shift; this is verified for the cubic two-origin groups – for other two-origin groups, confirm the convention against the International Tables.
Methods
Boolean mask of reflections allowed by the lattice centering.
Interplanar spacing d in nm for Miller indices
hkl.Explore STEM orientations using geometric lines and kinematic spots.
Create a crystal from a CIF file.
Create a crystal from lattice parameters and a simple atom list.
Reciprocal-lattice vectors in the Cartesian crystal frame (nm^-1).
Length
|g|in nm^-1 for Miller indiceshklof shape (..., 3).Compose phase metadata with native crystal and master figures.
Display the expanded crystal structure as a native 3-D figure.
Attributes
Lattice centering symbol (first letter of the space-group symbol).
Mass density in g/cm^3 from the unit-cell contents and volume.
Direct metric tensor g_ij in nm^2.
Columns are the basis vectors a, b, c in the Cartesian crystal frame (nm).
Whether this space group is one the Tables list with two origin choices.
Composition- (number-) averaged atomic number, sum(n_i Z_i) / sum(n_i).
Composition- (number-) averaged atomic weight in g/mol.
Number of equivalent atoms per asymmetric-unit site.
Expanded orbit (n_m, 3) of fractional positions, one array per site.
Reciprocal metric tensor g*_ij in nm^-2.
Columns are the reciprocal basis vectors a*, b*, c* in the Cartesian frame (nm^-1).
Unit-cell volume in nm^3.
- allowed_by_centering(hkl)[source]#
Boolean mask of reflections allowed by the lattice centering.
Mirrors EMsoft
IsGAllowed: only centering absences are tested; glide/screw absences follow automatically from|U_g| = 0.
- property centering#
Lattice centering symbol (first letter of the space-group symbol).
- property density#
Mass density in g/cm^3 from the unit-cell contents and volume.
- property direct_metric#
Direct metric tensor g_ij in nm^2.
- property direct_structure_matrix#
Columns are the basis vectors a, b, c in the Cartesian crystal frame (nm).
- explore(*, energy_kev=200.0, dmin=0.1, **kwargs)[source]#
Explore STEM orientations using geometric lines and kinematic spots.
Returns a
CrystalExplorerwith a shared projection, band sphere, and crystal view. Beam energy is in keV and the minimum lattice spacingdminin nm. Further keyword arguments are passed to the explorer. No master-pattern simulation is run.Display the result in Jupyter for interactive controls, or mount its native
figurein an application with a live Python bridge.
- classmethod from_cif(path, origin=None, debye_waller=0.005)[source]#
Create a crystal from a CIF file.
Reads only the asymmetric unit; the symmetry expansion is this class’s own job, so passing the expanded cell that
diffpy.structure.loadStructurereturns would double-count every atom.CIF lengths are Angstrom and are converted to nm. An
U_isocolumn becomes the Debye-Waller factor asB = 8 pi^2 U_iso, converted to nm^2; sites without one (or withU_iso <= 0) fall back todebye_waller. Ionic_atom_site_type_symbolentries are reduced to the element ("Si4+"->"Si"), since the scattering tables are per element.- Parameters:
- path
Path to the CIF file. Only its first data block is read.
- origin
Origin choice for the two-origin space groups.
None(default) reads_space_group_IT_coordinate_system_codefrom the file and falls back to 2 – the modern standard used by EMsoft and kikuchipy. Getting this wrong silently produces a plausible but incorrect master pattern, so pass it explicitly when the file does not record it and the group has two origins (has_two_origins).- debye_waller
Fallback isotropic B in nm^2 for sites with no usable
U_iso.
- Returns:
- classmethod from_parameters(a, b=None, c=None, alpha=90.0, beta=90.0, gamma=90.0, space_group=1, atoms=(), debye_waller=0.005)[source]#
Create a crystal from lattice parameters and a simple atom list.
atomsentries may beAtomSiteobjects or plain tuples(element, (x, y, z))/(element, (x, y, z), occupancy); tuples get the shareddebye_wallerdefault.
- property has_two_origins#
Whether this space group is one the Tables list with two origin choices.
When
True,originchanges the atom positions and therefore the master pattern, so a CIF that does not record its choice is ambiguous.
- property mean_atomic_number#
Composition- (number-) averaged atomic number, sum(n_i Z_i) / sum(n_i).
- property mean_atomic_weight#
Composition- (number-) averaged atomic weight in g/mol.
- property multiplicities#
Number of equivalent atoms per asymmetric-unit site.
- overview(master_pattern=None, name=None, *, texture_height=128, n_grid=96)[source]#
Compose phase metadata with native crystal and master figures.
The returned
PhaseOverviewdisplays in a notebook and gives SpyDE named figures to mount with its existing anyplotlib bridge. It never serializes a figure into another widget.
- property positions#
Expanded orbit (n_m, 3) of fractional positions, one array per site.
- property reciprocal_metric#
Reciprocal metric tensor g*_ij in nm^-2.
- property reciprocal_structure_matrix#
Columns are the reciprocal basis vectors a*, b*, c* in the Cartesian frame (nm^-1).
- property volume#
Unit-cell volume in nm^3.