diffpy.structure 3.4.0rc1__tar.gz → 3.5.0__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.
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/PKG-INFO +3 -3
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/README.rst +2 -2
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/__init__.py +2 -3
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/_legacy_importer.py +0 -1
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/apps/anyeye.py +1 -1
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/apps/vesta_viewer.py +6 -5
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/atom.py +35 -35
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/expansion/shapeutils.py +2 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/lattice.py +5 -5
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/__init__.py +4 -4
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_auto.py +3 -3
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_cif.py +13 -14
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_discus.py +12 -11
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_pdb.py +7 -5
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_pdffit.py +3 -3
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_rawxyz.py +1 -1
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_vesta.py +5 -8
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_xcfg.py +5 -5
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_xyz.py +1 -1
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/parser_index_mod.py +3 -3
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/structureparser.py +3 -3
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/pdffitstructure.py +4 -5
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/sgtbxspacegroups.py +1 -2
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/spacegroupmod.py +0 -1
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/spacegroups.py +3 -4
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/structure.py +288 -63
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/structureerrors.py +2 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/symmetryutilities.py +48 -47
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/utils.py +1 -2
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy.structure.egg-info/PKG-INFO +3 -3
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_atom.py +0 -1
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_expansion.py +1 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_spacegroups.py +0 -1
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_structure.py +304 -69
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_utils.py +1 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/AUTHORS.rst +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/LICENSE-DANSE.rst +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/LICENSE-pymmlib.rst +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/LICENSE.rst +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/MANIFEST.in +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/pyproject.toml +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/requirements/build.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/requirements/conda.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/requirements/docs.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/requirements/pip.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/requirements/tests.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/setup.cfg +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/__init__.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/apps/__init__.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/apps/transtru.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/expansion/__init__.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/expansion/makeellipsoid.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/expansion/supercell_mod.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/mmlibspacegroups.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/structure_app.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/version.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy.structure.egg-info/SOURCES.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy.structure.egg-info/dependency_links.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy.structure.egg-info/entry_points.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy.structure.egg-info/requires.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy.structure.egg-info/top_level.txt +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/conftest.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_lattice.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_loadstructure.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_p_cif.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_p_discus.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_p_pdffit.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_parsers.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_supercell.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_symmetryutilities.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/test_version.py +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/BubbleRaftShort.xcfg +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/CdSe_bulk.stru +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/LiCl-bad.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/Ni-bad.stru +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/Ni-discus.stru +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/Ni.stru +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/Ni_prim123.stru +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/Ni_ref.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/PbTe.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/TeI-unkocc.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/TeI.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/ZnSb_RT_Q28X_VM_20_fxiso.rstr +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/arginine.pdb +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/badspacegroup.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/bucky-bad1.xyz +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/bucky-bad2.xyz +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/bucky-plain-bad.xyz +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/bucky-plain.xyz +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/bucky-raw.xyz +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/bucky.xyz +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/curlybrackets.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/customsg.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/graphite.cif +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/hexagon-raw-bad.xyz +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/hexagon-raw.xy +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/hexagon-raw.xyz +0 -0
- {diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/tests/testdata/nosites.cif +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diffpy.structure
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5.0
|
|
4
4
|
Summary: Crystal structure container and parsers for structure formats.
|
|
5
5
|
Author-email: Simon Billinge <sbillinge@ucsb.edu>
|
|
6
6
|
Maintainer-email: Simon Billinge <sbillinge@ucsb.edu>
|
|
@@ -49,8 +49,8 @@ Dynamic: license-file
|
|
|
49
49
|
.. |Black| image:: https://img.shields.io/badge/code_style-black-black
|
|
50
50
|
:target: https://github.com/psf/black
|
|
51
51
|
|
|
52
|
-
.. |CI| image:: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov
|
|
53
|
-
:target: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov
|
|
52
|
+
.. |CI| image:: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov.yml/badge.svg
|
|
53
|
+
:target: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov.yml
|
|
54
54
|
|
|
55
55
|
.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.structure/branch/main/graph/badge.svg
|
|
56
56
|
:target: https://codecov.io/gh/diffpy/diffpy.structure
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
.. |Black| image:: https://img.shields.io/badge/code_style-black-black
|
|
16
16
|
:target: https://github.com/psf/black
|
|
17
17
|
|
|
18
|
-
.. |CI| image:: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov
|
|
19
|
-
:target: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov
|
|
18
|
+
.. |CI| image:: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov.yml/badge.svg
|
|
19
|
+
:target: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov.yml
|
|
20
20
|
|
|
21
21
|
.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.structure/branch/main/graph/badge.svg
|
|
22
22
|
:target: https://codecov.io/gh/diffpy/diffpy.structure
|
|
@@ -33,7 +33,6 @@ Exceptions:
|
|
|
33
33
|
* SymmetryError
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
|
-
|
|
37
36
|
import os
|
|
38
37
|
import sys
|
|
39
38
|
|
|
@@ -102,10 +101,10 @@ def load_structure(filename, fmt="auto", **kw):
|
|
|
102
101
|
Path to the file to be loaded.
|
|
103
102
|
fmt : str, Optional
|
|
104
103
|
Format of the structure file such as 'cif' or 'xyz'. Must be
|
|
105
|
-
one of the formats listed by the `parsers.
|
|
104
|
+
one of the formats listed by the `parsers.input_formats` function.
|
|
106
105
|
When 'auto', all supported formats are tried in a sequence.
|
|
107
106
|
kw : Optional
|
|
108
|
-
Extra keyword arguments that are passed to `parsers.
|
|
107
|
+
Extra keyword arguments that are passed to `parsers.get_parser`
|
|
109
108
|
function. These configure the dedicated Parser object that
|
|
110
109
|
is used to read content in filename.
|
|
111
110
|
|
|
@@ -187,7 +187,7 @@ def convert_structure_file(pd):
|
|
|
187
187
|
fmt = pd.get("format", "auto")
|
|
188
188
|
stru = None
|
|
189
189
|
if fmt == "auto":
|
|
190
|
-
stru, fmt =
|
|
190
|
+
stru, fmt = load_structure_file(strufile)
|
|
191
191
|
pd["fmt"] = fmt
|
|
192
192
|
# if fmt is recognized by the viewer, use as is
|
|
193
193
|
if fmt in pd["formats"] and pd["formula"] is None:
|
{diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/apps/vesta_viewer.py
RENAMED
|
@@ -72,12 +72,13 @@ pd = {
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
def usage(style=None):
|
|
75
|
-
"""Show usage info.
|
|
75
|
+
"""Show usage info.
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
for ``style=="brief"`` show only first 2 lines.
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
style : str, optional
|
|
81
|
+
The usage display style.
|
|
81
82
|
"""
|
|
82
83
|
myname = Path(sys.argv[0]).name
|
|
83
84
|
msg = __doc__.replace("vestaview", myname)
|
|
@@ -42,7 +42,7 @@ msdCart_deprecation_msg = build_deprecation_message(
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
class Atom(object):
|
|
45
|
-
"""
|
|
45
|
+
"""The storage of structure information relevant for a single atom.
|
|
46
46
|
|
|
47
47
|
This class manages atom information such as element symbol, position
|
|
48
48
|
in fractional and Cartesian coordinates, atomic displacement parameters
|
|
@@ -55,10 +55,10 @@ class Atom(object):
|
|
|
55
55
|
By default an empty string. When of the `Atom` type, create
|
|
56
56
|
a copy of `atype` and adjust it per other arguments.
|
|
57
57
|
xyz : numpy.ndarray, Optional
|
|
58
|
-
|
|
58
|
+
The fractional coordinates within the associated `lattice`.
|
|
59
59
|
By default ``[0, 0, 0]``.
|
|
60
60
|
label : str, Optional
|
|
61
|
-
|
|
61
|
+
The unique string `label` for referring to this `Atom`.
|
|
62
62
|
By default an empty string.
|
|
63
63
|
occupancy : float, Optional
|
|
64
64
|
The initial `occupancy` of this atom, by default ``1``.
|
|
@@ -76,25 +76,25 @@ class Atom(object):
|
|
|
76
76
|
*Uisoequiv* arguments may be provided at the same time. Assume
|
|
77
77
|
zero atomic displacements when *U* and *Uisoequiv* are unset.
|
|
78
78
|
lattice : Lattice, Optional
|
|
79
|
-
|
|
79
|
+
The coordinate system for the fractional coordinates `xyz`.
|
|
80
80
|
Use the absolute Cartesian system when ``None``.
|
|
81
81
|
|
|
82
82
|
Attributes
|
|
83
83
|
----------
|
|
84
84
|
element : str
|
|
85
|
-
The string type of the atom. An element or ion symbol.
|
|
85
|
+
The string type of the atom. An element or ion symbol, default "".
|
|
86
86
|
xyz : numpy.ndarray
|
|
87
87
|
The fractional coordinates in the associated `lattice`.
|
|
88
88
|
label : str
|
|
89
|
-
|
|
89
|
+
The unique string label referring to this atom, for example, "C_1".
|
|
90
90
|
The *label* can be used to reference this atom when contained in
|
|
91
|
-
a `Structure` object.
|
|
91
|
+
a `Structure` object, default "".
|
|
92
92
|
occupancy : float
|
|
93
|
-
The fractional occupancy of this atom.
|
|
93
|
+
The fractional occupancy of this atom, default 1.0.
|
|
94
94
|
lattice : Lattice
|
|
95
|
-
|
|
95
|
+
The coordinate system for the fractional coordinates `xyz` and
|
|
96
96
|
the tensor of atomic displacement parameters `U`.
|
|
97
|
-
Use the absolute Cartesian coordinates when ``None
|
|
97
|
+
Use the absolute Cartesian coordinates when ``None`` as the default.
|
|
98
98
|
|
|
99
99
|
Note
|
|
100
100
|
----
|
|
@@ -104,21 +104,17 @@ class Atom(object):
|
|
|
104
104
|
# Private attributes
|
|
105
105
|
#
|
|
106
106
|
# _U : 3-by-3 ndarray
|
|
107
|
-
#
|
|
107
|
+
# The internal storage of the displacement parameters.
|
|
108
108
|
|
|
109
109
|
# instance attributes that have immutable default values
|
|
110
110
|
element = ""
|
|
111
|
-
"""str: Default values of `element`."""
|
|
112
111
|
|
|
113
112
|
label = ""
|
|
114
|
-
"""str: Default values of `label`."""
|
|
115
113
|
|
|
116
114
|
occupancy = 1.0
|
|
117
|
-
"""float: Default values of `occupancy`."""
|
|
118
115
|
|
|
119
116
|
_anisotropy = False
|
|
120
117
|
lattice = None
|
|
121
|
-
"""None: Default values of `lattice`."""
|
|
122
118
|
|
|
123
119
|
def __init__(
|
|
124
120
|
self,
|
|
@@ -232,7 +228,7 @@ class Atom(object):
|
|
|
232
228
|
return msd
|
|
233
229
|
|
|
234
230
|
def __repr__(self):
|
|
235
|
-
"""
|
|
231
|
+
"""The string representation of this Atom."""
|
|
236
232
|
xyz = self.xyz
|
|
237
233
|
s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (
|
|
238
234
|
self.element,
|
|
@@ -273,29 +269,29 @@ class Atom(object):
|
|
|
273
269
|
x = property(
|
|
274
270
|
lambda self: self.xyz[0],
|
|
275
271
|
lambda self, val: self.xyz.__setitem__(0, val),
|
|
276
|
-
doc="
|
|
272
|
+
doc="The fractional coordinate *x*, same as ``xyz[0]``, as a float",
|
|
277
273
|
)
|
|
278
274
|
y = property(
|
|
279
275
|
lambda self: self.xyz[1],
|
|
280
276
|
lambda self, val: self.xyz.__setitem__(1, val),
|
|
281
|
-
doc="
|
|
277
|
+
doc="The fractional coordinate *y*, same as ``xyz[1]``, as a float",
|
|
282
278
|
)
|
|
283
279
|
z = property(
|
|
284
280
|
lambda self: self.xyz[2],
|
|
285
281
|
lambda self, val: self.xyz.__setitem__(2, val),
|
|
286
|
-
doc="
|
|
282
|
+
doc="The fractional coordinate *z*, same as ``xyz[2]``, as a float",
|
|
287
283
|
)
|
|
288
284
|
|
|
289
285
|
# xyz_cartn
|
|
290
286
|
|
|
291
287
|
@property
|
|
292
288
|
def xyz_cartn(self):
|
|
293
|
-
"""
|
|
294
|
-
|
|
289
|
+
"""Atom position in absolute Cartesian coordinates, as a
|
|
290
|
+
numpy.ndarray.
|
|
295
291
|
|
|
296
292
|
This is computed from fractional coordinates `xyz` and the
|
|
297
|
-
current `lattice` setup. Assignment to *xyz_cartn* or
|
|
298
|
-
|
|
293
|
+
current `lattice` setup. Assignment to *xyz_cartn* or its
|
|
294
|
+
components is applied on fractional coordinates `xyz`.
|
|
299
295
|
"""
|
|
300
296
|
if not self.lattice:
|
|
301
297
|
rv = self.xyz
|
|
@@ -315,7 +311,8 @@ class Atom(object):
|
|
|
315
311
|
|
|
316
312
|
@property
|
|
317
313
|
def anisotropy(self):
|
|
318
|
-
"""
|
|
314
|
+
"""The flag for allowing anisotropic displacement parameters, as
|
|
315
|
+
a bool.
|
|
319
316
|
|
|
320
317
|
When ``False`` the tensor of thermal displacement parameters `U`
|
|
321
318
|
must be isotropic and only its diagonal elements are taken into
|
|
@@ -340,8 +337,8 @@ class Atom(object):
|
|
|
340
337
|
|
|
341
338
|
@property
|
|
342
339
|
def U(self):
|
|
343
|
-
"""
|
|
344
|
-
|
|
340
|
+
"""The 3x3 matrix of anisotropic atomic displacements, as a
|
|
341
|
+
ndarray.
|
|
345
342
|
|
|
346
343
|
For isotropic displacements (when `anisotropy` is ``False``)
|
|
347
344
|
assignment to *U* uses only the first ``Unew[0, 0]`` element
|
|
@@ -387,7 +384,7 @@ class Atom(object):
|
|
|
387
384
|
# _doc_uii, _doc_uij are temporary local variables.
|
|
388
385
|
|
|
389
386
|
_doc_uii = """
|
|
390
|
-
|
|
387
|
+
The ``U[{0}, {0}]`` component of the displacement tensor `U`, as a float
|
|
391
388
|
|
|
392
389
|
When `anisotropy` is ``False`` setting a new value updates entire
|
|
393
390
|
tensor *U*.
|
|
@@ -410,7 +407,7 @@ class Atom(object):
|
|
|
410
407
|
)
|
|
411
408
|
|
|
412
409
|
_doc_uij = """
|
|
413
|
-
|
|
410
|
+
The ``U[{0}, {1}]`` element of the displacement tensor `U`, as a float
|
|
414
411
|
|
|
415
412
|
Sets ``U[{1}, {0}]`` together with ``U[{0}, {1}]``. Assignment
|
|
416
413
|
has no effect when `anisotropy` is ``False``.
|
|
@@ -439,7 +436,8 @@ class Atom(object):
|
|
|
439
436
|
|
|
440
437
|
@property
|
|
441
438
|
def Uisoequiv(self):
|
|
442
|
-
"""
|
|
439
|
+
"""The isotropic displacement parameter or an equivalent value,
|
|
440
|
+
as a float.
|
|
443
441
|
|
|
444
442
|
Setting a new value rescales tensor `U` so it yields equivalent
|
|
445
443
|
direction-averaged displacements.
|
|
@@ -481,14 +479,14 @@ class Atom(object):
|
|
|
481
479
|
# _doc_bii, _doc_bij are local variables.
|
|
482
480
|
|
|
483
481
|
_doc_bii = """
|
|
484
|
-
|
|
482
|
+
The ``B{0}{0}`` element of the Debye-Waller matrix, as a float
|
|
485
483
|
|
|
486
484
|
This is equivalent to ``8 * pi**2 * U{0}{0}``. When `anisotropy`
|
|
487
485
|
is ``False`` setting a new value updates entire tensor `U`.
|
|
488
486
|
"""
|
|
489
487
|
|
|
490
488
|
_doc_bij = """
|
|
491
|
-
|
|
489
|
+
The ``B{0}{1}`` element of the Debye-Waller matrix, as a float
|
|
492
490
|
|
|
493
491
|
This is equivalent to ``8 * pi**2 * U{0}{1}``. Setting a new
|
|
494
492
|
value updates `U` in a symmetric way. Assignment has no effect
|
|
@@ -533,7 +531,8 @@ class Atom(object):
|
|
|
533
531
|
|
|
534
532
|
@property
|
|
535
533
|
def Bisoequiv(self):
|
|
536
|
-
"""
|
|
534
|
+
"""The Debye-Waller isotropic displacement or an equivalent
|
|
535
|
+
value, as a float.
|
|
537
536
|
|
|
538
537
|
This equals ``8 * pi**2 * Uisoequiv``. Setting a new value
|
|
539
538
|
rescales `U` tensor to yield equivalent direction-average of
|
|
@@ -553,7 +552,8 @@ class Atom(object):
|
|
|
553
552
|
|
|
554
553
|
|
|
555
554
|
class _AtomCartesianCoordinates(numpy.ndarray):
|
|
556
|
-
"""
|
|
555
|
+
"""The specialized `numpy.ndarray` for accessing Cartesian
|
|
556
|
+
coordinates.
|
|
557
557
|
|
|
558
558
|
Inplace assignments to this array are applied on the *xyz* position
|
|
559
559
|
position of owner `Atom` as per the associated `Atom.lattice`.
|
|
@@ -561,7 +561,7 @@ class _AtomCartesianCoordinates(numpy.ndarray):
|
|
|
561
561
|
Parameters
|
|
562
562
|
----------
|
|
563
563
|
atom : Atom
|
|
564
|
-
|
|
564
|
+
The `Atom` instance to be linked to these coordinate array.
|
|
565
565
|
"""
|
|
566
566
|
|
|
567
567
|
def __new__(self, atom):
|
|
@@ -575,7 +575,7 @@ class _AtomCartesianCoordinates(numpy.ndarray):
|
|
|
575
575
|
|
|
576
576
|
@property
|
|
577
577
|
def asarray(self):
|
|
578
|
-
"""
|
|
578
|
+
"""This array viewed as standard numpy array."""
|
|
579
579
|
return self.view(numpy.ndarray)
|
|
580
580
|
|
|
581
581
|
def __setitem__(self, idx, value):
|
|
@@ -18,7 +18,7 @@ lattice coordinate system.
|
|
|
18
18
|
Attributes
|
|
19
19
|
----------
|
|
20
20
|
cartesian : Lattice
|
|
21
|
-
|
|
21
|
+
The default Cartesian lattice with a=b=c=1 and alpha=beta=gamma=90 degrees.
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
24
|
import math
|
|
@@ -159,8 +159,8 @@ class Lattice(object):
|
|
|
159
159
|
Note
|
|
160
160
|
----
|
|
161
161
|
The array attributes are read-only. They get updated by changing
|
|
162
|
-
some lattice parameters or by calling the `
|
|
163
|
-
`
|
|
162
|
+
some lattice parameters or by calling the `set_latt_parms()` or
|
|
163
|
+
`set_new_latt_base_vec()` methods.
|
|
164
164
|
|
|
165
165
|
Examples
|
|
166
166
|
--------
|
|
@@ -757,13 +757,13 @@ class Lattice(object):
|
|
|
757
757
|
I3 = numpy.identity(3, dtype=float)
|
|
758
758
|
rotbaseI3diff = max(numpy.reshape(numpy.fabs(self.baserot - I3), 9))
|
|
759
759
|
cartlatpar = numpy.array([1.0, 1.0, 1.0, 90.0, 90.0, 90.0])
|
|
760
|
-
latpardiff = cartlatpar - self.
|
|
760
|
+
latpardiff = cartlatpar - self.cell_parms()
|
|
761
761
|
if rotbaseI3diff > self._epsilon:
|
|
762
762
|
s = "Lattice(base=%r)" % self.base
|
|
763
763
|
elif numpy.fabs(latpardiff).max() < self._epsilon:
|
|
764
764
|
s = "Lattice()"
|
|
765
765
|
else:
|
|
766
|
-
s = "Lattice(a=%g, b=%g, c=%g, alpha=%g, beta=%g, gamma=%g)" % self.
|
|
766
|
+
s = "Lattice(a=%g, b=%g, c=%g, alpha=%g, beta=%g, gamma=%g)" % self.cell_parms()
|
|
767
767
|
return s
|
|
768
768
|
|
|
769
769
|
|
{diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/__init__.py
RENAMED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
The recognized structure formats are defined by subclassing `StructureParser`,
|
|
18
18
|
by convention these classes are named `P_<format>.py`. The parser classes should
|
|
19
|
-
to override the `
|
|
19
|
+
to override the `parse_lines()` and `to_lines()` methods of `StructureParser`.
|
|
20
20
|
Any structure parser needs to be registered in `parser_index` module.
|
|
21
21
|
|
|
22
22
|
For normal usage it should be sufficient to use the routines provided
|
|
@@ -25,9 +25,9 @@ in this module.
|
|
|
25
25
|
Content:
|
|
26
26
|
* StructureParser: base class for a concrete Parser
|
|
27
27
|
* parser_index: dictionary of known structure formats
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* get_parser: factory for Parser at given format
|
|
29
|
+
* input_formats: list of available input formats
|
|
30
|
+
* output_formats: list of available output formats
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
33
|
from diffpy.structure.parsers.parser_index_mod import parser_index
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
##############################################################################
|
|
15
15
|
"""Parser for automatic file format detection.
|
|
16
16
|
|
|
17
|
-
This Parser does not provide the the `
|
|
17
|
+
This Parser does not provide the the `to_lines()` method.
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
import os
|
|
@@ -55,10 +55,10 @@ class P_auto(StructureParser):
|
|
|
55
55
|
Attributes
|
|
56
56
|
----------
|
|
57
57
|
format : str
|
|
58
|
-
|
|
58
|
+
The detected structure format. Initially set to "auto" and updated
|
|
59
59
|
after successful detection of the structure format.
|
|
60
60
|
pkw : dict
|
|
61
|
-
|
|
61
|
+
The keyword arguments passed to the parser.
|
|
62
62
|
"""
|
|
63
63
|
|
|
64
64
|
def __init__(self, **kw):
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
Attributes
|
|
18
18
|
----------
|
|
19
19
|
rx_float : re.Pattern
|
|
20
|
-
|
|
20
|
+
The constant regular expression for `leading_float()`.
|
|
21
21
|
symvec : dict
|
|
22
|
-
|
|
22
|
+
The helper dictionary for `get_symop()`.
|
|
23
23
|
|
|
24
24
|
Note
|
|
25
25
|
----
|
|
@@ -79,26 +79,26 @@ class P_cif(StructureParser):
|
|
|
79
79
|
Attributes
|
|
80
80
|
----------
|
|
81
81
|
format : str
|
|
82
|
-
|
|
82
|
+
The structure format name.
|
|
83
83
|
ciffile : CifFile
|
|
84
|
-
|
|
84
|
+
The instance of `CifFile` from `PyCifRW`.
|
|
85
85
|
stru : Structure
|
|
86
|
-
`Structure` instance used for CIF input or output.
|
|
86
|
+
The `Structure` instance used for CIF input or output.
|
|
87
87
|
spacegroup : SpaceGroup
|
|
88
|
-
|
|
88
|
+
The instance of `SpaceGroup` used for symmetry expansion.
|
|
89
89
|
eps : float
|
|
90
|
-
|
|
90
|
+
The resolution in fractional coordinates for non-equal positions.
|
|
91
91
|
Used for expansion of asymmetric unit.
|
|
92
92
|
eau : ExpandAsymmetricUnit
|
|
93
|
-
|
|
93
|
+
The instance of `ExpandAsymmetricUnit` from `SymmetryUtilities`.
|
|
94
94
|
asymmetric_unit : list
|
|
95
|
-
|
|
95
|
+
The list of `Atom` instances for the original asymmetric unit in the CIF file.
|
|
96
96
|
labelindex : dict
|
|
97
|
-
|
|
97
|
+
The dictionary mapping unique atom label to index of `Atom` in `self.asymmetric_unit`.
|
|
98
98
|
anisotropy : dict
|
|
99
|
-
|
|
99
|
+
The dictionary mapping unique atom label to displacement anisotropy resolved at that site.
|
|
100
100
|
cif_sgname : str or None
|
|
101
|
-
|
|
101
|
+
The space group name obtained by looking up the value of
|
|
102
102
|
`_space_group_name_Hall`,
|
|
103
103
|
`_symmetry_space_group_name_Hall`,
|
|
104
104
|
`_space_group_name_H-M_alt`,
|
|
@@ -151,8 +151,8 @@ class P_cif(StructureParser):
|
|
|
151
151
|
_atom_setters[k] = _atom_setters[k.lower()] = k
|
|
152
152
|
del k
|
|
153
153
|
|
|
154
|
+
# Conversion factor from B values to U values, as a float
|
|
154
155
|
BtoU = 1.0 / (8 * numpy.pi**2)
|
|
155
|
-
"""float: Conversion factor from B values to U values."""
|
|
156
156
|
|
|
157
157
|
def _tr_ignore(a, value):
|
|
158
158
|
return
|
|
@@ -362,7 +362,6 @@ class P_cif(StructureParser):
|
|
|
362
362
|
"""
|
|
363
363
|
return self.parse_lines(lines)
|
|
364
364
|
|
|
365
|
-
@deprecated(parseLines_deprecation_msg)
|
|
366
365
|
def parse_lines(self, lines):
|
|
367
366
|
"""Parse list of lines in CIF format.
|
|
368
367
|
|
{diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_discus.py
RENAMED
|
@@ -39,23 +39,24 @@ toLines_deprecation_msg = build_deprecation_message(
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
class P_discus(StructureParser):
|
|
42
|
-
"""Parser for DISCUS structure format.
|
|
43
|
-
|
|
42
|
+
"""Parser for DISCUS structure format.
|
|
43
|
+
|
|
44
|
+
The parser chokes on molecule and generator records.
|
|
44
45
|
|
|
45
46
|
Attributes
|
|
46
47
|
----------
|
|
47
48
|
format : str
|
|
48
|
-
|
|
49
|
+
The file format name, default "discus".
|
|
49
50
|
nl : int
|
|
50
|
-
|
|
51
|
+
The line number of the current line being parsed.
|
|
51
52
|
lines : list of str
|
|
52
|
-
|
|
53
|
+
The list of lines from the input file.
|
|
53
54
|
line : str
|
|
54
|
-
|
|
55
|
+
The current line being parsed.
|
|
55
56
|
stru : PDFFitStructure
|
|
56
|
-
|
|
57
|
+
The structure being parsed.
|
|
57
58
|
ignored_lines : list of str
|
|
58
|
-
|
|
59
|
+
The list of lines that were ignored during parsing.
|
|
59
60
|
cell_read : bool
|
|
60
61
|
``True`` if cell record processed.
|
|
61
62
|
ncell_read : bool
|
|
@@ -139,7 +140,7 @@ class P_discus(StructureParser):
|
|
|
139
140
|
raise StructureFormatError(emsg)
|
|
140
141
|
# take care of superlattice
|
|
141
142
|
if self.stru.pdffit["ncell"][:3] != [1, 1, 1]:
|
|
142
|
-
latpars = list(self.stru.lattice.
|
|
143
|
+
latpars = list(self.stru.lattice.cell_parms())
|
|
143
144
|
superlatpars = [latpars[i] * self.stru.pdffit["ncell"][i] for i in range(3)] + latpars[3:]
|
|
144
145
|
superlattice = Lattice(*superlatpars)
|
|
145
146
|
self.stru.place_in_lattice(superlattice)
|
|
@@ -214,7 +215,7 @@ class P_discus(StructureParser):
|
|
|
214
215
|
raise StructureFormatError(emsg)
|
|
215
216
|
# take care of superlattice
|
|
216
217
|
if self.stru.pdffit["ncell"][:3] != [1, 1, 1]:
|
|
217
|
-
latpars = list(self.stru.lattice.
|
|
218
|
+
latpars = list(self.stru.lattice.cell_parms())
|
|
218
219
|
superlatpars = [latpars[i] * self.stru.pdffit["ncell"][i] for i in range(3)] + latpars[3:]
|
|
219
220
|
superlattice = Lattice(*superlatpars)
|
|
220
221
|
self.stru.place_in_lattice(superlattice)
|
|
@@ -267,7 +268,7 @@ class P_discus(StructureParser):
|
|
|
267
268
|
if stru_pdffit.get("stepcut", 0.0) > 0.0:
|
|
268
269
|
line = "shape stepcut, %g" % stru_pdffit["stepcut"]
|
|
269
270
|
lines.append(line)
|
|
270
|
-
lines.append("cell %9.6f, %9.6f, %9.6f, %9.6f, %9.6f, %9.6f" % self.stru.lattice.
|
|
271
|
+
lines.append("cell %9.6f, %9.6f, %9.6f, %9.6f, %9.6f, %9.6f" % self.stru.lattice.cell_parms())
|
|
271
272
|
lines.append("ncell %9i, %9i, %9i, %9i" % (1, 1, 1, len(self.stru)))
|
|
272
273
|
lines.append("atoms")
|
|
273
274
|
for a in self.stru:
|
|
@@ -74,7 +74,11 @@ class P_pdb(StructureParser):
|
|
|
74
74
|
Attributes
|
|
75
75
|
----------
|
|
76
76
|
format : str
|
|
77
|
-
|
|
77
|
+
The format name, default "pdb".
|
|
78
|
+
orderOfRecords : list
|
|
79
|
+
The ordered list of PDB record labels.
|
|
80
|
+
validRecords : dict
|
|
81
|
+
The set of valid PDB record labels.
|
|
78
82
|
"""
|
|
79
83
|
|
|
80
84
|
# Static data members
|
|
@@ -135,10 +139,8 @@ class P_pdb(StructureParser):
|
|
|
135
139
|
"MASTER",
|
|
136
140
|
"END",
|
|
137
141
|
]
|
|
138
|
-
"""list: Ordered list of PDB record labels."""
|
|
139
142
|
|
|
140
143
|
validRecords = dict.fromkeys(orderOfRecords)
|
|
141
|
-
"""dict: Dictionary of PDB record labels."""
|
|
142
144
|
|
|
143
145
|
def __init__(self):
|
|
144
146
|
StructureParser.__init__(self)
|
|
@@ -213,9 +215,9 @@ class P_pdb(StructureParser):
|
|
|
213
215
|
sc[2, :] = [float(x) for x in line[10:40].split()]
|
|
214
216
|
scaleU[2] = float(line[45:55])
|
|
215
217
|
base = numpy.transpose(numpy.linalg.inv(sc))
|
|
216
|
-
abcABGcryst = numpy.array(stru.lattice.
|
|
218
|
+
abcABGcryst = numpy.array(stru.lattice.cell_parms())
|
|
217
219
|
stru.lattice.set_new_latt_base_vec(base)
|
|
218
|
-
abcABGscale = numpy.array(stru.lattice.
|
|
220
|
+
abcABGscale = numpy.array(stru.lattice.cell_parms())
|
|
219
221
|
reldiff = numpy.fabs(1.0 - abcABGscale / abcABGcryst)
|
|
220
222
|
if not numpy.all(reldiff < 1.0e-4):
|
|
221
223
|
emsg = "%d: " % p_nl + "SCALE and CRYST1 are not consistent."
|
{diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_pdffit.py
RENAMED
|
@@ -40,11 +40,11 @@ class P_pdffit(StructureParser):
|
|
|
40
40
|
Attributes
|
|
41
41
|
----------
|
|
42
42
|
format : str
|
|
43
|
-
|
|
43
|
+
The format name, default "pdffit".
|
|
44
44
|
ignored_lines : list
|
|
45
|
-
|
|
45
|
+
The list of lines ignored during parsing.
|
|
46
46
|
stru : PDFFitStructure
|
|
47
|
-
|
|
47
|
+
The structure instance used for cif input or output.
|
|
48
48
|
"""
|
|
49
49
|
|
|
50
50
|
def __init__(self):
|
{diffpy_structure-3.4.0rc1 → diffpy_structure-3.5.0}/src/diffpy/structure/parsers/p_vesta.py
RENAMED
|
@@ -22,7 +22,7 @@ VESTA is the actively maintained successor viewer.
|
|
|
22
22
|
Attributes
|
|
23
23
|
----------
|
|
24
24
|
AtomicMass : dict
|
|
25
|
-
|
|
25
|
+
The dictionary of atomic masses for elements.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
import re
|
|
@@ -47,8 +47,9 @@ class P_vesta(StructureParser):
|
|
|
47
47
|
Attributes
|
|
48
48
|
----------
|
|
49
49
|
format : str
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
The format name, default "vesta".
|
|
51
|
+
cluster_boundary : int
|
|
52
|
+
The width of boundary around corners of non-periodic cluster, default 2.
|
|
52
53
|
Notes
|
|
53
54
|
-----
|
|
54
55
|
The ``cluster_boundary`` attribute is retained from the original
|
|
@@ -57,10 +58,6 @@ class P_vesta(StructureParser):
|
|
|
57
58
|
"""
|
|
58
59
|
|
|
59
60
|
cluster_boundary = 2
|
|
60
|
-
"""int: Width of boundary around corners of non-periodic cluster.
|
|
61
|
-
Retained from the original AtomEye/XCFG parser for API compatibility.
|
|
62
|
-
VESTA handles periodicity natively so this value has no effect on output.
|
|
63
|
-
"""
|
|
64
61
|
|
|
65
62
|
def __init__(self):
|
|
66
63
|
StructureParser.__init__(self)
|
|
@@ -187,7 +184,7 @@ class P_vesta(StructureParser):
|
|
|
187
184
|
emsg = "VESTA file is missing STRUC lattice parameters"
|
|
188
185
|
raise StructureFormatError(emsg)
|
|
189
186
|
|
|
190
|
-
stru.lattice.
|
|
187
|
+
stru.lattice.set_latt_parms(
|
|
191
188
|
a=latt_abc[0],
|
|
192
189
|
b=latt_abc[1],
|
|
193
190
|
c=latt_abc[2],
|