From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Sat Mar 01 2008 - 06:49:32 CST

On Sat, Mar 1, 2008 at 4:02 AM, massimo camarda
<camarda.massimo_at_gmail.com> wrote:
> Hello,

hi massimo,

> I would like to ask if there is any basic but "self contained" tutorial for
> basic vmd scripting because
> I am having huge problems to start "from scratch".

this is understandable. since VMD embeds existing script interpreters
you have to start by learning the basics of those script languages first
and then can start with the VMD stuff. VMD embeds TCL and Python,
with TCL being the older and more commonly used script interpreter.
a very good tcl tutorial can be found on the tcl homepage, www.tcl.tk.
similar for python, www.python.org.

> I would like to make a script that load x molecules, change the
> representations for each selection and render the final image,
> it does not seam too difficult.

if the images should all be identical, i would suggest you create
one visualization to your liking and then use the 'Save State' option.
that will write a TCL script file that would recreate the visualisation
that you want. i would use that script as a starting point and e.g.
replace the filenames with variables and put a loop around it
that sets them to the required values, uses the render command to
create an image and then deletes the molecule again.
the details of the commands used in the saved state you can look
up in the VMD user's guide.

> But then, I cannot understand how to correctly change the representation. I
> select some atoms with atomselect command,

sorry, but building representations does not use atomselect.

> but I don't know how to change the representation of this selection, I
> should probably use the "set" command, but I cannot find a full
> description of this useful command.

set is part of TCL and atomselect is used differently. you can lookup
some of the VMD scripting tutorials to see how set and atomselect are used.

> Generally speaking it seams to me that this basic script knowledge is not as
> documented as it should be to allow for an "easy start".
> Or maybe is just me that didn't look in the right places :)

it is mainly the second thing. but if you see a way to improve the
existing documentation, please let us know and - ideally - give us
a hand. as any open source and mostly user supported project (there
is only one person, john, being paid to work on VMD and he's got a
lot of other things to do as well) getting/writing good documentation
or even tutorials is always a challenge and - in my opinion - better
done by beginners (and then reviewed by experts) as they know best
what other beginners need to know. an expert tends to write documentation
(out of habit) in a 'technical shorthand' that requires more knowledge than
would be needed and occasionally overlooks that certain things may be
trivial for him or her, but are not obvious to the beginner.

ciao,
    axel.

> Best regards and good work to everybody
>
> Ps. talking of bonds between atoms and informations : where I can find
> information about the pdb format or about any other file format that
> can be used with vmd and that specify the bonds? (I use xyz but it does not
> specify the bonds, I can easly make a program that detect all the bonds
> (I prefere to do it in fortran or c++ instead of vmd script) but I cannot
> find the format of the file to write.
>
>
>

-- 
=======================================================================
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.