QSpaceHessian API Reference¶
tdscha.QSpaceHessian
¶
Q-Space Free Energy Hessian¶
Computes the free energy Hessian d²F/dRdR in q-space (Bloch basis).
Instead of building the full D4 matrix explicitly (O(N⁴) memory, O(N⁶) time), solves L_static(q) x = e_i for each band at each irreducible q-point, where L_static is the static Liouvillian operator. The Hessian is then H(q) = inv(G(q)), where G(q) is the static susceptibility.
The static L operator is DIFFERENT from the spectral L used in Lanczos: - Static: R sector = +w², W sector = 1/Lambda (one 2-phonon sector) - Spectral: R sector = -w², a'/b' sectors = -(w1∓w2)² (two sectors)
Both share the same anharmonic core (ensemble averages of D3/D4).
The q-space block-diagonal structure gives a speedup of ~N_cell³ / N_q_irr over the real-space approach.
References: Monacelli & Mauri 2021 (Phys. Rev. B)
QSpaceHessian(ensemble, verbose=True, ignore_v3=False, ignore_v4=False, **kwargs)
¶
Compute the free energy Hessian in q-space via iterative linear solves.
Uses the static Liouvillian operator L_static, which has the structure: - R sector: w² * R (positive, unlike spectral -w²) - W sector: (1/Lambda) * W (static 2-phonon propagator) - Anharmonic coupling via ensemble averages (same Julia core)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ensemble
|
Ensemble
|
The SSCHA ensemble. |
required |
verbose
|
bool
|
If True, print progress information. |
True
|
**kwargs
|
Additional keyword arguments passed to QSpaceLanczos. |
{}
|
Source code in tdscha/QSpaceHessian.py
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 | |
init(use_symmetries=True)
¶
Initialize the Lanczos engine and find irreducible q-points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_symmetries
|
bool
|
If True, use symmetries to reduce q-points. |
True
|
Source code in tdscha/QSpaceHessian.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
compute_hessian_at_q(iq, tol=1e-06, max_iters=500, use_preconditioner=True, dense_fallback=False, use_mode_symmetry=True)
¶
Compute the free energy Hessian at a single q-point.
Solves L_static(q) x_i = e_i for each non-acoustic band. G_q[j,i] = x_i[j] (R-sector), H_q = inv(G_q).
When use_mode_symmetry=True and degenerate modes are present, exploits Schur's lemma: L_static commutes with the little group of q, so G_q restricted to a d-dimensional irrep block is c*I_d. Only one solve per degenerate block is needed instead of d solves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iq
|
int
|
Q-point index. |
required |
tol
|
float
|
Convergence tolerance for the iterative solver. |
1e-06
|
max_iters
|
int
|
Maximum number of iterations. |
500
|
use_preconditioner
|
bool
|
If True, use harmonic preconditioner. |
True
|
dense_fallback
|
bool
|
If True, fall back to dense solve when iterative solvers fail. WARNING: this builds a psi_size x psi_size dense matrix, which can be very large for big supercells. Default is False. |
False
|
use_mode_symmetry
|
bool
|
If True, exploit mode degeneracy to reduce the number of GMRES solves. Within each degenerate block, only one solve is performed and G_q is filled using Schur's lemma (G_block = c * I). |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
H_q |
(ndarray(n_bands, n_bands), complex128)
|
The Hessian matrix in the mode basis at q-point iq. |
Source code in tdscha/QSpaceHessian.py
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 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 | |
compute_full_hessian(tol=1e-06, max_iters=500, use_preconditioner=True, dense_fallback=False, use_mode_symmetry=True)
¶
Compute the Hessian at all q-points and return as CC.Phonons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tol
|
float
|
Convergence tolerance for iterative solver. |
1e-06
|
max_iters
|
int
|
Maximum iterations per linear solve. |
500
|
use_preconditioner
|
bool
|
If True, use harmonic preconditioner. |
True
|
dense_fallback
|
bool
|
If True, fall back to dense solve when iterative solvers fail. WARNING: this builds a psi_size x psi_size dense matrix, which can be very large for big supercells. Default is False. |
False
|
use_mode_symmetry
|
bool
|
If True, exploit mode degeneracy to reduce GMRES solves. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
hessian |
Phonons
|
The free energy Hessian as a Phonons object (Ry/bohr²). |
Source code in tdscha/QSpaceHessian.py
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 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 | |