Skip to content

Develop - #8

Merged
knc6 merged 13 commits into
mainfrom
develop
May 21, 2026
Merged

knc6 merged 13 commits into
mainfrom
develop

Conversation

@knc6

@knc6 knc6 commented May 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

crhysc and others added 13 commits April 24, 2026 11:50
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.
@knc6
knc6 merged commit b40a754 into main May 21, 2026
2 checks passed
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