Re: [Jmol-users] labeling residue by position relative to observer

2017-05-16 Thread Luciano Abriata
Dear Eric,

Glad you liked the web app. But I should in turn thank Angel Herraez who did 
the hardest part of modifying webgazer to make it fully compatible with JSmol !

Related, here's another type of technology that would be cool to integrate 
better with JSmol. So far I'm exploring it with my own 3D drawings of 
molecules, just proof of concept:
Augmented reality in chemistry: 
https://lucianoabriata.altervista.org/jsinscience/arjs/arjs.html

(You need to print two small markers to use this web app!)

You can see the works by A. Olson to inspire possible applications of augmented 
reality in chemistry / structural biology (see articles or youtube videos). I 
think JSmol coupled to AR.js should allow such applications and more, in a far 
more simple way, just through HTML + JS.
Luciano





  De: Eric Martz <ema...@microbio.umass.edu>
 Para: jmol-users@lists.sourceforge.net 
 Enviado: Martes, 16 de mayo, 2017 17:25:59
 Asunto: Re: [Jmol-users] labeling residue by position relative to observer
   
 Dear Luciano, Wow! That is amazing! It worked easily for me (MacBook Pro). For 
people who haven't tried it: Go the link below. It asks permission to use your 
camera. Follow simple instructions to calibrate (takes less than one minute). 
Then whatever part of the molecule you look at rotates to the front! By 
tracking your eye movements! -Eric
  
 On 5/16/17 2:59 AM, Luciano Abriata wrote:
  
 And Eric, regarding the anecdote, actually I wanted to do this for something 
similar. With help from Angel I coupled an eye gazer that uses the webcam to 
track the user's eyes. Then, whatever part of the molecule you look at comes to 
the front (and now its frontmost residues get labeled). It doesn't work very 
well due to the low "resolution" of the eye gazer, but with good light on your 
face you can see the effect coming up! 
  
https://lucianoabriata.altervista.org/jsinscience/jsmolwebgazer/jsmolwebgazer.html
 
  
 
 --
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! 
http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


   --
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] labeling residue by position relative to observer

2017-05-16 Thread Eric Martz

Dear Luciano,

Wow! That is amazing! It worked easily for me (MacBook Pro).

For people who haven't tried it: Go the link below. It asks permission 
to use your camera. Follow simple instructions to calibrate (takes less 
than one minute). Then whatever part of the molecule you look at rotates 
to the front! By tracking your eye movements!


-Eric


On 5/16/17 2:59 AM, Luciano Abriata wrote:
And Eric, regarding the anecdote, actually I wanted to do this for 
something similar. With help from Angel I coupled an eye gazer that 
uses the webcam to track the user's eyes. Then, whatever part of the 
molecule you look at comes to the front (and now its frontmost 
residues get labeled). It doesn't work very well due to the low 
"resolution" of the eye gazer, but with good light on your face you 
can see the effect coming up!


https://lucianoabriata.altervista.org/jsinscience/jsmolwebgazer/jsmolwebgazer.html



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] labeling residue by position relative to observer

2017-05-16 Thread Angel Herráez
Great solution

I just noted this in the documentation (under "functions"):

point({x,y,z}, true)gives the screen coordinates {sx, sy, sz} corresponding 
to 
the 3D coordinates {x, y, z}.

point({sx,sy,sz}, false)gives the 3D coordinates {x, y, z} 
cooresponding to 
the screen coordinates {sx, sy, sz}. 


Bob, I think that sx, sy, sz should be listed under "atom properties"
https://chemapps.stolaf.edu/jmol/docs/#atomproperties

That's where I looked for it when Luciano asked.



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] labeling residue by position relative to observer

2017-05-16 Thread Luciano Abriata
Thank you Bob and thank you Eric too (your example helped me learn that I could 
set timeout inside Jmol scripts!!)
For documentation: I modified a bit the selection into:
select on *.ca and within(8,sz = @{all.sz.min})
So as to label each protein residue only at its CA, and to label not only the 
topmost but also those around it.
(I tried more straightforward things like select on sz = @{*.ca.sz.min} but 
didn't work)
And Eric, regarding the anecdote, actually I wanted to do this for something 
similar. With help from Angel I coupled an eye gazer that uses the webcam to 
track the user's eyes. Then, whatever part of the molecule you look at comes to 
the front (and now its frontmost residues get labeled). It doesn't work very 
well due to the low "resolution" of the eye gazer, but with good light on your 
face you can see the effect coming up!
https://lucianoabriata.altervista.org/jsinscience/jsmolwebgazer/jsmolwebgazer.html
Best
Luciano


  De: Robert Hanson <hans...@stolaf.edu>
 Para: "jmol-users@lists.sourceforge.net" <jmol-users@lists.sourceforge.net> 
 Enviado: Martes, 16 de mayo, 2017 6:56:47
 Asunto: Re: [Jmol-users] labeling residue by position relative to observer
   
"sz" stands for "screen z"; smaller is closer.

select on sz = @{all.sz.min}
highlights closest atom

(sorry,  Eric!)

​Bob

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! 
http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


   --
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] labeling residue by position relative to observer

