JDFTx Inputs - boundary value checking#4410
Merged
shyuep merged 5 commits intomaterialsproject:masterfrom May 19, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Major changes:
-- Added a
validate_value_boundsmethod toAbstractTag, that by default always returnsTrue, ""-- Added an alternate
AbstractNumericTagthat inheritsAbstractTagto implementvalidate_value_boundsproperly--- Changed boundary storing to the following fields
----
ubandlb----- Can either be
None, or some value to indicate an upper or lower bound----
ub_inclandlb_incl----- If True, applies
>=instead of>in comparative checks on upper and lower bounds-- Switched inheritance of
FloatTagandIntTagfromAbstractTagtoAbstractNumericTag-- Implemented
validate_value_boundsforTagContainerto dispatch checking for contained subtags-- Added a method
validate_boundariestoJDFTXInfileto runvalidate_value_boundson all contained tags and values-- Added
validate_value_boundariesargument for initialization methods ofJDFTXInfile, which will runvalidate_boundariesafter initializingJDFTXInfilebut before returning when True--- Note that this is explicitly disabled when initializing a
JDFTXInfilefrom the input summary in aJDFTXOutfileSlice- 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 aJDFTXInfile, but out-of-bounds values must never be written when writing a file for passing to JDFTx.Todos
-- Implement some way boundary checking can run when adding tags to a pre-existing
JDFTXInfileobject--- 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 toJDFTXInfileto 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