-
Notifications
You must be signed in to change notification settings - Fork 840
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
Deprecate _parse_atomic_densities
in BaderAnalysis
and fix Bader
test setup
#3656
Deprecate _parse_atomic_densities
in BaderAnalysis
and fix Bader
test setup
#3656
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
_parse_atomic_densities
in BaderAnalysis
_parse_atomic_densities
in BaderAnalysis
and fix Bader
test setup
Test setup for _____________________ TestBaderAnalysis.test_atom_parsing ______________________
self = <tests.command_line.test_bader_caller.TestBaderAnalysis testMethod=test_atom_parsing>
def test_atom_parsing(self):
# test with reference file
analysis = BaderAnalysis(
chgcar_filename=f"{TEST_FILES_DIR}/CHGCAR.Fe3O4",
potcar_filename=f"{TEST_FILES_DIR}/POTCAR.Fe3O4",
chgref_filename=f"{TEST_FILES_DIR}/CHGCAR.Fe3O4_ref",
parse_atomic_densities=True,
)
assert len(analysis.atomic_densities) == len(analysis.chgcar.structure)
> assert np.sum(analysis.chgcar.data["total"]) == approx(
np.sum([dct["data"] for dct in analysis.atomic_densities])
) Maybe I still should zero-pad them in the test (hopefully fix the issue)? @janosh (Or just remove/supress this test if no one is using it anyway?) |
yes, we should fix the test instead of removing it while the functionality is still available |
Should be good for now, please review @janosh . Though everything seems to be working, there is still a minor issue here: As pymatgen/pymatgen/command_line/bader_caller.py Lines 99 to 131 in dc60d35
This leads to some issues:
Meanwhile I think it might be better not to alter files in place, both during runtime and test time. As such I think it might make sense to alter the behaviour of |
that sounds good! by "after cleaning up test files" do you mean in or after #3653? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work @DanielYang59! love all your contributions 👍
Thanks for reviewing and those helpful suggestions @janosh |
holds all the data within a precision. | ||
""" | ||
total = np.sum(data) | ||
for idx in range(np.max(data.shape)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another note for myself:
-
This method
bader_caller
is overall slow, or the bottleneck could be callingbader
withsubprocess
itself, and might need some profiling to identify the bottleneck. -
Try replacing linear search with bisection method to see if performance could be improved. However it's also important to note this should search for the MINIMUM encompassing volume, pure bisection might not be suitable.
Summary
__init__
ofBaderAnalysis
parse_atomic_densities
inBaderAnalysis
as deprecated, to be removed on 26 Feb 2025, as discussed in [Dev] Tests forBader
not running properly #3652.