本文整理汇总了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