Re: [Jmol-users] callback for minimize
Thank you, Rolf Yes, it seems that although the callbacks can be targeted to a jmolscript, it does not allow to pick any parameters like it does in Javascript. After all, even though I was developing in the Jmol aplication console, my target is a webpage, so I have "outsourced" the processing to a Javascript function that after checking the arguments returned by the callback, uses a Jmol script to return the proper action. In case anyone is interested, this is my example // webpage, with 2 JSmol panels named jmol1 and jmol2 // script in Jmol (within two otherwise different spt files called by the page): set MinimizationCallback "jmolMinim"; set echo top center; echo "initial message" minimize steps 250; // Javascript in the page: function jmolMinim() { //callback, reports starting / running / done if (arguments[1]=='done') { if (arguments[0]=='jmol1') { Jmol.script(jmol1, 'echo "final message 1";') } else if (arguments[0]=='jmol2') { Jmol.script(jmol2, 'echo "final message 2";') } } } The effect is that "initial message" is displayed until the minimization finishes, then it is replaced by a different message in each JSmol. -- 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] callback for minimize
Am 30.01.17 um 22:24 schrieb Angel Herráez: > Dear Jmolers > > I'm trying to set an echo that will display after a minimization has finished. > I prefer not to apply single thread "using set useMinimizationThread false", > so I thought I could us the callback, > but I am unable to make it work > > Does anyone have a working example? > > This is what I've tried, in the Jmol 14.6.4 application's console: > > set echo top; > function mini(a,b,c,d,e,f) { if (b=='done') { echo "finished"; } } > set minimizationCallback "jmolscript:mini"; > minimize steps 30; > > The minimization runs but there is no reporting. > > Or "print" instead of "echo" -- no diference > Angel, my experience with the 'hoverCallback' in combination with a Jmolscript function is that it doesn't get any parameters assigned during each callback like it is described for a Javascript function. Instead your own values are assigned (e.g.: 'jmolscript: hoverAction("start")'). As a workaround I use the '_atomhovered' variable to determine the hovered atom. It seems to be similar for the 'minimizationCallback'. Unfortunatley there doesn't seem to be a similar system variable that could be used here as a workaround. You might be able to use your own global variable to count the minimization steps and use the counter to determine the minimization end. Regards, Rolf -- 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] callback for minimize
Dear Jmolers I'm trying to set an echo that will display after a minimization has finished. I prefer not to apply single thread "using set useMinimizationThread false", so I thought I could us the callback, but I am unable to make it work Does anyone have a working example? This is what I've tried, in the Jmol 14.6.4 application's console: set echo top; function mini(a,b,c,d,e,f) { if (b=='done') { echo "finished"; } } set minimizationCallback "jmolscript:mini"; minimize steps 30; The minimization runs but there is no reporting. Or "print" instead of "echo" -- no diference --- 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