-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy path__init__.py
More file actions
91 lines (74 loc) · 2.56 KB
/
__init__.py
File metadata and controls
91 lines (74 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python
##############################################################################
#
# (c) 2024-2025 The Trustees of Columbia University in the City of New York.
# All rights reserved.
#
# File coded by: Chris Farrow, Pavol Juhas, Simon Billinge, Billinge Group members.
#
# See GitHub contributions for a more detailed list of contributors.
# https://github.com/diffpy/diffpy.structure/graphs/contributors
#
# See LICENSE.rst for license information.
#
##############################################################################
"""Crystal structure container and parsers for structure formats.
Classes related to the structure of materials:
* Atom
* Lattice
* Structure
* PDFFitStructure
Other classes:
* SpaceGroup
* SymOp
* ExpandAsymmetricUnit
* GeneratorSite
* SymmetryConstraints
Exceptions:
* StructureFormatError
* LatticeError
* SymmetryError
"""
# Interface definitions ------------------------------------------------------
from diffpy.structure.atom import Atom
from diffpy.structure.lattice import Lattice
from diffpy.structure.parsers import getParser
from diffpy.structure.pdffitstructure import PDFFitStructure
from diffpy.structure.structure import Structure
from diffpy.structure.structureerrors import LatticeError, StructureFormatError, SymmetryError
# package version
from diffpy.structure.version import __version__
# top level routines
def loadStructure(filename, fmt="auto", **kw):
"""Load new structure object from the specified file.
Parameters
----------
filename : str
Path to the file to be loaded.
fmt : str, Optional
Format of the structure file such as 'cif' or 'xyz'. Must be
one of the formats listed by the `parsers.inputFormats` function.
When 'auto', all supported formats are tried in a sequence.
kw : Optional
Extra keyword arguments that are passed to `parsers.getParser`
function. These configure the dedicated Parser object that
is used to read content in filename.
Returns
-------
stru : `Structure`, `PDFFitStructure`
The new Structure object loaded from the specified file.
Return a more specific PDFFitStructure type for 'pdffit'
and 'discus' formats.
"""
p = getParser(fmt, **kw)
rv = p.parseFile(filename)
return rv
# silence pyflakes checker
assert StructureFormatError and LatticeError and SymmetryError
assert Atom
assert Lattice
assert Structure
assert PDFFitStructure
# silence the pyflakes syntax checker
assert __version__ or True
# End of file