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,44 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
##############################################################################
|
|
3
|
+
#
|
|
4
|
+
# diffpy.structure by DANSE Diffraction group
|
|
5
|
+
# Simon J. L. Billinge
|
|
6
|
+
# (c) 2008 trustees of the Michigan State University.
|
|
7
|
+
# All rights reserved.
|
|
8
|
+
#
|
|
9
|
+
# File coded by: Chris Farrow
|
|
10
|
+
#
|
|
11
|
+
# See AUTHORS.txt for a list of people who contributed.
|
|
12
|
+
# See LICENSE_DANSE.txt for license information.
|
|
13
|
+
#
|
|
14
|
+
##############################################################################
|
|
15
|
+
|
|
16
|
+
"""Utilities for making shapes."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def findCenter(S):
|
|
20
|
+
"""Find the approximate center `Atom` of a `Structure`.
|
|
21
|
+
|
|
22
|
+
The center of the `Structure` is the `Atom` closest to ``(0.5, 0.5, 0.5)``.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
S : Structure
|
|
27
|
+
A `Structure` instance.
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
-------
|
|
31
|
+
int
|
|
32
|
+
The index of the center `Atom`.
|
|
33
|
+
"""
|
|
34
|
+
best = -1
|
|
35
|
+
bestd = len(S)
|
|
36
|
+
center = [0.5, 0.5, 0.5] # the cannonical center
|
|
37
|
+
|
|
38
|
+
for i in range(len(S)):
|
|
39
|
+
d = S.lattice.dist(S[i].xyz, center)
|
|
40
|
+
if d < bestd:
|
|
41
|
+
bestd = d
|
|
42
|
+
best = i
|
|
43
|
+
|
|
44
|
+
return best
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
##############################################################################
|
|
3
|
+
#
|
|
4
|
+
# diffpy.structure by DANSE Diffraction group
|
|
5
|
+
# Simon J. L. Billinge
|
|
6
|
+
# (c) 2008 trustees of the Michigan State University.
|
|
7
|
+
# All rights reserved.
|
|
8
|
+
#
|
|
9
|
+
# File coded by: Chris Farrow, Pavol Juhas
|
|
10
|
+
#
|
|
11
|
+
# See AUTHORS.txt for a list of people who contributed.
|
|
12
|
+
# See LICENSE_DANSE.txt for license information.
|
|
13
|
+
#
|
|
14
|
+
##############################################################################
|
|
15
|
+
|
|
16
|
+
"""This module contains functions for simple `Structure` manipulation.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import numpy
|
|
20
|
+
|
|
21
|
+
from diffpy.structure import Atom, Structure
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def supercell(S, mno):
|
|
25
|
+
"""
|
|
26
|
+
Perform supercell expansion for a `Structure`.
|
|
27
|
+
|
|
28
|
+
New `lattice` parameters are multiplied and fractional coordinates
|
|
29
|
+
divided by corresponding multiplier. New `Atoms` are grouped with
|
|
30
|
+
their source in the original cell.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
S : Structure
|
|
35
|
+
An instance of `Structure` from `diffpy.structure`.
|
|
36
|
+
mno : array_like
|
|
37
|
+
Sequence of 3 integers for cell multipliers along
|
|
38
|
+
the `a`, `b` and `c` axes.
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
Structure
|
|
43
|
+
A new `Structure` instance representing the expanded supercell.
|
|
44
|
+
|
|
45
|
+
Raises
|
|
46
|
+
------
|
|
47
|
+
TypeError
|
|
48
|
+
`S` is not a `Structure` instance.
|
|
49
|
+
ValueError
|
|
50
|
+
Invalid `mno` argument.
|
|
51
|
+
"""
|
|
52
|
+
# check arguments
|
|
53
|
+
if len(mno) != 3:
|
|
54
|
+
emsg = "Argument mno must contain 3 numbers."
|
|
55
|
+
raise ValueError(emsg)
|
|
56
|
+
elif min(mno) < 1:
|
|
57
|
+
emsg = "Multipliers must be greater or equal 1"
|
|
58
|
+
raise ValueError(emsg)
|
|
59
|
+
if not isinstance(S, Structure):
|
|
60
|
+
emsg = "The first argument must be a Structure instance."
|
|
61
|
+
raise TypeError(emsg)
|
|
62
|
+
|
|
63
|
+
# convert mno to a tuple of integers so it can be used as range limit.
|
|
64
|
+
mno = (int(mno[0]), int(mno[1]), int(mno[2]))
|
|
65
|
+
|
|
66
|
+
# create return instance
|
|
67
|
+
newS = Structure(S)
|
|
68
|
+
if mno == (1, 1, 1):
|
|
69
|
+
return newS
|
|
70
|
+
|
|
71
|
+
# back to business
|
|
72
|
+
ijklist = [(i, j, k) for i in range(mno[0]) for j in range(mno[1]) for k in range(mno[2])]
|
|
73
|
+
# numpy.floor returns float array
|
|
74
|
+
mnofloats = numpy.array(mno, dtype=float)
|
|
75
|
+
|
|
76
|
+
# build a list of new atoms
|
|
77
|
+
newAtoms = []
|
|
78
|
+
for a in S:
|
|
79
|
+
for ijk in ijklist:
|
|
80
|
+
adup = Atom(a)
|
|
81
|
+
adup.xyz = (a.xyz + ijk) / mnofloats
|
|
82
|
+
newAtoms.append(adup)
|
|
83
|
+
# newS can own references in newAtoms, no need to make copies
|
|
84
|
+
newS.__setitem__(slice(None), newAtoms, copy=False)
|
|
85
|
+
|
|
86
|
+
# take care of lattice parameters
|
|
87
|
+
newS.lattice.setLatPar(a=mno[0] * S.lattice.a, b=mno[1] * S.lattice.b, c=mno[2] * S.lattice.c)
|
|
88
|
+
return newS
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# End of supercell
|