Skip to content

Supercell - #61

Open
xivh wants to merge 3 commits into
prisms-center:2.Xfrom
xivh:supercell
Open

xivh wants to merge 3 commits into
prisms-center:2.Xfrom
xivh:supercell

Conversation

@xivh

@xivh xivh commented May 14, 2026

Copy link
Copy Markdown
Contributor
  • Expose supercell name
  • Add get method to SupercellSet

@bpuchala bpuchala left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for this, I agree it is helpful.

A couple other requests besides the review comments:

  1. Merge conflict. GitHub marks it CONFLICTING after #62 merged. The only conflict is in test_supercell_set.py, where both PRs appended tests at the end of the file. A rebase is needed.
  2. Add a CHANGELOG entry
  3. Add full docstrings on the get_* methods. The matching add_* methods have full Parameters/Returns sections, but these are one-liners. They should say what's returned (Optional[SupercellRecord]) and that the name lookup only finds canonical supercells.

py::arg("record"))
// get
.def(
"get_supercell",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this should be get_by_supercell.

)pbdoc",
py::arg("transformation_matrix_to_super").noconvert())
.def(
"get_record",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think this is necessary? I would remove it.

)pbdoc",
py::arg("record"))
.def(
"get",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would remove this.

Notes
-----

.. rubric:: Special Methods

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd like to keep the .. rubric:: Special Methods section pattern to document special methods that don't show up in the class documentation otherwise. I'm happy if the contents of the section include nicer .. code-block:: Python examples like you've done here than the previous short bullets.

)pbdoc",
py::arg("data"), py::arg("supercells"))
.def(
"supercell_name",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Make supercell_name a read-only property, not a method. SupercellRecord.supercell_name is an attribute, and on Supercell the cheap derived values (n_sites, n_unitcells, superlattice, transformation_matrix_to_super) are all properties. This will avoid the confusion of record.supercell_name but supercell.supercell_name().

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.

2 participants