From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Mon Feb 23 2009 - 10:20:55 CST

On Mon, 23 Feb 2009, maria goranovic wrote:

MG> Thank you for the tips, Axel.

you're welcome. and thanks for asking a "proper" question now. ;-)

MG> I load a pdb file in VMD, and then I try to run play myscript where myscript
MG> is essentially a set of vmd commands, which also reads in a specific
MG> trajectory file called file.dcd. What I want to do is replace file.dcd by a
MG> variable like $file.
MG>
MG> >From the vmd console on the GUI, this does not work:
MG>
MG> play myscript -args file.dcd

the play command has no -args option. that is a _very_ different
entity than using -args from the command line.

MG> Usually something like this works for a vmd script, but running from the
MG> unix console
MG> *
MG> *vmd -dispdev text -args file.dcd
MG>
MG> I hope that clarifies the question?

yep. well, as i was saying before. you can always do

set env(MYARG) "somefilename.dcd"
play yourscript.tcl

and then access the data as $env(MYARG).
you can also always declare global veriables
or use the uplevel/upvar features of TCL.
you just need to look it up in a TCL book/reference.

the env hack also works from the command line as, e.g.

env MYARG="somefilename.dcd" vmd -e yourscript.tcl

this has the advantage that it also would work on
filenames with blanks, as windows junkies tend to
to produces occasionally, on which the csh startup
script fails.

cheers,
   axel.

MG>
MG> -Maria
MG>
MG> On Mon, Feb 23, 2009 at 4:08 PM, Axel Kohlmeyer <akohlmey_at_cmm.chem.upenn.edu
MG> > wrote:
MG>
MG> > On Mon, 23 Feb 2009, mariagoranovic_at_gmail.com wrote:
MG> >
MG> > MG> Hi,
MG> > MG>
MG> > MG> Is it possible to pass arguments to the play or source command if one
MG> > is
MG> > MG> running a script from the vmd console ? -args does not work
MG> >
MG> > yes, it is possible, and -args works just fine, only that it may
MG> > not work the way you use it. but since you don't describe what
MG> > you did and how it failed, there is little possibility to help you.
MG> >
MG> > since it hasn't been posted on this list in a while, it might help
MG> > people in general to first have a look at this document before posting
MG> > questions.
MG> >
MG> > http://www.catb.org/~esr/faqs/smart-questions.html>
MG> >
MG> > the general rule is: the better the question, the better the answer.
MG> >
MG> > cheers,
MG> > axel.
MG> >
MG> > MG>
MG> >
MG> > --
MG> > =======================================================================
MG> > Axel Kohlmeyer
akohlmey_at_cmm.chem.upenn.edu http://www.cmm.upenn.edu
MG> > Center for Molecular Modeling -- University of Pennsylvania
MG> > Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
MG> > tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel: 1-215-898-5425
MG> > =======================================================================
MG> > If you make something idiot-proof, the universe creates a better idiot.
MG> >
MG>
MG>
MG>
MG>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.