Skip to content

Conversation

benrich37
Copy link
Contributor

@benrich37 benrich37 commented May 22, 2025

Summary

Major changes:

  • feature 1: Convenience methods for comparing JDFTXInfile objects
    -- JDFTXInfile.is_comparable_to
    --- Returns True if at least one tag is found different
    --- Optional arguments exclude_tags, exclude_tag_categories, ensure_include_tags to ignore certain tags in the comparison
    ---- exclude_tag_categories defaults 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_to to get filtered differing tags between JDFTXInfile objects
    --- Convenient as a "verbose" alternative to JDFTXInfile.is_comparable_to
    -- AbstractTag.is_equal_to and AbstractTag._is_equal_to
    --- Used in tag comparison for finding differing tags
    --- AbstractTag._is_equal_to is an abstract method that must be implemented for each AbstractTag inheritor

  • feature 2: Default JDFTXInfile object pymatgen.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_from for tags in self missing from other that are identical to the default setting

  • fix 1: Re-ordered contents of JDFTXInfile to follow the order: magic methods -> class methods / transformation methods -> validation methods -> properties -> private methods

  • fix 2: Checking for 'selective_dynamics' in site_properties for a Structure passed in JDFTXInfile.from_structure (used if selective_dynamics argument left as None)

Todos

  • feature 1: Add examples to documentation on how to properly use new comparison methods
  • feature 2: Improve the mapping of 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 TagContainer needs 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

benrich37 and others added 17 commits May 21, 2025 14:48
…arameters for JDFTx, unwritten `is_comparable_to` method for `JDFTXInfile`
…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.
@benrich37 benrich37 marked this pull request as ready for review May 23, 2025 00:28
@benrich37 benrich37 requested review from shyuep and mkhorton as code owners May 23, 2025 00:28
@shyuep shyuep merged commit 55f70b2 into materialsproject:master May 23, 2025
43 checks passed
@benrich37 benrich37 deleted the jdftxinfile-is-comparable-to branch May 23, 2025 02:58
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