Skip to content

add organized and modular hydra configuration as well as 3 eigensolver modes: 1) cholesky transform (direct, ideal for dense matrices), 2) vqe (stub, we can populate later), and 3) lanczos algorithm (ideal for sparse matrices, near linear time complexity for extremal eigenvalues) - #7

Open
crhysc wants to merge 3 commits into
atomgptlab:mainfrom
crhysc:main

Conversation

@crhysc

@crhysc crhysc commented May 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

crhysc added 3 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.
Replaces JSON config + Pydantic BaseSettings + argparse with a structured
Hydra config hierarchy, making all hardcoded hyperparameters composable YAML
and ensuring training/prediction entry points are unit-testable without the
Hydra runtime.

Key changes:
- slakonet/conf.py: dataclass-based structured configs (DataConfig,
  TrainingConfig, OptimizerConfig, ModelConfig, PredictionConfig) that serve
  as the schema for both YAML files and direct OmegaConf instantiation in tests
- conf/: YAML config tree with groups data/, training/, optimizer/, model/,
  prediction/; includes training/quick.yaml for fast debug runs
- train_slakonet.py: run_training(cfg: DictConfig) callable + @hydra.main
- predict_slakonet.py: run_prediction(cfg: DictConfig) callable + @hydra.main;
  energy_range is now a typed list, not a split string
- optim.py: set_random_seed() extracted from module-level; kpoints, scheduler
  factor/patience, and regularization weights added as params to
  train_multi_vasp_skf_parameters; get_cache_dir fallback for jarvis compat
- tests/conftest.py: session-scoped model fixture, minimal_train_cfg via
  OmegaConf.structured (no Hydra runtime or network needed)
- tests/test_config.py: 6 schema/composition tests running in <0.25s
- tests/test_bands.py: default_model() moved to session fixture; tests use
  fixtures and run_training() directly
Introduces a SOLID-compliant plugin architecture for the generalized
eigenvalue solver used in SimpleDftb's forward pass. The solver
algorithm is now a first-class Hydra config group (eigsolver:
cholesky_eigh | lanczos | vqe), selectable at runtime without code
changes.

- slakonet/eigsolvers/: new module with _EigSolver ABC (mirrors
  _SkFeed), CholeskyEighSolver (the correctly-named former 'QR'
  solver), LanczosSolver (finds m lowest eigenvalues via Krylov
  subspace with normal/modified GS or selective reorthogonalization),
  VqeSolver stub, and make_eigsolver factory
- conf/eigsolver/: three YAML config files for each variant
- conf.py: CholeskyEighConfig, LanczosConfig, VqeConfig dataclasses
  registered as eigsolver Hydra group
- SimpleDftb accepts eigsolver=None (defaults to CholeskyEighSolver
  for backward compatibility); _solve_eigenvalue_problem delegates to
  self.eigsolver.solve
- Lanczos seed v_0 is detached; gradients flow through matrix-vector
  products with H_tilde and eigh(T) back to H and S
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