JR -- when I get time I'll take a close look here -- definitely have to
get this exactly right (+D, +E?). You probably have it. Not tonight.
Bob
JR Schmidt wrote:
>I've found that scientific notation (such as 4.5E-4) does not work in
>Jmol scripts. This somewhat problematic, in that, for isosurfaces,
>one frequently deals with numbers that are not conveniently
>represented in fixed precision decimals. I found it relatively easy
>to generalize the Compiler.lookingAtDecimal method to handel
>scientific notation, by modifing the subroutine to end as:
>
>...
> //well, guess what? we also have to look for 86.1Na, so...
>// if (ch == '.' && (ichT + 2 < cchScript) &&
>// (isAlphabetic(script.charAt(ichT + 2)) ||
>script.charAt(ichT + 2) == '?'))
>// return false;
>
> ++ichT;
> while (ichT < cchScript && isDigit(script.charAt(ichT))) {
> ++ichT;
> digitSeen = true;
> }
> //check for scientific notation
> if (script.charAt(ichT) == 'E')
> {
> boolean isScientific = true;
> if (ichT + 1 < cchScript && isDigit(script.charAt(ichT + 1)))
> ichT=ichT + 1; //move to the exponent
> else if (ichT + 2 < cchScript && script.charAt(ichT + 1) ==
>'-' && isDigit(script.charAt(ichT + 2)))
> ichT=ichT + 2; //move to the exponent
> else
> isScientific = false;
> while (isScientific && ichT < cchScript &&
>isDigit(script.charAt(ichT))) {
> ++ichT;
> digitSeen = true;
> }
> }
>
> cchToken = ichT - ichToken;
> return digitSeen;
>}
>
>This handles number of the form 4.51E-4 and 4.51E4, etc. Note that,
>as written, the 'E' has to be capitalized; this could be generalized,
>if desired, but since Float.toString() returns a capital E, this
>seemed consistent.
>
>Note also that I have commented out the small chunk of code checking
>for things of the form '86.1Na' because the check incorrectly flags
>scientific notation numbers such as 4.5E-4, with only one number
>after the decimal point. If I understood what that check was
>intended to do, I'm sure i could make it more specific...
>
>In any case, I think this would be a valuable addition to the stock
>Jmol codebase. Any thoughts?
>
> JR Schmidt
>
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Jmol-developers mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers