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

Structure graphs #63

Merged
merged 52 commits into from
Sep 14, 2023
Merged

Structure graphs #63

merged 52 commits into from
Sep 14, 2023

Conversation

naik-aakash
Copy link
Collaborator

@naik-aakash naik-aakash commented Aug 24, 2022

Hi Janine,

  • This is initial draft for getting structure_graphs .
  • I did add environment information from lobsterpy to graph nodes

Pending

  • Add test cases
  • Add bonding-antibonding percentages for COHP

Also provide feedback on the way it is implemented.

@JaGeo
Copy link
Owner

JaGeo commented Aug 24, 2022

Thanks. Will check it out. And, yes, pymatgen could be changed.

@naik-aakash
Copy link
Collaborator Author

naik-aakash commented Aug 24, 2022

Added the bonding-antibonding percentages as edge properties. The integral values obtained, however, don't match very well.

So I still need to recheck. If you spot any error when reviewing, I would be happy to rectify it.

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.

Thank you very much, Aakash. This is already a great start as always :). I have some suggestions and we can of course talk about it in more detail.


def __init__(
self,
path_to_calcdir: str,
Copy link
Owner

Choose a reason for hiding this comment

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

I think there is a chance that people have the files in different folders. I think we should support 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 thought it would be bit faster to use, and number of argument lists is bit large to type it out. But what you said also makes sense. So will revert it back to initial style.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think there is a chance that people have the files in different folders. I think we should support it.

Yeah, have removed the hardcoding , so users can give path to files seperately.

def __init__(
self,
path_to_calcdir: str,
add_additional_data_sg=True,
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe, we can already add an option to decide that COHP data is used for the determination of the bond strengths and bonds.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @naik-aakash . I think it looks qvery good. Could you maybe make the suggested changes? I think, I can then merge it.

Hi Janine, Thnaks! The change suggested pending is for option to decide that COHP data used for the determination of the bond strengths and bonds. I think, I have made other suggested changes already. Will try to get it done as quickly as possible.

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

naik-aakash commented Aug 26, 2022

Added test case for graph module . Let me know if any further changes are needed. Tests failed because current pymatgen release does not have bond_label key in sg object

@naik-aakash naik-aakash added the enhancement New feature or request label Aug 26, 2022
@JaGeo JaGeo self-requested a review August 27, 2022 09:41
@JaGeo
Copy link
Owner

JaGeo commented Nov 1, 2022

Thanks @naik-aakash . I think it looks qvery good. Could you maybe make the suggested changes? I think, I can then merge it.

lobsterpy/structuregraph/graph.py Show resolved Hide resolved
)

cba = analyze.condensed_bonding_analysis

Copy link
Owner

Choose a reason for hiding this comment

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

Mayybe add a comment to describe what you are doing in each step?

Copy link
Collaborator Author

@naik-aakash naik-aakash Nov 1, 2022

Choose a reason for hiding this comment

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

Added some additional comments as requested. Hope these do not cause linit errors , I just added via GUI on git

Copy link
Owner

Choose a reason for hiding this comment

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

I think we need to add precommit to the workflows at some point.

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will do add it next time

@naik-aakash
Copy link
Collaborator Author

Hi @JaGeo, let me know if anything more needs to be added or modified here. 😄

@JaGeo
Copy link
Owner

JaGeo commented Apr 17, 2023

Hi @naik-aakash , how does the test coverage currently look like and how diverse were the structures you tested the code on so far?

@naik-aakash
Copy link
Collaborator Author

Hi @JaGeo, this PR could also be reviewed and merged

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 ,

thanks for writing this! Could you check if some of the objects aren't already part of Analysis? Charge or LobsterNeighbors? And, if there are ways to simplify the code and potentially speed it up.

docs/source/conf.py Outdated Show resolved Hide resolved
docs/source/conf.py Outdated Show resolved Hide resolved
lobsterpy/structuregraph/graph.py Outdated Show resolved Hide resolved
)

# Adds Mulliken and Löwdin charges as site properties to structure object (node properties)
decorated_structure = Charge(self.path_to_charge).get_structure_with_charges(
Copy link
Owner

Choose a reason for hiding this comment

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

Isn't the charge information already in LobsterNeighbors or the Analysis object or anything else?

Copy link
Collaborator Author

@naik-aakash naik-aakash Sep 13, 2023

Choose a reason for hiding this comment

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

Oh yes, I just looked up into get_structure_with_charges method, I infact do not need to reinitialize the charge object just for that method. Thanks for the suggestion. Will implement the changes soon

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ops, we cannot, Lobsterpy only has Mulliken charges, Loewdin Charges are not part of Analysis object

Copy link
Owner

Choose a reason for hiding this comment

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

I see! Thanks for checking!

)

# Initialize automating bonding analysis from Lobsterpy based on ICOHP
analyze = Analysis(
Copy link
Owner

Choose a reason for hiding this comment

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

Isn't LobsterNeighbors part of the Analysis object? Can't you reuse this? I think we are currently running the same code multiple times which could be really slow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed LobsterNeighbors is part of Analysis object which can be reused, but as it is not initialized with ICOOP and ICOBI info when we create the analyze object. So the structure graph will not have ICOBI and ICOOP as edge properties.

I think to keep it simple we can simply not have them in single structure graph object?

It was implemented like this as ICOOP and ICOBI extension was not implemented before. Now we can simply have different sg objects for based on different analysis objects.

Let me know what you think of this? I will then make changes there

Copy link
Owner

@JaGeo JaGeo Sep 13, 2023

Choose a reason for hiding this comment

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

Can't you add a kwarg or something to Analysis to pass the ICOBI, ICOOP to LobsterNeighbors stuff?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can, but I think it can be quite confusing if we are already planning to extend the analysis to COBIs and COOPs.

If the user does analysis for COBICAR, then sg will not have COHP info added with our current implementation in pymatgen. I will need to first update LobsterNeighbors if we want to go this way.

Copy link
Owner

Choose a reason for hiding this comment

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

Ideally, we can determine bonds based on ICOHP, ICOBI and add ICOHP, ICOBI values to each structure graph. I guess we will keep the current implementation for now and then think about improvements later.

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for checking!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ideally, we can determine bonds based on ICOHP, ICOBI and add ICOHP, ICOBI values to each structure graph. I guess we will keep the current implementation for now and then think about improvements later.

Yes, I agree 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for checking!

You are welcome

naik-aakash and others added 4 commits September 13, 2023 09:07
Co-authored-by: J. George <JaGeo@users.noreply.github.com>
Co-authored-by: J. George <JaGeo@users.noreply.github.com>
@naik-aakash
Copy link
Collaborator Author

naik-aakash commented Sep 13, 2023

@JaGeo, I have made the suggested changes.

In the following days, I will try to make changes in pymatgen to switch to any icoxxlist as a base file for neighbor analysis and add additional data from the two types of files. Then I will raise another PR to improve the current implementation 😄

Let me know if anything more needs to be done before it can be merged :-)

@naik-aakash
Copy link
Collaborator Author

Hi @JaGeo , here as well issues seem to be resolved so this could be merged

@naik-aakash
Copy link
Collaborator Author

There are still conflicts, unfortunately :(

Just resolved it now , should be fine. test files xD

@JaGeo JaGeo merged commit 0889f07 into JaGeo:main Sep 14, 2023
21 checks passed
@naik-aakash naik-aakash deleted the structure_graphs branch June 20, 2024 06:55
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