2017-05-15 Thread Robert Hanson
"sz" stands for "screen z"; smaller is closer.

select on sz = @{all.sz.min}

highlights closest atom

(sorry,  Eric!)

​Bob
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] labeling residue by position relative to observer

2017-05-15 Thread Eric Martz

Dear Luciano,

Below is a script that selects the frontmost atom as the molecule is 
rotated by the mouse. It defines a set of 4 atoms, and whichever becomes 
frontmost is selected. This script can be adapted to run any arbitrary 
script triggered by one of a specified set of atoms becoming frontmost 
due to rotation of the molecule with the mouse. Thus, it could be 
adapted to label the frontmost atom.


The script defines a set of 4 atoms in atomlist. Every 100 milliseconds, 
it runs checkOrient(), which re-determines which of the 4 atoms is 
frontmost, and selects it. The selection is visible because 
selectionHalos is on.


Copy the script below and paste it into the Jmol console, or paste it 
into a plain text file, and drop that file into Jmol. As you rotate the 
molecule with the mouse, the frontmost atom is highlighted with a yellow 
halo. It does not seem to work if the molecule is spinning.


In April, 2012, we had the pleasure of a visit by Bob Hanson at our 
campus (UMass, Amherst). Craig Martin's Molecular Playground (website is 
currently unresponsive, but http://molecularplayground.org) was a major 
topic of discussion. Karsten Theis asked Bob if, when a person rotates 
the projected molecule by waving their arm, a script could be triggered 
to show more detail about whatever is in front. Within one day, Bob came 
up with orient.spt (below). Here is a photo commemorating this meeting: 
http://proteopedia.org/w/Proteopedia:Scrapbook#Molecular_Playground_Team 
-- as far as I know, this method has not yet been incorporated into 
Molecular Playground modules, or any other uses.


--

// orient.spt -- tracks the orientation of four points
// This script by Robert Hanson, April, 2012 for Karsten Theis, Eric 
Martz, Craig Martin.
// The frontmost of the 4 atoms specified in atomlist is selected every 
0.1 sec.
// This script can be adapted to run any arbitrary script when a 
specified atom

// becomes the frontmost of a specified set of atoms.

load DATA "mol"
C:/jmol-dev/bobtest/mmff94_dative.mol2
__Jmol-12_04301213583D 1   1.0 0.0 0
Jmol version 12.3.24_dev  2012-04-27 23:05 EXTRACT: ({0:24})
 25 26  0  0  0  0  1 V2000
  -8.19190  -2.59960  15.52080 N   0  0  0  0  0  0
  -7.34730  -2.94810  16.47440 C   0  0  0  0  0  0
  -7.02800  -2.03140  17.44970 N   0  0  0  0  0  0
  -6.80300  -4.16350  16.55330 N   0  0  0  0  0  0
  -7.15100  -5.04140  15.59320 C   0  0  0  0  0  0
  -6.48610  -6.26490  15.62980 N   0  0  0  0  0  0
  -8.03730  -4.74600  14.54960 C   0  0  0  0  0  0
  -8.39880  -5.63640  13.58900 N   0  0  0  0  0  0
  -9.27230  -5.22870  12.63230 C   0  0  0  0  0  0
  -9.64070  -6.23510  11.58280 C   0  0  0  0  0  0
  -9.79140  -3.93470  12.64140 C   0  0  0  0  0  0
 -10.75920  -3.46050  11.59680 C   0  0  0  0  0  0
  -9.44170  -3.03720  13.60530 N   0  0  0  0  0  0
  -8.56300  -3.44580  14.55720 C   0  0  0  0  0  0
  -8.61250  -1.68180  15.51700 H   0  0  0  0  0  0
  -6.87870  -1.06530  17.18790 H   0  0  0  0  0  0
  -6.29240  -2.39870  18.05420 H   0  0  0  0  0  0
  -5.95280  -6.40360  16.48240 H   0  0  0  0  0  0
  -7.05940  -7.06120  15.35990 H   0  0  0  0  0  0
 -10.71720  -6.43030  11.60180 H   0  0  0  0  0  0
  -9.12410  -7.18450  11.75870 H   0  0  0  0  0  0
  -9.35260  -5.87520  10.59050 H   0  0  0  0  0  0
 -11.04610  -2.41970  11.78010 H   0  0  0  0  0  0
 -11.66930  -4.06770  11.61530 H   0  0  0  0  0  0
 -10.30480  -3.51330  10.60280 H   0  0  0  0  0  0
  1 15  1  0  0  0
  1 14  2  0  0  0
  1  2  1  0  0  0
  2  4  2  0  0  0
  2  3  1  0  0  0
  3 17  1  0  0  0
  3 16  1  0  0  0
  4  5  1  0  0  0
  5  7  2  0  0  0
  5  6  1  0  0  0
  6 19  1  0  0  0
  6 18  1  0  0  0
  7 14  1  0  0  0
  7  8  1  0  0  0
  8  9  2  0  0  0
  9 11  1  0  0  0
  9 10  1  0  0  0
 10 22  1  0  0  0
 10 21  1  0  0  0
 10 20  1  0  0  0
 11 13  2  0  0  0
 11 12  1  0  0  0
 12 25  1  0  0  0
 12 24  1  0  0  0
 12 23  1  0  0  0
 13 14  1  0  0  0
