Exemple #1
0
def test_gb_2d_csl():
    """
    Test the two-dimensional boundary plane basis in bp_basis function
    """
    Mat = np.zeros(6, dtype=[('t_g1tog2_go1',
                              '(3,3)float64'), ('bp1_go1', '(3,1)float64')])
    Mat['bp1_go1'][0] = np.array([[0.5], [0.], [-0.5]])
    Mat['bp1_go1'][1] = np.array([[1.5], [-0.5], [-1.0]])
    Mat['bp1_go1'][2] = np.array([[11.], [-4.0], [-4.0]])
    Mat['bp1_go1'][3] = np.array([[12.5], [0.5], [-1.0]])
    Mat['bp1_go1'][4] = np.array([[3.5], [2.0], [0.5]])
    Mat['bp1_go1'][5] = np.array([[3.], [-0.5], [-0.5]])
    Mat['t_g1tog2_go1'][0] = np.array([[2./3, -1./3, 2./3],
                                       [2./3, 2./3, -1./3],
                                       [-1./3, 2./3, 2./3]])
    Mat['t_g1tog2_go1'][1] = np.array([[2./3, -1./3, 2./3],
                                       [2./3, 2./3, -1./3],
                                       [-1./3, 2./3, 2./3]])
    Mat['t_g1tog2_go1'][2] = np.array([[1./3, 2./3, 2./3],
                                       [-2./3, 2./3, -1./3],
                                       [-2./3, -1./3, 2./3]])
    Mat['t_g1tog2_go1'][3] = np.array([[-2./3, -1./3, 2./3],
                                       [1./3, 2./3, 2./3],
                                       [-2./3, 2./3, -1./3]])
    Mat['t_g1tog2_go1'][4] = np.array([[-2./3, -2./3, 1./3],
                                       [-2./3, 1./3, -2./3],
                                       [1./3, -2./3, -2./3]])
    Mat['t_g1tog2_go1'][5] = np.array([[1./3, 2./3, 2./3],
                                       [-2./3, 2./3, -1./3],
                                       [-2./3, -1./3, 2./3]])

    for i in range(Mat.shape[0]):
        AL = lat.Lattice('Al')
        print("AL ",AL)
        print("l_g_go ",AL.l_g_go)
        bp1_go1 = Mat['bp1_go1'][i]
        t_g1tog2_go1 = Mat['t_g1tog2_go1'][i]
        a, b, c = bpb.bicryst_planar_den(bp1_go1, t_g1tog2_go1, AL, 
            mat_ref="go1", inds_type="normal_go")
        print('Pl Density 1=', a, '\nPl Density 2=',
               b, '\nPl Density_2D CSL=', c)
        print('\n------------\n')
Exemple #2
0
# Load Lattice Module
import GBpy.lattice as lat
# Load CSL Utility function
import GBpy.csl_utility_functions as csl_util

# Test Cases
# 1: Common rotations for cubic lattices
# 2: Common rotations for primitive tetrahedral lattices
# 3: Common rotations for primitive hexagonal lattices
# 4: Common rotations for primitive rhombohedral lattices

test_case = 6
# Input parameters for pkl files
if test_case == 1:
    sig_type = 'common'
    l1 = lat.Lattice()
elif test_case == 2:
    sig_type = 'common'
    lat_type = 'tP_Id'
    l1 = lat.Lattice(lat_type)
elif test_case == 3:
    sig_type = 'common'
    lat_type = 'hP_Id'
    l1 = lat.Lattice(lat_type)
elif test_case == 4:
    sig_type = 'common'
    lat_type = 'hR_Id'
    l1 = lat.Lattice(lat_type)
elif test_case == 5:
    sig_type = 'specific'
    ca_rat = 3
Exemple #3
0
def Sigma3CSL(left, right):
    fcc_rotation_location = os.path.join(
        os.path.dirname(inspect.getfile(GBpy)), 'pkl_files',
        'cF_Id_csl_common_rotations.pkl')
    with open(fcc_rotation_location) as infile:
        fcc_rotations = pickle.load(infile)
    # misorientation for sigma 3 boundary
    sig3 = fcc_rotations['3']['N'][0] / fcc_rotations['3']['D'][0]
    # create lattice instance and multiply by lattice parameter of nickel
    Ni = lattice.Lattice()
    a_Ni = 3.52
    a_Al = 4.050
    #4.032, LEA (Liu, Ercolessi, Adams) potential on NIST
    a_ref = 1.
    Ni.l_g_go *= a_Al
    basis = [[0., 0.5, 0.5], [0.5, 0., 0.5], [0.5, 0.5, 0.]]
    # get primitive CSL vectors and convert them to orthogonal basis
    csl_p, __ = find_csl_dsc.find_csl_dsc(basis, sig3)
    print csl_p
    csl_o = np.dot(Ni.l_g_go, csl_p).T
    # take boundary plane from orientation matrix, use it to get
    # 2D CSL in boundary plane, and convert to orthogonal basis
    boundary_plane = left[0]
    gb = bp_basis.gb_2d_csl(boundary_plane, sig3, basis, 'normal_go', 'g1')
    #print "gb =",gb
    csl_2d = np.dot(Ni.l_g_go, gb[0]).T
    #print "csl_2d =",csl_2d

    # normalize orientation matrix to make it a rotation matrix,
    # and rotate both CSL and 2D CSL into crystal frame

    rotation_matrix = [list(np.array(i) / np.linalg.norm(i)) for i in left]
    #print rotation_matrix

    csl_2d = [np.dot(rotation_matrix, i) for i in csl_2d]
    csl = [np.dot(rotation_matrix, i) for i in csl_o]
    # iterate through the vertices of the CSL unit cell
    # and use the highest and lowest x coordinates
    # to calculate the period in the x direction

    xlo, xhi = 0, 0

    for i in product([0, 1], [0, 1], [0, 1]):
        csl_vertex = np.sum(np.array(csl).T * i, axis=1)
        xlo = min(xlo, csl_vertex[0])
        xhi = max(xhi, csl_vertex[0])

    x_period = xhi - xlo

    # iterate through the vertices of the 2D CSL unit cell
    # and use the highest and lowest y and z coordinates
    # to calculate the period in the y and z directions

    ylo, yhi, zlo, zhi = 0, 0, 0, 0

    for i in product([0, 1], [0, 1]):
        csl_2d_vertex = np.sum(np.array(csl_2d).T * i, axis=1)
        ylo = min(ylo, csl_2d_vertex[1])
        yhi = max(yhi, csl_2d_vertex[1])
        zlo = min(zlo, csl_2d_vertex[2])
        zhi = max(zhi, csl_2d_vertex[2])

    y_period = yhi - ylo
    z_period = zhi - zlo

    return x_period, y_period, z_period