From: Axel Kohlmeyer (
Date: Wed May 25 2011 - 14:01:44 CDT

On Wed, May 25, 2011 at 12:44 PM, Anna Amat <> wrote:
> Hi,
> I have a xyz file with an extra column for a given property.  In my case
> this property is the percentage of a certain atomic orbital on the atom
> (though its physical meaning is irrelevant). My file it would be something
> like:
> 56
> C    3.12435    4.56460    4.54668    0.25
> O    4.53425    3.32442    3.23423    0.11
> ....
> I would like to generate a color surface (like for electrostatic potential)
> with the value of this property.
> Is there any utility to generate a mesh of points and plot this data?

i don't see how you can generate a mesh from scattered points.

what you _can_ do, however, is to color the atoms by that value.

assuming that you have only one coordinate frame in your data set
the corresponding script code (untested) for the VMD console would
be something like the following:

mol new waitfor all

set sel [atomselect top all]
set line {}
set fp [open r]
set numlines -1
gets $fp line
if {[regexp {^\s*([0-9]+)} $line x numlines]} {
   # first line is number of atoms
} else {
   set numlines -1

if {$numlines < 0} {error "illegal xyz file"}
gets $fp line

set frame {}
for {set i 0} {$i < $numlines} {incr i} {
     gets $fp line
     lassign $line a x y z p
     lappend frame $p
$sel set user $frame
animate goto 0

# from this point on you should be able to
visualize the atoms with the "User" color scale.


> Thank you!
> Anna.

Dr. Axel Kohlmeyer
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.