Skip to content

fix/order#282

Open
VsevolodX wants to merge 2 commits intomainfrom
fix/order
Open

fix/order#282
VsevolodX wants to merge 2 commits intomainfrom
fix/order

Conversation

@VsevolodX
Copy link
Member

@VsevolodX VsevolodX commented Mar 23, 2026

  • update: fix category
  • update: adjust the tolerance for better result

Summary by CodeRabbit

  • Documentation

    • Enhanced table formatting and alignment in the materials designer example notebook for improved readability.
  • Bug Fixes

    • Adjusted grain boundary overlap tolerance threshold to improve accuracy in coordinate resolution.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

This PR contains two distinct changes: a markdown table reformatting in the Introduction notebook to improve visual alignment and consistency, and a parameter adjustment increasing the overlap tolerance threshold in the grain boundary notebook from 0.8 to 1.2 Angstroms for improved atom collision handling.

Changes

Cohort / File(s) Summary
Table Formatting
other/materials_designer/specific_examples/Introduction.ipynb
Reformatted markdown table with widened columns, adjusted spacing/padding, and improved text alignment for visual consistency. No rows added/removed; all links and reference anchors preserved.
Grain Boundary Configuration
other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb
Increased OVERLAP_TOLERANCE constant from 0.8 to 1.2 Angstroms in the grain boundary basis collision resolution method call, adjusting the threshold for removing overlapping atoms at boundary interfaces.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested reviewers

  • pranabdas
  • timurbazhirov

Poem

🐰 A table dressed up neat and tight,
With columns spaced just right,
While boundaries dance with atoms anew,
At tolerance 1.2, what wonders brew!
Minor tweaks make all things bright. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix/order' is vague and does not clearly convey the specific changes made in the pull request. Use a more descriptive title that explains the main changes, such as 'Fix category order in Introduction table and adjust grain boundary tolerance' to make the intent clear.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/order

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Ruff (0.15.6)
other/materials_designer/specific_examples/Introduction.ipynb

Unexpected end of JSON input

other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb

