Files

Sessions

A session (.vmdance) keeps:

  • every run: its request, its clustering, the plugin’s measures, and what was asked of it (PRIME, the similarity, the groups and their colours, the map, the profiles);

  • the elbow scan and the sweep;

  • the picked frames and the selection;

  • the window’s settings of the plots and of the 3D view.

It is gzip-compressed UTF-8 text. VMDanceSession 1 is on the first line, then comes a Tcl dictionary that is read as data, never evaluated.

Every run is checked as a new clustering is: the labels and sizes, the representatives, the measures’ sizes, the numbers. So are the scans and the picks. All this happens before anything is replaced, so a damaged file changes nothing.

A session is read up to 400 MB unpacked and 50 million values. Lists are counted before they are made, because a few kilobytes of text can otherwise allocate gigabytes: a value takes about 120 bytes once read.

How much room a session takes:

  • A run takes some 40 bytes a frame.

  • For k clusters, 300 or fewer, a run also takes two k×k tables of the distances between them: about 16·k² bytes (1.5 MB at 300). A session made before keeps them for more clusters; those are left out as it opens.

  • A sweep takes every configuration’s labels.

So sessions of many runs, or of large sweeps, are large. A save that would be larger than can be read back is refused, and the file is left as it was. The refusal names what to drop, the largest first:

  • runs to delete (vmdance run delete id, or Clustering ▸ Delete this run);

  • the scans or the picks to clear (vmdance elbow clear, sweep clear, pick clear);

  • or what is too large alone to keep, whose tables can be exported.

The limits are ::VMDance::Session::max_bytes and max_values. Raised where a session is saved and where it is opened (set ::VMDance::Session::max_values 60000000), they let a larger one be saved and opened.

A session keeps each molecule’s files in two ways: as VMD keeps them (as typed), and by their names in full. The full names are made in the folder VMD is in when it clusters, because VMD does not keep the folder a name was typed in.

On opening (-mol auto, the default), each run’s molecule is the first that has its frames:

  • among those loaded: by its files, in full or as typed; then by the same name and number of atoms;

  • else, among its files loaded: by their names in full, from the session’s folder (a session moved with its files), or as typed, from VMD’s folder.

A molecule of the user’s, from its files, that does not have the frames is taken as it is (said below), not loaded again. The other choices:

  • -mol load always loads the files.

  • -mol none does not look for the molecule. The tables and plots work; the 3D drawing and the questions that read the coordinates again wait for it.

  • -mol id puts every run on one molecule, which must have the same number of atoms.

Every run, the scans and the picks are then checked against the molecule they are put on. The coordinates at their frames must be those they were made from (their digest). Or they must be the same frames moved in place rigidly since (each frame’s radius of gyration): a trajectory aligned before it was clustered.

A warning reports another trajectory of the same file names (a replica’s folder), files written over since, or frames deleted or added before them. That run’s frames are then refused: no 3D views, goto, frame, user field, structure exports, PRIME or similarity. Its tables still answer.

A molecule can have frames before the clustered ones that it did not have then: a PDB’s own frame, deleted after loading, as MDANCE’s tutorial does.

  • A molecule the session loaded itself gets them deleted again.

  • One of the user’s is never changed. The warning, and every refusal then, says which frames to delete (animate delete beg 0 end 0 m). Once they are deleted, its frames are the clustered ones again.

In a session made before the picks kept what tells their frames, the picks are listed only: pick them again.

A molecule is loaded from its files only when every file:

  • is a regular, non-empty file (or a DESRES trajectory’s folder) of one of VMD’s own file readers;

  • has no FIFO or device beside it, or in the folders of a DESRES trajectory (a reader opens files beside the one named: VASP’s POTCAR, a DESRES trajectory’s own);

  • for the AMBER and NetCDF readers, which give its name to a shell, is named without the characters a shell acts on.

So a session from someone else cannot make VMD run a file through an external converter (the Babel formats), download it (webpdb), give its name to a shell, or block on a FIFO or device. Otherwise the molecule is left unloaded, with a warning that says why.

A session saved by an earlier version opens as one saved now would. The backend’s placeholders it kept are left out:

  • a cluster without frames had an MSD and an iSIM of 0;

  • when every cluster was a frame alone, the scores were 1 and 0;

  • a scan’s record counted the clusters without frames.

HELM’s scores with a trim are kept as they were made. They are CPP-MDANCE’s, which count the trimmed frames as one more cluster. Cluster again for those of the clustered frames.

Sessions of the MDANCE plugin

File ▸ Import a session of the MDANCE plugin (vmdance session import file.mdance) reads the old plugin’s session as data:

  • its clustering;

  • its frames (every n-th of a range);

  • its selection and parameters;

  • the name and frames of its molecule, which must be loaded (or given with -mol).

HELM’s pre-k becomes -initial, and its label file -initial-labels, named as the file names it. A run of the imported request reads it again, or says it cannot.

Its values are counted before any list is made of them. A file that holds more than a clustering of the frames loaded is refused at once. Its selection, which an index list can make long, is counted apart:

  • it is refused past 200 000 words, since VMD’s own parser fails on a few hundred thousand;

  • one that still holds more than 50 000 separate values once its index lists are written as ranges is refused where it is handed to VMD.

