Ejemplo n.º 1
0
    def aniso_211(self):
        c = tool_elastic_constants.elastic_constants(C11=self.pot['c11'],
                                                     C12=self.pot['c12'],
                                                     C44=self.pot['c44'])

        e1 = [1, 0, 0]
        e2 = [0, 1, -1]
        e3 = [0, 1, 1]

        # axes = np.array([e2, e1, e3])
        axes = np.array([e1, e2, e3])

        burgers = self.pot["lattice"] / 2. * np.array([1., 1., -1.])
        burgers = axes_check.axes_check(axes).dot(burgers)
        stroh = stroh_solve.Stroh(c, burgers, axes=axes)

        A = np.mat(np.zeros([3, 3]), dtype='complex')
        A[:, 0] = np.mat(stroh.A[0]).transpose()
        A[:, 1] = np.mat(stroh.A[2]).transpose()
        A[:, 2] = np.mat(stroh.A[4]).transpose()

        B = np.mat(np.zeros([3, 3]), dtype='complex')
        B[:, 0] = np.mat(stroh.L[0]).transpose()
        B[:, 1] = np.mat(stroh.L[2]).transpose()
        B[:, 2] = np.mat(stroh.L[4]).transpose()

        Linv = np.real(np.complex(0, 1) * A * np.linalg.inv(B))
        Gamma = 0.5 * Linv

        self.ckcoeff.K1 = sqrt(2 * self.pot["surf110"] /
                               abs(Gamma[1, 1] * 1e3))

        # theta = np.deg2rad(54.735610317245346)
        theta = np.deg2rad(35.2643896828)
        omega = np.mat([[cos(theta), sin(theta), 0.0],
                        [-sin(theta), cos(theta), 0.0], [0.0, 0.0, 1.0]])
        Gamma = omega * Gamma * omega.transpose()  #
        Gamma = np.abs(np.linalg.inv(Gamma))
        Gamma = Gamma * 1e9  # Pa
        print(self.ckcoeff.K1)

        if axes is not None:
            burgers = axes_check.axes_check(axes).dot(burgers)
            c = c.transform(axes)

        G00 = Gamma[0, 0]
        usf = 0.57405172613
        k1e = np.sqrt(G00 * usf) * 1e-6
        print(Gamma)
        print(self.ckcoeff.K1, k1e)

        self.set_plane_strain_bij(c.Sij)
        # self.get_scalarB(self.pot["surf110"]) get the same k1c

        self.get_coeffs()
        atoms = self.intro_crack_k1(atoms=self.gn_perf_plate())
        self.write_lmp_config_data(atoms, 'crack.txt')
Ejemplo n.º 2
0
 def bcc_screw_dipole_alongz_atoms(self, atoms, c1, c2):
     c = tool_elastic_constants.elastic_constants(C11=self.pot['c11'],
                                                  C12=self.pot['c12'],
                                                  C44=self.pot['c44'])
     burgers = self.pot['lattice'] / 2 * np.array([1., 1., 1.])
     stroh = stroh_solve.Stroh(c, burgers, axes=axes)
     pos = atoms.get_positions()
     atoms = self.bcc_screw_dipole_tools(stroh, pos, atoms, c1, 1)
     atoms = self.bcc_screw_dipole_tools(stroh, pos, atoms, c2, -1)
     return atoms
