Exemplo n.º 1
0
 def test_ubi2rod(self):
     phi1 = 0.13
     PHI = 0.4
     phi2 = 0.21
     cell = [3, 4, 5, 80, 95, 100]
     Umat = tools.euler_to_u(phi1, PHI, phi2)
     ubi = n.linalg.inv(n.dot(Umat, tools.form_b_mat(cell))) * 2 * n.pi
     rodubi = tools.ubi_to_rod(ubi)
     rodU = tools.u_to_rod(Umat)
     diff = n.abs(rodubi - rodU).sum()
     self.assertAlmostEqual(diff, 0, 9)
Exemplo n.º 2
0
def ubitoRod(ubi):
    """
    TODO Testcases!!!
    """
    #     u = ubitoU(ubi)
    #     w, v = np.linalg.eig(u)
    #     print 'Eigenvalues'
    #     print w
    #     print 'Eigen vectors'
    #     print v
    #     #ehat = v[:,0]
    #     #angle = -1*math.acos(np.clip(w[order[1]].real,-1,1))
    #     order = np.argsort(w.real)
    #     print order
    #     ehat = v[:, order[-1]]
    #     if order.tolist() != range(3):
    #         print 'HHFH'
    #         angle = -1*np.arccos(w[order[1]].real)
    #     else:
    #         angle = np.arccos(w[order[1]].real)
    #     Rod = ehat * math.tan(angle/2)
    #     return Rod.real
    return ubi_to_rod(ubi)