From: Mike McCallum (mmccallum_at_PACIFIC.EDU)
Date: Sat Jun 30 2018 - 12:00:27 CDT

I made a small error typing this in the “foreach m..” The “$sel” should be “$all” (that is the way it is in my script):
foreach m [$all get mass] v [$all get {x y z}] id [$all get index] {

Cheers
Mike
On Jun 29, 2018, at 2:01 PM, Mike McCallum <mmccallum_at_PACIFIC.EDU<mailto:mmccallum_at_PACIFIC.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 and https://www-s.ks.uiuc.edu/Research/namd/mailing_list/namd-l.2015-2016/1064.html) which helps me do exactly that. My problem is that my selections are distance-based, so I need the regular DCD file to make those selections. I’m pretty much a novice at TCL, but what I’m trying to do is open two copies of the same system in VMD using the same PSF; a velDCD in molid 0, and a DCD in molid 1. I then use the [atomselect n (selection)] command. I’m having trouble figuring out how to pass the index from the DCD set to the velDCD set.

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






--
C. Michael McCallum
Professor
Department of Chemistry, UOP
mmccallum .at. pacific .dot. edu (209) 946-2636 v / (209) 946-2607 fax