Repository navigation
Claude/inspiring brahmagupta ne81m7 - #34
Merged
tproffen merged 12 commits intoNov 16, 2026
Merged
Conversation
- discus/prog/CMakeLists.txt: drop hdf_write.f90, which was removed in de3fae9 (now in lib_f90); configure failed without this. - python/CMakeLists.txt: link experi_all before discus_all, since experi_kdo calls exp3_pdf; otherwise suite_python fails on import with an undefined symbol. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
- python/CMakeLists.txt: link experi_all before discus_all; experi_kdo calls exp3_pdf, so suite_python failed on import with an undefined symbol. - tests/python/suite_session.py: test helper around suite_python. run() uses a driver macro with a completion flag and raises MacroError when a command error stops the macro; dataset()/dataset_2d() return KUPLOT data sets as NumPy arrays. - tests/python/test_suite_python.py: expressions, error detection, crystal build, 1-D/2-D Fourier and Debye powder, checked against the legacy RESULTS/ files and against golden data. - tests/python/compare.py + tests/golden/: R-value and golden .npz/meta.json handling (DIFFUSE_UPDATE_GOLDEN=1 rewrites them). - .github/workflows/tests.yml: build with -DDIFFUSE_PYTHON=ON, run pytest and the legacy tests tagged fast,mc on Ubuntu 24.04. - Docs: tests/README.md, WP0 progress log, and the rule that work is built against and merged into claude-python-app until the first Python release (migration plan and new CLAUDE.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
…com/tproffen/DiffuseCode into claude/inspiring-brahmagupta-ne81m7 # Conflicts: # discus/prog/CMakeLists.txt
- python/diffuse/: first Python package on top of suite_python. read_structure() reads CIF/.cell (with supercell) or .stru, Crystal.atoms() returns names and fractional coordinates, powder() returns a PowderPattern (NumPy q/intensity) with a matplotlib plot(), run_macro() runs anything not wrapped yet. DISCUS output is captured, errors raise MacroError with the *** lines, and inputs are read from a scratch copy because DISCUS writes converted files next to them. - python/examples/powder_demo.py + anatase.cif: X-ray vs neutron and crystal-size broadening for anatase; python/README.md explains it. - tests/python/test_diffuse_api.py (+ golden data): reading, supercells, errors, powder peak positions, reloading an older Crystal, plotting and the demo script. The test helper moved into the package; the suite fixture now returns diffuse.session(). - CI installs matplotlib; docs and WP0 log updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
04.sro3 failed once in CI on code that had passed. MMC ignores the seed (known bug, WP0 task 0.5a), so tests tagged mc are random and can miss their statistical limits by chance. run_legacy_tests.py gets --retry-mc N: a failed mc test is re-run up to N times; a pass on retry is reported as flaky with the first failure, and a real regression still fails. CI uses --retry-mc 2. Documented in tests/README.md and the WP0 log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
"seed <n>" copied only the given value(s) into the compiler's generator state (gfortran: 8 words) and left the other words at their clock-based start-up values, so runs with the same seed differed. ini_ran_ix now derives the remaining words from the user's values. Serial MMC with the same seed now gives a byte-identical structure (04.SRO/SRO_0). With OpenMP threads MMC is still not reproducible: random_number keeps a state per thread that random_seed does not reset, and threads update the shared crystal in timing-dependent order. Documented in the WP0 log (task 0.5a). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
Tests tagged mc now run with "seed <n>" before the macro (--seed, default 1234, or a per-test "seed" in the manifest) and with OMP_THREAD_LIMIT=1, which also caps "set parallel, nthreads:all" inside the macros. Threaded MMC is not reproducible even with a seed, so one thread is needed for repeatable results. --no-seed gives the old behaviour. Seeded tests no longer need to run alone, so the "exclusive" ones share the pool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
CI failed test_macro_error_message: MacroError said "(no message)" and the DISCUS text appeared at the end of the job log. On Ubuntu the apt NumPy loads libgfortran (through OpenBLAS) before diffuse sets GFORTRAN_UNBUFFERED_PRECONNECTED, so the setting is ignored and the output stays buffered until exit. suite_python gets flush_output(), which flushes the output and error units; the session calls it before and after each captured call. Reproduced locally with GFORTRAN_UNBUFFERED_PRECONNECTED=n: fails before, passes after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
All 16 enabled mc tests, run twice with seed 1234 on one thread, gave byte-identical outputs and passed, except one 04.sro3 run: identical MC structure, but the Fourier step (lots + nufft) wrote Infinity/zeros and a NaN 3D-PDF. Not reproduced in 14 further runs. CI keeps --retry-mc 2 for this; documented in the WP0 log, tests/README.md and the workflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
- docs/: Sphinx with MyST Markdown pages (index, installation), an API reference from the docstrings (autodoc + napoleon), and the migration plan, WP0 documents and tests/README.md pulled in at build time. - sphinx-gallery runs every script in python/examples/; powder_demo.py is now a gallery example (text between code cells, plt.show()). The committed PNG is replaced by the generated gallery page. - Public docstrings in NumPy style (Parameters, Returns, Raises, Examples). - CI builds the docs with -W after the tests and uploads the HTML as the docs-html artifact. Nothing is published: GitHub Pages of this repository serves the DISCUS homepage (gh-pages). - Tests run every example script; python/README.md and CLAUDE.md explain how to build the docs and what new API needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
…lease Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
New CI job publish-docs, after a successful build and test job, for pushes to claude-python-app only. tools/publish_docs.sh replaces the python-docs/ folder of the gh-pages branch and adds an empty .nojekyll at the root (Jekyll would drop Sphinx's _static/, _images/; the homepage is plain HTML and unaffected). It refuses to publish if anything else would change, so the DISCUS homepage is never touched. Tested against a copy of gh-pages: first publish adds python-docs/ and .nojekyll only; a repeat is a no-op; an edited homepage file makes it refuse. Docs URL: https://tproffen.github.io/DiffuseCode/python-docs/ 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.
No description provided.