VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Tue Aug 21 2007 - 18:23:55 CDT
- Next message: J T: "Re: Selecting the N-closest Waters"
- Previous message: Axel Kohlmeyer: "Re: Selecting the N-closest Waters"
- In reply to: J T: "Re: Selecting the N-closest Waters"
- Next in thread: Axel Kohlmeyer: "Re: Selecting the N-closest Waters"
- Reply: Axel Kohlmeyer: "Re: Selecting the N-closest Waters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
On Tue, 21 Aug 2007, J T wrote:
jeff,
i suspect your problems arise from the
fact, that you do distiguish between water
oxygen and hydrogen and thus may have multiple
matches with different distance.
the simple workaround would be to search
only for water oxygens. it is generally
more consistent in many ways, too.
also, i would like to be careful with the
use of 'resid' this is not guaranteed to be
unique (it is whatever VMD reads from the
pdb/psf/whatever file).
there are more elaborate ways to work around
your problems, in case you absolutely need
to include the hydrogens in your search.
cheers,
axel.
JT> > > Try instead
JT> > > set nwatlist [lsort -unique -index 1 $wlist]
JT>
JT> I've also tried that. Elements of the list may have the same residue
JT> number, but the distance is still different, which renders the -
JT> unique option void. I've even setting the elements of the list with:
JT>
JT> lset wlist $i [list $d $wresnum]
JT>
JT> instead of
JT>
JT> lset wlist $i "$d $wresnum"
JT>
JT>
JT> Jeff Tibbitt
JT>
JT>
JT>
JT>
JT>
JT>
JT>
JT>
JT>
JT> ------------------------------------------------------------------------
JT> ----------------------------------------------------
JT> On Aug 21, 2007, at 5:34 PM, Nuno Loureiro Ferreira wrote:
JT>
JT> > J T wrote:
JT> >>> > Instead of
JT> >>> > set nwatlist [lsort $wlist]
JT> >>> >
JT> >>> > try,
JT> >>> > set nwatlist [lsort -unique $wlist]
JT> >>
JT> >>
JT> >> Tried it. Since the list elements are double valued (distance and
JT> >> residue number) the -unique does not work. Is a different way to
JT> >> set the list up so the -unique option would filter out all double
JT> >> residue numbers.
JT> >
JT> > Right ;-)
JT> > Try instead
JT> > set nwatlist [lsort -unique -index 1 $wlist]
JT> >
JT> > This way you will sort by uniqueness on the second element, in your
JT> > case, the residue number.
JT> >
JT> >
JT> >> Right now the ith list element is created with the command:
JT> >>
JT> >> lset wlist $i "$d $wres"
JT> >>
JT> >> where $d is the distance and $wres is the water residue number,
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >>
JT> >> On Aug 21, 2007, at 4:55 PM, Nuno Loureiro Ferreira wrote:
JT> >>
JT> >>> Hi JT
JT> >>>
JT> >>> Instead of
JT> >>> set nwatlist [lsort $wlist]
JT> >>>
JT> >>> try,
JT> >>> set nwatlist [lsort -unique $wlist]
JT> >>> N.
JT> >>>
JT> >>> J T wrote:
JT> >>>> Dear VMD Community,
JT> >>>>
JT> >>>> I've been working on a script that will select the N-closest
JT> >>>> waters to a specified atom selection by following the algorithm
JT> >>>> suggested by John Stone in an earlier post. It successfully
JT> >>>> returns a sorted list of increasing distances, but there are
JT> >>>> duplicate water residues. The script generates a list of all
JT> >>>> water indices within a max cutoff distance. Then each water
JT> >>>> index in that list is replaced with a double valued element
JT> >>>> containing the distance and the water residue. Is there a way I
JT> >>>> can use the -unique option somehow to fix this?
JT> >>>>
JT> >>>> Thank-you for reading,
JT> >>>> Jeff Tibbitt
JT> >>>> jtibbitt_at_odu.edu <mailto:jtibbitt_at_odu.edu>
JT> >>>>
JT> >>>>
JT> >>>> John Stone's algorithm:
JT> >>>> / 1) select all waters within the max cutoff distance M /
JT> >>>> / 2) calculate the distance D of each water molecule and add the
JT> >>>> index and //distance to a list or lists /
JT> >>>> / 3) sort the list(s) by the distance (keeping the water index
JT> >>>> and distance //assocation intact, if they are in separate
JT> >>>> lists..) /
JT> >>>> / 4) select the closest N waters from the sorted list// /
JT> >>>> /
JT> >>>> /
JT> >>>> /
JT> >>>> /
JT> >>>> /My Script:/
JT> >>>> proc nwat {n sel} {
JT> >>>> set lists [measure contacts 6 [atomselect top water] $sel]
JT> >>>> set wlist [lindex $lists 0]
JT> >>>> set slist [lindex $lists 1]
JT> >>>> set n [llength $wlist]
JT> >>>> for {set i 0} {$i < $n} {incr i} {
JT> >>>> set satom [lindex $slist $i]
JT> >>>> set watom [lindex $wlist $i]
JT> >>>> set wres [[atomselect top "index $watom"] get resid]
JT> >>>> set d [measure bond "$watom $satom"]
JT> >>>> lset wlist $i "$d $wres"
JT> >>>> } set nwatlist [lsort $wlist]
JT> >>>> }
JT> >>>> -------------------------------------------------------------------
JT> >>>> -----
JT> >>>>
JT> >>>> No virus found in this incoming message.
JT> >>>> Checked by AVG Free Edition. Version: 7.5.484 / Virus Database:
JT> >>>> 269.12.0/961 - Release Date: 19-08-2007 7:27
JT> >>>>
JT> >>>
JT> >>
JT> >>
JT> >>
JT> >
JT>
-- ======================================================================= 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: J T: "Re: Selecting the N-closest Waters"
- Previous message: Axel Kohlmeyer: "Re: Selecting the N-closest Waters"
- In reply to: J T: "Re: Selecting the N-closest Waters"
- Next in thread: Axel Kohlmeyer: "Re: Selecting the N-closest Waters"
- Reply: Axel Kohlmeyer: "Re: Selecting the N-closest Waters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]