Skip to content
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

Automatic orbital wise analysis functionality in analyze module #132

Merged
merged 63 commits into from
Oct 23, 2023

Conversation

naik-aakash
Copy link
Collaborator

@naik-aakash naik-aakash commented Aug 2, 2023

This PR implements the feature request of #113

Added

  1. Automatic orbital-wise analysis functionality in analyze module

Todo

  • Update describe the module
  • Refactor plotting module to remove code repetition
  • Check with plots as well if numbers make sense as well
  • Update plotter to plot orbital resolved cohp curves
  • Update text description
  • Add tests
  • Fix orbital wise plot labels to match atom-pair and orbital pair
  • Add orbitalwise cuttoff arg to analyze module
  • cli intergration
  • add tests for cobi-coop orbitalwise analysis
  • Update test durations file

@naik-aakash naik-aakash added the enhancement New feature or request label Aug 2, 2023
@naik-aakash naik-aakash self-assigned this Aug 2, 2023
@naik-aakash
Copy link
Collaborator Author

Hi @JaGeo ,

Below is the current output of condensed bonding analysis dict when oribital wise analysis is switched on. Please have a look at the output information I am providing. Suggestions are most welcome 😃

Orbital_wise_data_example

@JaGeo
Copy link
Owner

JaGeo commented Aug 8, 2023

Closes #113

@naik-aakash
Copy link
Collaborator Author

naik-aakash commented Aug 11, 2023

Hi @JaGeo , here is the updated output skeleton that fixes the discrepancies in previous results.

NaCl

Revise_output

3s-3s (57%)

NaCl_3s-3s

3px-3s (42%)

NaCl_3px_3s

#ZnS

ZnS_revised_ouput

3s-4s (38%)

ZnS_3s-4s

3py-4s (20%)

ZnS_3py-4s

@naik-aakash
Copy link
Collaborator Author

This PR is ready for review now. I have updated the interactive plotter legends for Orbitalwise analysis.

@JaGeo
Copy link
Owner

JaGeo commented Aug 18, 2023

Btw, could you make a PR adding the units to the plotter as well?

@naik-aakash
Copy link
Collaborator Author

naik-aakash commented Aug 18, 2023

Btw, could you make a PR adding the units to the plotter as well?

Yes sure! Thanks for pointing this out. Somwhow got overlooked so far

@naik-aakash
Copy link
Collaborator Author

naik-aakash commented Aug 25, 2023

Hi @JaGeo, I think it would be better if I introduce another parameter to limit the orbital contributions, I am currently using the same parameter limit of ICOHP cutoff i.e. 10% for limiting the orbital contributions. I found 10% cutoff can result in no orbital interactions being shown. (For example, in diamond, mp-66: no orbital-orbital interactions are detected using a 10% cutoff as all the contributions to total summed icohp are around 8%)

If we simply change the cutoff_icohp arg in the analysis, this fixes the issue. But that could affect our other results

Please let me know what you think is the best.

@naik-aakash
Copy link
Collaborator Author

Hi @JaGeo , it would be best to merge this after COBI coop extension PR as lot of changes needs to be updated in here (Merge conflicts will arise)

Comment on lines 566 to 569
"In the Sb-F bond, the maximum contribution are from Sb(5pz)-F(2s), Sb(5py)-F(2s), "
"and Sb(5px)-F(2s) orbitals, contributing 39.12, 39.12, and 39.12 percent, respectively, "
"whereas the maximum antibonding contribution is from the Sb(5s)-F(2s) orbital, "
"contributing 35.799 percent.",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It says: there is no antibonding contribution but then you list an orbital contribution for it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also spotted this inconsistency yesterday. Trying an alternative approach for it. It happens because I did not use summed cohps of all relevant bonds , but rather looked relevant bond label to extract orbital contributions. Working on it since yesterday

Copy link
Collaborator Author

