Scope and usageStarting with VMD version 1.8.7 it is now possible to store the complete topology information, i.e. not only bonds, but also angle, dihedral, and improper definitions as well as their force field type labels (if available). This now allows to do a large variety of modifications to topology data or even building topologies from scratch. The focus lies hereby on being able to perform many operations manually or scripted and thus being less focused on and optimized for biomolecules like psfgen. In combination with the new command The underlying Tcl script API in VMD itself had been designed to be minimalistic, since most operations are not computationally demanding and could be programmed with scripting. The topotools packages is supposed to provide a middleware, i.e. more powerful and easy to use script commands that make combine multiple low lever commands in a way to solve common tasks conveniently and efficiently. Finally topotools also contains some utilities and applications for more complex operations like combining multiple molecules (=different files) or multiple selections into one new molecule, or building larger systems by replicating a given unitcell. VersionThis documentation always describes the latest version of topotools available from this homepage. Main command interfaceThis is the middleware part of the package that provides abstract operations on top of the low-level API. This is modeled after the example of the internal topo <command> [args...] <flags>Common flagsThe following flags can be passed on to all subsequent
The following flags can be added to subsequently documented operations on bonds. Bond information is treated and stored differently from angles, dihedrals, and impropers in VMD, since bond information is used for visualization and the others not. This also results in performance differences in commands operating on the two groups.
numatomsReturns the number of atoms. numatomtypesReturns the number of atom types as determined from the atomtypenamesReturns the list of unique atom types names. The list has guessatom <property> <from>Resets per atom data through selected heuristics. This is most useful to recover some data when using a file format that doesn't set contain these properties, or when they cannot be reliably determined, so the user should choose which ones work. The following combinations are supported:
numbondsReturns the number of bonds. numbondtypesReturns the number of unique bond types. bondtypenamesReturns a list of all unique bond types. The list has clearbondsDelete all bonds. retypebondsAssign new bond types composed of the atom type strings connected with a '-' character. Bond types are canonicalized so that the atom type with the lower dictionary sort value will be placed on the left and the other on the right. addbond <id1> <id2>Defines a bond bone between the two specified atoms. This does nothing if one of the two atom indices is outside the selection. You can specify the bond type and order via the optional flags delbond <id1> <id2>Deletes a bond between the two specified atoms. This does nothing if the bond does not exist or one of the two atom indices is outside the selection. getbondlist [type|order|both|none]Returns a list of unique bonds, the individual bond is a list of the atom indices forming the bond and optionally added the bond type name and/or the bond order value. setbondlist [type|order|both|none] <list>Defines bonds from a list in a format as returned by num(angle|dihedral|improper)sReturns the number of angles, dihedrals, or impropers. num(angle|dihedral|improper)typesReturns the number of unique angle-, dihedral-, or improper-types. (angle|dihedral|improper)typenamesReturns a list of all unique angles, dihedrals, or impropers. The list has clear(angle|dihedral|improper)sDeletes the currently defined angles, dihedrals, or impropers. sort(angle|dihedral|improper)sSorts and canonicalizes the list of angles, dihedrals, or impropers. Duplicates are removed and the list is sorted by atom types. retype(angle|dihedral|improper)sAssign new angle, dihedral, or improper types composed of the atom type strings connected with a '-' character. The resulting types are canonicalized and sorted. guess(angle|dihedral)sGuess angle or dihedral definitions from the bond topology. An angle is defined by two bonds sharing an atom and a dihedral by two bonds sharing a bond. Types are assigned in the same way as in the corresponging retype command. guessimproper [tolerance <degrees>]Guess improper angles. Are defined for atoms that are bonded to exactly 3 atoms when they form a near flat structure. The addangle <type> <id1> <id2> <id3>Defines an angle of type delangle <id1> <id2> <id3>Deletes an angle between the three specified atoms. Does nothing if not all three atom indices are contained within the given selection (default 'all'). getanglelistReturns a list of defined angles with each entry in the format setanglelist <list>Resets the angle definitions from a list in a format as returned by adddihedral <type> <id1> <id2> <id3> <id4>Defines a dihedral or improper of type deldihedral <idx1> <id2> <id3> <id4>Deletes the dihedral or improper between the four specified atoms. Does nothing if not all four atom indices are contained within the given selection (default 'all'). addimproper <type> <id1> <id2> <id3> <id4>Defines a dihedral or improper of type delimproper <id1> <id2> <id3> <id4>Deletes the dihedral or improper between the four specified atoms. Does nothing if not all four atom indices are contained within the given selection (default 'all'). get(dihedral|improper)listReturns a list of defined dihedrals or impropers with each entry in the format set(dihedral|improper)list <list>Resets the dihedral or improper definitions from a list in a format as returned by File I/O CommandsTopoTools provides a number of file I/O commands that contrast from the molfile plugins in such that they use Tcl scripting to read and write files. This provides additional flexibility and allows to easily pass flags to the reader or writer, that are not available in the molfile plugin API, however, it may also results in reduced reading performance. All of the file I/O commands also use the topo prefix and support the commonly supported optional flags for specifying molecule id and atom selection. readlammpsdata <file name> [<atom style>]Read in atom coordinates, properties, bond, angle, dihedral and other related topology info from a LAMMPS data file, i.e. a file suitable for the writelammpsdata <file name> [<atom style>]Write out atom coordinates, properties, bond, angle, dihedral and other related topology info stored inside VMD to a LAMMPS data file, i.e. a file suitable for the readvarxyz <file name>Read in an xyz-format trajectory file (in xmol style) with a varying number of atoms per frame. This format is normally not supported in VMD and the script circumvents the restriction by automatically adding a sufficient number of dummy particles. Whether an atom is actually present in a given frame or not is flagged by the value of the corresponding writevarxyz <file name> [selmod <sel>] [first|last|step <frame]Write out an xyz-format trajectory file with a varying number of atoms per frame. This is the counterpart to the readvarxyz subcommand. The optional selection string defines how atoms for each frame have to be selected. If not given, as selection string of "user > 0" is assumed.
writegmxtop <file name>Write a "fake" gromacs topology file that can be used in combination with a .gro or .pdb file to generate a .tpr file, which is needed for some of the more advanced gromacs analysis tools in order to analyze trajectories that were not generated with gromacs. This file is in no way suitable to start a simulation. Utility FunctionsThese are useful and convenient tools written on top of the topotools API. You can access them directly with their mergemols <list of molecule ids>Combines multiple separate molecules into one file. This is non-destructive and will create a new molecule. The molecule id of the new molecule is returned, or -1 in case of a failure. Usage example: package require topotools 1.1# load to be merged molecules into VMDset midlist {}
set mol [mol new part1.psf waitfor all]mol addfile part1.pdblappend midlist $mol
set mol [mol new part2.psf waitfor all]mol addfile part2.pdb
lappend midlist $mol # do the magicset mol [::TopoTools::mergemols $midlist]animate write psf merged.psf $mol animate write pdb merged.pdb $mol
selections2mol <list of atom selections>This is very similar to the previous package require topotools 1.1set sellist {}set sel [atomselect 0 protein]lappend sellist $sel set sel [atomselect 0 protein]$sel frame 200 $sel moveby {50.0 50.0 0.0}lappend sellist $selset sel [atomselect 1 "same residue as (within 3.0 of chain L)"]lappend sellist $sel# do the magicset mol [::TopoTools::selections2mol $sellist]animate write psf combinedsel.psf $molanimate write pdb combinedsel.pdb $molreplicatemol <mol> <nx> <ny> <nz>Replicate the current unitcell according to integer replicate counts. This currently assumes an orthorhombic cell. Usage example: package require topotools 1.2 # load a moleculeset mol [mol new pegc12e8-small.xml type hoomd waitfor all]# do the magicset newmol [::TopoTools::replicatemol $mol 2 2 1 ]animate write hoomd replicated.xml $newmol |