Re: [Jmol-users] Orient molecule along bond or arbitrary axis

2007-06-14 Thread Bob Hanson
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
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Orient molecule along bond or arbitrary axis

2007-06-14 Thread Bob Hanson
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 Z 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 along the Z axis:

a1 = 1
a2 = 5

# 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:

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}, {1 0 0})
if (y > 0)
  angleA = -angleA
endif

#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:

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 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}


This works for me, but this sort of thing is tricky; I may have not 
accounted for all possibilities. In any case, you get the idea from this 
of what is possible now with arithmetic expressions. Certainly you can 
do what you want to do.

Nice application of rotateSelected and translateSelected, I think.

Bob


Dean Johnston wrote:

>Exactly.  I want to be able to "look down" a particular molecular axis - so
>I guess that might be "orient this bond along the Z axis".
>
>Dean
>
>
>On 6/14/07 10:45 PM, "Bob Hanson" <[EMAIL PROTECTED]> wrote:
>
>  
>
>>Dean,
>>
>>There are two coordinate systems -- that of the molecule and that of the
>>reference frame. Is what you are asking to do to align some axis in the
>>molecular system with some axis in the reference plane? In other words,
>>something like "orient the axis going through atoms 1 and 2 along the X
>>(horizontal) axis"?
>>
>>
>>Bob Hanson
>>
>>
>>Dean Johnston wrote:
>>
>>
>>
>>>Jmol users,
>>>
>>> Does anybody know a simple way to align a molecule in the Jmol viewer
>>>along a bond or (arbitrary) axis?  This axis may not correspond to one of
>>>the original x, y, or z axes.  (or front, back, top, etc.)   I know you can
>>>ROTATE around an arbitrary axis.   I also know you can also NAVIGATE along a
>>>PATH, but I just want to re-orient, not move anywhere.  Am I overlooking
>>>some obvious parameter to MOVETO?  Thanks for any tips.
>>>
>>>Dean
>>>  
>>>
>..
>
>
>
>-
>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
>Jmol-users@lists.sourceforge.net
>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
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Orient molecule along bond or arbitrary axis

2007-06-14 Thread Dean Johnston
Exactly.  I want to be able to "look down" a particular molecular axis - so
I guess that might be "orient this bond along the Z axis".

Dean


On 6/14/07 10:45 PM, "Bob Hanson" <[EMAIL PROTECTED]> wrote:

> Dean,
> 
> There are two coordinate systems -- that of the molecule and that of the
> reference frame. Is what you are asking to do to align some axis in the
> molecular system with some axis in the reference plane? In other words,
> something like "orient the axis going through atoms 1 and 2 along the X
> (horizontal) axis"?
> 
> 
> Bob Hanson
> 
> 
> Dean Johnston wrote:
> 
>> Jmol users,
>> 
>>  Does anybody know a simple way to align a molecule in the Jmol viewer
>> along a bond or (arbitrary) axis?  This axis may not correspond to one of
>> the original x, y, or z axes.  (or front, back, top, etc.)   I know you can
>> ROTATE around an arbitrary axis.   I also know you can also NAVIGATE along a
>> PATH, but I just want to re-orient, not move anywhere.  Am I overlooking
>> some obvious parameter to MOVETO?  Thanks for any tips.
>> 
>> Dean
..



-
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
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Orient molecule along bond or arbitrary axis

2007-06-14 Thread Bob Hanson
Dean,

There are two coordinate systems -- that of the molecule and that of the 
reference frame. Is what you are asking to do to align some axis in the 
molecular system with some axis in the reference plane? In other words, 
something like "orient the axis going through atoms 1 and 2 along the X 
(horizontal) axis"?


Bob Hanson


Dean Johnston wrote:

>Jmol users,
>
>  Does anybody know a simple way to align a molecule in the Jmol viewer
>along a bond or (arbitrary) axis?  This axis may not correspond to one of
>the original x, y, or z axes.  (or front, back, top, etc.)   I know you can
>ROTATE around an arbitrary axis.   I also know you can also NAVIGATE along a
>PATH, but I just want to re-orient, not move anywhere.  Am I overlooking
>some obvious parameter to MOVETO?  Thanks for any tips.
>
>Dean
>
>
>
>-
>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
>Jmol-users@lists.sourceforge.net
>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
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


[Jmol-users] Orient molecule along bond or arbitrary axis

2007-06-14 Thread Dean Johnston
Jmol users,

  Does anybody know a simple way to align a molecule in the Jmol viewer
along a bond or (arbitrary) axis?  This axis may not correspond to one of
the original x, y, or z axes.  (or front, back, top, etc.)   I know you can
ROTATE around an arbitrary axis.   I also know you can also NAVIGATE along a
PATH, but I just want to re-orient, not move anywhere.  Am I overlooking
some obvious parameter to MOVETO?  Thanks for any tips.

Dean



-
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
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] [Jmol-developers] Jmol application freezing

2007-06-14 Thread Bob Hanson
It's also, I think, only with the Jmol application, not the applet. OK, 
let's let it go.

Bob


Sérgio Ceroni da Silva wrote:

> >>Sérgio Ceroni da Silva wrote:
> >>
> >>Dear all
> >>I've been doing some testing regarding the problem where Jmol
> >>application freezes after a few changes in the default language.
> >>Apparently it's a memory matter. Every time the language is changed
> >>javaw uses more 6 to 15 MB. This happen with every language change until
> >>all resources are consumed. I hope this is not a java problem and a fix
> >>can be found.
> >>Regards
> >>Sérgio
> >>
> >
> >This is a Jmol problem, but I am not experienced enough to solve it.
> >Language switching is not intended to be done more than once or twice in
> >a single Jmol run. If you have to switch back and forth among languages,
> >consider restarting Jmol. That's just the way it is for now. Perhaps
> >someone knows how to track down the memory leak associated with this; I
> >tried for some time, and I give up. The viewer is not finalizing upon
> >creation of a new one, which is what language switching involves. I do
> >not know how to fix that.
> >
> >Bob
>
>Hi Bob, thanks for your reply. I've come across this problem while 
>checking the pt_br translation I did. I was going from en to pt_br and 
>back again several times to make sure the translation was meaningful and 
>not just literal. Sure no sane person will change languages more than a 
>couple of times, so it is not a big problem. I've reported it just 
>because I thought this memory leak could be a symptom of a more 
>important problem.
>Thanks again.
>Sérgio
>
>
>
>-
>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
>Jmol-users@lists.sourceforge.net
>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
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] [Jmol-developers] Jmol application freezing

2007-06-14 Thread Sérgio Ceroni da Silva
 >>Sérgio Ceroni da Silva wrote:
 >>
 >>Dear all
 >>I've been doing some testing regarding the problem where Jmol
 >>application freezes after a few changes in the default language.
 >>Apparently it's a memory matter. Every time the language is changed
 >>javaw uses more 6 to 15 MB. This happen with every language change until
 >>all resources are consumed. I hope this is not a java problem and a fix
 >>can be found.
 >>Regards
 >>Sérgio
 >>
 >
 >This is a Jmol problem, but I am not experienced enough to solve it.
 >Language switching is not intended to be done more than once or twice in
 >a single Jmol run. If you have to switch back and forth among languages,
 >consider restarting Jmol. That's just the way it is for now. Perhaps
 >someone knows how to track down the memory leak associated with this; I
 >tried for some time, and I give up. The viewer is not finalizing upon
 >creation of a new one, which is what language switching involves. I do
 >not know how to fix that.
 >
 >Bob

Hi Bob, thanks for your reply. I've come across this problem while 
checking the pt_br translation I did. I was going from en to pt_br and 
back again several times to make sure the translation was meaningful and 
not just literal. Sure no sane person will change languages more than a 
couple of times, so it is not a big problem. I've reported it just 
because I thought this memory leak could be a symptom of a more 
important problem.
Thanks again.
Sérgio



-
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
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users