pyextal.blochwave

Attributes

Classes

Functions

bloch_parse(→ Tuple[int, int, numpy.ndarray, float, ...)

Parses a .dat input file and initializes the simulation parameters.

defaultsf(→ Tuple[float, float, float, float, float])

Calculates the default structure factor for a given reflection.

resetugh(→ None)

Resets and updates the Ugh (potential) matrices in the bloch_module.

larbed(→ numpy.ndarray)

Calculates the LARBED (Large Angle Rocking Beam Electron Diffraction) pattern.

larbed2(→ numpy.ndarray)

Calculates the LARBED pattern with thickness varying for each tilt.

beamcheck(→ int)

Checks the number of beams within the excitation error limit for a given tilt.

bloch_run(→ int)

Runs the Bloch wave simulation over a range of tilts, using MPI if enabled.

dryrun(→ float)

Calculates the estimated memory usage for a simulation.

tilt_run(→ None)

Runs the Bloch wave simulation for specific indices using MPI.

Module Contents

class pyextal.blochwave.Constants
pi: float
twopi: float
ratio: numpy.ndarray
dkv: float
hv: float
vol: float
build_version: str
build_date: str
class pyextal.blochwave.Cryst
label: numpy.ndarray
cell: numpy.ndarray
abx: numpy.ndarray
zt: numpy.ndarray
v0: float
itype: numpy.ndarray
iftype: numpy.ndarray
atpar: numpy.ndarray
smult: numpy.ndarray
dw: numpy.ndarray
natoms: int
ntype: int
class pyextal.blochwave.Difpar
nbeams: int
ncore: int
nidptr: int
nref: int
hkl: numpy.ndarray
idptr: numpy.ndarray
kv: float
bigk: float
ratio1: float
abm: float
sgmax: float
sgmin: float
omgmx: float
gamma: float
wavel: float
gx: numpy.ndarray
gy: numpy.ndarray
zone: numpy.ndarray
snorm: numpy.ndarray
hklf: numpy.ndarray
vhkl: numpy.ndarray
allocate_arrays_difpar() → None
deallocate_arrays_difpar() → None
updatekv(kv_new: float) → None
class pyextal.blochwave.BlochModule
ughr: numpy.ndarray
ughi: numpy.ndarray
cinv: numpy.ndarray
v: numpy.ndarray
cc: numpy.ndarray
ig: numpy.ndarray
ipvt: numpy.ndarray
ndiag: int
allocate_arrays_bloch(nbeams: int) → None
deallocate_arrays_bloch() → None
class pyextal.blochwave.Sfpar
stab: numpy.ndarray
ftab: numpy.ndarray
ftab2: numpy.ndarray
ntab: numpy.ndarray
istab: int
class pyextal.blochwave.Xtal
atm: numpy.ndarray
xyz: numpy.ndarray
xyz0: numpy.ndarray
jtype: numpy.ndarray
jftype: numpy.ndarray
nsite: int
class pyextal.blochwave.Spgr
aspg: str
alag: str
syst: str
ngp: int
centro: int
ncsub4: int
gp: numpy.ndarray
csub4: numpy.ndarray
class pyextal.blochwave.Eigen
ndiags: numpy.ndarray
eigenvectors: numpy.ndarray
cinvs: numpy.ndarray
eigenvalues: numpy.ndarray
tilt: numpy.ndarray
check_allocated_eigen() → bool
check_size_eigen(nbeams: int, ntilt: int, nout: int) → bool
allocate_arrays_eigen(nbeams: int, ntilt: int, nout: int) → None
deallocate_arrays_eigen() → None
allocate_tilt(ntilt: int) → None
deallocate_tilt() → None
class pyextal.blochwave.Mpiinfo
intercomm: int
first: bool
mpiinfo_despawn() → None
class pyextal.blochwave.Sfmanager
e2xray(gg: numpy.ndarray, value: numpy.ndarray) → numpy.ndarray
class pyextal.blochwave.Gram
gmx: numpy.ndarray
gmxr: numpy.ndarray
pyextal.blochwave.constants: Constants
pyextal.blochwave.cryst: Cryst
pyextal.blochwave.difpar: Difpar
pyextal.blochwave.bloch_module: BlochModule
pyextal.blochwave.sfpar: Sfpar
pyextal.blochwave.xtal: Xtal
pyextal.blochwave.spgr: Spgr
pyextal.blochwave.eigen: Eigen
pyextal.blochwave.mpiinfo: Mpiinfo
pyextal.blochwave.sfmanager: Sfmanager
pyextal.blochwave.gram: Gram
pyextal.blochwave.bloch_parse(fname: str, t_x: float = 0.0, t_y: float = 0.0) → Tuple[int, int, numpy.ndarray, float, float, numpy.ndarray, numpy.ndarray, numpy.ndarray]

Parses a .dat input file and initializes the simulation parameters.

Parameters:
  • fname – Path to the .dat input file.

  • t_x – Additional tilt in x direction (degrees). Default is 0.0.

  • t_y – Additional tilt in y direction (degrees). Default is 0.0.

Returns:

  • nout (int): Number of reflections to be output.

  • nx2 (int): Sampling size.

  • hklout (np.ndarray): (3, 1000) integer array of output reflections.

  • disks (float): Convergence angle/disk radius.

  • alpha (float): Angle between zone axis and surface normal.

  • tilt0 (np.ndarray): (3, 3) real array of incident beam direction and disk centers.

  • gvx (np.ndarray): (3,) real array of horizontal reciprocal vector.

  • gvy (np.ndarray): (3,) real array of vertical reciprocal vector.

Return type:

A tuple containing

pyextal.blochwave.defaultsf(id: int, gg: numpy.ndarray) → Tuple[float, float, float, float, float]

Calculates the default structure factor for a given reflection.

Parameters:
  • id – Atom type index.

  • gg – (3,) reflection vector (h, k, l).

Returns:

  • ss (float): Scattering vector length squared.

  • xfre (float): Real part of the X-ray structure factor.

  • xfim (float): Imaginary part of the X-ray structure factor.

  • afre (float): Real part of the absorption structure factor.

  • afim (float): Imaginary part of the absorption structure factor.

Return type:

A tuple containing

pyextal.blochwave.resetugh() → None

Resets and updates the Ugh (potential) matrices in the bloch_module.

pyextal.blochwave.larbed(depth: float, ntilt: int, alpha: float, gg: numpy.ndarray, nout: int) → numpy.ndarray

Calculates the LARBED (Large Angle Rocking Beam Electron Diffraction) pattern.

Parameters:
  • depth – Sample thickness in Angstroms.

  • ntilt – Number of tilt positions.

  • alpha – Convergence angle.

  • gg – (3,) reciprocal space vector.

  • nout – Number of output reflections.

Returns:

(ntilt * nout,) real array of intensities.

Return type:

yt (np.ndarray)

pyextal.blochwave.larbed2(depth: numpy.ndarray, nout: int, alpha: float, gg: numpy.ndarray) → numpy.ndarray

Calculates the LARBED pattern with thickness varying for each tilt.

Parameters:
  • depth – (ntilt,) real array of sample thicknesses.

  • nout – Number of output reflections.

  • alpha – Convergence angle.

  • gg – (3,) reciprocal space vector.

Returns:

(ntilt * nout,) real array of intensities.

Return type:

yt (np.ndarray)

pyextal.blochwave.beamcheck(tiltCheck: numpy.ndarray) → int

Checks the number of beams within the excitation error limit for a given tilt.

Parameters:

tiltCheck – (3,) real array of the tilt vector.

Returns:

Number of diagonal elements (beams) included.

Return type:

ndiagCheck (int)

pyextal.blochwave.bloch_run(nout: int, tilt0: numpy.ndarray, gg: numpy.ndarray, g_horizontal: numpy.ndarray, pixsiz: float, subAper: int, subnx: numpy.ndarray, subny: numpy.ndarray, ncores: int, collector: Callable[[int, numpy.ndarray, int, int, int], int]) → int

Runs the Bloch wave simulation over a range of tilts, using MPI if enabled.

Parameters:
  • nout – Number of output reflections.

  • tilt0 – (3,) incident tilt vector.

  • gg – (3,) reciprocal space vector.

  • g_horizontal – (3,) horizontal direction in reciprocal space.

  • pixsiz – Pixel size in reciprocal space.

  • subAper – Aperture type.

  • subnx – (2,) sampling range in x.

  • subny – (2,) sampling range in y.

  • ncores – Number of MPI cores to use.

  • collector – Callback function to collect results for each tilt.

Returns:

Total number of tilts simulated.

Return type:

ntilt (int)

pyextal.blochwave.dryrun(nout: int, tilt0: numpy.ndarray, gg: numpy.ndarray, g_horizontal: numpy.ndarray, pixsiz: float, subAper: int, subnx: numpy.ndarray, subny: numpy.ndarray, ncores: int) → float

Calculates the estimated memory usage for a simulation.

Parameters:
  • nout – Number of output reflections.

  • tilt0 – (3,) incident tilt vector.

  • gg – (3,) reciprocal space vector.

  • g_horizontal – (3,) horizontal direction in reciprocal space.

  • pixsiz – Pixel size in reciprocal space.

  • subAper – Aperture type.

  • subnx – (2,) sampling range in x.

  • subny – (2,) sampling range in y.

  • ncores – Number of MPI cores to use.

Returns:

Estimated memory usage.

Return type:

memuse (float)

pyextal.blochwave.tilt_run(nout: int, indices: numpy.ndarray, ncores: int) → None

Runs the Bloch wave simulation for specific indices using MPI.

Parameters:
  • nout – Number of output reflections.

  • indices – (nhklout,) integer array of reflection indices.

  • ncores – Number of MPI cores to use.