-
Notifications
You must be signed in to change notification settings - Fork 7
/
materials.py
802 lines (659 loc) · 27.3 KB
/
materials.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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
################################################################################
# Copyright Adam J. Jackson (2015) #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
################################################################################
import numpy as np
from scipy import constants
from interpolate_thermal_property import get_potential_aims, get_potential_nist_table, get_potential_sulfur_table
import re
import os # get correct path for datafiles when called from another directory
materials_directory = os.path.dirname(__file__)
# Append a trailing slash to make coherent directory name - this would select the
# root directory in the case of no prefix, so we need to check
if materials_directory:
materials_directory = materials_directory + '/'
eV2Jmol = constants.physical_constants['electron volt-joule relationship'][0] * constants.N_A
class material(object):
"""Parent class for materials properties. See docstrings for derived classes solid, ideal_gas"""
def __init__(self,name,stoichiometry,pbesol_energy_eV=False, N=1):
self.name = name
self.stoichiometry = stoichiometry
self.pbesol_energy_eV = pbesol_energy_eV
self.N = N
class solid(material):
"""
Class for solid material data.
Sets properties:
-------------------
solid.name (Identifying string)
solid.stoichiometry (Dict relating element to number of atoms in a single formula unit)
solid.pbesol_energy_eV (DFT total energy in eV with PBEsol XC functional)
solid.fu_cell (Number of formula units in periodic unit cell)
solid.volume (Volume of unit cell in cubic angstroms (m3 * 10^30))
solid.phonons (String containing path to phonopy-FHI-aims output data file)
solid.N (Number of atoms per formula unit)
Sets methods:
-------------------
solid.U_eV(T), solid.U_J(T), solid.U_kJ(T) : Internal energy
solid.H_eV(T,P), solid.H_J(T,P), solid.H_kJ(T,P) : Enthalpy H = U + PV
solid.mu_eV(T,P), solid.mu_J(T,P), solid.mu_kJ(T,P) : Chemical potential mu = U + PV - TS
The material is assumed to be incompressible and without thermal expansion
"""
def __init__(self, name, stoichiometry, pbesol_energy_eV, fu_cell, volume, phonons=False, N=1):
material.__init__(self,name,stoichiometry,pbesol_energy_eV,N)
self.fu_cell = fu_cell
self.volume = volume
self.phonons = materials_directory + phonons
def U_eV(self,T,*P):
"""Internal energy of one formula unit of solid, expressed in eV.
U = solid.U_eV(T)
Returns a matrix with the same dimensions as T
"""
U_func = get_potential_aims(self.phonons,'U')
return (self.pbesol_energy_eV + U_func(T))/self.fu_cell
def U_J(self,T):
"""Internal energy of one gram-mole of solid, expressed in J/mol
U = solid.U_J(T)
Returns a matrix with the same dimensions as T
"""
return self.U_eV(T) * constants.physical_constants['electron volt-joule relationship'][0] * constants.N_A
def U_kJ(self,T):
"""Internal energy of one gram-mole of solid, expressed in kJ/mol
U = solid.U_kJ(T)
Returns a matrix with the same dimensions as T
"""
return self.U_J(T)/1000.
def H_eV(self,T,P):
"""
Enthalpy of one formula unit of solid, expressed in eV
H = solid.H_eV(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
U_func = get_potential_aims(self.phonons,'U')
PV = P * self.volume * 1E-30 * constants.physical_constants['joule-electron volt relationship'][0] / constants.N_A
return ((self.pbesol_energy_eV + U_func(T)) + PV)/self.fu_cell
def H_J(self,T,P):
"""Enthalpy of one gram-mole of solid, expressed in J/mol
H = solid.H_J(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
return self.H_eV(T,P) * constants.physical_constants['electron volt-joule relationship'][0] * constants.N_A
def H_kJ(self,T,P):
"""Enthalpy of one gram-mole of solid, expressed in kJ/mol
H = solid.H_kJ(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
return self.H_J(T,P) * 0.001
def mu_eV(self,T,P):
"""
Free energy of one formula unit of solid, expressed in eV
mu = solid.mu_eV(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
TS_func = get_potential_aims(self.phonons,'TS')
H = self.H_eV(T,P)
return H - TS_func(T)/self.fu_cell
def mu_J(self,T,P):
"""
Free energy of one mol of solid, expressed in J/mol
mu = solid.mu_J(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
return self.mu_eV(T,P) * constants.physical_constants['electron volt-joule relationship'][0] * constants.N_A
def mu_kJ(self,T,P):
"""
Free energy of one mol of solid, expressed in kJ/mol
mu = solid.mu_kJ(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
return self.mu_J(T,P) * 0.001
def Cv_kB(self,T):
"""
Constant-volume heat capacity of one formula unit of solid, expressed in units
of the Boltzmann constant kB:
Cv = solid.Cv_kB(T)
T may be an array, in which case Cv will be an array of the same dimensions.
"""
Cv_func = get_potential_aims(self.phonons,'Cv')
return Cv_func(T)/self.fu_cell
def Cv_eV(self,T):
"""
Constant-volume heat capacity of one formula unit of solid, expressed in units
of the Boltzmann constant kB:
Cv = solid.Cv_eV(T)
T may be an array, in which case Cv will be an array of the same dimensions.
"""
return self.Cv_kB(T) * constants.physical_constants['Boltzmann constant in eV/K'][0]
def Cv_J(self,T):
"""
Constant-volume heat capacity of solid, expressed in J/molK.
Cv = solid.Cv_J(T)
T may be an array, in which case Cv will be an array of the same dimensions.
"""
return (self.Cv_kB(T) * constants.physical_constants['Boltzmann constant'][0] * constants.N_A)
def Cv_kJ(self,T):
"""
Constant-volume heat capacity of solid, expressed in kJ/molK.
Cv = solid.Cv_kJ(T)
T may be an array, in which case Cv will be an array of the same dimensions.
"""
return self.Cv_J(T) * 0.001
class ideal_gas(material):
"""
Class for ideal gas properties.
Sets properties:
-------------------
ideal_gas.name (string)
ideal_gas.stoichiometry (Dict relating element to number of atoms in a single formula unit)
ideal_gas.pbesol_energy_eV (DFT total energy in eV with PBEsol XC functional)
ideal_gas.thermo_data (String containing path to aims.vibrations output data file)
ideal_gas.N (Number of atoms per formula unit)
Sets methods:
-------------------
ideal_gas.U_eV(T), ideal_gas.U_J(T), ideal_gas.U_kJ(T) : Internal energy
ideal_gas.H_eV(T), ideal_gas.H_J(T), ideal_gas.H_kJ(T) : Enthalpy H = U + PV
ideal_gas.mu_eV(T,P), ideal_gas.mu_J(T,P), ideal_gas.mu_kJ(T,P) : Chemical potential mu = U + PV - TS
Ideal gas law PV=nRT is applied: specifically (dH/dP) at const. T = 0 and int(mu)^P2_P1 dP = kTln(P2/P1)
Enthalpy has no P dependence as volume is not restricted / expansion step is defined as isothermal
"""
def __init__(self,name,stoichiometry,pbesol_energy_eV,thermo_file,zpe_pbesol=0,zpe_lit=0,N=1):
material.__init__(self, name, stoichiometry, pbesol_energy_eV,N)
self.thermo_file = materials_directory + thermo_file
# Initialise ZPE to PBEsol value if provided.
# This looks redundant at the moment: the intent is to implement
# some kind of switch or heirarchy of methods further down the line.
if zpe_pbesol > 0:
self.zpe = zpe_pbesol
elif zpe_lit > 0:
self.zpe = zpe_lit
else:
self.zpe = 0
def U_eV(self,T):
"""Internal energy of one formula unit of ideal gas, expressed in eV.
U = ideal_gas.U_eV(T)
Returns a matrix with the same dimensions as T
"""
U_func = get_potential_nist_table(self.thermo_file,'U')
return (self.pbesol_energy_eV + self.zpe +
U_func(T)*constants.physical_constants['joule-electron volt relationship'][0]/constants.N_A
)
def U_J(self,T):
"""Internal energy of one gram-mole of ideal gas, expressed in J/mol
U = ideal_gas.U_J(T)
Returns a matrix with the same dimensions as T
"""
return self.U_eV(T) * constants.physical_constants['electron volt-joule relationship'][0] * constants.N_A
def U_kJ(self,T):
"""Internal energy of one gram-mole of ideal gas, expressed in kJ/mol
U = ideal_gas.U_kJ(T)
Returns a matrix with the same dimensions as T
"""
return self.U_J(T) * 0.001
def H_eV(self,T,*P):
"""Enthalpy of one formula unit of ideal gas, expressed in eV
H = ideal_gas.H_eV(T)
Returns an array with the same dimensions as T
Accepts ideal_gas.H_eV(T,P): P is unused
"""
H_func = get_potential_nist_table(self.thermo_file,'H')
return (self.pbesol_energy_eV + self.zpe +
H_func(T)*constants.physical_constants['joule-electron volt relationship'][0]/constants.N_A
)
def H_J(self,T,*P):
"""Enthalpy of one gram-mole of ideal gas, expressed in J/mol
H = ideal_gas.H_J(T)
Returns an array with the same dimensions as T
Accepts ideal_gas.H_eV(T,P): P is unused
"""
return self.H_eV(T) * constants.physical_constants['electron volt-joule relationship'][0] * constants.N_A
def H_kJ(self,T,*P):
"""Enthalpy of one gram-mole of ideal gas, expressed in kJ/mol
H = ideal_gas.H_kJ(T,P)
Returns an array with the same dimensions as T
Accepts ideal_gas.H_eV(T,P): P is unused
"""
return self.H_J(T) * 0.001
def mu_eV(self,T,P):
"""
Free energy of one formula unit of ideal gas, expressed in eV
mu = ideal_gas.mu_eV(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
S_func = get_potential_nist_table(self.thermo_file,'S')
S = S_func(T) * constants.physical_constants['joule-electron volt relationship'][0]/constants.N_A
H = self.H_eV(T)
return H - T*S + constants.physical_constants['Boltzmann constant in eV/K'][0] * T * np.log(P/1E5)
def mu_J(self,T,P):
"""
Free energy of one mol of ideal gas, expressed in J/mol
mu = ideal_gas.mu_J(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
return self.mu_eV(T,P) * constants.physical_constants['electron volt-joule relationship'][0] * constants.N_A
def mu_kJ(self,T,P):
"""
Free energy of one mol of ideal gas, expressed in kJ/mol
mu = ideal_gas.mu_kJ(T,P)
T, P may be orthogonal 2D arrays of length m and n, populated in one row/column:
in this case H is an m x n matrix.
T, P may instead be equal-length non-orthogonal 1D arrays, in which case H is a vector
of H values corresponding to T,P pairs.
Other T, P arrays may result in undefined behaviour.
"""
return self.mu_J(T,P) * 0.001
class sulfur_model_legacy(object):
"""
Class for calculated sulfur equilibria.
Sets properties:
-------------------
sulfur_model.name (string)
sulfur_model.pbesol_energy_eV (DFT total energy in eV with PBEsol XC functional for D4d S8 cluster)
sulfur_model.thermo_data (String containing path to T/P effects data file)
sulfur_model.N (Number of atoms per formula unit)
sulfur_model.N_ref (Number of atoms in reference energy)
Sets methods:
-------------------
sulfur_model.mu_eV(T,P), sulfur_model.mu_J(T,P), sulfur_model.mu_kJ(T,P) : Chemical potential mu = U + PV - TS
Ideal gas law PV=nRT is applied: specifically (dH/dP) at const. T = 0 and int(mu)^P2_P1 dP = kTln(P2/P1)
Methods not yet implemented:
----------------------------
sulfur_model.U_eV(T), sulfur_model.U_J(T), sulfur_model.U_kJ(T) : Internal energy
sulfur_model.H_eV(T), sulfur_model.H_J(T), sulfur_model.H_kJ(T) : Enthalpy H = U + PV
Thermo data file format:
------------------------
CSV file containing header line:
# T/K, mu (x1 Pa) / J mol-1,mu (x2 Pa) / J mol-1...
followed by comma-separated data rows
t1,mu11,mu12 ...
t2,mu21,mu22 ...
...
DEV NOTE:
---------
Not currently a derived class of "material" due to substantially different operation.
"""
def __init__(self,name,pbesol_energy_eV,mu_file,mu_file_0,zpe=0,N=1,N_ref=8):
self.name = name
self.stoichiometry = {'S':1}
self.pbesol_energy_eV = pbesol_energy_eV
self.mu_file = materials_directory + mu_file
self.mu_file_0 = mu_file_0
self.zpe = zpe
self.N = 1
self.N_ref=N_ref
self._mu_tab = get_potential_sulfur_table(self.mu_file)
def mu_J(self,T,P):
if type(T) == np.ndarray:
T = T.flatten()
if type(P) == np.ndarray:
P = P.flatten()
mu_tab_0 = 100.416/8. * 1e3 # J mol from kJmol-1
E0 = self.pbesol_energy_eV * eV2Jmol
ZPE_tab = self.zpe * eV2Jmol
return self._mu_tab(T,P) - mu_tab_0 + (E0 + ZPE_tab)/self.N_ref
def mu_kJ(self,T,P):
return self.mu_J(T,P) * 1e-3
def mu_eV(self,T,P):
return self.mu_J(T,P) / eV2Jmol
# def __init__(self,name,pbesol_energy_eV,thermo_file,zpe_pbesol=0,zpe_lit=0,N=1):
# material.__init__(self, name, pbesol_energy_eV,N)
# self.thermo_file = materials_directory + thermo_file
# # Initialise ZPE to PBEsol value if provided.
# # This looks redundant at the moment: the intent is to implement
# # some kind of switch or heirarchy of methods further down the line.
# if zpe_pbesol > 0:
# self.zpe = zpe_pbesol
# elif zpe_lit > 0:
# self.zpe = zpe_lit
# else:
# self.zpe = 0
class sulfur_model(object):
"""
Class for calculated sulfur equilibria.
Sets properties:
-------------------
sulfur_model.name (string)
sulfur_model.pbesol_energy_eV (DFT total energy in eV with PBEsol XC functional for D4d S8 cluster)
sulfur_model.thermo_data (String containing path to T/P effects data file)
sulfur_model.N (Number of atoms per formula unit)
sulfur_model.N_ref (Number of atoms per formula unit of reference state)
Sets methods:
-------------------
sulfur_model.mu_eV(T,P), sulfur_model.mu_J(T,P), sulfur_model.mu_kJ(T,P) : Chemical potential mu = U + PV - TS
Ideal gas law PV=nRT is applied: specifically (dH/dP) at const. T = 0 and int(mu)^P2_P1 dP = kTln(P2/P1)
Methods not yet implemented:
----------------------------
sulfur_model.U_eV(T), sulfur_model.U_J(T), sulfur_model.U_kJ(T) : Internal energy
sulfur_model.H_eV(T), sulfur_model.H_J(T), sulfur_model.H_kJ(T) : Enthalpy H = U + PV
Thermo data file format:
------------------------
CSV file containing header line:
# T/K, mu (x1 Pa) / J mol-1,mu (x2 Pa) / J mol-1...
followed by comma-separated data rows
t1,mu11,mu12 ...
t2,mu21,mu22 ...
...
DEV NOTE:
---------
Not currently a derived class of "material" due to substantially different operation.
"""
def __init__(self,name,pbesol_energy_eV,mu_file,N=1,N_ref=8):
self.name = name
self.stoichiometry = {'S':1}
self.pbesol_energy_eV = pbesol_energy_eV
self.mu_file = materials_directory + mu_file
self.N = 1
self.N_ref = N_ref
self._mu_tab = get_potential_sulfur_table(self.mu_file)
def mu_J(self,T,P):
if type(T) == np.ndarray:
T = T.flatten()
if type(P) == np.ndarray:
P = P.flatten()
E0 = self.pbesol_energy_eV * eV2Jmol
return self._mu_tab(T,P) + E0/self.N_ref
def mu_kJ(self,T,P):
return self.mu_J(T,P) * 1e-3
def mu_eV(self,T,P):
return self.mu_J(T,P) / eV2Jmol
# def __init__(self,name,pbesol_energy_eV,thermo_file,zpe_pbesol=0,zpe_lit=0,N=1):
# material.__init__(self, name, pbesol_energy_eV,N)
# self.thermo_file = materials_directory + thermo_file
# # Initialise ZPE to PBEsol value if provided.
# # This looks redundant at the moment: the intent is to implement
# # some kind of switch or heirarchy of methods further down the line.
# if zpe_pbesol > 0:
# self.zpe = zpe_pbesol
# elif zpe_lit > 0:
# self.zpe = zpe_lit
# else:
# self.zpe = 0
################ Quaternary compounds ###############
CZTS_kesterite=solid(name='Kesterite CZTS',
stoichiometry={'Cu':2,'Zn':1,'Sn':1,'S':4},
pbesol_energy_eV= -0.353240291658938E+06,
fu_cell=1,
volume=155.433224529,
phonons='phonopy_output/czts-kest-primitive.dat',
N=8
)
#### Deprecated conventional cell model used in Mater. Chem. A paper.
#### Difference is not critical: about 1 kJ/mol
# CZTS_kesterite = solid(name='Kesterite CZTS',
# pbesol_energy_eV=-0.706480597450521e06,
# fu_cell=2,
# volume=310.86645888987351,
# phonons='phonopy_output/czts-conventional.dat',
# N=8
# )
CZTS = CZTS_kesterite
CZTS_stannite = solid(name='Stannite CZTS',
stoichiometry={'Cu':2,'Zn':1,'Sn':1,'S':4},
pbesol_energy_eV=-0.353240264472923e06 ,
fu_cell=1,
volume=155.572938002,
phonons='phonopy_output/czts_stannite.dat',
N=8
)
############### Elements ###############
Cu = solid(name='Cu',
stoichiometry={'Cu':1},
pbesol_energy_eV=-180838.168712673,
fu_cell=4,
volume=45.2576997892,
phonons='phonopy_output/Cu.dat'
)
beta_Sn = solid(name='Beta Sn',
stoichiometry={'Sn':1},
pbesol_energy_eV=-0.340581412216286E+06,
fu_cell=2,
volume=53.538071915,
phonons='phonopy_output/beta_Sn.dat'
)
alpha_Sn = solid(name='Alpha Sn',
stoichiometry={'Sn':1},
pbesol_energy_eV=-0.340581358439856E+06,
fu_cell=2,
volume=69.6092979612,
phonons='phonopy_output/alpha_Sn.dat'
)
Sn = beta_Sn
Zn = solid(name='Zn',
stoichiometry={'Zn':1},
pbesol_energy_eV=-0.981596036898606e05,
fu_cell=2,
volume=28.2580218348,
phonons='phonopy_output/Zn.dat'
)
alpha_S=solid(
name='Alpha S',
stoichiometry={'S':1},
pbesol_energy_eV=-0.347575504588933e06,
fu_cell=32,
volume= 832.91786077871541,
phonons='phonopy_output/alpha_S.dat'
)
############### Binary sulfides ###############
Cu2S_low=solid(
name='Low Cu2S',
stoichiometry={'Cu':2,'S':1},
pbesol_energy_eV=-0.486150076546942e07,
fu_cell=48,
volume=2055.8786918601486,
phonons='phonopy_output/Cu2S_low.dat',
N=3
)
Cu2S=Cu2S_low
SnS2=solid(
name='SnS2',
stoichiometry={'Sn':1,'S':2},
pbesol_energy_eV=-0.192015452706802e06,
fu_cell=1,
volume=69.3883090547,
phonons='phonopy_output/SnS2.dat',
N=3
)
SnS_pcma=solid(
name='SnS',
stoichiometry={'Sn':1,'S':1},
pbesol_energy_eV=-0.724613674134358E+06,
fu_cell=4,
volume=186.605514927,
phonons='phonopy_output/SnS_pcma.dat',
N=2
)
SnS=SnS_pcma
Sn2S3=solid(
name='Sn2S3',
stoichiometry={'Sn':2,'S':3},
pbesol_energy_eV=-0.149267503419682e07,
fu_cell=4,
volume=457.334873727,
phonons='phonopy_output/Sn2S3.dat'
)
ZnS_wurtzite=solid(
name='ZnS (wurtzite)',
stoichiometry={'Zn':1,'S':1},
pbesol_energy_eV=-119886.323698657,
fu_cell=2,
volume=76.9580344589,
phonons='phonopy_output/ZnS_wurtzite.dat',
N=2
)
ZnS_zincblende=solid(
name='ZnS (zinc blende)',
stoichiometry={'Zn':1,'S':1},
pbesol_energy_eV=-59943.163599041,
fu_cell=1,
volume=38.4544005985,
phonons='phonopy_output/ZnS_zincblende.dat',
N=2
)
ZnS=ZnS_zincblende
########## Ternary compounds ##########
Cu2SnS3_mo1=solid(
name='Cu2SnS3 (Mo-1)',
stoichiometry={'Cu':2,'Sn':1,'S':3},
pbesol_energy_eV=-0.117318818763261e07,
fu_cell=4,
volume=469.83485422571772,
phonons='phonopy_output/Cu2SnS3-mo1.dat',
N=6
)
Cu2SnS3_mo2=solid(
name='Cu2SnS3 (Mo-2)',
stoichiometry={'Cu':2,'Sn':1,'S':3},
pbesol_energy_eV=-0.293297062672424e06,
fu_cell=1,
volume=117.43775202426687,
phonons='phonopy_output/Cu2SnS3-mo2.dat',
N=6
)
Cu3SnS4=solid(
# Note that a correction is applied to the total energy;
# this is based on HSE06 calculations
name='Cu3SnS4 (pmn21)',
stoichiometry={'Cu':3,'Sn':1,'S':4},
pbesol_energy_eV=-0.698738136506990E+06 + 2*0.667,
fu_cell=2,
volume=299.906413446,
phonons='phonopy_output/Cu3SnS4.dat',
N=8
)
Cu4SnS4=solid(
name='Cu4SnS4 (pnma)',
stoichiometry={'Cu':4,'Sn':1,'S':4},
pbesol_energy_eV=-0.157831255950904e07,
fu_cell=4,
volume=640.981231346,
phonons='phonopy_output/Cu4SnS4.dat',
N=36
)
############### Binary oxides ###############
SnO=solid(
name='SnO',
stoichiometry={'Sn':1,'O':1},
pbesol_energy_eV=-0.344666615074050E+06,
fu_cell=2,
volume=68.1249805813,
phonons='phonopy_output/SnO.dat',
N=2
)
SnO2=solid(
name='SnO2',
stoichiometry={'Sn':1,'O':2},
pbesol_energy_eV=-0.348751648981493E+06,
fu_cell=2,
volume=73.2239419677,
phonons='phonopy_output/SnO2.dat'
)
ZnO=solid(
name='ZnO',
stoichiometry={'Zn':1,'O':1},
pbesol_energy_eV=-102245.514300524,
fu_cell=2,
volume=47.0750741794,
phonons='phonopy_output/ZnO.dat',
N=2
)
S8=ideal_gas(
name='S8',
stoichiometry={'S':8},
pbesol_energy_eV=-0.868936310037924e05,
thermo_file='nist_janaf/S8.dat',
zpe_pbesol=0.32891037,
N=8
)
S2=ideal_gas(
name='S2',
stoichiometry={'S':2},
pbesol_energy_eV=-0.217220682510473e05,
thermo_file='nist_janaf/S2.dat',
zpe_pbesol=0.04421415,
N=2
)
O2=ideal_gas(
name='O2',
stoichiometry={'O':2},
pbesol_energy_eV=-0.408004839112704e04,
thermo_file='nist_janaf/O2.dat',
zpe_lit=0.0976, # Irikura, K. K. (2007). Journal of Physical and
# Chemical Reference Data, 36(2), 389-397.
# doi:10.1063/1.2436891
N=2
)
H2=ideal_gas(
name='H2',
stoichiometry={'H':2},
pbesol_energy_eV=-0.312204882567064e02,
thermo_file='nist_janaf/H2.dat',
zpe_pbesol=0.26465608, # Experimental values are ~ 0.27
N=2
)
H2S=ideal_gas(
name='H2S',
stoichiometry={'H':2,'S':1},
pbesol_energy_eV=-0.108932246222711e05,
thermo_file='nist_janaf/H2S.dat',
zpe_pbesol=0.39799970,
N=3
)
S_model_legacy = sulfur_model_legacy('S vapours',-0.868936310037924e05,'sulfur/mu_pbe0_scaled.csv',
-10879.641688137717, zpe=0.33587176822026876)
S_model_S8ref = sulfur_model('S vapours',-0.868936310037924e05,'sulfur/mu_pbe0_scaled_S8ref.csv')
S_model = sulfur_model('S vapours',S2.pbesol_energy_eV,'sulfur/mu_pbe0_scaled_S2ref.csv',N_ref=2)
S = S_model
def volume_calc(filename):
"""Calculate unit cell volume in cubic angstroms from FHI-aims geometry.in file"""
import numpy as np
lattice_vectors = []
with open(filename, 'r') as f:
for line in f:
if line.split()[0] == 'lattice_vector':
lattice_vectors.append(line.split()[1:4])
lattice_vectors = np.array(lattice_vectors).astype(float)
volume = np.dot(lattice_vectors[0],np.cross(lattice_vectors[1],lattice_vectors[2]))
return abs(volume)