Skip to content

Fix file existence check in ChargemolAnalysis to verify directory instead. #4226

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

Merged
merged 7 commits into from
Apr 20, 2025

Conversation

lllangWV
Copy link
Contributor

atomic_densities dir for chargemol is a dir not a file.

I am working with chargemol in a high throughput context with Atomate2. When trying to perform chargemol calculations I could not get past if not os.path.isfile(atomic_densities_path):. I believe this is because if you provide a directory, which is what atomic_densities_path should be, this will always trigger preventing the operation. Unless I am wrong with the functioning of os.path.isfile.

Summary

Major changes:

  • feature 1: Changed isfile to isdir
  • fix 1: Changed isfile to isdir

…tead of file.

atomic_densities dir for chargemold is a dir not a file.
@mkhorton
Copy link
Member

mkhorton commented Jan 9, 2025

Thanks for flagging this @lllangWV

Tagging @mhsiron @Andrew-S-Rosen for this one, I haven't used the Chargemol functionality myself. Not clear how this worked previously if it is an error?

@mkhorton mkhorton added the bug label Jan 9, 2025
@Andrew-S-Rosen
Copy link
Member

Almost certainly this is the correct patch, although I must admit that I don't think I've used this function in a long time (likely before any refactoring).

@DanielYang59
Copy link
Contributor

DanielYang59 commented Jan 10, 2025

Not clear how this worked previously if it is an error?

I guess this is an oversight from (very likely done by batch regular expression replacement or similar, as this part is not covered by unit test):

@Andrew-S-Rosen Andrew-S-Rosen enabled auto-merge (squash) March 15, 2025 12:05
@shyuep shyuep disabled auto-merge April 20, 2025 19:39
@shyuep shyuep merged commit 4a3d067 into materialsproject:master Apr 20, 2025
1 check was pending
@shyuep
Copy link
Member

shyuep commented Apr 20, 2025

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants