OK, this is pretty amazing. Turns out the compiler can handle functions. 
Took me most of the day, but believe it or not, now you can:

1) write macros that look like commands:

function coloritgreen
 color atoms green
end function


delay 1; coloritgreen; delay 2

2) write subroutines that accept parameters:

function drawline(id,atom1,atom2)
  var x = script("draw line"+id+" {atomno="+atom1+"} {atomno="+atom2+"})")
end function

[note the localization of the variable x using the "var" keyword, like 
JavaScript

3) write your own math functions:

function dist_nm_rounded(a,b)
    return (a.distance(b) * 100)%0
end function


x = dist_nm_rounded({atomno=3},{atomno=4}) / 2

print dist_nm_rounded({atomno=3},{atomno=4})


You can nest up to 10 scripts and functions. That could be higher -- 10 
is totally arbitrary.



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



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to