9.2.1. VMD选择

MDAnalysis.core.groups.AtomGroup 将选定内容添加到 VMD tcl`文件(例如,“acros.vmd”),它定义 `atomselect macros 。要像这样在VMD中使用(假设默认宏名称“mdanalysis001”):

source macros.vmd
set sel [atomselect top mdanalysis001]

VMD Gui宏“mdanalysis001”出现在 Graphics ‣ Representations 窗下 Selections: Singlewords

class MDAnalysis.selections.vmd.SelectionWriter(filename, mode='w', numterms=None, preamble=None, **kwargs)[源代码]

设置为写入 文件名

参数:
  • filename -- 输出文件

  • mode -- 创建新文件(“w”),或将(“a”)追加到现有文件 ["w"]

  • numterms -- 在一行中写入多个条目的输出格式的每行单个索引号的数量。如果设置为0或 False 则不会执行特殊的格式化 [8]

  • preamble -- 作为注释写入文件顶部的字符串[]

  • kwargs -- 用作以下项的默认值 write()

close()

关闭该文件

在 0.16.0 版本加入.

comment(s)

返回字符串 s 插入到注释格式字符串中。

如果没有 SelectionWriterBase.commentfmt 则返回空字符串,因为可能无法向文件中输入注释。

换行符被附加到非空字符串。

commentfmt = '# %s'

注释格式字符串;应包含‘%S’或 None 无可奉告。

continuation = '\\'

用于在换行符之间接续一行的特殊字符。

ext = 'vmd'

输出文件的扩展名。

format = 'VMD'

格式的名称。

write(selection, number=None, name=None, frame=None, mode=None)

将所选内容写入输出文件。

参数:
  • selection -- 一个 MDAnalysis.core.groups.AtomGroup

  • number -- 所选内容将命名为“mdanalysis<number>” (None 写入之间自动递增;在追加时很有用) [None]

  • name -- 所选内容将命名为 name (而不是编号) [None]

  • frame -- write selection of this frame (or the current one if None [None]

write_preamble()

根据文件格式编写标题。