Sea Blou wrote:
>
> But when I use the jmolloadinline, it always give me error message
> which said
> format can not be recognized. What I did is I got the contents of
> the jaguar file and
> passed them by jmolloadinline.
>
> <SCRIPT>
> jmolInitialize("../jmol");
> jmolCheckBrowser("popup", "../../browsercheck", "onClick");
> var script ="wireframe .1; cpk off;" +
> "frame 3; vectors on; color vectors yellow;" +
> "move 10 -20 10 0 0 0 0 0 1; delay 1; vibration on;";
>
> var mol ='Job PY_QZ1-1_GOB1V started on bc54 at Fri Jul 27
> 07:57:45 2007\n'+'jobid: bc54-0-46a9ebc8\n'
>
> +'+--------------------------------------------------------------------+\n'
> +'| Jaguar version 6.5, release
> 106 |\n'
>
> +'|
> |\n'
> +'| Copyright (c) 2005 Schrodinger,
> LLC. |\n'
> +'| All Rights
> Reserved. |\n'
>
> +'|
> |\n'
> jmolApplet(400," ");
> jmolAppletLoadInline(mol,script);
>
Well, it turns out that Jaguar files can't be read inline this way. The
problem is that we use vertical bar as a line terminator, and in Jaguar
files that turns out to be a critical component.
Furthermore, this method of creating the applet without a script and
then immediately running a script will not generally work. The script
has to be part of the applet loading process. But, ALAS, the problem is
that the script cannot be part of that, because new line characters are
not honored in applet loading. That's why we came up with the vertical
bar idea.
SO, here's the question: How can we load a file inline initially without
it being part of the applet tag, avoid the vertical bar business, and
also run an initializing script -- all in the correct order? There is a way:
1) start Jmol with:
jmolApplet(400,'script "javascript:loadMyFile()";');
This just runs a JavaScript function on the page instead of a Jmol
script. It avoids putting the data into the applet tag, and it still
ensures that the script will be run when we want it to -- after applet
initialization.
2) create the following JavaScript function on your page:
function loadMyFile(){
var script ='data "model"Job PY_QZ1-1_GOB1V started on bc54 at Fri Jul
27 07:57:45 2007\n'+'jobid: bc54-0-46a9ebc8\n'
+'+--------------------------------------------------------------------+\n'
+' | Jaguar version 6.5, release
106 |\n'
+'
| |\n'
+' | Copyright (c) 2005 Schrodinger,
LLC. |\n'
+' | All Rights
Reserved. |\n'
+'
| |\n'
[etc.]
+"end model;"
+"wireframe .1; cpk off;" +
"frame 3; vectors on; color vectors yellow;" +
"move 10 -20 10 0 0 0 0 0 1; delay 1; vibration on;";
jmolScript(script)
}
This avoids the vertical bar business because it uses the DATA command,
and in additon it sequences the loading of the file into the rest of the
script, so the entire script runs at once in the proper order.
By the way, there is a minor problem with your data. You dropped two
spaces prior to those vertical bars -- this turns out to be critical for
Jmol to identify the file as a Jaguar file. The critical line is
+'| Jaguar version 6.5, release
106 |\n'
which must read at least:
+' | Jaguar version'
In general, make sure all the original leading spaces are there -- the
Jaguar reader needs to see some of them.
Bob
>
> Thanks,
>
> Alan
>
>------------------------------------------------------------------------
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc.
>Still grepping through log files to find problems? Stop.
>Now Search log events and configuration files using AJAX and a browser.
>Download your FREE copy of Splunk now >> http://get.splunk.com/
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Jmol-users mailing list
>[email protected]
>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
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users