Jonathan, also take a look at the source of 
http://chemapps.stolaf.edu/quaternions/PISEMA/pisema.htm -- near the end 
and right at the beginning. This is REALLY easy to set up.

1) place the script in the HTML file in the following form. Note the 
CAPITALIZED words. Those will be filled in with values on the fly.

<!-- JMOL SCRIPT pisemaScriptQ --

var qStandard = quaternion( 0.049291, -0.788039, -0.609815,  0.068490) # 
standard helix
tau = TAU
data "thetaphi"
data "thetaphi"
THETAPHI
end "thetaphi"
SHOW_DETAIL = SHOWDETAIL
DO_VECTORS = DOVECTORS
DRAW_ARCS = DRAWARCS
q0 = QREF #qStandard
axislength = RADIUS * 2 #10
cutoff = CUTOFF #0.001
ndeg0 = 0
function doit()
....
end function

doit

-- JMOL SCRIPT pisemaScriptQ -->


2) Use this function:


function getScript(name) {
  try {
        return eval(name)
  } catch(e) {
        var tag = "-- JMOL SCRIPT " + name + " --";
        var script = document.body.innerHTML.split(tag)[1];
        if (script)
          return script;
  }
  alert("missing embedded Jmol script " + tag)
  return ""
}

like this, where you can see I'm substituting values in -- maybe not 
something we need to do in your case:

    var script = getScript("pisemaScriptQ")
        .replace(/TAU/,tau)
        .replace(/THETAPHI/,ThetaPhi.join("\n"))
        .replace(/SHOWDETAIL/,false)
        .replace(/DOVECTORS/,false)
        .replace(/DRAWARCS/,false)
        .replace(/RADIUS/,150)
        .replace(/QREF/,"qStandard")
        .replace(/CUTOFF/,0.001)
    jmolScript(script);

That's all there is to it!

Bob


Jonathan Gutow wrote:

>Bob,
>       Is this using the inline script stuff you mentioned figuring out for  
>PE?  It seems easier to have fewer files to maintain, but I'm  
>wondering about tweaks and debugging?  I sometimes use these  
>templates as a place to start and then go in and edit the scripts to  
>do loops other things.  Is it harder to do that to scripts included  
>in the .html file?
>
>Jonathan
>On Jul 21, 2008, at 8:47 AM, Bob Hanson wrote:
>
>  
>
>>right -- and, Jonathan, I'd like to show you how we can make the  
>>scripts
>>all part of ONE file -- the HTML -- so that there will be none of this
>>multiple SPT file problem at all.
>>
>>Bob
>>
>>
>>Jonathan Gutow wrote:
>>
>>    
>>
>>>Dear all:
>>>     I've thought of a way of making the javascript for the export to web
>>>functions more flexible.  Since we always save this script with
>>>the .html, .spt, etc... used to make the page, I don't think I have
>>>to maintain backwards compatibility, do I?  There are functions I'd
>>>like to replace with a more flexible ones that take a different
>>>number of parameters.  Any thoughts?
>>>
>>>Jonathan
>>>
>>>                         Dr. Jonathan H. Gutow
>>>Chemistry Department                                 [EMAIL PROTECTED]
>>>UW-Oshkosh                                           Office: 
>>>920-424-1326
>>>800 Algoma Boulevard                                 FAX:920-424-2042
>>>Oshkosh, WI 54901
>>>                 http://www.uwosh.edu/faculty_staff/gutow/
>>>
>>>
>>>
>>>
>>>
>>>--------------------------------------------------------------------- 
>>>----
>>>This SF.Net email is sponsored by the Moblin Your Move Developer's  
>>>challenge
>>>Build the coolest Linux based applications with Moblin SDK & win  
>>>great prizes
>>>Grand prize is a trip for two to an Open Source event anywhere in  
>>>the world
>>>http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>_______________________________________________
>>>Jmol-developers mailing list
>>>Jmol-developers@lists.sourceforge.net
>>>https://lists.sourceforge.net/lists/listinfo/jmol-developers
>>>
>>>
>>>      
>>>
>>-- 
>>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 the Moblin Your Move Developer's  
>>challenge
>>Build the coolest Linux based applications with Moblin SDK & win  
>>great prizes
>>Grand prize is a trip for two to an Open Source event anywhere in  
>>the world
>>http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>_______________________________________________
>>Jmol-developers mailing list
>>Jmol-developers@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/jmol-developers
>>    
>>
>
>                          Dr. Jonathan H. Gutow
>Chemistry Department                                 [EMAIL PROTECTED]
>UW-Oshkosh                                           Office:920-424-1326
>800 Algoma Boulevard                                 FAX:920-424-2042
>Oshkosh, WI 54901
>                  http://www.uwosh.edu/faculty_staff/gutow/
>
>
>
>
>
>-------------------------------------------------------------------------
>This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>Build the coolest Linux based applications with Moblin SDK & win great prizes
>Grand prize is a trip for two to an Open Source event anywhere in the world
>http://moblin-contest.org/redirect.php?banner_id=100&url=/
>_______________________________________________
>Jmol-developers mailing list
>Jmol-developers@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/jmol-developers
>  
>


-- 
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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to