# Phonon angular momentum near GM (crystod-mag --phonon-angular-momentum)
# Example directory: example/05-08_phonon_angular_momentum (testsuite section 05-08)
#
# The angular momentum l(q) of a phonon branch (L. Zhang and Q. Niu, Phys. Rev.
# Lett. 112, 085503 (2014)) is a real axial vector, odd under time reversal. An
# operation g = (R, t) of the magnetic point group (t: combined with time
# reversal, s = -1 if t else +1) acts on the wavevector by A = s R and on l by
# B = s det(R) R, and symmetry demands l(A q) = B l(q). Each Cartesian component
# l_i(q) near GM is therefore a polynomial in q with a lowest allowed degree n:
# s, p, d, f, g, h, i, j for n = 0..7 (the convention used here). crystod-mag
# gives, for every exported
# spin component, the lowest-degree polynomials of l_x, l_y and l_z and the
# nodal planes through GM pinned by a single operation (a mirror without time
# reversal whose plane contains e_i, or a 2' along the normal when e_i is along
# it). The pinned planes can be fewer than the degree
# (the group 4' gives l_z ~ q_z with no plane); the other nodes are then not
# fixed in position by symmetry, so both numbers are printed. P T makes l
# vanish at every q ("none (P T)"); degree 0 is the net magnetization.
#
# Symmetry fixes the forms, not the magnitudes. With ordinary (time-reversal
# even) force constants the phonons of a magnet have the symmetry of the grey
# group of the crystal: only the odd-degree forms of the paramagnetic row occur,
# l(-q) = -l(q). The even-degree textures (and every form beyond the
# paramagnetic row) need a time-reversal-odd term in the lattice dynamics, such
# as spin-phonon coupling.
#
# 1) Rutile TiO2 (P4_2/mnm), Ti at GM. The paramagnetic crystal is
#    centrosymmetric, its grey group 4/mmm1' contains P T: no angular momentum
#    from ordinary force constants. The altermagnetic GM2+ arrangement (moments
#    along z, MPG 4'/mmm', no net magnetization) allows l_z ~ q_x q_y, d-wave,
#    with the two nodal planes (100) and (010) -- the same pattern as the spin
#    splitting k_x k_y of the altermagnet, because z is an axis that every
#    operation maps to plus or minus itself.
#
#   crystod-mag -c 136_PPOSCAR_TiO2 --element Ti --qpoint GM --classify-only --phonon-angular-momentum
#
# writes the report samm_TiO2_Ti_GM_classify. Its new block:
#
#   * Phonon angular momentum allowed by symmetry *
#   basis                    component  MPG      l_x  l_x ~       planes  l_y  l_y ~       planes  l_z  l_z ~            planes
#   paramagnetic             -          4/mmm1'  -    none (P T)  -       -    none (P T)  -       -    none (P T)       -
#   GM3+(1) [FM, dipole]     z          4/mm'm'  d    q_x q_z     2       d    q_y q_z     2       s    const            0
#   ...
#   GM2+(1) [AFM, octupole]  z          4'/mmm'  d    q_y q_z     2       d    q_x q_z     2       d    q_x q_y          2
#
# Without --classify-only the same result is one line in every component block,
# after "collinear order:":
#
#   crystod-mag -c 136_PPOSCAR_TiO2 --element Ti --qpoint GM --phonon-angular-momentum
#
#     collinear order: altermagnet (d-wave; spin splitting allowed by symmetry ~ k_x k_y; spin-degenerate planes perpendicular to [100], [010])
#     phonon angular momentum: l_x ~ q_y q_z (d-wave; zero on the planes perpendicular to [010], [001]); l_y ~ q_x q_z (d-wave; zero on the planes perpendicular to [100], [001]); l_z ~ q_x q_y (d-wave; zero on the planes perpendicular to [100], [010])
#
# 2) Ferroelectric YMnO3 (P6_3cm), Mn at GM. The crystal is not centrosymmetric:
#    already the grey group 6mm1' allows l_x ~ q_y, l_y ~ q_x (p-wave) and
#    l_z ~ q_x q_y q_z (3 q_x^4 - 10 q_x^2 q_y^2 + 3 q_y^4), j-wave (degree 7)
#    with seven nodal planes. The magnetic ground state GM4 (P6_3'cm', MPG
#    6'mm') lowers l_z to the g-wave q_x q_z (q_x^2 - 3 q_y^2), four planes.
#
#   crystod-mag -c 185_PPOSCAR_YMnO3 --element Mn --qpoint GM --classify-only --phonon-angular-momentum
#
#   * Phonon angular momentum allowed by symmetry *
#   basis                       component  MPG    l_x  l_x ~  planes  l_y  l_y ~  planes  l_z  l_z ~                                             planes
#   paramagnetic                -          6mm1'  p    q_y    1       p    q_x    1       j    q_x q_y q_z (3 q_x^4 - 10 q_x^2 q_y^2 + 3 q_y^4)  7
#   GM1(1) [AFM, 64pole]        comp1      6mm    p    q_y    1       p    q_x    1       i    q_x q_y (3 q_x^4 - 10 q_x^2 q_y^2 + 3 q_y^4)      6
#   ...
#   GM4(1) [AFM, hexadecapole]  z          6'mm'  p    q_y    0       p    q_x    1       g    q_x q_z (q_x^2 - 3 q_y^2)                         4
#
# A component whose polynomials of the lowest degree span two dimensions has its
# second polynomial on a continuation line (GM5 of YMnO3: l_x ~ q_x, q_y).
#
# Files:
#   136_PPOSCAR_TiO2           rutile TiO2, primitive cell (as example/test_POSCARs)
#   185_PPOSCAR_YMnO3          P6_3cm YMnO3 (as example/05-06_mag_directions)
#   samm_TiO2_Ti_GM_classify   report of the first command
#   samm_YMnO3_Mn_GM_classify  report of the third command
#
# In Python (crystod.mag): phonon_angular_momentum(group) for a MagneticGroupInfo
# or for explicit rotations and time-reversal flags; plane_normal=[0, 0, 1] for a
# layer (q in the plane, nodal lines: the group 4' then gives the d-wave
# l_z ~ q_x^2 - q_y^2, q_x q_y); phonon_angular_momentum_degrees(...) lists every
# allowed degree n (the (n-1)-th order angular-momentum current response to a
# temperature gradient). See doc/crystod-mag.md section 05-08 and
# doc/theory-representations.md.
