-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #460 which adds new sampling approaches
- Loading branch information
Showing
6 changed files
with
243 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
================== | ||
Sampling rotations | ||
================== | ||
This example shows how to sample some phase object in Orix. We will | ||
get both the zone axis and the reduced fundamental zone rotations for | ||
the phase of interest. | ||
""" | ||
|
||
from diffpy.structure import Atom, Lattice, Structure | ||
|
||
from orix.crystal_map import Phase | ||
from orix.sampling import get_sample_reduced_fundamental, get_sample_zone_axis | ||
from orix.vector import Vector3d | ||
|
||
a = 5.431 | ||
latt = Lattice(a, a, a, 90, 90, 90) | ||
atom_list = [] | ||
for coords in [[0, 0, 0], [0.5, 0, 0.5], [0, 0.5, 0.5], [0.5, 0.5, 0]]: | ||
x, y, z = coords[0], coords[1], coords[2] | ||
atom_list.append(Atom(atype="Si", xyz=[x, y, z], lattice=latt)) # Motif part A | ||
atom_list.append( | ||
Atom(atype="Si", xyz=[x + 0.25, y + 0.25, z + 0.25], lattice=latt) | ||
) # Motif part B | ||
struct = Structure(atoms=atom_list, lattice=latt) | ||
p = Phase(structure=struct, space_group=227) | ||
reduced_fun = get_sample_reduced_fundamental(resolution=4, point_group=p.point_group) | ||
|
||
vect_rot = ( | ||
reduced_fun * Vector3d.zvector() | ||
) # get the vector representation of the rotations | ||
vect_rot.scatter(grid=True) # plot the stereographic projection of the rotations | ||
|
||
# %% | ||
|
||
zone_axis_rot, directions = get_sample_zone_axis( | ||
phase=p, density="7", return_directions=True | ||
) # get the zone axis rotations | ||
zone_vect_rot = ( | ||
zone_axis_rot * Vector3d.zvector() | ||
) # get the vector representation of the rotations | ||
zone_vect_rot.scatter( | ||
grid=True, vector_labels=directions, text_kwargs={"size": 8, "rotation": 0} | ||
) # plot the stereographic projection of the rotations | ||
|
||
# %% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters