diffpy.structure 3.3.1rc0__tar.gz → 3.4.0rc0__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 (95) hide show
  1. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/PKG-INFO +29 -12
  2. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/README.rst +23 -7
  3. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/pyproject.toml +7 -7
  4. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/requirements/conda.txt +1 -0
  5. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/requirements/docs.txt +1 -1
  6. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/requirements/pip.txt +1 -0
  7. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/__init__.py +1 -1
  8. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/__init__.py +26 -2
  9. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/_legacy_importer.py +5 -1
  10. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/apps/anyeye.py +7 -2
  11. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/apps/transtru.py +4 -1
  12. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/atom.py +25 -7
  13. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/lattice.py +96 -19
  14. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/mmlibspacegroups.py +20 -4
  15. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/p_auto.py +4 -1
  16. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/p_cif.py +9 -3
  17. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/p_discus.py +16 -3
  18. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/p_pdb.py +32 -3
  19. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/p_pdffit.py +14 -2
  20. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/p_xcfg.py +6 -1
  21. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/spacegroupmod.py +18 -3
  22. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/structure.py +31 -5
  23. diffpy_structure-3.4.0rc0/src/diffpy/structure/structure_app.py +33 -0
  24. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/symmetryutilities.py +31 -4
  25. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/version.py +7 -6
  26. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy.structure.egg-info/PKG-INFO +29 -12
  27. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy.structure.egg-info/SOURCES.txt +2 -1
  28. diffpy_structure-3.4.0rc0/src/diffpy.structure.egg-info/entry_points.txt +2 -0
  29. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy.structure.egg-info/requires.txt +1 -0
  30. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_lattice.py +16 -3
  31. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_p_pdffit.py +12 -2
  32. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_parsers.py +42 -7
  33. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_spacegroups.py +10 -5
  34. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_structure.py +16 -5
  35. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_symmetryutilities.py +120 -15
  36. diffpy_structure-3.3.1rc0/src/diffpy.structure.egg-info/entry_points.txt +0 -2
  37. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/AUTHORS.rst +0 -0
  38. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/LICENSE-DANSE.rst +0 -0
  39. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/LICENSE-pymmlib.rst +0 -0
  40. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/LICENSE.rst +0 -0
  41. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/MANIFEST.in +0 -0
  42. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/requirements/build.txt +0 -0
  43. /diffpy_structure-3.3.1rc0/requirements/test.txt → /diffpy_structure-3.4.0rc0/requirements/tests.txt +0 -0
  44. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/setup.cfg +0 -0
  45. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/apps/__init__.py +0 -0
  46. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/expansion/__init__.py +0 -0
  47. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/expansion/makeellipsoid.py +0 -0
  48. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/expansion/shapeutils.py +0 -0
  49. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/expansion/supercell_mod.py +0 -0
  50. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/__init__.py +0 -0
  51. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/p_rawxyz.py +0 -0
  52. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/p_xyz.py +0 -0
  53. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/parser_index_mod.py +0 -0
  54. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/parsers/structureparser.py +0 -0
  55. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/pdffitstructure.py +0 -0
  56. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/sgtbxspacegroups.py +0 -0
  57. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/spacegroups.py +0 -0
  58. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/structureerrors.py +0 -0
  59. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy/structure/utils.py +0 -0
  60. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy.structure.egg-info/dependency_links.txt +0 -0
  61. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/src/diffpy.structure.egg-info/top_level.txt +0 -0
  62. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/conftest.py +0 -0
  63. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_atom.py +0 -0
  64. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_loadstructure.py +0 -0
  65. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_p_cif.py +0 -0
  66. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_p_discus.py +0 -0
  67. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_supercell.py +0 -0
  68. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/test_version.py +0 -0
  69. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/BubbleRaftShort.xcfg +0 -0
  70. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/CdSe_bulk.stru +0 -0
  71. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/LiCl-bad.cif +0 -0
  72. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/Ni-bad.stru +0 -0
  73. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/Ni-discus.stru +0 -0
  74. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/Ni.stru +0 -0
  75. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/Ni_prim123.stru +0 -0
  76. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/Ni_ref.cif +0 -0
  77. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/PbTe.cif +0 -0
  78. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/TeI-unkocc.cif +0 -0
  79. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/TeI.cif +0 -0
  80. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/ZnSb_RT_Q28X_VM_20_fxiso.rstr +0 -0
  81. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/arginine.pdb +0 -0
  82. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/badspacegroup.cif +0 -0
  83. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/bucky-bad1.xyz +0 -0
  84. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/bucky-bad2.xyz +0 -0
  85. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/bucky-plain-bad.xyz +0 -0
  86. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/bucky-plain.xyz +0 -0
  87. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/bucky-raw.xyz +0 -0
  88. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/bucky.xyz +0 -0
  89. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/curlybrackets.cif +0 -0
  90. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/customsg.cif +0 -0
  91. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/graphite.cif +0 -0
  92. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/hexagon-raw-bad.xyz +0 -0
  93. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/hexagon-raw.xy +0 -0
  94. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/hexagon-raw.xyz +0 -0
  95. {diffpy_structure-3.3.1rc0 → diffpy_structure-3.4.0rc0}/tests/testdata/nosites.cif +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffpy.structure
