本文整理匯總了Python中structure.Structure.change_units方法的典型用法代碼示例。如果您正苦於以下問題:Python Structure.change_units方法的具體用法?Python Structure.change_units怎麽用?Python Structure.change_units使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類structure.Structure
的用法示例。
在下文中一共展示了Structure.change_units方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: PhysicalSystem
# 需要導入模塊: from structure import Structure [as 別名]
# 或者: from structure.Structure import change_units [as 別名]
#.........這裏部分代碼省略.........
if ion in self.particles:
ionp = self.particles[ion]
if isinstance(ionp,Ion):
self.particles[ion] = ionp.pseudize(valence_charge)
self.pseudized = True
else:
self.error(ion+' cannot be pseudized',exit=False)
#end if
else:
self.error(ion+' is not in the physical system',exit=False)
errors = True
#end if
#end for
if errors:
self.error('system cannot be generated')
#end if
self.valency = obj(**valency)
self.update()
#end def pseudize
def check_folded_system(self):
sys_folded = self.folded_system!=None
struct_folded = self.structure.folded_structure!=None
if sys_folded!=struct_folded:
self.error('folding of physical system and structure is not consistent\n system folded: {0}\n structure folded: {1}'.format(sys_folded,struct_folded))
#end if
if sys_folded and id(self.structure.folded_structure)!=id(self.folded_system.structure):
self.error('structure of folded system and folded structure are distinct\n this is not allowed and may be a developer error')
#end if
#end def check_folded_system
def change_units(self,units):
self.structure.change_units(units,folded=False)
if self.folded_system!=None:
self.folded_system.change_units(units)
#end if
#end def change_units
def group_atoms(self):
self.structure.group_atoms(folded=False)
if self.folded_system!=None:
self.folded_system.group_atoms()
#end if
#end def group_atoms
def rename(self,folded=True,**name_pairs):
self.particles.rename(**name_pairs)
self.structure.rename(folded=False,**name_pairs)
if self.pseudized:
for old,new in name_pairs.iteritems():
if old in self.valency:
if new not in self.valency:
self.valency[new] = self.valency[old]
#end if
del self.valency[old]
#end if
#end for
self.valency_in = self.valency
#end if
if self.folded_system!=None and folded:
self.folded_system.rename(folded=folded,**name_pairs)
#end if
示例2: PhysicalSystem
# 需要導入模塊: from structure import Structure [as 別名]
# 或者: from structure.Structure import change_units [as 別名]
#.........這裏部分代碼省略.........
for ion,valence_charge in valency.iteritems():
if ion in self.particles:
ionp = self.particles[ion]
if isinstance(ionp,Ion):
self.particles[ion] = ionp.pseudize(valence_charge)
else:
self.error(ion+' cannot be pseudized',exit=False)
#end if
else:
self.error(ion+' is not in the physical system',exit=False)
errors = True
#end if
#end for
if errors:
self.error('system cannot be generated')
#end if
self.valency = obj(**valency)
self.update()
#end def pseudize
def check_folded_system(self):
sys_folded = self.folded_system!=None
struct_folded = self.structure.folded_structure!=None
if sys_folded!=struct_folded:
self.error('folding of physical system and structure is not consistent\n system folded: {0}\n structure folded: {1}'.format(sys_folded,struct_folded))
#end if
if sys_folded and id(self.structure.folded_structure)!=id(self.folded_system.structure):
self.error('structure of folded system and folded structure are distinct\n this is not allowed and may be a developer error')
#end if
#end def check_folded_system
def change_units(self,units):
self.structure.change_units(units)
if self.folded_system!=None:
self.folded_system.change_units(units)
#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