VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Thu Aug 09 2007 - 09:23:39 CDT
- Next message: Philipp Schön: "package require Tcl 8.5 => ::tcl::mathfunc::"
- Previous message: Olaf Lenz: "Re: radial density"
- In reply to: Christopher Stiles: "radial density"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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> set NT_radius 0
CS>
CS> set NT_radius_old 0
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> set NT_radius_max 15
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)"]
at this point NT_radius and NT_radius_old both have the value 0
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)
radial distribution function.
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> while { $NT_radius <= $NT_radius_max } {
CS>
CS> set NT_radius_old $NT_radius
CS>
CS> set NT_radius [ expr { $NT_radius + $step_size } ]
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> lappend x_list $NT_radius
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.
- Next message: Philipp Schön: "package require Tcl 8.5 => ::tcl::mathfunc::"
- Previous message: Olaf Lenz: "Re: radial density"
- In reply to: Christopher Stiles: "radial density"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]