acemd | manual | plugins | resources | change log | gallery | contact


ACEMD RESOURCES

Movie generation

Use the moviemaker plugin of VMD to generate jpeg images from a DCD trajectory for instance. The following commands output MPEG4, with DIVX tag, in AVI container. This should work on most computers. Please check.

in=villin
mencoder "mf://final.$in.*.jpg" -mf fps=25 -o $in.avi \
         -ovc lavc -ffourcc DIVX -lavcopts vcodec=mpeg4:vqscale=5

or

ffmpeg -i villin.%05d.ppm -q 5 -vtag DIVX villin.avi

which works on ppm directly. The factor "5" selects compression: smaller is better quality/larger file.

Experimental: 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)

in=villin
mencoder "mf://final.$in.*.jpg" -mf fps=25   \
     -o $in.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).

Windows media player compatibility

The following command lines produced AVI files that were playable with the default WinXP/SP2 installation of Windows Media Player:

  •  ffmpeg -i <inputfile.ext> -vcodec msmpeg4 -vtag MP43 -acodec libmp3lame <file.avi> 

    • This is the same as the infamous 'DIV3' DivX
  •  ffmpeg -i <inputfile.ext> -vcodec msmpeg4v2 -acodec mp3 <file.avi> 

    • use Microsoft MPEG-4v2 video
  •  ffmpeg -i <inputfile.ext> -vcodec wmv7 -acodec mp3 <file.avi> 

    • use Microsoft WMV7

Note that if you omit a specific '-acodec' audio coding format, FFmpeg will encode MP2 audio by default. This also works with the default WMP. Note also that MP3 encoding support is external to FFmpeg and must be configured appropriately.

Another compatible format that WMP can handle is vanilla MPEG. The command line:

  •  ffmpeg -i <inputfile.ext> <file.mpg> 

    • will create a MPEG file with MPEG-1 video and MP2 audio.

If you want to enable Windows to playback of any format inside Windows Media Player, Powerpoint, etc., install a recent ffdshow codec pack (open source).

Quicktime compatibility

The following command lines produced QuickTime files that were playable with Apple QuickTime Player v6.5.2:

  •  ffmpeg -i <inputfile.ext> <file.mov> 

  •  ffmpeg -i <inputfile.ext> <file.mp4> 

These command lines will produce MPEG-4 QuickTime files with ISO MPEG-4 video and AAC audio. Note that AAC encoding support is external to FFmpeg and must be configured appropriately.

Another compatible format that Apple's QuickTime Player can handle is vanilla MPEG. The command line:

  •  ffmpeg -i <inputfile.ext> <file.mpg>  

will create a MPEG file with MPEG-1 video and MP2 audio.

To encode in x264, use the following:

 ffmpeg -i file.avi -threads 0 -vcodec libx264 -vpre ipod640 out.mp4

Add the GPUGRID logo and title

Follow these steps.

  • Copy your video (in any format) in /shared/lab/Media/videos

  • Rename it in the format 2010_07_NAME.EXT
  • If you want a description, put it in a text file called 2010_07_NAME.txt
  • Call  bash autogen_all.sh 2010_07_NAME.EXT  from mio

You will find encoded and watermarked copies in HD_autogen and SD_autogen. These should be compatible with most systems.

Add a generic 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.

Copyright 2008-2011. All rights reserved.