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 __authors__ = [ "Marie-Francoise Incardona", "Olof Svensson" ]
29 __contact__ = "svensson@esrf.fr"
30 __license__ = "LGPLv3+"
31 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
35 """
36 This utility class contains methods useful for handling symmetries.
37 """
38
39 @staticmethod
41 """
42 This static method returns a string containing the name of the space
43 group with minimum symmetry that corresponds to a given two-letter Bravais
44 Lattice.
45
46 Note that the "hR" Bravais Lattice is translated into the "H3" and not the
47 "R3" space group since the "H3" space group is the one used in MX in general
48 and in particular for structures deposited in the PDB.
49
50 If the Bravais Lattice is not recognised a "None" object is returned.
51 """
52 strSpaceGroup = None
53 strBravaisLattice = _strBravaisLattice
54 if strBravaisLattice == "aP":
55 strSpaceGroup = "P1"
56
57 elif strBravaisLattice == "mP":
58 strSpaceGroup = "P2"
59
60 elif strBravaisLattice == "mC" or \
61 strBravaisLattice == "mI":
62 strSpaceGroup = "C2"
63
64 elif strBravaisLattice == "oP":
65 strSpaceGroup = "P222"
66
67 elif strBravaisLattice == "oA" or \
68 strBravaisLattice == "oB" or \
69 strBravaisLattice == "oC" or \
70 strBravaisLattice == "oS":
71 strSpaceGroup = "C222"
72
73 elif strBravaisLattice == "oF":
74 strSpaceGroup = "F222"
75
76 elif strBravaisLattice == "oI":
77 strSpaceGroup = "I222"
78
79 elif strBravaisLattice == "tP" or \
80 strBravaisLattice == "tC":
81 strSpaceGroup = "P4"
82
83 elif strBravaisLattice == "tI" or \
84 strBravaisLattice == "tF":
85 strSpaceGroup = "I4"
86
87 elif strBravaisLattice == "hP":
88 strSpaceGroup = "P3"
89
90 elif strBravaisLattice == "hR":
91 strSpaceGroup = "H3"
92
93 elif strBravaisLattice == "cP":
94 strSpaceGroup = "P23"
95
96 elif strBravaisLattice == "cF":
97 strSpaceGroup = "F23"
98
99 elif strBravaisLattice == "cI":
100 strSpaceGroup = "I23"
101
102 return strSpaceGroup
103
104
105
106 @staticmethod
111
112
113 @staticmethod
118
119
120
121 @staticmethod
123 """
124 """
125 strNumOperators = None
126 symmetryTableFile = open(_strSymmetryTableFileName)
127 for strLine in symmetryTableFile.xreadlines():
128 listItems = strLine.split(" ")
129 if (len(listItems) > 3 and listItems[_iIndex] == _strSpaceGroupIdOrName):
130 strNumOperators = listItems[1]
131 return strNumOperators
132
133 @staticmethod
135 """
136 """
137 iITNumber = None
138 symmetryTableFile = open(_strSymmetryTableFileName)
139 for strLine in symmetryTableFile.xreadlines():
140 listItems = strLine.split(" ")
141 if len(listItems) > 3:
142 if _strSpaceGroupName == listItems[3]:
143 iITNumber = int(listItems[0])
144 return iITNumber
145