Its molecule is a loaded one of that name (any, when the file does not know it) with the frames clustered. Its coordinates must give the clusters’ MSDs the file holds (MDANCE’s, which its backend computed). Those of the number of frames the file recorded come first (with frames added since, a warning says so), and, first among them, the molecule id the file names. When none agrees, the import is refused, naming them. A molecule whose clustered frames cannot be read is passed over. When the file holds no MSD to compare, only the one molecule of its name and number of frames is taken.

A molecule given with -mol is taken, with a warning when its coordinates do not agree. When the window finds none, it offers the molecule chosen in Setup.

The plugin’s measures are computed from the coordinates, and the clustering becomes a run, named (imported). The window’s status names the molecule taken.

The old plugin kept less than a run needs, and the import says so rather than make it up:

  • HELM’s merges are numbered among its starting clusters, which the file does not keep. After a trimming they cannot be placed, nor when frames are in no cluster.

    Stopped by -eps, an mdance-cli built before CPP-MDANCE 4042c24 kept, as its last merge, the one -eps refused. It is left out when the merges tell it (each one’s count of starting clusters, and the pre-k asked for). When they cannot, the others are left out too: merges of all pre-k starting clusters are also those of one fewer, which NANI can leave empty, and the refused one.

    Merges left out are said in a warning. The tree is then the linkage of the mean structures, and the clustering is imported.

  • A configuration of its sweep, made the results with Load Selected, was saved without its parameters. MSD and the defaults are taken, and the run says they are not recorded:

    • its name ends (imported; parameters not recorded);

    • the tables’ # header says so in place of them;

    • info has unrecorded {metric params};

    • Setup keeps its own.

  • Its numbers are read as the plugin took them: +10, and a zero-padded 010, which mdance-cli read as 10 and its library as 8. For the number of clusters, the reading that is the clusters it found is taken. The others are read as mdance-cli read them, with a warning when its library read them otherwise.

Export

_images/dialog_export.png

File ▸ Export results (vmdance export dir -prefix name -items {…}) writes each item as name_item:

Item

Content

summary

what was clustered, how, and the clusters (text)

clusters

cluster,frames,percent,msd,msd_to_representative,representative_frame,mean_silhouette. msd is MDANCE’s, within the cluster. msd_to_representative is the mean RMSD² of its frames from the representative.

labels

frame,cluster of every clustered frame (-1: noise). HELM reads it back as starting clusters.

top

frame,cluster,rank,msd_to_representative: each cluster’s -top frames nearest its representative (rank 0 is the representative)

timeline

frame,cluster,msd_to_representative

transitions

from_cluster,to_cluster,count,probability, at lag -lag. When there is noise, a column -1 makes each row sum to 1. A row with nothing counted has no probability. There are k² rows: above 300 clusters, written only when named.

residence

cluster,visits,mean_frames,min_frames,max_frames (in clustered frames)

silhouette

frame,cluster,silhouette,silhouette_pairs: every frame’s silhouette from the clusters’ mean structures, and from every frame, of the squared distances. A run made before the second was measured has the first column only.

distances

cluster_i,cluster_j,centroid_msd,representative_rmsd. centroid_msd is the RMSD² between the mean structures. Measured for 300 clusters or fewer, not above.

tree

left,right,distance,count,height: the dendrogram’s merges and each merge’s height. The average linkage is made for 300 clusters or fewer, and its height is its distance. HELM’s takes any number, and its height is the MSD of the cluster it makes.

representatives

the representatives’ structures: one frame per cluster with frames, in the clusters’ order. An empty cluster has none, so the frames are then fewer than k. The format is -format dcd, with a PDB of the atoms, or pdb (a model each, named by a REMARK: below). -sel gives the atoms.

trajectories

each cluster’s frames as a trajectory of its own (name_cluster_c.dcd and .pdb, or .pdb). Those an earlier export left under the name that this one does not write (a larger k, the other format) are deleted; the window asks first.

prime, similarity

PRIME’s seven frames; each cluster’s iSIM and least similar frame

groups

frame,cluster,group of every clustered frame (no group: empty). vmdance groups -file reads it back.

makeup

cluster,group,frames,share_of_cluster,share_of_group

map

frame,cluster,group,pc1,pc2, in Å. The # lines give each axis’s share of the variance.

profiles

atom,residue,chain (atom: the atom’s place in the selection, from 0). Then, atom by atom (Å), each cluster’s and each group’s RMSF (rmsf_cluster_c, rmsf_group_name), and each cluster’s mean structure’s distance from the reference’s (distance_cluster_c_from_r).

elbow, sweep

every k or configuration and its scores, with the elbow’s stability when it was measured. An eQual scan has its radius in place of k.

picks

the picked frames

Every table starts with # lines that say:

  • what was clustered: the molecule and its files, the atoms, the frames;

  • how: the algorithm, k, the metric, every parameter (a sweep’s: each algorithm’s but the seeding, which is a column);

  • what came out: the clusters, the scores, the noise;

  • with which backend and when (a scan’s and the picks’ too).

