| 1 | # Measure the angle between two axes, each axis specified by two atoms.
|
|---|
| 2 | #
|
|---|
| 3 | # This was written to measure angles between axes determined by the
|
|---|
| 4 | # "measure rotation" command which creates axis models containing two atoms
|
|---|
| 5 | # connected by a bond defining the axis. If models #2 and #3 are two such
|
|---|
| 6 | # axis models this script can be run using Chimera command
|
|---|
| 7 | #
|
|---|
| 8 | # runscript angle.py #2 #3
|
|---|
| 9 | #
|
|---|
| 10 | a1, a2 = arguments
|
|---|
| 11 |
|
|---|
| 12 | from Midas.midas_text import _parseAtomBondAxis as parseAxis
|
|---|
| 13 | # Axis vector and base point given in model coordinate system
|
|---|
| 14 | lv1, p1, os1 = parseAxis(a1)
|
|---|
| 15 | lv2, p2, os2 = parseAxis(a2)
|
|---|
| 16 |
|
|---|
| 17 | # Get axis vectors in global coordinate system.
|
|---|
| 18 | v1 = os1.xform.apply(lv1)
|
|---|
| 19 | v2 = os2.xform.apply(lv2)
|
|---|
| 20 |
|
|---|
| 21 | # Calculate angle
|
|---|
| 22 | a = chimera.angle(v1,v2)
|
|---|
| 23 |
|
|---|
| 24 | from chimera.replyobj import status, info
|
|---|
| 25 | msg = 'Angle %s to %s is %.4g degrees' % (a1, a2, a)
|
|---|
| 26 | status(msg)
|
|---|
| 27 | info(msg + '\n')
|
|---|