Exemplo n.º 1
0
    def Reorient(self, hkl1, pos1, hkl2, pos2):
        """Calculate orientation matrix from two indexed positions.

        hkl1: index of reflection 1
        pos1: position of reflection 1 (goniometer.position object)
        hkl2: index of reflection 2
        pos2: position of reflection 2
        """
        gmat = self.cell.CMatrix()
        cv_h1 = self.cell.CVector(hkl1)
        cv_h2 = self.cell.CVector(hkl2)

        cv_p1 = np.array(pos1.asC().c)
        cv_p2 = np.array(pos2.asC().c)

        bmat = _norm(complete_matrix(cv_p1, cv_p2))
        amat = _norm(complete_matrix(cv_h1, cv_h2))

        amat_i = np.linalg.inv(amat)
        temp = np.dot(bmat, amat_i)
        omat_t = np.dot(temp, gmat)
        omat = np.transpose(omat_t)
        cell = SXTalCell(omat)
        return cell
Exemplo n.º 2
0
 def get_new_cell(p):
     # reconstruct UB matrix
     Umat = Zrot(-p.phi).dot(Yrot(-p.theta)).dot(Xrot(-p.psi))
     Bmat = matrixfromcell(p.a, p.b, p.c, p.alpha, p.beta, p.gamma)
     return SXTalCell(Umat.dot(Bmat).T)