Each # line is one line: a selection written over several lines is joined with spaces. Frames are VMD’s frame numbers.

An export is checked whole before anything is written:

  • each item has what it needs (a clustering, PRIME, a scan, the molecule with its frames);

  • -sel holds atoms at the first frame of each structure;

  • no file it writes is a folder or read-only.

The folder is made when it does not exist, and deleted again when the export fails.

Every file is written under a temporary name beside it that only the plugin made. A link put there is never followed. An export’s files are renamed into place once all of them are written, so a failure, a full disk too, changes none. Only a rename the system refuses at the end can leave some in place, and the error names them.

When a file is replaced:

  • it keeps its permissions, where the system allows it;

  • a link of the user’s stays a link, and the file it points to is written;

  • a link of another user’s is replaced, and what it points to is left alone, its permissions too.

Sessions, the preferences and figures are written the same way.

The structures are written as VMD writes them, from the clustered molecule. No molecule is made.

  • A DCD keeps every frame’s unit cell.

  • A PDB is VMD’s PDB writer’s, frame by frame: residues past 9999 in its hexadecimal, each frame’s unit cell.

In a PDB the frames are models: MODEL n … ENDMDL around each, a REMARK before it that names it, and one END after the last:

REMARK     VMDance: cluster 0's representative, frame 4646 (2412 frames)
MODEL        1
CRYST1 …
ATOM      1  N   …
ENDMDL
REMARK     VMDance: cluster 1's representative, frame 4134 (1508 frames)
MODEL        2
…
ENDMDL
END

The REMARK says:

  • for the representatives: the cluster, its representative’s frame and its size;

  • for a cluster’s trajectory: cluster c, frame f;

  • for the picked frames: picked frame f.

VMD reads such a file back as frames, one a model. To other programs, frames joined by END alone are one frame, or atoms piled up. The PDB of the atoms beside a DCD is one frame, as VMD writes it.

A PDB holds coordinates from -999.999 to 9999.999 Å. A frame beyond them is refused, naming it. A DCD holds such a frame, but for the file’s first frame, which the PDB beside a DCD has. An occupancy or a beta beyond them is refused too, in either format: leave those atoms out.

File ▸ Quick export writes one file:

  • the table of clusters or the data of the plot shown (CSV);

  • the plot shown (PDF, PNG or EPS);

  • or the 3D view (PNG).

Figures

_images/dialog_figures.png

File ▸ Create figures (vmdance figures dir -plots {…} -formats {pdf png eps} -size -width -height -dpi -text -prefix) draws the plots again at the size asked. It writes them as EPS, and through Ghostscript as PDF and PNG.

In the dialog, For chooses where the figure goes: the screen, a journal’s column, two columns, a slide. It fills the width, the height and the text, which can then be typed over. The size is said in millimetres beside it. The line at VMD’s current frame is left out unless ticked.

-size says where the figure goes, and sets its width, its height and its text size together:

-size

For

Width × height

Text

column

a journal’s column

85 × 64 mm (241 × 181 points)

8 points

two-columns

its two columns

178 × 100 mm (504 × 284 points)

9 points

slide

a 16:9 slide

10 × 5.6 in (720 × 405 points)

16 points

screen (the default)

a look on the screen

900 × 560 points

12 points

The other options:

  • -width and -height change what the size set. Each is a number of points (72 an inch), or a number with its unit: 85mm, 8.5cm, 3.35in. A figure is 160 to 6000 points (56 mm at least) each way.

  • -text is the plots’ text size, 6 to 36 points.

  • -dpi is the PNG’s resolution: 50 to 1200, 300 by default.

  • -cursor is 0 by default: the red line at VMD’s current frame is not drawn in a figure unless asked (-cursor 1).

The Timeline’s lanes are drawn in a figure as shapes, not as an image of the window’s pixels, so they are sharp at any size and resolution.

A plot that has only a message to show (No similarity yet, a plot of groups without groups) gets no figure. The others are written, and the console names it and why. Asked for alone, the command is refused with the same words.

-options {setting value …} sets plot options for these figures only: tl_view shares, ds_show representatives, mu_view groups, mp_colour cluster, pf_show differences, td_view heights, sl_kind pairs, eb_show explained, plot_len a, plot_time "0.1 ns" …

-3d 1 renders the 3D view too; -plots {} -3d 1 renders it alone. The renderer is:

  • -renderer auto: TachyonInternal, else a snapshot;

  • snapshot;

  • or another of VMD’s internal ray tracers (OptiXInternal, ANARIInternal).

VMD’s exporters (POV3, Tachyon, Wavefront …) write no image, and are refused before any figure is written.

The folder is made when it does not exist.

Tk draws the figures, so they need a display, which text-mode VMD has not (its launcher unsets DISPLAY). Make them in VMD with its window, from a session saved in text mode if need be (vmdance session load file -mol none, then vmdance figures dir).

File ▸ Quick export ▸ 3D view renders the 3D view as a PNG (TachyonInternal, or a snapshot).