This plugin provides procedures to handle periodic boundary conditions, i.e. to set and get the unitcell parameters, to wrap atoms into the central image, to unwrap atoms when they have been wrapped, and to draw the unit cell vectors. All of the procedures are able to handle non-rectangular periodic boundary conditions and changes of the unitcell parameters over time (as for example in constant pressure simulations).
pbctools
To use the plugin, put
package require pbctoolsinto your Tcl-script or VMD startup file. All of the plugin's functions can be accessed via the Tcl text command
pbc subcommand. When no subcommand is provided, a short help message will be printed.
pbc subcommand [options...]
set cell [options...] |
Set the VMD unit cell properties. |
readxst xstfile [options...] |
Read the VMD unit cell properties from an XST file. |
get [options...] |
Get the VMD unit cell properties. |
wrap [options...] |
Wrap atoms into a single unit cell. |
unwrap [options...] |
Unwrap atoms so that no wrapping occurs over a series of frames. |
join compound [options...] |
Joins compounds (residues, chains, segments, or bonded atoms) that have been split due to wrapping around the unit cell boundaries, so that they are not split anymore. |
box [options...] |
(Re)Draws an automatically updateing box that shows the boundaries of the unit cell. |
box_draw [options...] |
Draws a static box that shows the boundaries of the unit cell. |
pbc set cell [options...]
-molid molid|top |
Which molecule to use (default: top) |
-first frame|first|now |
The first frame to use (default: now) |
-last frame|last|now |
The last frame to use (default: now) |
-all|-allframes |
Equivalent to -first first -last last |
-now |
Equivalent to -first now -last now |
-namd|-vmd |
Format of the unit cell parameters. When -vmd is used, a parameter set must be a list of the VMD unitcell parameters a, b, c and optionally alpha, beta, gamma for non-rectangular unitcells. When -namd is used, a parameter set must contain the three unit cell vectors A, B and C. (default: -vmd) |
-alignx|-noalignx |
If the format NAMD is used, alignx is given and the unit cell vector A is not parallel to the x-axis, the system will be rotated so that it is. If noalignx is given, the function will return with a warning. |
pbc set {10.0 10.0 10.0} -all
pbc readxst xstfile [options...]
-molid molid|top |
Which molecule to use (default: top) |
-first frame|first|now |
The first frame to use (default: first) |
-last frame|last|now |
The last frame to use (default: last) |
-all|-allframes |
Equivalent to -first first -last last |
-now |
Equivalent to -first now -last now |
-stride stride |
Read only every stride-th timestep from the file. (default: 1) |
-skipfirst|-noskipfirst |
Whether to skip the first line of the file, or not (default: -skipfirst for XST files, -noskipfirst for XSC files) |
-step2frame num |
Conversion factor between step num in XST file and frame num in DCDs (useful when loading multiple XSTs and want to avoid over-writing info of earlier frames by having a unique mapping between step and frame. |
-alignx|-noalignx |
If alignx is given and the unit cell vector A is not parallel to the x-axis, the system will be rotated so that it is. If noalignx is given, the function will return with a warning. |
-log log |
Log for debugging information. |
pbc readxst system.xst
pbc get [options...]
-molid molid|top |
Which molecule to use (default: top) |
-first frame|first|now |
The first frame to use (default: now) |
-last frame|last|now |
The last frame to use (default: now) |
-all|-allframes |
Equivalent to -first first -last last |
-now |
Equivalent to -first now -last now |
-namd|-vmd |
Format of the unit cell parameters. When -vmd is used, a parameter set will contains the VMD unitcell parameters a, b, c, alpha, beta, gamma. When -namd is used, a parameter set contains the three unit cell vectors A, B and C. (default: -vmd) |
-[no]check |
Check whether the unit cell parameters seem reasonable, i.e. whether the side lengths are not too small and the angles are not very small or very large. |
pbc get -now
pbc wrap [options...]
-molid molid|top |
Which molecule to use (default: top) |
-first frame|first|now |
The first frame to use (default: now) |
-last frame|last|now |
The last frame to use (default: now) |
-all|-allframes |
Equivalent to -first first -last last |
-now |
Equivalent to -first now -last now |
-parallelepiped|-rectangular |
Wrap the atoms into the unitcell parallelepiped or the corresponding rectangular box with the same volume and center as the (nonorthogonal) unitcell. The unitcell displacement vectors are not changed. (default: -parallelepiped) |
-sel sel |
The selection of atoms to be wrapped (default: all). |
-nocompound|-compound res[idue]|seg[ment]|chain |
Defines, which atom compounds should be kept together, i.e. atoms will not be wrapped if a compound would be split. (default: residue) |
-nocompoundref|-compoundref refsel |
When compounds have been defined via the -compound option, this defines a reference selection of atoms. After the wrapping, at least one of the atoms in this selection will be in the central image. This can be useful, for example, when water molecules should be wrapped such that the oxygen atom ends up in the central image. (default: -norefsel) |
-center origin|unitcell|sel |
Set the center of the wrapping cell to the origin, to the center of the unit cell or to the center of the enclosing box of a given selection sel. (default: unitcell) |
-shiftcenter shift |
Shift the center of the wrapping cell by shift. shift has to be a list of three numerical values. (default: {0 0 0}) |
-shiftcenterrel shift |
Shift the center of the wrapping cell by shift (in units of the unit cell vectors). $shift has to be a list of three umerical values. (default: {0 0 0}) |
-verbose |
Increase verbosity of the function (for debugging). (default: off) |
-draw|-nodraw |
Draw some test vectors (for debugging). (default: -nodraw) |
pbc wrap -rectangular -shiftcenterrel {0.5 0.5 0.5}
pbc unwrap [options...]
-molid molid|top |
Which molecule to use (default: top) |
-first frame|first|now |
The first frame to use (default: now) |
-last frame|last|now |
The last frame to use (default: now) |
-all|-allframes |
Equivalent to -first first -last last |
-now |
Equivalent to -first now -last now |
-sel sel |
The selection of atoms to be unwrapped (default: all). |
-verbose |
Increase verbosity of the function (for debugging). (default: off) |
pbc join compound [options...]
-molid molid|top |
Which molecule to use (default: top) |
-first frame|first|now |
The first frame to use (default: now) |
-last frame|last|now |
The last frame to use (default: now) |
-all|-allframes |
Equivalent to -first first -last last |
-now |
Equivalent to -first now -last now |
-sel sel |
The selection of atoms to be unwrapped (default: all). |
-noref|-ref refsel |
This defines a reference selection of atoms. When joining compounds, the first atom matching the selection in each compound will be chosen, and all atoms will be wrapped into a unit cell around this atom. If noref is given, the first atom in the compound is the reference atom. (default: -noref) |
-verbose |
Increase verbosity of the function (for debugging). (default: off) |
pbc box [options...]
-molid molid|top |
Which molecule to use (default: top) |
-on|-off|-toggle |
Turn the box on, off, or toggle. (default: on) |
-parallelepiped|-rectangular |
Draw the box as a parallelpiped, or as the corresponding rectangular box. (default: -parallelepiped) |
-color color |
Draw the box in color color. (default: blue) |
-style lines|dashed|arrows|tubes |
Choose the style of the box (default: lines). |
-width width |
Define the width of the lines/arrows/tubes (default: 3). |
-resolution res |
Use resolution faces for the tube style (default: 8). |
-center origin|unitcell|sel |
Set the center of the box to the origin, to the center of the unit cell or to the center of the enclosing box of a given selection sel. (default: unitcell) |
-shiftcenter shift |
Shift the center of the box by shift. shift has to be a list of three numerical values. (default: {0 0 0}) |
-shiftcenterrel shift |
Shift the center of the box by shift (in units of the unit cell vectors). $shift has to be a list of three umerical values. (default: {0 0 0}) |
pbc box -center unitcell
pbc box_draw [options...]or
draw molid pbcbox [options...]
# draw a box around the central image set box0 [pbc box_draw -shiftcenterrel { 0 0 0 }] # draw a box around the cenral image shifted by the unit cell vector C set box1 [pbc box_draw -shiftcenterrel { 0 0 1 }]
pbctools
plugin.
pbc join
.wrap
, unwrap
and join
have
an option -verbose
for verbose output. Furthermore, the
functions report their progress while they work.pbctools
plugin.