Beispiel #1
0
def return2fz(euler):
    g = bunge2g(euler)
    symhex = ef.symhex()
    for ii in xrange(symhex.shape[0]):
        g_symm = np.dot(symhex[ii, ...], g)
        euler_ = g2bunge(g_symm)
        euler_ += 2 * np.pi * np.array(euler_ < 0)
        if np.all(euler_ < np.array([2 * np.pi, np.pi / 2, np.pi / 3])):
            break
    return euler_
def is_equiv_g(g1, g2):
    symhex = ef.symhex()
    is_equiv = False

    for ii in xrange(symhex.shape[0]):
        g_symm = np.dot(symhex[ii, ...], g1)
        if np.all(np.isclose(g2, g_symm)):
            is_equiv = True

    return is_equiv
import euler_func as ef
import h5py
"""
check whether the database exhibits hexagonal-triclinic crystal
symmetry

first find 12 symmetric orientations in triclinic FZ
(0<=phi1<2*pi, 0<=Phi<=pi, 0<=phi2<2*pi)

for each deformation mode sample (theta), check if the value of
interest is the same for all symmetric orientations
"""

np.random.seed()  # generate seed for random

symhex = ef.symhex()

inc = 5  # degree increment for angular variables

n_th_max = 120 / inc  # number of theta samples in FOS
n_max = 360 / inc  # number of phi1, Phi and phi2 samples in FOS
n_hlf = 180 / inc  # half n_max

n_th = (60 / inc) + 1  # number of theta samples for FZ
n_p1 = 360 / inc  # number of phi1 samples for FZ
n_P = (90 / inc) + 1  # number of Phi samples for FZ
n_p2 = 60 / inc  # number of phi2 samples for FZ

print "angle space shape: %s" % str(np.array([n_th, n_p1, n_P, n_p2]))

# only look at last in series for value of interest
print "N_L = %s" % N_L
# N_L = 10

phi1max = 360
phimax = 90
phi2max = 60

inc = 10.

"""Retrieve Euler angle set"""

euler, n_tot = euler_grid_center(inc, phi1max, phimax, phi2max)

"""Perform the symmetry check"""

symop = ef.symhex()
n_sym = symop.shape[0]
print "number of symmetry operators: %s" % n_sym

euler_sym = np.zeros((n_sym, n_tot, 3))

g_orig = ef.bunge2g(euler[:, 0], euler[:, 1], euler[:, 2])

# find the symmetric equivalents to the euler angle within the FZ
for sym in xrange(n_sym):
    op = symop[sym, ...]

    # g_sym: array of orientation matrices transformed with a
    # symmetry operator
    g_sym = np.einsum('ik,...kj', op, g_orig)