@naik-aakash naik-aakash Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried with alternative approach, results change when using summed cohps, but it will still happen and it makes sense as we also see it in the plots 😅

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you need to rephrase the text ;). The sum is 0 but there are antibonding contributions from individual orbitals.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newplot(3)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but then the text is not describing it correctly. It's not a percentage of the 0.0% antibonding interactions. Make sure this is clear from the text.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general: what percentage are you giving there? orbital COHP/overall COHP? And then antibonding orbtia interactions/overall orbital interaction strength? Might also not be exactly clear.

Comment on lines 548 to 551
"It has 4 C-C (mean ICOHP: -9.59 eV, 0.0 percent antibonding interaction below EFermi) bonds.",
"In the C-C bond, the maximum contribution are from C(2py)-C(2s), C(2pz)-C(2s), C(2px)-C(2s), "
"C(2s)-C(2py), C(2s)-C(2pz), and C(2s)-C(2px) orbitals, contributing 7.94, 7.94, 7.94, 7.94, "
"7.94, and 7.94 percent, respectively, whereas the maximum antibonding contribution is from "
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0 percent antibonding contribution and then a list of the max antibonding contribution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newplot(2)

@naik-aakash
Copy link
Collaborator Author

Hi @JaGeo , I found the current version of implementation does not work very well with just using ICOHPs to find the contributions, I would need to rewrite it.

I Think to find most relevant orbitals, I would need to first compute area under intergrals from COHPs and then compute the percentage of contribution (This will take longer to run especially for larger structures or that have many orbital pairs)

If you have any suggestions, please let me know 😃

@JaGeo
Copy link
Owner

JaGeo commented Oct 6, 2023

Maybe, you could add this as an additional optional flag and not make it part of the standard orbital-wise analysis? I think people might just want to plot the most important orbital interactions and not much more.

@naik-aakash
Copy link
Collaborator Author

Hi @JaGeo, I made the code changes to include space between the sentences. So this PR could be merged. Let me know if I should add more comments for the implementation.

Copy link
Owner

@JaGeo JaGeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @naik_aakash, this looks great. I left some further comments to avoid potenial code repetition.

Next steps should be documenting this functionality very well - both within our repository and for our publication. I would like to wait with a release until we have done this. I think users might have a lot of questions without it.

Another idea that I had: should we move to pytest completely? I think there are automatic tools to do so.

lobsterpy/plotting/__init__.py Outdated Show resolved Hide resolved
lobsterpy/plotting/__init__.py Show resolved Hide resolved
Comment on lines 666 to 669
if label_with_count + suffix not in self._cohps:
self._cohps[label_with_count + suffix] = {}
plot_data_orb = analyse.get_site_orbital_resolved_labels()
drop_down_key = label_with_count + suffix
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks similar below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks similar below.

Now with comments added, it probably makes clearer how it differ

lobsterpy/plotting/__init__.py Outdated Show resolved Hide resolved
@naik-aakash
Copy link
Collaborator Author

Hi @naik_aakash, this looks great. I left some further comments to avoid potenial code repetition.

Next steps should be documenting this functionality very well - both within our repository and for our publication. I would like to wait with a release until we have done this. I think users might have a lot of questions without it.

Another idea that I had: should we move to pytest completely? I think there are automatic tools to do so.

Yes, I wiIl document this soon for repo and publication. And I am not familiar with the tools, but should be easy I guess to find it out. Will check that

@JaGeo
Copy link
Owner

JaGeo commented Oct 23, 2023

I will merge this now. However, we need a clear description of how this orbital-wise automatic analysis works in our documentation, the tutorials and the paper. We should showcase the results for several examples of different complexity.

@JaGeo JaGeo merged commit 8e79b1c into JaGeo:main Oct 23, 2023
24 checks passed
@naik-aakash
Copy link
Collaborator Author

I will merge this now. However, we need a clear description of how this orbital-wise automatic analysis works in our documentation, the tutorials and the paper. We should showcase the results for several examples of different complexity.

Thanks, I will do this 😃

@naik-aakash naik-aakash deleted the orbital_resolved_analysis branch June 20, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants