Skip to content

Commit e3f385c

Browse files
committed
Refactor: reorganize modules + add profile-driven per-basis SCF for pooled CorrNet training
Structural refactors: - Move deepks/io/input/ → deepks/config/ (packager, validator, defaults, loader, etc.) - Flatten deepks/orchestration/scheduler/job/ → deepks/orchestration/scheduler/ - Move ABACUS iterate/scf workflow files to deepks/workflows/iterate/abacus/ and deepks/workflows/scf/abacus/ - Move runtime reporting to deepks/io/reporting.py New feature: profile-driven per-basis SCF for non-hierarchical recipes - task_params.py: add resolve_scf_profile_levels() — drives per-basis SCF Sequence from physics.backend.profiles for any recipe (not gated on hierarchical-regression) - prepare.py: scf_levels = hierarchical_levels or profile_levels; use for main+init SCF - packager.py: use_profile_scf path sets pooled train data paths level.00/01/02 - validator.py: relax global orb_files requirement when profiles present; validate per-profile Enables training a single shared CorrNet on pooled sz/dzp/tzdp data in one iterate, testing basis-independence without the additive hierarchical stack.
1 parent 57999e7 commit e3f385c

91 files changed

Lines changed: 4815 additions & 1274 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codex

Whitespace-only changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Unified input configuration module for DeePKS."""
22

3-
from .config import normalize_config
3+
from .normalize import normalize_config
44
from .docs import render_input_parameter_doc
55
from .defaults import get_default_config
66
from .loader import load_config
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def render_input_parameter_doc():
327327
lines = [
328328
"# DeePKS input parameter reference",
329329
"",
330-
"> Generated from `deepks/io/input/docs.py`. Do not edit this file manually.",
330+
"> Generated from `deepks/config/docs.py`. Do not edit this file manually.",
331331
"",
332332
"## Preferred schema",
333333
"",
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ def pack_child(child_type, child_config):
333333
)
334334
hierarchical_train_groups = data.get("train", []) if isinstance(data.get("train"), list) else []
335335
hierarchical_test_groups = data.get("test", []) if isinstance(data.get("test"), list) else []
336+
scf_profiles = backend.get("profiles") if isinstance(backend.get("profiles"), list) else []
337+
use_profile_scf = bool(scf_profiles) and not hierarchical_levels
336338

337339
main_scf = {
338340
"recipe": deepcopy(main_config.get("recipe")),
@@ -393,8 +395,17 @@ def pack_child(child_type, child_config):
393395
resolved_terms = _resolve_hierarchical_terms(ml)
394396
if resolved_terms:
395397
main_train.setdefault("ml", {}).setdefault("objective", {})["terms"] = resolved_terms
398+
elif use_profile_scf:
399+
main_train["data"]["train"] = [
400+
f"../00.scf/level.{i:02d}/data_train/*" for i in range(len(scf_profiles))
401+
]
396402
if data.get("test") is not None:
397-
main_train["data"]["test"] = "data_test/*"
403+
if use_profile_scf:
404+
main_train["data"]["test"] = [
405+
f"../00.scf/level.{i:02d}/data_test/*" for i in range(len(scf_profiles))
406+
]
407+
else:
408+
main_train["data"]["test"] = "data_test/*"
398409
if isinstance(runtime.get("io"), dict):
399410
main_train["runtime"]["io"] = deepcopy(runtime["io"])
400411
if child_proj_basis:
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,30 @@ def _validate_iterate_config(config):
171171
if n_iter < 0:
172172
raise ValueError(f"'n_iter' must be non-negative, got {n_iter}")
173173

174+
physics = config.get("physics") if isinstance(config.get("physics"), dict) else {}
175+
backend = physics.get("backend") if isinstance(physics.get("backend"), dict) else {}
176+
scf_profiles = backend.get("profiles") if isinstance(backend.get("profiles"), list) else []
174177
backend_name = _validate_scf_backend_name(config)
175178
if backend_name == 'pyscf':
176179
_validate_pyscf_block(config)
177180
else:
178-
_validate_abacus_block(config, require_files=(recipe_name != HIERARCHICAL_REGRESSION_RECIPE_NAME))
181+
# Per-basis SCF profiles supply orb_files individually, so the global
182+
# physics.backend.input.orb_files requirement is relaxed when present.
183+
require_files = recipe_name != HIERARCHICAL_REGRESSION_RECIPE_NAME and not scf_profiles
184+
_validate_abacus_block(config, require_files=require_files)
185+
# Profile-driven per-basis SCF (non-hierarchical): each profile must
186+
# carry its own orb_files (or an input_template). The hierarchical
187+
# recipe validates its own profiles in _validate_hierarchical_iterate_config.
188+
if recipe_name != HIERARCHICAL_REGRESSION_RECIPE_NAME:
189+
for i, prof in enumerate(scf_profiles):
190+
prof_input = prof.get("input", {}) if isinstance(prof, dict) else {}
191+
has_orb = isinstance(prof_input, dict) and prof_input.get("orb_files")
192+
has_template = isinstance(prof, dict) and prof.get("input_template") is not None
193+
if not (has_orb or has_template):
194+
raise ValueError(
195+
f"physics.backend.profiles[{i}] requires 'input.orb_files' "
196+
"(or 'input_template') for per-basis SCF"
197+
)
179198

180199

181200
def _validate_hierarchical_iterate_config(config):

0 commit comments

Comments
 (0)