Skip to content

Feat arbitrary custom tags#45

Open
jkshenton wants to merge 2 commits into
mainfrom
feat-arbitrary-custom-tags
Open

Feat arbitrary custom tags#45
jkshenton wants to merge 2 commits into
mainfrom
feat-arbitrary-custom-tags

Conversation

@jkshenton
Copy link
Copy Markdown
Collaborator

This pull request enhances the flexibility and robustness of the FEFF configuration handling in the codebase. The main improvements are the introduction of support for arbitrary FEFF card tags (custom tags), improved normalization and merging logic for configuration parameters, and a refactor of how configuration data is loaded from presets and YAML files. These changes make it easier for users to specify custom FEFF input cards and ensure that configuration parsing is more consistent and maintainable.

Support for arbitrary FEFF card tags:

  • Added a custom_tags field to the FeffConfig dataclass, allowing users to specify any FEFF card/tag by name and value, which are then included verbatim in the FEFF input. [1] [2]
  • Extended the to_pymatgen_user_tags method to include custom FEFF tags when generating the user tag dictionary.

Configuration normalization and parsing improvements:

  • Introduced normalization methods for custom_tags and delete_tags, ensuring all tags are consistently uppercased and deduplicated, and that both standard and custom tags can be marked for deletion if set to None.
  • Added logic to merge and normalize custom tags and delete tags, handling explicit None values and preventing duplicates.

Refactor of configuration loading:

  • Refactored the from_preset and from_yaml class methods to use a new _prepare_init_params helper, which partitions known configuration fields from custom FEFF tags and applies normalization. This makes the loading process more robust and extensible.

Internal improvements:

  • Updated imports to include field and fields from dataclasses, enabling dynamic field handling and default dictionary creation for custom tags.
  • Ensured that post-initialization normalization is applied to custom_tags in the __post_init__ method of FeffConfig.

Kane Shenton added 2 commits February 2, 2026 10:35
add custom_tags handling plus shared _prepare_init_params pipeline for presets/YAML so unexpected keys are treated as user tags instead of constructor errors
normalize delete lists and custom-card keys (uppercased, deduped) before instantiation, and serialize them into to_pymatgen_user_tags so FEFF inputs can include tags like CORRECTIONS while keeping _del cleanup behavior consistent
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21587679734

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 156 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.6%) to 70.182%

Files with Coverage Reduction New Missed Lines %
feff_utils.py 156 70.72%
Totals Coverage Status
Change from base Build 19245476578: -0.6%
Covered Lines: 1544
Relevant Lines: 2200

💛 - Coveralls

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