From: John Stone (johns_at_ks.uiuc.edu)
Date: Sun Apr 15 2007 - 01:14:52 CDT

Hi,
  Which version of VMD are you using? There was previously
a small memory leak in the "sidechain" selection which is fixed
in VMD 1.8.6. If you're not using VMD 1.8.6, I would recommend
upgrading since you're using "sidechain" in your selections and
this may be related to the memory consumption you're observing.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Sun, Apr 15, 2007 at 01:54:48AM -0400, Guo Zhi wrote:
> Hi all, I am trying to use a script to do statistics on sidechain
> contact in the whole trajectory. Since the MD trajectory were yielded
> by a home-made MD program which uses only one united atom for each
> sidechain, the selection code might looks a little strange. Well, the
> script seem to produce the right result, but the memory usage
> coninuously grow up which implies certain memory leakage. I check the
> code for several times(mainly the "atomselect" sentences) and still
> can not find any where that cause this problem. Would anyone of you
> bother to look into this and give me some help?
>
>
> ########### Code for sidechain contact statistics ########
>
> set frame_no [molinfo top get numframes]
> set res_set [lsort -increasing {"ASN" "HIS" "VAL" "THR" "LEU" "SER" "GLN"}]
> set file_id [open "contact.dat" w]
>
> set sel_all [atomselect top all]
> set res_leng [llength [lsort -unique [$sel_all get resid]]]
>
> for {set m 0} {$m<$frame_no} {incr m} {
> puts $file_id "Frame $m:"
> set all_contact {}
> for {set i 0} {$i<$res_leng} {incr i} {
> set tmp_sel [atomselect top "(sidechain or (not protein)) and
> (exwithin 6.5 of ((resid $i) and (sidechain or (not protein))))" frame
> $m]
>
> set contact_res [$tmp_sel get resid]
> foreach ele $contact_res {
> set ele_contact $i
> lappend ele_contact $ele
> set ele_contact [lsort -increasing $ele_contact]
> lappend all_contact $ele_contact
> }
>
> $tmp_sel delete
> }
>
> set short_contact [lsort -unique $all_contact]
> foreach ele_short $short_contact {
> set ele_name [atomselect top "(resid $ele_short) and (name
> CA)"]
> set pos [lsearch -exact $short_contact $ele_short]
> set short_contact [lreplace $short_contact $pos $pos [lsort
> -increasing [$ele_name get resname]]]
> $ele_name delete
> }
>
> # initialize matrix
>
> set matrix {}
>
> for {set j 0} {$j<28} {incr j} {
> lappend matrix 0
> }
>
> foreach ele_short $short_contact {
> set count 0
> for {set j 0} {$j<7} {incr j} {
> for {set k $j} {$k<7} {incr k} {
> if {[lindex $ele_short 0]==[lindex $res_set
> $j]} {
> if {[lindex $ele_short 1]==[lindex
> $res_set $k]} {
> # Now set matrix element
> set new_ele [expr [lindex
> $matrix $count]+1]
> set matrix [lreplace $matrix
> $count $count $new_ele]
> }
> }
> incr count
> }
> }
> }
>
> puts $file_id $matrix
> }
>
> $sel_all delete
> close $file_id

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078