VMD-L Mailing List
From: Magnus Andersson (magnus.andersson_at_scilifelab.se)
Date: Fri Feb 15 2013 - 07:12:04 CST
- Next message: Sabine Reisser: "Licorice in transparent surface visualisation"
- Previous message: Axel Kohlmeyer: "Re: Dynamic bonds for amorphous silicon carbide?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi all,
I have tried to write a script that calculates residence times of a certain selection as per Alex Kohlmeyers suggestion earlier in the VMD mailiing list (http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/7697.html). However, I'm stuck. Basically, I want to end up with an output of indices as a fuction of number of hits (present in the selection). Here's an excerpt from my script - note that curly brackets might not be paired and parameters not defined (since this is part of a bigger script). I basically need help with how to structure the script to get the output I want (indeces and how many times these indices occur)
# initialize an array (i.e. fill it with zeroes) - one entry for each atom in the system
set atom [atomselect top all]
set allres [$atom num]
for {set i 0} {$i < $allres} {incr i} {
set hist($i) 0
}
# Build the required selection
set sel [atomselect top "name OH2 and same residue as within 10 of protein"]
# Create list of indices
set water [$sel list]
# Compare this list to the list of the previous frame (initialized to {} )
set restime 0
foreach object $water {
# If an index is new or present in the previous list increment the entry in the array: incr $hist($object)
# Else if an entry from the previous list is missing in the new the water has left
# so you store the info via: lappend restime $hist($object) in a list and reset the counter via. set hist($object) 0
if {$hist($object)==0} {
incr $hist($object)
lappend restime $hist($object)
} else {
set hist($object) 0
}
}
#now with the list in $restime, you can build a histogram or compute the average. voila.
# write out indices & number of hits
puts $idf "[$hist] [$restime num]"
Cheers /
Magnus
- Next message: Sabine Reisser: "Licorice in transparent surface visualisation"
- Previous message: Axel Kohlmeyer: "Re: Dynamic bonds for amorphous silicon carbide?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]