本文整理汇总了Python中pymatgen.core.composition.Composition.values方法的典型用法代码示例。如果您正苦于以下问题:Python Composition.values方法的具体用法?Python Composition.values怎么用?Python Composition.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.core.composition.Composition
的用法示例。
在下文中一共展示了Composition.values方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: interaction
# 需要导入模块: from pymatgen.core.composition import Composition [as 别名]
# 或者: from pymatgen.core.composition.Composition import values [as 别名]
class MolecularOrbitals:
'''
Represents the character of bands in a solid. The input is a chemical
formula, since no structural characteristics are taken into account.
The band character of a crystal emerges from the atomic orbitals of the
constituant ions, hybridization/covalent bonds, and the spin-orbit
interaction (ex: Fe2O3). Right now the orbitals are only built from
the uncharged atomic species. Functionality can be improved by:
1) calculate charged ion orbital energies
2) incorportate the coordination enviornment to account for covalant bonds
The atomic orbital energies are stored in pymatgen.core.periodic_table.JSON
>>> MOs = MolecularOrbitals('SrTiO3')
>>> MOs.band_edges
{'HOMO':['O','2p',-0.338381], 'LUMO':['Ti','3d',-0.17001], 'metal':False}
'''
def __init__(self, formula):
'''
Args:
chemical formula as a string. formula must have integer subscripts
Ex: 'SrTiO3'
Attributes:
composition: the composition as a dictionary.
Ex: {'Sr': 1, 'Ti': 1, 'O', 3}
elements: the dictionary keys for the composition
elec_neg: the maximum pairwise electronegetivity difference
aos: the consituant atomic orbitals for each element as a
dictionary
band_edges: dictionary containing the highest occupied molecular
orbital (HOMO), lowest unocupied molecular orbital
(LUMO), and whether the material is predicted to be a
metal
'''
self.composition = Composition(formula).as_dict()
self.elements = self.composition.keys()
for subscript in self.composition.values():
if not float(subscript).is_integer():
raise ValueError('composition subscripts must be integers')
self.elec_neg = self.max_electronegativity()
self.aos = {str(el): [[str(el), k, v]
for k, v in Element(el).atomic_orbitals.items()]
for el in self.elements}
self.band_edges = self.obtain_band_edges()
def max_electronegativity(self):
'''
returns the maximum pairwise electronegativity difference
'''
maximum = 0
for e1, e2 in combinations(self.elements, 2):
if abs(Element(e1).X - Element(e2).X) > maximum:
maximum = abs(Element(e1).X - Element(e2).X)
return maximum
def aos_as_list(self):
'''
Returns a list of atomic orbitals, sorted from lowest to highest energy
'''
return sorted(chain.from_iterable(
[self.aos[el] * int(self.composition[el]) for el in self.elements]
), key=lambda x: x[2])
def obtain_band_edges(self):
'''
Fill up the atomic orbitals with available electrons.
Return HOMO, LUMO, and whether it's a metal.
'''
orbitals = self.aos_as_list()
electrons = Composition(self.composition).total_electrons
partial_filled = []
for orbital in orbitals:
if electrons <= 0:
break
if 's' in orbital[1]:
electrons += -2
elif 'p' in orbital[1]:
electrons += -6
elif 'd' in orbital[1]:
electrons += -10
elif 'f' in orbital[1]:
electrons += -14
partial_filled.append(orbital)
if electrons != 0:
homo = partial_filled[-1]
lumo = partial_filled[-1]
else:
homo = partial_filled[-1]
try:
lumo = orbitals[len(partial_filled)]
except:
lumo = None
if homo == lumo:
metal = True
#.........这里部分代码省略.........