Skip to content

Draw ionic ball_stick coordination sticks on the wrapped unit cell - #244

Closed
SchrodingersCattt wants to merge 4 commits into
mainfrom
cursor/ionic-ball-stick-nacl-dd83
Closed

SchrodingersCattt wants to merge 4 commits into
mainfrom
cursor/ionic-ball-stick-nacl-dd83

Conversation

@SchrodingersCattt

@SchrodingersCattt SchrodingersCattt commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Explicit --style ball_stick on conventional ionic / inorganic unit cells draws coordination sticks on the same wrapped lattice-site layout as #243: centres stay in [0, 1] (crystallographic sites plus the symmetric face, edge, and corner images at 0 and 1). There is no one-sided coordination shell at fractional -0.5.

Each home site still has its first-neighbor coordination (CN=6 along ±a/2 for rocksalt NaCl). A neighbor with no sphere inside the closed cell is a stick ending at that image coordinate. Those exterior ends are closed under inversion through the cell centre and under cubic axis permutation, so a blob on one corner fails the regression. Atom spheres stay larger than the sticks.

Ball and space-filling styles do not stroke those contacts. When --style is omitted, ionic and inorganic lattices still use ball and unit_cell.

Based on the lattice-site layout now on main from #243 (bc2515f).

Closes #238

Acceptance

ASE bulk('NaCl', 'rocksalt', a=5.6402, cubic=True) written as a VASP POSCAR:

mat-vis render POSCAR_NaCl -o nacl_bs.png \
  --backend cpu --orthogonal --background '#FFFFFF' --style ball_stick --json

Centered rocksalt NaCl ball-and-stick unit cell

Tests

  • tests/render/test_ionic_coordination_sticks.py checks CN=6, equal axis counts, centres inside the closed cell, and inversion plus cubic symmetry of both centres and stick endpoints.
  • The two-atom ionic NaCl benchmark uses the 12-atom symmetric 0/1 layout and keeps Na–Cl contacts visible.
  • The ball unit-cell checks still require the 27-site figure and no bond primitives when the representation is ball.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Extended ionic and inorganic unit-cell views were drawing a one-sided
coordination shell, such as NaCl Cl at fractional -0.5, from spanning-bond
context. Display those lattices as wrapped crystallographic sites plus
symmetric 0/1 boundary images.

Co-authored-by: Ming-Yu Guo <guomy26@mail2.sysu.edu.cn>

@SchrodingersCattt SchrodingersCattt left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Review @ 927a95fa (pending CI)

Looks right for #238.

  • Ionic contacts stay in scene["bonds"] (suppressed_ionic_bond_count == 0); ball/space_filling still don’t stroke them.
  • Half-cell MIC tie in _bond_endpoints keeps both ±a/2 arms of the octahedron instead of doubling one image.
  • coordination_stick_radius + lattice ball radii give spheres larger than sticks; omitted --style → ball for ionic/inorganic matches the viewer.
  • Regression suite in tests/render/test_ionic_coordination_sticks.py (CN=6, equal axes, omitted-style default) is solid.
  • PR body keywords are safe (Closes #238; “does not address #239”).

Merge note vs open #243: both touch scene/core.py and tests/test_inorganic_defaults.py. #244 still expects CIF NaCl draw_atoms == 4 (spanning-bond shell); #243 rewrites that path to wrapped lattice sites (12). Prefer merge #243 first, then rebase #244 onto main so the inorganic defaults assertion follows the new site contract.

Waiting on GHA 9/9. Will not squash until you say so.

Copy link
Copy Markdown
Owner Author

User feedback (needs-changes): the acceptance PNG is still a one-sided corner blob (structure clustered bottom-left; top-right of the cell empty). That is not acceptable.

Wanted instead:

  1. Box-centered / lattice-site layout (same contract as Keep ionic lattice ball centres inside the conventional cell #243: wrapped sites + symmetric 0/1 replicas; centres in [0, 1]), or
  2. If anything protrudes outside the wire, protrusions at all symmetry-equivalent places — not one corner only.

CN=6 octahedral sticks, sphere>stick radii, and omitted---style→ball stay. Follow-up sent to the cloud agent: rebase onto #243’s lattice_site_display path and re-render.

cursoragent and others added 3 commits October 26, 2026 01:15
Binary alkali-halide contacts stay in the visible bond list, and a
half-cell neighbour keeps its manifested endpoint so each site shows
all six Fm-3m arms. An omitted CLI --style follows the viewer lattice
default of ball on the unit cell.

Co-authored-by: Ming-Yu Guo <guomy26@mail2.sysu.edu.cn>
Move omitted-style resolution next to the other render CLI controls.
A 2x2x2 repeat of the one-dimensional NaCl contact includes the
junction bonds between repeated cells.

Co-authored-by: Ming-Yu Guo <guomy26@mail2.sysu.edu.cn>
Lattice-site centres stay inside the closed cell, including the 0/1
boundary images. First neighbors that have no sphere there are sticks
ending at the image coordinate, so each home site keeps six octahedral
arms and the exterior ends are inversion-symmetric.

Co-authored-by: Ming-Yu Guo <guomy26@mail2.sysu.edu.cn>
@cursor
cursor Bot force-pushed the cursor/ionic-ball-stick-nacl-dd83 branch from 927a95f to a712c65 Compare October 26, 2026 01:21
@cursor cursor Bot changed the title Draw complete rocksalt coordination sticks for ball-and-stick Draw rocksalt sticks on the wrapped symmetric unit cell Oct 26, 2026

@SchrodingersCattt SchrodingersCattt left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Re-review @ a712c652 (pending CI) — addresses the one-sided corner blob.

  • Acceptance PNG is now box-centered: wrapped sites + symmetric 0/1 replicas; sticks to exterior image ends appear on every symmetry-equivalent face.
  • Tests assert centres in [0, 1], inversion + cubic closure for both centres and stick endpoints, CN=6, and no framework/bonded-image shell.
  • Branch includes #243’s lattice-site commit; land #243 first, then this.
  • Keywords OK (Closes #238; dependency on #243 stated without auto-close phrasing).

Waiting on GHA 9/9. Will not squash until you say so.

@SchrodingersCattt SchrodingersCattt changed the title Draw rocksalt sticks on the wrapped symmetric unit cell Draw ionic ball_stick coordination sticks on the wrapped unit cell Oct 26, 2026

Copy link
Copy Markdown
Owner Author

Closing without merge: owner review found the change rocksalt-specific (NaCl octahedral CN=6 tests/acceptance/comments; stick geometry comments hard-coded around rocksalt). Redo as a general ionic lattice ball_stick coordination-sticks PR on main (post-#243).

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.

[P1] CLI ball_stick NaCl rocksalt still looks like stick maze (tiny/missing atoms) — regression of #181

2 participants