当前位置: 首页>>代码示例>>Python>>正文


Python Structure.zero_corner方法代码示例

本文整理汇总了Python中structure.Structure.zero_corner方法的典型用法代码示例。如果您正苦于以下问题:Python Structure.zero_corner方法的具体用法?Python Structure.zero_corner怎么用?Python Structure.zero_corner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在structure.Structure的用法示例。


在下文中一共展示了Structure.zero_corner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: return_system

# 需要导入模块: from structure import Structure [as 别名]
# 或者: from structure.Structure import zero_corner [as 别名]
    def return_system(self):
        ibrav = self.system.ibrav
        if ibrav!=0:
            self.error('ability to handle non-zero ibrav not yet implemented')
        #end if

        scale,axes,kaxes = self.get_common_vars('scale','axes','kaxes')

        elem = list(self.atomic_positions.atoms)
        ap = self.atomic_positions.copy()
        ap.change_specifier('bohr',self)
        pos = ap.positions

        kp = self.k_points.copy()
        kp.change_specifier('tpiba',self)
        kpoints = kp.kpoints*(2*pi)/scale

        center = axes.sum(0)/2
        structure = Structure(
            axes    = axes,
            elem    = elem,
            scale   = scale,
            pos     = pos,
            center  = center,
            kpoints = kpoints,
            units   = 'B',
            rescale = False
            )
        structure.zero_corner()
        structure.recenter()
  
        ion_charge = 0
        valency = dict()
        atoms   = list(self.atomic_positions.atoms)
        for atom in self.atomic_species.atoms:
            pseudo_file = self.atomic_species.pseudopotentials[atom]
            if self.pseudopotentials!=None and pseudo_file in self.pseudopotentials:                
                pseudopot = self.pseudopotentials[pseudo_file]
                element = pseudopot.element
                valence = int(pseudopot.Z)
                ion_charge += atoms.count(atom)*valence
                valency[atom] = valence
            else:
                self.error('file '+pseudo_file+' was not listed in Pseudopotentials object\n  please specify pseudopotentials with the settings function',trace=False)
            #end if
        #end for

        if 'nelup' in self.system:
            nup = self.system.nelup
            ndn = self.system.neldw
            net_charge = ion_charge - nup - ndn
            net_spin   = nup - ndn
        elif 'tot_magnetization' in self.system:
            net_spin = self.system.tot_magnetization
            if 'nelec' in self.system:
                net_charge = ion_charge - self.system.nelec
            else:
                net_charge = 0
            #end if
        else:
            net_spin = 0
            if 'nelec' in self.system:
                net_charge = ion_charge - self.system.nelec
            else:
                net_charge = 0
            #end if
        #end if

        system = PhysicalSystem(structure,net_charge,net_spin,**valency)

        return system
开发者ID:jyamu,项目名称:qmc,代码行数:73,代码来源:pwscf_input.py


注:本文中的structure.Structure.zero_corner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。