ESR
The phenomenological sweep's output flag controls the printed transition list:
calc_FreqSweep defaults to True, while plot_FreqSweep defaults to False.
It does not affect returned results or figure display; use show for the latter.
ESR
Calculating and visualizing Electron Spin Resonance (ESR) spectra.
This module provides calculation and visualization helpers for Electron Spin Resonance (ESR) spectra of a specified spin systems.
Functions:
| Name | Description |
|---|---|
calc_FreqSweep |
Calculate the Electron Spin Resonance (ESR) spectrum for a given spin system. |
calc_RecordedTransitions |
Calculate and record transitions between quantum states within an energy range. |
calc_FreqSweep_ESRrate |
Simulate a continuous-wave ESR frequency sweep by solving rate equations. |
calc_Populations_ESR |
Calculate the steady-state populations of a spin system under ESR. |
add_ESRrate |
Add the ESR transition rates to the given spin system. |
plot_FreqSweep |
Plot the ESR spectrum for a given spin system. |
plot_FreqSweep_ESRrate |
Compute and plot the ESR spectrum based on the ESR driving rate. |
plot_Tipfieldmap |
Plot ESR spectra as a function of tip magnetic field for a given spin system. |
plot_ESRPopulations |
Plot the populations of spin states for a given spin system under ESR conditions. |
Dependencies
- Uses
spinfinity.SpinSys.SpinSysclass to represent the spin system and its properties. - Uses
spinfinity.SpinHamiltonianfor eigenvalue and eigenvector calculations. - Uses functions from
spinfinity.Bathfor population and rate calculations.
References
- Yang, K., Willke, P., Bae, Y. et al. Electrically controlled nuclear polarization of individual atoms. Nature Nanotech 13, 1120–1125 (2018). https://doi.org/10.1038/s41565-018-0296-7
- Yang, K., Phark, SH., Bae, Y. et al. Probing resonating valence bond states in artificial quantum magnets. Nat Commun 12, 993 (2021). https://doi.org/10.1038/s41467-021-21274-5
add_ESRrate(spinsys, freq=14, B1=0.001, T2=200)
Add the ESR (Electron Spin Resonance) transition rates to the given spin system.
This function calculates the ESR-induced transition rates between energy levels of the spin system. The rates are computed based on the Rabi rate, coherence time (T2), and the frequency of the driving field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object to which the ESR rates will be added.
Must have attributes such as |
required |
freq
|
float
|
The frequency (in GHz) of the driving field (default is 14). |
14
|
B1
|
float
|
The amplitude of the RF driving field (in T) for the ESR transition (default is 1e-3). |
0.001
|
T2
|
float
|
The coherence time (in ns) for the ESR transition (default is 200). |
200
|
Source code in spinfinity\ESR.py
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | |
calc_FreqSweep(spinsys, freq_array=None, AllowPumping=False, lw=0.02, norm=True, output=True)
Calculate the Electron Spin Resonance (ESR) spectrum for a given spin system.
This function computes the ESR spectrum by calculating the transition frequencies and amplitudes based on the eigenstates of the spin system. The ESR signal is constructed as a sum of Lorentzian lines for each allowed transition, where the amplitude of each transition depends on the population difference and the matrix element of the transition with the tip field operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object containing all relevant spin Hamiltonian parameters and state information. |
required |
freq_array
|
ndarray
|
An array of frequency points (in GHz) at which the ESR spectrum is calculated. If None, a default range from 10 to 20 GHz and 1000 points will be used. |
None
|
AllowPumping
|
bool
|
If True, allows for population pumping effects in the calculation. Default is False. |
False
|
lw
|
float
|
Lorentzian linewidth (full width at half maximum) in GHz. Default is 0.02. |
0.02
|
norm
|
bool
|
If True, scales the signal minimum to zero and maximum to one. A constant signal cannot be normalized and raises ValueError. If False, returns the unnormalized signal, including zero signals. Default is True. |
True
|
output
|
bool
|
If True, prints the recorded transitions and their frequencies. Default is True. This does not change the returned spectrum. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
freq |
ndarray
|
Array of frequency values (in GHz) at which the ESR spectrum is calculated. |
ESRsignal |
ndarray
|
Calculated ESR signal intensity at each frequency point. With norm=True, the minimum is zero and the maximum is one. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If norm=True and the ESR signal is constant. |
Notes
The function updates the following attributes of spinsys:
RecordedTransitions: A list of tuples representing the indices of the initial and final states for each allowed transition.ResonanceFrequencies: An array of resonance frequencies corresponding to the recorded transitions.
Source code in spinfinity\ESR.py
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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
calc_FreqSweep_ESRrate(spinsys, freq_array=None, B1=0.001, T2=200, norm=True)
Calculate the ESR spectrum for a given spin system via ESR-Rates.
This function calculates the ESR signal as a function of frequency by solving the rate equations for the spin system, including the effects of Rabi driving and relaxation. The ESR signal is computed as the difference in tunneling current with and without RF excitation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object containing Hamiltonian, rates, eigenvectors, and other relevant properties. |
required |
freq_array
|
ndarray
|
An array of frequency points (in GHz) at which the ESR spectrum is calculated. If None, a default range from 10 to 20 GHz and 200 points will be used. |
None
|
B1
|
float
|
The amplitude of the RF driving field (in T) for the ESR transition (default is 1e-3). |
0.001
|
T2
|
float
|
The total coherence time (in ns) for the ESR transition (default is 200). It technically includes T1 contributions from the inelastic tunneling as well as pure phase decoherence. |
200
|
norm
|
bool
|
If True, normalizes the ESR signal to its maximum value (default is True). |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
freq |
ndarray
|
Array of frequency points (in GHz) at which the ESR signal is calculated. |
ESRsignal |
ndarray
|
Array of calculated ESR signal values corresponding to each frequency point. |
I_off |
float
|
The tunneling current without RF excitation, used as a reference for the ESR signal. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Notes
The function updates the following attributes of spinsys:
ESRRates: A matrix of ESR-induced transition rates between states.
Source code in spinfinity\ESR.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
calc_Populations_ESR(spinsys, freq=14, B1=0.001, T2=200)
Calculate the steady-state populations of a spin system under ESR.
This function updates the populations of the given spin system by including ESR-induced transitions, solving the rate equations for the steady-state populations. If the rate equation has no solution, the thermal distribution is used as a fallback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object containing the system's states, rates, and populations. |
required |
freq
|
float
|
The frequency (in GHz) of the ESR driving field (default is 14). |
14
|
B1
|
float
|
The amplitude of the RF driving field (in T) for the ESR transition (default is 1e-3). |
0.001
|
T2
|
float
|
The coherence time (in ns) for the ESR transition (default is 200). |
200
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The steady-state populations of the spin system under ESR conditions. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Notes
The function updates the following attributes of spinsys:
Populations_ESR: An array containing the steady-state populations of the spin system under ESR conditions.
Source code in spinfinity\ESR.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
calc_RecordedTransitions(spinsys, MinE, MaxE)
Calculate and record transitions between quantum states within an energy range.
This function calculates the recorded transitions based on the occupation and the energy differences between states. It records transitions where the state has sufficiently high occupation and the energy difference is within the range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object containing state populations and energy levels. |
required |
MinE
|
float
|
The minimum allowed energy difference (in GHz) for a transition to be recorded. |
required |
MaxE
|
float
|
The maximum allowed energy difference (in GHz) for a transition to be recorded. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RecordedTransitions |
list of tuple of int
|
A list of tuples, each representing a pair of state indices (i, j) corresponding to allowed transitions. |
Notes
Here no selection rules are applied, transitions within the specified energy range which initial states fulfill Population > 10e-5 are recorded.
Source code in spinfinity\ESR.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
plot_ESRPopulations(spinsys, freq=14, B1=0.001, T2=200, filter=None, show=None)
Plot the populations of spin states for a given spin system under ESR conditions.
This function calculates and visualizes the populations of spin
states, including Boltzmann, tunneling, and ESR-driven populations,
for a provided spin system. The populations are displayed as
horizontal bar plots. Uses calc_Populations_ESR to compute the ESR-driven
populations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object containing the relevant state and population information. |
required |
freq
|
float
|
The frequency of the ESR field in the same units as used in the simulation, by default 14. |
14
|
B1
|
float
|
The amplitude of the RF driving field (in T) for the ESR transition (default is 1e-3). |
0.001
|
T2
|
float
|
The coherence time (in ns) for the ESR transition (default is 200). |
200
|
filter
|
float
|
If provided, only states with populations greater than this value in any of the three population arrays will be displayed. Default is None, which means all states are shown. |
None
|
show
|
(fixed, responsive, no)
|
Display mode. |
"fixed"
|
Returns:
| Name | Type | Description |
|---|---|---|
return_dict |
dict
|
A dictionary containing: - 'fig': plotly.graph_objects.Figure The plotly figure object containing the plot. - 'Pop_Boltzmann': numpy.ndarray The Boltzmann populations of the spin states. - 'Pop_Tunneling': numpy.ndarray The steady state populations under the influence of the tunneling rates of the spin states. - 'Pop_ESR': numpy.ndarray The ESR-driven populations of the spin states. |
Source code in spinfinity\ESR.py
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | |
plot_FreqSweep(spinsys, freq_array=None, AllowPumping=False, lw=0.02, norm=True, output=False, show=None)
Plot the ESR spectrum for a given spin system.
This function computes the ESR spectrum using the provided spin
system using calc_FreqSweep and plots the resulting signal.
It also marks the resonance frequencies corresponding to
recorded transitions in the spin system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object containing resonance frequencies and recorded transitions. |
required |
freq_array
|
ndarray
|
An array of frequency points (in GHz) at which the ESR spectrum is calculated. If None, a default range from 10 to 20 GHz and 1000 points will be used. |
None
|
AllowPumping
|
bool
|
Whether to allow pumping effects in the ESR calculation (default is False). |
False
|
lw
|
float
|
Linewidth for the ESR calculation (default is 0.02). |
0.02
|
norm
|
bool
|
Whether to normalize the ESR signal (default is True). |
True
|
output
|
bool
|
If True, prints the recorded transitions and their frequencies. Default is False. This is independent of the figure display mode. |
False
|
show
|
(fixed, responsive, no)
|
Display mode. |
"fixed"
|
Returns:
| Name | Type | Description |
|---|---|---|
return_dict |
dict
|
A dictionary containing: - 'fig': plotly.graph_objects.Figure The plotly figure object containing the ESR spectrum plot. - 'Freq_array': numpy.ndarray The array of frequency points in GHz. - 'ESRsignal': numpy.ndarray The calculated ESR signal corresponding to the frequency points. |
Source code in spinfinity\ESR.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | |
plot_FreqSweep_ESRrate(spinsys, freq_array=None, B1=0.001, T2=200, norm=True, show=None)
Plot the ESR spectrum based on the ESR driving rate.
This function computes the ESR spectrum based on an ESR driving rate
for a given spin system using calc_FreqSweep_ESRrate and plots
the resulting ESR signal. It also marks the resonance frequencies
corresponding to allowed transitions in the spin system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object containing energy levels and transition information. |
required |
freq_array
|
ndarray
|
An array of frequency points (in GHz) at which the ESR spectrum is calculated. If None, a default range from 10 to 20 GHz and 200 points will be used. |
None
|
B1
|
float
|
The amplitude of the RF driving field (in T) for the ESR transition (default is 1e-3). |
0.001
|
T2
|
float
|
The coherence time (in ns) for the ESR transition (default is 200). |
200
|
norm
|
bool
|
Whether to normalize the ESR signal (default is True). |
True
|
show
|
(fixed, responsive, no)
|
Display mode. |
"fixed"
|
Returns:
| Name | Type | Description |
|---|---|---|
return_dict |
dict
|
A dictionary containing: - 'fig': plotly.graph_objects.Figure The plotly figure object containing the ESR spectrum plot. - 'Freq_array': numpy.ndarray The array of frequency points in GHz. - 'ESRsignal': numpy.ndarray The calculated ESR signal corresponding to the frequency points. |
Source code in spinfinity\ESR.py
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | |
plot_Tipfieldmap(spinsys, freq_array=None, BTip_array=None, lw=0.02, norm=True, AllowPumping=False, Angle=0, show=None)
Plot ESR spectra as a function of tip magnetic field for a given spin system.
The function caluclates the ESR spectrum for a set of tipfields unsing
calc_FreqSweep and plots the resulting ESR signal as a color map.
The x-axis represents the frequency, the y-axis represents the tip magnetic field,
and the color intensity represents the ESR signal strength. Additionally,
a secondary y-axis is added to show the detuning from the tip field in GHz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spinsys
|
SpinSys
|
The spin system object containing all relevant spin and field parameters. |
required |
freq_array
|
ndarray
|
An array of frequency points (in GHz) at which the ESR spectrum is calculated. If None, a default range from 10 to 20 GHz and 500 points will be used. |
None
|
BTip_array
|
ndarray
|
An array of tip magnetic field values (T) at which to calculate the spectrum. If None, a default range from -0.1 to 0.1 T and 100 points will be used. |
None
|
lw
|
float
|
Linewidth for the ESR peaks (default is 0.02). |
0.02
|
norm
|
bool
|
Whether to normalize the ESR signal (default is True). |
True
|
AllowPumping
|
bool
|
Whether to allow pumping effects in the ESR calculation (default is False). |
False
|
Angle
|
float
|
Angle (in degrees) of the tip field with respect to the z-axis (default is 0). |
0
|
show
|
(fixed, responsive, no)
|
Display mode. |
"fixed"
|
Returns:
| Name | Type | Description |
|---|---|---|
return_dict |
dict
|
A dictionary containing: - 'fig': plotly.graph_objects.Figure The plotly figure object containing the ESR spectrum plot. - 'Freq_array': numpy.ndarray The array of frequency points in GHz. - 'BTip_array': numpy.ndarray The array of tip magnetic field values in Tesla. - 'ESRsignal': numpy.ndarray The calculated ESR signal corresponding to the frequency points. |
Source code in spinfinity\ESR.py
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | |