本文整理汇总了Python中model.elements.PeriodicTable.getAllElements方法的典型用法代码示例。如果您正苦于以下问题:Python PeriodicTable.getAllElements方法的具体用法?Python PeriodicTable.getAllElements怎么用?Python PeriodicTable.getAllElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.elements.PeriodicTable
的用法示例。
在下文中一共展示了PeriodicTable.getAllElements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_art_data
# 需要导入模块: from model.elements import PeriodicTable [as 别名]
# 或者: from model.elements.PeriodicTable import getAllElements [as 别名]
def write_art_data(fileHandle):
"""
Writes the Atom Rendering Table (ART) data, which contains all
the atom rendering properties needed by QuteMolX, to the file with the
given fileHandle.
Each atom is on a separate line.
Lines starting with '#' are comment lines.
"""
fileHandle.write("""\
REMARK 8
REMARK 8 ;NanoEngineer-1 Atom Rendering Table (format version 0.1.0)
REMARK 8 ;This table specifies the scene rendering scheme as employed by
REMARK 8 ;NanoEngineer-1 (NE1) at the time this file was created.
REMARK 8
REMARK 8 ;Note: All CPK radii were calculated using a CPK scaling factor that
REMARK 8 ;can be modified by the user from "Preferences... | Atoms".\n""")
fileHandle.write("REMARK 8 ;This table's CPK Scaling Factor: %2.3f"
% env.prefs[cpkScaleFactor_prefs_key])
fileHandle.write("""
REMARK 8 ;To compute the original van der Waals radii, use the formula:
REMARK 8 ; vdW Radius = CPK Radius / CPK Scaling Factor
REMARK 8
REMARK 8 ;Atom Name NE1 Atom CPK Radius Ball and Stick Color (RGB)
REMARK 8 ; Number Radius\n""")
elementTable = PeriodicTable.getAllElements()
for elementNumber, element in elementTable.items():
color = element.color
r = int(color[0] * 255 + 0.5)
g = int(color[1] * 255 + 0.5)
b = int(color[2] * 255 + 0.5)
# The following was distilled from chem.py: Atom.howdraw()
#
# "Render Radius"
cpkRadius = \
element.rvdw * env.prefs[cpkScaleFactor_prefs_key]
# "Covalent Radius"
ballAndStickRadius = \
element.rvdw * 0.25 * env.prefs[diBALL_AtomRadius_prefs_key]
#if element.symbol == 'Ax3':
# ballAndStickRadius = 0.1
fileHandle.write \
("REMARK 8 %-3s %-3d %3.3f %3.3f %3d %3d %3d\n"
% (element.symbol, elementNumber, cpkRadius, ballAndStickRadius,
r, g, b))
fileHandle.close()
return