Skip to content

Deprecate composition overrides in favor of direct CIF specification - #34

Merged
laubachb merged 2 commits into
refactorfrom
laubachb/starting-material-safety
Jul 30, 2026
Merged

Deprecate composition overrides in favor of direct CIF specification#34
laubachb merged 2 commits into
refactorfrom
laubachb/starting-material-safety

Conversation

@laubachb

Copy link
Copy Markdown
Collaborator

Summary

Deprecates the transition_metal and group_iv composition override fields in IntermetallicConfig. Users should now specify the starting material directly via the CIF file, with automatic validation that f-block elements are compatible with the search mode.

Motivation

The previous approach of using a template CIF + composition overrides was confusing and not future-proof for:

  • Structures with vacancies or partial occupancies
  • Doped materials
  • Complex starting compositions beyond simple element substitution

Direct CIF specification makes the starting material explicit and enables more sophisticated structure definitions.

Changes

1. Config Validation (core/config.py)

  • Deprecation warnings: transition_metal/group_iv fields now emit DeprecationWarning
  • F-block validation (when overrides NOT used):
    • f_block_mode='u_only': requires U (atomic 92) in CIF
    • f_block_mode='lanthanides_u' or 'lanthanides_u_no_wrap': requires lanthanides (57-71) or U (92)
    • f_block_mode='full_f_block': accepts all f-block elements
    • Warns if no f-block elements found (allows for testing)

2. Builder Documentation (cli/builders.py)

  • Added deprecation comment above composition override logic
  • Logic unchanged for backward compatibility

3. Documentation

  • Created REFACTOR_NOTES.md with full migration guide
  • Added examples/config_intermetallic_new_style.yaml showing new approach

Backward Compatibility

All existing configs continue to work (with deprecation warnings)

  • The 18 sensitivity study configs using overrides are unaffected
  • Override mechanism in builders.py remains functional
  • Validation skipped when overrides are present

Migration Example

Before (deprecated):

intermetallic:
  structure_path: mat_Pb6U1W6_sg191.cif  # Template
  transition_metal: Cr
  group_iv: Sn
  f_block_mode: u_only

@laubachb
laubachb requested a review from yingwaili July 30, 2026 18:40
@laubachb laubachb self-assigned this Jul 30, 2026
@laubachb laubachb added the enhancement New feature or request label Jul 30, 2026
@laubachb
laubachb merged commit 9b333bc into refactor Jul 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant