Loading...
Searching...
No Matches
q3::math::tolerances Namespace Reference

Variables

constexpr double bessel_argument_zero_threshold = 1e-8
 
constexpr double cell_volume_threshold = 1e-10
 
constexpr double d_matrix_element_threshold = 1e-15
 
constexpr int default_number_of_q_points_for_atomic_wavefunctions = 2000
 
constexpr double default_q_grid_spacing = 0.01
 
constexpr double default_symmetry_precision = 1e-5
 
constexpr double empty_band_tolerance_floor = 1e-5
 
constexpr double empty_band_tolerance_relaxation_factor = 5.0
 
constexpr double energy_consistency_threshold = 1e-8
 
constexpr double energy_cutoff_rounding_tolerance = 1e-8
 
constexpr double ewald_convergence_threshold = 1e-7
 
constexpr double fermi_electron_count_plateau = 1e-6
 
constexpr double fermi_energy_bisection_convergence = 1e-12
 
constexpr double fractional_translation_rounding_tolerance = 1e-3
 
constexpr double gaunt_coefficient_threshold = 1e-6
 
constexpr double initial_eigenvalue_tolerance = 1e-2
 
constexpr double iterative_solver_norm_threshold = 1e-14
 
constexpr double kpoint_gamma_threshold = 1e-10
 
constexpr double kpoint_grid_offset_tolerance = 1e-6
 
constexpr double kpoint_weight_sum = 1e-6
 
constexpr double lattice_shell_relative_width = 1e-6
 
constexpr double lowdin_minimum_overlap_eigenvalue = 1e-10
 
constexpr double minimum_eigenvalue_tolerance = 1e-13
 
constexpr double minimum_electron_density = 1e-12
 
constexpr double minimum_finite_difference_step = 1e-10
 
constexpr double numerical_zero_threshold = 1e-12
 
constexpr double occupation_threshold = 1e-10
 
constexpr double preconditioner_denominator_floor = 1e-4
 
constexpr double radial_integration_truncation_radius = 10.0
 
constexpr double reciprocal_space_finite_difference_step = 1e-5
 
constexpr double relative_change_scale_floor = 1e-30
 
constexpr double smearing_width_threshold = 1e-10
 
constexpr double stress_finite_difference_scale = 1e-6
 
constexpr bool use_radial_integration_truncation = true
 
constexpr double wannier_diagonal_overlap_threshold = 1e-10
 
constexpr double wannier_negative_spread_tolerance = 1e-8
 
constexpr double wannier_projection_singular_value_threshold = 1e-8
 
constexpr double zero_vector_magnitude_threshold = 1e-10
 

Variable Documentation

◆ bessel_argument_zero_threshold

constexpr double q3::math::tolerances::bessel_argument_zero_threshold = 1e-8
inlineconstexpr

Threshold below which a spherical Bessel function argument is treated as zero.

Definition at line 158 of file tolerances.hpp.

Referenced by q3::spherical_bessel(), and q3::spherical_bessel_batch().

◆ cell_volume_threshold

constexpr double q3::math::tolerances::cell_volume_threshold = 1e-10
inlineconstexpr

Threshold below which a cell volume is treated as zero (uninitialized).

Definition at line 104 of file tolerances.hpp.

Referenced by q3::PlanewaveChargeDensity::get_total_charge().

◆ d_matrix_element_threshold

constexpr double q3::math::tolerances::d_matrix_element_threshold = 1e-15
inlineconstexpr

◆ default_number_of_q_points_for_atomic_wavefunctions

constexpr int q3::math::tolerances::default_number_of_q_points_for_atomic_wavefunctions = 2000
inlineconstexpr

Default number of q-points for atomic wavefunction interpolation tables.

Definition at line 114 of file tolerances.hpp.

Referenced by q3::NormConservingPlanewaveWavefunctionInitializer::initialize_interpolation_table().

◆ default_q_grid_spacing

constexpr double q3::math::tolerances::default_q_grid_spacing = 0.01
inlineconstexpr

Default q-grid spacing (in atomic units) for radial Fourier transform interpolation tables.

Definition at line 109 of file tolerances.hpp.

Referenced by q3::BetaFunctionTable::initialize().

◆ default_symmetry_precision

