本文整理汇总了Python中pymatgen.electronic_structure.core.Orbital类的典型用法代码示例。如果您正苦于以下问题:Python Orbital类的具体用法?Python Orbital怎么用?Python Orbital使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Orbital类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: from_dict
def from_dict(d):
"""
Args:
A dict with all data for a band structure symm line object.
Returns:
A BandStructureSymmLine object
"""
labels_dict = d['labels_dict']
projections = {}
structure = None
if 'projections' in d and len(d['projections']) != 0:
structure = Structure.from_dict(d['structure'])
projections = {
Spin.from_int(int(spin)): [
[{Orbital.from_string(orb): [
d['projections'][spin][i][j][orb][k]
for k in range(len(d['projections'][spin][i][j][orb]))]
for orb in d['projections'][spin][i][j]}
for j in range(len(d['projections'][spin][i]))]
for i in range(len(d['projections'][spin]))]
for spin in d['projections']}
return BandStructureSymmLine(
d['kpoints'], {Spin.from_int(int(k)): d['bands'][k]
for k in d['bands']},
Lattice(d['lattice_rec']['matrix']), d['efermi'],
labels_dict, structure=structure, projections=projections)
开发者ID:materialsgenome,项目名称:pymatgen,代码行数:28,代码来源:bandstructure.py
示例2: get_dos_from_id
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
开发者ID:gmatteo,项目名称:pymatgen-db,代码行数:33,代码来源:query_engine.py
示例3: from_dict
def from_dict(cls, d):
"""
Args:
A dict with all data for a band structure symm line object.
Returns:
A BandStructureSymmLine object
"""
# Strip the label to recover initial string (see trick used in as_dict to handle $ chars)
labels_dict = {k.strip(): v for k, v in d['labels_dict'].items()}
projections = {}
structure = None
if 'projections' in d and len(d['projections']) != 0:
structure = Structure.from_dict(d['structure'])
projections = {
Spin.from_int(int(spin)): [
[{Orbital.from_string(orb): [
d['projections'][spin][i][j][orb][k]
for k in range(len(d['projections'][spin][i][j][orb]))]
for orb in d['projections'][spin][i][j]}
for j in range(len(d['projections'][spin][i]))]
for i in range(len(d['projections'][spin]))]
for spin in d['projections']}
return BandStructureSymmLine(
d['kpoints'], {Spin.from_int(int(k)): d['bands'][k]
for k in d['bands']},
Lattice(d['lattice_rec']['matrix']), d['efermi'],
labels_dict, structure=structure, projections=projections)
开发者ID:dbroberg,项目名称:pymatgen_chgdef,代码行数:29,代码来源:bandstructure.py
示例4: get_complete_dos
def get_complete_dos(self, structure):
"""
Gives a CompleteDos object with the DOS from the interpolated projected band structure
Args:
the structure (necessary to identify sites for projection)
Returns:
a CompleteDos object
"""
pdoss = {}
for s in self._dos_partial:
if structure.sites[int(s)] not in pdoss:
pdoss[structure.sites[int(s)]] = {}
for o in self._dos_partial[s]:
if Orbital.from_string(o) not in pdoss[structure.sites[int(s)]]:
pdoss[structure.sites[int(s)]][Orbital.from_string(o)] = {}
pdoss[structure.sites[int(s)]][Orbital.from_string(o)][Spin.up] = self._dos_partial[s][o]
return CompleteDos(structure, total_dos=self.dos, pdoss=pdoss)
开发者ID:mxm2,项目名称:pymatgen,代码行数:18,代码来源:boltztrap.py
示例5: from_dict
def from_dict(d):
"""
Returns PDos object from dict representation.
"""
return PDos(
d["efermi"],
d["energies"],
{Spin.from_int(int(k)): v for k, v in d["densities"].items()},
Orbital.from_string(d["orbital"]),
)
开发者ID:chenweis,项目名称:pymatgen,代码行数:10,代码来源:dos.py
示例6: from_dict
def from_dict(cls, d):
"""
Returns CompleteDos object from dict representation.
"""
tdos = Dos.from_dict(d)
struct = Structure.from_dict(d["structure"])
pdoss = {}
for i in range(len(d["pdos"])):
at = struct[i]
orb_dos = {}
for orb_str, odos in d["pdos"][i].items():
orb = Orbital.from_string(orb_str)
orb_dos[orb] = {Spin.from_int(int(k)): v
for k, v in odos["densities"].items()}
pdoss[at] = orb_dos
return CompleteDos(struct, tdos, pdoss)
开发者ID:sonium0,项目名称:pymatgen,代码行数:16,代码来源:dos.py
示例7: from_dict
def from_dict(cls, d):
"""
Args:
A dict with all data for a band structure symm line object.
Returns:
A BandStructureSymmLine object
"""
labels_dict = d["labels_dict"]
projections = {}
structure = None
if "projections" in d and len(d["projections"]) != 0:
structure = Structure.from_dict(d["structure"])
projections = {
Spin.from_int(int(spin)): [
[
{
Orbital.from_string(orb): [
d["projections"][spin][i][j][orb][k]
for k in range(len(d["projections"][spin][i][j][orb]))
]
for orb in d["projections"][spin][i][j]
}
for j in range(len(d["projections"][spin][i]))
]
for i in range(len(d["projections"][spin]))
]
for spin in d["projections"]
}
return BandStructureSymmLine(
d["kpoints"],
{Spin.from_int(int(k)): d["bands"][k] for k in d["bands"]},
Lattice(d["lattice_rec"]["matrix"]),
d["efermi"],
labels_dict,
structure=structure,
projections=projections,
)
开发者ID:sikisis,项目名称:pymatgen,代码行数:39,代码来源:bandstructure.py
示例8: test_cached
def test_cached(self):
self.assertEquals(id(Orbital.from_vasp_index(0)), id(Orbital.s))
开发者ID:NadezhdaBzhilyanskaya,项目名称:pymatgen,代码行数:2,代码来源:test_core.py
示例9: test_init
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)
开发者ID:NadezhdaBzhilyanskaya,项目名称:pymatgen,代码行数:4,代码来源:test_core.py
注:本文中的pymatgen.electronic_structure.core.Orbital类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论