Repository navigation
Conversation
…method list in the plan Crystal.save(path): DISCUS's own format through the save menu (reset, outfile, write all): .stru, or .h5/.hdf5 (format nexus); read_structure now also reads .h5/.hdf5. Crystal.export(path, format=, ...): DISCUS export as CIF (space_group "P1" or "original"), SHELX (cycles, force, origin, wavelength), RMCProfile (version 6/7), VASP/POSCAR, Scatty (site average/indiv); the format from the suffix or format=. Both load the crystal first if DISCUS holds another one, refuse names DISCUS cannot take, and check that the file was written. Tests (tests/python/test_crystal_save_export.py), each reading back what was written: * save .stru and .h5 for molecules (cmm2), a monoclinic crystal (CuO) and an anisotropic tensor (P6), and a crystal made in Python: atoms, types, B, occupancy, tensors, property flags, molecules, cell, space group, cell counts identical; the same Fourier map. * export CIF read by gemmi (P1, the whole crystal as one cell, U_iso = B/8 pi^2) and by DISCUS; RMCProfile through DISCUS's import (same sites after a whole-cell shift); VASP and Scatty parsed (Scatty: site + cell gives every position); SHELX writes a file; bad arguments. DISCUS bugs found, kept as strict xfail tests: * read stru sets the tensors of the first 5 x (atoms per cell) atoms only; a saved anisotropic supercell reads back with wrong tensors (a Fourier map changes by up to 3 %); isotropic crystals only report it wrong. * export cif with spcgr:original lists the whole unit cell with the space-group operations; readers (DISCUS and gemmi) generate 80 atoms for anatase instead of 12. migration/WP3_Next_Steps.md: the DISCUS bugs found in crystal I/O, and a new section 3 with the DISCUS routines that should become Crystal methods (writing, questions, changes; what stays outside the class; design questions; first batch), and the updated order of next steps. Notebook crystals_and_ase.ipynb: saving and exporting. api.md: save, export. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Yw8KkfPLawp8Po4f5Bc9v
This branch has not been deployed
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).What
Crystal.save(path)writes DISCUS's own format through thesavemenu (reset,outfile,write all):.stru(text), or.h5/.hdf5(format nexus, binary, compact for large crystals).read_structurenow also reads.h5/.hdf5.Crystal.export(path, format=..., ...)writes files for other programs through DISCUSexport; the format comes from the suffix or fromformat=:space_group:"P1"or"original".inscycles,force,origin,wavelength.rmc6fversion: 6 or 7POSCARsite:"average"or"indiv"Both methods load the crystal first if DISCUS holds another one, refuse file names DISCUS cannot take (commas, quotes), and check that the file was written.
Tests: each reads back what was written
New file
tests/python/test_crystal_save_export.py:saveto.struand.h5: a crystal with molecules (cmm2), a monoclinic one (CuO), an anisotropic tensor (P6), and a crystal made in Python. Atoms, types, B, occupancy, tensors, property flags, molecules, cell, space group and cell counts are identical, and the Fourier map is the same.import; the same sites after a whole-cell shift.test_wp3_structures.DISCUS bugs found, kept as strict xfail tests:
read strusets the displacement tensors of the first 5 × (atoms per cell) atoms only; every later atom keeps tensor 1.adps(); their calculations use B and are unaffected (checked).make_crystalalready works around this.export cifwithspcgr:originallists the whole unit cell together with the space-group operations, so readers (DISCUS and gemmi alike) generate 80 atoms for anatase instead of 12. The docstring warns to use"P1"until this is fixed.Plan
migration/WP3_Next_Steps.md:Crystalmethods.composition,asymmetric_unit,cut,replace,remove,thermal_displacements; then the chem analysis.Docs
api.md:save,export.crystals_and_ase.ipynb: a "Saving and exporting" section; it ran in a Jupyter kernel.Local results:
tests/python: 212 passed, 34 skipped, 5 xfailed-W: OKGenerated by Claude Code