-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponentFeature.py
More file actions
31 lines (21 loc) · 833 Bytes
/
Copy pathComponentFeature.py
File metadata and controls
31 lines (21 loc) · 833 Bytes
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
import numpy as np
from pymatgen.core import Composition, Structure, Element
from matminer.featurizers.composition import ElementFraction, BandCenter
from matminer.featurizers.composition import Meredig
# calculate the fraction of Li of a composition
def meredig(composition):
composition = Composition(composition)
meredig = Meredig()
elemental_property = meredig.featurize(composition)
return elemental_property[-17:]
# calculate the band center by first ionization energy and electron affinity
def band_center(composition):
composition = Composition(composition)
BC = BandCenter()
bandcenter = BC.featurize(composition)
return bandcenter
def main():
#structure = Structure.from_file('Li7P3S11_mp-641703_primitive.cif')
print(meredig("Li3O"))
if __name__ == '__main__':
main()