Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3e28cb9
Add Kehl ENDOR pulse sequences
May 8, 2026
999f5a5
Fold Kehl ENDOR options into parameters
May 8, 2026
7ac1764
Fix Kehl ENDOR orientation edge cases
May 8, 2026
9b4e27f
Use coupling eigs in Kehl ENDOR examples
May 8, 2026
1971308
Move Kehl experiment setup into context
May 8, 2026
160ecd6
Infer Kehl context data from spin system
May 8, 2026
e969423
Inline Kehl ENDOR helper stack
May 8, 2026
0b5fecd
Use Spinach constants in Kehl context
May 8, 2026
475eb22
Use Spinach isotope metadata in Kehl ENDOR
May 8, 2026
a7c4aa3
Use direct Liouville vectorisation in Kehl ENDOR
May 8, 2026
56bf93e
Use direct reshape in Kehl ENDOR
May 8, 2026
23f02e3
Restore Kehl ENDOR sequence files
May 8, 2026
f8d645f
Use Spinach operators in Kehl ENDOR kernels
May 8, 2026
332bde4
Move Kehl experiment fields into parameters
May 8, 2026
6221822
Extract Kehl context physics helpers
May 8, 2026
004a498
Use Spinach Hamiltonian assembly in Kehl ENDOR
May 8, 2026
bc6eb8b
Cache Kehl Hamiltonian orientation basis
May 8, 2026
c59238a
Harden Kehl ENDOR integration style
May 8, 2026
20a0558
Use full Spinach systems in Kehl ENDOR
May 9, 2026
fcabac9
Use Spinach relaxation in Kehl ENDOR
May 9, 2026
ee1e8b5
Run Kehl ENDOR in Zeeman Liouville space
May 9, 2026
433b63c
Port Kehl EPR selection to Liouville space
May 9, 2026
57fbfc7
Remove Kehl operator basis caches
May 9, 2026
6d713d2
Prune unused Kehl function arguments
May 9, 2026
e3d2209
Inline Kehl initial state construction
May 9, 2026
5ef6950
Normalise Kehl ENDOR units
May 9, 2026
a91344f
Refactor Kehl sequence setup and relaxation
May 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions examples/esr_sol_pulsed/endor_kehl_mims_powder.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
% Exemplary setup of a 19F Mims ENDOR simulation at 34 GHz using
% Spinach constructor, ENDOR context, and pulse-sequence function style.
%
% March 2024 A. Kehl (akehl@gwdg.de)
% Spinach architecture migration May 2026 Talos

function endor_kehl_mims_powder()

% Define constants
constants=kehl_constants();

% Spinach spin-system constructor input
T=0.066;
D=6.5;

sys.magnet=1.20521;
sys.isotopes={'E','19F','1H','1H','14N'};
sys.output='hush';
sys.disable={'hygiene'};

inter.zeeman.matrix=cell(1,5);
inter.zeeman.matrix{1}=diag([2.00886,2.00610,2.00211]);
inter.zeeman.matrix{2}=local_tensor([205,310,358],[29,14,-87]);
inter.zeeman.matrix{3}=zeros(3,3);
inter.zeeman.matrix{4}=zeros(3,3);
inter.zeeman.matrix{5}=zeros(3,3);

inter.coupling.matrix=cell(5,5);
inter.coupling.matrix{1,2}=local_tensor([2*T,-T,-T]*1e6,[161,1,0]);
inter.coupling.matrix{1,5}=local_tensor([15,11,95.8]*1e6,[0,0,0]);
inter.coupling.matrix{5,5}=local_traceless_tensor([1.2,0.54,-1.7]*1e6,[0,0,0]);
inter.coupling.matrix{2,3}=local_tensor([2*D,-D,-D]*1e3,[-16.9,143.0,0]);
inter.coupling.matrix{2,4}=local_tensor([2*D,-D,-D]*1e3,[-47.9,34.3,0]);

bas.formalism='zeeman-hilb';
bas.approximation='none';

spin_system=create(sys,inter);
spin_system=basis(spin_system,bas);

% Experiment parameters
expt=kehl_exp_create(33.7727,12052.1,0.5,0.001,0.3,...
[12,2000,12,1000,200000,1000,12]);
expt=kehl_mims_fields(constants,expt,true,[0,0]);
expt=kehl_exp_freq(expt,32,3,0.001);
expt=kehl_exp_angle(expt,163);
expt=kehl_exp_pulse(expt,...
fullfile(fileparts(mfilename('fullpath')),'kehl_mlr09_12ns_pulse.txt'),false);

