-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPénélope.py
356 lines (342 loc) · 15.7 KB
/
Pénélope.py
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
import numpy as np
import matplotlib.pyplot as plt
# Predefined data for a few elements
ELEMENT_DATA = {
1: {
'name': 'Hydrogen',
'ground_state': '1s1',
'excited_states': ['2s1', '2p1'],
'quantum_states': [(1, 0, 0, 1/2), (2, 0, 0, 1/2), (2, 1, -1, 1/2), (2, 1, 0, 1/2), (2, 1, 1, 1/2)]
},
2: {
'name': 'Helium',
'ground_state': '1s2',
'excited_states': ['2s2', '2p2'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
3: {
'name': 'Lithium',
'ground_state': '1s2 2s1',
'excited_states': ['2s2', '2p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
4: {
'name': 'Beryllium',
'ground_state': '1s2 2s2',
'excited_states': ['2s2 2p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
5: {
'name': 'Boron',
'ground_state': '1s2 2s2 2p1',
'excited_states': ['2s2 2p2'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
6: {
'name': 'Carbon',
'ground_state': '1s2 2s2 2p2',
'excited_states': ['2s2 2p3'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
7: {
'name': 'Nitrogen',
'ground_state': '1s2 2s2 2p3',
'excited_states': ['2s2 2p4'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
8: {
'name': 'Oxygen',
'ground_state': '1s2 2s2 2p4',
'excited_states': ['2s2 2p5'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
9: {
'name': 'Fluorine',
'ground_state': '1s2 2s2 2p5',
'excited_states': ['2s2 2p6'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
10: {
'name': 'Neon',
'ground_state': '1s2 2s2 2p6',
'excited_states': ['3s2 3p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2)]
},
11: {
'name': 'Sodium',
'ground_state': '1s2 2s2 2p6 3s1',
'excited_states': ['3p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2)]
},
12: {
'name': 'Magnesium',
'ground_state': '1s2 2s2 2p6 3s2',
'excited_states': ['3p2'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2)]
},
13: {
'name': 'Aluminum',
'ground_state': '1s2 2s2 2p6 3s2 3p1',
'excited_states': ['3p2', '3d1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2)]
},
14: {
'name': 'Silicon',
'ground_state': '1s2 2s2 2p6 3s2 3p2',
'excited_states': ['3p3', '3d2'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2)]
},
15: {
'name': 'Phosphorus',
'ground_state': '1s2 2s2 2p6 3s2 3p3',
'excited_states': ['3p4', '3d3'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2)]
},
16: {
'name': 'Sulfur',
'ground_state': '1s2 2s2 2p6 3s2 3p4',
'excited_states': ['3p5', '3d4'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2)]
},
17: {
'name': 'Chlorine',
'ground_state': '1s2 2s2 2p6 3s2 3p5',
'excited_states': ['3p6', '3d5'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2)]
},
18: {
'name': 'Argon',
'ground_state': '1s2 2s2 2p6 3s2 3p6',
'excited_states': ['4s1', '4p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2)]
},
19: {
'name': 'Potassium',
'ground_state': '1s2 2s2 2p6 3s2 3p6 4s1',
'excited_states': ['4p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2)]
},
20: {
'name': 'Calcium',
'ground_state': '1s2 2s2 2p6 3s2 3p6 4s2',
'excited_states': ['4p2'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2)]
},
21: {
'name': 'Scandium',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d1 4s2',
'excited_states': ['4p1', '3d2'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)]
},
22: {
'name': 'Titanium',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d2 4s2',
'excited_states': ['4p1', '3d3'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)]
},
23: {
'name': 'Vanadium',
'symbol': 'V',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d3 4s2',
'excited_states': ['4p1', '3d4'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 50.9415, 'density': 6.0}
},
24: {
'name': 'Chromium',
'symbol': 'Cr',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d5 4s1',
'excited_states': ['4p1', '3d6'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 51.9961, 'density': 7.19}
},
25: {
'name': 'Manganese',
'symbol': 'Mn',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d5 4s2',
'excited_states': ['4p1', '3d6'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 54.938044, 'density': 7.21}
},
26: {
'name': 'Iron',
'symbol': 'Fe',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d6 4s2',
'excited_states': ['4p1', '3d7'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 55.845, 'density': 7.87}
},
27: {
'name': 'Cobalt',
'symbol': 'Co',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d7 4s2',
'excited_states': ['4p1', '3d8'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 58.933194, 'density': 8.9}
},
28: {
'name': 'Nickel',
'symbol': 'Ni',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d8 4s2',
'excited_states': ['4p1', '3d9'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 58.6934, 'density': 8.9}
},
29: {
'name': 'Copper',
'symbol': 'Cu',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s1',
'excited_states': ['4p1', '3d11'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 63.546, 'density': 8.96}
},
30: {
'name': 'Zinc',
'symbol': 'Zn',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2',
'excited_states': ['4p1', '3d11'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 65.38, 'density': 7.14}
},
31: {
'name': 'Gallium',
'symbol': 'Ga',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p1',
'excited_states': ['4p2', '3d11'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 69.723, 'density': 5.91}
},
32: {
'name': 'Germanium',
'symbol': 'Ge',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p2',
'excited_states': ['4p3', '3d11'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 72.63, 'density': 5.323}
},
33: {
'name': 'Arsenic',
'symbol': 'As',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p3',
'excited_states': ['4p4', '3d11'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 74.921595, 'density': 5.776}
},
34: {
'name': 'Selenium',
'symbol': 'Se',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p4',
'excited_states': ['4p5', '3d11'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 78.96, 'density': 4.809}
},
35: {
'name': 'Bromine',
'symbol': 'Br',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p5',
'excited_states': ['4p6', '3d11'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (3, 2, -2, -1/2), (3, 2, -2, 1/2)],
'properties': {'atomic_mass': 79.904, 'density': 3.122}
},
36: {
'name': 'Krypton',
'symbol': 'Kr',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p6',
'excited_states': ['5s1', '5p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2)],
'properties': {'atomic_mass': 83.798, 'density': 3.749}
},
37: {
'name': 'Rubidium',
'symbol': 'Rb',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p6 5s1',
'excited_states': ['5p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (5, 0, 0, -1/2), (5, 0, 0, 1/2)],
'properties': {'atomic_mass': 85.4678, 'density': 1.532}
},
38: {
'name': 'Strontium',
'symbol': 'Sr',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p6 5s2',
'excited_states': ['5p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (5, 0, 0, -1/2), (5, 0, 0, 1/2)],
'properties': {'atomic_mass': 87.62, 'density': 2.64}
},
39: {
'name': 'Yttrium',
'symbol': 'Y',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p6 4d1 5s2',
'excited_states': ['5p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (5, 0, 0, -1/2), (5, 0, 0, 1/2)],
'properties': {'atomic_mass': 88.90584, 'density': 4.47}
},
40: {
'name': 'Zirconium',
'symbol': 'Zr',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p6 4d2 5s2',
'excited_states': ['5p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (5, 0, 0, -1/2), (5, 0, 0, 1/2)],
'properties': {'atomic_mass': 91.224, 'density': 6.52}
},
41: {
'name': 'Niobium',
'symbol': 'Nb',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p6 4d4 5s1',
'excited_states': ['5p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (5, 0, 0, -1/2), (5, 0, 0, 1/2)],
'properties': {'atomic_mass': 92.90637, 'density': 8.57}
},
42: {
'name': 'Molybdenum',
'symbol': 'Mo',
'ground_state': '1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p6 4d5 5s1',
'excited_states': ['5p1'],
'quantum_states': [(1, 0, 0, -1/2), (1, 0, 0, 1/2), (2, 0, 0, -1/2), (2, 0, 0, 1/2), (3, 0, 0, -1/2), (3, 0, 0, 1/2), (4, 0, 0, -1/2), (4, 0, 0, 1/2), (5, 0, 0, -1/2), (5, 0, 0, 1/2)],
'properties': {'atomic_mass': 95.95, 'density': 10.22}
},
# Continue adding elements with detailed data...
}
def get_element_data(atomic_number):
return ELEMENT_DATA.get(atomic_number, None)
def calculate_quantum_states(atomic_number):
element_data = get_element_data(atomic_number)
if element_data:
return element_data['quantum_states']
return []
def visualize_states(element_data):
fig, ax = plt.subplots()
ground_state = element_data['ground_state']
excited_states = element_data['excited_states']
quantum_states = element_data['quantum_states']
y_vals = [0] * len(quantum_states)
x_vals = range(len(quantum_states))
labels = [f'n={n}, l={l}, m={m}, s={s}' for (n, l, m, s) in quantum_states]
ax.scatter(x_vals, y_vals, label='Quantum States')
for i, label in enumerate(labels):
ax.annotate(label, (x_vals[i], y_vals[i]), textcoords="offset points", xytext=(0,10), ha='center')
ax.set_title(f"{element_data['name']} Quantum States")
ax.set_xlabel("State Index")
ax.set_ylabel("Energy Level (Arbitrary Units)")
plt.xticks(x_vals, labels, rotation='vertical')
plt.legend()
plt.tight_layout()
plt.show()
def main():
try:
atomic_number = int(input("Enter the atomic number of the element: "))
element_data = get_element_data(atomic_number)
if not element_data:
print("Element data not found. Please try another atomic number.")
return
print(f"Element: {element_data['name']}")
print(f"Ground State: {element_data['ground_state']}")
print(f"Excited States: {', '.join(element_data['excited_states'])}")
quantum_states = calculate_quantum_states(atomic_number)
if quantum_states:
visualize_states(element_data)
else:
print("No quantum states available for visualization.")
except ValueError:
print("Invalid input. Please enter a valid atomic number.")
if __name__ == "__main__":
main()