From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Sun Mar 09 2008 - 15:49:17 CDT

On Sun, 9 Mar 2008, Christopher Stiles wrote:

CS> *Sorry if this has posted twice I looked though the list and it did not seem
CS> to have gone through,*
CS>
CS>
CS>
CS> I have been trying to come up with a script for radial density over the
CS> whole run but it have been just giving me zeroes, if some one could take a
CS> quick look at let me know if any errors catch there eye right away that
CS> would be great.

it looks to me, that you don't factor in that the variables
in the selection string are expanded while defining the selection,
so changing them later will not change the selection. you'll have
to create (and delete) a selection for each area.

that being said, it would probably be much more efficient
(and much more readable) if you simply create a selection for
all relevant water molecules (BTW: you should select only the
water oxygens or else you have 3 entries per water and they may
not be into the same slot) then do a $sel frame $i and $sel update
and then $sel get {x y z} and operate on the resulting list of
coordinates directly.

cheers,
   axel.

CS>
CS>
CS>
CS> Please note that as of now I am just trying to get it to run over one frame,
CS> looping is not a problem.
CS>
CS>
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #Put following code into the Tk console
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> set nt [atomselect top "resid 1"]
CS>
CS> set NT_min [lindex [lindex [measure minmax $nt] 0] 2]
CS>
CS> set NT_max [lindex [lindex [measure minmax $nt] 1] 2]
CS>
CS> set x_0 [lindex [measure center $nt] 0]
CS>
CS> set y_0 [lindex [measure center $nt] 1]
CS>
CS> set step 0.25
CS>
CS> set num_frames [molinfo top get numframes]
CS>
CS> set Inner_limmit 0
CS>
CS> set Outer_limmit 0
CS>
CS>
CS>
CS> set numb {0}
CS>
CS> set x 1
CS>
CS> set y 0
CS>
CS> for {set i 1} {$i < 1000} {incr i} {
CS>
CS> set y "[expr $i + $x]"
CS>
CS> set numb [linsert $numb $y 0]
CS>
CS> }
CS>
CS>
CS>
CS> llength $numb
CS>
CS>
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #Put following code into the black VMD command window
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS>
CS>
CS> set wat_sel [atomselect top "water and (z > $NT_min and z < $NT_max and
CS> sqrt((x-$x_0)*(x-$x_0) + (y-$y_0)*(y-$y_0)) <= $Outer_limmit and
CS> sqrt((x-$x_0)*(x-$x_0) + (y-$y_0)*(y-$y_0)) > $Inner_limmit)"]
CS>
CS>
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #Put following code into the Tk console
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS>
CS>
CS> for {set j 0} {$j < 1000} {incr j} {
CS>
CS> set Inner_limmit "[expr $j*$step]"
CS>
CS> set Outer_limmit "[expr $j*$step + 1*$step]"
CS>
CS> lreplace $numb $j $j "[expr [lindex $numb $j] + [$wat_sel num]]"
CS>
CS> }
CS>
CS>
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #this last bit of code should of stored density of water of the box in
CS> relation to the center of the box in the "numb" list.
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS> #*****************************************************************
CS>
CS>
CS>
CS> The following are links to the files I use.
CS>
CS> http://www.cs86.com/CNSE/SWNT/post_part7/SWNT_6_6_144_b4em.gro
CS>
CS> http://www.cs86.com/CNSE/SWNT/post_part7/traj.trr
CS>
CS>
CS>
CS> Thank you very much!
CS>
CS> ~Christopher Stiles
CS>
CS> College of Nanoscale Science and Engineering (CNSE)
CS>
CS> State University of New York, Albany, New York 12203, USA
CS>
CS>
CS>
CS>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.