VMD-L Mailing List
From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Thu Jun 27 2019 - 12:04:01 CDT
- Next message: Vermaas, Joshua: "RE: Adaptive real time selection and coloring in default display"
- Previous message: Giacomo Fiorin: "Re: Adaptive real time selection and coloring in default display"
- In reply to: Bart Bruininks: "Adaptive real time selection and coloring in default display"
- Next in thread: Vermaas, Joshua: "RE: Adaptive real time selection and coloring in default display"
- Maybe reply: Vermaas, Joshua: "RE: Adaptive real time selection and coloring in default display"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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 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)
- Next message: Vermaas, Joshua: "RE: Adaptive real time selection and coloring in default display"
- Previous message: Giacomo Fiorin: "Re: Adaptive real time selection and coloring in default display"
- In reply to: Bart Bruininks: "Adaptive real time selection and coloring in default display"
- Next in thread: Vermaas, Joshua: "RE: Adaptive real time selection and coloring in default display"
- Maybe reply: Vermaas, Joshua: "RE: Adaptive real time selection and coloring in default display"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]