Skip to content

Compatibility with incoming update to JDFTx pymatgen-core IO module - #1659

Open
benrich37 wants to merge 2 commits into
materialsproject:mainfrom
benrich37:jdftx-parameters-without-msonable-keys
Open

benrich37 wants to merge 2 commits into
materialsproject:mainfrom
benrich37:jdftx-parameters-without-msonable-keys

Conversation

@benrich37

@benrich37 benrich37 commented Nov 17, 2026 •

Copy link
Copy Markdown

Required before overhaul parts 5-6 are merged (materialsproject/pymatgen-core#323 and materialsproject/pymatgen-core#324)

Summary

  • Fix: CalculationOutput.from_jdftxoutput now stores JDFTXOutfile.as_dict() in parameters without its top-level "@module"/"@class" keys.
    A pending pymatgen-core change (JDFTx IO module overhaul pymatgen-core#317) adds these keys so that JDFTXOutfile is a proper MSONable.
    With them, every flow that passes a JDFTx job's output (or part of it, e.g. .calc_outputs.structure) to a later job fails:
    jobflow resolves the reference with MontyDecoder, which turns the stored parameters dict back into a JDFTXOutfile,
    and pydantic rejects that for the parameters: dict field.
    With the currently pinned pymatgen-core (2026.10.16), as_dict() has no @ keys and this change does nothing,
    so it is safe to merge now and should be merged before the pymatgen-core change is released.
  • Test: new test_output_loads_from_store runs a single-point job into a memory store and resolves its output reference
    the way a downstream job does. With the pymatgen-core change it fails without this fix (pydantic dict_type error)
    and passes with it.
  • Test: tests/jdftx/sets/test_core.py accepts fluid-cation read as either a dict or a list, since the same
    pymatgen-core change reads repeatable tags such as fluid-cation as a list.

Checked locally: all pre-commit hooks pass, and pytest tests/jdftx passes with pymatgen-core 2026.10.16 (the CI pin)
and with the pymatgen-core change.

Additional dependencies introduced (if any)

  • None.

TODO (if any)

  • None.

Checklist

  • Code is in the standard Python style.
    The easiest way to handle this is to run the following in the correct sequence on
    your local machine. Start with running ruff and ruff format on your new code. This will
    automatically reformat your code to PEP8 conventions and fix many linting issues.
  • Doc strings have been added in the Numpy docstring format.
    Run ruff on your code.
  • Type annotations are highly encouraged. Run mypy to
    type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

Newer pymatgen-core includes "@module"/"@Class" in JDFTXOutfile.as_dict().
When a later job took this output as input, jobflow decoded the stored
parameters dict back into a JDFTXOutfile, which the dict field rejects.
Strip the "@" keys so parameters stays a plain dict.

Tests: add a round trip through the job store, and accept repeatable
tags such as fluid-cation being read as a list.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant