Ejemplo n.º 1
0
def add_strain(chgl):
    global khac1, khac2, khac3

    C_al = np.array([[0.62639459, 0.41086487, 0.41086487, 0, 0, 0],
                     [0.41086487, 0.62639459, 0.41086487, 0, 0, 0],
                     [0.41086487, 0.41086487, 0.62639459, 0, 0, 0],
                     [0, 0, 0, 0.42750351, 0, 0], [0, 0, 0, 0, 0.42750351, 0],
                     [0, 0, 0, 0, 0, 0.42750351]])

    C_al *= 1000.0  # Convert to MeV!
    C_al = to_full_rank4(C_al)
    # Misfit strain in 3D
    misfit = np.array([[0.0440222, 0.00029263, 0.0008603],
                       [0.00029263, -0.0281846, 0.00029263],
                       [0.0008603, 0.00029263, 0.0440222]])

    misfit1 = misfit = np.array([[0.0440222, 0.00029263, 0.0],
                                 [0.00029263, -0.0281846, 0.0],
                                 [0.0, 0.0, 0.0440222]])

    misfit2 = np.array([[-0.0281846, 0.00029263, 0.0],
                        [0.00029263, 0.0440222, 0.0], [0.0, 0.0, 0.0440222]])

    misfit3 = np.array([[0.0440222, 0.00029263, 0.0],
                        [0.00029263, 0.0440222, 0.0], [0.0, 0.0, -0.0281846]])

    khac1 = PyKhachaturyan(3, C_al, misfit1)
    khac2 = PyKhachaturyan(3, C_al, misfit2)
    khac3 = PyKhachaturyan(3, C_al, misfit3)

    chgl.add_strain_model(khac1, 1)
    chgl.add_strain_model(khac2, 2)
    chgl.add_strain_model(khac3, 3)
Ejemplo n.º 2
0
    def test_mandel_transformation(self):
        if not available:
            self.skipTest(reason)
        mandel_vec = np.linspace(1.0, 6.0, 6)
        mandel_full = to_full_tensor(mandel_vec)
        self.assertTrue(np.allclose(to_mandel(mandel_full), mandel_vec))

        # Try rank for tensors
        mandel_tensor = np.random.rand(6, 6)
        mandel_full = to_full_rank4(mandel_tensor)
        self.assertTrue(
            np.allclose(to_mandel_rank4(mandel_full), mandel_tensor))
Ejemplo n.º 3
0
    def __init__(self,
                 elastic_tensor=None,
                 uniform_strain=None,
                 misfit_strain=None):
        self.C = to_full_rank4(elastic_tensor)
        self.uniform_strain = uniform_strain
        if self.uniform_strain is None:
            self.uniform_strain = np.zeros((3, 3))

        if misfit_strain is None:
            raise ValueError("Misfit strain has to be a 3x3 numpy array!")
        self.misfit_strain = misfit_strain