Exemplo n.º 1
0
def diamond_110_001(el, a0, n, crack_surface=[1,1,0], crack_front=[0,0,1],
            skin_x=1.0, skin_y=1.0, vac=5.0):
    nx, ny, nz = n
    third_dir = np.cross(crack_surface, crack_front)
    directions = [ third_dir, crack_surface, crack_front ]
    if np.linalg.det(directions) < 0:
        third_dir = -third_dir
    directions = [ third_dir, crack_surface, crack_front ]
    a = Diamond(el, latticeconstant = a0, size = [ nx,ny,nz ], 
                directions = directions)
    sx, sy, sz = a.get_cell().diagonal()
    a.translate([a0/100,a0/100,a0/100])
    a.set_scaled_positions(a.get_scaled_positions())
    a.center()

    lx  = skin_x*sx/nx
    ly  = skin_y*sy/ny
    r   = a.get_positions()
    g   = np.where(
        np.logical_or(
            np.logical_or(
                np.logical_or(
                    r[:, 0] < lx, r[:, 0] > sx-lx),
                r[:, 1] < ly),
            r[:, 1] > sy-ly),
        np.zeros(len(a), dtype=int),
        np.ones(len(a), dtype=int))
    a.set_array('groups', g)

    a.set_cell([sx+2*vac, sy+2*vac, sz])
    a.translate([vac, vac, 0.0])
    a.set_pbc([False, False, True])

    return a
Exemplo n.º 2
0
def diamond_110_110(el, a0, n, crack_surface=[1,1,0],
                    crack_front=[1,-1,0],
                    skin_x=0.5, skin_y=1.0,
                    central_x=-1.0, central_y=-1.0,
                    vac=5.0):
    nx, ny, nz = n
    third_dir = np.cross(crack_surface, crack_front)
    a = Diamond(el,
            latticeconstant = a0,
            size = [nx, ny, nz], 
            directions = [third_dir, crack_surface, crack_front]
            )
    sx, sy, sz = a.get_cell().diagonal()
    a.translate([sx/(8*nx), sy/(4*ny), sz/(4*nz)])
    a.set_scaled_positions(a.get_scaled_positions())

    skin_x = skin_x*sx/nx
    skin_y = skin_y*sy/ny
    r = a.get_positions()
    g = np.where(
        np.logical_or(
            np.logical_or(
                np.logical_or(
                    r[:, 0] < skin_x, r[:, 0] > sx-skin_x),
                r[:, 1] < skin_y),
            r[:, 1] > sy-skin_y),
        np.zeros(len(a), dtype=int),
        np.ones(len(a), dtype=int))

    g = np.where(
        np.logical_or(
            np.logical_or(
                np.logical_or(
                    r[:, 0] < sx/2-central_x, r[:, 0] > sx/2+central_x),
                r[:, 1] < sy/2-central_y),
            r[:, 1] > sy/2+central_y),
        g,
        2*np.ones(len(a), dtype=int))
    a.set_array('groups', g)

    a.set_cell([sx+2*vac, sy+2*vac, sz])
    a.translate([vac, vac, 0.0])
    a.set_pbc([False, False, True])

    return a