Skip to content

Commit a320856

Browse files
committed
API: remove functions that need diffpy.structure.
Drop `crystalToDiffpyStructure` and `expandSymmetry` as they are very old and hardly ever used. Avoid dependency on diffpy.structure.
1 parent 4e914c2 commit a320856

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

src/pyobjcryst/utils.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,6 @@
1515

1616
"""Utilities for crystals."""
1717

18-
def crystalToDiffpyStructure(crystal):
19-
"""Create a diffpy.Structure.Structure from a crystal.
20-
21-
This requires diffpy.Structure to be installed. This uses file IO transfer
22-
data, so there is some inherent precision loss.
23-
24-
Note that the resulting structure will be in P1 symmetry.
25-
26-
"""
27-
28-
# Write the crystal to string and load it into a diffpy Structure
29-
30-
from io import StringIO
31-
buf = StringIO()
32-
crystal.CIFOutput(buf)
33-
34-
from diffpy.Structure import Structure
35-
stru = Structure()
36-
37-
s = buf.getvalue()
38-
stru.readStr(s)
39-
buf.close()
40-
41-
return stru
42-
43-
def expandSymmetry(crystal):
44-
"""Expand a crystal to P1 symmetry.
45-
46-
This requires diffpy.Structure to be installed. This uses file IO transfer
47-
data, so there is some inherent precision loss.
48-
49-
This returns a new structure.
50-
51-
"""
52-
53-
# Create a string from a diffpy Structure, which is in P1 symmetry, and
54-
# load this as a Crystal.
55-
stru = crystalToDiffpyStructure(crystal)
56-
57-
cifstr = stru.writeStr(format = "cif")
58-
from io import StringIO
59-
buf = StringIO(cifstr)
60-
61-
from pyobjcryst.crystal import CreateCrystalFromCIF
62-
p1 = CreateCrystalFromCIF(buf)
63-
return p1
64-
6518

6619
def putAtomsInMolecule(crystal, alist = None, name = None):
6720
"""Place atoms from a crystal into a molecule inside the crystal.

0 commit comments

Comments
 (0)