Esempio n. 1
0
def orthogonal():
    """
    Returns orthogonal symmetry operators

    (100)_sa mirroring  - RD
    (010)_sa mirroring  - TD


    RD = [[ 1.,  0.,  0.],
          [ 0., -1.,  0.],
          [ 0.,  0.,  1.]]
    TD = [[-1.,  0.,  0.],
          [ 0.,  1.,  0.],
          [ 0.,  0.,  1.]]

    v`[sa] = RD[sa,sa] * v[sa]
    """
    from cs import reflect, vector_ang

    import numpy as np
    rxz = reflect(th=0)  # rxz xz-plane reflection, v`<- [rxz]v
    r = vector_ang(u=[0, 0, 1], th=90)

    # matrix that rotates about z-axis by 90degree
    ryz = np.zeros((3, 3))
    for i in range(3):
        for j in range(3):
            ryz[i, j] = 0.
            for k in range(3):
                for l in range(3):
                    ryz[i, j] = ryz[i, j] + r[k, i] * rxz[k, l] * r[l, j]

    RD = rxz
    TD = ryz
    return RD, TD
Esempio n. 2
0
def orthogonal():
    """
    Returns orthogonal symmetry operators

    (100)_sa mirroring  - RD
    (010)_sa mirroring  - TD


    RD = [[ 1.,  0.,  0.],
          [ 0., -1.,  0.],
          [ 0.,  0.,  1.]]
    TD = [[-1.,  0.,  0.],
          [ 0.,  1.,  0.],
          [ 0.,  0.,  1.]]

    v`[sa] = RD[sa,sa] * v[sa]
    """
    from cs import reflect, vector_ang

    import numpy as np
    rxz = reflect(th = 0) # rxz xz-plane reflection, v`<- [rxz]v
    r = vector_ang(u=[0,0,1], th=90)

    # matrix that rotates about z-axis by 90degree
    ryz = np.zeros((3,3))
    for i in range(3):
        for j in range(3):
            ryz[i,j] = 0.
            for k in range(3):
                for l in range(3):
                    ryz[i,j] = ryz[i,j] + r[k,i] * rxz[k,l] * r[l,j]

    RD = rxz
    TD = ryz
    return RD, TD
Esempio n. 3
0
 def rot_vectang(self, th, r):
     """ Rotate the given rotation matrix r [ca<-sa] by a 
     random axis with th degree.
     """
     from cs import vector_ang
     import numpy as np
     delta, phi = self.rot_axis()
     v = self.polar2vect(delta, phi)
     rot = vector_ang(u=v, th=th)
     newr = np.dot(rot, r)
     return newr
Esempio n. 4
0
 def rot_vectang(self, th, r):
     """ Rotate the given rotation matrix r [ca<-sa] by a 
     random axis with th degree.
     """
     from cs import vector_ang
     import numpy as np
     delta, phi = self.rot_axis()
     v = self.polar2vect(delta, phi)
     rot = vector_ang(u=v, th=th)
     newr = np.dot(rot, r)
     return newr