From: Simon Dürr (
Date: Thu Nov 26 2015 - 08:37:45 CST

Hi Vlad,

If you're talking about a linear regression (or Orthgonal Linear
Regression in 3D) I'm sure you can write a tcl script to calculate
your vector and from this vector a start and an end point and then
use the draw function to draw a line between those points. You just
need to do the math with tcl.
mol new
mol rename top DRAWINGNAME
draw color 0
draw line {x1 y1 z1} {x2 y2 z2} [width w] [style solid|dashed]

I however think you're better off to just use the programming language
of your choice that probably has a orthogonal linear regression method
already implemented, calculate your vector and generate a .vmd File
(Visualization State) that later can be loaded into VMD and that
displays your fitted line. The drawing will then be like a molecule in
VMD (so you can delete or hide it temporarily).

In the VMD File you use exactly the same synthax as you would in the
tcl console to draw a line.


2015-11-25 17:10 GMT+01:00 Vlad Cojocaru <>:
> Dear VMD users,
> Is there a way to do a line fit on 3D data points in VMD ? In other words,
> if I have a number of 3D points can I find the vector representing the line
> that best fits those points ?
> Thanks for any advice
> Best wishes
> Vlad
> --
> Dr. Vlad Cojocaru
> Computational Structural Biology Laboratory
> Department of Cell and Developmental Biology
> Max Planck Institute for Molecular Biomedicine
> Röntgenstrasse 20, 48149 Münster, Germany
> Tel: +49-251-70365-324; Fax: +49-251-70365-399
> Email: vlad.cojocaru[at]