Structures from a formula: symmetry-based generation through PyXtal - #13
Merged
Conversation
mv.gen.from_symmetry places the atoms of a composition on Wyckoff positions of a chosen space group and randomises the free parameters that remain. With mv.gen.compositions from the previous commit the funnel now runs end to end: elements -> compositions -> structures -> energies, where before it could only start from a structure somebody already had. The output is a starting geometry and says so. Cell volume is estimated and the free coordinates are random, so generated BaTiO3 in Pm-3m comes out near 5.06 A against a measured 4.00. That is the dangerous part of a structure generator and it is stated in the notes, in uns['from_symmetry']['note'] and in the tutorial. Two columns rather than one, and the second is the one that matters. requested_space_group is what PyXtal was asked for; space_group is what pymatgen finds in the structure that came back. They disagree far more often than I expected: asking for 40 random groups for TiO2 gave 7 structures and 5 of them came back at *higher* symmetry than requested - P-6 asked for, P6/mmm delivered - because with few atoms the random free parameters land on a special position. A generator that reported only the request would be reporting its input, and a test asserts the disagreement is real and is always upward. The same run shows 33 of 40 attempts failing outright, because a random space group usually cannot host a given composition at a given cell size. A failure is a missing row plus a counted reason, never a substituted structure. The notes say plainly that passing space_groups= explicitly is both faster and more likely to give what was asked for. The composition is read from obs[source_column] when present and from the composition matrix otherwise. I had declared the column as required; the probe deleted it, the call succeeded anyway, and the claim was wrong. That is the third false claim of mine the contract probe has caught in this run of work, after an uns slot that landed on a different object and a plotting function that could not in fact plot what its notes promised. 948 tests pass on py3.12, 846 on py3.10 where PyXtal is absent and its tests skip. Contract-verified rate stays 165/165, all 16 notebooks execute, docs build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wh5NzNE9Wn49nuUm7zg2a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mv.gen.from_symmetryplaces the atoms of a composition on Wyckoff positions of a chosen space group and randomises the free parameters that remain.With
mv.gen.compositionsfrom #12 the funnel now runs end to end — elements → compositions → structures → energies — where before it could only start from a structure somebody already had.The output is a starting geometry, and says so
Cell volume is estimated and the free coordinates are random, so generated BaTiO₃ in Pm-3m comes out near 5.06 Å against a measured 4.00. That is the dangerous part of a structure generator, so it is stated in the registry notes, in
uns["from_symmetry"]["note"], and in the tutorial.Two columns, and the second is the one that matters
requested_space_groupis what PyXtal was asked for.space_groupis what pymatgen finds in the structure that came back.They disagree far more often than I expected. Asking for 40 random groups for TiO₂:
P-6 asked for, P6/mmm delivered — with few atoms the random free parameters land on a special position. A generator reporting only the request would be reporting its input. A test asserts the disagreement is real and that it is always upward.
The 33 failures are honest rather than hidden: a failure is a missing row plus a counted reason in
uns["from_symmetry"], never a substituted structure. The notes say plainly that passingspace_groups=explicitly is both faster and more likely to give what you asked for.The probe caught another of mine
I declared
obs["formula"]as required. The probe deleted it, the call succeeded anyway — the composition matrix is a perfectly good fallback — so the claim was wrong and is gone.That is the third false claim of mine this contract probe has caught in this run of work, after a
unsslot that landed on a different object (#11) and a plotting function that could not in fact plot what its notes promised (#9).Verification
🤖 Generated with Claude Code
https://claude.ai/code/session_016wh5NzNE9Wn49nuUm7zg2a