Repository navigation
Crystal arrays out through the C interface (WP3 slice 1); legacy tests prefer this checkout's build - #59
Merged
Conversation
…inary run_legacy_tests.py and test_legacy_macros.py look for discus_suite in this order: --exe, $DISCUS_SUITE, build/suite/prog/discus_suite of this checkout, PATH. PATH comes last because an installed discus_suite (e.g. a working copy in /usr/local/bin) may be older than the checkout: that made 03.pdf, 04.sro3 and 08.nano_ellipsoid fail on the owner's machine. The runner prints, and the pytest header shows, the binary, its build time and where it was found, with a warning when it comes from PATH. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
New bind(C) functions (C interface version 2), "ask, then fill": dc_crystal_size (atoms, atom types), dc_get_cell (lattice, space group, unit cells, atoms per cell), dc_get_atoms (positions as double[n][3] = cr_pos(3,n), types, property flags, molecule numbers) and dc_get_atom_types (names, B, occupancy of types 0..ntypes). Crystal.atoms() reads these instead of saving and parsing a .stru file: about 100 times faster (1 036 800 atoms: 34 ms instead of 3.7 s), same positions. read_structure() takes natoms, lattice and the space group from them (no r[490..496] round trip). New: Crystal.atom_types() (names, B, occupancy) and Crystal.space_group. Tests: test_capi calls every new function (sizes, cell, a 2x3x1 supercell that checks the (n, 3) order, wrong sizes give -1); test_wp3_structures compares the arrays with DISCUS's own "save" output for the nine golden structures (names, positions, B, properties, molecules, types, occupancy, cell, space group). Docs: api.md, powder_demo example, binding decision, plan (WP3 progress). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
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.
Targets
claude-python-app(notmaster).This PR has two commits. The second was pushed while the first was still waiting for review.
1. Step 4 / WP3, first slice: crystal arrays out (a6de9b9)
New
bind(C)functions; the C interface goes to version 2. They use the "ask, then fill" pattern:dc_crystal_sizedc_get_celldc_get_atomsdouble[n][3](the layout ofcr_pos(3,n)), types, property flags, molecule numbersdc_get_atom_typesPython side:
Crystal.atoms()reads these instead of saving and parsing a.strufile, with the same positions:save+ parseread_structure()takes natoms, lattice and the space group from them, with nor[490..496]round trip.New:
Crystal.atom_types()(names, B, occupancy) andCrystal.space_group.Tests:
test_capi: every new function, including a 2×3×1 supercell that checks the(n, 3)order, and wrong sizes returning -1.test_wp3_structures: the arrays against DISCUS's ownsaveoutput for the nine golden structures (names, positions, B, properties, molecules, types, occupancy, cell, space group).Docs:
api.md, thepowder_demoexample, the binding decision and the plan (WP3 progress).2. Legacy tests: which
discus_suite(fee9d06)On the owner's machine, pytest picked up an older
discus_suiteworking copy in/usr/local/bin, so03.pdf,04.sro3and08.nano_ellipsoidfailed, and nothing in the output said which binary had run.tools/run_legacy_tests.pyandtests/python/test_legacy_macros.pynow look in this order:--exe$DISCUS_SUITEbuild/suite/prog/discus_suiteof this checkoutPATH, lastPATH.tests/README.md: the search order, and settingDISCUS_SUITEin the virtual environment.Tests (local)
tests/python: 141 passed, 34 skipped, 2 xfailed.discus_suitelookup checked in four cases:DISCUS_SUITEset, onlyPATH, a build inside the checkout, none found.-W: OK.CI runs every job, because the C interface (
python/*.f90,*.h) changed.🤖 Generated with Claude Code
https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v