9.2.1. VMD selections
MDAnalysis.core.groups.AtomGroup selection to a VMD tcl file
(for example, “macros.vmd”) that defines atomselect macros. To be used in
VMD like this (assuming the default macro name “mdanalysis001”):
source macros.vmd set sel [atomselect top mdanalysis001]
In the VMD GUI the macro “mdanalysis001” appears in the window under Selections: Singlewords.
- class MDAnalysis.selections.vmd.SelectionWriter(filename, mode='w', numterms=None, preamble=None, **kwargs)
Set up for writing to filename.
filename – output file
mode – create a new file (“w”), or append (“a”) to existing file [“w”]
numterms – number of individual index numbers per line for output formats that write multiple entries in one line. If set to 0 or
Falsethen no special formatting is done 
preamble – string that is written as a comment at the top of the file 
kwargs – use as defaults for
Close the file
New in version 0.16.0.
Return string s interpolated into the comment format string.
SelectionWriterBase.commentfmtis defined (None) then the empty string is returned because presumably there is no way to enter comments into the file.
A newline is appended to non-empty strings.
- commentfmt = '# %s'
Comment format string; should contain ‘%s’ or
Nonefor no comments.
- continuation = '\\'
Special character to continue a line across a newline.
- ext = 'vmd'
Extension of output files.
- format = 'VMD'
Name of the format.
- write(selection, number=None, name=None, frame=None, mode=None)
Write selection to the output file.
selection – a
number – selection will be named “mdanalysis<number>” (
Noneauto increments between writes; useful when appending) [
name – selection will be named name (instead of numbered) [
frame – write selection of this frame (or the current one if
Write a header, depending on the file format.