Conversation
Replace O(N_cells·N²) dense distance allocation with matscipy cell-list neighbor detection (O(N·z̄)), then rebuild only the relevant cells differentiably from positions so autograd is preserved for forces/stress. Batch all k-points into a single eighb call instead of a Python for-loop, removing serial overhead and letting cuBLAS/LAPACK parallelize across k-points.
Optimize neighbor list and k-point eigensolver
- main.py: replace Fermi-based VBM/CBM with electron-counting on sorted
eigenvalues, plus a |E|>100 eV mask to ignore numerical garbage from
ill-conditioned eigh at boundary k-points.
- utils.py: replace unstable eigh(solve(S, H)) fallback with Löwdin
orthogonalisation (S^{-1/2} H S^{-1/2}) + clamp on tiny S eigenvalues
to prevent inverse-sqrt blow-up.
- predict_slakonet.py: mask |E| > 50 eV in band-plot before drawing so
matplotlib doesn't connect garbage k-points with vertical streaks.
- optim.py: fix save_safetensors to also serialise the trainable
r_*coef parameters (was silently writing r_spline=None when an
optimizer was in repulsive-only mode).
…he SKF - main.py:calculate_dos: replace nested k×band Python loop with a single vectorized broadcast over (E_grid, k, band), 2-5× speedup on DOS. - main.py:_solve_eigenvalue_problem: branch on with_eigenvectors and call new eighb_vals_only() when False — skips the eigenvector construction for DOS / bandgap-only paths (~30% wall on those queries). - utils.py:eighb chol path: use solve_triangular(L, ...) instead of inv(L) explicitly — more accurate, slightly faster, and cleaner. - utils.py: add eighb_vals_only() helper using triangular solve and a Löwdin fallback (eigvalsh) when Cholesky fails on ill-conditioned S. - main.py: cache pre-multiplied (×27.211 Ha→eV) on-device r_spline tensors per pair at SimpleDftb construction; _compute_repulsive_energy uses the cache instead of re-doing .to(device) and the H2E multiply on every iteration. Important for SCC's 30-60 evaluations. Bandgap audit on slakonet_v5_hybrid (54 materials) before / after: MAE: 1.01 -> 0.97 eV ; Spearman ρ: 0.73 -> 0.77. Si EOS still produces a clean BM curve (RMS 19 meV).
- main.py: add a DOS-based fallback for the bandgap. When the electron-count cut collapses to ~0 (e.g. SrTiO3 where the SKF basis doesn't cleanly partition Sr/Ti orbitals into valence/conduction), scan the eigenvalue spectrum for the largest empty interval whose midpoint sits within ±1.5 eV of the Fermi level and use that as the gap. Also override VBM/CBM to the chosen interval edges. - predict_slakonet plot: lower the per-k jump threshold for breaking polylines from 5 eV → 2 eV so connecting lines from VBM to CBM through the gap are clipped. - optim.py:compute_multi_element_properties: pass-through args for use_scc / kT / alpha / scc_max_iter / scc_tol so callers (esp. ionic compounds) can opt into SCC. Defaults preserved. - predict_slakonet CLI: new --use_scc flag plus --kT, --alpha. For oxides / halides / perovskites pass --use_scc --kT 0.1 --alpha 1.0 to get correct band edges. - optim.py:_get_electrons_for_element: fix the inconsistent factor of 2 between homo (returned sum) and hetero fallback (returned 2*sum). Both now return sum(occupations); SKF atomic_data already accounts for spin in the listed values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.