RE: running VMD from a script?

From: Samuel Flores (
Date: Mon Mar 21 2005 - 19:28:41 CST



Many thanks for your reply. I was able to successfully execute simple vmd
commands in batch mode, for which I am most grateful.


Can you tell me how to run Tk commands from a batch script? In interactive
mode I would choose Extensions -> Tk Console, and then type my Tk commands
into the TkCon window. However how would I do this from a shell script,
without having to use vmd interactively every time?





From: [] On Behalf
Of Nicolas Sapay
Sent: Monday, March 21, 2005 3:30 AM
To: Samuel Flores
Subject: Re: namd-l: running VMD from a script?


Dear Sam,
the easiest way is probably a shell script "" looking like this:
#! /bin/sh

tmpdir=`mktemp -d /tmp/nsapay_vmd_XXXXXX` || exit 1

echo "initial PDB structure .... $pdbstart"
echo "VMD script ............... $vmdin"
echo "output directory ......... $outdir"
echo "tmp directory ............ $tmpdir"

/usr/bin/vmd/vmd -dispdev none -e $vmdin -pdb $pdbstart -psf $psffile -args

cp -f $tmpdir/* $outdir
rm -f $tmpdir/*
rmdir $tmpdir
You can get the value of tmpdir in you vmd script using the argv list (i.e.
[lindex $::argv 0]). You can also put in argv all additional values that
are required in your script. Then, you can put your VMD commands in the VMD
input file and run the shell script, i.e. if you use a PBS server:
qsub -q batch -e vmd.e -o vmd.o -N VMD ./

if you want to run VMD several times, you can create a new shell script
"" where you put the qsub command in a loop
for ((i=1 ; i<10 ; i=$[i+1]))
       qsub -q batch -N vmdjob$i ./run_vmd$

Then, you just have to run to submit your jobs

Le lun 21/03/2005 à 01:22, Samuel Flores a écrit :

Howdy all,
Many thanks for the multiple responses I received about the tutorial files!
I have completed the tutorial, for which I am most grateful.
I'm wondering -- is it possible to run VMD commands from a shell script? Of
course, there exist tcl scripts, which can be run inside VMD with a few
mouse clicks, or perhaps by typing a command into the vmd console. But I'd
like to not have to do anything at all interactively, since I have batch
jobs that will have to be run 100 times with slight variations.
Any help will be much appreciated!

_ Nicolas Sapay ________________________ PhD student _

IBCP <> - Institut de
Biologie et Chimie des Protéines
Pôle Bio <> Inform
<> atique Lyonnais
<> - Gerland
>> 7, Passage du Vercors
69367 Lyon cedex 07, France
>> Tel : (33) (0)4 72 72 26 46
>> Fax : (33) (0)4 72 72 26 04

____________________________________ _


This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:40:37 CST