Re: [Jmol-users] "newbie" question....load from script
Many thanks for all of your guidance Bob -- I've taken your advice about switching over to Jmol.js and jmolApplet() / jmolScript() ... as you say, I expect it will save me even more trouble in the future! I've only been working at this for ~ a week, so I've got a great deal of learning to do (and making mistakes is a very good way of doing that) Cheers, Tom On Wed, Mar 26, 2008 at 4:25 PM, Bob Hanson <[EMAIL PROTECTED]> wrote: > Thomas Stout wrote: > > > > > Ah ha! -- Lots of good information and suggestions there - thank you > > very much! > > One of those was exactly the problem: it turns out that naming the > > script "load.script" OR load_script was problematic. Renaming to > > either "load_script.txt" or "foo" works as expected! As you suggest, > > I suspect there is some confusion arising from naming the file so > > similarly to an actual jmol command. Somehow it seemed to be parsing > > through that file looking for coordinate files to "load" and that's > > all it didbut it didn't throw an error about all the extraneous > stuff! > > > > BTW, I've not been enclosing script names in quotes because it breaks > > my HTML (at least on Linux/Firefox). The HTML command looks like: > > Load > > script > > > Sure, that makes sense. There's a reason we suggest using quotation > marks, although I'm surprised load_script did not work. Actually -- it > did -- the debug report you sent in the last email did show that the > load_script file was being read. Only "load.script" (without the > quotation marks) would cause the problem. > > In any case, that's a classic problem. You can't escape quotes using \" > in an HTML tag, and here you would need three sets, because you have to > have them for the Jmol command, the JavaScript command, and the HTML tag. > > Two comments: > > javascript:document.jmol.script('') > > is very odd. I think it indicates you are not using Jmol.js. If that's > the case, I recommend you read up on why we recommend use of Jmol.js. > Mostly it makes life easy and provides automatic cross-browser support. > My guess is that with some browsers, for instance, "document.jmol" does > not work. So to save yourself more grief, use > > > > and then just create the applet using > > jmolApplet() > > and script it using > > jmolScript() > > This doesn't relate to the quotation marks problem, but it does point > you in the right direction for success, I think. > > Second: > > If changing the filename works, fine, but in general I recommend using > Jmol.js and > > jmolLink(...) > > if you want to add an HTML link. That command creates the link but > doesn't have the quotation issue, because it stores the command in an > array and then calls a function that accesses that value and calls > jmolScript() with it. It also adds some nice CSS around the link so you > can control mouse-based movement around the link. > > Good luck! > > Bob > > > -- > Robert M. Hanson > Professor of Chemistry > St. Olaf College > Northfield, MN > 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 > > > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > ___ > Jmol-users mailing list > Jmol-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jmol-users > - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users
Re: [Jmol-users] "newbie" question....load from script
Hi again Tom. (Sorry to be late, the time shift) 1.- Everything in your page (using the files you sent me off-list) works OK here in local mode, so the problem as Bob advised must be specific to serving files from the web server. Those of us who started with Chime before Jmol have got into the habit of using SPT extension for scripts, so we didn't find this before. Of course, you can use any extension as you wish, but it seems that no extension is dangerous. 2.- Isosurfaces: you should give a name to both, to avoid trouble. In addition, it seems that when you have several frames you must select each frame before generating the isosurface. This is discussed here: http://www.mail-archive.com/jmol-users@lists.sourceforge.net/msg08941.html and I have just tried a modification of your surfaces_AZ.script file that does indeed work, generating both isosurfaces: frame 1; select *:A; isosurface prA ignore(*:Z or solvent) resolution 0 molecular translucent; frame 2; select *:Z; isosurface ligZ ignore(protein or solvent) resolution 0 color green molecular translucent; - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users
Re: [Jmol-users] "newbie" question....load from script
Thomas Stout wrote: > > Ah ha! -- Lots of good information and suggestions there - thank you > very much! > One of those was exactly the problem: it turns out that naming the > script "load.script" OR load_script was problematic. Renaming to > either "load_script.txt" or "foo" works as expected! As you suggest, > I suspect there is some confusion arising from naming the file so > similarly to an actual jmol command. Somehow it seemed to be parsing > through that file looking for coordinate files to "load" and that's > all it didbut it didn't throw an error about all the extraneous stuff! > > BTW, I've not been enclosing script names in quotes because it breaks > my HTML (at least on Linux/Firefox). The HTML command looks like: > Load > script > Sure, that makes sense. There's a reason we suggest using quotation marks, although I'm surprised load_script did not work. Actually -- it did -- the debug report you sent in the last email did show that the load_script file was being read. Only "load.script" (without the quotation marks) would cause the problem. In any case, that's a classic problem. You can't escape quotes using \" in an HTML tag, and here you would need three sets, because you have to have them for the Jmol command, the JavaScript command, and the HTML tag. Two comments: javascript:document.jmol.script('') is very odd. I think it indicates you are not using Jmol.js. If that's the case, I recommend you read up on why we recommend use of Jmol.js. Mostly it makes life easy and provides automatic cross-browser support. My guess is that with some browsers, for instance, "document.jmol" does not work. So to save yourself more grief, use and then just create the applet using jmolApplet() and script it using jmolScript() This doesn't relate to the quotation marks problem, but it does point you in the right direction for success, I think. Second: If changing the filename works, fine, but in general I recommend using Jmol.js and jmolLink(...) if you want to add an HTML link. That command creates the link but doesn't have the quotation issue, because it stores the command in an array and then calls a function that accesses that value and calls jmolScript() with it. It also adds some nice CSS around the link so you can control mouse-based movement around the link. Good luck! Bob -- Robert M. Hanson Professor of Chemistry St. Olaf College Northfield, MN 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 - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users
Re: [Jmol-users] "newbie" question....load from script
Ah ha! -- Lots of good information and suggestions there - thank you very much! One of those was exactly the problem: it turns out that naming the script " load.script" OR load_script was problematic. Renaming to either "load_script.txt" or "foo" works as expected! As you suggest, I suspect there is some confusion arising from naming the file so similarly to an actual jmol command. Somehow it seemed to be parsing through that file looking for coordinate files to "load" and that's all it didbut it didn't throw an error about all the extraneous stuff! BTW, I've not been enclosing script names in quotes because it breaks my HTML (at least on Linux/Firefox). The HTML command looks like: Load script and putting quotes around the filename leads to the link being interpreted as: "javascript:document.jmol.script('script " (it doesn't differentiate between double, single or back-tick quotes and doesn't nest them) Many, many thanks for these insights! -Tom On Wed, Mar 26, 2008 at 12:29 PM, Bob Hanson <[EMAIL PROTECTED]> wrote: > Thomas Stout wrote: > > > > > Thanks very much -- this is getting /more/ confusing! If I add "set > > debugScript; set loglevel 5;" to the script, nothing changes and the > > amount of output to the console does not change (I only get "Script > > completed / Jmol script terminated". > > But you also get those "Token" statements -- those are from set > debugScript; set loglevel 5. > > > > However, the coordinates DO load, but no other JMol commands in the > > script are executed, whether they are placed before or after the > > "load" command. Now, if I cut and paste all of those commands from > > the script file into the console, then every statement is executed! > > So, I was suspecting the file itself, but I've also tried creating a > > completely new file with a different name and got the same result > > It's highly unlikely that the other Jmol commands are not executing. > There is nothing unique about loading a script from a file or loading by > a script. > > There are a few more debugging tricks that you might want to try: > > set showScript; // display script commands as they are processed > set scriptDelay 1000; // 1 sec. delay between commands > > Now, you should see exactly what is being executed. > > > > > > > > > I just tried something else & seem to have gotten it partially > > working. I got rid of "zap;" and I changed: > > select :Z; > > center :Z; > > > > to: > > > > select *:Z; > > center *:Z; > > > This should not matter at all. > > > and now some additional commands are executing, but not allI had > > previously tried "center *;" and that didn't work either. Here is the > > full script file (currently): > > > > > load FILES "protein.pdb" "ligand.pdb"; > > frames ALL; > > select *:Z; > > center *:Z; > > zoom 300; > > spacefill on; > > delay 0.5; > > zoom 100; > > > > It is now getting as far as the first "zoom" - I can clearly observe > > that! But, the spacefill is not applied, nor is the subsequent > zoom-out. > > > > > However, if I paste all these commands into the console, all are > > executed successfully! > > > > Here is the output in the console window (from calling the script file > > via an HTML link): > > > What browser/platform are you using? I suppose it is possible that the > delay command is hanging the thread that is assigned to the browser. > Could be something we are not aware of. > > > Eval.instructionDispatchLoop():1206556049237 > > Eval > > pc:0 > > 2 statements > > the above shows that "debugScript;set loglevel 5" worked. > > > > > Token[keyword(0x108010b) intValue=16(0x10) value="script"] > > Token[string(0x4) value="load_script"] > > do you have a file called "load_script", without any extension? I > thought it was "load.script". One problem is that your browser may be > doing something funny with that file because it has no extension. You > might try renaming it "load_script.txt" > > Also, you should be putting fileNames in double quotes: > > script "load_script.txt" > > I know some people don't do that, and sometimes that's OK, but it is > always safest to use double quotes around a file name, and sometimes it > is required (as in the load FILES command). With names like "load" and > "script" as part of the name, you might be having a problem there. > > > > > > > > Token[keyword(0x144) intValue=16(0x10) value="frame"] > > Token[keyword(0x8000f) value="all"] > > > > END > > END? OK, then that's the end of the script. It must be just > > script load_script > frames ALL; > > > > > Token[keyword(0x108010b) intValue=16(0x10) value="script"] "load_script" > > Eval.instructionDispatchLoop():1206556049241 > > Running just 4 ms after the first one, so this is the script file > executing, I suppose. > > > > Eval > > pc:0 > > 4 statements > > > > Token[keyword(0x1081109) intValue=16(0x10) value="load"] > > Token[identifier(0x1) value="files"] > > Token[string(0x4) value="protein.pdb"] > > Token[string(
Re: [Jmol-users] "newbie" question....load from script
Thomas Stout wrote: > > Thanks very much -- this is getting /more/ confusing! If I add "set > debugScript; set loglevel 5;" to the script, nothing changes and the > amount of output to the console does not change (I only get "Script > completed / Jmol script terminated". But you also get those "Token" statements -- those are from set debugScript; set loglevel 5. > However, the coordinates DO load, but no other JMol commands in the > script are executed, whether they are placed before or after the > "load" command. Now, if I cut and paste all of those commands from > the script file into the console, then every statement is executed! > So, I was suspecting the file itself, but I've also tried creating a > completely new file with a different name and got the same result It's highly unlikely that the other Jmol commands are not executing. There is nothing unique about loading a script from a file or loading by a script. There are a few more debugging tricks that you might want to try: set showScript; // display script commands as they are processed set scriptDelay 1000; // 1 sec. delay between commands Now, you should see exactly what is being executed. > > I just tried something else & seem to have gotten it partially > working. I got rid of "zap;" and I changed: > select :Z; > center :Z; > > to: > > select *:Z; > center *:Z; > This should not matter at all. > and now some additional commands are executing, but not allI had > previously tried "center *;" and that didn't work either. Here is the > full script file (currently): > > load FILES "protein.pdb" "ligand.pdb"; > frames ALL; > select *:Z; > center *:Z; > zoom 300; > spacefill on; > delay 0.5; > zoom 100; > > It is now getting as far as the first "zoom" - I can clearly observe > that! But, the spacefill is not applied, nor is the subsequent zoom-out. > However, if I paste all these commands into the console, all are > executed successfully! > > Here is the output in the console window (from calling the script file > via an HTML link): What browser/platform are you using? I suppose it is possible that the delay command is hanging the thread that is assigned to the browser. Could be something we are not aware of. > Eval.instructionDispatchLoop():1206556049237 > Eval > pc:0 > 2 statements the above shows that "debugScript;set loglevel 5" worked. > > Token[keyword(0x108010b) intValue=16(0x10) value="script"] > Token[string(0x4) value="load_script"] do you have a file called "load_script", without any extension? I thought it was "load.script". One problem is that your browser may be doing something funny with that file because it has no extension. You might try renaming it "load_script.txt" Also, you should be putting fileNames in double quotes: script "load_script.txt" I know some people don't do that, and sometimes that's OK, but it is always safest to use double quotes around a file name, and sometimes it is required (as in the load FILES command). With names like "load" and "script" as part of the name, you might be having a problem there. > > > Token[keyword(0x144) intValue=16(0x10) value="frame"] > Token[keyword(0x8000f) value="all"] > > END END? OK, then that's the end of the script. It must be just script load_script frames ALL; > Token[keyword(0x108010b) intValue=16(0x10) value="script"] "load_script" > Eval.instructionDispatchLoop():1206556049241 Running just 4 ms after the first one, so this is the script file executing, I suppose. > Eval > pc:0 > 4 statements > > Token[keyword(0x1081109) intValue=16(0x10) value="load"] > Token[identifier(0x1) value="files"] > Token[string(0x4) value="protein.pdb"] > Token[string(0x4) value="ligand.pdb"] > > > Token[keyword(0x31e) intValue=16(0x10) value="select"] > Token[keyword(0x80064) value="expressionBegin"] > Token[keyword(0x8001c) intValue=90(0x5a) value="spec_chain"] > Token[keyword(0x80065) value="expressionEnd"] > > > Token[keyword(0x304) intValue=16(0x10) value="center"] > Token[keyword(0x80064) value="expressionBegin"] > Token[keyword(0x8001c) intValue=90(0x5a) value="spec_chain"] > Token[keyword(0x80065) value="expressionEnd"] > > > Token[keyword(0x152f) intValue=16(0x10) value="zoom"] > Token[integer(0x2) intValue=300(0x12c) value="300"] > > END So your script file says: load FILES "protein.pdb" "ligand.pdb" select :Z center :Z zoom 300 There aren't any other commands there. > Token[keyword(0x1081109) intValue=16(0x10) value="load"] files > "protein.pdb" "ligand.pdb" > Successfully loaded:files > select *:Z > Token[keyword(0x304) intValue=16(0x10) value="center"] *:Z > Token[keyword(0x152f) intValue=16(0x10) value="zoom"] 300 these are executing from your script file load_script > Token[keyword(0x144) intValue=16(0x10) value="frame"] > Token[keyword(0x8000f) value="all"] > Script completed This is executing from your main script > Jmol script terminated > > > So, it l
Re: [Jmol-users] "newbie" question....load from script
Thanks very much -- this is getting *more* confusing! If I add "set debugScript; set loglevel 5;" to the script, nothing changes and the amount of output to the console does not change (I only get "Script completed / Jmol script terminated". However, the coordinates DO load, but no other JMol commands in the script are executed, whether they are placed before or after the "load" command. Now, if I cut and paste all of those commands from the script file into the console, then every statement is executed! So, I was suspecting the file itself, but I've also tried creating a completely new file with a different name and got the same result I just tried something else & seem to have gotten it partially working. I got rid of "zap;" and I changed: select :Z; center :Z; to: select *:Z; center *:Z; and now some additional commands are executing, but not allI had previously tried "center *;" and that didn't work either. Here is the full script file (currently): load FILES "protein.pdb" "ligand.pdb"; frames ALL; select *:Z; center *:Z; zoom 300; spacefill on; delay 0.5; zoom 100; It is now getting as far as the first "zoom" - I can clearly observe that! But, the spacefill is not applied, nor is the subsequent zoom-out. However, if I paste all these commands into the console, all are executed successfully! Here is the output in the console window (from calling the script file via an HTML link): Eval.instructionDispatchLoop():1206556049237 Eval pc:0 2 statements Token[keyword(0x108010b) intValue=16(0x10) value="script"] Token[string(0x4) value="load_script"] Token[keyword(0x144) intValue=16(0x10) value="frame"] Token[keyword(0x8000f) value="all"] END Token[keyword(0x108010b) intValue=16(0x10) value="script"] "load_script" Eval.instructionDispatchLoop():1206556049241 Eval pc:0 4 statements Token[keyword(0x1081109) intValue=16(0x10) value="load"] Token[identifier(0x1) value="files"] Token[string(0x4) value="protein.pdb"] Token[string(0x4) value="ligand.pdb"] Token[keyword(0x31e) intValue=16(0x10) value="select"] Token[keyword(0x80064) value="expressionBegin"] Token[keyword(0x8001c) intValue=90(0x5a) value="spec_chain"] Token[keyword(0x80065) value="expressionEnd"] Token[keyword(0x304) intValue=16(0x10) value="center"] Token[keyword(0x80064) value="expressionBegin"] Token[keyword(0x8001c) intValue=90(0x5a) value="spec_chain"] Token[keyword(0x80065) value="expressionEnd"] Token[keyword(0x152f) intValue=16(0x10) value="zoom"] Token[integer(0x2) intValue=300(0x12c) value="300"] END Token[keyword(0x1081109) intValue=16(0x10) value="load"] files "protein.pdb" "ligand.pdb" Successfully loaded:files select *:Z Token[keyword(0x304) intValue=16(0x10) value="center"] *:Z Token[keyword(0x152f) intValue=16(0x10) value="zoom"] 300 Token[keyword(0x144) intValue=16(0x10) value="frame"] Token[keyword(0x8000f) value="all"] Script completed Jmol script terminated So, it looks to me like it is simply ignoring the last three statements, but I can't figure out why! Thanks for your interest! -Tom On Tue, Mar 25, 2008 at 4:37 PM, Angel Herráez <[EMAIL PROTECTED]> wrote: > Hi, Thomas, welcome to Jmol world! > > I can see no reason for the problem you describe. > Try these: > > 1.- open the Java console* and see if there is some error there > (*find a coffee cup icon in the taskbar, bottom right of your screen, > right-click on it, > choose "Open Console") > > 2.- open Jmol console from the applet pop-up menu and try commands from > there, > both your "script load.script" and any other commands after that, like > "spacefill off". > See if they work and if any errors show up there or in the Java console. > > > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > ___ > Jmol-users mailing list > Jmol-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jmol-users > - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users
Re: [Jmol-users] "newbie" question....load from script
Hi, Thomas, welcome to Jmol world! I can see no reason for the problem you describe. Try these: 1.- open the Java console* and see if there is some error there (*find a coffee cup icon in the taskbar, bottom right of your screen, right-click on it, choose "Open Console") 2.- open Jmol console from the applet pop-up menu and try commands from there, both your "script load.script" and any other commands after that, like "spacefill off". See if they work and if any errors show up there or in the Java console. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users
Re: [Jmol-users] "newbie" question....load from script
Tom, welcome! Be sure to let us know if you are using the application or the applet -- sometimes it makes a difference. The zap command is not necessary -- it's always executed first as part of the load command. But it must have been excuted. Everything looks fine there. Try adding these first two lines to your script: set debugScript set loglevel 5 Then see if you can find the Java console. This is something you will use a lot. If using the application, it's under "Help"; if using the applet on Windows it's a little icon in the bottom right of the bar with the program icons. Looks like a cup of coffee, I think. Click on that and select "open console" - that's where all the useful messages are. Load your script and check for errors. Bob Thomas Stout wrote: > > Hi All -- > > I am /just /getting started with JMol, so I apologize if this is > blatently obvious, but I've run into a bit of strange behavior with > scripting the applet. Is there something particularly "special" about > the "load" command? I am calling out to a script file to load several > PDB files, but for reasons I don't understand no other command seems > to be executed from the script file. > > For example, if I issue: > script load.script; > > and "load.script" contains: > zap; > load FILES "molecule1.pdb" "molecule2.pdb"; > frame ALL; > center *; > > then, mysteriously, neither the "zap", the "frame" or the "center" > commands are executed, but the coordinates DO get loaded! I find > this really surprising, since I would expect things to be executed in > order (or error-out). > > Any clues for the clue-less (me)? > Thanks! > -Tom > > PS - I'm using version 11.4.0 > > > >- >Check out the new SourceForge.net Marketplace. >It's the best place to buy or sell services for >just about anything Open Source. >http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > > > >___ >Jmol-users mailing list >Jmol-users@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/jmol-users > > -- Robert M. Hanson Professor of Chemistry St. Olaf College Northfield, MN 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 - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users
[Jmol-users] "newbie" question....load from script
Hi All -- I am *just *getting started with JMol, so I apologize if this is blatently obvious, but I've run into a bit of strange behavior with scripting the applet. Is there something particularly "special" about the "load" command? I am calling out to a script file to load several PDB files, but for reasons I don't understand no other command seems to be executed from the script file. For example, if I issue: script load.script; and "load.script" contains: zap; load FILES "molecule1.pdb" "molecule2.pdb"; frame ALL; center *; then, mysteriously, neither the "zap", the "frame" or the "center" commands are executed, but the coordinates DO get loaded! I find this really surprising, since I would expect things to be executed in order (or error-out). Any clues for the clue-less (me)? Thanks! -Tom PS - I'm using version 11.4.0 - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users