constexpr double q3::math::tolerances::default_symmetry_precision = 1e-5
inlineconstexpr

Default symmetry precision for spglib operations (in Bohr).

Definition at line 134 of file tolerances.hpp.

◆ empty_band_tolerance_floor

constexpr double q3::math::tolerances::empty_band_tolerance_floor = 1e-5
inlineconstexpr

Definition at line 66 of file tolerances.hpp.

Referenced by q3::PlanewaveDavidsonDiagonalizer::solve().

◆ empty_band_tolerance_relaxation_factor

constexpr double q3::math::tolerances::empty_band_tolerance_relaxation_factor = 5.0
inlineconstexpr

Empty (unoccupied) bands converge to a looser tolerance than occupied bands: their eigenvalues do not enter the total energy, so tight convergence is wasted work. The effective empty-band tolerance is max(empty_band_tolerance_relaxation_factor * tolerance, empty_band_tolerance_floor).

Both numbers are iteration-path knobs, not answers: they decide when a band stops being refined, never what it converges to, so no result in the test suite distinguishes these values from neighbouring ones. The floor is what stops the relaxed tolerance chasing the occupied one down as the SCF tightens; the factor is small enough that a badly-converged empty band still cannot pollute the subspace it spans.

Definition at line 65 of file tolerances.hpp.

Referenced by q3::PlanewaveDavidsonDiagonalizer::solve().

◆ energy_consistency_threshold

constexpr double q3::math::tolerances::energy_consistency_threshold = 1e-8
inlineconstexpr

Default threshold for energy consistency checks.

Definition at line 231 of file tolerances.hpp.

◆ energy_cutoff_rounding_tolerance

constexpr double q3::math::tolerances::energy_cutoff_rounding_tolerance = 1e-8
inlineconstexpr

◆ ewald_convergence_threshold

constexpr double q3::math::tolerances::ewald_convergence_threshold = 1e-7
inlineconstexpr

Ewald summation convergence check threshold.

Also used by MartynaTuckermanCorrectionCalculator's convergence-parameter search (select_convergence_parameters()), which bounds the same kind of erf/erfc-smoothed reciprocal-space truncation error, at the same value Quantum ESPRESSO uses when it sets up its own Martyna-Tuckerman correction.

Definition at line 226 of file tolerances.hpp.

Referenced by q3::EwaldStressTensorCalculator::compute(), q3::EwaldForceCalculator::compute(), and q3::compute_ewald().

◆ fermi_electron_count_plateau

constexpr double q3::math::tolerances::fermi_electron_count_plateau = 1e-6
inlineconstexpr

Electron-count slack that still counts as "on the plateau" when bracketing a gap to place E_F at its midpoint.

Across a gap the smeared electron count equals the target only up to the occupation tails, so the upper-edge bisection needs a tolerance rather than an exact equality. Loose enough to span a real gap's residual tails. A metal has a bracket too, this slack over its density of states, and the midpoint of that one would leave half the slack in the cell as extra charge; the calculator tells the two apart by comparing the bracket with the smearing width, not by this value.

Definition at line 177 of file tolerances.hpp.

◆ fermi_energy_bisection_convergence

constexpr double q3::math::tolerances::fermi_energy_bisection_convergence = 1e-12
inlineconstexpr

Convergence threshold for Fermi energy bisection.

Definition at line 163 of file tolerances.hpp.

◆ fractional_translation_rounding_tolerance

constexpr double q3::math::tolerances::fractional_translation_rounding_tolerance = 1e-3
inlineconstexpr

How far a fractional translation component may sit from 1/n and still be read as 1/n when the FFT grid is asked to be divisible by n.

The translations come from spglib and are accurate to the symmetry precision it was given, so the bound has to be at least that loose; it is two orders looser so that tightening that precision never starts rejecting a genuine fraction. What it must separate is coarser than either number by far: the closest competing value for the smallest accepted denominator is 1/6 against 1/5 or 1/7, 0.03 away, and the difference that motivated checking at all – 0.375 read as 1/3 – is 0.04 away.

Definition at line 148 of file tolerances.hpp.

Referenced by q3::FFTGridSizer::fft_factor_for_fractional_translation().

◆ gaunt_coefficient_threshold