3
- Version: 3.3.1rc0
3
+ Version: 3.4.0rc0
4
4
  Summary: Crystal structure container and parsers for structure formats.
5
- Author-email: Simon Billinge <sb2896@columbia.edu>
6
- Maintainer-email: Simon Billinge <sb2896@columbia.edu>
5
+ Author-email: Simon Billinge <sbillinge@ucsb.edu>
6
+ Maintainer-email: Simon Billinge <sbillinge@ucsb.edu>
7
7
  Project-URL: Homepage, https://github.com/diffpy/diffpy.structure/
8
8
  Project-URL: Issues, https://github.com/diffpy/diffpy.structure/issues/
9
9
  Keywords: diffpy,crystal structure data storage,CIF,PDB
@@ -16,12 +16,12 @@ Classifier: Operating System :: MacOS :: MacOS X
16
16
  Classifier: Operating System :: Microsoft :: Windows
17
17
  Classifier: Operating System :: POSIX
18
18
  Classifier: Operating System :: Unix
19
- Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
22
  Classifier: Topic :: Scientific/Engineering :: Physics
23
23
  Classifier: Topic :: Scientific/Engineering :: Chemistry
24
- Requires-Python: <3.14,>=3.11
24
+ Requires-Python: <3.15,>=3.12
25
25
  Description-Content-Type: text/x-rst
26
26
  License-File: LICENSE-DANSE.rst
27
27
  License-File: LICENSE-pymmlib.rst
@@ -29,6 +29,7 @@ License-File: LICENSE.rst
29
29
  License-File: AUTHORS.rst
30
30
  Requires-Dist: numpy
31
31
  Requires-Dist: pycifrw
32
+ Requires-Dist: diffpy.utils
32
33
  Dynamic: license-file
33
34
 
34
35
  |Icon| |title|_
@@ -58,6 +59,7 @@ Dynamic: license-file
58
59
  :target: https://anaconda.org/conda-forge/diffpy.structure
59
60
 
60
61
  .. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff
62
+ :target: https://github.com/diffpy/diffpy.structure/pulls
61
63
 
62
64
  .. |PyPI| image:: https://img.shields.io/pypi/v/diffpy.structure
63
65
  :target: https://pypi.org/project/diffpy.structure/
@@ -132,6 +134,19 @@ and run the following ::
132
134
 
133
135
  pip install .
134
136
 
137
+ This package also provides command-line utilities. To check the software has been installed correctly, type ::
138
+
139
+ diffpy.structure --version
140
+
141
+ You can also type the following command to verify the installation. ::
142
+
143
+ python -c "import diffpy.structure; print(diffpy.structure.__version__)"
144
+
145
+
146
+ To view the basic usage and available commands, type ::
147
+
148
+ diffpy.structure -h
149
+
135
150
  Getting Started
136
151
  ---------------
137
152
 
@@ -167,8 +182,15 @@ Improvements and fixes are always appreciated.
167
182
 
168
183
  Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.structure/blob/main/CODE-OF-CONDUCT.rst>`_.
169
184
 
170
- Acknowledgement
171
- ---------------
185
+ Contact
186
+ -------
187
+
188
+ For more information on diffpy.structure please visit the project `web-page <https://diffpy.github.io/>`_ or email the maintainer``Simon Billinge(sbillinge@ucsb.edu)``.
189
+
190
+ Acknowledgements
191
+ ----------------
192
+
193
+ ``diffpy.structure`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
172
194
 
173
195
  Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py*
174
196
  originate from the `pymmlib project <http://pymmlib.sourceforge.net>`_.
@@ -177,8 +199,3 @@ Less common settings of space groups were generating using the
177
199
  `Computational Crystallography Toolbox <http://cctbx.sourceforge.net>`_.
178
200
 
