Re: Aligning the distance between two centroids with an axis

From: Grace Brannigan (
Date: Fri Jan 30 2009 - 10:01:55 CST

Hi Mert,

This is really a VMD question and should be directed to the VMD mailing

While you're here though, I suggest you check out the "trans" routines

in particular "transvec", which will generate the rotation matrix you need,

set trans_mat [transvec $v]

and then apply the rotation matrix to your selection by

$sel move $trans_mat

Hope this helps,


On Fri, Jan 30, 2009 at 5:02 AM, Mert Gür <> wrote:

> Dear all,
> I have a system composed of two proteins. I defined the first centroid
> (c1) to be the centroid of the Calfa atoms of protein1 . The same way I
> defined the second centroid (c2) to be the centroid of the Calfa atoms of
> protein2 .
> What I would like to do is to align the vector v=c1-c2 with the x axis
> (Could also be y axis or z axis). I think what I need is to rotate my
> protein with respects to this vector. But unfortunately I have no clue how
> to do that. I did some search but I haven't come along any relevant
> information .
> I appreciate any help,hint or source.
> Thanks in advance,
> Mert
> set allatoms [atomselect top all]
> $allatoms set beta 0
> set c1atom [atomselect top "chain A and name CA"]
> $c1atom set beta 1
> $allatoms set occupancy 0
> set c2atom [atomselect top "chain B and name CA"]
> $c2atom set occupancy 1
> set c1 [lindex [$c1datom get {x y z}] 0]
> set c2 [lindex [$c2atom get {x y z}] 0]
> vecnorm [vecsub $c1 $c2]

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:52:19 CST