本文整理匯總了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)