Exemple #1
0
def explore_orientations():
    from cemc.tools import StrainEnergy
    from matplotlib import pyplot as plt
    mu = 0.27155342515650893
    C_al = 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 = np.loadtxt("data/C_al.csv", delimiter=",")
    C_mgsi = np.loadtxt("data/C_MgSi100_225.csv", delimiter=",")
    misfit = np.array([[0.0440222, 0.00029263, 0.0008603],
                       [0.00029263, -0.0281846, 0.00029263],
                       [0.0008603, 0.00029263, 0.0440222]])

    strain_eng = StrainEnergy(poisson=mu, misfit=misfit)
    ellipsoid = {
        "aspect": [10.0, 1.0, 1.0],
        "C_prec": C_mgsi
        #"scale_factor": 0.8
    }
    res = strain_eng.explore_orientations(
        ellipsoid,
        C_al,
        step=5,
        phi_ax="z",
        fname="data/mgsi100_orientation_needle_iso.csv")
    strain_eng.plot_explore_result(res)
    plt.show()
def explore_orientations():
    from cemc.tools import StrainEnergy
    from matplotlib import pyplot as plt
    mu = 0.27155342515650893
    C_al = np.loadtxt("data/C_al.csv", delimiter=",")
    C_mgsi = np.loadtxt("data/C_beta_eye.csv", delimiter=",")
    misfit = np.array([[ 6.31232839e-02,  2.96796703e-07,  0.00000000e+00],
                       [ 2.96796703e-07,  6.31232839e-02,  0.00000000e+00],
                       [ 0.00000000e+00,  0.00000000e+00, -6.80589135e-05]])


    strain_eng = StrainEnergy(poisson=mu, misfit=misfit)
    ellipsoid = {
        "aspect": [10000.0, 1.0, 1.0],
        "C_prec": C_mgsi
        #"scale_factor": 0.8
    }
    res = strain_eng.explore_orientations(
        ellipsoid, C_al, step=5, phi_ax="z")
    strain_eng.plot_explore_result(res)
    plt.show()
    print("Bulk modulus: {} GPa".format(B))
    print("Shear modulus: {} GPa".format(G))
    print("Poisson ratio: {}".format(mu))
    print("Young's modulus {} GPa".format(E))

    eigenstrain_princ = [-0.06497269, -0.06497269, 0.09606948, 0.0, 0.0, 0.0]
    #eigenstrain_princ = [-0.06497269, -0.06497269, 0.04, 0.0, 0.0, 0.0]
    eigenstrain = [
        -0.01129197, -0.01129197, -0.01129197, 0.05368072, 0.05368072,
        0.05368072
    ]
    strain_eng = StrainEnergy(poisson=mu, eigenstrain=eigenstrain)
    ellipsoid = {"aspect": [1000.0, 1.0, 1.0], "scale_factor": 0.83}
    # strain_eng.explore_aspect_ratios(0.83, C)
    res = strain_eng.explore_orientations(ellipsoid, C, step=5)
    # opt_res = strain_eng.optimize_rotation(ellipsoid, C, res[0]["rot_seq"])
    # strain_eng.show_ellipsoid(ellipsoid, res[0]["rot_seq"])
    strain_eng.plot_explore_result(res)
    # print(opt_res)
    # fig = strain_eng.plot(0.83, C, rot_seq=res[0]["rot_seq"])
    # fig = strain_eng.plot(0.83, C, rot_seq=res[0]["rot_seq"], latex=True)
    plt.show()
elif eigenstrain:
    ref_atoms = bulk("Al")
    ref_atoms *= (2, 2, 2)
    ref_cell = ref_atoms.get_cell().T
    strained_cell = atoms.get_cell().T
    princ_strain = ElasticConstants.get_strain(ref_cell,
                                               strained_cell,
                                               principal=False)