M  END
END "mol"

atomlist = ["C10","C12","N3","N6"]



function checkOrient() {
ptcenter = {*}.xyz
q = quaternion()// current rotation
asort = []
for (var i = 1; i <= atomlist.length; i++) {
var a = atomlist[i]
var pt = {atomName=a}.xyz - ptcenter
asort[i] = [a, (q%pt).z]
}
asort = asort.sort(2)
var frontAtom = (asort[0])[1]
select {atomName=frontatom}
}

selectionHalos on
# run checkOrient() every 100 milliseconds.
timeout "t1" -100 "checkOrient()"


-Eric

Eric Martz, Professor Emeritus, Dept Microbiology
U Mass, Amherst -- Martz.MolviZ.Org 

 * Top Five 3D MolVis Tools: Top5.MolviZ.Org 
 * FirstGlance: 3D Molecules in /Nature/: FirstGlance.Jmol.Org
   
 * Protein 3D Structure Wiki: Proteopedia.Org 
 * Education: Biochem in 3D at MolviZ.Org 
 * Find 

Re: [Jmol-users] labeling residue by position relative to observer

2017-05-15 Thread Luciano Abriata
Thank you Angel. Actually now that you wrote the word "screen-Z" I could refine 
my searches and found this:

| x = point({sx,sy,sz}, false) |

gives the 3D coordinates {x, y, z} cooresponding to the screen coordinates {sx, 
sy, sz}. 

which I think is a good starting point for what I want!
Luciano


  De: Angel Herráez <angel.herr...@uah.es>
 Para: Luciano Abriata <luciano_abri...@yahoo.com>; 
jmol-users@lists.sourceforge.net 
 Enviado: Domingo, 14 de mayo, 2017 20:15:38
 Asunto: Re: [Jmol-users] labeling residue by position relative to observer
   
Ciao Luciano

Although Jmol obviously "knows" the screen-Z position of an atom (used e.g 
in perspective, fog, slab and depth, rotate best), I can find no command that
will retrieve that value.



---
El software de antivirus Avast ha analizado este correo electrónico en busca de 
virus.
https://www.avast.com/antivirus


   --
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] labeling residue by position relative to observer

2017-05-14 Thread Angel Herráez
Ciao Luciano

Although Jmol obviously "knows" the screen-Z position of an atom (used e.g 
in perspective, fog, slab and depth, rotate best), I can find no command that 
will retrieve that value.



---
El software de antivirus Avast ha analizado este correo electrónico en busca de 
virus.
https://www.avast.com/antivirus


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] labeling residue by position relative to observer

2017-05-13 Thread Luciano Abriata
Hello, does anybody know how to know which atoms are being displayed closer to 
the viewer? (in other words, most visible on top of all other atoms). I want to 
automatically label protein residues being observed by the user as (s)he 
rotates the protein.

Sorry for the report! And thanks for your help,
Luciano

  De: Luciano Abriata 
 Para: "jmol-users@lists.sourceforge.net"  
 Enviado: Miércoles, 10 de mayo, 2017 20:40:10
 Asunto: labeling residue by position relative to observer
   
Hello Jmol community,
I searched on google but found no hint on how to do this: given a 3D view in 
JSmol, I want to label the residue (or just CA atom) that is "closest" to the 
viewer (user, or observer) in 3D. (Or even better, maybe label the 5 closest 
residues). This, in a dynamic way such that when the user rotates the molecule 
in any direction, the new residues that are closest to him/her are now labeled. 
I hope the description of my problem is clear enough!

Do you see any way to achieve this? I guess I should access the x, y, z 
positions of the atoms in the frame of the camera? (but how?)

Thanks a lot for your help!
Luciano


   --
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


[Jmol-users] labeling residue by position relative to observer

2017-05-10 Thread Luciano Abriata
Hello Jmol community,
I searched on google but found no hint on how to do this: given a 3D view in 
JSmol, I want to label the residue (or just CA atom) that is "closest" to the 
viewer (user, or observer) in 3D. (Or even better, maybe label the 5 closest 
residues). This, in a dynamic way such that when the user rotates the molecule 
in any direction, the new residues that are closest to him/her are now labeled. 
I hope the description of my problem is clear enough!

Do you see any way to achieve this? I guess I should access the x, y, z 
positions of the atoms in the frame of the camera? (but how?)

Thanks a lot for your help!
Luciano
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users