acemd | manual | plugins | resources | gallery | contact


ACEMD RESOURCES

Apply periodic boundary conditions

From VMD (http://www.ks.uiuc.edu/Research/vmd/plugins/pbctools/):

package require pbctools;
pbc set {51.2722 51.2722 51.2722} -all
pbc wrap -sel "not protein" -center "protein" -first first -last last

With the latest version of VMD, 1.8.7 (careful you should align only after wrapping):

pbc set {51.2722 51.2722 51.2722} -all
pbc wrap -center bb -centersel protein -compound res -all

Movie generation

Use the moviemaker plugin of VMD to generate jpeg images from a DCD trajectory for instance.

mencoder "mf://final.villin.*.jpg" -mf fps=25 -o output.avi \
         -ovc lavc -lavcopts vcodec=mpeg4:vqscale=3:bframe=1

This command

ffmpeg -i villin.%04d.ppm out.avi

works on ppm directly but generates worse quality movies (by default).

The h264 codec is the most efficient (and CPU-intensive) standard encoder. It's suggested by Vimeo. Binaries with x264 library compiled-in are required. Example (the last line reformats to HD, so Vimeo should preserve the high quality; crf sets the quality, lower is better)

mencoder "mf://final.villin.*.jpg" -mf fps=25   \
     -o output.avi -ovc x264 -x264encopts crf=20:bframes=1:threads=4 \
     -vf scale=-3:720,expand=1280:720,dsize=1280:720  

ffmpeg -i untitled.%04d.ppm [-s WWWxHHH] -threads 0 \
     -vcodec libx264 -vpre ipod640 out.avi

Option -s is needed if the video has strange width or height (you have to round them yourself).

Add a logo to a video

Use the following command (input and output formats are arbitrary)

ffmpeg -i in.mp4 -vcodec libx264 -threads 0 \
  -vhook '/shared/lab/software/ffmpeg/lib/vhook/watermark.so \
          -f /shared/lab/Media/logos/gpugrid_watermark_1280.png -m 2' \
  out.mp4

Install video tools

To install tools:

su -c 'rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm 
http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm'
yum install mencoder.x86_64
yum install ffmpeg.x86_64
yum install mplayer.x86_64

Concatenate DCD files (properly sorted)

Within VMD. Notes:

  • you may load any supported file, including pdb, coor etc.
  • use appendFrames to append to currently loaded frames

     source /shared/toni/scripts/loadDCD.tcl
     loadFrames xxx-*.dcd

On the shell

     ls -1 --sort=v 379-*.dcd | xargs catdcd -o 379.dcd 

Debug TCL scripts

The following definitions can be prepended before the TCL script in order to enable 'light' debugging (function calls).

    rename proc _proc
    _proc proc {name arglist body} {
        _proc $name $arglist [concat "proc_start;" $body ";proc_end"]
    }
    _proc proc_start {} {
        puts stderr ">>> ENTER PROC [lindex [info level -1] 0]"
        for {set level [expr [info level] -1]} {$level > 0} {incr level -1} {
            puts stderr "  LEVEL $level: [info level $level]"
        }
        puts stderr ""
    }
    _proc proc_end {} {
        puts stder ">>> LEAVE PROC [lindex [info level -1] 0]\n"
    }

The following functions can be added after the calcforces definition to enable very verbose (complete trace) debugging.

    proc tracer { a b } { puts "TRACE $b: $a" }
    trace add execution calcforces enterstep tracer

Generating subsets of PSF structures (eg for ptraj)

VMD can subset psf files. Ptraj can load psf files provided that they have "segid" defined.

    [atomselect top all] set segname [[atomselect top all] get fragment]
    animate write psf newfile.psf sel [ ... ]

Editing structures with AMBER topology

Editing structures generated by tleap can be tricky. The PDB file produced by tleap's savepdb is, in general, only usable for simulation. Whether modified by VMD or not, tleap won't read it back for re-creating the topology because of two problems: (a) duplicate atom names and (b) missing TER cards (if edited).

The easiest approach requires the pdb_ter output format for VMD (preinstalled in multiscale lab).

1. Load the prmtop and coor (or dcd) files. Do not load the pdb.

2. Edit it, and save the file (or selection) using the pdb_ter format.

3. Now it can be re-synthesized with tleap.

The pdb_ter output format is provided by a plugin which allows VMD to save a PDB file with TER cards between fragments. A fragment is defined as a connected component of the bond graph. For the plugin the work, the bond connectivity must be available, which usually means that one should have a psf or prmtop topology loaded in the molecule.

The pdb_ter output format (preinstalled in multiscale lab) is not yet available in vmd. To get it, download the vmd sources, compile the pdb_ter plugin source, and copy the generated pdbplugin.so into the following directory of your vmd installation: plugins/YOURARCH/molfile/pdbplugin_ter.so. It is not necessary to compile the whole vmd program; just the plugin is enough.

Useful quantities

  • 1kBT @ 295 K = 0.586 kcal/mol = 2.452 kJ/mol
  • 1 kcal = 4.184 J; 1 J = 0.2390 kcal
  • 1 L = 10^27 ³
  • Volume of 1 mol of H2O = 18/10³ L = 0.018 L; 1 L of H2O contains 10³/18 mol = 55 mol
  • Volume of 1 molecule of H2O = 2.99e-26 L = 29.9 ³
  • [X] (M) = no. of molecules of X / (no. of molecules of H2O/55.6) = no. of molecules of X / (1660 ³)
Copyright 2008-2009. All rights reserved.