• ## Outreach

From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Thu Aug 09 2007 - 09:23:39 CDT

On Thu, 9 Aug 2007, Christopher Stiles wrote:

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.
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>
CS>
CS> set num_frames [molinfo top get numframes]
CS>
CS> set x_list {}
CS>
CS> set y_list {}
CS>
CS> set step_size 7.5
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) + (y*y)) < \$NT_radius and sqrt((x*x) + (y*y)) > \$NT_radius_old)"]

so the selection is always empty. vmd selections texts do not allow
to refer tcl variables (they can be called from python, too!).
...and in a string with " " variables are always expanded right away.

it may actually be easier to do a selection of water within
a maximum distance of the nanotube and then simply compute
a histogram over all distances. similar to the (spherical) g(r)

also, i suggest you count only the water oxygens. the
selection 'water' with count all atoms within the selection
and not only whole water molecules.

cheers,
axel.

CS>
CS>
CS>
CS>
CS>
CS>
CS> set holder 0
CS>
CS>
CS>
CS> for {set i 0} {\$i < \$num_frames} {incr i} {
CS>
CS> \$wat_sel frame \$i
CS>
CS> \$wat_sel num
CS>
CS> \$wat_sel update
CS>
CS> set holder [ expr { \$holder + [ \$wat_sel num ] } ]
CS>
CS> }
CS>
CS>
CS>
CS>
CS> lappend y_list \$holder
CS>
CS> }
CS>
CS> ############################
CS>
CS>
CS>
CS> Thank you,
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.
```