Skip to content

Add POT_NS_CUTOFF / POT_NS_WRITE_CUTOFF keys to kkrparams - #255

Merged
Irratzo merged 1 commit into
developfrom
feat/pot-ns-cutoff-keys
Sep 27, 2026
Merged

Irratzo merged 1 commit into
developfrom
feat/pot-ns-cutoff-keys

Conversation

@Irratzo

@Irratzo Irratzo commented Sep 27, 2026

Copy link
Copy Markdown
Member

Adds keys for the two places where KKR cuts the non-spherical potential channels (LM ≥ 2):

key code meaning default (set by the KKR code when unset)
POT_NS_CUTOFF KKRimp (new here; KKRhost already had it) cutoff applied to the potential in memory every iteration 0.1 · QBOUND
POT_NS_WRITE_CUTOFF KKRimp and KKRhost (new) a channel is written to the output potential only if its norm exceeds this value QBOUND (today's behaviour)

POT_NS_CUTOFF is read by KKRimp config.f90 and KKRhost rinput13.F90. POT_NS_WRITE_CUTOFF is being added in jukkr (branch fix/kkrimp-pot-ns-write-cutoff); older binaries ignore keys they don't know. The motivation, from aiida-kkr: its straight-mixing step runs at QBOUND = 1e-2, so the potential written for the next step has lost every channel below that. This costs about 20 iterations for near-converged starts.

Format change: the existing KKRhost POT_NS_CUTOFF switches from %f to %e. The writer turns %f into %21.12f, which keeps only 5 significant digits at 1e-8 (1.23456e-8 → 0.000000012346) and writes values below 1e-12 as zero. It is now written as POT_NS_CUTOFF= 1.234560e-08. No stored test data in masci-tools or aiida-kkr sets this key. The new keys also use %e, like QBOUND.

Only the keyword tables (masci_tools/io/data_kkrparams/*.json) change; the generic KEY= value writer needs nothing else. kkrparams cannot read config.cfg back in (read_keywords_from_inputcard handles only KKRhost inputcards); that limitation already existed and doesn't affect aiida-kkr.

Tests: new test_pot_ns_cutoff_keys, which writes config.cfg and an inputcard and reads the inputcard back. Two kkrparams snapshot files gain POT_NS_WRITE_CUTOFF: null, the only change. CI is red on develop independently of this PR (#252).

KKRimp: add POT_NS_CUTOFF (non-spherical potential cutoff applied every
iteration, read by KKRimp config.f90, default 0.1*QBOUND) and
POT_NS_WRITE_CUTOFF (non-spherical channels are written to the output
potential only if their norm exceeds this value, default QBOUND).
KKRhost: add POT_NS_WRITE_CUTOFF.

All are optional reals written as '%e'. The existing KKRhost
POT_NS_CUTOFF also switches from '%f' (written as '%21.12f', i.e. few
significant digits for small cutoffs and zero below 1e-12) to '%e'.
Only the keyword tables change; the generic writer needs nothing else.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

Only a minor changelog precision nit was identified; no blocking issues remain.

Review effort: Lite
Findings: None

What changed in this PR

Adds POT_NS_CUTOFF and POT_NS_WRITE_CUTOFF support for KKRhost and KKRimp.

Changes:

  • Updates KKRhost and KKRimp keyword definitions.
  • Changes KKRhost cutoff formatting from %f to %e.
  • Adds regression tests and updates snapshots and changelog.
File Summary
tests/​test_kkrparams/​test_read_slab.yml Updates expected parameter snapshot.
tests/​test_kkrparams/​test_get_dict.yml Updates expected dictionary snapshot.
tests/​test_kkrparams.py Adds cutoff serialization and parsing tests.
masci_tools/​io/​data_kkrparams/​defaults_kkrimp.json Adds KKRimp cutoff definitions.
masci_tools/​io/​data_kkrparams/​defaults_kkrhost.json Adds the KKRhost write cutoff and updates formatting.
CHANGELOG.md Documents the new keys and formatting change.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants