Skip to content

Fix has_cobicar when NcICOBILIST is present#4447

Merged
shyuep merged 3 commits intomaterialsproject:masterfrom
tomdemeyere:ncicobilist
Aug 21, 2025
Merged

Fix has_cobicar when NcICOBILIST is present#4447
shyuep merged 3 commits intomaterialsproject:masterfrom
tomdemeyere:ncicobilist

Conversation

@tomdemeyere
Copy link
Contributor

@tomdemeyere tomdemeyere commented Jul 3, 2025

When icobiBetween is activated lobster prints out the NcICOBILIST.lobster file. In the lobster output we find "Writing COBICAR.lobster, ICOBILIST.lobster and NcICOBILIST.lobster..." instead of the regular line. The current parser then returns False even if the COBICAR.lobster is present.

Also, it seems that has_cohpcar and has_coopcar are flipped?

Switching to a regex approach on the whole files (not \n split) would allow much greater flexbility, performance and robustness.

@JaGeo @naik-aakash

  • 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

@naik-aakash
Copy link
Contributor

Hi @tomdemeyere, thanks for catching this flip in checks for COHP and COOP and fixing the has_cobicar logic when multicenter bonding is enabled.

Regarding the suggestion of switching to regex, I do not have any strong opinion. The only thing I feel is that maintaining it can be harder if one is not very familiar with regex syntax.

@JaGeo
Copy link
Member

JaGeo commented Jul 4, 2025

I think my opinion on regex is similar to @naik-aakash 's. As long as one can still easily maintain it, I am fine with it. We also, of course, have to check with the main maintainers of this repo :)

And thanks for catching the bugs!

@shyuep shyuep merged commit fd41fd1 into materialsproject:master Aug 21, 2025
44 checks passed
@shyuep
Copy link
Member

shyuep commented Aug 21, 2025

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants