cristma 0.1.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. cristma-0.1.0b1/LICENSE +28 -0
  2. cristma-0.1.0b1/MANIFEST.in +6 -0
  3. cristma-0.1.0b1/PKG-INFO +232 -0
  4. cristma-0.1.0b1/README.md +210 -0
  5. cristma-0.1.0b1/THIRD_PARTY_NOTICES.md +104 -0
  6. cristma-0.1.0b1/pyproject.toml +45 -0
  7. cristma-0.1.0b1/setup.cfg +4 -0
  8. cristma-0.1.0b1/src/cristma/__init__.py +105 -0
  9. cristma-0.1.0b1/src/cristma/chemistry/__init__.py +62 -0
  10. cristma-0.1.0b1/src/cristma/chemistry/analyzer.py +33 -0
  11. cristma-0.1.0b1/src/cristma/chemistry/classification.py +241 -0
  12. cristma-0.1.0b1/src/cristma/chemistry/composition.py +119 -0
  13. cristma-0.1.0b1/src/cristma/chemistry/elements.py +41 -0
  14. cristma-0.1.0b1/src/cristma/chemistry/evidence.py +20 -0
  15. cristma-0.1.0b1/src/cristma/chemistry/grammar.py +282 -0
  16. cristma-0.1.0b1/src/cristma/chemistry/species.py +140 -0
  17. cristma-0.1.0b1/src/cristma/core/__init__.py +25 -0
  18. cristma-0.1.0b1/src/cristma/core/cell.py +92 -0
  19. cristma-0.1.0b1/src/cristma/core/structure.py +17 -0
  20. cristma-0.1.0b1/src/cristma/core/values.py +68 -0
  21. cristma-0.1.0b1/src/cristma/crystal_chemistry/__init__.py +106 -0
  22. cristma-0.1.0b1/src/cristma/crystal_chemistry/_ring_search.py +201 -0
  23. cristma-0.1.0b1/src/cristma/crystal_chemistry/_ring_symmetry.py +291 -0
  24. cristma-0.1.0b1/src/cristma/crystal_chemistry/contacts.py +195 -0
  25. cristma-0.1.0b1/src/cristma/crystal_chemistry/periodic_connectivity.py +270 -0
  26. cristma-0.1.0b1/src/cristma/crystal_chemistry/policy.py +39 -0
  27. cristma-0.1.0b1/src/cristma/crystal_chemistry/polyhedra.py +219 -0
  28. cristma-0.1.0b1/src/cristma/crystal_chemistry/representation.py +148 -0
  29. cristma-0.1.0b1/src/cristma/crystal_chemistry/resolver.py +671 -0
  30. cristma-0.1.0b1/src/cristma/crystal_chemistry/ring_finder.py +391 -0
  31. cristma-0.1.0b1/src/cristma/crystal_chemistry/rings.py +188 -0
  32. cristma-0.1.0b1/src/cristma/crystal_chemistry/shannon_distance.py +66 -0
  33. cristma-0.1.0b1/src/cristma/crystal_chemistry/structural_blocks.py +161 -0
  34. cristma-0.1.0b1/src/cristma/crystal_chemistry/structural_graph.py +361 -0
  35. cristma-0.1.0b1/src/cristma/crystal_chemistry/structural_units.py +274 -0
  36. cristma-0.1.0b1/src/cristma/crystallography/__init__.py +27 -0
  37. cristma-0.1.0b1/src/cristma/crystallography/catalog.py +233 -0
  38. cristma-0.1.0b1/src/cristma/crystallography/local_geometry.py +108 -0
  39. cristma-0.1.0b1/src/cristma/crystallography/orbit.py +345 -0
  40. cristma-0.1.0b1/src/cristma/crystallography/space_group.py +61 -0
  41. cristma-0.1.0b1/src/cristma/crystallography/wyckoff.py +148 -0
  42. cristma-0.1.0b1/src/cristma/diagnostics.py +45 -0
  43. cristma-0.1.0b1/src/cristma/geometry/__init__.py +25 -0
  44. cristma-0.1.0b1/src/cristma/geometry/coordination.py +69 -0
  45. cristma-0.1.0b1/src/cristma/geometry/finder.py +143 -0
  46. cristma-0.1.0b1/src/cristma/geometry/neighbors.py +144 -0
  47. cristma-0.1.0b1/src/cristma/io/__init__.py +39 -0
  48. cristma-0.1.0b1/src/cristma/io/cif/__init__.py +19 -0
  49. cristma-0.1.0b1/src/cristma/io/cif/document.py +140 -0
  50. cristma-0.1.0b1/src/cristma/io/cif/handler.py +35 -0
  51. cristma-0.1.0b1/src/cristma/io/cif/lexer.py +171 -0
  52. cristma-0.1.0b1/src/cristma/io/cif/mapper.py +866 -0
  53. cristma-0.1.0b1/src/cristma/io/cif/names.py +54 -0
  54. cristma-0.1.0b1/src/cristma/io/cif/parser.py +213 -0
  55. cristma-0.1.0b1/src/cristma/io/cif/probe.py +23 -0
  56. cristma-0.1.0b1/src/cristma/io/cif/tokens.py +27 -0
  57. cristma-0.1.0b1/src/cristma/io/cif/writer.py +301 -0
  58. cristma-0.1.0b1/src/cristma/io/diagnostics.py +5 -0
  59. cristma-0.1.0b1/src/cristma/io/formats.py +152 -0
  60. cristma-0.1.0b1/src/cristma/io/pdb/__init__.py +13 -0
  61. cristma-0.1.0b1/src/cristma/io/pdb/document.py +56 -0
  62. cristma-0.1.0b1/src/cristma/io/pdb/handler.py +23 -0
  63. cristma-0.1.0b1/src/cristma/io/pdb/mapper.py +177 -0
  64. cristma-0.1.0b1/src/cristma/io/pdb/parser.py +169 -0
  65. cristma-0.1.0b1/src/cristma/io/pdb/probe.py +15 -0
  66. cristma-0.1.0b1/src/cristma/io/registry.py +175 -0
  67. cristma-0.1.0b1/src/cristma/io/result.py +43 -0
  68. cristma-0.1.0b1/src/cristma/io/shelx/__init__.py +53 -0
  69. cristma-0.1.0b1/src/cristma/io/shelx/document.py +108 -0
  70. cristma-0.1.0b1/src/cristma/io/shelx/handler.py +37 -0
  71. cristma-0.1.0b1/src/cristma/io/shelx/mapper.py +387 -0
  72. cristma-0.1.0b1/src/cristma/io/shelx/occupancy.py +61 -0
  73. cristma-0.1.0b1/src/cristma/io/shelx/parser.py +276 -0
  74. cristma-0.1.0b1/src/cristma/io/shelx/probe.py +26 -0
  75. cristma-0.1.0b1/src/cristma/io/shelx/records.py +79 -0
  76. cristma-0.1.0b1/src/cristma/io/shelx/sfac.py +70 -0
  77. cristma-0.1.0b1/src/cristma/io/shelx/symmetry.py +137 -0
  78. cristma-0.1.0b1/src/cristma/io/shelx/writer.py +189 -0
  79. cristma-0.1.0b1/src/cristma/io/source.py +171 -0
  80. cristma-0.1.0b1/src/cristma/io/vasp/__init__.py +45 -0
  81. cristma-0.1.0b1/src/cristma/io/vasp/document.py +218 -0
  82. cristma-0.1.0b1/src/cristma/io/vasp/handler.py +59 -0
  83. cristma-0.1.0b1/src/cristma/io/vasp/mapper.py +123 -0
  84. cristma-0.1.0b1/src/cristma/io/vasp/numeric.py +75 -0
  85. cristma-0.1.0b1/src/cristma/io/vasp/outcar.py +221 -0
  86. cristma-0.1.0b1/src/cristma/io/vasp/poscar.py +254 -0
  87. cristma-0.1.0b1/src/cristma/io/vasp/probe.py +60 -0
  88. cristma-0.1.0b1/src/cristma/io/vasp/vasprun.py +248 -0
  89. cristma-0.1.0b1/src/cristma/io/vasp/xdatcar.py +191 -0
  90. cristma-0.1.0b1/src/cristma/io/xyz/__init__.py +36 -0
  91. cristma-0.1.0b1/src/cristma/io/xyz/document.py +143 -0
  92. cristma-0.1.0b1/src/cristma/io/xyz/handler.py +25 -0
  93. cristma-0.1.0b1/src/cristma/io/xyz/index.py +87 -0
  94. cristma-0.1.0b1/src/cristma/io/xyz/mapper.py +155 -0
  95. cristma-0.1.0b1/src/cristma/io/xyz/metadata.py +180 -0
  96. cristma-0.1.0b1/src/cristma/io/xyz/parser.py +267 -0
  97. cristma-0.1.0b1/src/cristma/io/xyz/probe.py +30 -0
  98. cristma-0.1.0b1/src/cristma/reference_data/__init__.py +28 -0
  99. cristma-0.1.0b1/src/cristma/reference_data/chemical_reference.py +345 -0
  100. cristma-0.1.0b1/src/cristma/reference_data/elements.py +75 -0
  101. cristma-0.1.0b1/src/cristma/reference_data/facade.py +32 -0
  102. cristma-0.1.0b1/src/cristma/reference_data/radii.py +79 -0
  103. cristma-0.1.0b1/src/cristma/reference_data/resources/COVALENT_RADII_SOURCE.md +26 -0
  104. cristma-0.1.0b1/src/cristma/reference_data/resources/PYMATGEN_LICENSE.txt +21 -0
  105. cristma-0.1.0b1/src/cristma/reference_data/resources/QCELEMENTAL_LICENSE.txt +29 -0
  106. cristma-0.1.0b1/src/cristma/reference_data/resources/SHANNON_SOURCE.md +24 -0
  107. cristma-0.1.0b1/src/cristma/reference_data/resources/chemical_reference_v3.json +6883 -0
  108. cristma-0.1.0b1/src/cristma/reference_data/resources/chemical_reference_v3_1.json +7074 -0
  109. cristma-0.1.0b1/src/cristma/reference_data/resources/covalent_radii.json +726 -0
  110. cristma-0.1.0b1/src/cristma/reference_data/resources/crystallography/SOURCE.md +44 -0
  111. cristma-0.1.0b1/src/cristma/reference_data/resources/crystallography/SPGLIB_LICENSE.txt +26 -0
  112. cristma-0.1.0b1/src/cristma/reference_data/resources/crystallography/space_groups.json +1 -0
  113. cristma-0.1.0b1/src/cristma/reference_data/resources/crystallography/wyckoff_positions.json +1 -0
  114. cristma-0.1.0b1/src/cristma/reference_data/resources/shannon_radii.json +3962 -0
  115. cristma-0.1.0b1/src/cristma/reference_data/shannon.py +106 -0
  116. cristma-0.1.0b1/src/cristma/structure/__init__.py +52 -0
  117. cristma-0.1.0b1/src/cristma/structure/collection.py +220 -0
  118. cristma-0.1.0b1/src/cristma/structure/crystal.py +139 -0
  119. cristma-0.1.0b1/src/cristma/structure/identity.py +84 -0
  120. cristma-0.1.0b1/src/cristma/structure/molecular.py +161 -0
  121. cristma-0.1.0b1/src/cristma/structure/occupation.py +37 -0
  122. cristma-0.1.0b1/src/cristma/structure/position.py +18 -0
  123. cristma-0.1.0b1/src/cristma/structure/properties.py +90 -0
  124. cristma-0.1.0b1/src/cristma/structure/view.py +82 -0
  125. cristma-0.1.0b1/src/cristma/symmetry/__init__.py +18 -0
  126. cristma-0.1.0b1/src/cristma/symmetry/affine.py +135 -0
  127. cristma-0.1.0b1/src/cristma/symmetry/displacement.py +149 -0
  128. cristma-0.1.0b1/src/cristma/symmetry/orbit.py +210 -0
  129. cristma-0.1.0b1/src/cristma.egg-info/PKG-INFO +232 -0
  130. cristma-0.1.0b1/src/cristma.egg-info/SOURCES.txt +131 -0
  131. cristma-0.1.0b1/src/cristma.egg-info/dependency_links.txt +1 -0
  132. cristma-0.1.0b1/src/cristma.egg-info/requires.txt +4 -0
  133. cristma-0.1.0b1/src/cristma.egg-info/top_level.txt +1 -0
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, ABKuznetsov
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its contributors
16
+ may be used to endorse or promote products derived from this software
17
+ without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,6 @@
1
+ prune tests
2
+ prune docs
3
+
4
+ global-exclude __pycache__
5
+ global-exclude *.py[cod]
6
+ global-exclude .DS_Store
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: cristma
3
+ Version: 0.1.0b1
4
+ Summary: Physics-first crystallography, crystal chemistry, and periodic structure analysis
5
+ License-Expression: BSD-3-Clause
6
+ Project-URL: Repository, https://github.com/ABKuznetsov/CrIStMa
7
+ Project-URL: Issues, https://github.com/ABKuznetsov/CrIStMa/issues
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
13
+ Classifier: Topic :: Scientific/Engineering :: Physics
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: THIRD_PARTY_NOTICES.md
18
+ Requires-Dist: numpy>=1.26
19
+ Provides-Extra: reference-build
20
+ Requires-Dist: spglib==2.7.0; extra == "reference-build"
21
+ Dynamic: license-file
22
+
23
+ # CrIStMa
24
+
25
+ **Crystallographic Infrastructure for Structures and Materials.**
26
+
27
+ A compact, physics-first Python library for crystallography, crystal chemistry,
28
+ and periodic structure analysis.
29
+
30
+ [![Python](https://img.shields.io/badge/Python-3.11%2B-1479b8)](https://www.python.org/)
31
+ ![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-777777)
32
+ [![License](https://img.shields.io/badge/License-BSD--3--Clause-55a630)](https://github.com/ABKuznetsov/CrIStMa/blob/main/LICENSE)
33
+ [![Status](https://img.shields.io/badge/Status-Beta-e6a700)](https://github.com/ABKuznetsov/CrIStMa/tree/v0.1.0b1)
34
+
35
+ ## Overview
36
+
37
+ CrIStMa provides a common scientific foundation for programs that work with
38
+ crystal and molecular structures. It reads widely used structural formats,
39
+ maps them into one canonical model, and offers independent tools for symmetry,
40
+ geometry, crystal chemistry, and periodic topology.
41
+
42
+ The project exists because scientific logic is often coupled to a particular
43
+ file parser, graphical application, or large external framework. That makes
44
+ calculations difficult to reuse, compare, and audit. CrIStMa keeps these layers
45
+ separate: formats end at the I/O boundary, scientific operations receive
46
+ explicit inputs, and results retain diagnostics and provenance.
47
+
48
+ CrIStMa is not an end-user application and does not prescribe a workflow. It
49
+ is a reusable scientific library for scripts, notebooks, research software,
50
+ desktop applications, and automated data-processing systems.
51
+
52
+ ## What it can do
53
+
54
+ - read CIF, SHELX RES/INS, VASP, PDB, XYZ, and extXYZ structures through one
55
+ content-aware API;
56
+ - preserve source documents where supported or write a normalized structure;
57
+ - represent periodic crystals and non-periodic molecules as distinct physical
58
+ models;
59
+ - expand crystallographic sites using exact symmetry operations;
60
+ - use a bundled catalog of all 530 Hall settings and their Wyckoff positions;
61
+ - build symmetry orbits and assign Wyckoff positions;
62
+ - calculate finite and periodic neighbour graphs and coordination
63
+ environments;
64
+ - analyze composition, oxidation-state evidence, coordination shells, and
65
+ coordination polyhedra;
66
+ - assemble structural units and classify periodic blocks as finite units,
67
+ chains, layers, or frameworks;
68
+ - find translation-aware finite rings in periodic structural
69
+ representations;
70
+ - report recoverable problems as structured diagnostics instead of hiding
71
+ assumptions or silently changing the input.
72
+
73
+ ## Scientific model
74
+
75
+ All supported formats converge on the same native structures:
76
+
77
+ ```text
78
+ CIF / RES / INS / POSCAR / XDATCAR / OUTCAR / vasprun.xml / PDB / XYZ / extXYZ
79
+ |
80
+ v
81
+ CrystalStructure | MolecularStructure
82
+ |
83
+ v
84
+ symmetry / geometry / chemistry / periodic topology
85
+ ```
86
+
87
+ The canonical structure is the source of truth for calculations. Parsed
88
+ documents remain available for source preservation and provenance, but
89
+ file-specific details do not control downstream scientific semantics.
90
+
91
+ Calculated objects are immutable results rather than hidden application state.
92
+ The caller decides calculation order, caching, storage, presentation, and user
93
+ interaction.
94
+
95
+ ## Installation
96
+
97
+ CrIStMa requires Python 3.11 or newer.
98
+
99
+ After the public beta is published on PyPI:
100
+
101
+ ```bash
102
+ python -m pip install --pre cristma
103
+ ```
104
+
105
+ To install the current source checkout:
106
+
107
+ ```bash
108
+ git clone https://github.com/ABKuznetsov/CrIStMa.git
109
+ cd CrIStMa
110
+ python -m pip install -e .
111
+ ```
112
+
113
+ NumPy is the only runtime dependency. Optional development and reference-data
114
+ dependencies are kept outside the scientific runtime.
115
+
116
+ ## Quick start
117
+
118
+ ```python
119
+ import cristma
120
+ from cristma.geometry import CoordinationAnalyzer, NeighborFinder
121
+ from cristma.symmetry import expand_structure
122
+
123
+ result = cristma.read("sample.cif")
124
+
125
+ for diagnostic in result.diagnostics:
126
+ print(diagnostic.severity.value, diagnostic.code, diagnostic.message)
127
+
128
+ if not result.ok or not result.structures:
129
+ raise RuntimeError("The structure could not be read")
130
+
131
+ crystal = result.structures.primary or result.structures[0]
132
+ view = expand_structure(crystal)
133
+ neighbors = NeighborFinder(cutoff=3.0).find(view)
134
+ coordination = CoordinationAnalyzer().analyze(view, neighbors)
135
+
136
+ print(crystal.cell.volume)
137
+ print(len(view.atoms), len(neighbors.edges))
138
+ print(len(coordination.environments))
139
+ ```
140
+
141
+ The same entry point reads other supported formats:
142
+
143
+ ```python
144
+ structure = cristma.read("POSCAR").structures[0]
145
+ trajectory = cristma.read("XDATCAR").structures
146
+ model = cristma.read("molecule.pdb").structures[0]
147
+ ```
148
+
149
+ ## Native structure I/O
150
+
151
+ | Format | Reading | Writing | Notes |
152
+ | --- | --- | --- | --- |
153
+ | CIF 1.1 | Yes | Preserve and canonical | Source order, comments, unknown tags, and numeric text can be retained |
154
+ | SHELX RES/INS | Yes | Preserve and canonical | Canonical output requires an explicit wavelength |
155
+ | VASP POSCAR/CONTCAR | Yes | — | Selective Dynamics and reported velocities are retained |
156
+ | VASP XDATCAR | Yes | — | Frames are indexed and loaded lazily |
157
+ | VASP OUTCAR | Structural frames | — | Per-atom forces and units are retained |
158
+ | `vasprun.xml` | Structural frames | — | Trajectory-oriented structural parsing |
159
+ | PDB | Yes | — | Crystal and molecular coordinate models |
160
+ | XYZ/extXYZ | Yes | — | Typed properties and lazy trajectories |
161
+
162
+ CrIStMa implements these readers natively. Gemmi, pymatgen, PyXtal, CrysPy,
163
+ GSAS-II, SHELX, and graphical frameworks are not required at runtime.
164
+
165
+ ## Design principles
166
+
167
+ - **Physics before interface.** Scientific meaning is not determined by a GUI
168
+ or storage format.
169
+ - **One canonical model.** Every reader produces the same structure types for
170
+ downstream calculations.
171
+ - **Explicit assumptions.** Policies, tolerances, limits, and incomplete
172
+ searches are visible in inputs and results.
173
+ - **Traceable results.** Symmetry images, reference data, transformations, and
174
+ diagnostics retain provenance.
175
+ - **Composable tools.** Calculators are independent and do not rely on a
176
+ hidden current structure or global workflow.
177
+ - **Small runtime.** The core depends only on Python and NumPy.
178
+
179
+ ## Beta status
180
+
181
+ `0.1.0b1` is the first public beta. The implemented scientific core is covered
182
+ by automated tests and is ready for evaluation and integration. Until the
183
+ first stable release, public APIs may still change when required to correct or
184
+ clarify scientific contracts.
185
+
186
+ The current beta covers structural I/O, canonical structure models, symmetry,
187
+ periodic geometry, crystal chemistry, structural representations, periodic
188
+ block classification, and ring analysis. It does not yet calculate diffraction
189
+ patterns or perform structure refinement.
190
+
191
+ ## Roadmap
192
+
193
+ Planned scientific layers are developed as independent milestones:
194
+
195
+ 1. reciprocal metrics, reflection generation, systematic absences, reciprocal
196
+ symmetry orbits, multiplicity, and Friedel relations;
197
+ 2. scattering contexts and structure-factor calculations;
198
+ 3. radiation-aware powder lines and physical corrections;
199
+ 4. calculated diffraction profiles on explicit grids;
200
+ 5. additional structural transforms, hierarchy and topology tools, and
201
+ refinement built over the same forward calculations.
202
+
203
+ The roadmap describes direction, not a compatibility or release-date promise.
204
+ CrIStMa will remain independent of any particular consuming application.
205
+
206
+ ## License and reference data
207
+
208
+ Original CrIStMa code is distributed under the permissive
209
+ [BSD-3-Clause license](https://github.com/ABKuznetsov/CrIStMa/blob/main/LICENSE).
210
+ It may be used in open-source, commercial, and closed-source software subject
211
+ to the license notice requirements.
212
+
213
+ Bundled reference resources retain their own attribution and provenance:
214
+
215
+ - space-group and Wyckoff data normalized from pinned spglib 2.7.0 resources
216
+ under BSD-3-Clause;
217
+ - Cordero covalent radii compiled from QCElemental resources under
218
+ BSD-3-Clause;
219
+ - Shannon radii compiled from a pinned pymatgen artifact under MIT;
220
+ - selected Crystallography Open Database fixtures under CC0/public-domain
221
+ terms;
222
+ - curated chemical-reference rules with their scientific literature recorded
223
+ in the versioned resources.
224
+
225
+ Versions, commits, hashes, known provenance limitations, and redistribution
226
+ requirements are listed in
227
+ [THIRD_PARTY_NOTICES.md](https://github.com/ABKuznetsov/CrIStMa/blob/main/THIRD_PARTY_NOTICES.md).
228
+
229
+ ## Author
230
+
231
+ Artem B. Kuznetsov<br>
232
+ [GitHub](https://github.com/ABKuznetsov)
@@ -0,0 +1,210 @@
1
+ # CrIStMa
2
+
3
+ **Crystallographic Infrastructure for Structures and Materials.**
4
+
5
+ A compact, physics-first Python library for crystallography, crystal chemistry,
6
+ and periodic structure analysis.
7
+
8
+ [![Python](https://img.shields.io/badge/Python-3.11%2B-1479b8)](https://www.python.org/)
9
+ ![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-777777)
10
+ [![License](https://img.shields.io/badge/License-BSD--3--Clause-55a630)](https://github.com/ABKuznetsov/CrIStMa/blob/main/LICENSE)
11
+ [![Status](https://img.shields.io/badge/Status-Beta-e6a700)](https://github.com/ABKuznetsov/CrIStMa/tree/v0.1.0b1)
12
+
13
+ ## Overview
14
+
15
+ CrIStMa provides a common scientific foundation for programs that work with
16
+ crystal and molecular structures. It reads widely used structural formats,
17
+ maps them into one canonical model, and offers independent tools for symmetry,
18
+ geometry, crystal chemistry, and periodic topology.
19
+
20
+ The project exists because scientific logic is often coupled to a particular
21
+ file parser, graphical application, or large external framework. That makes
22
+ calculations difficult to reuse, compare, and audit. CrIStMa keeps these layers
23
+ separate: formats end at the I/O boundary, scientific operations receive
24
+ explicit inputs, and results retain diagnostics and provenance.
25
+
26
+ CrIStMa is not an end-user application and does not prescribe a workflow. It
27
+ is a reusable scientific library for scripts, notebooks, research software,
28
+ desktop applications, and automated data-processing systems.
29
+
30
+ ## What it can do
31
+
32
+ - read CIF, SHELX RES/INS, VASP, PDB, XYZ, and extXYZ structures through one
33
+ content-aware API;
34
+ - preserve source documents where supported or write a normalized structure;
35
+ - represent periodic crystals and non-periodic molecules as distinct physical
36
+ models;
37
+ - expand crystallographic sites using exact symmetry operations;
38
+ - use a bundled catalog of all 530 Hall settings and their Wyckoff positions;
39
+ - build symmetry orbits and assign Wyckoff positions;
40
+ - calculate finite and periodic neighbour graphs and coordination
41
+ environments;
42
+ - analyze composition, oxidation-state evidence, coordination shells, and
43
+ coordination polyhedra;
44
+ - assemble structural units and classify periodic blocks as finite units,
45
+ chains, layers, or frameworks;
46
+ - find translation-aware finite rings in periodic structural
47
+ representations;
48
+ - report recoverable problems as structured diagnostics instead of hiding
49
+ assumptions or silently changing the input.
50
+
51
+ ## Scientific model
52
+
53
+ All supported formats converge on the same native structures:
54
+
55
+ ```text
56
+ CIF / RES / INS / POSCAR / XDATCAR / OUTCAR / vasprun.xml / PDB / XYZ / extXYZ
57
+ |
58
+ v
59
+ CrystalStructure | MolecularStructure
60
+ |
61
+ v
62
+ symmetry / geometry / chemistry / periodic topology
63
+ ```
64
+
65
+ The canonical structure is the source of truth for calculations. Parsed
66
+ documents remain available for source preservation and provenance, but
67
+ file-specific details do not control downstream scientific semantics.
68
+
69
+ Calculated objects are immutable results rather than hidden application state.
70
+ The caller decides calculation order, caching, storage, presentation, and user
71
+ interaction.
72
+
73
+ ## Installation
74
+
75
+ CrIStMa requires Python 3.11 or newer.
76
+
77
+ After the public beta is published on PyPI:
78
+
79
+ ```bash
80
+ python -m pip install --pre cristma
81
+ ```
82
+
83
+ To install the current source checkout:
84
+
85
+ ```bash
86
+ git clone https://github.com/ABKuznetsov/CrIStMa.git
87
+ cd CrIStMa
88
+ python -m pip install -e .
89
+ ```
90
+
91
+ NumPy is the only runtime dependency. Optional development and reference-data
92
+ dependencies are kept outside the scientific runtime.
93
+
94
+ ## Quick start
95
+
96
+ ```python
97
+ import cristma
98
+ from cristma.geometry import CoordinationAnalyzer, NeighborFinder
99
+ from cristma.symmetry import expand_structure
100
+
101
+ result = cristma.read("sample.cif")
102
+
103
+ for diagnostic in result.diagnostics:
104
+ print(diagnostic.severity.value, diagnostic.code, diagnostic.message)
105
+
106
+ if not result.ok or not result.structures:
107
+ raise RuntimeError("The structure could not be read")
108
+
109
+ crystal = result.structures.primary or result.structures[0]
110
+ view = expand_structure(crystal)
111
+ neighbors = NeighborFinder(cutoff=3.0).find(view)
112
+ coordination = CoordinationAnalyzer().analyze(view, neighbors)
113
+
114
+ print(crystal.cell.volume)
115
+ print(len(view.atoms), len(neighbors.edges))
116
+ print(len(coordination.environments))
117
+ ```
118
+
119
+ The same entry point reads other supported formats:
120
+
121
+ ```python
122
+ structure = cristma.read("POSCAR").structures[0]
123
+ trajectory = cristma.read("XDATCAR").structures
124
+ model = cristma.read("molecule.pdb").structures[0]
125
+ ```
126
+
127
+ ## Native structure I/O
128
+
129
+ | Format | Reading | Writing | Notes |
130
+ | --- | --- | --- | --- |
131
+ | CIF 1.1 | Yes | Preserve and canonical | Source order, comments, unknown tags, and numeric text can be retained |
132
+ | SHELX RES/INS | Yes | Preserve and canonical | Canonical output requires an explicit wavelength |
133
+ | VASP POSCAR/CONTCAR | Yes | — | Selective Dynamics and reported velocities are retained |
134
+ | VASP XDATCAR | Yes | — | Frames are indexed and loaded lazily |
135
+ | VASP OUTCAR | Structural frames | — | Per-atom forces and units are retained |
136
+ | `vasprun.xml` | Structural frames | — | Trajectory-oriented structural parsing |
137
+ | PDB | Yes | — | Crystal and molecular coordinate models |
138
+ | XYZ/extXYZ | Yes | — | Typed properties and lazy trajectories |
139
+
140
+ CrIStMa implements these readers natively. Gemmi, pymatgen, PyXtal, CrysPy,
141
+ GSAS-II, SHELX, and graphical frameworks are not required at runtime.
142
+
143
+ ## Design principles
144
+
145
+ - **Physics before interface.** Scientific meaning is not determined by a GUI
146
+ or storage format.
147
+ - **One canonical model.** Every reader produces the same structure types for
148
+ downstream calculations.
149
+ - **Explicit assumptions.** Policies, tolerances, limits, and incomplete
150
+ searches are visible in inputs and results.
151
+ - **Traceable results.** Symmetry images, reference data, transformations, and
152
+ diagnostics retain provenance.
153
+ - **Composable tools.** Calculators are independent and do not rely on a
154
+ hidden current structure or global workflow.
155
+ - **Small runtime.** The core depends only on Python and NumPy.
156
+
157
+ ## Beta status
158
+
159
+ `0.1.0b1` is the first public beta. The implemented scientific core is covered
160
+ by automated tests and is ready for evaluation and integration. Until the
161
+ first stable release, public APIs may still change when required to correct or
162
+ clarify scientific contracts.
163
+
164
+ The current beta covers structural I/O, canonical structure models, symmetry,
165
+ periodic geometry, crystal chemistry, structural representations, periodic
166
+ block classification, and ring analysis. It does not yet calculate diffraction
167
+ patterns or perform structure refinement.
168
+
169
+ ## Roadmap
170
+
171
+ Planned scientific layers are developed as independent milestones:
172
+
173
+ 1. reciprocal metrics, reflection generation, systematic absences, reciprocal
174
+ symmetry orbits, multiplicity, and Friedel relations;
175
+ 2. scattering contexts and structure-factor calculations;
176
+ 3. radiation-aware powder lines and physical corrections;
177
+ 4. calculated diffraction profiles on explicit grids;
178
+ 5. additional structural transforms, hierarchy and topology tools, and
179
+ refinement built over the same forward calculations.
180
+
181
+ The roadmap describes direction, not a compatibility or release-date promise.
182
+ CrIStMa will remain independent of any particular consuming application.
183
+
184
+ ## License and reference data
185
+
186
+ Original CrIStMa code is distributed under the permissive
187
+ [BSD-3-Clause license](https://github.com/ABKuznetsov/CrIStMa/blob/main/LICENSE).
188
+ It may be used in open-source, commercial, and closed-source software subject
189
+ to the license notice requirements.
190
+
191
+ Bundled reference resources retain their own attribution and provenance:
192
+
193
+ - space-group and Wyckoff data normalized from pinned spglib 2.7.0 resources
194
+ under BSD-3-Clause;
195
+ - Cordero covalent radii compiled from QCElemental resources under
196
+ BSD-3-Clause;
197
+ - Shannon radii compiled from a pinned pymatgen artifact under MIT;
198
+ - selected Crystallography Open Database fixtures under CC0/public-domain
199
+ terms;
200
+ - curated chemical-reference rules with their scientific literature recorded
201
+ in the versioned resources.
202
+
203
+ Versions, commits, hashes, known provenance limitations, and redistribution
204
+ requirements are listed in
205
+ [THIRD_PARTY_NOTICES.md](https://github.com/ABKuznetsov/CrIStMa/blob/main/THIRD_PARTY_NOTICES.md).
206
+
207
+ ## Author
208
+
209
+ Artem B. Kuznetsov<br>
210
+ [GitHub](https://github.com/ABKuznetsov)
@@ -0,0 +1,104 @@
1
+ # Third-party data and notices
2
+
3
+ CrIStMa is distributed under the BSD-3-Clause license in [`LICENSE`](LICENSE).
4
+ That license covers original CrIStMa code, documentation, and project-authored
5
+ test data. It does not replace the licenses or provenance of bundled
6
+ third-party resources.
7
+
8
+ CrIStMa has no runtime dependency on the projects named below. Selected source
9
+ data are compiled into versioned local resources so calculations remain
10
+ reproducible. Upstream versions, commits, file hashes, scientific references,
11
+ and license texts are retained with the package.
12
+
13
+ ## Crystallographic catalog
14
+
15
+ The packaged space-group and Wyckoff catalog is normalized from spglib 2.7.0:
16
+
17
+ - upstream: [spglib/spglib](https://github.com/spglib/spglib), tag `v2.7.0`;
18
+ - commit: `12355c77fb7c505a55f52cae36341d73b781a065`;
19
+ - source files: `database/spg.csv` and `database/Wyckoff.csv`;
20
+ - license: BSD-3-Clause;
21
+ - generated content: 530 Hall settings covering all 230 three-dimensional
22
+ space-group types and 3,467 Wyckoff records.
23
+
24
+ No International Tables pages or Bilbao Crystallographic Server records are
25
+ copied into CrIStMa. Exact hashes and rebuild instructions are recorded in
26
+ [`src/cristma/reference_data/resources/crystallography/SOURCE.md`](src/cristma/reference_data/resources/crystallography/SOURCE.md).
27
+ The upstream license is reproduced in
28
+ [`SPGLIB_LICENSE.txt`](src/cristma/reference_data/resources/crystallography/SPGLIB_LICENSE.txt).
29
+
30
+ ## Cordero covalent radii
31
+
32
+ `covalent_radii.json` is compiled from a pinned QCElemental artifact:
33
+
34
+ - upstream: [MolSSI/QCElemental](https://github.com/MolSSI/QCElemental);
35
+ - commit: `c4eb31cff9c7041f4767804a0076e35343df8177`;
36
+ - source path: `qcelemental/data/alvarez_2008_covalent_radii.py`;
37
+ - source license: BSD-3-Clause;
38
+ - source SHA-256:
39
+ `9ac22bedfc04ead3567ebf0484fe09583e959d679aec99b69a0aef13388cb63e`.
40
+
41
+ Scientific reference: B. Cordero et al., “Covalent radii revisited”,
42
+ *Dalton Transactions* (2008), 2832–2838,
43
+ [doi:10.1039/B801115J](https://doi.org/10.1039/B801115J).
44
+
45
+ The complete provenance and selection policy are documented in
46
+ [`COVALENT_RADII_SOURCE.md`](src/cristma/reference_data/resources/COVALENT_RADII_SOURCE.md).
47
+ The upstream license is reproduced in
48
+ [`QCELEMENTAL_LICENSE.txt`](src/cristma/reference_data/resources/QCELEMENTAL_LICENSE.txt).
49
+
50
+ ## Shannon ionic and crystal radii
51
+
52
+ `shannon_radii.json` is compiled from a pinned pymatgen artifact:
53
+
54
+ - upstream: [materialsproject/pymatgen](https://github.com/materialsproject/pymatgen);
55
+ - commit: `0428f232a569ffe6b16fa030d38ea35a56d70fd6`;
56
+ - source path: `dev_scripts/periodic_table_resources/Shannon_Radii.csv`;
57
+ - source license: MIT;
58
+ - source SHA-256:
59
+ `d71d42ef465b7ab48bc9fec7e60c7b2fe500b5787b107d1c813410eb3581b52e`.
60
+
61
+ Scientific reference: R. D. Shannon, “Revised effective ionic radii and
62
+ systematic studies of interatomic distances in halides and chalcogenides”,
63
+ *Acta Crystallographica A* **32** (1976), 751–767,
64
+ [doi:10.1107/S0567739476001551](https://doi.org/10.1107/S0567739476001551).
65
+
66
+ The pinned pymatgen generator states that the earlier provenance of its CSV is
67
+ unknown. CrIStMa therefore attributes the numerical artifact to the exact
68
+ pymatgen commit and cites the Shannon paper as its scientific reference; it
69
+ does not claim a stronger undocumented lineage. See
70
+ [`SHANNON_SOURCE.md`](src/cristma/reference_data/resources/SHANNON_SOURCE.md)
71
+ and the reproduced [`PYMATGEN_LICENSE.txt`](src/cristma/reference_data/resources/PYMATGEN_LICENSE.txt).
72
+
73
+ ## Curated chemical reference knowledge
74
+
75
+ `chemical_reference_v3.json` and `chemical_reference_v3_1.json` are original
76
+ CrIStMa compilations of machine-readable classification rules. Their embedded
77
+ `sources` sections cite 22 books, papers, reviews, and nomenclature references
78
+ that support the scientific concepts. CrIStMa does not reproduce the source
79
+ publications or copy their prose or tables. The JSON records the project's
80
+ curated interpretation and links each rule to its supporting bibliography.
81
+
82
+ ## Crystallographic Open Database fixtures
83
+
84
+ Selected CIF files used only as tests come from the Crystallography Open
85
+ Database, whose data are dedicated to the public domain under CC0. Each file
86
+ retains publication metadata, source identity, and a recorded SHA-256 digest.
87
+ The fixture inventory is in
88
+ [`tests/fixtures/crystal_chemistry/PROVENANCE.md`](tests/fixtures/crystal_chemistry/PROVENANCE.md).
89
+
90
+ ## Project-authored format fixtures
91
+
92
+ Small VASP, XYZ/extXYZ, PDB, and analytic crystallographic fixtures are
93
+ hand-authored or hand-reduced test inputs. They exercise public file-format
94
+ grammars and are not copied calculation outputs, pseudopotentials, or upstream
95
+ scientific datasets. Their provenance is documented beside the corresponding
96
+ fixtures where applicable.
97
+
98
+ ## Downstream redistribution
99
+
100
+ Commercial and closed-source software may use CrIStMa under BSD-3-Clause.
101
+ Distributors must retain the CrIStMa license and the applicable notices and
102
+ license texts for bundled third-party resources. Materials with incompatible,
103
+ copyleft, non-commercial, or unclear redistribution terms must not be added to
104
+ CrIStMa without a separate compatibility review.
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cristma"
7
+ version = "0.1.0b1"
8
+ description = "Physics-first crystallography, crystal chemistry, and periodic structure analysis"
9
+ readme = "README.md"
10
+ license = "BSD-3-Clause"
11
+ license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]
12
+ requires-python = ">=3.11"
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Science/Research",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Topic :: Scientific/Engineering :: Chemistry",
19
+ "Topic :: Scientific/Engineering :: Physics",
20
+ ]
21
+ dependencies = [
22
+ "numpy>=1.26",
23
+ ]
24
+
25
+ [project.urls]
26
+ Repository = "https://github.com/ABKuznetsov/CrIStMa"
27
+ Issues = "https://github.com/ABKuznetsov/CrIStMa/issues"
28
+
29
+ [project.optional-dependencies]
30
+ reference-build = [
31
+ "spglib==2.7.0",
32
+ ]
33
+
34
+ [tool.setuptools.packages.find]
35
+ where = ["src"]
36
+
37
+ [tool.setuptools.package-data]
38
+ cristma = [
39
+ "reference_data/resources/*.json",
40
+ "reference_data/resources/*.md",
41
+ "reference_data/resources/*.txt",
42
+ "reference_data/resources/crystallography/*.json",
43
+ "reference_data/resources/crystallography/*.md",
44
+ "reference_data/resources/crystallography/*.txt",
45
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+