Unexpected end of JSON input


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb`:
- Line 47: Explain and justify the change to OVERLAP_TOLERANCE by adding a
concise comment next to the variable (OVERLAP_TOLERANCE = 1.2) that states which
metric improved (e.g., reduced spurious atom removals at the GB, better match to
reference atom counts/coordination) and why 1.2 Å was chosen (empirically
minimized difference vs. reference structure). Then add validation after the GB
construction step (the routine that uses OVERLAP_TOLERANCE) that: (a) loads or
defines the reference structure from the manuscript, (b) compares simple metrics
such as total atom count, atom count within the grain-boundary region (atoms
within X Å of the interface), and coordination statistics between the generated
structure and reference, and (c) raises an assertion or prints a clear pass/fail
summary; also add a quick visualization call (e.g., plotting or snapshot) to
show the boundary region for human inspection. Finally, document expected
structural properties (e.g., expected atoms in GB region or expected
coordination defects) in a short comment or markdown cell to make the validation
criteria explicit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4a33ebd2-d679-4f64-876a-cc3eb1b12e7b

📥 Commits

Reviewing files that changed from the base of the PR and between 7fe82a8 and 8808033.

📒 Files selected for processing (2)
  • other/materials_designer/specific_examples/Introduction.ipynb
  • other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb

"TARGET_TWIST_ANGLE = 9.0 # in degrees\n",
"BOUNDARY_GAP = 0.0 # Gap between two orientations in X direction, in Angstroms\n",
"OVERLAP_TOLERANCE = 0.8 # Tolerance to remove overlapping atoms, in Angstroms\n",
"OVERLAP_TOLERANCE = 1.2 # Tolerance to remove overlapping atoms, in Angstroms\n",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for documentation, tests, or related discussions about this tolerance value

# Search for references to OVERLAP_TOLERANCE in other files
rg -n -C3 'OVERLAP_TOLERANCE|overlap.*tolerance|resolve_colliding_coordinates' --type ipynb --type py

# Search for any validation or test files related to grain boundaries
fd -e py -e ipynb -e md . -x rg -l 'grain.*boundary.*test|validate.*grain|boron.*nitride' {}

# Check git log for commits related to this parameter
git log -p --all -S "OVERLAP_TOLERANCE" -- "**/*grain*boundary*.ipynb"

Repository: Exabyte-io/api-examples

Length of output: 553


🏁 Script executed:

#!/bin/bash
# Read the notebook file to examine line 47 and surrounding context
# Jupyter notebooks are JSON format, so we can use jq to extract cell contents

# First, let's check the file size and structure
wc -l other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb

# Extract the notebook cells to find the OVERLAP_TOLERANCE definition
python <<'EOF'
import json

notebook_path = "other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb"

with open(notebook_path, 'r') as f:
    notebook = json.load(f)

# Find cells containing OVERLAP_TOLERANCE
for idx, cell in enumerate(notebook['cells']):
    if cell['cell_type'] == 'code':
        source = ''.join(cell['source'])
        if 'OVERLAP_TOLERANCE' in source:
            print(f"\n=== Cell {idx} (code) ===")
            print(source)
            print(f"Execution count: {cell.get('execution_count', 'N/A')}")

EOF

Repository: Exabyte-io/api-examples

Length of output: 1434


🏁 Script executed:

#!/bin/bash
# Check other related boron nitride notebooks for OVERLAP_TOLERANCE or similar tolerance parameters

notebooks=$(fd -e ipynb . -x rg -l 'boron.*nitride' {})

for nb in $notebooks; do
    echo "=== Checking $nb ==="
    python <<EOF
import json

try:
    with open("$nb", 'r') as f:
        notebook = json.load(f)
    
    for idx, cell in enumerate(notebook['cells']):
        if cell['cell_type'] == 'code':
            source = ''.join(cell['source'])
            if 'OVERLAP_TOLERANCE' in source or 'overlap' in source.lower() or 'tolerance' in source.lower():
                print(f"Cell {idx}: Found tolerance-related parameter")
                # Print just the parameter line
                for line in source.split('\n'):
                    if 'tolerance' in line.lower() or 'overlap' in line.lower():
                        print(f"  {line.strip()}")
except Exception as e:
    print(f"Error: {e}")
EOF
done

Repository: Exabyte-io/api-examples

Length of output: 1519


🏁 Script executed:

#!/bin/bash
# Check git history for this specific file and parameter
cd other/materials_designer/specific_examples

# Get the git history for this file
git log --oneline -- defect_planar_grain_boundary_2d_boron_nitride.ipynb | head -20

# Get the last few commits with more details
echo -e "\n=== Recent commits affecting this file ==="
git log --format="%h %ai %s" -- defect_planar_grain_boundary_2d_boron_nitride.ipynb | head -10

# Check if there's a specific commit that changed OVERLAP_TOLERANCE
echo -e "\n=== Commits affecting OVERLAP_TOLERANCE ==="
git log -p --all -- defect_planar_grain_boundary_2d_boron_nitride.ipynb | grep -A5 -B5 'OVERLAP_TOLERANCE' | head -50

cd ../../../

Repository: Exabyte-io/api-examples

Length of output: 291


🏁 Script executed:

#!/bin/bash
# Search for documentation about the reference manuscript or validation in the notebook

python <<'EOF'
import json

notebook_path = "other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb"

with open(notebook_path, 'r') as f:
    notebook = json.load(f)

# Check all cells for references to manuscript, validation, or expected values
print("=== All cells with potential references to validation or manuscript ===\n")
for idx, cell in enumerate(notebook['cells']):
    source = ''.join(cell['source'])
    
    # Look for references to manuscript, ACS, figures, validation, or expected values
    keywords = ['manuscript', 'ACS', 'figure', 'figure 2', 'validation', 'validate', 'expected', 'atom count', 'reference', 'paper']
    
    if any(keyword in source.lower() for keyword in keywords):
        print(f"=== Cell {idx} ({cell['cell_type']}) ===")
        print(source[:500])
        print("...\n")

# Also check for any comments or markdown that might reference the original work
print("\n=== Markdown cells (for context) ===\n")
for idx, cell in enumerate(notebook['cells']):
    if cell['cell_type'] == 'markdown':
        source = ''.join(cell['source'])
        if len(source) < 800:  # Only show shorter cells to find titles/descriptions
            print(f"=== Cell {idx} (markdown) ===")
            print(source)
            print()

EOF

Repository: Exabyte-io/api-examples

Length of output: 1525


🏁 Script executed:

#!/bin/bash
# Check for README or documentation in the materials_designer directory

find other/materials_designer -name "README*" -o -name "*.md" | head -20

echo -e "\n=== Checking README content ==="
find other/materials_designer -name "README*" | xargs cat 2>/dev/null | head -100

Repository: Exabyte-io/api-examples

Length of output: 231


🏁 Script executed:

#!/bin/bash
# Search for any references to atom overlap, grain boundary, or tolerance in documentation

rg -A5 -B5 'grain.*boundary|atom.*overlap|OVERLAP|resolve_colliding' --type md . | head -50

Repository: Exabyte-io/api-examples

Length of output: 49


Document the rationale for the OVERLAP_TOLERANCE change and add validation against the reference structure.

The OVERLAP_TOLERANCE parameter was changed to 1.2 Angstroms with the commit message "adjust the tolerance for better result," but this provides no specific justification. Since this parameter controls which atoms are removed at the grain boundary interface and directly affects the resulting structure, the change requires documentation.

The notebook correctly cites the reference manuscript (Qiucheng Li et al., ACS Nano 2015, 9(6), 6308-6315), but there is no visible validation showing that the grain boundary structure matches the expected result (e.g., Figure 2.c from the paper).

Please:

  1. Add a code comment explaining why 1.2 Angstroms produces better results—what metric improved and why this value was chosen
  2. Add validation code that compares the generated structure against the reference manuscript, such as checking atom count or visualizing the boundary
  3. Consider documenting expected structural properties (e.g., number of atoms in the grain boundary region)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@other/materials_designer/specific_examples/defect_planar_grain_boundary_2d_boron_nitride.ipynb`
at line 47, Explain and justify the change to OVERLAP_TOLERANCE by adding a
concise comment next to the variable (OVERLAP_TOLERANCE = 1.2) that states which
metric improved (e.g., reduced spurious atom removals at the GB, better match to
reference atom counts/coordination) and why 1.2 Å was chosen (empirically
minimized difference vs. reference structure). Then add validation after the GB
construction step (the routine that uses OVERLAP_TOLERANCE) that: (a) loads or
defines the reference structure from the manuscript, (b) compares simple metrics
such as total atom count, atom count within the grain-boundary region (atoms
within X Å of the interface), and coordination statistics between the generated
structure and reference, and (c) raises an assertion or prints a clear pass/fail
summary; also add a quick visualization call (e.g., plotting or snapshot) to
show the boundary region for human inspection. Finally, document expected
structural properties (e.g., expected atoms in GB region or expected
coordination defects) in a short comment or markdown cell to make the validation
criteria explicit.

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.

1 participant