예제 #1
0
def test_dihedral_groups(sparse_rzxz_grid, point_group_str):
    """ Asserts volume changes broadly as expected """
    order = int(point_group_str[0])
    volume = 1 / (2 * order)  # From page 103 of Morawiec
    start_size = sparse_rzxz_grid.data.shape[0]
    r = reduce_to_fundamental_zone(sparse_rzxz_grid, point_group_str)
    assert_volume_changes_obeyed(r, start_size, volume)
예제 #2
0
def test_orthogonal_linear_case_for_cyclic_group(fz_string):
    """ Rotations about the x direction are never removed by the effects of the cyclic group """
    axis = np.hstack((np.ones((2000, 1)), np.zeros((2000, 2))))  # x
    angle = np.linspace(-np.pi, np.pi, 2000)
    along_x_axis = AxAngle(np.hstack((axis, angle.reshape(-1, 1))))
    reduced = reduce_to_fundamental_zone(along_x_axis, fz_string)
    assert reduced.data.shape[0] == along_x_axis.data.shape[0]
def test_tetragonal_group(dense_rzxz_grid):
    """ Tests volume lies with the two bounding spheres """
    full_volume = (4 / 3) * np.pi * (180) ** 3
    outer_volume = (4 / 3) * np.pi * (90) ** 3
    r_inner = 90 * np.sqrt(1 / 3)  # See https://en.wikipedia.org/wiki/Octahedron
    inner_volume = (4 / 3) * np.pi * (r_inner) ** 3
    start_size = dense_rzxz_grid.data.shape[0]
    r = reduce_to_fundamental_zone(dense_rzxz_grid, "23")
    observed_ratio = r.data.shape[0] / start_size
    assert observed_ratio < outer_volume / full_volume
    assert observed_ratio > inner_volume / full_volume
예제 #4
0
def get_fundamental_zone_grid(space_group_number, resolution):
    """
    Creates a rotation list for the rotations within the fundamental zone of a given space group.

    Parameters
    ----------
    space_group_number : int
        Between 1 and 230

    resolution : float
        The 'resolution' of the grid (degrees)

    Returns
    -------
    rotation_list : list of tuples
    """
    zone_string = get_proper_point_group_string(space_group_number)
    raw_grid = create_linearly_spaced_array_in_rzxz(
        resolution)  # see discussion in diffsims/#50
    raw_grid_axangle = raw_grid.to_AxAngle()
    fz_grid_axangle = reduce_to_fundamental_zone(raw_grid_axangle, zone_string)
    return _returnable_eulers_from_axangle(fz_grid_axangle, 'rzxz', round_to=2)
예제 #5
0
def test_cyclic_groups(sparse_rzxz_grid, order):
    """ Asserts volume changes broadly as expected """
    start_size = sparse_rzxz_grid.data.shape[0]
    r = reduce_to_fundamental_zone(sparse_rzxz_grid, order)
    volume = 1 / int(order)
    assert_volume_changes_obeyed(r, start_size, volume)
예제 #6
0
def test_non_zero_returns(sparse_rzxz_grid, fz_string):
    """ All code paths must return some orientations """
    reduced_data = reduce_to_fundamental_zone(sparse_rzxz_grid, fz_string)
    assert reduced_data.data.shape[0] > 0