Skip to content

Velocity matrix transport - #332

Merged
ttadano merged 11 commits into
2.0devfrom
velocity-matrix-transport
Sep 13, 2026
Merged

ttadano merged 11 commits into
2.0devfrom
velocity-matrix-transport

Conversation

@ttadano

@ttadano ttadano commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

ttadano and others added 11 commits September 12, 2026 23:06
Phonon group velocities were obtained by central differences of the SORTED
eigenvalues at k +/- h. Wherever branches cross or are degenerate the sorted
index swaps character, so the difference quotient connects two different
branches. Inside a degenerate multiplet the eigenvectors are an arbitrary
basis, so per-mode velocities are not defined there at all; the velocity
matrix was additionally symmetrized element-wise over the little group of k,
which is a no-op only for the diagonal of a non-degenerate mode and
suppresses the velocities of degenerate ones. Both effects are large in
supercells, where zone folding manufactures degeneracies, but also affect
primitive cells with symmetry-enforced degenerate branches.

Test: Si (Stillinger-Weber cubic IFCs), primitive cell (2M)^3 mesh vs a
diagonal 2x supercell M^3 mesh, which sample identical absolute q points.
Before: 470.435 vs 322.883 W/m/K (tetrahedron), with a symmetry-forbidden
kappa_xy = 4.74 in the supercell. After: identical to relative 1e-15 at
M = 3..6 with Gaussian smearing, kappa_xy ~ 1e-13.

Default formulation (RTA and PRINTVEL):
- velocity matrix without element-wise symmetrization, with the
  nonanalytic contribution and its sublattice-phase connection term
  (calc_nonanalytic_k_* fold the sublattice phase into D_na, so its
  finite difference needs + i 2pi (t_j - t_i) D_na to match Allen's
  displacement-aware convention); NONANALYTIC = 3 uses fc2_without_dipole
  for the velocity matrix as eval_k_ewald does for the eigenproblem
- Peierls weights as degenerate-block traces Tr(P V^a P V^b P), coherent
  term over cross-block pairs only; boundary speed as the block mean
- blocks: subdivide the damping-averaging groups with an anchored 1e-6 cm^-1
  numerical tolerance; the worst splitting/linewidth ratio among merged
  blocks is reported since the band-like limit overestimates their weight
  by 1 + (dw/Gamma)^2
- band-path PRINTVEL differentiates with the segment direction (kvec_na)
  used by its eigenproblem

Cost: the full velocity matrix (nk ns^2 x 3 complex) is built only when
KAPPA_COHERENT = 1. Otherwise each k point is contracted on the fly to a
per-branch block diad (nk ns x 9 doubles). Eigenvector projections are
O(ns^3) matrix products; MPI gathers are chunked below INT_MAX/2.

Result files carry /kappa attribute "formulation" from checkpoint creation
on; accumulating mixed formulations in one file is refused at open.

ALAMODE_LEGACY_VELOCITY=1 restores the previous behaviour for comparison.
Legacy mode preserves the historical formulation within floating-point
roundoff; bitwise identity is not guaranteed because the Eigen projection
changes summation order, and result-file bytes differ in any case because
of the new /kappa "formulation" attribute.

Not changed: adaptive smearing (ISMEAR = 2) and the IBTE solver keep
finite-difference velocities and remain cell dependent; tetrahedron
linewidths remain cell dependent (sorted-branch interpolation).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Rename damping_groups -> freq_groups and reword the comments in
degeneracy_utils.h: the groups being subdivided are frequency-degeneracy
groups (the ones the damping is averaged over), and no damping value is
consulted when forming transport blocks. Comment and identifier change only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…mulation

The formulation check refused any restart whose file carried a different
transport formulation. That was over-conservative: the stored three-phonon
linewidths do not depend on the velocity formulation (boundary and isotope
terms are added at run time, adaptive widths use finite differences in both
formulations), and a plain restart recomputes every kappa slice from them.
Restarting a file written by an older version therefore reuses its gammas
and yields the recomputed kappa with the new stamp; the reverse (legacy
over a corrected file) likewise recomputes legacy kappa.

Mixing is now refused only where an old kappa value would actually survive
unrecomputed: a temperature-resolved file holding valid rows for
temperatures this run does not cover.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Theory page: group velocity from the velocity matrix (convention,
non-analytic connection term, no element-wise symmetrization, legacy
finite-difference path), degenerate-multiplet block traces in the
Peierls term and their exclusion from the coherent term, the
frequency-only block criterion and its reported error measure, the
block boundary speed, and the cell-independence remark with the paths
that remain cell dependent. Add Simoncelli, Marzari and Mauri, PRX 12,
041011 (2022).

Input page: RESTART now documents the formulation stamp and restart
compatibility; KAPPA_COHERENT documents the storage cost of the full
velocity matrix.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Introduce D-tilde for the dynamical matrix whose phase carries the full
interatomic separation, state its unitary relation to D, and write the
velocity matrix in terms of D-tilde and its eigenvectors, so that the
convention question reduces to which matrix is differentiated. Remove the
description of the element-wise symmetrization from the theory page; it is
an implementation detail documented in the source.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…is a convention

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
In the page's normalization the factor reduces to 1/(Gamma_j + Gamma_j'),
not 1/[2(Gamma_j + Gamma_j')]; the latter belongs to the code's convention
with a compensating prefactor. Make the equality with the Peierls weight
c v v tau explicit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… for cumulative kappa

The Peierls kappa of anphon is now assembled from the degenerate-block
velocity diad W^{mu nu}_{qj} = sum_{j' in B(j)} V^mu_{jj'} V^nu_{j'j}
(block trace), whereas analyzer.py rebuilt kappa from the stored
finite-difference velocities v^mu v^nu, so its cumulative and
boundary-limited kappa did not reproduce kappa_peierls of the run
(Si 8^3: 435.480 vs 445.110 W/mK).

anphon: write W per irreducible-point copy and branch as
/scattering/3ph/velocity_diad (shape {nequiv,ns,3,3}, or
{nt,nequiv,ns,3,3} in the temperature-resolved layout, unit (m/s)^2)
whenever the velocity-matrix formulation is active; legacy runs leave
the dataset out. A restart over a file from an older version creates it.

analyzer.py: read velocity_diad (and the /kappa formulation stamp) and
use W in place of v^mu v^nu in --calc kappa/cumulative/cumulative2 and
the boundary-scattering models, with sqrt(tr W) as the mode speed for
mean free paths; fall back to the finite-difference velocities on files
that lack the dataset, warning when the file's kappa was nevertheless
stamped with the velocity-matrix formulation.

Checks (Si, 8^3, Gaussian, KAPPA_COHERENT=1): default run writes
velocity_diad (512,6,3,3), analyzer --calc kappa and the large-L limit of
--calc cumulative/cumulative2 give 445.110 = kappa_peierls; legacy run
(ALAMODE_LEGACY_VELOCITY) keeps 435.480 on both sides; default restart
over the legacy file yields 445.110 and adds the dataset; the
temperature-resolved layout writes the (nt,...) slices.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ttadano
ttadano merged commit bc7b1cf into 2.0dev Sep 13, 2026
4 checks passed
@ttadano
ttadano deleted the velocity-matrix-transport branch September 13, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant