Coverage for /builds/kinetik161/ase/ase/lattice/compounds.py: 100.00%

31 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-12-10 11:04 +0000

1"""Function-like objects creating lattices with more than one element. 

2 

3These lattice creators are mainly intended as examples for how to build you 

4own. The following crystal structures are defined: 

5 

6 B1 = NaCl = Rocksalt 

7 B2 = CsCl 

8 B3 = ZnS = Zincblende 

9 L1_2 = AuCu3 

10 L1_0 = AuCu 

11 TRI_Fe2O3 

12 HEX_Fe2O3 

13 

14""" 

15from ase.lattice.cubic import DiamondFactory, SimpleCubicFactory 

16from ase.lattice.hexagonal import HexagonalFactory 

17from ase.lattice.tetragonal import SimpleTetragonalFactory 

18from ase.lattice.triclinic import TriclinicFactory 

19 

20 

21# To prevent a layer of element one on one side, and a layer of 

22# element two on the other side, NaCl is based on SimpleCubic instead 

23# of on FaceCenteredCubic 

24class NaClFactory(SimpleCubicFactory): 

25 "A factory for creating NaCl (B1, Rocksalt) lattices." 

26 

27 bravais_basis = [[0, 0, 0], [0, 0, 0.5], [0, 0.5, 0], [0, 0.5, 0.5], 

28 [0.5, 0, 0], [0.5, 0, 0.5], [0.5, 0.5, 0], 

29 [0.5, 0.5, 0.5]] 

30 element_basis = (0, 1, 1, 0, 1, 0, 0, 1) 

31 

32 

33B1 = NaCl = Rocksalt = NaClFactory() 

34 

35 

36class CsClFactory(SimpleCubicFactory): 

37 "A factory for creating CsCl (B2) lattices." 

38 bravais_basis = [[0, 0, 0], [0.5, 0.5, 0.5]] 

39 element_basis = (0, 1) 

40 

41 

42B2 = CsCl = CsClFactory() 

43 

44 

45# The zincblende structure is easily derived from Diamond, which 

46# already has the right basis. 

47class ZnSFactory(DiamondFactory): 

48 "A factory for creating ZnS (B3, Zincblende) lattices." 

49 element_basis = (0, 1) 

50 

51 

52B3 = ZnS = Zincblende = ZnSFactory() 

53 

54 

55# The L1_0 structure is "based on FCC", but is a tetragonal distortion 

56# of fcc. It must therefore be derived from the base-centered 

57# tetragonal structure. That structure, however, does not exist, 

58# since it is equivalent to a simple tetragonal structure rotated 45 

59# degrees along the z-axis. Basing L1_2 on that would however give 

60# unexpected miller indices. L1_2 will therefore be based on a simple 

61# tetragonal structure, but with a basis corresponding to a 

62# base-centered tetragonal. 

63class AuCuFactory(SimpleTetragonalFactory): 

64 "A factory for creating AuCu (L1_0) lattices (tetragonal symmetry)." 

65 bravais_basis = [[0, 0, 0], [0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]] 

66 element_basis = (0, 1, 1, 0) 

67 

68 

69AuCu = L1_0 = AuCuFactory() 

70 

71 

72# The L1_2 structure is "based on FCC", but is really simple cubic 

73# with a basis. 

74class AuCu3Factory(SimpleCubicFactory): 

75 "A factory for creating AuCu3 (L1_2) lattices." 

76 bravais_basis = [[0, 0, 0], [0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]] 

77 element_basis = (0, 1, 1, 1) 

78 

79 

80AuCu3 = L1_2 = AuCu3Factory() 

81 

82 

83class TriclinicFe2O3Factory(TriclinicFactory): 

84 """A factory for creating hematite (Fe2O3) lattices. 

85 

86 Rhombohedral unit cell. 

87 Pauling L, Hendricks S B 

88 Journal of the American Chemical Society 47 (1925) 781-790 

89 

90 Example:: 

91 

92 #!/usr/bin/env python3 

93 

94 from ase.lattice.hexagonal import * 

95 from ase.lattice.compounds import * 

96 import ase.io as io 

97 from ase import Atoms, Atom 

98 

99 index1=3 

100 index2=3 

101 index3=3 

102 mya = 5.42 

103 myb = 5.42 

104 myc = 5.42 

105 myalpha = 55.28 

106 mybeta = 55.28 

107 mygamma = 55.28 

108 gra = TRI_Fe2O3(symbol = ('Fe', 'O'), 

109 latticeconstant={'a':mya,'b':myb, 'c':myc, 

110 'alpha':myalpha, 

111 'beta':mybeta, 

112 'gamma':mygamma}, 

113 size=(index1,index2,index3)) 

114 io.write('rhombohedralUC_Fe2O3.xyz', gra, format='xyz') 

115 

116 """ 

117 

118 bravais_basis = [[0.10534, 0.10534, 0.10534], [0.39466, 0.39466, 0.39466], 

119 [0.60534, 0.60534, 0.60534], [0.89466, 0.89466, 0.89466], 

120 [0.30569, 0.69431, 0.00000], [0.69431, 0.00000, 0.30569], 

121 [0.00000, 0.30569, 0.69431], [0.19431, 0.80569, 0.50000], 

122 [0.80569, 0.50000, 0.19431], [0.50000, 0.19431, 0.80569]] 

123 element_basis = (0, 0, 0, 0, 1, 1, 1, 1, 1, 1) 

124 

125 

126TRI_Fe2O3 = TriclinicFe2O3Factory() 

127 

128 

129class HexagonalFe2O3Factory(HexagonalFactory): 

130 """A factory for creating hematite (Fe2O3) lattices. 

131 With hexagonal unit cell. 

132 Blake R L, Hessevick R E, Zoltai T, Finger L W 

133 American Mineralogist 51 (1966) 123-129 

134 5.038 5.038 13.772 90 90 120 R-3c 

135 Fe 0 0 .3553 .0080 .0080 .00029 .0040 0 0 

136 O .3059 0 1/4 .0068 .0083 .00046 .0042 .00058 .0012 

137 

138 Example: 

139 #!/usr/bin/env python3 

140 from ase.lattice.hexagonal import * 

141 from ase.lattice.compounds import * 

142 import ase.io as io 

143 from ase import Atoms, Atom 

144 

145 index1=1 

146 index2=1 

147 index3=1 

148 mya = 5.038 

149 myb = 5.038 

150 myc = 13.772 

151 myalpha = 90 

152 mybeta = 90 

153 mygamma = 120 

154 gra = HEX_Fe2O3(symbol = ('Fe', 'O'), 

155 latticeconstant={'a':mya,'b':myb, 'c':myc, 

156 'alpha':myalpha, 

157 'beta':mybeta, 

158 'gamma':mygamma}, 

159 size=(index1,index2,index3)) 

160 io.write('hexaFe2O3.xyz', gra, format='xyz') 

161 

162 """ 

163 

164 bravais_basis = [[0.000000, 0.000000, 0.355300], 

165 [0.000000, 0.000000, 0.144700], 

166 [0.000000, 0.000000, 0.644700], 

167 [0.000000, 0.000000, 0.855300], 

168 [0.666667, 0.333333, 0.688633], 

169 [0.666667, 0.333333, 0.478033], 

170 [0.666667, 0.333333, 0.978033], 

171 [0.666667, 0.333333, 0.188633], 

172 [0.333333, 0.666667, 0.021967], 

173 [0.333333, 0.666667, 0.811367], 

174 [0.333333, 0.666667, 0.311367], 

175 [0.333333, 0.666667, 0.521967], 

176 # Fe to O here 

177 [0.305900, 0.000000, 0.250000], 

178 [0.000000, 0.305900, 0.250000], 

179 [0.694100, 0.694100, 0.250000], 

180 [0.694100, 0.000000, 0.750000], 

181 [0.000000, 0.694100, 0.750000], 

182 [0.305900, 0.305900, 0.750000], 

183 [0.972567, 0.333333, 0.583333], 

184 [0.666667, 0.639233, 0.583333], 

185 [0.360767, 0.027433, 0.583333], 

186 [0.360767, 0.333333, 0.083333], 

187 [0.666667, 0.027433, 0.083333], 

188 [0.972567, 0.639233, 0.083333], 

189 [0.639233, 0.666667, 0.916667], 

190 [0.333333, 0.972567, 0.916667], 

191 [0.027433, 0.360767, 0.916667], 

192 [0.027433, 0.666667, 0.416667], 

193 [0.333333, 0.360767, 0.416667], 

194 [0.639233, 0.972567, 0.416667]] 

195 element_basis = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 

196 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 

197 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) 

198 

199 

200HEX_Fe2O3 = HexagonalFe2O3Factory()