Ejemplo n.º 3
0
    def get_bcc_w_result211(self, param):
        c = tool_elastic_constants.elastic_constants(C11=param['c11'],
                                                     C12=param['c12'],
                                                     C44=param['c44'])
        e1 = [1, 0, 0]
        e2 = [0, 1, -1]
        e3 = [0, 1, 1]
        # glide plane [2, 1, -1]
        axes = np.array([e1, e2, e3])

        # x [1, 0, 0], y[0, 1, -1], z[0, 1, 1]
        burgers = param['lat'] / 2. * np.array([1., 1., -1.])

        stroh = stroh_solve.Stroh(c, burgers, axes=axes)
        A = np.mat(np.zeros([3, 3]), dtype='complex')
        A[:, 0] = np.mat(stroh.A[0]).transpose()
        A[:, 1] = np.mat(stroh.A[2]).transpose()
        A[:, 2] = np.mat(stroh.A[4]).transpose()

        B = np.mat(np.zeros([3, 3]), dtype='complex')
        B[:, 0] = np.mat(stroh.L[0]).transpose()
        B[:, 1] = np.mat(stroh.L[2]).transpose()
        B[:, 2] = np.mat(stroh.L[4]).transpose()

        Linv = np.real(np.complex(0, 1) * A * np.linalg.inv(B))
        Gamma = 0.5 * Linv
        surf = param['surf']
        k1c = sqrt(2 * surf / abs(Gamma[1, 1] * 1e3))

        theta = np.deg2rad(54.735610317245346)
        omega = np.mat([[cos(theta), sin(theta), 0.0],
                        [-sin(theta), cos(theta), 0.0], [0.0, 0.0, 1.0]])
        Gamma = omega * Gamma * omega.transpose()
        Gamma = np.abs(np.linalg.inv(Gamma))
        Gamma = Gamma * 1e9  # Pa

        # K1c
        # G11 = Gamma[1, 1]
        # k1c = sqrt(2 * surf / G11) * 1e6

        # Ke
        if axes is not None:
            T = axes_check.axes_check(axes)
            burgers = T.dot(burgers)
            c = c.transform(axes)

        (coeff, Kg) = self.cal_crack(param, c, theta=theta)
        print(Kg)
        usf = param['ugsf1']  # J/m^2

        G00 = Gamma[0, 0]
        k1e = np.sqrt(G00 * usf) * 1e-6
        k1e = k1e / coeff
        print(k1e, k1c, Kg, k1e / k1c)
        return (k1e, k1c, k1e / k1c)
Ejemplo n.º 4
0
    def get_cutin_result_mat_k2e(self, param):
        c = tool_elastic_constants.elastic_constants(C11=param['c11'],
                                                     C12=param['c12'],
                                                     C44=param['c44'])
        # A
        axes = np.array([[1, 1, 2], [1, 1, -1], [-1, 1, 0]])
        burgers = param['lat'] / np.sqrt(6.) * np.array([1., 1., 2.])

        stroh = stroh_solve.Stroh(c, burgers, axes=axes)
        A = np.mat(np.zeros([3, 3]), dtype='complex')
        A[:, 0] = np.mat(stroh.A[0]).transpose()
        A[:, 1] = np.mat(stroh.A[2]).transpose()
        A[:, 2] = np.mat(stroh.A[4]).transpose()

        B = np.mat(np.zeros([3, 3]), dtype='complex')
        B[:, 0] = np.mat(stroh.L[0]).transpose()
        B[:, 1] = np.mat(stroh.L[2]).transpose()
        B[:, 2] = np.mat(stroh.L[4]).transpose()

        # print A * B.transpose() + B * A.transpose()
        Linv = np.real(np.complex(0, 1) * A * np.linalg.inv(B))
        Gamma = 0.5 * Linv

        theta = np.deg2rad(0.0)
        omega = np.mat([[cos(theta), sin(theta), 0.0],
                        [-sin(theta), cos(theta), 0.0], [0.0, 0.0, 1.0]])
        Gamma = np.abs(omega * Gamma * omega)

        # phi = 0
        # svect = np.mat(np.array([cos(phi), 0.0, sin(phi)]))
        Gamma = np.linalg.inv(Gamma)
        Gamma00 = Gamma[0, 0]  # in GPa
        Gamma11 = Gamma[1, 1]
        Gamma00 *= 1e9
        Gamma11 *= 1e9

        # cal F(theta)
        soltrace = np.mat([[stroh.p[0], 0.0, 0.0], [0.0, stroh.p[2], 0.0],
                           [0.0, 0.0, stroh.p[4]]],
                          dtype='complex')

        Fmat1 = soltrace / np.sqrt(np.cos(theta) + soltrace * np.sin(theta))
        Fmat1 = np.real(B * Fmat1 * np.linalg.inv(B))

        Fmat2 = 1.0 / np.sqrt(np.cos(theta) + soltrace * np.sin(theta))
        Fmat2 = np.real(B * Fmat2 * np.linalg.inv(B))

        print(Fmat1[0, 1])
        # print Gamma
        k2e = np.sqrt(Gamma00 * param['ugsf']) * 1e-6  # Mpa
        print('k2e', k2e / abs(Fmat1[0, 1]))
