From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Thu Jun 27 2019 - 17:54:01 CDT

Hi Bart,

I'm not sure I understand your question. You mean would the colors respond as the trajectory is played? They should if you colored your atoms by the user field (Coloring Method = Trajectory->User->User), since again that can change from frame to frame, unlike something like occupancy or beta which are shared between frames. This won't be smooth though, since as the cluster identifier changes, the colors will switch instantaneously, which probably isn't the effect you are looking for.

-Josh

On 2019-06-27 15:47:31-06:00 Bart Bruininks wrote:

Heya Josh,
Thanks for the replay, would that also work upon sliding of the user window? The goal is to add it smoothly to the visual interphase to act as an extra layer of selection you can compare to.
Cheers,
Bart

Op do 27 jun. 2019 19:04 schreef Vermaas, Joshua <Joshua.Vermaas_at_nrel.gov<mailto:Joshua.Vermaas_at_nrel.gov>>:
Hi Bart,

There are two ways I can see this working. One is to use Tcl, and modify the user field for each atom to a numeric identifier for the cluster they belong to. Then you would color your trajectory by the user field, which can be updated per frame. Lets say you've written a text file with all your cluster identifications per frame, with one per line. I *think* something like this would do what you want.

#Setup. Read the file, set some initial variables
set sel [atomselect top "all"]
set fp [open "data.txt" r]
set file_data [read $fp]
close $fp
set frame 0
set data [split $file_data "\n"]
#Act on each line.
foreach line $data {
$sel frame $frame
#Assuming a space-delimited output format
set cluster [split $line " "]
$sel set user $cluster
#On the next line, apply to the next frame
incr frame
}

The other is with python, and would be more applicable if not every atom was assigned to a cluster, or if your data structure was oriented such that clusters only knew which atoms they contained. This requires a working python-enabled VMD installation. You would use the Molecule and MoleculeRep commands to create a distinct representation for each cluster at each frame, taking advantage of the ease of removing all representations through the python interface relative to the Tcl one.

-Josh

On 2019-06-27 10:04:57-06:00 owner-vmd-l_at_ks.uiuc.edu<mailto:owner-vmd-l_at_ks.uiuc.edu> wrote:

Heya,
I am currently working on some cool clustering scripts and what I would like to do is show the clustering in VMD. However, to do so, I need to be able to make an adaptive selection based on a full trajectory spanning cluster array (numpy) per atom e.g.:
[
  [frame 1
    atom1 1
    atom2 3
    atom3 1
  . ..
  ]
  [frame 2
    atom1 1
    atom2 2
    ...
  ]
]
I would like to use the atom clusters per frame as my selection and color them based on cluster name. However, this seems to be more complex then I had hoped. I do know some tcl etc so I could figure it out, I am just wondering what would be a wise path to take.
Cheers,
Bart Bruininks
MD Groningen (Martini)