• ## Outreach

From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Tue Oct 08 2019 - 11:29:15 CDT

Hello,

Those transformations don't do what you think they do. Try something like this:

#Move everything to the origin
\$sel moveby [vecscale -1 [list \$x0 \$y0 \$z0]]
#find the axis
set axis [vecsub [list \$x1 \$y1 \$z1] [list \$x0 \$y0 \$z0]]
#Move this axis to be aligned to the x-axis
\$sel move [transvecinv \$axis]
#Move the x axis to the z axis
\$sel move [transaxis y 90]

I'm getting all of this from https://www.ks.uiuc.edu/Research/vmd/current/ug/node194.html

-Josh

On 2019-10-08 01:28:22-06:00 owner-vmd-l_at_ks.uiuc.edu wrote:

I want to transform a structure that should follow the one of a line that I want to fit to the z-axis. I am trying to use the 4*4 transformation matrix in VMD.

The line passes through the following points:

x0, y0, z0 = -10.91, 25.47, -8.43

and x1, y1, z1 = -11.49, 26.69, -8.49

I first fitted point (x0, y0, z0) to the origin by subtracting (x0, y0, z0).

set sel [atomselect top "all"]
set matrix [transaxis x 10.912694059827974]
\$sel move \$matrix
set matrix [transaxis y -25.473592228622916]
\$sel move \$matrix
set matrix [transaxis z 8.430980843040398]
\$sel move \$matrix
set sel [atomselect top "all"]

Then I calculated the angle (è) between (x1-x0, y1-y0, z1-z0) and the z-axis. Then I am not sure exactly how to use the transformation matrix to use.

I am using the following rotation matrix:

cosè -sinè 0

sinè cosè 0

0 0 1

set M {{-0.04869659873579198 -0.9988136168833329 0 0} {0.9988136168833329 -0.04869659873579198 0 0} {0 0 1 0} {0 0 0 1}}

\$sel move \$M

However the result I am getting is not fitting the line to the z axis.