本文整理汇总了Python中pymatgen.electronic_structure.core.Orbital.from_vasp_index方法的典型用法代码示例。如果您正苦于以下问题:Python Orbital.from_vasp_index方法的具体用法?Python Orbital.from_vasp_index怎么用?Python Orbital.from_vasp_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.electronic_structure.core.Orbital
的用法示例。
在下文中一共展示了Orbital.from_vasp_index方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_dos_from_id
# 需要导入模块: from pymatgen.electronic_structure.core import Orbital [as 别名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_vasp_index [as 别名]
def get_dos_from_id(self, task_id):
"""
Overrides the get_dos_from_id for the MIT gridfs format.
"""
args = {'task_id': task_id}
fields = ['calculations']
structure = self.get_structure_from_id(task_id)
dosid = None
for r in self.query(fields, args):
dosid = r['calculations'][-1]['dos_fs_id']
if dosid != None:
self._fs = gridfs.GridFS(self.db, 'dos_fs')
with self._fs.get(dosid) as dosfile:
s = dosfile.read()
try:
d = json.loads(s)
except:
s = zlib.decompress(s)
d = json.loads(s)
tdos = Dos.from_dict(d)
pdoss = {}
for i in range(len(d['pdos'])):
ados = d['pdos'][i]
all_ados = {}
for j in range(len(ados)):
orb = Orbital.from_vasp_index(j)
odos = ados[str(orb)]
all_ados[orb] = {Spin.from_int(int(k)): v
for k, v
in odos['densities'].items()}
pdoss[structure[i]] = all_ados
return CompleteDos(structure, tdos, pdoss)
return None
示例2: test_cached
# 需要导入模块: from pymatgen.electronic_structure.core import Orbital [as 别名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_vasp_index [as 别名]
def test_cached(self):
self.assertEquals(id(Orbital.from_vasp_index(0)), id(Orbital.s))
示例3: test_init
# 需要导入模块: from pymatgen.electronic_structure.core import Orbital [as 别名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_vasp_index [as 别名]
def test_init(self):
for i, orb in enumerate(Orbital.all_orbitals):
self.assertEqual(Orbital.from_vasp_index(i), orb)
self.assertRaises(IndexError, Orbital.from_vasp_index, 100)