Skip to content

JDFTx Inputs - boundary value checking#4410

Merged
shyuep merged 5 commits intomaterialsproject:masterfrom
benrich37:revise-tag-boundaries
May 19, 2025
Merged

JDFTx Inputs - boundary value checking#4410
shyuep merged 5 commits intomaterialsproject:masterfrom
benrich37:revise-tag-boundaries

Conversation

@benrich37
Copy link
Copy Markdown
Contributor

Summary

Major changes:

  • feature 1: Revised boundary checking for input tags
    -- Added a validate_value_bounds method to AbstractTag, that by default always returns True, ""
    -- Added an alternate AbstractNumericTag that inherits AbstractTag to implement validate_value_bounds properly
    --- Changed boundary storing to the following fields
    ---- ub and lb
    ----- Can either be None, or some value to indicate an upper or lower bound
    ---- ub_incl and lb_incl
    ----- If True, applies >= instead of > in comparative checks on upper and lower bounds
    -- Switched inheritance of FloatTag and IntTag from AbstractTag to AbstractNumericTag
    -- Implemented validate_value_bounds for TagContainer to dispatch checking for contained subtags
    -- Added a method validate_boundaries to JDFTXInfile to run validate_value_bounds on all contained tags and values
    -- Added validate_value_boundaries argument for initialization methods of JDFTXInfile, which will run validate_boundaries after initializing JDFTXInfile but before returning when True
    --- Note that this is explicitly disabled when initializing a JDFTXInfile from the input summary in a JDFTXOutfileSlice - boundary values may exist internally in JDFTx for non-inclusive bounded tags as the default values, but cannot be passed in the input file. For this reason, errors on boundary checking must be an easily disabled feature for the construction and manipulation of a JDFTXInfile, but out-of-bounds values must never be written when writing a file for passing to JDFTx.

Todos

  • feature 1
    -- Implement some way boundary checking can run when adding tags to a pre-existing JDFTXInfile object
    --- boundary checking is currently only run when initializing from a pre-existing collection of input tags
    --- writing this into JDFTXInfile.__setitem__ is too extreme as it would require adding an attribute to JDFTXInfile to allow disabling the check
    --- the better solution would be to implement a more obvious user-friendly method for reading in additional inputs so that the user doesn't need to learn how to properly write out the dictionary representation of complicated tag containers.
    -- Fill out reference tags for other unimplemented boundaries

@benrich37 benrich37 requested review from mkhorton and shyuep as code owners May 17, 2025 02:06
@shyuep shyuep merged commit 24cd680 into materialsproject:master May 19, 2025
43 checks passed
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