% Context options
values=containers.Map;
values('freqDomain')=true;
values('powder')=true;
values('Nang')=50;
values('Relax')=false;
values('Bterm')=false;
opt=kehl_set_opt([],values);

% ENDOR context metadata
parameters.inter=inter;
parameters.endor_spins=[2,3,4];
parameters.epr_spins=5;
parameters.epr_quadrupole_matrix=local_tensor([1.2,0.54,-1.7]*1e6,[0,0,0]);
parameters.n_spin_systems=1;
parameters.dipolar_pairs=[2,3;2,4];
parameters.expt=expt;
parameters.opt=opt;

% Actual ENDOR calculation through Spinach-style context and experiment
[endor_amp,endor_amp_conv,x_coords,v_L]=endor_kehl_context(spin_system,@endor_kehl_mims,parameters,'labframe'); %#ok<ASGLU>

% Plotting
sim=endor_amp(:)-endor_amp(1);
sim=sim/min(sim);
plot((x_coords(:))*1e-6,sim);

end

function T=local_traceless_tensor(values,eulers_deg)
values=values-mean(values);
T=local_tensor(values,eulers_deg);
end

function T=local_tensor(values,eulers_deg)
alpha=eulers_deg(1)*pi/180;
beta=eulers_deg(2)*pi/180;
gamm=eulers_deg(3)*pi/180;
R=zeros(3,3);
R(1,1)=cos(beta)*cos(alpha)*cos(gamm)-sin(alpha)*sin(gamm);
R(1,2)=cos(beta)*sin(alpha)*cos(gamm)+cos(alpha)*sin(gamm);
R(1,3)=-sin(beta)*cos(gamm);
R(2,1)=-cos(beta)*cos(alpha)*sin(gamm)-sin(alpha)*cos(gamm);
R(2,2)=-cos(beta)*sin(alpha)*sin(gamm)+cos(alpha)*cos(gamm);
R(2,3)=sin(beta)*sin(gamm);
R(3,1)=sin(beta)*cos(alpha);
R(3,2)=sin(beta)*sin(alpha);
R(3,3)=cos(beta);
T=R*diag(values)*R';
end

98 changes: 98 additions & 0 deletions examples/esr_sol_pulsed/endor_kehl_time_powder.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
% Exemplary setup of a 19F time-domain ENDOR simulation at 34 GHz using
% Spinach constructor, ENDOR context, and pulse-sequence function style.
%
% March 2024 A. Kehl (akehl@gwdg.de)
% Spinach architecture migration May 2026 Talos

function endor_kehl_time_powder()

% Define constants
constants=kehl_constants();

% Spinach spin-system constructor input
T=0.066;
D=6.5;

sys.magnet=1.20521;
sys.isotopes={'E','19F','1H','1H','14N'};
sys.output='hush';
sys.disable={'hygiene'};

inter.zeeman.matrix=cell(1,5);
inter.zeeman.matrix{1}=diag([2.00886,2.00610,2.00211]);
inter.zeeman.matrix{2}=zeros(3,3);
inter.zeeman.matrix{3}=zeros(3,3);
inter.zeeman.matrix{4}=zeros(3,3);
inter.zeeman.matrix{5}=zeros(3,3);

inter.coupling.matrix=cell(5,5);
inter.coupling.matrix{1,2}=local_tensor([2*T,-T,-T]*1e6,[161,1,0]);
inter.coupling.matrix{1,5}=local_tensor([15,11,95.8]*1e6,[0,0,0]);
inter.coupling.matrix{5,5}=local_traceless_tensor([1.2,0.54,-1.7]*1e6,[0,0,0]);
inter.coupling.matrix{2,3}=local_tensor([2*D,-D,-D]*1e3,[-16.9,143.0,0]);
inter.coupling.matrix{2,4}=local_tensor([2*D,-D,-D]*1e3,[-47.9,34.3,0]);

bas.formalism='zeeman-hilb';
bas.approximation='none';

spin_system=create(sys,inter);
spin_system=basis(spin_system,bas);

% Experiment parameters
expt=kehl_exp_create(33.7727,12052.1,0.5,0.24,144.24,...
[12,1600,12,1000,6000,1000,6000,344240,12]);
expt=kehl_time_fields(constants,expt,true,[0,0]);
expt=kehl_exp_freq(expt,32,3,0.001);
expt=kehl_exp_pulse(expt,...
fullfile(fileparts(mfilename('fullpath')),'kehl_mlr09_12ns_pulse.txt'),false);

% Context options
values=containers.Map;
values('freqDomain')=true;
values('powder')=true;
values('Nang')=50;
opt=kehl_set_opt([],values);

