Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a diffraction module for handling of reciprocal lattice points and structure factors #197

Closed
wants to merge 6 commits into from

Conversation

hakonanes
Copy link
Member

Description

A diffraction module to enable easy creation, storage and manipulation of reciprocal lattice points (Miller indices/Kikuchi bands), which stores

  • Miller indices
  • direct space interplanar spacing (d-spacing)
  • reciprocal space lattice point spacing (g-spacing)
  • structure factors
  • similar quantitites

The class is loosely based upon EMsoft's gnode type (https://github.com/EMsoft-org/EMsoft/blob/develop/Source/EMsoftLib/typedefs.f90#L1238).

It needs a well defined crystal structure as a orix.crystal_map.Phase object, which conveniently stores diffpy.structure.Structure, diffpy.structure.SpaceGroup and orix.quaternion.symmetry.Symmetry objects.

The reciprocal lattice point indices are stored as orix.vector3d.Vector3d objects, which allows use of the Vector3d.unique() method to get unique indices, compute the multiplicity and other useful things.

Checklist

Minimal example of the bug fix or new feature

>>> from orix.crystal_map import Phase
>>> from diffpy.structure import Lattice, Atom, Structure
>>> from kikuchipy.diffraction import ReciprocalLatticePoint
>>> lattice = Lattice(2.8665, 2.8665, 2.8665, 90, 90, 90)
>>> atoms = [Atom("Fe", [0, 0, 0]), Atom("Fe", [0.5, 0.5, 0.5])]
>>> structure = Structure(lattice=lattice, atoms=atoms)
>>> p = Phase("ferrite", space_group=229, structure=structure)
>>> rlp = ReciprocalLatticePoint.from_min_dspacing(p, 0.5)  # Ångstrøm
>>> rlp
ReciprocalLatticePoint (19,)
Phase: ferrite (m-3m)
[[3 3 3]
 [3 3 2]
 [3 3 1]
 [3 3 0]
 [3 2 2]
 [3 2 1]
 [3 2 0]
 [3 1 1]
 [3 1 0]
 [3 0 0]
 [2 2 2]
 [2 2 1]
 [2 2 0]
 [2 1 1]
 [2 1 0]
 [2 0 0]
 [1 1 1]
 [1 1 0]
 [1 0 0]]
>>> rlp.multiplicity
array([ 8, 24, 24, 12, 24, 48, 24, 24, 24,  6,  8, 24, 12, 24, 24,  6,  8,
       12,  6])
>>> rlp.dspacing
array([0.55165818, 0.61113985, 0.6576202 , 0.67564053, 0.69522837,
       0.76610435, 0.79502406, 0.86428227, 0.90646689, 0.9555    ,
       0.82748727, 0.9555    , 1.01346079, 1.17024372, 1.28193777,
       1.43325   , 1.65497455, 2.02692159, 2.8665    ])
>>> rlp.gspacing
array([1.8127167 , 1.63628668, 1.52063455, 1.48007699, 1.43837629,
       1.30530521, 1.25782357, 1.15702941, 1.10318425, 1.04657248,
       1.2084778 , 1.04657248, 0.98671799, 0.85452285, 0.78006907,
       0.69771498, 0.6042389 , 0.493359  , 0.34885749])
>>> rlp.calculate_structure_factor()  # Don't think this is correct yet
>>> rlp.structure_factor
array([1.8127167 , 1.63628668, 1.52063455, 1.48007699, 1.43837629,
       1.30530521, 1.25782357, 1.15702941, 1.10318425, 1.04657248,
       1.2084778 , 1.04657248, 0.98671799, 0.85452285, 0.78006907,
       0.69771498, 0.6042389 , 0.493359  , 0.34885749])
>>> rlp[rlp.structure_factor > 0]
ReciprocalLatticePoint (9,)
Phase: ferrite (m-3m)
[[3 3 2]
 [3 3 0]
 [3 2 1]
 [3 1 0]
 [2 2 2]
 [2 2 0]
 [2 1 1]
 [2 0 0]
 [1 1 0]]

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    the unreleased section in doc/changelog.rst.

@hakonanes
Copy link
Member Author

This functionality will be moved to diffsims (see discussions in pyxem/diffsims#80). kikuchipy will then depend on diffsims for this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant