# Re: Aligning the distance between two centroids with an axis

From: Chris Harrison (char_at_ks.uiuc.edu)
Date: Fri Jan 30 2009 - 21:31:43 CST

Mert,

Your question is really a VMD question and therefore, to yield better and
more responses, it's best to post similar questions to vmd-l.

1. Check out the matrix commands in the vmd manual; ie transvec, vecsub,
etc.

2. Check out the Orient script, written for similar problems, at:
http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/orient/

3. A hastily written example soln to a similar problem:
proc align_p1p2_to_z { p1 p2 } {
# p1 and p2 should represent more than one atom

set p1pos [lindex [\$p1 get {x y z}] 0 ]
set p2pos [lindex [\$p2 get {x y z}] 0 ]
set vec [vecsub \$p1pos \$p2pos]

set alat [atomselect top all]

set M [transvec \$vec]
\$alat move \$M

set M2 [transaxis y -90]
\$alat move \$M2
}

C.

```--
Chris Harrison, Ph.D.
Theoretical and Computational Biophysics Group
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave., Urbana, IL 61801
char_at_ks.uiuc.edu                            Voice: 217-244-1733
http://www.ks.uiuc.edu/~char               Fax: 217-244-6078
On Fri, Jan 30, 2009 at 4:02 AM, Mert Gür <gurmert_at_gmail.com> 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.
> 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