This repository was archived by the owner on Jun 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave_tensors.m
More file actions
60 lines (47 loc) · 1.4 KB
/
save_tensors.m
File metadata and controls
60 lines (47 loc) · 1.4 KB
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
function save_tensors(Nuclei, System, Method,Data)
% Extract physical constants.
ge = System.ge;
geff = System.g(end);
muB = System.muB;
muN = System.muN;
mu0 = System.mu0;
hbar = System.hbar;
magneticField = System.magneticField;
Theory = System.Theory;
theory = Theory(Method.order,:);
thisCluster = Nuclei.Index;
[tensors,~] = pairwisetensors(Nuclei.Nuclear_g, ...
Nuclei.Coordinates,thisCluster,Nuclei.Atensor,magneticField,ge,geff,...
muB,muN,mu0,hbar,theory,0,0,0);
tensor_indices = [0, thisCluster];
for ii = tensor_indices
idx = 0;
if ii >= 1, idx = Nuclei.pdbID(ii); end
fprintf('T[%i] = [%f, %f, %f];\n', idx,...
tensors(1,1,ii+1,ii+1), tensors(2,2,ii+1,ii+1),tensors(3,3,ii+1,ii+1));
end
for ii = tensor_indices
idx = 0;
if ii >= 1, idx = Nuclei.pdbID(ii); end
for jj = tensor_indices
if jj < ii, continue; end
jdx = 0;
if jj >= 1, jdx = Nuclei.pdbID(jj); end
fprintf('T[%i,%i] = [%f, %f, %f, %f, %f, %f];\n',...
idx,jdx,...
tensors(1,1,ii+1,jj+1), tensors(1,2,ii+1,jj+1),tensors(1,3,ii+1,jj+1),...
tensors(2,2,ii+1,jj+1), tensors(2,3,ii+1,jj+1),tensors(3,3,ii+1,jj+1)...
);
end
end
if ii > 1
ten = Nuclei.Qtensor(:,:,ii);
if max(abs(ten)) > 1e-12
fprintf('T[%i,%i] = [%f, %f, %f, %f, %f, %f];\n',...
Nuclei.pdbID(ii),Nuclei.pdbID(ii),...
ten(1,1), ten(1,2),ten(1,3),...
ten(2,2), ten(2,3),ten(3,3)...
);
end
end
end