Closed DanielYang59 closed 8 months ago
thanks for reporting! the whole bader
is very brittle atm. i was hoping we could transition to pybader
at some point in the future to have less install and subprocess shenanigans but development there seems to have stalled.
if you could fix the current implementation, that would be great! 👍
thanks for reporting! the whole
bader
is very brittle atm. i was hoping we could transition topybader
at some point in the future to have less install and subprocess shenanigans but development there seems to have stalled.
Yes it seems pybader
is stalled for some reason...
if you could fix the current implementation, that would be great!
Well I have made too many promises (in pymatviz
and pymatgen
, and my own codebase) but having too limited time 😭. I would certain give this a try when I have time but I cannot promise that at this moment sorry.
Well I have made too many promises (in pymatviz and pymatgen, and my own codebase) but having too limited time 😭.
i know the problem 😄
don't worry, nobody's going to hold you to those promises. any help is appreciated and none is expected
I just had a look at why test for Bader_caller
is failing.
It looks like BaderAnalysis
sliced a central part from the complete charge density:
https://github.com/materialsproject/pymatgen/blob/dc60d35a21fd7b55d82c65bb078afc4a2c0e9bbf/pymatgen/command_line/bader_caller.py#L194-L224
As the "encompassing volume" is determined on the fly: https://github.com/materialsproject/pymatgen/blob/dc60d35a21fd7b55d82c65bb078afc4a2c0e9bbf/pymatgen/command_line/bader_caller.py#L209-L216
The shapes for charge density array of different atoms differ, and therefore the error in test from trying to calculating the sum of arrays in different shapes: https://github.com/materialsproject/pymatgen/blob/dc60d35a21fd7b55d82c65bb078afc4a2c0e9bbf/tests/command_line/test_bader_caller.py#L129-L131
So the fix should be pretty straightforward (zero-pad charge density arrays to consistent shape).
But I'm not sure about the underlying reasoning behind this @janosh @shyuep , as this seems to be a breaking change so I guess should avoid this (if I pad the charge array inplace in BaderAnalysis
), or should I keep this behaviour and just pad the arrays in tests?
Thanks a lot for any suggestion 😃 .
So the fix should be pretty straightforward (zero-pad charge density arrays to consistent shape).
But I'm not sure about the underlying reasoning behind this @janosh @shyuep ,
this is actually news to me. i hadn't looked closely at the implementation before. if the tests produce arrays of different shapes then i don't understand how they could have passed in the past? maybe @Andrew-S-Rosen knows more?
potential for breakage from zero padding seems small but i'm still leaning towards just padding the arrays in tests to fix CI rather than changing the implementation
Thanks for the quick response and for sharing your thoughts.
if the tests produce arrays of different shapes then i don't understand how they could have passed in the past?
Not sure... I just checked an early (on Dec 6, 2023, expired after 90 days) workflow logs and it seems at least back then the tests passed just fine (pytest split 3
) 😕 :
6.70s call tests/command_line/test_bader_caller.py::TestBaderAnalysis::test_atom_parsing
Maybe I didn't understand the implementation correctly?
potential for breakage from zero padding seems small but i'm still leaning towards just padding the arrays in tests to fix CI rather than changing the implementation
If we change the implementation to zero-pad the atomic_densities
, then the behaviour of this function would change to produce consistent shapes for atomic_densities
(which would break downstream process). So I guess it's better not to change this for now. Or we could make zero-pad optional during __init__
if necessary.
I have never used parse_atomic_densities = True
so can't help much here (the default is False
). I must be honest --- I'm not entirely sure of the purpose of this task anyway. The bader analysis is already breaking down the charge density on a per-atom basis. Why would I want pymatgen to "Enable atomic partition of the charge density" separately from this in a more rudimentary way?
that's funny, i was wondering the same thing but figured i'm missing something obvious.
So maybe the right path forward is to put a deprecation warning on this functionality with a removal date and see if anyone objects before then?
So maybe the right path forward is to put a deprecation warning on this functionality with a removal date and see if anyone objects before then?
I would lean towards yes (with a somewhat generation deprecation period), unless it's used in the MP builders for some reason. CC @munrojm
sure, let's do 1 year deprecation. emmet
only uses bader_analysis_from_path(dir_name, suffix=suffix)
(i.e. parse_atomic_densities=False
).
@DanielYang59 would you like to submit a PR to close this issue?
Why would I want pymatgen to "Enable atomic partition of the charge density" separately from this in a more rudimentary way?
I was wondering too (thought there is some reasoning I didn't know about...), thanks a lot for pointing out.
sure, let's do 1 year deprecation.
emmet
only usesbader_analysis_from_path(dir_name, suffix=suffix)
(i.e.parse_atomic_densities=False
).@DanielYang59 would you like to submit a PR to close this issue?
Glad to help, thanks for the helpful discussion.
Fixed in #3656
Summary
Noticed two
Bader
related issues:Test workflow not running properly
While trying to clean up test files for VASP, I noticed tests for
Bader
in (tests/command_line/test_bader_caller.py) (apparently depends on VASP output files) in the GitHub workflow doesn't seem to run properly (though the tests seem to pass, until one checks the details):Seen the screenshot:
Test for
Bader
failsIf running on a local machine with Bader properly installed, I then get: