Re: A way to check for non-unique coordinates?

From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Fri Nov 21 2008 - 04:36:21 CST

On Thu, 20 Nov 2008, Diego Alejandro Vargas wrote:

diego,

DAV> I just thought I would ask if anybody had any suggestions on how to check
DAV> for non-unique coordinates? I thought about writing a C programm, I'm

rather than checking for identity, i'd check for distance between
pairs of atoms. this way you could also catch atoms that are very
close.

DAV> wondering if anybody has any readily available or in tcl script. Or
DAV> how have you done this in the past?

this can be done from withing VMD without much of a
hassle and interactively. it doesn't really warrant
a full fledged script or program. you can try the
following (off the top of my head and completely
untested).

set all [atomselect top all]
set numall [$all num]
set allcrd [$all get {x y z}]
set eps 0.5

for {set i 0} {$i < [expr $numall - 1]} {incr i} {
  for {set j [expr $i + 1]} {$j < $numall} {incr j} {
    if {[vecdist [lindex $allcrd $i] [lindex $allcrd $j]] < $eps} {
      puts "atoms closer than $eps : $i $j"
    }
  }
}

please note, that vmd indexes atoms starting at 0.

cheers,
   axel.

DAV>
DAV> Thank you,
DAV> Diego A. Vargas
DAV>

-- 
=======================================================================
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.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:50:07 CST