Ejemplo n.º 1
0
def calc_anisotropy(U):
    """Calculates the anisotropy of a atomic ADP tensor U.  Anisotropy is
    defined as the smallest eigenvalue of U divided by the largest eigenvalue
    of U.
    """
    evals = linalg.eigenvalues(U)
    return min(evals) / max(evals)
Ejemplo n.º 2
0
    def eigenvalues(self):
        "Returns the eigenvalues of a rank-2 tensor in an array."
	if self.rank == 2:
	    from numpy.oldnumeric.linear_algebra import eigenvalues
	    return eigenvalues(self.array)
	else:
	    raise ValueError, 'Undefined operation'
Ejemplo n.º 3
0
def calc_anisotropy(U):
    """Calculates the anisotropy of a atomic ADP tensor U.  Anisotropy is
    defined as the smallest eigenvalue of U divided by the largest eigenvalue
    of U.
    """
    evals = linalg.eigenvalues(U)
    return min(evals) / max(evals)
Ejemplo n.º 4
0
    def glr_Uellipse(self, position, U, prob):
        """Renders the ellipsoid enclosing the given fractional probability
        given the gaussian variance-covariance matrix U at the given position.
        C=1.8724 = 68%
        """
        ## rotate U
        R = self.matrix[:3, :3]
        Ur = numpy.dot(numpy.dot(R, U), numpy.transpose(R))

        Umax = max(linalg.eigenvalues(Ur))
        try:
            limit_radius = Gaussian.GAUSS3C[prob] * MARGIN * math.sqrt(Umax)
        except ValueError:
            limit_radius = 2.0

        try:
            Q = linalg.inverse(Ur)
        except linalg.LinAlgError:
            return

        self.object_list.append(
            (
                14,
                dot43(self.matrix, position),
                limit_radius,
                self.material_color_r,
                self.material_color_g,
                self.material_color_b,
                Q,
                -Gaussian.GAUSS3C[prob] ** 2,
            )
        )
    def glr_Uellipse(self, position, U, prob):
        """Renders the ellipsoid enclosing the given fractional probability
        given the gaussian variance-covariance matrix U at the given position.
        C=1.8724 = 68%
        """
        ## rotate U
        R  = self.matrix[:3,:3]
        Ur = numpy.matrixmultiply(numpy.matrixmultiply(R, U), numpy.transpose(R))

        Umax = max(linalg.eigenvalues(Ur))
        try:
            limit_radius = Gaussian.GAUSS3C[prob] * MARGIN * math.sqrt(Umax)
        except ValueError:
            limit_radius = 2.0

        try:
            Q = linalg.inverse(Ur)
        except linalg.LinAlgError:
            return
        
        self.object_list.append(
            (14,
             matrixmultiply43(self.matrix, position),
             limit_radius,
             self.material_color_r,
             self.material_color_g,
             self.material_color_b,
             Q,
             -Gaussian.GAUSS3C[prob]**2))
Ejemplo n.º 6
0
    H[5,3] = v_xy*g3s
    H[3,5] = v_xy*g3
    H[6,3] = v_xx*g0s
    H[3,6] = v_xx*g0
    H[7,3] = v_xy*g1s
    H[3,7] = v_xy*g1

    H[5,4] = v_xy*g2s
    H[4,5] = v_xy*g2
    H[6,4] = v_xy*g1s
    H[4,6] = v_xy*g1
    H[7,4] = v_xx*g0s
    H[4,7] = v_xx*g0

    enarray = eigenvalues(H)
    enarray = sort_eigenvalues(enarray)
    for en in enarray:
        gfile.write("%13.8f" % en)
    gfile.write("\n")

gfile.close()

label_y = 0.05
L_x = 0
gamma_x = n
X_x = 2*n
K_x = 2*n+1
gamma2_x = 3*n+1

pfile = open('chadicohen.gnu','w')