-
Notifications
You must be signed in to change notification settings - Fork 871
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
Clarify argument shift
for SlabGenerator.get_slab
#3748
Conversation
Important Auto Review SkippedDraft detected. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
This reverts commit 65e3ec8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @DanielYang59 and sorry for the slow reply. this all looks good. just had 1 question
This comment was marked as resolved.
This comment was marked as resolved.
that i understood. but i was tentatively advising against all but one of the breaking changes you suggested (the one you clearly identified as a bug). how much does that leave to change here? |
This comment was marked as resolved.
This comment was marked as resolved.
shift
to termination
for SlabGenerator.get_slab
shift
for termination
for SlabGenerator.get_slab
This comment was marked as outdated.
This comment was marked as outdated.
shift
for termination
for SlabGenerator.get_slab
shift
for SlabGenerator.get_slab
@janosh I decide to minimize (potentially) breaking changes and just clarify in the docstring. |
shift
for SlabGenerator.get_slab
shift
for SlabGenerator.get_slab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @DanielYang59, lgtm. just a conflict to resolve
@janosh thanks for reviewing. Resolved I begin to notice this CI failure about 12 hours ago:
Is this some issue from the latest release 0.3.7 of |
Summary
A follow-up PR for #3691.
shift
for private methodSlabGenerator.get_slab
slab
in functioncenter_slab
(should beStructure
instead ofSlab
)Rationale
shift
forSlabGenerator.get_slab
corresponds to the desiredtermination
coordinate (instead of the shift vector to get theSlab
), which could be misleading:pymatgen/pymatgen/core/surface.py
Line 1087 in 578d29c
Which might cause confusion in understanding the implementation:
pymatgen/pymatgen/core/surface.py
Line 1119 in 578d29c
Clarify
shift
attribute ofSlab
Similarly, the description of
shift
attribute ofSlab
is incorrect, it is NOT the shift but the negative shift.pymatgen/pymatgen/core/surface.py
Lines 118 to 119 in 578d29c
TODO for future PRs
In future PRs
Function
center_slab
:pymatgen/pymatgen/core/surface.py
Lines 759 to 788 in ad6eafe
a. During the
for site in slab:
loop, site coordinates would change.b. This method to put the
Slab
to the center seems overly complex, can we just calculate the z-center of theSlab
, and move it to z=0.5 (fractional)?c. If not b, Sites with z<0 is not considered (it would only move
nn[1] >= slab.lattice.c
).d. A magic number for determining near neighbors by cutoff radius:
cutoff_radius = bond_dists[0] * 3
.The
move_to_other_side
method ofSlabGenerator
:pymatgen/pymatgen/core/surface.py
Lines 1459 to 1473 in ad6eafe
Clean up
core.surface
comments and docstrings #3691 (comment)Currently there are three very similar methods/functions that need to clarify in docstring:
a.
get_slab
ofSlabGenerator
: The actual method to generateSlab
, should be a private method (as per the docstring, but have already been used externally).b.
get_slabs
ofSlabGenerator
: A wrapper method on top ofget_slab
to generate possible shifts and then callget_slab
.c.
generate_all_slabls
: A wrapper function on top ofget_slabs
, which generate slabs up to a given Miller index.Next up: Fix some
Slab
related issuesDon't think I could resolve them in one shot, but good to collect them: