Oops, this message and the original should have gone to the VMD mailing list and not Gromacs of course. My mistake, apologies for cluttering your inbox. :-)<br><br>-Nathan<br><br><div class="gmail_quote">On Thu, May 5, 2011 at 3:35 PM, J. Nathan Scott <span dir="ltr">&lt;<a href="mailto:scottjn@chemistry.montana.edu">scottjn@chemistry.montana.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello again, fellow gmx-users,<br><br>I finally found my coding error that only set the User data for the first half of the frames loaded, it was a simple indexing error after all. However, I would still *greatly* appreciate any assistance with speeding up the following loop:<div class="im">

<br>
<br>        for {set k 6} {$k &lt;= 141} {incr k} {<br>
        set prot [atomselect $mol_ID &quot;resid $k&quot; frame $j]<br>        set num [$prot num]<br>        $prot frame $j<br>        set user_list {}<br>        set u [lindex $efield [expr $k - 6]]<br>        for {set b 1} {$b &lt;= $num} {incr b} {<br>



           lappend user_list $u<br>        }<br>        $prot set user $user_list<br>        $prot delete<br>        }<br><br></div>Is there a simpler way to accomplish the task of assigning a single User value to individual residues without first atomselecting each one, getting its number of atoms, and then finally looping over the atoms to build a user_list? I&#39;m hoping that there is some better way to do this that I haven&#39;t thought of yet. My script runs very wonderfully except for this chunk.<br>


<br>Thanks in advance for any help you can provide,<br><font color="#888888"><br>-Nathan</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, May 4, 2011 at 11:06 AM, J. Nathan Scott <span dir="ltr">&lt;<a href="mailto:scottjn@chemistry.montana.edu" target="_blank">scottjn@chemistry.montana.edu</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br><br>I have written a script that does per-time-step coloring of the water molecules, residues, and ions in my protein based on electric field values I previously calculated. I received excellent help here a few months sorting out some problems with the script, but there is one big one remaining that I hope someone can help with.<br>



<br>The problem is that only half the frames (the first half) in my simulation are getting colored, and I can&#39;t figure out why. This happens no matter how many frames I load, whether the full trajectory or just a few hundred frames. For what it&#39;s worth, the machine I&#39;m running on has 12 GB of RAM, a very nice video card, and a new Xeon quad core processor, so I don&#39;t think this is an issue of system resources. At least I can see that there is still tons of free RAM when I am experiencing this issue.<br>



<br>Also, I would sincerely appreciate any advice on speeding up one of my loops. To color the water molecules and ions I can simply atomselect them all, and then loop through the values from the electric field data file for that timestep and assign the color value to a user list either 3 or 1 times respectively to color each atom. <br>



<br>However, for the residues in the protein I am having to atomselect them one at a time, get the number of atoms for that residue, and then do another loop to build a list of the correct length to assign the user values to each atom of the residue. Can anyone recommend a more efficient way of coloring the residues? When the residue coloring part of the script is stripped out it runs so much faster despite the fact that there are far fewer protein atoms than there are water or ion atoms, so I know this method of assignment is sluggish.<br>



<br>Please see the script below my signature, and thank you in advance for any advice you can provide.<br clear="all"><br>-- <br>----------<br>J. Nathan Scott, Ph.D.<br>Postdoctoral Fellow<br>Department of Chemistry and Biochemistry<br>



Montana State University<br><br><br><br><br>#######################################################################<br>set first 0;<br>set last 1000;<br>set mut wt;<br>set mut_ wt_;<br>set i $first; #i will be timestep/filename indicator,<br>



set j 0;<br><br>mol new /data/1stn/xtc/1stn_$mut.gro type gro waitfor all<br>mol addfile /data/1stn/xtc/1stn_$mut.xtc type xtc waitfor all first $first last $l$<br>set mol_ID top;<br>set n [ molinfo $mol_ID get numframes ];<br>



animate goto 0<br>animate delete  beg 0 end 0 skip 0 0<br>mol delrep 0 $mol_ID<br><br>while {$i &lt;= $last} {<br>        set fp [open &quot;/data/1stn/$mut/pd5/pd5.stripped/1stn_$mut_$i.pd5&quot; r]<br>        set file_data [read $fp]<br>



        close $fp<br><br>        set data [split $file_data &quot;\n&quot;]<br>        foreach {one} $data {<br>                lappend efield [lindex $one 3]<br>        }<br><br>### Looping through residues in the for loop,<br>



### selecting one residue at a time, getting its number of atoms,<br>### and then building a user value list for each of those<br>###  atoms in another for loop. <br><br>        for {set k 6} {$k &lt;= 141} {incr k} {<br>



        set prot [atomselect $mol_ID &quot;resid $k&quot; frame $j]<br>        set num [$prot num]<br>        $prot frame $j<br>        set user_list {}<br>        set u [lindex $efield [expr $k - 6]]<br>        for {set b 1} {$b &lt;= $num} {incr b} {<br>



           lappend user_list $u<br>        }<br>        $prot set user $user_list<br>        $prot delete<br>        }<br><br>### Water loop works well<br><br>        set wat [atomselect $mol_ID waters frame $j]<br>        $wat frame $j<br>



        set user_list {}<br>        for {set a 136} {$a &lt; 10233} {incr a} {<br>                set u [lindex $efield $a]<br>                lappend user_list $u $u $u<br>        }<br>        $wat set user $user_list<br>



        $wat delete<br><br>### Ion loop works well too<br><br>        set ions [atomselect $mol_ID ions frame $j]<br>        $ions frame $j<br>        set user_list {}<br>        for {set a 10233} {$a &lt; 10243} {incr a} {<br>



                set u [lindex $efield $a]<br>                lappend user_list $u<br>        }<br>        $ions set user $user_list<br>        $ions delete<br><br>        unset efield<br>        incr j 1<br>        incr i 2<br>



}<br><br><br><br>
</blockquote></div><br><br clear="all"><br>-- <br>----------<br>J. Nathan Scott, Ph.D.<br>Postdoctoral Fellow<br>Department of Chemistry and Biochemistry<br>Montana State University<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>----------<br>J. Nathan Scott, Ph.D.<br>Postdoctoral Fellow<br>Department of Chemistry and Biochemistry<br>Montana State University<br>