Ejemplo n.º 5
0
    def get_cutin_result(self, param):
        c = tool_elastic_constants.elastic_constants(C11=param['c11'],
                                                     C12=param['c12'],
                                                     C44=param['c44'])

        # A
        axes = np.array([[-1, -1, 2], [1, 1, 1], [-1, 1, 0]])
        burgers = param['lat'] * np.sqrt(2.) / 2. * np.array([-1., 1., 0])

        stroh = stroh_solve.Stroh(c, burgers, axes=axes)
        A = np.mat(np.zeros([3, 3]), dtype='complex')
        A[:, 0] = np.mat(stroh.A[0]).transpose()
        A[:, 1] = np.mat(stroh.A[2]).transpose()
        A[:, 2] = np.mat(stroh.A[4]).transpose()

        B = np.mat(np.zeros([3, 3]), dtype='complex')
        B[:, 0] = np.mat(stroh.L[0]).transpose()
        B[:, 1] = np.mat(stroh.L[2]).transpose()
        B[:, 2] = np.mat(stroh.L[4]).transpose()

        Linv = np.real(np.complex(0, 1) * A * np.linalg.inv(B))
        Gamma = 0.5 * Linv

        # theta = self.theta
        # omega = np.mat([[cos(theta), sin(theta), 0.0],
        #                 [-sin(theta), cos(theta), 0.0],
        #                 [0.0, 0.0, 1.0]])

        phi = 0
        svect = np.mat(np.array([cos(phi), 0.0, sin(phi)]))
        usf = param['ugsf']  # J/m^2

        Gamma = np.abs(np.linalg.inv(Gamma))
        # Gamma = omega * Gamma * omega
        Gamma = Gamma  # Pa

        Gamma00 = (svect * Gamma * svect.transpose())[0, 0]  # in GPa
        Gamma11 = Gamma[1, 1]

        Gamma00 *= 1e9
        Gamma11 *= 1e9

        # print Gamma
        k2e = np.sqrt(Gamma00 * usf) * 1e-6  # Mpa
        coeff, tmp = self.cal_crack(param)

        k1e = k2e / coeff
        print('Gamma', Gamma00, Gamma11)
        print('k1e, k2e', k1e, k2e)
        return
Ejemplo n.º 6
0
    def get_bcc_w_result(self, param):
        c = tool_elastic_constants.elastic_constants(C11=param['c11'],
                                                     C12=param['c12'],
                                                     C44=param['c44'])
        # axes = np.array([[0, 1, 1],
        #                  [2, 1, -1],
        #                  [-1., 1., -1.]])
        e1 = [1, 0, 0]
        e2 = [0, 1, -1]
        e3 = [0, 1, 1]

        # glide plane [2, 1, -1]
        axes = np.array([e1, e2, e3])

        # x [1, 0, 0], y[0, 1, -1], z[0, 1, 1]
        burgers = param['lat'] / 2. * np.array([-1., 1., -1.])
        stroh = stroh_solve.Stroh(c, burgers, axes=axes)
        A = np.mat(np.zeros([3, 3]), dtype='complex')
        A[:, 0] = np.mat(stroh.A[0]).transpose()
        A[:, 1] = np.mat(stroh.A[2]).transpose()
        A[:, 2] = np.mat(stroh.A[4]).transpose()

        B = np.mat(np.zeros([3, 3]), dtype='complex')
        B[:, 0] = np.mat(stroh.L[0]).transpose()
        B[:, 1] = np.mat(stroh.L[2]).transpose()
        B[:, 2] = np.mat(stroh.L[4]).transpose()

        Linv = np.real(np.complex(0, 1) * A * np.linalg.inv(B))
        Gamma = 0.5 * Linv

        Gamma = np.abs(np.linalg.inv(Gamma))
        Gamma = Gamma * 1e9  # Pa

        # K1c
        G11 = Gamma[1, 1]
        surf = param['surf']
        k1c = sqrt(2 * surf / G11) * 1e6

        # Ke
        # phi = 0
        usf = param['ugsf1']  # J/m^2

        # svect = np.mat(np.array([cos(phi), 0.0, sin(phi)]))
        # Gamma = (svect * Gamma * svect.transpose())[0, 0]  # in GPa
        G00 = Gamma[0, 0]
        k2e = np.sqrt(G00 * usf) * 1e-6
        coeff, tmp = self.cal_crack(param)
        k1e = k2e / coeff
        print(k1e, k2e, k1c, tmp)
        return (k1e, k2e, k1c)
