當前位置: 首頁>>代碼示例>>Python>>正文


Python Orbital.from_string方法代碼示例

本文整理匯總了Python中pymatgen.electronic_structure.core.Orbital.from_string方法的典型用法代碼示例。如果您正苦於以下問題:Python Orbital.from_string方法的具體用法?Python Orbital.from_string怎麽用?Python Orbital.from_string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pymatgen.electronic_structure.core.Orbital的用法示例。


在下文中一共展示了Orbital.from_string方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: from_dict

# 需要導入模塊: from pymatgen.electronic_structure.core import Orbital [as 別名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_string [as 別名]
    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,代碼行數:30,代碼來源:bandstructure.py

示例2: from_dict

# 需要導入模塊: from pymatgen.electronic_structure.core import Orbital [as 別名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_string [as 別名]
    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,代碼行數:31,代碼來源:bandstructure.py

示例3: get_complete_dos

# 需要導入模塊: from pymatgen.electronic_structure.core import Orbital [as 別名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_string [as 別名]
    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,代碼行數:20,代碼來源:boltztrap.py

示例4: from_dict

# 需要導入模塊: from pymatgen.electronic_structure.core import Orbital [as 別名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_string [as 別名]
 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,代碼行數:12,代碼來源:dos.py

示例5: from_dict

# 需要導入模塊: from pymatgen.electronic_structure.core import Orbital [as 別名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_string [as 別名]
 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,代碼行數:18,代碼來源:dos.py

示例6: from_dict

# 需要導入模塊: from pymatgen.electronic_structure.core import Orbital [as 別名]
# 或者: from pymatgen.electronic_structure.core.Orbital import from_string [as 別名]
    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,代碼行數:41,代碼來源:bandstructure.py


注:本文中的pymatgen.electronic_structure.core.Orbital.from_string方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。