179
201
  ``diffpy.structure`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
180
-
181
- Contact
182
- -------
183
-
184
- For more information on diffpy.structure please visit the project `web-page <https://diffpy.github.io/>`_ or email Prof. Simon Billinge at sb2896@columbia.edu.
@@ -25,6 +25,7 @@
25
25
  :target: https://anaconda.org/conda-forge/diffpy.structure
26
26
 
27
27
  .. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff
28
+ :target: https://github.com/diffpy/diffpy.structure/pulls
28
29
 
29
30
  .. |PyPI| image:: https://img.shields.io/pypi/v/diffpy.structure
30
31
  :target: https://pypi.org/project/diffpy.structure/
@@ -99,6 +100,19 @@ and run the following ::
99
100
 
100
101
  pip install .
101
102
 
103
+ This package also provides command-line utilities. To check the software has been installed correctly, type ::
104
+
105
+ diffpy.structure --version
106
+
107
+ You can also type the following command to verify the installation. ::
108
+
109
+ python -c "import diffpy.structure; print(diffpy.structure.__version__)"
110
+
111
+
112
+ To view the basic usage and available commands, type ::
113
+
114
+ diffpy.structure -h
115
+
102
116
  Getting Started
103
117
  ---------------
104
118
 
@@ -134,8 +148,15 @@ Improvements and fixes are always appreciated.
134
148
 
135
149
  Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.structure/blob/main/CODE-OF-CONDUCT.rst>`_.
136
150
 
137
- Acknowledgement
138
- ---------------
151
+ Contact
152
+ -------
153
+
154
+ For more information on diffpy.structure please visit the project `web-page <https://diffpy.github.io/>`_ or email the maintainer``Simon Billinge(sbillinge@ucsb.edu)``.
155
+
156
+ Acknowledgements
157
+ ----------------
158
+
159
+ ``diffpy.structure`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
139
160
 
140
161
  Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py*
141
162
  originate from the `pymmlib project <http://pymmlib.sourceforge.net>`_.
@@ -144,8 +165,3 @@ Less common settings of space groups were generating using the
144
165
  `Computational Crystallography Toolbox <http://cctbx.sourceforge.net>`_.
145
166
 
146
167
  ``diffpy.structure`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
147
-
148
- Contact
149
- -------
150
-
151
- For more information on diffpy.structure please visit the project `web-page <https://diffpy.github.io/>`_ or email Prof. Simon Billinge at sb2896@columbia.edu.
@@ -6,15 +6,15 @@ build-backend = "setuptools.build_meta"
6
6
  name = "diffpy.structure"
7
7
  dynamic=['version', 'dependencies']
8
8
  authors = [
9
- { name="Simon Billinge", email="sb2896@columbia.edu" },
9
+ {name='Simon Billinge', email='sbillinge@ucsb.edu'},
10
10
  ]
11
11
  maintainers = [
12
- { name="Simon Billinge", email="sb2896@columbia.edu" },
12
+ {name='Simon Billinge', email='sbillinge@ucsb.edu'},
13
13
  ]
14
14
  description = "Crystal structure container and parsers for structure formats."
15
15
  keywords = ['diffpy', 'crystal structure data storage', 'CIF', 'PDB']
16
16
  readme = "README.rst"
