# New measurements

I was asked by colleague to add new type of measurement: angle between two planes without shared atoms (each defined by three different atoms). So, measurement sequence will be
2 atoms: distance
3 atoms: angle
4 atoms: dihedral
5 atoms: angle between two plains with central atom as shared
6 atoms: angle between two planes without shared atoms

## Problem is that 2-4 atoms measurements display not only “main” value, but also distances between all atoms, etc. Introduction of 5 and 6 will make that information excessive Is it OK, to break tradition and display only “last” result?

Regards,
Konstantin

On Feb 21, 2010, at 3:53 PM, Konstantin Tokarev wrote:

I was asked by colleague to add new type of measurement: angle between two planes without shared atoms (each defined by three different atoms). So, measurement sequence will be

5 atoms: angle between two plains with central atom as shared
6 atoms: angle between two planes without shared atoms

What I’d really prefer is if we can get a “Plane” tool, which takes 3 or more atoms and creates a plane and renders it. Then the same tool could easily handle measurements between the planes as you describe. I mention this, because you might also want the distance between an atom and a plane, the angle between a bond and a plane, etc.

We actually already have code to compute a plane/hyperplane for the camera. I believe you’d also want the drawQuadrilateral calls in Painter.

From molecule.cpp:

``````  int i = 0;
Vector3d ** atomPositions = new Vector3d*[nAtoms];
// Calculate the center of the molecule too
foreach (Atom *atom, m_atomList) {
Vector3d *pos = &(*m_atomPos)[atom->id()];
d->center += *pos;
atomPositions[i++] = pos;
}
d->center /= static_cast<double>(nAtoms);
Eigen::Hyperplane<double, 3> planeCoeffs;
Eigen::fitHyperplane(numAtoms(), atomPositions, &planeCoeffs);
delete[] atomPositions;
d->normalVector = planeCoeffs.normal()
``````

Hope that helps,
-Geoff

What I’d really prefer is if we can get a “Plane” tool, which takes 3 or more atoms and creates a plane and renders it. Then the same tool could easily handle measurements between the planes as you describe. I mention this, because you might also want the distance between an atom and a plane, the angle between a bond and a plane, etc.

Yes, it’ll be useful. Also it could be useful to draw arbitrary planes, as it can be done with axes now.

We actually already have code to compute a plane/hyperplane for the camera. I believe you’d also want the drawQuadrilateral calls in Painter.
From molecule.cpp:

``````  int i = 0;
Vector3d ** atomPositions = new Vector3d*[nAtoms];
// Calculate the center of the molecule too
foreach (Atom *atom, m_atomList) {
Vector3d *pos = &(*m_atomPos)[atom->id()];
d->center += *pos;
atomPositions[i++] = pos;
}
d->center /= static_cast(nAtoms);
Eigen::Hyperplane planeCoeffs;
Eigen::fitHyperplane(numAtoms(), atomPositions, &planeCoeffs);
delete[] atomPositions;
d->normalVector = planeCoeffs.normal()
``````

Thanks!

Regards,
Konstantin

Am Monday 22 February 2010 16:36:55 schrieb Geoffrey Hutchison:

On Feb 21, 2010, at 3:53 PM, Konstantin Tokarev wrote:

I was asked by colleague to add new type of measurement: angle between
two planes without shared atoms (each defined by three different atoms).
So, measurement sequence will be

5 atoms: angle between two plains with central atom as shared
6 atoms: angle between two planes without shared atoms

What I’d really prefer is if we can get a “Plane” tool, which takes 3 or
more atoms and creates a plane and renders it. Then the same tool could
easily handle measurements between the planes as you describe. I mention
this, because you might also want the distance between an atom and a
plane, the angle between a bond and a plane, etc.

This would really be great to have. The way you describe seems just
like “Mercury” (http://www.ccdc.cam.ac.uk/products/mercury/) does it. But in
addition, I’d like to suggest to have the possibility to limit the (infinite)
plane to the area between the three atoms, so you can visualize polyhedra by
drawing several planes/areas. (I realize my nomenclature of plane vs. area
may not be mathematically correct here, but I hope you know what I mean)

Regards,
Xaver

We actually already have code to compute a plane/hyperplane for the camera.
I believe you’d also want the drawQuadrilateral calls in Painter.

From molecule.cpp:
int i = 0;
Vector3d ** atomPositions = new Vector3d*[nAtoms];
// Calculate the center of the molecule too
foreach (Atom *atom, m_atomList) {
Vector3d *pos = &(*m_atomPos)[atom->id()];
d->center += *pos;
atomPositions[i++] = pos;
}
d->center /= static_cast(nAtoms);
Eigen::Hyperplane<double, 3> planeCoeffs;
Eigen::fitHyperplane(numAtoms(), atomPositions, &planeCoeffs);
delete[] atomPositions;
d->normalVector = planeCoeffs.normal()

## Hope that helps, -Geoff

Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

22.02.10, 17:21, “Xaver Wurzenberger” xaver.xn@web.de:

Am Monday 22 February 2010 16:36:55 schrieb Geoffrey Hutchison:

On Feb 21, 2010, at 3:53 PM, Konstantin Tokarev wrote:

I was asked by colleague to add new type of measurement: angle between
two planes without shared atoms (each defined by three different atoms).
So, measurement sequence will be

5 atoms: angle between two plains with central atom as shared
6 atoms: angle between two planes without shared atoms

What I’d really prefer is if we can get a “Plane” tool, which takes 3 or
more atoms and creates a plane and renders it. Then the same tool could
easily handle measurements between the planes as you describe. I mention
this, because you might also want the distance between an atom and a
plane, the angle between a bond and a plane, etc.
This would really be great to have. The way you describe seems just
like “Mercury” (http://www.ccdc.cam.ac.uk/products/mercury/) does it. But in
addition, I’d like to suggest to have the possibility to limit the (infinite)
plane to the area between the three atoms, so you can visualize polyhedra by
drawing several planes/areas. (I realize my nomenclature of plane vs. area
may not be mathematically correct here, but I hope you know what I mean)
Regards,
Xaver

What it should be: tool, engine, extension?
Advantages of tool: easy to pick atoms
Advantages of engine: it could be cloned => easier to get separate settings (color, “size”, 3 points) for different planes
Advantages of extension: open dialog with list of all planes, choose two and angle between them will be shown

1. Can it all be combined in one plugin?
2. If not, do you have any ideas what is the best way to setup interaction between these related plugins?

Regards,
Konstantin

Advantages of tool: easy to pick atoms
Advantages of engine: it could be cloned => easier to get separate settings (color, “size”, 3 points) for different planes
Advantages of extension: open dialog with list of all planes, choose two and angle between them will be shown

The tool can do #1 and #3 easily. It could also have some coloring (e.g., each plane defined by the tool has separate colors). Otherwise, I’d create a “plane engine” which renders and colors planes, and a tool.

Just my \$0.02,
-Geoff