From: Vikas Varshney (vv0210_at_gmail.com)
Date: Tue Oct 16 2012 - 11:51:51 CDT

Dear Axel,
Thanks for the suggestions. I will try to get it working.

Best Regards,
Vikas

On Tue, Oct 16, 2012 at 11:33 AM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:

> On Tue, Oct 16, 2012 at 5:11 PM, Vikas Varshney <vv0210_at_gmail.com> wrote:
> > Dear Axel,
> > Thank you for your email and the suggestions.
> >
> > As you mentioned, I can load the dump file in the same molecule. That
> should
> > not be a problem. About the coloring scheme, I want to calculate the
> > distance between all bonding pairs (3 pairs) for certain atom and then
> use
> > the largest distance among the three as the measure of the color of the
> > atom.
> >
> > After reading your email, this is what I should be done. Please let me
> know
> > if that makes sense.
> >
> > 1. Read the data file using topotools
> > 2. Retrieve the bond information (Please let me know in which variable
> the
> > list of lists for bonding information is stored).
>
> you have to choose the variable.
>
> set bondlist [topo getbondlist none]
>
>
> https://sites.google.com/site/akohlmey/software/topotools/topotools---documentation#TOC-getbondlist-type-order-both-none-
>
> > Question: Is this list of lists based on the bond index (as in
> lammps)
> > or for each atom (as in each sub-list contains information about all of
> its
> > bonds)
>
> no, the lammps bond index is lost. VMD stores bonds in a very peculiar
> format
> that is optimized for fast display. you get a list where each entry has the
> atom indices that form a bond.
>
> > 3. If bond retrival list is like lammps (index based), Create a new list
> of
> > lists for each atom bond (each sublist will contain information about one
> > atom's bonding partners). Lets call this list bond3. This will be done
> only
> > one time.
>
> this information is readily available from VMD and how it stores the
> bond information.
> if that is what you are after, then you don't need topo getbonds, but
> rather create
> a selection for all atoms and then do
>
> set bondlist [$sel getbonds]
>
> in this case $bondlist will contain a list of lists with one entry per atom
> where each entry is the list of bonding partners of this atom.
>
> > 4. Then, for a certain frame, calculate the 3 distances for each atom
> (using
> > bond3 list of lists). Get the magnitude of the longest bond. Then color
> that
> > atom based on that distance.
>
> yup.
>
> > 5. Do this for each frame.
> >
> > Please let me know if you think is more appropriate. Thanks for your
> help.
>
> with my proposed augmentations, that should work.
>
> axel.
>
> > Best Regards,
> > Vikas
> >
> >
> > On Mon, Oct 15, 2012 at 3:12 PM, Axel Kohlmeyer <akohlmey_at_gmail.com>
> wrote:
> >>
> >> i am adding some comments below.
> >>
> >> On Mon, Oct 15, 2012 at 5:53 PM, Vikas Varshney <vv0210_at_gmail.com>
> wrote:
> >> > Dear John, Axel,
> >> >
> >> > I have a trajectory of my system of interest (CNTs) which I want to
> >> > visualize with certain color scheme associated with retrival of bonds
> >> > information.
> >> >
> >> > Basically, I am stretching a CNT and would like to color the atoms
> based
> >> > on
> >> > the longest bond distance. I have looked over the forum to get some
> >> > insights
> >> > on how to color atoms based on user defined parameters and have the
> >> > following TCl script which hopefully will do the job. I need some help
> >> > with
> >> > how to retrive bond information so that I can calculated bond lengths
> >> > for
> >> > each atom with its bonding pairs.
> >> >
> >> > I am using Axel's topotools package to load the lammps data file
> which I
> >> > think is loading bond information as well. Below is the template of
> the
> >> > TCl
> >> > script
> >> >
> >> > -------------------
> >> > #/usr/bin/tclsh
> >> >
> >> > set lmpdata [atomselect 0 all] #This contains topology information
> >> > set lmptrj [atomselect 1 all] #This is the trajectory file
> >>
> >> this looks as if you are loading the dump into a different (vmd)
> >> "molecule".
> >> it would be much better to load the trajectory "into" the same
> "molecule".
> >> if your dump contains the atom ids, the order should be preserved.
> >>
> >>
> >> > for {set i 0} {$i < [molinfo 1 get numframes]} {incr i} {
> >> > $lmptrj frame $i
> >> > foreach atomind [$allsel get index] {
> >> > set csel [atomselect 1 "index $atomind" frame $i]
> >>
> >> > # Get indices of other atoms that are connected to atom "atomind"
> >>
> >> this is hugely inefficient.
> >>
> >> since you seem to be using a conventional force field
> >> or at least a topology file that has contains bond information,
> >> you can do the following.
> >>
> >> topotools has a command to retrieve a "bond list" this is a
> >> list of lists which contains a list of all bonds with each entry
> >> containing the two atom indices forming the bond and additional
> >> information, as requested. this information will not change
> >> over the trajectory, so it can be retrieved up front and stored.
> >>
> >> then you should take the selection for all atoms (also defined
> >> outside the loop) and advance it to the current frame as in your
> >> script fragment and then retrieve all coordinate triples via
> >> $sel get {x y z}. this will also produce a list of lists.
> >>
> >> now you can loop over the bond list and for each bond get
> >> the two indices (e.g. using lassign) and then use lindex
> >> on the coordinate list to get the two coordinate vectors and
> >> use vecdist to compute the distance (i.e. bond length).
> >>
> >> now the big question is, how do you want to convert this
> >> information into a color code, since color is stored on a
> >> per atom basis and each atom has multiple bonding partners
> >> (3) and you have 4 user fields to store per atom per frame
> >> information. so theoretically it should be possible with
> >> 3 representations using one of 3 user fields to handle
> >> this, but you'd have to figure out a way to select the bonds
> >> accordingly, which i currently have no idea how to do.
> >>
> >>
> >> > # Calculate distance of each bond pair with one atom "atomind" using
> >> > vector
> >> > operators or some other functions
> >> > # Get the largest distance (ldist)
> >> > # Color atom
> >> > $csel set user $ldist
> >> > $csel delete
> >>
> >> creating and deleting selections during a loop and particularly
> >> on a per atom basis, is going to be very slow, and in your
> >> case not really needed.
> >>
> >> axel.
> >>
> >> > }
> >> > }
> >> >
> >> > $lmpsdata delete
> >> > $lmptrj delete
> >> >
> >> > -------------------
> >> >
> >> > I will highly appreciate any other suggestions as well.
> >> >
> >> > Best Regards,
> >> > Vikas
> >>
> >>
> >>
> >> --
> >> Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0
> >> International Centre for Theoretical Physics, Trieste. Italy.
> >
> >
>
>
>
> --
> Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0
> International Centre for Theoretical Physics, Trieste. Italy.
>