Exemplo n.º 1
0
def compute_all_misorientation_voxel(trunc_triangles, grain_ids, M):
    """
    Computes misorientation distribution using grain_ids to find grain boundaries.
    """
    print 'Computing voxel based misorientation'
    symOps=[]
    # Unity
    symOps.append(np.eye(3))
    # 3 fold axis around z
    symOps.append(GT.rot_matrix([0,0,1],2*math.pi/3))
    symOps.append(GT.rot_matrix([0,0,-1],2*math.pi/3))
    # 2 fold axis around (sqrt(3),-1,0)
    symOps.append(GT.rot_matrix([math.sqrt(3),-1,0],math.pi))	
    # 2 fold axis around y
    symOps.append(GT.rot_matrix([0,1,0],math.pi))
    # 2 fold axis around (sqrt(3),1,0)
    symOps.append(GT.rot_matrix([math.sqrt(3),1,0],math.pi))	

    from collections import defaultdict
    areas = defaultdict(int)
    angles = defaultdict(float)
    for ix in range(M[0]):
        nx = (ix + 1) % M[0]
        for iy in range(M[1]):
            ny = (iy + 1) % M[1]
            for iz in range(M[2]):
                nz = (iz + 1) % M[2]
                ig = grain_ids[ix + iy * M[0] + iz * (M[0] * M[1])]

                if ig == 1: continue # Skip the Co-phase

                def do_compute(ng):
                    if ig != ng and ng != 1:
                        index = (min(ig, ng), max(ig, ng))
                        areas[index] += 1
                        if index not in angles:
                            angles[index] = compute_misorientation_net(trunc_triangles[ig-2], trunc_triangles[ng-2], symOps)

                # Check all three neighbours (in the + side)
                do_compute(grain_ids[nx + iy * M[0] + iz * (M[0] * M[1])])
                do_compute(grain_ids[ix + ny * M[0] + iz * (M[0] * M[1])])
                do_compute(grain_ids[ix + iy * M[0] + nz * (M[0] * M[1])])

    return angles, areas
Exemplo n.º 2
0
def compute_all_misorientation_net(trunc_triangles,nbrList):
	symOps=[]
	# Unity
	symOps.append(np.eye(3))
	# 3 fold axis around z
	symOps.append(GT.rot_matrix([0,0,1],2*math.pi/3))
	symOps.append(GT.rot_matrix([0,0,-1],2*math.pi/3))
	# 2 fold axis around (sqrt(3),-1,0)
	symOps.append(GT.rot_matrix([math.sqrt(3),-1,0],math.pi))	
	# 2 fold axis around y
	symOps.append(GT.rot_matrix([0,1,0],math.pi))
	# 2 fold axis around (sqrt(3),1,0)
	symOps.append(GT.rot_matrix([math.sqrt(3),1,0],math.pi))	

	angles=[]
	for i,t in enumerate(trunc_triangles):
		for j in xrange(len(nbrList[i])):
		
			theta =  compute_misorientation_net(t,trunc_triangles[ nbrList[i][j] ],symOps)	
			angles.append(theta)
	return angles
Exemplo n.º 3
0
def compute_all_misorientation_net(trunc_triangles, nbrList):
    """
    Computes misorientation given a list of trunc_triangles and a neighborList
    Using the net rotation  M_1^-1 * M_2, with a few symmetry operations.
    This method might not be correct.
    """
    symOps = []
    # Unity
    symOps.append(np.eye(3))
    # 3 fold axis around z
    symOps.append(GT.rot_matrix([0, 0, 1], 2*math.pi/3))
    symOps.append(GT.rot_matrix([0, 0, -1], 2*math.pi/3))
    # 2 fold axis around y
    symOps.append(GT.rot_matrix([0, 1, 0], math.pi))
    
    angles = []
    print('Computing misorientation angles net')
    for i, t in enumerate(trunc_triangles):
        for j in xrange(len(nbrList[i])):
            theta = compute_misorientation_net(t, trunc_triangles[nbrList[i][j]], symOps)
            angles.append(theta)
    return angles