constexpr double q3::math::tolerances::gaunt_coefficient_threshold = 1e-6
inlineconstexpr

Threshold below which a Gaunt coefficient is considered insignificant.

Definition at line 71 of file tolerances.hpp.

Referenced by q3::generate_gaunt_coefficients().

◆ initial_eigenvalue_tolerance

constexpr double q3::math::tolerances::initial_eigenvalue_tolerance = 1e-2
inlineconstexpr

Initial eigenvalue diagonalization tolerance for early SCF iterations.

Definition at line 206 of file tolerances.hpp.

Referenced by q3::PlanewaveKohnShamSCFIterator::set_diagonalization_tolerance().

◆ iterative_solver_norm_threshold

constexpr double q3::math::tolerances::iterative_solver_norm_threshold = 1e-14
inlineconstexpr

Threshold below which a vector norm squared is treated as zero in iterative solvers. Used in Davidson diagonalizer for residual norm and orthogonalization checks.

Definition at line 39 of file tolerances.hpp.

Referenced by q3::GPUPlanewaveSubspaceManager::orthogonalize_batch(), and q3::SerialPlanewaveSubspaceManager::orthogonalize_batch().

◆ kpoint_gamma_threshold

constexpr double q3::math::tolerances::kpoint_gamma_threshold = 1e-10
inlineconstexpr

Threshold for the sum of |k_x| + |k_y| + |k_z| (in crystal coordinates) below which a k-point is treated as the Gamma point.

Definition at line 242 of file tolerances.hpp.

◆ kpoint_grid_offset_tolerance

constexpr double q3::math::tolerances::kpoint_grid_offset_tolerance = 1e-6
inlineconstexpr

How far n * k may sit from the common grid offset, in units of the grid step, and still count as a point of an n-division grid when a grid is recovered from an explicit k-point list.

Listed coordinates carry their printing noise, ~1e-10, which the largest grid tried (1000 divisions) magnifies to ~1e-7. A point genuinely off an n-division grid, k = p/m, misses it by at least 1/m of a step – 1e-3 for the finest grid tried. A q0 displacement of the whole list is common to every point, so it moves the offset rather than the test.

Definition at line 201 of file tolerances.hpp.

Referenced by q3::BerkeleyGWCommonHeader::complete_kpoint_grid().

◆ kpoint_weight_sum

constexpr double q3::math::tolerances::kpoint_weight_sum = 1e-6
inlineconstexpr

How far a k-point weight sum may sit from the spin degeneracy and still count as a Brillouin-zone sampling.

Loose because the sum is built from symmetry multiplicities over a point count and carries ordinary rounding; the case it exists to catch misses by whole integers rather than by rounding, since a band path gives every point weight 1 and its sum is the number of points.

Definition at line 188 of file tolerances.hpp.

◆ lattice_shell_relative_width

constexpr double q3::math::tolerances::lattice_shell_relative_width = 1e-6
inlineconstexpr

Relative width of a shell of lattice vectors: two |R| closer than this share a shell when the decay of a real-space Hamiltonian is measured on its outermost one.

Definition at line 270 of file tolerances.hpp.

◆ lowdin_minimum_overlap_eigenvalue

constexpr double q3::math::tolerances::lowdin_minimum_overlap_eigenvalue = 1e-10
inlineconstexpr

Minimum overlap-matrix eigenvalue accepted by Lowdin orthogonalization. Below this the atomic-orbital overlap S is treated as singular (linearly dependent orbitals) and S^{-1/2} would amplify noise by >= 1e5.

Definition at line 78 of file tolerances.hpp.

Referenced by q3::compute_lowdin_transform().

◆ minimum_eigenvalue_tolerance

constexpr double q3::math::tolerances::minimum_eigenvalue_tolerance = 1e-13
inlineconstexpr

Floor for adaptive eigenvalue tolerance to prevent numerical issues.

Definition at line 211 of file tolerances.hpp.

Referenced by q3::KohnShamSCFIterator::diagonalization_threshold(), q3::KohnShamSCFIterator::perform_iteration(), and q3::NonSelfConsistentFieldFlavor::run_calculation().

◆ minimum_electron_density

constexpr double q3::math::tolerances::minimum_electron_density = 1e-12
inlineconstexpr