Ejemplo n.º 7
0
    def bcc_screw_dipole_alongz_with_image(self, atoms, center):
        # x direction  +10.5 unitx,  +21
        #              -10.5 unitx,  -21
        # y direction  +(11 + 1./3.) unity  + 22
        #              -(11 - 1./3.) unity  - 22

        c = tool_elastic_constants.elastic_constants(C11=self.pot['c11'],
                                                     C12=self.pot['c12'],
                                                     C44=self.pot['c44'])
        burgers = self.pot['lattice'] / 2 * np.array([1., 1., 1.])

        stroh = stroh_solve.Stroh(c, burgers, axes=axes)

        px = 10.5
        py = 11

        # ydisp = [4 * py, 3 * py + 1. / 3., 2 * py, py + 1. / 3.,
        #          0., -py + 1. / 3., -2 * py, -3 * py + 1. / 3., -4 * py]
        # xdisp = [-4 * px, -3 * px, -2 * px, -1 *
        #          px, 0.0, px, 2 * px, 3 * px, 4 * px]

        ydisp = [2 * py, py + 1. / 3., 0., -py + 1. / 3., -2 * py]
        xdisp = [-2 * px, -1 * px, 0.0, px, 2 * px]

        pos = atoms.get_positions()

        ux = np.sqrt(6) / 3. * self.pot['lattice']
        uy = np.sqrt(2) / 2. * self.pot['lattice']

        sign = 1.0
        for dy in ydisp:
            for dx in xdisp:
                ctmp = np.array([center[0] + dx * ux, center[1] + dy * uy])
                atoms = self.bcc_screw_dipole_tools(stroh, pos, atoms, ctmp,
                                                    sign)
                sign *= -1
        atoms.wrap(pbc=[1, 1, 1])
        return atoms
Ejemplo n.º 8
0
    def print_dis_constants(self):
        struct = "hex"
        if struct in ["cubic"]:
            # Cubic
            c = tool_elastic_constants.elastic_constants(C11=self.pot['c11'],
                                                         C12=self.pot['c12'],
                                                         C44=self.pot['c44'])
            axes = np.array([[1, -1, 1], [2, 1, -1], [0, 1, 1]])
            burgers = self.pot['lattice'] / 2 * np.array([1., 1., 1.])
            stroh = stroh_solve.Stroh(c, burgers, axes=axes)
            print(stroh.A[0])

        # hexagonal
        if struct in ["hex"]:
            print(self.pot["lattice"])
            axes = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])

        burgers = self.pot['lattice'] / 2 * np.array([1., 1, 0])
        c = am.ElasticConstants()
        c.hexagonal(C11=326.08, C33=357.50, C12=129.56, C13=119.48, C44=92.54)
        stroh = stroh_solve.Stroh(c, burgers, axes=axes)
        print(stroh.A)
        print(stroh.L)
Ejemplo n.º 9
0
    def bcc_screw_dipole_configs_alongz(self, sizen=1):
        c = tool_elastic_constants.elastic_constants(C11=self.pot['c11'],
                                                     C12=self.pot['c12'],
                                                     C44=self.pot['c44'])
        burgers = self.pot['lattice'] / 2 * np.array([1., 1., 1.])
        stroh = stroh_solve.Stroh(c, burgers, axes=axes)

        atoms = self.set_dipole_box()
        atoms_perf = atoms.copy()
        pos = atoms.get_positions()

        ux = sqrt(6) / 3. * self.pot['lattice']
        uy = sqrt(2) / 2. * self.pot['lattice']
        uz = sqrt(3) / 2. * self.pot['lattice']

        sx = 10.0 * sizen
        sy = 5 * sizen
        ix = 10.5 * sizen

        # c1 = 1. / 3. * np.sum(self.pot['core1'], axis=0)
        # c2 = 1. / 3. * np.sum(self.pot['core2'], axis=0)
        # shiftc1 = \
        # np.ones(np.shape(pos)) * np.array([c1[0, 0], c1[0, 1], 0.0])
        # shiftc2 = \
        # np.ones(np.shape(pos)) * np.array([c2[0, 0], c2[0, 1], 0.0])

        opt = 'original'
        if opt in ['split']:
            c1 = self.pot['posleft'] + \
                np.array([0.0, 0.21 * self.pot['yunit']])
            c2 = self.pot['posrigh'] + \
                np.array([0.0, -0.21 * self.pot['yunit']])
        elif opt in ['move']:
            c1 = [(sx + 0.5) * ux, (sy + 1. / 3. - 0.95 * 1. / 3.) * uy]
            c2 = [(sx + ix + 0.5) * ux, (sy + 2. / 3. + 0.95 * 1. / 3.) * uy]
        else:
            c1 = [(sx) * ux, (sy + 1. / 3.) * uy]
            c2 = [(sx + ix) * ux, (sy + 2. / 3.) * uy]

        shiftc1 = np.ones(np.shape(pos)) * np.array([c1[0], c1[1], 0.0])
        shiftc2 = np.ones(np.shape(pos)) * np.array([c2[0], c2[1], 0.0])

        disp1 = stroh.displacement(pos - shiftc1)
        disp2 = stroh.displacement(pos - shiftc2)

        if opt in ['pull']:
            radius = 2.0  # find the atoms near the center
            for ps, dp in zip(pos, disp1):
                dis = np.linalg.norm(ps[:2] - c1)
                if (dis < radius):
                    dp[2] += 1. / 6. * uz
                    # add shirt
            for ps, dp in zip(pos, disp2):
                dis = np.linalg.norm(ps[:2] - c2)
                if (dis < radius):
                    dp[2] -= 1. / 6. * uz

        atoms.set_positions(pos + np.real(disp1) - np.real(disp2))

        # periodic boundary conditions ???
        # c2l = [(sx - ix + 0.5) * ux, (sy + 2. / 3. + 0.95 * 1. / 3.) * uy]
        # shft = np.ones(np.shape(pos)) * np.array([c2l[0], c2l[1], 0.0])
        # disp3 = stroh.displacement(pos - shft)
        # atoms.set_positions(atoms.get_positions() - np.real(disp3))

        atoms.wrap(pbc=[1, 1, 1])
        ase.io.write("perf_poscar", atoms_perf, format='vasp')
        ase.io.write('POSCAR', atoms, format='vasp')
        return (atoms, atoms_perf)
