-
Notifications
You must be signed in to change notification settings - Fork 2
/
GB5DOF_setup.m
95 lines (85 loc) · 2.06 KB
/
GB5DOF_setup.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
function propList = GB5DOF_setup(pA,pB,mA,mat,epsijk,nv)
arguments
pA(:,4) = []
pB(:,4) = []
mA(:,3) = [0 0 1] %default is octonion convention
mat char = 'Ni'
epsijk(1,1) double = 1
nv.o double = []
end
%GB5DOF_SETUP Compute 5DOF GB energy from BRK function
%--------------------------------------------------------------------------
% Author(s): Oliver Johnson, Sterling Baird
% Date: 2020-07-27
%
% Inputs:
% five - struct containing at minimum misorientation quaternions (q) and
% boundary plane normals in crystal reference frame of grain A (nA)
% pointing towards grain B.
%
% Outputs:
% propList - grain boundary energies computed at each grain boundary in
% five
%
% Usage:
% propList = GB5DOF_setup(five)
%
% Dependencies:
% constructGBMatrices.m
% GB5DOF.m
%
% Notes:
% Find a good verification/ground truth (i.e. here is a GBE for a GB with
% this representation.)
%--------------------------------------------------------------------------
% Compute GB matrices
% if ~isempty(five)
% pB = vertcat(five.q);
% pA = repmat([1 0 0 0],nGB,1);
% mA = vertcat(five.nA).';
% end
o = nv.o;
if isempty([pA;pB])
assert(~isempty(o),'specify either pA and pB or o')
pA = o(:,1:4);
pB = o(:,5:8);
end
pA = normr(pA);
pB = normr(pB);
npts = size(pB,1);
if isempty(mA)
mA = [0 0 1];
end
if size(mA,1) == 1
mA = repmat(mA,npts,1);
end
if isempty(pA)
% case that pB is actually misorientation
pA = repmat([1 0 0 0],npts,1);
end
if epsijk == -1
pA = qinv(pA);
pB = qinv(pB);
end
% [gA_R,gB_R] = constructGBMatrices(pA,pB,mA,'livermore');
[omA,omB] = deal(zeros(3,3,npts));
parfor i = 1:npts
mAtmp = mA(i,:);
R = vecpair2rmat(mAtmp,[1 0 0],1);
qR = om2qu(R,1);
pAtmp = pA(i,:);
pBtmp = pB(i,:);
qA = qmult(qR,pAtmp,1);
qB = qmult(qR,pBtmp,1);
omA(:,:,i) = qu2om(qA,1);
omB(:,:,i) = qu2om(qB,1);
end
%Calculate GB Energies
% mat = 'Ni'; %'Al', 'Au', 'Cu'
E(npts) = struct;
E(1).(mat) = [];
parfor k = 1:npts
E(k).(mat) = GB5DOF(omA(:,:,k),omB(:,:,k),mat);
end
propList = vertcat(E.(mat));
end