6.5. Numerical Precision¶
This section describes numerical precision considerations in \({\mathcal H}\Phi\).
6.5.1. Floating-Point Representation¶
\({\mathcal H}\Phi\) uses IEEE 754 double precision floating-point numbers throughout:
Real numbers: 64-bit double (
double)Complex numbers: 128-bit complex double (
double complex)
This provides approximately 15-16 significant decimal digits of precision.
6.5.2. Sources of Numerical Error¶
- Finite precision arithmetic
Each floating-point operation introduces small rounding errors. These accumulate during iterative algorithms.
- Cancellation errors
Subtracting nearly equal numbers can lose significant digits. This can occur in certain physical quantities near phase transitions.
- Overflow and underflow
Very large or small intermediate values can exceed the representable range. \({\mathcal H}\Phi\) is designed to avoid these in normal usage.
6.5.3. Convergence Criteria¶
\({\mathcal H}\Phi\) uses several convergence criteria:
- Lanczos eigenvalue convergence
The Lanczos iteration converges when the relative change in eigenvalue falls below a specified threshold (default: \(10^{-14}\), i.e.
LanczosEps = 14).- Eigenvector residual
The eigenvector accuracy is checked via \(|H|\psi\rangle - E|\psi\rangle|\).
- Orthogonality
For multiple eigenvalues, orthogonality between eigenvectors is maintained through reorthogonalization.
6.5.4. Setting Convergence Thresholds¶
The convergence thresholds are specified in the ModPara input file:
LanczosEpsInteger controlling the convergence threshold. For the Lanczos method, the iteration is judged to have converged when the relative error between an eigenvalue and that of the previous step becomes smaller than \(10^{- {\tt LanczosEps}}\) (default:
LanczosEps = 14). Formethod="CG", the calculation finishes when the 2-norm of the residual vector becomes smaller than \(10^{- {\tt LanczosEps}/2}\).LanczosTargetInteger giving the target eigenvalue used to judge convergence (e.g.
1for the ground state,2for the first excited state).Lanczos_maxMaximum number of iteration steps; the calculation finishes earlier once the threshold above is reached.
For most applications, the default values provide sufficient accuracy.
6.5.5. Validation and Testing¶
\({\mathcal H}\Phi\) includes test cases that verify:
Eigenvalue accuracy against known analytical results
Hermiticity of the Hamiltonian
Conservation of particle number and \(S_z\)
Consistency between different calculation methods
6.5.6. Recommendations¶
- Check physical quantities
Always verify that conserved quantities (particle number, \(S_z\), etc.) remain constant to within numerical precision.
- Compare methods
When possible, compare results from Lanczos and LOBPCG methods. Agreement indicates reliable results.
- System size dependence
Be cautious about extrapolating results to larger systems, as numerical errors may scale differently.
- Report anomalies
If you observe unexpected numerical behavior, please report it to the developers with a minimal reproducing example.