RE: running VMD from a script?

From: Samuel Flores (samuel.flores_at_yale.edu)
Date: Mon Mar 21 2005 - 19:28:41 CST

Nicolas,

 

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?

 

Sam

 

  _____

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

 

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

tmpdir=`mktemp -d /tmp/nsapay_vmd_XXXXXX` || exit 1
pdbstart="$HOME/namd_projects/vmd_script/afile.pdb"
psffile="$HOME/namd_projects/vmd_script/afile.psf"
dcdfile="$HOME/namd_projects/vmd_script/afile.dcd"
vmdinput="$HOME/namd_projects/vmd_script/vmd.in"

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
$tmpdir

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 ./run_vmd.sh

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

Then, you just have to run batch.sh 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!
 
Sam
 

_ Nicolas Sapay ________________________ PhD student _

IBCP <http://www.ibcp.fr/IBCP/IBCP_new/home_index.html> - Institut de
Biologie et Chimie des Protéines
Pôle Bio <http://www.ibcp.fr/IBCP/IBCP_new/home_index.html> Inform
<http://www.ibcp.fr/IBCP/IBCP_new/home_index.html> atique Lyonnais
<http://www.ibcp.fr/IBCP/IBCP_new/home_index.html> - 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

____________________________________ n.sapay_at_ibcp.fr _

 

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