Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix TypeError when attr force_field not exists #3495

Merged
merged 3 commits into from
Dec 6, 2023

Conversation

xjf729
Copy link
Contributor

@xjf729 xjf729 commented Dec 5, 2023

Summary

Major changes:

  • feature 1: ...
  • fix 1: Fix bug "TypeError: argument of type 'NoneType' is not iterable". Not all LammpsData in CombinedData should have attribute force_field, replace this NoneType attribute with [] to skip unexisting force_field.

Todos

If this is work in progress, what else needs to be done?

  • feature 2: ...
  • fix 2:

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

Tip: Install pre-commit hooks to auto-check types and linting before every commit:

pip install -U pre-commit
pre-commit install

Fix bug "TypeError: argument of type 'NoneType' is not iterable". Not all LammpsData in CombinedData should have attribute force_field, replace this `NoneType` attribute with `[]` to skip unexisting force_field.

Signed-off-by: XiongJF <[email protected]>
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a test for this?

@janosh janosh added needs testing PRs that are not ready to merge due to lacking tests md Molecular dynamics labels Dec 5, 2023
@xjf729
Copy link
Contributor Author

xjf729 commented Dec 6, 2023

Can you please add a test for this?

Sure, I have added a test for CombinedData.

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @xjf729! 👍

@janosh janosh added fix Bug fix PRs lammps Pymatgen LAMMPS interface and removed needs testing PRs that are not ready to merge due to lacking tests labels Dec 6, 2023
@janosh janosh enabled auto-merge (squash) December 6, 2023 17:13
@janosh janosh merged commit 9518085 into materialsproject:master Dec 6, 2023
22 checks passed
@xjf729 xjf729 deleted the patch-2 branch December 7, 2023 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix PRs lammps Pymatgen LAMMPS interface md Molecular dynamics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants