#include <spread_functional.hpp>
Public Member Functions | |
| SpreadFunctional (const KPointStencil &stencil, int number_of_wannier_functions, std::shared_ptr< const PhaseBranch > phase_branch=std::make_shared< const PrincipalPhaseBranch >()) | |
| SpreadTerms | evaluate (const BlochOverlaps &rotated_overlaps) const |
rotated_overlaps: N x N at every (k, b), between the Wannier-gauge states at k and k+b. | |
| std::vector< DenseMatrix< Complex > > | gradient (const BlochOverlaps &rotated_overlaps, const SpreadTerms &terms) const |
| int | number_of_wannier_functions () const |
Static Public Member Functions | |
| static Real | square_norm (const std::vector< DenseMatrix< Complex > > &gradients) |
| sum_k ||G^(k)||_F^2, the square norm the descent step is measured in. | |
Definition at line 96 of file spread_functional.hpp.
|
inline |
stencil must carry b-vectors: the centres are Berry phases along them. phase_branch is the branch every diagonal phase is read on; the principal one unless another is given.
Definition at line 103 of file spread_functional.hpp.
References q3::KPointStencil::has_b_vectors(), and number_of_wannier_functions().
|
inline |
rotated_overlaps: N x N at every (k, b), between the Wannier-gauge states at k and k+b.
<r^2>_n, accumulated with the centres and finished into Omega_n below.
The centres have to be complete before Omega_D can be evaluated at all – its summand measures each diagonal phase against the centre every k-point agreed on – so the diagonal phases are swept twice.
Definition at line 129 of file spread_functional.hpp.
References q3::BlochOverlaps::at(), q3::KPointStencil::b_vector(), q3::SpreadTerms::centers_bohr, q3::SpreadTerms::diagonal_bohr_squared, q3::Vector3D::dot(), q3::DenseMatrix< T >::frobenius_norm_squared(), q3::SpreadTerms::gauge_invariant_bohr_squared, q3::KPointStencil::number_of_directions(), q3::KPointStencil::number_of_kpoints(), q3::SpreadTerms::off_diagonal_bohr_squared, q3::SpreadTerms::spreads_bohr_squared, and q3::KPointStencil::weight().
Referenced by q3::MaximallyLocalizedGaugeChoice::choose(), and q3::ProjectionGaugeChoice::choose().
|
inline |
dOmega/dW at every k-point, N x N and anti-Hermitian, in the convention where a step along -gradient lowers Omega by the gradient's square norm per unit step. terms must be the evaluation of these same overlaps: the gradient depends on the centres, and centres from a different gauge silently give a gradient of a different function.
Omega carries a 1/N_k and so does its derivative, and the sign is fixed by the rotation this gradient is meant to be used with: U(k) -> U(k) exp(t D). Both were established against a central difference of Omega itself rather than read off the paper, because the paper's W is not necessarily this code's W – a convention that differs by a sign gives a minimiser that climbs, and one that differs by N_k gives a first step N_k times too long, which backtracking hides by quietly halving it back.
R_mn = M_mn conj(M_nn) and T_mn = (M_mn / M_nn) q_n, with q_n the diagonal phase measured against the centre. Both columns are scaled by a property of the DIAGONAL element of that column, which is what makes them column operations.
A[R] - S[T], assembled directly into the gradient: A[B] = (B - B^dagger)/2 contributes B/2 here and -conj(B)/2 at the transposed index, and S[B] = (B + B^dagger)/(2i) contributes B/(2i) and +conj(B)/(2i). Writing both halves as we go avoids materialising R and T at all.
Definition at line 203 of file spread_functional.hpp.
References q3::BlochOverlaps::at(), q3::KPointStencil::b_vector(), q3::SpreadTerms::centers_bohr, q3::Vector3D::dot(), q3::KPointStencil::number_of_directions(), q3::KPointStencil::number_of_kpoints(), and q3::KPointStencil::weight().
Referenced by q3::SpreadMinimizer::run().
|
inline |
Definition at line 124 of file spread_functional.hpp.
Referenced by SpreadFunctional().
|
inlinestatic |
sum_k ||G^(k)||_F^2, the square norm the descent step is measured in.
Definition at line 270 of file spread_functional.hpp.