From: Axel Kohlmeyer (
Date: Thu Oct 28 2004 - 07:30:57 CDT

On Thu, 28 Oct 2004, angelo vargas wrote:

AV> hallo
AV> I am a new vmd user, and have some difficulty in the customization.
AV> I would like to change some default values, for example the drawing
AV> method from LINES to CPK, and such things as the sphere resolution.
AV> I have tried to add the line
AV> mol representation CPK
AV> in the .vmdrc file but it doesn't seem to work
AV> the manual suggests that the command mol shoud do the job but I am
AV> evidently missing something.
AV> Can anybody help?

dear angelo,

the behavior you describe could be desirable, but considering the way VMD
works internally, it also makes sense to re-initialize it with each
molecule load, or else you'd always get the latest used representation
from the previous molecule, i.e. a not very predictable behavior for
scripts. with large molecules this could be quite 'deadly'.

there is, however a workaround. the VMD/tcl scripting interface allows you
to define custom custom functions, that are run whenever a certain event
happens, and VMD provides a such an event handler for initializing a
structure, which happens on loading a new molecule.

so if you put the following code into your .vmdrc:

proc my_def_viz {args} {
   mol color Name
   mol representation CPK 0.8 0.2 20 15
   mol addrep top

trace variable vmd_initialize_structure(0) w my_def_viz
trace variable vmd_initialize_structure(1) w my_def_viz
trace variable vmd_initialize_structure(2) w my_def_viz


the first three molecules should be loaded with the
CPK representation with a 0.8 sphere radius, 0.2 bond radius,
20 sphere resolution, 15 bond resolution added.

the lines representation will be added later, so it cannot
be deleted here. this hack can probably optimized much
further and made much more robust. i noticed, though, that
you'll need a vmd-1.8.3 alpha version, to get the correct

best regards,

AV> thanks in advance
AV> Angelo

Dr. Axel Kohlmeyer   e-mail:
Lehrstuhl fuer Theoretische Chemie          Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53         Fax:   ++49 (0)234/32-14045
D-44780 Bochum
If you make something idiot-proof, the universe creates a better idiot.