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

Clean up core.surface comments and docstrings #3691

Merged
merged 93 commits into from
Apr 10, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Mar 17, 2024

Summary

Major clean up of core.surface, I decide to split this task into two for readability: this PR to revise comments/docstrings with some relocation of code. Another follow up PR for functional changes/fixes.

Non-breaking changes

  • Major clean up of comments/docstrings (made more concise and add missing)
  • Sort ordering of methods in Slab and SlabGenerator

TODOs:

@DanielYang59

This comment was marked as resolved.

@DanielYang59

This comment was marked as resolved.

@DanielYang59

This comment was marked as resolved.

@janosh janosh added fix Bug fix PRs core Pymatgen core surfaces Surface analysis labels Mar 17, 2024
@janosh
Copy link
Member

janosh commented Mar 17, 2024

i can only assign members of MP to issues or people who've commented on issues. so if you leave a comment i could assign you. but given the 1st issue has been open since Oct 23, i don't see a high risk of other people working on it

@DanielYang59
Copy link
Contributor Author

but given the 1st issue has been open since Oct 23, i don't see a high risk of other people working on it

I think it should be fine. People should see this PR being linked to those issues. Thanks for the help.

But I'm afraid this would take some time as it seems I would need to clean up the entire surface module

@DanielYang59 DanielYang59 marked this pull request as ready for review April 10, 2024 03:40
@DanielYang59
Copy link
Contributor Author

Can you please review this? @janosh. Sorry I'm making this PR overly large, but I don't expect functional changes within this PR (mostly cleaning up of comment/docstring/namings).

And I would also expect (multiple) follow up PRs, as I did find some issues (all tagged, you could search @DanielYang59 to find tags). And I think it would be easier to view the difference if I separate them with this PR.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

pymatgen/core/structure.py Show resolved Hide resolved
pymatgen/core/structure.py Show resolved Hide resolved
pymatgen/core/structure.py Show resolved Hide resolved
@DanielYang59 DanielYang59 changed the title Clean up core.surface Clean up core.surface comments and docstrings Apr 10, 2024
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

And I would also expect (multiple) follow up PRs, as I did find some issues (all tagged, you could search @DanielYang59 to find tags). And I think it would be easier to view the difference if I separate them with this PR.

thanks a lot for polishing this module! doc string improvements are great for helping usability

@janosh janosh enabled auto-merge (squash) April 10, 2024 05:25
@DanielYang59
Copy link
Contributor Author

DanielYang59 commented Apr 10, 2024

And I would also expect (multiple) follow up PRs, as I did find some issues (all tagged, you could search @DanielYang59 to find tags). And I think it would be easier to view the difference if I separate them with this PR.

thanks a lot for polishing this module! doc string improvements are great for helping usability

Thanks a lot for reviewing and capture those issues. This really took me a lot of energy but I'm now much much familiar with the module, which should hugely facilitate future functional tweaks.

@ftherrien
Copy link
Contributor

ftherrien commented Aug 13, 2024

@janosh @DanielYang59 I think this PR may have removed the definition of _calculate_possible_shifts or was it renamed?

@DanielYang59
Copy link
Contributor Author

DanielYang59 commented Aug 14, 2024

Hi @ftherrien thanks for asking. It's now renamed to gen_possible_terminations as a private function of get_slabs method under SlabGenerator class for two reasons:

  • It was a private method and depended on by get_slabs alone.
  • The original name is a bit misleading, because it doesn't really generate the shift but the termination (negative of shift).

def gen_possible_terminations(ftol: float) -> list[float]:
"""Generate possible terminations by clustering z coordinates.
Args:
ftol (float): Threshold for fcluster to check if
two atoms are on the same plane.
"""

@ftherrien
Copy link
Contributor

Ah! Thanks so much that makes a lot of sense

@DanielYang59
Copy link
Contributor Author

All good! Thanks for asking and happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Pymatgen core fix Bug fix PRs surfaces Surface analysis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants