JDFTXInfile Comparison Methods#4416
Merged
shyuep merged 17 commits intomaterialsproject:masterfrom May 23, 2025
Merged
Conversation
…arameters for JDFTx, unwritten `is_comparable_to` method for `JDFTXInfile`
…s format option for `MultiformatTag`s
…e set as a list with elements of different format options, changing `JDFTXStructure.get_str` to build a dictionary representation of each ion instead of a list (not sure how it was even working before)
…ity handler, and now `_is_equal_to` to the abstractmethod to be implemented which compares two non-list values
…e objects, along convenience arguments to filter which tags to pay attention to. Not sure if `is_comparable_to` is implementable in a way generalizable enough to be useful.
…y in implementations
… `JDFTXInfile.from_structure`
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:
feature 1: Convenience methods for comparing
JDFTXInfileobjects--
JDFTXInfile.is_comparable_to--- Returns True if at least one tag is found different
--- Optional arguments
exclude_tags,exclude_tag_categories,ensure_include_tagsto ignore certain tags in the comparison----
exclude_tag_categoriesdefaults to["export", "restart", "structure"]as"export"and"restart"are very rarely pertinent to comparability,"structure"as subtags of this category are generally the one thing being intentionally changed in comparisons (ie different local minima or a slab with/without an adsorbate)--
JDFTXInfile.get_filtered_differing_tags--- What is used in
JDFTXInfile.is_comparable_toto get filtered differing tags betweenJDFTXInfileobjects--- Convenient as a "verbose" alternative to
JDFTXInfile.is_comparable_to--
AbstractTag.is_equal_toandAbstractTag._is_equal_to--- Used in tag comparison for finding differing tags
---
AbstractTag._is_equal_tois an abstract method that must be implemented for eachAbstractTaginheritorfeature 2: Default
JDFTXInfileobjectpymatgen.io.jdftx.inputs.ref_infile-- Initialized from reading default JDFTx settings from
pymatgen.io.jdftx.jdftxinfile_default_inputs.default_inputs: dict-- Used in
JDFTXInfile.get_differing_tags_fromfor tags inselfmissing fromotherthat are identical to the default settingfix 1: Re-ordered contents of
JDFTXInfileto follow the order: magic methods -> class methods / transformation methods -> validation methods -> properties -> private methodsfix 2: Checking for
'selective_dynamics'insite_propertiesfor aStructurepassed inJDFTXInfile.from_structure(used ifselective_dynamicsargument left asNone)Todos
TagContainers to their default values-- The current implementation of comparison for tags to default values only works if the tag as written exactly matches the full default value - at the very least the missing subtags of a partially filled
TagContainerneeds to be filled with the default values before comparing to the full default value-- Some subtags also change depending on the other subtags present for a particular tag (ie convergence threshold depending on algorithm specified for
'fluid-minimize', so an improved mapping for dynamic default values needs to be implemented