Smit-Beljers
This module contains the basic implementation of the Smit-Beljers model. The model is based on the following paper which introduced a corrected model: Rodríguez-Suárez et al., "Ferromagnetic resonance investigation of the residual coupling in spin-valve systems" 10.1103/PhysRevB.71.224406
LayerDynamic
dataclass
Bases: LayerSB
Source code in cmtj/models/general_sb.py
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 293 294 |
|
rhs_llg(H, J1top, J1bottom, J2top, J2bottom, top_layer, down_layer)
Returns the symbolic expression for the RHS of the spherical LLG equation. Coupling contribution comes only from the bottom layer (top-down crawl)
Source code in cmtj/models/general_sb.py
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 |
|
LayerSB
dataclass
Basic Layer for Smit-Beljers model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thickness |
float
|
thickness of the FM layer (effective). |
required |
Kv |
VectorObj
|
volumetric (in-plane) anisotropy. Only phi and mag count [J/m^3]. |
required |
Ks |
float
|
surface anisotropy (out-of plane, or perpendicular) value [J/m^3]. |
required |
Ms |
float
|
magnetisation saturation value in [A/m]. |
required |
Hdmi |
VectorObj
|
DMI field in the layer. Defaults to [0, 0, 0]. |
None
|
Source code in cmtj/models/general_sb.py
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 244 245 246 247 248 249 250 251 252 |
|
get_coord_sym()
Returns the symbolic coordinates of the layer.
Source code in cmtj/models/general_sb.py
187 188 189 |
|
get_m_sym()
Returns the magnetisation vector.
Source code in cmtj/models/general_sb.py
191 192 193 |
|
no_iec_symbolic_layer_energy(H)
Returns the symbolic expression for the energy of the layer. Coupling contribution comes only from the bottom layer (top-down crawl)
Source code in cmtj/models/general_sb.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
symbolic_layer_energy(H, J1top, J1bottom, J2top, J2bottom, top_layer, down_layer)
cached
Returns the symbolic expression for the energy of the layer. Coupling contribution comes only from the bottom layer (top-down crawl)
Source code in cmtj/models/general_sb.py
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 |
|
Solver
dataclass
General solver for the system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layers |
List[Union[LayerSB, LayerDynamic]]
|
list of layers in the system. |
required |
J1 |
List[float]
|
list of interlayer exchange constants. Goes (i)-(i+1), i = 0, 1, 2, ... with i being the index of the layer. |
required |
J2 |
List[float]
|
list of interlayer exchange constants. |
required |
H |
VectorObj
|
external field. |
None
|
Ndipole |
List[List[VectorObj]]
|
list of dipole fields for each layer. Defaults to None. Goes (i)-(i+1), i = 0, 1, 2, ... with i being the index of the layer. |
None
|
Source code in cmtj/models/general_sb.py
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 462 463 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 532 533 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 591 592 593 594 595 596 597 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 712 713 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 |
|
adam_gradient_descent(init_position, max_steps, tol=1e-08, learning_rate=0.0001, first_momentum_decay=0.9, second_momentum_decay=0.999, perturbation=1e-06)
A naive implementation of Adam gradient descent. See: ADAM: A METHOD FOR STOCHASTIC OPTIMIZATION, Kingma et Ba, 2015
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_steps |
int
|
maximum number of gradient steps. |
required |
tol |
float
|
tolerance of the solution. |
1e-08
|
learning_rate |
float
|
the learning rate (descent speed). |
0.0001
|
first_momentum_decay |
float
|
constant for the first momentum. |
0.9
|
second_momentum_decay |
float
|
constant for the second momentum. |
0.999
|
Source code in cmtj/models/general_sb.py
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 532 533 534 535 536 537 |
|
analytical_field_scan(Hrange, init_position=None, max_steps=1000000000.0, learning_rate=0.0001, first_momentum_decay=0.9, second_momentum_decay=0.999, disable_tqdm=False)
Performs a field scan using the analytical solutions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
Hrange |
List[VectorObj]
|
the range of fields to scan. |
required |
init_position |
List[float]
|
the initial position for the gradient descent. If None, the first field in Hrange will be used. |
None
|
max_steps |
int
|
maximum number of gradient steps. |
1000000000.0
|
learning_rate |
float
|
the learning rate (descent speed). |
0.0001
|
first_momentum_decay |
float
|
constant for the first momentum. |
0.9
|
second_momentum_decay |
float
|
constant for the second momentum. |
0.999
|
disable_tqdm |
bool
|
disable the progress bar. |
False
|
Returns:
Type | Description |
---|---|
Iterable[Tuple[List[float], List[float], VectorObj]]
|
an iterable of (equilibrium position, frequencies, field) |
Source code in cmtj/models/general_sb.py
700 701 702 703 704 705 706 707 708 709 710 711 712 713 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 |
|
analytical_roots()
Find & cache the analytical roots of the system. Returns a list of solutions. Ineffecient for more than 2 layers (can try though).
Source code in cmtj/models/general_sb.py
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 |
|
compose_llg_jacobian(H)
Create a symbolic jacobian of the LLG equation in spherical coordinates.
Source code in cmtj/models/general_sb.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
|
create_energy(H=None, volumetric=False)
Creates the symbolic energy expression.
Due to problematic nature of coupling, there is an issue of computing each layer's FMR in the presence of IEC. If volumetric = True then we use the thickness of the layer to multiply the energy and hence avoid having to divide J by the thickness of a layer. If volumetric = False the J constant is divided by weighted thickness and included in every layer's energy, correcting FMR automatically.
Source code in cmtj/models/general_sb.py
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 |
|
create_energy_hessian(equilibrium_position)
Creates the symbolic hessian of the energy expression.
Source code in cmtj/models/general_sb.py
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
|
dynamic_layer_solve(eq)
Return the FMR frequencies and modes for N layers using the dynamic RHS model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
eq |
List[float]
|
the equilibrium position of the system. |
required |
Returns:
Type | Description |
---|---|
frequencies and eigenmode vectors. |
Source code in cmtj/models/general_sb.py
623 624 625 626 627 628 629 630 631 632 633 634 635 |
|
get_gradient_expr(accel='math')
Returns the symbolic gradient of the energy expression.
Source code in cmtj/models/general_sb.py
480 481 482 483 484 485 486 487 488 489 490 |
|
get_layer_references(layer_indx, interaction_constant)
Returns the references to the layers above and below the layer with index layer_indx.
Source code in cmtj/models/general_sb.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
get_ms_subs()
Returns a dictionary of substitutions for the Ms symbols.
Source code in cmtj/models/general_sb.py
687 688 689 690 691 692 693 694 |
|
get_subs(equilibrium_position)
Returns the substitution dictionary for the energy expression.
Source code in cmtj/models/general_sb.py
678 679 680 681 682 683 684 685 |
|
set_H(H)
Sets the external field.
Source code in cmtj/models/general_sb.py
696 697 698 |
|
single_layer_resonance(layer_indx, eq_position)
We can compute the equilibrium position of a single layer directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer_indx |
int
|
the index of the layer to compute the equilibrium |
required |
eq_position |
np.ndarray
|
the equilibrium position vector |
required |
Source code in cmtj/models/general_sb.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
|
solve(init_position, max_steps=1000000000.0, learning_rate=0.0001, adam_tol=1e-08, first_momentum_decay=0.9, second_momentum_decay=0.999, perturbation=0.001, ftol=10000000.0, max_freq=80000000000.0, force_single_layer=False, force_sb=False)
Solves the system.
For dynamic LayerDynamic, the return is different, check :return.
1. Computes the energy functional.
2. Computes the gradient of the energy functional.
3. Performs a gradient descent to find the equilibrium position.
Returns the equilibrium position and frequencies in [GHz].
If there's only one layer, the frequency is computed analytically.
For full analytical solution, see: analytical_field_scan
Parameters:
Name | Type | Description | Default |
---|---|---|---|
init_position |
np.ndarray
|
initial position for the gradient descent. Must be a 1D array of size 2 * number of layers (theta, phi) |
required |
max_steps |
int
|
maximum number of gradient steps. |
1000000000.0
|
learning_rate |
float
|
the learning rate (descent speed). |
0.0001
|
adam_tol |
float
|
tolerance for the consecutive Adam minima. |
1e-08
|
first_momentum_decay |
float
|
constant for the first momentum. |
0.9
|
second_momentum_decay |
float
|
constant for the second momentum. |
0.999
|
perturbation |
float
|
the perturbation to use for the numerical gradient computation. |
0.001
|
ftol |
float
|
tolerance for the frequency search. [numerical only] |
10000000.0
|
max_freq |
float
|
maximum frequency to search for. [numerical only] |
80000000000.0
|
force_single_layer |
bool
|
whether to force the computation of the frequencies for each layer individually. |
False
|
force_sb |
bool
|
whether to force the computation of the frequencies. Takes effect only if the layers are LayerDynamic, not LayerSB. |
False
|
Returns:
Type | Description |
---|---|
equilibrium position and frequencies in [GHz] (and eigenvectors if LayerDynamic instead of LayerSB). |
Source code in cmtj/models/general_sb.py
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 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
|
fast_norm(x)
Fast norm function for 1D arrays.
Source code in cmtj/models/general_sb.py
28 29 30 31 32 33 34 |
|
general_hessian_functional(N)
cached
Create a generalised hessian functional for N layers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
N |
int
|
number of layers. ! WARNING: remember Ms Symbols must match!!! |
required |
Source code in cmtj/models/general_sb.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
get_all_second_derivatives(energy_functional_expr, energy_expression, subs=None)
Get all second derivatives of the energy expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
energy_functional_expr |
symbolic energy_functional expression |
required | |
energy_expression |
symbolic energy expression (from solver) |
required | |
subs |
substitutions to be made. |
None
|
Source code in cmtj/models/general_sb.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
get_hessian_from_energy_expr(N, energy_functional_expr)
cached
Computes the Hessian matrix of the energy functional expression with respect to the spin angles and phases.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
(int) |
N
|
The number of spins. |
required |
(sympy.Expr) |
energy_functional_expr
|
The energy functional expression. returns: sympy.Matrix: The Hessian matrix of the energy functional expression. |
required |
Source code in cmtj/models/general_sb.py
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 96 97 98 99 100 101 102 103 104 105 |
|
real_deocrator(fn)
Using numpy real cast is way faster than sympy.
Source code in cmtj/models/general_sb.py
19 20 21 22 23 24 25 |
|
solve_for_determinant(N)
cached
Solve for the determinant of the hessian functional.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
N |
int
|
number of layers. |
required |
Source code in cmtj/models/general_sb.py
108 109 110 111 112 113 114 115 116 117 118 119 |
|