-
Notifications
You must be signed in to change notification settings - Fork 874
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
Issue stronger warning if bader
is run without the AECCAR
s
#3458
Conversation
…g AECCAR0/2 and vice versa
bader
is run without the AECCAR
sbader
is run without the AECCAR
s
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.
I'm quite sure that this PR is causing the "bader_analysis_from_path" method to fail for any of its usage. I'm confused how could this PR pass the tests without failing.
The problematic line is line 455 in this PR and now line 451 in the latest pymatgen. The method is now looking for CHGCAR in the "Could not find CHGCAR!" folder path...
I think the tests and this code should be corrected.
pymatgen/pymatgen/command_line/bader_caller.py
Lines 438 to 452 in 5514ff5
def _get_filepath(filename, path=path, suffix=suffix): | |
paths = glob(f"{path}/{filename}{suffix}*") | |
if len(paths) == 0: | |
return None | |
if len(paths) > 1: | |
# using reverse=True because, if multiple files are present, | |
# they likely have suffixes 'static', 'relax', 'relax2', etc. | |
# and this would give 'static' over 'relax2' over 'relax' | |
# however, better to use 'suffix' kwarg to avoid this! | |
paths.sort(reverse=True) | |
warnings.warn(f"Multiple files detected, using {os.path.basename(path)}") | |
return paths[0] | |
chgcar_path = _get_filepath("CHGCAR", "Could not find CHGCAR!") | |
chgcar = Chgcar.from_file(chgcar_path) |
@JiQi535 you're right, thanks for reporting. the reason this wasn't caught is that the only test for pymatgen/tests/command_line/test_bader_caller.py Lines 84 to 99 in 5514ff5
|
Closes #3448.