From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri Aug 28 2009 - 16:14:00 CDT

On Fri, 2009-08-28 at 12:40 -0300, Urahata wrote:
> Dear VMD-L,

dear sergio,

> I have another question regarding the "user field" coloring option in VMD.
>
> After post-processing simulation data, a list of real
> numbers were saved in the "beta" field of a regular PDB file.
> At the time I mistakenly assumed that the coloring method would
> be updated in a per frame basis. After going through the mailing list,
> I found a few discussions suggesting the use a external
> file to be loaded (via script) in the "user" field but somehow it is not clear
> for me how to format this file.

since the file has to be parsed "manually",
it doesn't really matter. all that is required is
that you can read it with tcl and extract the data
that you want to assign to the user (or user1, user2, user3)
field.

> If the PDB file has, let's say, 100 atoms and 20 frames, is it
> ok to define a single column file containing 2000 lines (without
> white spaces or any other character between frames) to be loaded
> in the "user" field ?

yes. however the easiest to program way would be to
write all 100 values for the 100 atoms into one line.

the script code to read this would be something like this:

set mol [mol new trajectory.pdb waitfor all]

set sel [atomselect $mol all]
set nf [molinfo $mol get numframes]
set fp [open user.dat r]
set line ""

for {set i 0} {$i < $nf} {incr i} {
  gets $fp line
  $sel frame $i
  $sel set user $line
}

close $fp
$sel delete

>
> Thanks,
>
> Sergio
>
> Obs. Since all values are already in the "beta" column, would it be
> possible to transfer them to the "user" field ? If not, I will just
> extract the column to a external file using awk...

not directly, you'd have to split the file and then collect
the data from the various molecules. using awk or sed or perl
or cut is simpler.

cheers,
   axel.

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com 
Research Associate Professor
Institute for Computational Molecular Science
College of Science and Technology
Temple University, Philadelphia PA, USA.