From: sunyeping (sunyeping_at_aliyun.com)
Date: Tue Dec 30 2014 - 19:13:35 CST

Dear Brain,Thank you for your reply. The script is workable now. variable b is set after  "foreach water $waters {"; the result of lsort should be assigned to another variable and use the option -real: set t1  [lsort -real $t]; the first element should be the minimum of the list t1, so "set min [lindex t1 0]. Yeping Sun Institute of Microbiology, Chinese Academy of Sciences ------------------------------------------------------------------发件人:Bennion, Brian <bennion1_at_llnl.gov>发送时间:2014年12月31日(星期三) 01:47收件人:vmd-l <vmd-l_at_ks.uiuc.edu>主 题:RE: vmd-l: a script to count the frames in which some water molecules interact with selected protein atoms P {margin-top: 0;margin-bottom: 0;} Where do you set the variable b? Brian From: owner-vmd-l_at_ks.uiuc.edu [owner-vmd-l_at_ks.uiuc.edu] on behalf of sunyeping [sunyeping_at_aliyun.com] Sent: Monday, December 29, 2014 10:39 PM To: vmd-l Subject: vmd-l: a script to count the frames in which some water molecules interact with selected protein atoms Dear all,  I compsed the follow script to count the frames in which some water molecules interact with selected protein atoms set n [molinfo top get numframes] set pockect_A [atomselect top "segname P1 and resid 7 45 59 63 66 69 159 171"] set a [$pockect_A get index] set wat1 [atomselect top "segname WT1 and resid 2828"] set wat2 [atomselect top "segname WT1 and resid 8173"] set wat3 [atomselect top "segname WT4 and resid 2284"] set wat4 [atomselect top "segname WT4 and resid 6029"] set wat5 [atomselect top "segname WT5 and resid 2201"] set wat6 [atomselect top "segname WT7 and resid 8622"] set waters [list $wat1 $wat2 $wat3 $wat4 $wat5 $wat6] set file [open count_frame_water.dat w] set loop_count 0 foreach water $waters { incr loop_count puts -nonewline $file water$loop_count for {set i 0} {$i<$n} {incr i} { foreach ai $a { foreach bj $b { lappend t [measure bond "$ai $bj" frame $i] } } lsort -decreasing $t; set max [lindex $t 0] if { $max<=3.5} { puts -nonewline $file $i } puts $file \n } } close $file It cannot work properly. It seems that the foreach loop of  foreach water $waters is carried inly once. Could you check it and find what are the faults of it? Thanks in advance. Yeping Sun Institute of Microbiology, Chinese Academy of Sciences