Bob,

I was aware of the Jmol integration of JSME and JSpecView, but I did not know 
that auto sync 2D to 3D was an option - i.e. as the 2d drawing grows the 3d 
model is automatically updated with no transfer button click required.

Am I reading you correctly on this:

jmol = Jmol.getApplet("jmol", JmolInfo)
jme = Jmol.getJMEApplet("jme", JMEInfo, jmol);

The above will automatically update any 2d JSME change to 3d Jmol window?

I should have mentioned that JSME has a number of callbacks:

BeforePaste, AfterPaste, AfterStructureModified, AtomHighlight, BondHighlight, 
AtomClicked, BondClicked

I was aware of these other JSME callbacks, but I tend to have tunnel vision 
when a potential simple “model kit” use is a possibility!

Otis

--
Otis Rothenberger
o...@chemagic.org
http://chemagic.org

> On Apr 28, 2016, at 11:38 PM, Robert Hanson <hans...@stolaf.edu> wrote:
> 
> Oh, and JSmol on that jsv_predict2.htm page is using special "all-atom" 
> SMILES calls to find the mapping between JSpecView, JSmol, and JSME, since 
> the MOL file coming back from JSpecView is not the mol file sent to it. It's 
> critical in this case that every atoms - especially the H atoms -- are 
> synchronized. 
> 
> I am almost done with a C13-NMR predictor that works exactly the same way. 
> 
> Bob
> 
> On Thu, Apr 28, 2016 at 10:34 PM, Robert Hanson <hans...@stolaf.edu 
> <mailto:hans...@stolaf.edu>> wrote:
> Otis, that's very interesting. Nice job on that. I think you  are forgetting, 
> though, that JSME is fully integrated into JSmol already. You do not need to 
> add any functions of your own.
> If you look at the code for chemapps.stolaf.edu/jmol/jsmol/jsmetest2.htm 
> <http://chemapps.stolaf.edu/jmol/jsmol/jsmetest2.htm>, you will see that JSME 
> integrates into JSmol very smoothly. It's as simple as this:
> 
> <script type="text/javascript" language="javascript" 
> src="jsme/jsme/jsme.nocache.js"></script>
> <script type="text/javascript" src="JSmol.min.js"></script>
> <script type="text/javascript" src="js/JSmolJME.js"></script>
> 
> var JMEInfo = {     
>     use: "HTML5",
>   visible: true
>   ,"options" : "nocanonize"//"query,hydrogens"
> }
> ...
> 
> jmol = Jmol.getApplet("jmol", JmolInfo)
> jme = Jmol.getJMEApplet("jme", JMEInfo, jmol);
> 
> That last parameter tells JSmol that you want jme to be associated with the 
> jmol instance of JSmol.
> You don't need anything  more on the page.
> Now you have a 2D and 3D applet linked together with a tab interface. 
> Automatic updating.
> 
> If you want two separate applets, like you have there, then you just add a 
> div to that JMEinfo:
> 
> var JMEInfo = {     
>     use: "HTML5"
>   ,visible: true
>   ,divId: "jmediv"
>   ,options : "autoez;nocanonize"
> }
> 
> 
> See jsmetest2.htm for something like what you are doing. The two buttons on 
> that page are driving:
> 
> Jmol.show2d(jmol, false) // to 3D
> Jmol.show2d(jmol, true) // to 2D
> 
> 
> Note that when JSME is in an environment where JSmol and JSpecView are both 
> there -- http://chemapps.stolaf.edu/jmol/jsmol/jsv_predict2.htm 
> <http://chemapps.stolaf.edu/jmol/jsmol/jsv_predict2.htm> -- then it doesn't 
> use this callback and instead uses an even more interesting one:
> 
>               app._applet.setAfterStructureModifiedCallback(f);
> 
> This sends a detailed message every time you change the structure or click on 
> an "atom" in the 2D drawing. JSmol is using this to synchronize the spectrum 
> and JSmol window when the JSME applet is clicked or the structure is 
> modified. Works like a charm!
> 
> That page is actually extraordinarily simple. JSmol automatically senses the 
> presence of JSME, Jmol, and JSpecView on the page using a sort of "bus" 
> communication system. Robert Lancashire and I worked this out a couple of 
> years ago. It's complicated in JSmolCore.js, but it's super simple in terms 
> of the page. As the atoms or spectral regions are clicked, registered applets 
> are automatically queried for their state, and the signal is passed around 
> until all are two or three applets on the page are in sync. 
> 
> The synchronization is activated by a a call to  Jmol.updateView(isJmol ? 
> jmol : jme);
> 
> "Simple" as that! :)
> 
> Bob
> 
> 
> 
> 
> 
> 
> 
> 
> On Thu, Apr 28, 2016 at 6:15 PM, Otis Rothenberger <osrot...@icloud.com 
> <mailto:osrot...@icloud.com>> wrote:
> Maybe someone pointed this out before, but it’s new to me...
> 
> The page below is an ongoing test page that I use, so there are some button 
> and screen message issues (conflicts). Nevertheless one new JSME point is so 
> much fun that I thought I’d point it out:
> 
> http://chemagic.org/molecules/mini2.html 
> <http://chemagic.org/molecules/mini2.html>
> 
> JSME now has a callback function: 
> jsmeApplet.setCallBack("AfterStructureModified", sendToJmol);
> 
> On the above page, I’ve set the callback sendToJmol to:
> 
> function sendToJmol(jsmeEvent) {
>         var jsme = jsmeEvent.src;
>         var jmefile = jsme.jmeFile();
>         window.parent.jms('var molf2 = "' + jmefile + '"; load "@molf2"; 
> hover off; delete hydrogen;calculate hydrogen;boundbox {*}; centerat 
> boundbox; zoom 100;’);
> }
> 
> (jms is a run Jmol script function)
> 
> On the page, ignore the Jmol window messages and standard Jmol/JSME transfer 
> arrow buttons. Just start drawing in the JSME window. Great fun…
> 
> There are some loaded Jmol model issues via this route. I’ll try to figure 
> them out and then ask Bob!
> 
> Otis
> 
> --
> Otis Rothenberger
> o...@chemagic.org <mailto:o...@chemagic.org>
> http://chemagic.org <http://chemagic.org/>
> 
> 
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z 
> <https://ad.doubleclick.net/ddm/clk/302982198;130105516;z>
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net <mailto:Jmol-users@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/jmol-users 
> <https://lists.sourceforge.net/lists/listinfo/jmol-users>
> 
> 
> 
> -- 
> Robert M. Hanson
> Larson-Anderson Professor of Chemistry
> Chair, Department of Chemistry
> St. Olaf College
> Northfield, MN
> http://www.stolaf.edu/people/hansonr <http://www.stolaf.edu/people/hansonr>
> 
> 
> If nature does not answer first what we want,
> it is better to take what answer we get. 
> 
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
> 
> 
> 
> 
> -- 
> Robert M. Hanson
> Larson-Anderson Professor of Chemistry
> Chair, Department of Chemistry
> St. Olaf College
> Northfield, MN
> http://www.stolaf.edu/people/hansonr <http://www.stolaf.edu/people/hansonr>
> 
> 
> If nature does not answer first what we want,
> it is better to take what answer we get. 
> 
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
> 
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z_______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to