diffpy.structure 3.2.0__py3-none-any.whl
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.py +35 -0
- diffpy/__init__.py +23 -0
- diffpy/structure/__init__.py +93 -0
- diffpy/structure/_legacy_importer.py +88 -0
- diffpy/structure/apps/__init__.py +17 -0
- diffpy/structure/apps/anyeye.py +284 -0
- diffpy/structure/apps/transtru.py +126 -0
- diffpy/structure/atom.py +544 -0
- diffpy/structure/expansion/__init__.py +27 -0
- diffpy/structure/expansion/makeellipsoid.py +129 -0
- diffpy/structure/expansion/shapeutils.py +44 -0
- diffpy/structure/expansion/supercell_mod.py +91 -0
- diffpy/structure/lattice.py +663 -0
- diffpy/structure/mmlibspacegroups.py +8154 -0
- diffpy/structure/parsers/__init__.py +83 -0
- diffpy/structure/parsers/p_auto.py +217 -0
- diffpy/structure/parsers/p_cif.py +876 -0
- diffpy/structure/parsers/p_discus.py +312 -0
- diffpy/structure/parsers/p_pdb.py +405 -0
- diffpy/structure/parsers/p_pdffit.py +290 -0
- diffpy/structure/parsers/p_rawxyz.py +149 -0
- diffpy/structure/parsers/p_xcfg.py +457 -0
- diffpy/structure/parsers/p_xyz.py +161 -0
- diffpy/structure/parsers/parser_index_mod.py +108 -0
- diffpy/structure/parsers/structureparser.py +80 -0
- diffpy/structure/pdffitstructure.py +109 -0
- diffpy/structure/sgtbxspacegroups.py +5198 -0
- diffpy/structure/spacegroupmod.py +329 -0
- diffpy/structure/spacegroups.py +1441 -0
- diffpy/structure/structure.py +866 -0
- diffpy/structure/structureerrors.py +35 -0
- diffpy/structure/symmetryutilities.py +1100 -0
- diffpy/structure/utils.py +126 -0
- diffpy/structure/version.py +26 -0
- diffpy.structure-3.2.0.dist-info/AUTHORS.rst +13 -0
- diffpy.structure-3.2.0.dist-info/LICENSE.rst +141 -0
- diffpy.structure-3.2.0.dist-info/LICENSE_DANSE.rst +50 -0
- diffpy.structure-3.2.0.dist-info/LICENSE_pymmlib.rst +203 -0
- diffpy.structure-3.2.0.dist-info/METADATA +197 -0
- diffpy.structure-3.2.0.dist-info/RECORD +42 -0
- diffpy.structure-3.2.0.dist-info/WHEEL +5 -0
- diffpy.structure-3.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# Copyright 2002 by PyMMLib Development Group, http://pymmlib.sourceforge.net/
|
|
3
|
+
# This code is part of the PyMMLib distribution and governed by
|
|
4
|
+
# its license. Please see the LICENSE_pymmlib file that should have been
|
|
5
|
+
# included as part of this package.
|
|
6
|
+
"""Symmetry operations as functions on vectors or arrays.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import numpy
|
|
10
|
+
|
|
11
|
+
# 64 unique rotation matricies
|
|
12
|
+
Rot_Z_mY_X = numpy.array([[0.0, 0.0, 1.0], [0.0, -1.0, 0.0], [1.0, 0.0, 0.0]], float)
|
|
13
|
+
Rot_Y_mX_mZ = numpy.array([[0.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
14
|
+
Rot_XmY_X_mZ = numpy.array([[1.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
15
|
+
Rot_mX_Y_mZ = numpy.array([[-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
16
|
+
Rot_X_mZ_Y = numpy.array([[1.0, 0.0, 0.0], [0.0, 0.0, -1.0], [0.0, 1.0, 0.0]], float)
|
|
17
|
+
Rot_Y_mXY_Z = numpy.array([[0.0, 1.0, 0.0], [-1.0, 1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
18
|
+
Rot_Y_mX_Z = numpy.array([[0.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
19
|
+
Rot_XmY_X_Z = numpy.array([[1.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
20
|
+
Rot_mX_mXY_mZ = numpy.array([[-1.0, 0.0, 0.0], [-1.0, 1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
21
|
+
Rot_Y_Z_X = numpy.array([[0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0]], float)
|
|
22
|
+
Rot_mY_mZ_X = numpy.array([[0.0, -1.0, 0.0], [0.0, 0.0, -1.0], [1.0, 0.0, 0.0]], float)
|
|
23
|
+
Rot_X_Z_mY = numpy.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, -1.0, 0.0]], float)
|
|
24
|
+
Rot_XmY_mY_Z = numpy.array([[1.0, -1.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
25
|
+
Rot_Y_X_mZ = numpy.array([[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
26
|
+
Rot_Y_mZ_X = numpy.array([[0.0, 1.0, 0.0], [0.0, 0.0, -1.0], [1.0, 0.0, 0.0]], float)
|
|
27
|
+
Rot_mXY_Y_Z = numpy.array([[-1.0, 1.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
28
|
+
Rot_mX_mY_mZ = numpy.array([[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
29
|
+
Rot_X_Y_mZ = numpy.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
30
|
+
Rot_mXY_mX_Z = numpy.array([[-1.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
31
|
+
Rot_mZ_mY_mX = numpy.array([[0.0, 0.0, -1.0], [0.0, -1.0, 0.0], [-1.0, 0.0, 0.0]], float)
|
|
32
|
+
Rot_X_mZ_mY = numpy.array([[1.0, 0.0, 0.0], [0.0, 0.0, -1.0], [0.0, -1.0, 0.0]], float)
|
|
33
|
+
Rot_X_Y_Z = numpy.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
34
|
+
Rot_mY_mX_mZ = numpy.array([[0.0, -1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
35
|
+
Rot_mY_X_Z = numpy.array([[0.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
36
|
+
Rot_Z_X_Y = numpy.array([[0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], float)
|
|
37
|
+
Rot_X_XmY_Z = numpy.array([[1.0, 0.0, 0.0], [1.0, -1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
38
|
+
Rot_mY_X_mZ = numpy.array([[0.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
39
|
+
Rot_mY_Z_mX = numpy.array([[0.0, -1.0, 0.0], [0.0, 0.0, 1.0], [-1.0, 0.0, 0.0]], float)
|
|
40
|
+
Rot_mY_Z_X = numpy.array([[0.0, -1.0, 0.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0]], float)
|
|
41
|
+
Rot_mX_mZ_mY = numpy.array([[-1.0, 0.0, 0.0], [0.0, 0.0, -1.0], [0.0, -1.0, 0.0]], float)
|
|
42
|
+
Rot_mX_Z_Y = numpy.array([[-1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, 1.0, 0.0]], float)
|
|
43
|
+
Rot_mZ_mX_mY = numpy.array([[0.0, 0.0, -1.0], [-1.0, 0.0, 0.0], [0.0, -1.0, 0.0]], float)
|
|
44
|
+
Rot_X_XmY_mZ = numpy.array([[1.0, 0.0, 0.0], [1.0, -1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
45
|
+
Rot_mY_XmY_mZ = numpy.array([[0.0, -1.0, 0.0], [1.0, -1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
46
|
+
Rot_Z_X_mY = numpy.array([[0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, -1.0, 0.0]], float)
|
|
47
|
+
Rot_mZ_mY_X = numpy.array([[0.0, 0.0, -1.0], [0.0, -1.0, 0.0], [1.0, 0.0, 0.0]], float)
|
|
48
|
+
Rot_X_Z_Y = numpy.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, 1.0, 0.0]], float)
|
|
49
|
+
Rot_Z_mX_mY = numpy.array([[0.0, 0.0, 1.0], [-1.0, 0.0, 0.0], [0.0, -1.0, 0.0]], float)
|
|
50
|
+
Rot_mX_Z_mY = numpy.array([[-1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, -1.0, 0.0]], float)
|
|
51
|
+
Rot_X_mY_Z = numpy.array([[1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
52
|
+
Rot_mY_mX_Z = numpy.array([[0.0, -1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
53
|
+
Rot_Z_mY_mX = numpy.array([[0.0, 0.0, 1.0], [0.0, -1.0, 0.0], [-1.0, 0.0, 0.0]], float)
|
|
54
|
+
Rot_mX_mY_Z = numpy.array([[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
55
|
+
Rot_Z_Y_X = numpy.array([[0.0, 0.0, 1.0], [0.0, 1.0, 0.0], [1.0, 0.0, 0.0]], float)
|
|
56
|
+
Rot_mZ_Y_mX = numpy.array([[0.0, 0.0, -1.0], [0.0, 1.0, 0.0], [-1.0, 0.0, 0.0]], float)
|
|
57
|
+
Rot_Y_Z_mX = numpy.array([[0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [-1.0, 0.0, 0.0]], float)
|
|
58
|
+
Rot_mY_XmY_Z = numpy.array([[0.0, -1.0, 0.0], [1.0, -1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
59
|
+
Rot_mXY_Y_mZ = numpy.array([[-1.0, 1.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
60
|
+
Rot_mZ_mX_Y = numpy.array([[0.0, 0.0, -1.0], [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], float)
|
|
61
|
+
Rot_mX_mZ_Y = numpy.array([[-1.0, 0.0, 0.0], [0.0, 0.0, -1.0], [0.0, 1.0, 0.0]], float)
|
|
62
|
+
Rot_mX_Y_Z = numpy.array([[-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
63
|
+
Rot_X_mY_mZ = numpy.array([[1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
64
|
+
Rot_mZ_X_Y = numpy.array([[0.0, 0.0, -1.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], float)
|
|
65
|
+
Rot_Y_mZ_mX = numpy.array([[0.0, 1.0, 0.0], [0.0, 0.0, -1.0], [-1.0, 0.0, 0.0]], float)
|
|
66
|
+
Rot_mY_mZ_mX = numpy.array([[0.0, -1.0, 0.0], [0.0, 0.0, -1.0], [-1.0, 0.0, 0.0]], float)
|
|
67
|
+
Rot_mZ_Y_X = numpy.array([[0.0, 0.0, -1.0], [0.0, 1.0, 0.0], [1.0, 0.0, 0.0]], float)
|
|
68
|
+
Rot_Z_Y_mX = numpy.array([[0.0, 0.0, 1.0], [0.0, 1.0, 0.0], [-1.0, 0.0, 0.0]], float)
|
|
69
|
+
Rot_mXY_mX_mZ = numpy.array([[-1.0, 1.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
70
|
+
Rot_XmY_mY_mZ = numpy.array([[1.0, -1.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
71
|
+
Rot_Z_mX_Y = numpy.array([[0.0, 0.0, 1.0], [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], float)
|
|
72
|
+
Rot_mX_mXY_Z = numpy.array([[-1.0, 0.0, 0.0], [-1.0, 1.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
73
|
+
Rot_Y_mXY_mZ = numpy.array([[0.0, 1.0, 0.0], [-1.0, 1.0, 0.0], [0.0, 0.0, -1.0]], float)
|
|
74
|
+
Rot_mZ_X_mY = numpy.array([[0.0, 0.0, -1.0], [1.0, 0.0, 0.0], [0.0, -1.0, 0.0]], float)
|
|
75
|
+
Rot_Y_X_Z = numpy.array([[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]], float)
|
|
76
|
+
|
|
77
|
+
# 32 unique translation vectors
|
|
78
|
+
Tr_0_0_34 = numpy.array([0.0, 0.0, 3.0 / 4.0], float)
|
|
79
|
+
Tr_12_0_34 = numpy.array([1.0 / 2.0, 0.0, 3.0 / 4.0], float)
|
|
80
|
+
Tr_0_0_56 = numpy.array([0.0, 0.0, 5.0 / 6.0], float)
|
|
81
|
+
Tr_12_0_12 = numpy.array([1.0 / 2.0, 0.0, 1.0 / 2.0], float)
|
|
82
|
+
Tr_0_12_12 = numpy.array([0.0, 1.0 / 2.0, 1.0 / 2.0], float)
|
|
83
|
+
Tr_12_0_14 = numpy.array([1.0 / 2.0, 0.0, 1.0 / 4.0], float)
|
|
84
|
+
Tr_0_12_14 = numpy.array([0.0, 1.0 / 2.0, 1.0 / 4.0], float)
|
|
85
|
+
Tr_14_14_14 = numpy.array([1.0 / 4.0, 1.0 / 4.0, 1.0 / 4.0], float)
|
|
86
|
+
Tr_0_12_34 = numpy.array([0.0, 1.0 / 2.0, 3.0 / 4.0], float)
|
|
87
|
+
Tr_34_14_14 = numpy.array([3.0 / 4.0, 1.0 / 4.0, 1.0 / 4.0], float)
|
|
88
|
+
Tr_0_0_0 = numpy.array([0.0, 0.0, 0.0], float)
|
|
89
|
+
Tr_23_13_56 = numpy.array([2.0 / 3.0, 1.0 / 3.0, 5.0 / 6.0], float)
|
|
90
|
+
Tr_14_14_34 = numpy.array([1.0 / 4.0, 1.0 / 4.0, 3.0 / 4.0], float)
|
|
91
|
+
Tr_12_12_0 = numpy.array([1.0 / 2.0, 1.0 / 2.0, 0.0], float)
|
|
92
|
+
Tr_23_13_13 = numpy.array([2.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0], float)
|
|
93
|
+
Tr_13_23_23 = numpy.array([1.0 / 3.0, 2.0 / 3.0, 2.0 / 3.0], float)
|
|
94
|
+
Tr_12_12_12 = numpy.array([1.0 / 2.0, 1.0 / 2.0, 1.0 / 2.0], float)
|
|
95
|
+
Tr_12_12_14 = numpy.array([1.0 / 2.0, 1.0 / 2.0, 1.0 / 4.0], float)
|
|
96
|
+
Tr_14_34_14 = numpy.array([1.0 / 4.0, 3.0 / 4.0, 1.0 / 4.0], float)
|
|
97
|
+
Tr_12_12_34 = numpy.array([1.0 / 2.0, 1.0 / 2.0, 3.0 / 4.0], float)
|
|
98
|
+
Tr_0_0_23 = numpy.array([0.0, 0.0, 2.0 / 3.0], float)
|
|
99
|
+
Tr_0_12_0 = numpy.array([0.0, 1.0 / 2.0, 0.0], float)
|
|
100
|
+
Tr_14_34_34 = numpy.array([1.0 / 4.0, 3.0 / 4.0, 3.0 / 4.0], float)
|
|
101
|
+
Tr_34_34_14 = numpy.array([3.0 / 4.0, 3.0 / 4.0, 1.0 / 4.0], float)
|
|
102
|
+
Tr_12_0_0 = numpy.array([1.0 / 2.0, 0.0, 0.0], float)
|
|
103
|
+
Tr_34_34_34 = numpy.array([3.0 / 4.0, 3.0 / 4.0, 3.0 / 4.0], float)
|
|
104
|
+
Tr_0_0_13 = numpy.array([0.0, 0.0, 1.0 / 3.0], float)
|
|
105
|
+
Tr_0_0_12 = numpy.array([0.0, 0.0, 1.0 / 2.0], float)
|
|
106
|
+
Tr_13_23_16 = numpy.array([1.0 / 3.0, 2.0 / 3.0, 1.0 / 6.0], float)
|
|
107
|
+
Tr_0_0_14 = numpy.array([0.0, 0.0, 1.0 / 4.0], float)
|
|
108
|
+
Tr_0_0_16 = numpy.array([0.0, 0.0, 1.0 / 6.0], float)
|
|
109
|
+
Tr_34_14_34 = numpy.array([3.0 / 4.0, 1.0 / 4.0, 3.0 / 4.0], float)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class SymOp(object):
|
|
113
|
+
"""The transformation of coordinates to a symmetry-related position.
|
|
114
|
+
|
|
115
|
+
The SymOp operation involves rotation and translation in cell coordinates.
|
|
116
|
+
|
|
117
|
+
Parameters
|
|
118
|
+
----------
|
|
119
|
+
R : numpy.ndarray
|
|
120
|
+
The 3x3 matrix of rotation for this symmetry operation.
|
|
121
|
+
t : numpy.ndarray
|
|
122
|
+
The vector of translation in this symmetry operation.
|
|
123
|
+
|
|
124
|
+
Attributes
|
|
125
|
+
----------
|
|
126
|
+
R : numpy.ndarray
|
|
127
|
+
The 3x3 matrix of rotation pertaining to unit cell coordinates.
|
|
128
|
+
This may be identity, simple rotation, improper rotation, mirror
|
|
129
|
+
or inversion. The determinant of *R* is either +1 or -1.
|
|
130
|
+
t : numpy.ndarray
|
|
131
|
+
The translation of cell coordinates applied after rotation *R*.
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
def __init__(self, R, t):
|
|
135
|
+
self.R = R
|
|
136
|
+
self.t = t
|
|
137
|
+
return
|
|
138
|
+
|
|
139
|
+
def __str__(self):
|
|
140
|
+
"""Printable representation of this SymOp object."""
|
|
141
|
+
x = "[%6.3f %6.3f %6.3f %6.3f]\n" % (self.R[0, 0], self.R[0, 1], self.R[0, 2], self.t[0])
|
|
142
|
+
x += "[%6.3f %6.3f %6.3f %6.3f]\n" % (self.R[1, 0], self.R[1, 1], self.R[1, 2], self.t[1])
|
|
143
|
+
x += "[%6.3f %6.3f %6.3f %6.3f]\n" % (self.R[2, 0], self.R[2, 1], self.R[2, 2], self.t[2])
|
|
144
|
+
return x
|
|
145
|
+
|
|
146
|
+
def __call__(self, vec):
|
|
147
|
+
"""Return symmetry-related position for the specified coordinates.
|
|
148
|
+
|
|
149
|
+
Parameters
|
|
150
|
+
----------
|
|
151
|
+
vec : numpy.ndarray
|
|
152
|
+
The initial position in fractional cell coordinates.
|
|
153
|
+
|
|
154
|
+
Returns
|
|
155
|
+
-------
|
|
156
|
+
numpy.ndarray
|
|
157
|
+
The transformed position after this symmetry operation.
|
|
158
|
+
"""
|
|
159
|
+
return numpy.dot(self.R, vec) + self.t
|
|
160
|
+
|
|
161
|
+
def __eq__(self, symop):
|
|
162
|
+
"""Implement the ``self == symop`` test of equality.
|
|
163
|
+
|
|
164
|
+
Return ``True`` when *self* and *symop* difference is within
|
|
165
|
+
tiny round-off errors.
|
|
166
|
+
"""
|
|
167
|
+
return numpy.allclose(self.R, symop.R) and numpy.allclose(self.t, symop.t)
|
|
168
|
+
|
|
169
|
+
def is_identity(self):
|
|
170
|
+
"""Check if this SymOp is an identity operation.
|
|
171
|
+
|
|
172
|
+
Returns
|
|
173
|
+
-------
|
|
174
|
+
bool
|
|
175
|
+
``True`` if this is an identity operation within a small round-off.
|
|
176
|
+
Return ``False`` otherwise.
|
|
177
|
+
"""
|
|
178
|
+
rv = numpy.allclose(self.R, numpy.identity(3, float)) and numpy.allclose(self.t, numpy.zeros(3, float))
|
|
179
|
+
return rv
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# End of class SymOp
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class SpaceGroup(object):
|
|
186
|
+
"""Definition and basic operations for a specific space group.
|
|
187
|
+
|
|
188
|
+
Provide standard names and all symmetry operations contained in
|
|
189
|
+
one space group.
|
|
190
|
+
|
|
191
|
+
Parameters
|
|
192
|
+
----------
|
|
193
|
+
number : int
|
|
194
|
+
The space group number.
|
|
195
|
+
num_sym_equiv : int
|
|
196
|
+
The number of symmetry equivalent sites for a general position.
|
|
197
|
+
num_primitive_sym_equiv : int
|
|
198
|
+
The number of symmetry equivalent sites in a primitive unit cell.
|
|
199
|
+
short_name : str
|
|
200
|
+
The short Hermann-Mauguin symbol of the space group.
|
|
201
|
+
point_group_name : str
|
|
202
|
+
The point group of this space group.
|
|
203
|
+
crystal_system : str
|
|
204
|
+
The crystal system of this space group.
|
|
205
|
+
pdb_name : str
|
|
206
|
+
The full Hermann-Mauguin symbol of the space group.
|
|
207
|
+
symop_list : list of SymOp
|
|
208
|
+
The symmetry operations contained in this space group.
|
|
209
|
+
|
|
210
|
+
Attributes
|
|
211
|
+
----------
|
|
212
|
+
number : int
|
|
213
|
+
A unique space group number. This may be incremented by
|
|
214
|
+
several thousands to facilitate unique values for multiple
|
|
215
|
+
settings of the same space group. Use ``number % 1000``
|
|
216
|
+
to get the standard space group number from International
|
|
217
|
+
Tables.
|
|
218
|
+
num_sym_equiv : int
|
|
219
|
+
The number of symmetry equivalent sites for a general position.
|
|
220
|
+
num_primitive_sym_equiv : int
|
|
221
|
+
The number of symmetry equivalent sites in a primitive unit cell.
|
|
222
|
+
short_name : str
|
|
223
|
+
The short Hermann-Mauguin symbol of the space group.
|
|
224
|
+
point_group_name : str
|
|
225
|
+
The point group to which this space group belongs to.
|
|
226
|
+
crystal_system : str
|
|
227
|
+
The crystal system of this space group. The possible values are
|
|
228
|
+
``"TRICLINIC", "MONOCLINIC", "ORTHORHOMBIC", "TETRAGONAL",
|
|
229
|
+
"TRIGONAL" "HEXAGONAL", "CUBIC"``.
|
|
230
|
+
pdb_name : str
|
|
231
|
+
The full Hermann-Mauguin symbol of the space group.
|
|
232
|
+
symop_list : list of SymOp
|
|
233
|
+
A list of `SymOp` objects for all symmetry operations
|
|
234
|
+
in this space group.
|
|
235
|
+
"""
|
|
236
|
+
|
|
237
|
+
def __init__(
|
|
238
|
+
self,
|
|
239
|
+
number=None,
|
|
240
|
+
num_sym_equiv=None,
|
|
241
|
+
num_primitive_sym_equiv=None,
|
|
242
|
+
short_name=None,
|
|
243
|
+
point_group_name=None,
|
|
244
|
+
crystal_system=None,
|
|
245
|
+
pdb_name=None,
|
|
246
|
+
symop_list=None,
|
|
247
|
+
):
|
|
248
|
+
|
|
249
|
+
self.number = number
|
|
250
|
+
self.num_sym_equiv = num_sym_equiv
|
|
251
|
+
self.num_primitive_sym_equiv = num_primitive_sym_equiv
|
|
252
|
+
self.short_name = short_name
|
|
253
|
+
self.point_group_name = point_group_name
|
|
254
|
+
self.crystal_system = crystal_system
|
|
255
|
+
self.pdb_name = pdb_name
|
|
256
|
+
self.symop_list = symop_list
|
|
257
|
+
|
|
258
|
+
def __repr__(self):
|
|
259
|
+
"""Return a string representation of the space group."""
|
|
260
|
+
return ("SpaceGroup #%i (%s, %s). Symmetry matrices: %i, " "point sym. matr.: %i") % (
|
|
261
|
+
self.number,
|
|
262
|
+
self.short_name,
|
|
263
|
+
self.crystal_system[0] + self.crystal_system[1:].lower(),
|
|
264
|
+
self.num_sym_equiv,
|
|
265
|
+
self.num_primitive_sym_equiv,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
def iter_symops(self):
|
|
269
|
+
"""Iterate over all symmetry operations in the space group.
|
|
270
|
+
|
|
271
|
+
Yields
|
|
272
|
+
------
|
|
273
|
+
SymOp
|
|
274
|
+
Generate all symmetry operations for this space group.
|
|
275
|
+
"""
|
|
276
|
+
return iter(self.symop_list)
|
|
277
|
+
|
|
278
|
+
def check_group_name(self, name):
|
|
279
|
+
"""Check if given name matches this space group.
|
|
280
|
+
|
|
281
|
+
Parameters
|
|
282
|
+
----------
|
|
283
|
+
name : str or int
|
|
284
|
+
The space group identifier, a string name or number.
|
|
285
|
+
|
|
286
|
+
Returns
|
|
287
|
+
-------
|
|
288
|
+
bool
|
|
289
|
+
``True`` if the specified name matches one of the recognized
|
|
290
|
+
names of this space group or if it equals its `number`.
|
|
291
|
+
Return ``False`` otherwise.
|
|
292
|
+
"""
|
|
293
|
+
|
|
294
|
+
if name == self.short_name:
|
|
295
|
+
return True
|
|
296
|
+
if name == self.pdb_name:
|
|
297
|
+
return True
|
|
298
|
+
if name == self.point_group_name:
|
|
299
|
+
return True
|
|
300
|
+
if name == self.number:
|
|
301
|
+
return True
|
|
302
|
+
return False
|
|
303
|
+
|
|
304
|
+
def iter_equivalent_positions(self, vec):
|
|
305
|
+
"""Generate symmetry equivalent positions for the specified position.
|
|
306
|
+
|
|
307
|
+
The initial position must be in fractional coordinates and so
|
|
308
|
+
are the symmetry equivalent positions yielded by iteration.
|
|
309
|
+
This generates `num_sym_equiv` positions regardless of initial
|
|
310
|
+
coordinates being a special symmetry position or not.
|
|
311
|
+
|
|
312
|
+
Parameters
|
|
313
|
+
----------
|
|
314
|
+
vec : numpy.ndarray
|
|
315
|
+
The initial position in fractional coordinates.
|
|
316
|
+
|
|
317
|
+
Yields
|
|
318
|
+
------
|
|
319
|
+
numpy.ndarray
|
|
320
|
+
The symmetry equivalent positions in fractional coordinates.
|
|
321
|
+
The positions may be duplicate or outside of the ``0 <= x < 1``
|
|
322
|
+
unit cell bounds.
|
|
323
|
+
"""
|
|
324
|
+
for symop in self.symop_list:
|
|
325
|
+
yield symop(vec)
|
|
326
|
+
pass
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
# End of class SpaceGroup
|