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


Python Structure.remove_folded_structure方法代碼示例

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


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

示例1: PhysicalSystem

# 需要導入模塊: from structure import Structure [as 別名]
# 或者: from structure.Structure import remove_folded_structure [as 別名]

#.........這裏部分代碼省略.........
        #end if
        if 'net_spin' in kwargs:
            net_spin = kwargs['net_spin']
        #end if
        supercell = self.structure.tile(*td)
        supercell.remove_folded()
        if extensive:
            ncells = int(round(supercell.volume()/self.structure.volume()))
            net_charge = ncells*self.net_charge
            if net_spin is None:
                net_spin   = ncells*self.net_spin
            #end if
        else:
            net_charge = self.net_charge
            if net_spin is None:
                net_spin   = self.net_spin
            #end if
        #end if
        system = self.copy()
        supersystem = PhysicalSystem(
            structure  = supercell,
            net_charge = net_charge,
            net_spin   = net_spin,
            **self.valency
            )
        supersystem.folded_system = system
        supersystem.structure.set_folded(system.structure)
        return supersystem
    #end def tile


    def remove_folded_system(self):
        self.folded_system = None
        self.structure.remove_folded_structure()
    #end def remove_folded_system


    def remove_folded(self):
        self.remove_folded_system()
    #end def remove_folded


    def get_primitive(self):
        if self.folded_system is None:
            fs = self
        else:
            fs = self.folded_system
            while fs.folded_system!=None:
                fs = fs.folded_system
            #end while
        #end if
        return fs
    #end def get_primitive


    def folded_representation(self,arg0,arg1=None):
        self.error('folded_representation needs a developers attention to make it equivalent with tile')
        if isinstance(arg0,PhysicalSystem):
            folded_system = arg0
        elif isinstance(arg0,str):
            shape = arg0
            tiling    = arg1
            if tiling is None:
                tiling = (1,1,1)
            #end if
            if not 'generation_info' in self:
開發者ID:Paul-St-Young,項目名稱:myNexus,代碼行數:70,代碼來源:physical_system.py

示例2: PhysicalSystem

# 需要導入模塊: from structure import Structure [as 別名]
# 或者: from structure.Structure import remove_folded_structure [as 別名]

#.........這裏部分代碼省略.........
        #end if
    #end def change_units


    def group_atoms(self):
        self.structure.group_atoms()
        if self.folded_system!=None:
            self.folded_system.group_atoms()
        #end if
    #end def group_atoms


    def copy(self):
        cp = DevBase.copy(self)
        if self.folded_system!=None and self.structure.folded_structure!=None:
            del cp.folded_system.structure
            cp.folded_system.structure = cp.structure.folded_structure
        #end if
        return cp
    #end def copy


    def load(self,filepath):
        DevBase.load(self,filepath)
        if self.folded_system!=None and self.structure.folded_structure!=None:
            del self.folded_system.structure
            self.folded_system.structure = self.structure.folded_structure
        #end if
    #end def load


    def tile(self,*td,**kwargs):
        extensive = True
        if 'extensive' in kwargs:
            extensive = kwargs['extensive']
        #end if
        supercell = self.structure.tile(*td)
        if extensive:
            ncells = int(round(supercell.volume()/self.structure.volume()))
            net_charge = ncells*self.net_charge
            net_spin   = ncells*self.net_spin
        else:
            net_charge = self.net_charge
            net_spin   = self.net_spin
        #end if
        supersystem = PhysicalSystem(
            structure  = supercell,
            net_charge = net_charge,
            net_spin   = net_spin,
            **self.valency
            )
        return supersystem
    #end def tile


    def remove_folded_system(self):
        print 'removing folded system',self.folded_system.__class__.__name__
        self.folded_system = None
        self.structure.remove_folded_structure()
    #end def remove_folded_system


    def folded_representation(self,arg0,arg1=None):
        self.error('folded_representation needs a developers attention to make it equivalent with tile')
        if isinstance(arg0,PhysicalSystem):
            folded_system = arg0
        elif isinstance(arg0,str):
            shape = arg0
            tiling    = arg1
            if tiling is None:
                tiling = (1,1,1)
            #end if
            if not 'generation_info' in self:
                self.error('system was not formed with generate_physical_system, cannot form folded representation')
            #end if
            structure,element,scale,units,net_charge,net_spin,particles,valency = \
                self.generation_info.tuple('structure','element','scale','units', \
                                               'net_charge','net_spin','particles','valency')
            folded_system = generate_physical_system(
                structure  = structure,
                shape      = shape,
                element    = element,
                tiling     = tiling,
                scale      = scale,
                units      = units,
                net_charge = net_charge,
                net_spin   = net_spin,
                particles  = particles,
                **valency
                )
        else:
            self.error('unrecognized inputs in folded_representation')
        #end if
        tilematrix,kmap = self.structure.fold(folded_system.structure,'tilematrix','kmap')
        self.set(
            folded_system = folded_system,
            tilematrix    = tilematrix,
            kmap          = kmap
            )
        return folded_system
開發者ID:jyamu,項目名稱:qmc,代碼行數:104,代碼來源:physical_system.py


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