From: Bakary N'tji Diallo (diallobakary4_at_gmail.com)
Date: Tue Oct 08 2019 - 01:20:35 CDT

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.