Minimum electron density value to prevent division by zero in XC functionals.

Definition at line 216 of file tolerances.hpp.

Referenced by q3::XC_LibXC::compute_spin().

◆ minimum_finite_difference_step

constexpr double q3::math::tolerances::minimum_finite_difference_step = 1e-10
inlineconstexpr

Minimum finite difference step for numerical derivatives.

Definition at line 33 of file tolerances.hpp.

◆ numerical_zero_threshold

constexpr double q3::math::tolerances::numerical_zero_threshold = 1e-12
inlineconstexpr

◆ occupation_threshold

◆ preconditioner_denominator_floor

constexpr double q3::math::tolerances::preconditioner_denominator_floor = 1e-4
inlineconstexpr

◆ radial_integration_truncation_radius

constexpr double q3::math::tolerances::radial_integration_truncation_radius = 10.0
inlineconstexpr

Truncation radius (Bohr) for radial integration.

Definition at line 94 of file tolerances.hpp.

Referenced by q3::NormConservingPlanewaveBasis::compute_mesh_truncation_sizes(), and q3::tabulate_atomic_wavefunctions_in_q_space().

◆ reciprocal_space_finite_difference_step

constexpr double q3::math::tolerances::reciprocal_space_finite_difference_step = 1e-5
inlineconstexpr

Finite difference step size for numerical gradient computation in reciprocal space.

Definition at line 153 of file tolerances.hpp.

◆ relative_change_scale_floor

constexpr double q3::math::tolerances::relative_change_scale_floor = 1e-30
inlineconstexpr

Floor on the magnitude a relative change is measured against, so that an objective that has reached exactly zero has a relative change at all.

Definition at line 45 of file tolerances.hpp.

Referenced by q3::ConvergenceWindow::has_converged().

◆ smearing_width_threshold

constexpr double q3::math::tolerances::smearing_width_threshold = 1e-10
inlineconstexpr

Threshold below which a smearing width is treated as zero (insulating).

Definition at line 124 of file tolerances.hpp.

Referenced by q3::PlanewaveKohnShamSCFIterator::resolve_number_of_bands(), and q3::SmearingScheme::uses_smearing().

◆ stress_finite_difference_scale

constexpr double q3::math::tolerances::stress_finite_difference_scale = 1e-6
inlineconstexpr

Relative finite difference step scale for stress tensor gradient computation.

Definition at line 236 of file tolerances.hpp.

◆ use_radial_integration_truncation

constexpr bool q3::math::tolerances::use_radial_integration_truncation = true
inlineconstexpr

─── Physics-Specific Thresholds ───────────────────────────────────────────── These encode domain knowledge about DFT, plane-wave methods, or specific physical quantities. Whether to truncate radial integrations at a finite radius.

Definition at line 89 of file tolerances.hpp.

Referenced by q3::NormConservingPlanewaveBasis::compute_mesh_truncation_sizes(), and q3::tabulate_atomic_wavefunctions_in_q_space().

◆ wannier_diagonal_overlap_threshold

constexpr double q3::math::tolerances::wannier_diagonal_overlap_threshold = 1e-10
inlineconstexpr

Modulus of a diagonal neighbour overlap M_nn(k,b) below which the Berry phase of Wannier function n – its centre and its spread – is undefined: the gauge has collapsed.

Definition at line 256 of file tolerances.hpp.

◆ wannier_negative_spread_tolerance

constexpr double q3::math::tolerances::wannier_negative_spread_tolerance = 1e-8
inlineconstexpr

How negative the gauge-invariant spread may come out, per Wannier function in bohr squared, before it is read as overlaps that are not between orthonormal states rather than as rounding. Omega_I cannot be negative.

Definition at line 263 of file tolerances.hpp.

◆ wannier_projection_singular_value_threshold

constexpr double q3::math::tolerances::wannier_projection_singular_value_threshold = 1e-8
inlineconstexpr

Smallest singular value of the trial-orbital projection A(k) below which the orbitals are taken not to span the target manifold at that k-point: the projection gauge A (A^dagger A)^(-1/2) is then singular, and is refused.

Definition at line 249 of file tolerances.hpp.

◆ zero_vector_magnitude_threshold