-
Notifications
You must be signed in to change notification settings - Fork 0
/
constructCouplingMatrix.m
53 lines (43 loc) · 1.5 KB
/
constructCouplingMatrix.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
function Coupling = constructCouplingMatrix(varargin)
p = inputParser;
p.addRequired('Elf',@(x)isnumeric(x));
p.addRequired('lowFStates', @(x)isnumeric(x));
p.addRequired('upperFStates', @(x)isnumeric(x));
p.addRequired('normEl', @(x)isnumeric(x));
p.addOptional('J', 1/2, @(x)isnumeric(x));
p.addOptional('Jp', 1/2, @(x)isnumeric(x));
p.addParamValue('I', 3/2, @(x)isnumeric(x));
parse(p,varargin{:});
Elf = p.Results.Elf;
lowFStates = p.Results.lowFStates;
upperFStates = p.Results.upperFStates;
normEl = p.Results.normEl;
J = p.Results.J;
Jp = p.Results.Jp;
I = p.Results.I;
NlowF = length(lowFStates);
NupperF = length(upperFStates);
NlowTotal = lowFStateEndInd(lowFStates,NlowF);
NupperTotal = upperFStateEndInd(upperFStates,NlowTotal,NupperF)-NlowTotal;
Nlevel = NlowTotal+NupperTotal;
Coupling = zeros(Nlevel);
for lFInd=1:NlowF
F = lowFStates(lFInd);
sInd = lowFStateStartInd(lowFStates,lFInd);
eInd = lowFStateEndInd(lowFStates,lFInd);
for uFInd = 1:NupperF
Fp = upperFStates(uFInd);
sFInd = upperFStateStartInd(upperFStates,NlowTotal,uFInd);
eFInd = upperFStateEndInd(upperFStates,NlowTotal,uFInd);
for ii=sInd:eInd
mF = ii-(sInd-1)-(F+1);
for jj = sFInd:eFInd
mFp = jj-(sFInd-1)-(Fp+1);
C = getCouplingForAllPolarizations(Elf, F,Fp, mF,mFp,normEl,...
'J', J, 'Jp', Jp, 'I', I);
Coupling(ii,jj) = C;
Coupling(jj,ii) = C;
end
end
end
end