Skip to content

Add MPRester.get_charge_density_from_task_id()#929

Merged
tschaume merged 1 commit intomaterialsproject:mainfrom
teddykoker:charge-density-from-task-id
Aug 19, 2024
Merged

Add MPRester.get_charge_density_from_task_id()#929
tschaume merged 1 commit intomaterialsproject:mainfrom
teddykoker:charge-density-from-task-id

Conversation

@teddykoker
Copy link
Copy Markdown
Contributor

@teddykoker teddykoker commented Aug 6, 2024

Summary

Fixes #924

Major changes:

  • Added MPRester.get_charge_density_from_task_id() to obtain charge densities from task id

Todos

Note that the test_get_charge_density_from_material_id() is currently failing, and was failing independently of this PR. This is due to an issue in emmet from task.search:

    def model_post_init(self, __context: Any) -> None:
        # Always refresh task_type, calc_type, run_type
        # See, e.g. https://github.com/materialsproject/emmet/issues/960
        # where run_type's were set incorrectly in older versions of TaskDoc
    
        # To determine task and run type, we search for input sets in this order
        # of precedence: calcs_reversed, inputs, orig_inputs
>       for inp_set in [self.calcs_reversed[0].input, self.input, self.orig_inputs]:
E       TypeError: 'NoneType' object is not subscriptable

venv/lib/python3.10/site-packages/emmet/core/tasks.py:453: TypeError

Should be reproducible with:

python -m pytest tests/test_mprester.py -k test_get_charge_density_data

on main branch.

I can submit a separate issue for this if you'd like, but otherwise the code should function identically, with the relevant parts moved to get_charge_density_from_task_id()

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.

@teddykoker
Copy link
Copy Markdown
Contributor Author

cc @tschaume

@tschaume tschaume added the release:patch Patch release label Aug 19, 2024
@tschaume tschaume merged commit a9e1bc5 into materialsproject:main Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:patch Patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: No longer way to obtain charge density from task_id

2 participants