Beispiel #1
0
    try:
        hkls.append(tuple([int(c) for c in pfName]))
        files.append(os.path.join(datadir, file))
    except:  #not hkls
        continue

    sortby = [sum([c**2 for c in h]) for h in hkls]
    hkls = [x for _, x in sorted(zip(sortby, hkls), key=lambda pair: pair[0])]
    files = [
        x for _, x in sorted(zip(sortby, files), key=lambda pair: pair[0])
    ]

crystalSym = 'm-3m'

symHKL = symmetrise(crystalSym, hkls)
symHKL = normalize(symHKL)

def_al = {
    'name':
    'Al',
    'composition': [
        dict(ion='Al', pos=[0, 0, 0]),
        dict(ion='Al', pos=[0.5, 0, 0.5]),
        dict(ion='Al', pos=[0.5, 0.5, 0]),
        dict(ion='Al', pos=[0, 0.5, 0.5])
    ],
    'lattice':
    dict(abc=[4.0495, 4.0495, 4.0495], abg=[90, 90, 90]),
    'debye-waller':
    False,
Beispiel #2
0
hkls = np.array(hkls)

omega = np.radians(np.arange(0, 360 + 5, 5))
""" symmetry after """

fibre_e = {}
fibre_q = {}
weights = {}
hkls = normalize(hkls)
""" search for unique hkls to save time """

hkls_loop, uni_hkls_idx, hkls_loop_idx = np.unique(hkls,
                                                   axis=0,
                                                   return_inverse=True,
                                                   return_index=True)
symHKL_loop = symmetrise(crystalSym, hkls_loop)
symHKL_loop = normalize(symHKL_loop)

symOps = genSymOps(crystalSym)
symOps = np.unique(np.swapaxes(symOps, 2, 0), axis=0)
""" only use proper rotations """
""" complicated, simplify? """

proper = np.where(np.linalg.det(symOps) == 1)  #proper orthogonal
quatSymOps = quat.from_matrix(symOps[proper])
quatSymOps = np.tile(quatSymOps[:, :, np.newaxis], (1, 1, len(omega)))
quatSymOps = quatSymOps.transpose((2, 0, 1))
""" gen quats from bunge grid """

bungeAngs = np.zeros((np.product(od.phi1cen.shape), 3))
Beispiel #3
0
    dist = 1 - np.abs(np.dot(a, b))
    
    return dist
    
def quatMetric_tensorDot(a, b):
    
    dist = 1 - np.abs(np.tensordot(a,b,axes=([-1],[1])))
    
    return dist

# %% MAIN
    
#reflections
hkls = np.array([(2,2,2), (3,1,1), (4,0,0)])
hkls = normalize(hkls)
symHKL = symmetrise('m-3m', hkls)

#od
od = bunge(np.deg2rad(5), 'm-3m', '1')

#rotation around path in space
phi = np.linspace(0,2*np.pi,73)

#y
pf_grid, alp, bet = poleFigure.genGrid(res=np.deg2rad(5),
                                    radians=True,
                                    centered=True,
                                    ret_ab=True)

#calculate pole figure y's
sph = np.array((np.ravel(alp),np.ravel(bet))).T
Beispiel #4
0
""" only use proper rotations """
""" complicated, simplify? """

symOps = genSym(crystalSym)
symOps = np.unique(np.swapaxes(symOps,2,0),axis=0)

proper = np.where( np.linalg.det(symOps) == 1 ) #proper orthogonal
quatSymOps = quat.from_matrix(symOps[proper])
quatSymOps = np.tile(quatSymOps[:,:,np.newaxis],(1,1,len(omega)))
quatSymOps = quatSymOps.transpose((2,0,1))

""" search for unique hkls to save time """

re_hkls_loop, uni_re_hkls_idx, re_hkls_loop_idx = np.unique(re_hkls,axis=0,return_inverse=True,return_index=True)
sym_reHKL_loop = symmetrise(crystalSym, re_hkls_loop)
sym_reHKL_loop = normalize(sym_reHKL_loop)

""" gen quats from bunge grid """

bungeAngs = np.zeros(( np.product(od.phi1cen.shape), 3 ))

for ii,i in enumerate(np.ndindex(od.phi1cen.shape)):
    
    bungeAngs[ii,:] = np.array((od.phi1cen[i],od.Phicen[i],od.phi2cen[i]))

qgrid = eu2quat(bungeAngs).T

""" calculate pf grid XYZ for fibre """

pf_grid, alp, bet = pf.grid(full=True, ret_ab=True)
Beispiel #5
0
rot = R.from_euler('XZY', (13, -88, 90), degrees=True).as_dcm()
pf = poleFigure(files, hkls, crystalSym, 'nd')
""" rotate """

pf.rotate(rot)

od = bunge(cellSize, crystalSym, sampleSym)
hkls = np.array(hkls)

phi = np.linspace(0, 2 * pi, 73)
""" symmetry after """

fibre_e = {}
fibre_q = {}
weights = {}
refls = symmetrise(crystalSym, hkls)
hkls = normalize(hkls)
symHKL = symmetrise(crystalSym, hkls)
""" search for unique hkls to save time """

hkls_loop, uni_hkls_idx, hkls_loop_idx = np.unique(hkls,
                                                   axis=0,
                                                   return_inverse=True,
                                                   return_index=True)
symHKL_loop = symmetrise(crystalSym, hkls_loop)
symHKL_loop = normalize(symHKL_loop)

symOps = genSymOps(crystalSym)
symOps = np.unique(np.swapaxes(symOps, 2, 0), axis=0)
""" only use proper rotations """
""" complicated, simplify? """