17
- requires-python = ">=3.11, <3.14"
17
+ requires-python = ">=3.12, <3.15"
18
18
  classifiers = [
19
19
  'Development Status :: 5 - Production/Stable',
20
20
  'Environment :: Console',
@@ -25,16 +25,13 @@ classifiers = [
25
25
  'Operating System :: Microsoft :: Windows',
26
26
  'Operating System :: POSIX',
27
27
  'Operating System :: Unix',
28
- 'Programming Language :: Python :: 3.11',
29
28
  'Programming Language :: Python :: 3.12',
30
29
  'Programming Language :: Python :: 3.13',
30
+ 'Programming Language :: Python :: 3.14',
31
31
  'Topic :: Scientific/Engineering :: Physics',
32
32
  'Topic :: Scientific/Engineering :: Chemistry',
33
33
  ]
34
34
 
35
- [project.scripts]
36
- transtru = "diffpy.structure.apps.transtru:main"
37
-
38
35
  [project.urls]
39
36
  Homepage = "https://github.com/diffpy/diffpy.structure/"
40
37
  Issues = "https://github.com/diffpy/diffpy.structure/issues/"
@@ -51,6 +48,9 @@ include = ["*"] # package names should match these glob patterns (["*"] by defa
51
48
  exclude = [] # exclude packages matching these glob patterns (empty by default)
52
49
  namespaces = false # to disable scanning PEP 420 namespaces (true by default)
53
50
 
51
+ [project.scripts]
52
+ diffpy-structure = "diffpy.structure.app:main"
53
+
54
54
  [tool.setuptools.dynamic]
55
55
  dependencies = {file = ["requirements/pip.txt"]}
56
56
 
@@ -1,2 +1,3 @@
1
1
  numpy
2
2
  pycifrw
3
+ diffpy.utils
@@ -2,4 +2,4 @@ sphinx
2
2
  sphinx_rtd_theme
3
3
  sphinx-copybutton
4
4
  doctr
5
- m2r
5
+ m2r2
@@ -1,2 +1,3 @@
1
1
  numpy
2
2
  pycifrw
3
+ diffpy.utils
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  ##############################################################################
3
3
  #
4
- # (c) 2024-2025 The Trustees of Columbia University in the City of New York.
4
+ # (c) 2024-2026 The Trustees of Columbia University in the City of New York.
5
5
  # All rights reserved.
6
6
  #
7
7
  # File coded by: Billinge Group members and community contributors.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  ##############################################################################
3
3
  #
4
- # (c) 2024-2025 The Trustees of Columbia University in the City of New York.
4
+ # (c) 2024-2026 The Trustees of Columbia University in the City of New York.
5
5
  # All rights reserved.
6
6
  #
7
7
  # File coded by: Chris Farrow, Pavol Juhas, Simon Billinge, Billinge Group members.
@@ -33,8 +33,10 @@ Exceptions:
33
33
  * SymmetryError
34
34
  """
35
35
 
36
- # Interface definitions ------------------------------------------------------
37
36
 
37
+ import sys
38
+
39
+ import diffpy.structure as _structure
38
40
  from diffpy.structure.atom import Atom
39
41
  from diffpy.structure.lattice import Lattice
40
42
  from diffpy.structure.parsers import getParser
@@ -45,6 +47,28 @@ from diffpy.structure.structureerrors import LatticeError, StructureFormatError,
45
47
  # package version
46
48
  from diffpy.structure.version import __version__
47
49
 
50
+ # Deprecations -------------------------------------------------------
51
+
52
+
53
+ # @deprecated
54
+ # custom deprecator for diffpy.Structure module
55
+ class DeprecatedStructureModule:
56
+ """Proxy for backward compatibility of diffpy.Structure."""
57
+
58
+ def __getattr__(self, name):
59
+ import warnings
60
+
61
+ warnings.warn(
62
+ "Module 'diffpy.Structure' is deprecated and will be removed in version 4.0. "
63
+ "Use 'diffpy.structure' instead.",
64
+ DeprecationWarning,
65
+ stacklevel=2,
66
+ )
67
+ return getattr(_structure, name)
68
+
69
+
70
+ sys.modules["diffpy.Structure"] = DeprecatedStructureModule()
71
+
48
72
  # top level routines
49
73
 
50
74
 
@@ -80,7 +80,11 @@ class MapRenamedStructureModule(importlib.abc.Loader):
80
80
  # ----------------------------------------------------------------------------
81
81
 
82
82
  # show deprecation warning for diffpy.Structure
83
- warn(WMSG.format("diffpy.Structure", "diffpy.structure"), DeprecationWarning, stacklevel=2)
83
+ warn(
84
+ WMSG.format("diffpy.Structure", "diffpy.structure"),
85
+ DeprecationWarning,
86
+ stacklevel=2,
87
+ )
84
88
 
85
89
  # install meta path finder for diffpy.Structure submodules
86
90
  sys.meta_path.append(FindRenamedStructureModule())
@@ -138,7 +138,10 @@ def convertStructureFile(pd):
138
138
  if pd["formula"]:
139
139
  formula = pd["formula"]
140
140
  if len(formula) != len(stru):
141
- emsg = "Formula has %i atoms while structure %i" % (len(formula), len(stru))
141
+ emsg = "Formula has %i atoms while structure %i" % (
142
+ len(formula),
143
+ len(stru),
144
+ )
142
145
  raise RuntimeError(emsg)
143
146
  for a, el in zip(stru, formula):
144
147
  a.element = el
@@ -217,7 +220,9 @@ def main():
217
220
  pd["watch"] = False
218
221
  try:
219
222
  opts, args = getopt.getopt(
220
- sys.argv[1:], "f:whV", ["formula=", "watch", "viewer=", "formats=", "help", "version"]
223
+ sys.argv[1:],
224
+ "f:whV",
225
+ ["formula=", "watch", "viewer=", "formats=", "help", "version"],
221
226
  )
222
227
  except getopt.GetoptError as errmsg:
223
228
  print(errmsg, file=sys.stderr)
@@ -99,7 +99,10 @@ def main():
99
99
  print("'%s' is not valid output format" % outfmt, file=sys.stderr)
100
100
  sys.exit(2)
101
101
  except ValueError:
102
- print("invalid format specification '%s' does not contain .." % args[0], file=sys.stderr)
102
+ print(
103
+ "invalid format specification '%s' does not contain .." % args[0],
104
+ file=sys.stderr,
105
+ )
103
106
  sys.exit(2)
104
107
  # ready to do some real work
105
108
  try:
@@ -201,7 +201,13 @@ class Atom(object):
201
201
  def __repr__(self):
202
202
  """String representation of this Atom."""
203
203
  xyz = self.xyz
204
- s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (self.element, xyz[0], xyz[1], xyz[2], self.occupancy)
204
+ s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (
205
+ self.element,
206
+ xyz[0],
207
+ xyz[1],
208
+ xyz[2],
209
+ self.occupancy,
210
+ )
205
211
  return s
206
212
 
207
213
  def __copy__(self, target=None):
@@ -355,13 +361,19 @@ class Atom(object):
355
361
  """
356
362
 
357
363
  U11 = property(
358
- lambda self: self._get_Uij(0, 0), lambda self, value: self._set_Uij(0, 0, value), doc=_doc_uii.format(0)
364
+ lambda self: self._get_Uij(0, 0),
365
+ lambda self, value: self._set_Uij(0, 0, value),
366
+ doc=_doc_uii.format(0),
359
367
  )
360
368
  U22 = property(
361
- lambda self: self._get_Uij(1, 1), lambda self, value: self._set_Uij(1, 1, value), doc=_doc_uii.format(1)
369
+ lambda self: self._get_Uij(1, 1),
370
+ lambda self, value: self._set_Uij(1, 1, value),
371
+ doc=_doc_uii.format(1),
362
372
  )
363
373
  U33 = property(
364
- lambda self: self._get_Uij(2, 2), lambda self, value: self._set_Uij(2, 2, value), doc=_doc_uii.format(2)
374
+ lambda self: self._get_Uij(2, 2),
375
+ lambda self, value: self._set_Uij(2, 2, value),
376
+ doc=_doc_uii.format(2),
365
377
  )
366
378
 
367
379
  _doc_uij = """
@@ -372,13 +384,19 @@ class Atom(object):
372
384
  """
373
385
 
374
386
  U12 = property(
375
- lambda self: self._get_Uij(0, 1), lambda self, value: self._set_Uij(0, 1, value), doc=_doc_uij.format(0, 1)
387
+ lambda self: self._get_Uij(0, 1),
388
+ lambda self, value: self._set_Uij(0, 1, value),
389
+ doc=_doc_uij.format(0, 1),
376
390
  )
377
391
  U13 = property(
378
- lambda self: self._get_Uij(0, 2), lambda self, value: self._set_Uij(0, 2, value), doc=_doc_uij.format(0, 2)
392
+ lambda self: self._get_Uij(0, 2),
393
+ lambda self, value: self._set_Uij(0, 2, value),
394
+ doc=_doc_uij.format(0, 2),
379
395
  )
380
396
  U23 = property(
381
- lambda self: self._get_Uij(1, 2), lambda self, value: self._set_Uij(1, 2, value), doc=_doc_uij.format(1, 2)
397
+ lambda self: self._get_Uij(1, 2),
398
+ lambda self, value: self._set_Uij(1, 2, value),
399
+ doc=_doc_uij.format(1, 2),
382
400
  )
383
401
 
384
402
  # clean local variables
@@ -31,7 +31,16 @@ from diffpy.structure.structureerrors import LatticeError
31
31
  # Helper Functions -----------------------------------------------------------
32
32
 
33
33
  # exact values of cosd
34
- _EXACT_COSD = {0.0: +1.0, 60.0: +0.5, 90.0: 0.0, 120.0: -0.5, 180.0: -1.0, 240.0: -0.5, 270.0: 0.0, 300.0: +0.5}
34
+ _EXACT_COSD = {
35
+ 0.0: +1.0,
36
+ 60.0: +0.5,
37
+ 90.0: 0.0,
38
+ 120.0: -0.5,
39
+ 180.0: -1.0,
40
+ 240.0: -0.5,
41
+ 270.0: 0.0,
42
+ 300.0: +0.5,
43
+ }
35
44
 
36
45
 
37
46
  def cosd(x):
@@ -158,15 +167,21 @@ class Lattice(object):
158
167
  # properties -------------------------------------------------------------
159
168
 
160
169
  a = property(
161
- lambda self: self._a, lambda self, value: self.setLatPar(a=value), doc="The unit cell length *a*."
170
+ lambda self: self._a,
171
+ lambda self, value: self.setLatPar(a=value),
172
+ doc="The unit cell length *a*.",
162
173
  )
163
174
 
164
175
  b = property(
165
- lambda self: self._b, lambda self, value: self.setLatPar(b=value), doc="The unit cell length *b*."
176
+ lambda self: self._b,
177
+ lambda self, value: self.setLatPar(b=value),
178
+ doc="The unit cell length *b*.",
166
179
  )
167
180
 
168
181
  c = property(
169
- lambda self: self._c, lambda self, value: self.setLatPar(c=value), doc="The unit cell length *c*."
182
+ lambda self: self._c,
183
+ lambda self, value: self.setLatPar(c=value),
184
+ doc="The unit cell length *c*.",
170
185
  )
171
186
 
172
187
  alpha = property(
@@ -200,19 +215,40 @@ class Lattice(object):
200
215
  rv = math.sqrt(1.0 + 2.0 * ca * cb * cg - ca * ca - cb * cb - cg * cg)
201
216
  return rv
202
217
 
203
- volume = property(lambda self: self.a * self.b * self.c * self.unitvolume, doc="The unit cell volume.")
218
+ volume = property(
219
+ lambda self: self.a * self.b * self.c * self.unitvolume,
220
+ doc="The unit cell volume.",
221
+ )
204
222
 
205
- ar = property(lambda self: self._ar, doc="The cell length *a* of the reciprocal lattice.")
223
+ ar = property(
224
+ lambda self: self._ar,
225
+ doc="The cell length *a* of the reciprocal lattice.",
226
+ )
206
227
 
207
- br = property(lambda self: self._br, doc="The cell length *b* of the reciprocal lattice.")
228
+ br = property(
229
+ lambda self: self._br,
230
+ doc="The cell length *b* of the reciprocal lattice.",
231
+ )
208
232
 
209
- cr = property(lambda self: self._cr, doc="The cell length *c* of the reciprocal lattice.")
233
+ cr = property(
234
+ lambda self: self._cr,
235
+ doc="The cell length *c* of the reciprocal lattice.",
236
+ )
210
237
 
211
- alphar = property(lambda self: self._alphar, doc="The reciprocal cell angle *alpha* in degrees.")
238
+ alphar = property(
239
+ lambda self: self._alphar,
240
+ doc="The reciprocal cell angle *alpha* in degrees.",
241
+ )
212
242
 
213
- betar = property(lambda self: self._betar, doc="The reciprocal cell angle *beta* in degrees")
243
+ betar = property(
244
+ lambda self: self._betar,
245
+ doc="The reciprocal cell angle *beta* in degrees",
246
+ )
214
247
 
215
- gammar = property(lambda self: self._gammar, doc="The reciprocal cell angle *gamma* in degrees")
248
+ gammar = property(
249
+ lambda self: self._gammar,
250
+ doc="The reciprocal cell angle *gamma* in degrees",
251
+ )
216
252
 
217
253
  ca = property(lambda self: self._ca, doc="The cosine of the cell angle *alpha*.")
218
254
 
@@ -226,11 +262,20 @@ class Lattice(object):
226
262
 
227
263
  sg = property(lambda self: self._sg, doc="The sine of the cell angle *gamma*.")
228
264
 
229
- car = property(lambda self: self._car, doc="The cosine of the reciprocal angle *alpha*.")
265
+ car = property(
266
+ lambda self: self._car,
267
+ doc="The cosine of the reciprocal angle *alpha*.",
268
+ )
230
269
 
231
- cbr = property(lambda self: self._cbr, doc="The cosine of the reciprocal angle *beta*.")
270
+ cbr = property(
271
+ lambda self: self._cbr,
272
+ doc="The cosine of the reciprocal angle *beta*.",
273
+ )
232
274
 
233
- cgr = property(lambda self: self._cgr, doc="The cosine of the reciprocal angle *gamma*.")
275
+ cgr = property(
276
+ lambda self: self._cgr,
277
+ doc="The cosine of the reciprocal angle *gamma*.",
278
+ )
234
279
 
235
280
  sar = property(lambda self: self._sar, doc="The sine of the reciprocal angle *alpha*.")
236
281
 
@@ -240,7 +285,17 @@ class Lattice(object):
240
285
 
241
286
  # done with properties ---------------------------------------------------
242
287
 
243
- def __init__(self, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, baserot=None, base=None):
288
+ def __init__(
289
+ self,
290
+ a=None,
291
+ b=None,
292
+ c=None,
293
+ alpha=None,
294
+ beta=None,
295
+ gamma=None,
296
+ baserot=None,
297
+ base=None,
298
+ ):
244
299
  # build a set of provided argument names for later use.
245
300
  apairs = (
246
301
  ("a", a),
@@ -287,7 +342,16 @@ class Lattice(object):
287
342
  self.setLatPar(a, b, c, alpha, beta, gamma, baserot=baserot)
288
343
  return
289
344
 
290
- def setLatPar(self, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, baserot=None):
345
+ def setLatPar(
346
+ self,
347
+ a=None,
348
+ b=None,
349
+ c=None,
350
+ alpha=None,
351
+ beta=None,
352
+ gamma=None,
353
+ baserot=None,
354
+ ):
291
355
  """Set one or more lattice parameters.
292
356
 
293
357
  This updates all attributes that depend on the lattice parameters.
@@ -361,7 +425,11 @@ class Lattice(object):
361
425
  )
362
426
  # standard Cartesian coordinates of lattice vectors
363
427
  self.stdbase = numpy.array(
364
- [[1.0 / ar, -cgr / sgr / ar, cb * self.a], [0.0, self.b * sa, self.b * ca], [0.0, 0.0, self.c]],
428
+ [
429
+ [1.0 / ar, -cgr / sgr / ar, cb * self.a],
430
+ [0.0, self.b * sa, self.b * ca],
431
+ [0.0, 0.0, self.c],
432
+ ],
365
433
  dtype=float,
366
434
  )
367
435
  # Cartesian coordinates of lattice vectors
@@ -423,7 +491,12 @@ class Lattice(object):
423
491
  self._gammar = math.degrees(math.acos(cgr))
424
492
  # standard orientation of lattice vectors
425
493
  self.stdbase = numpy.array(
426
- [[1.0 / ar, -cgr / sgr / ar, cb * a], [0.0, b * sa, b * ca], [0.0, 0.0, c]], dtype=float
494
+ [
495
+ [1.0 / ar, -cgr / sgr / ar, cb * a],
496
+ [0.0, b * sa, b * ca],
497
+ [0.0, 0.0, c],
498
+ ],
499
+ dtype=float,
427
500
  )
428
501
  # calculate unit cell rotation matrix, base = stdbase @ baserot
429
502
  self.baserot = numpy.dot(numalg.inv(self.stdbase), self.base)
@@ -434,7 +507,11 @@ class Lattice(object):
434
507
  self.isotropicunit = _isotropicunit(self.recnormbase)
435
508
  # update metrics tensor
436
509
  self.metrics = numpy.array(
437
- [[a * a, a * b * cg, a * c * cb], [b * a * cg, b * b, b * c * ca], [c * a * cb, c * b * ca, c * c]],
510
+ [
511
+ [a * a, a * b * cg, a * c * cb],
512
+ [b * a * cg, b * b, b * c * ca],
513
+ [c * a * cb, c * b * ca, c * c],
514
+ ],
438
515
  dtype=float,
439
516
  )
440
517
  return
@@ -3269,7 +3269,11 @@ sg143 = SpaceGroup(
3269
3269
  point_group_name="PG3",
3270
3270
  crystal_system="TRIGONAL",
3271
3271
  pdb_name="P 3",
3272
- symop_list=[SymOp(Rot_X_Y_Z, Tr_0_0_0), SymOp(Rot_mY_XmY_Z, Tr_0_0_0), SymOp(Rot_mXY_mX_Z, Tr_0_0_0)],
3272
+ symop_list=[
3273
+ SymOp(Rot_X_Y_Z, Tr_0_0_0),
3274
+ SymOp(Rot_mY_XmY_Z, Tr_0_0_0),
3275
+ SymOp(Rot_mXY_mX_Z, Tr_0_0_0),
3276
+ ],
3273
3277
  )
3274
3278
 
3275
3279
  sg144 = SpaceGroup(
@@ -3280,7 +3284,11 @@ sg144 = SpaceGroup(
3280
3284
  point_group_name="PG3",
3281
3285
  crystal_system="TRIGONAL",
3282
3286
  pdb_name="P 31",
3283
- symop_list=[SymOp(Rot_X_Y_Z, Tr_0_0_0), SymOp(Rot_mY_XmY_Z, Tr_0_0_13), SymOp(Rot_mXY_mX_Z, Tr_0_0_23)],
3287
+ symop_list=[
3288
+ SymOp(Rot_X_Y_Z, Tr_0_0_0),
3289
+ SymOp(Rot_mY_XmY_Z, Tr_0_0_13),
3290
+ SymOp(Rot_mXY_mX_Z, Tr_0_0_23),
3291
+ ],
3284
3292
  )
3285
3293
 
3286
3294
  sg145 = SpaceGroup(
@@ -3291,7 +3299,11 @@ sg145 = SpaceGroup(
3291
3299
  point_group_name="PG3",
3292
3300
  crystal_system="TRIGONAL",
3293
3301
  pdb_name="P 32",
3294
- symop_list=[SymOp(Rot_X_Y_Z, Tr_0_0_0), SymOp(Rot_mY_XmY_Z, Tr_0_0_23), SymOp(Rot_mXY_mX_Z, Tr_0_0_13)],
3302
+ symop_list=[
3303
+ SymOp(Rot_X_Y_Z, Tr_0_0_0),
3304
+ SymOp(Rot_mY_XmY_Z, Tr_0_0_23),
3305
+ SymOp(Rot_mXY_mX_Z, Tr_0_0_13),
3306
+ ],
3295
3307
  )
3296
3308
 
3297
3309
  sg146 = SpaceGroup(
@@ -3323,7 +3335,11 @@ sg1146 = SpaceGroup(
3323
3335
  point_group_name="PG3",
3324
3336
  crystal_system="TRIGONAL",
3325
3337
  pdb_name="R 3",
3326
- symop_list=[SymOp(Rot_X_Y_Z, Tr_0_0_0), SymOp(Rot_Z_X_Y, Tr_0_0_0), SymOp(Rot_Y_Z_X, Tr_0_0_0)],
3338
+ symop_list=[
3339
+ SymOp(Rot_X_Y_Z, Tr_0_0_0),
3340
+ SymOp(Rot_Z_X_Y, Tr_0_0_0),
3341
+ SymOp(Rot_Y_Z_X, Tr_0_0_0),
3342
+ ],
3327
3343
  )
3328
3344
 
3329
3345
  sg147 = SpaceGroup(
@@ -190,7 +190,10 @@ class P_auto(StructureParser):
190
190
  pass
191
191
  if stru is None:
192
192
  emsg = "\n".join(
193
- ["Unknown or invalid structure format.", "Errors per each tested structure format:"]
193
+ [
194
+ "Unknown or invalid structure format.",
195
+ "Errors per each tested structure format:",
196
+ ]
194
197
  + parsers_emsgs
195
198
  )
196
199
  raise StructureFormatError(emsg)
@@ -32,6 +32,7 @@ import sys
32
32
  from contextlib import contextmanager
33
33
 
34
34
  import numpy
35
+ from CifFile.yapps3_compiled_rt import YappsSyntaxError
35
36
 
36
37
  from diffpy.structure import Atom, Lattice, Structure
37
38
  from diffpy.structure.parsers import StructureParser
@@ -408,7 +409,7 @@ class P_cif(StructureParser):
408
409
  # stop after reading the first structure
409
410
  if self.stru is not None:
410
411
  break
411
- except (StarError, ValueError, IndexError) as err:
412
+ except (YappsSyntaxError, StarError, ValueError, IndexError) as err:
412
413
  exc_type, exc_value, exc_traceback = sys.exc_info()
413
414
  emsg = str(err).strip()
414
415
  e = StructureFormatError(emsg)
@@ -553,7 +554,10 @@ class P_cif(StructureParser):
553
554
  from diffpy.structure.spacegroups import FindSpaceGroup, GetSpaceGroup, IsSpaceGroupIdentifier, SpaceGroup
554
555
 
555
556
  self.asymmetric_unit = list(self.stru)
556
- sym_synonyms = ("_space_group_symop_operation_xyz", "_symmetry_equiv_pos_as_xyz")
557
+ sym_synonyms = (
558
+ "_space_group_symop_operation_xyz",
559
+ "_symmetry_equiv_pos_as_xyz",
560
+ )
557
561
  sym_loop_name = [n for n in sym_synonyms if n in block]
558
562
  # recover explicit list of symmetry operations
559
563
  symop_list = []
@@ -591,7 +595,9 @@ class P_cif(StructureParser):
591
595
  block.get("_space_group_crystal_system") or block.get("_symmetry_cell_setting") or "TRICLINIC"
592
596
  ).upper()
593
597
  self.spacegroup = SpaceGroup(
594
- short_name=new_short_name, crystal_system=new_crystal_system, symop_list=symop_list
598
+ short_name=new_short_name,
599
+ crystal_system=new_crystal_system,
600
+ symop_list=symop_list,
595
601
  )
596
602
  if self.spacegroup is None:
597
603
  emsg = "CIF file has unknown space group identifier {!r}."