% ENDOR context metadata
parameters.inter=inter;
parameters.endor_spins=[2,3,4];
parameters.epr_spins=5;
parameters.epr_quadrupole_matrix=local_tensor([1.2,0.54,-1.7]*1e6,[0,0,0]);
parameters.n_spin_systems=1;
parameters.dipolar_pairs=[2,3;2,4];
parameters.expt=expt;
parameters.opt=opt;
parameters.time_domain=true;

% Actual ENDOR calculation through Spinach-style context and experiment
[endor_amp,endor_amp_conv,x_coords,v_L]=endor_kehl_context(spin_system,@endor_kehl_time,parameters,'labframe'); %#ok<ASGLU>

% Plotting
sim=endor_amp(:)-endor_amp(1);
sim=sim/min(sim);
plot((x_coords(:))*1e-6,sim);

end

function T=local_traceless_tensor(values,eulers_deg)
values=values-mean(values);
T=local_tensor(values,eulers_deg);
end

function T=local_tensor(values,eulers_deg)
alpha=eulers_deg(1)*pi/180;
beta=eulers_deg(2)*pi/180;
gamm=eulers_deg(3)*pi/180;
R=zeros(3,3);
R(1,1)=cos(beta)*cos(alpha)*cos(gamm)-sin(alpha)*sin(gamm);
R(1,2)=cos(beta)*sin(alpha)*cos(gamm)+cos(alpha)*sin(gamm);
R(1,3)=-sin(beta)*cos(gamm);
R(2,1)=-cos(beta)*cos(alpha)*sin(gamm)-sin(alpha)*cos(gamm);
R(2,2)=-cos(beta)*sin(alpha)*sin(gamm)+cos(alpha)*cos(gamm);
R(2,3)=sin(beta)*sin(gamm);
R(3,1)=sin(beta)*cos(alpha);
R(3,2)=sin(beta)*sin(alpha);
R(3,3)=cos(beta);
T=R*diag(values)*R';
end

128 changes: 128 additions & 0 deletions examples/esr_sol_pulsed/kehl_mlr09_12ns_pulse.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
1 0 225 186
2 1 254 221
3 2 254 219
4 3 243 222
5 4 218 219
6 5 216 225
7 6 253 202
8 7 472 131
9 8 1124 -30
10 9 2074 -55
11 10 2784 49
12 11 3107 159
13 12 3190 229
14 13 3190 236
15 14 3204 213
16 15 3253 190
17 16 3297 174
18 17 3368 210
19 18 3308 296
20 19 2880 414
21 20 2055 445
22 21 1248 390
23 22 745 326
24 23 585 293
25 24 584 274
26 25 598 256
27 26 540 246
28 27 473 240
29 28 421 234
30 29 409 230
31 30 429 239
32 31 422 246
33 32 404 246
34 33 371 238
35 34 370 236
36 35 376 238
37 36 361 234
38 37 331 237
39 38 311 234
40 39 314 221
41 40 334 233
42 41 334 242
43 42 313 245
44 43 291 250
45 44 274 223
46 45 274 205
47 46 290 207
48 47 283 198
49 48 273 205
50 49 260 231
51 50 228 229
52 51 229 215
53 52 257 211
54 53 248 226
55 54 257 241
56 55 252 234
57 56 257 230
58 57 253 220
59 58 275 224
60 59 269 226
61 60 255 227
62 61 256 228
63 62 256 218
64 63 255 230
65 64 262 233
66 65 260 215
67 66 248 199
68 67 242 207
69 68 250 240
70 69 273 249
71 70 261 256
72 71 259 234
73 72 239 227
74 73 266 226
75 74 248 210
76 75 245 227
77 76 241 226
78 77 235 222
79 78 245 224
80 79 252 209
81 80 258 222
82 81 252 221
83 82 247 215
84 83 240 228
85 84 228 231
86 85 243 222
87 86 231 229
88 87 224 235
89 88 212 220
90 89 208 220
91 90 203 214
92 91 218 214
93 92 244 209
94 93 249 222
95 94 251 201
96 95 258 206
97 96 260 219
98 97 241 235
99 98 231 227
100 99 234 228
101 100 244 229
102 101 263 222
103 102 243 222
104 103 225 216
105 104 226 222
106 105 230 219
107 106 250 205
108 107 256 204
109 108 246 206
110 109 231 222
111 110 232 238
112 111 239 226
113 112 241 222
114 113 248 222
115 114 243 214
116 115 252 224
117 116 252 238
118 117 264 236
119 118 254 246
120 119 241 250
121 120 250 244
122 121 254 233
123 122 255 245
124 123 255 221
125 124 252 215
126 125 242 217
127 126 252 228
128 127 244 219
Loading