VMD-L Mailing List
From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Fri Jun 29 2018 - 18:28:58 CDT
- Next message: Mike McCallum: "Re: distance-based selections applied to velDCD"
- Previous message: Mike McCallum: "distance-based selections applied to velDCD"
- In reply to: Mike McCallum: "distance-based selections applied to velDCD"
- Next in thread: Mike McCallum: "Re: distance-based selections applied to velDCD"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi Mike,
Your velocity variable (v) is coming from $sel, which is based on your coordinate DCD, so yeah, its doing the wrong thing. This is how I'd approach it:
set coordsel [atomselect 1 “sqr(x)+sqr(y)+sqr(z) <= sqr(30)”]
for { set frame 0 } { $frame < [molinfo 0 get numframes] } { incr frame } {
$coordsel frame $frame
$coordsel update
set velsel [atomselect 0 "index [$coordsel get index]" frame $frame]
set m [$velsel get mass]
set v [$velsel get {x y z}]
#Do what I need to do...
$velsel delete
}
I'm super puzzled by what you are trying to do though. What is so special about being 30 Angstroms from the center?
-Josh
On 2018-06-29 16:19:19-06:00 owner-vmd-l_at_ks.uiuc.edu wrote:
Hi there,
I am trying to apply a distance-based selection to a velocity DCD file. I’m calculating instantaneous temperature of a collection of molecules in my system, and I did find a TCL script posted (https://www-s.ks.uiuc.edu/Research/namd/mailing_list/namd-l.2013-2014/2915.html
set all [atomselect 0 all frame $frame]
set sel [atomselect 1 “sqr(x)+sqr(y)+sqr(z) <= sqr(30)” frame $frame]
…
The critical part of the temperature call is this foreach:
foreach m [$sel get mass] v [$sel get {x y z}] id [$sel get index] {
The index is the same between the two molids, of course, but it’s picking out the positions from the DCD rather than the velocities from the velDCD.
I can guess that I need to use the ‘id [$sel get index]’ to create a list of the IDs, and then I could loop over those ids, but they will be non-consecutive. Should I just do that and then test to skip the non-pertinent ones? Or loop over all, and test to see if they satisfy the query?
Is there an elegant way to include the index in the selection query, in the ‘foreach m…’ statement?
TIA
Mike
--
C. Michael McCallum
Professor
Department of Chemistry, UOP
mmccallum .at. pacific .dot. edu (209) 946-2636 v / (209) 946-2607 fax