Ejemplo n.º 10
0
    def get_cutin_result_mat_k1e(self, param):
        c = tool_elastic_constants.elastic_constants(C11=param['c11'],
                                                     C12=param['c12'],
                                                     C44=param['c44'])

        axes = np.array([[-1, -1, 2], [1, 1, 1], [-1, 1, 0]])
        burgers = param['lat'] / np.sqrt(6.) * np.array([-1., -1., 2.])

        stroh = stroh_solve.Stroh(c, burgers, axes=axes)

        A = np.mat(np.zeros([3, 3]), dtype='complex')
        A[:, 0] = np.mat(stroh.A[0]).transpose()
        A[:, 1] = np.mat(stroh.A[2]).transpose()
        A[:, 2] = np.mat(stroh.A[4]).transpose()

        B = np.mat(np.zeros([3, 3]), dtype='complex')
        B[:, 0] = np.mat(stroh.L[0]).transpose()
        B[:, 1] = np.mat(stroh.L[2]).transpose()
        B[:, 2] = np.mat(stroh.L[4]).transpose()

        Linv = np.real(np.complex(0, 1) * A * np.linalg.inv(B))
        Gamma = 0.5 * Linv

        v1 = np.array([-1, -1, 2])
        v2 = np.array([1, 1, 2])
        theta = (np.arccos(
            np.dot(v1, v2) / (np.linalg.norm(v1) * np.linalg.norm(v2))))
        omega = np.mat([[cos(theta), sin(theta), 0.0],
                        [-sin(theta), cos(theta), 0.0], [0.0, 0.0, 1.0]])
        Gamma = omega * Gamma * omega.transpose()
        # phi = 0
        # svect = np.mat(np.array([cos(phi), 0.0, sin(phi)]))
        Gamma = np.linalg.inv(Gamma)
        Gamma = np.abs(Gamma)

        Gamma00 = Gamma[0, 0]  # in GPa
        Gamma11 = Gamma[1, 1]

        Gamma00 *= 1e9
        Gamma11 *= 1e9

        if axes is not None:
            T = axes_check.axes_check(axes)
            burgers = T.dot(burgers)
            c = c.transform(axes)

        (coeff, Kg) = self.cal_crack(param, c, theta)
        # print((cos(0.5 * theta))**2 * sin(0.5 * theta))

        # cal F(theta)
        soltrace = np.mat([[stroh.p[0], 0.0, 0.0], [0.0, stroh.p[2], 0.0],
                           [0.0, 0.0, stroh.p[4]]],
                          dtype='complex')

        Fmat1 = soltrace / np.sqrt(np.cos(theta) + soltrace * np.sin(theta))
        Fmat1 = np.real(B * Fmat1 * np.linalg.inv(B))

        Fmat2 = 1.0 / np.sqrt(np.cos(theta) + soltrace * np.sin(theta))
        Fmat2 = np.real(B * Fmat2 * np.linalg.inv(B))

        # print(((Fmat1 + Fmat2) * Gamma) * 1e-3 * param["ugsf"])
        k1e = sqrt(Gamma00 * param['ugsf']) * 1e-6  # Mpa
        print('k1e', k1e)
        print('k1e / coeff', k1e / coeff)