draw objects just have centers in this context. but you could define the
points:
draw pt1 {0.0 3.1 1.3} off
draw pt2 {0.1 2.1 1.0} off
draw line1 @pt1 @pt2
and then use the points themselves, not the line, for your reference
points. Be sure to use $ in front of the point id:
x = -$pt1.x
y = -$pt1.y
z = -$pt1.z
translateSelected [EMAIL PROTECTED] @y @z}
Otherwise Jmol will be looking for a variable named "pt1" not an object
named "pt1"
Bob
Dean Johnston wrote:
>OK, not simple, but very impressive what you can do with the "molecular
>math". (I especially like the use of improper angles.)
>
>Now, if I want to orient along an line (as opposed to along a bond), can I
>do it the same way? Is there a way to extract the endpoints of a line?
>When I tried something like x = @line1.x I get what appears to be the center
>point of the line instead of either end. I guess I can always pass the
>information to Jmol using Javascript, since that's how I created the line in
>the first place.
>
>
>
>Dean
>
>
>On 6/15/07 12:58 AM, "Bob Hanson" <[EMAIL PROTECTED]> wrote:
>
>
>
>>This is better -- it uses improper angles to set the sign of the angle
>>correctly.
>>
>>Bob Hanson wrote:
>>
>>
>>
>>>no simple way. HOWEVER, you could do the calculation I think. Let's see
>>>if it can be done with a Jmol script...
>>>
>>>Let's say we want to align the axis between atom 1 and atom 2 along the
>>>Z axis.
>>>
>>> Y
>>> |
>>> +--X
>>> /
>>> Z
>>>
>>>Strategy: rotate the axis around the Z axis into the XZ plane, then
>>>rotate it around the Y axis into the YZ plane.
>>>To do this, we need two angles:
>>>
>>>a) the angle of the axis projected into the XY plane and the X axis,
>>>and, after that,
>>>b) the angle between the axis and the Z axis.
>>>
>>>try this:
>>>
>>>
>>>
>>>
>>>
>>#atoms to align:
>>
>>a1 = 1
>>a2 = 2
>>
>># just for testing:
>>
>>select *;color cpk;
>>select atomno=a1;color yellow;spacefill 0.40;
>>select atomno=a2;color green;spacefill 0.25
>>select atomno=a1 or atomno=a2; label on
>>set axesmolecular
>>axes on
>>
>>
>># align molecular and window frame coordinate system;
>>
>>reset
>>select *
>>
>>
>># move atom 1 to {0 0 0}:
>>
>>x = -{atomno=a1}.x
>>y = -{atomno=a1}.y
>>z = -{atomno=a1}.z
>>
>>translateSelected [EMAIL PROTECTED] @y @z}
>>
>># into the XZ plane, using an improper angle:
>>
>>axisAB = {atomno=a2}.xyz - {atomno=a1}.xyz
>>
>>x = axisAB.x
>>y = axisAB.y
>>#echo %{x} %{y}
>>
>>
>>projAB = [EMAIL PROTECTED], @y, 0}
>>angleA = angle(projAB, {0 0 0}, {0 0 1}, {1 0 0})
>>#echo %{angleA}
>>
>>rotateSelected Z @angleA
>>
>># move atom 1 to {0 0 0}:
>>
>>x = -{atomno=a1}.x
>>y = -{atomno=a1}.y
>>z = -{atomno=a1}.z
>>
>>translateSelected [EMAIL PROTECTED] @y @z}
>>
>>
>># onto the Z axis, using an improper angle:
>>
>>axisAB = {atomno=a2}.xyz - {atomno=a1}.xyz
>>
>>x = axisAB.x
>>z = axisAB.z
>>#echo %{x} %{z}
>>
>>projAB = [EMAIL PROTECTED], 0, @z}
>>angleA = angle(projAB, {0 0 0}, {0 1 0}, {0 0 1})
>>#echo %{angleA}
>>
>>rotateSelected Y @angleA
>>
>># move atom 1 to {0 0 0}:
>>
>>x = -{atomno=a1}.x
>>y = -{atomno=a1}.y
>>z = -{atomno=a1}.z
>>
>>translateSelected [EMAIL PROTECTED] @y @z}
>>
>>
>>
>>Bob
>>
>>
>>-------------------------------------------------------------------------
>>This SF.net email is sponsored by DB2 Express
>>Download DB2 Express C - the FREE version of DB2 express and take
>>control of your XML. No limits. Just data. Click to get it now.
>>http://sourceforge.net/powerbar/db2/
>>_______________________________________________
>>Jmol-users mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
>>
>
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>_______________________________________________
>Jmol-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users