本文整理匯總了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