From: <ha...@us...> - 2007-10-02 15:41:29
|
Revision: 8343 http://jmol.svn.sourceforge.net/jmol/?rev=8343&view=rev Author: hansonr Date: 2007-10-02 08:41:27 -0700 (Tue, 02 Oct 2007) Log Message: ----------- 11.3.27 VERSION -- # critical bug fix for functions not returning values # bug fix for atomarray[i] not selecting properly # bug fix for write not working with VAR # bug fix for application not accepting pastes into the # console consisting of multiple lines # bug fix for bondOrder command not properly treating 4.0 or 0.5 # bug fix for decimals not represented properly in error messages Modified Paths: -------------- trunk/Jmol/src/org/jmol/modelset/Atom.java trunk/Jmol/src/org/jmol/viewer/Compiler.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Token.java Modified: trunk/Jmol/src/org/jmol/modelset/Atom.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Atom.java 2007-10-02 00:53:47 UTC (rev 8342) +++ trunk/Jmol/src/org/jmol/modelset/Atom.java 2007-10-02 15:41:27 UTC (rev 8343) @@ -557,6 +557,12 @@ Vector3f[] vibrationVectors = group.chain.modelSet.vibrationVectors; return vibrationVectors == null ? null : vibrationVectors[atomIndex]; } + + public float getVibrationCoord(char ch) { + Vector3f[] v = group.chain.modelSet.vibrationVectors; + return (v == null || v[atomIndex] == null ? 0 + : ch == 'x' ? v[atomIndex].x : ch == 'y' ? v[atomIndex].y : v[atomIndex].z); + } public void transform(Viewer viewer) { Point3i screen; @@ -1104,6 +1110,7 @@ case 't': temperature factor case 'U': identity case 'u': sUrface distance + case 'v': vibration x, y, or z vx vy vz case 'V': van der Waals case 'x': x coord case 'X': fractional X coord @@ -1116,7 +1123,7 @@ */ char ch0 = ch = strFormat.charAt(ich++); - if (chAtom != '\0' && ich < cch && ch != 'v' && ch != 'u') { + if (chAtom != '\0' && ich < cch) { if (strFormat.charAt(ich) != chAtom) { strLabel = strLabel + "%"; ich = ichPercent + 1; @@ -1180,6 +1187,25 @@ case 'P': floatT = getPartialCharge(); break; + case 'v': + ch = (ich < strFormat.length() ? strFormat.charAt(ich++) : '\0'); + switch (ch) { + case 'x': + case 'y': + case 'z': + floatT = getVibrationCoord(ch); + break; + default: + if (ch != '\0') + --ich; + Vector3f v = getVibrationVector(); + if (v == null) { + floatT = 0; + break; + } + strT = v.x + " " + v.y + " " + v.z; + } + break; case 'V': floatT = getVanderwaalsRadiusFloat(); break; Modified: trunk/Jmol/src/org/jmol/viewer/Compiler.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Compiler.java 2007-10-02 00:53:47 UTC (rev 8342) +++ trunk/Jmol/src/org/jmol/viewer/Compiler.java 2007-10-02 15:41:27 UTC (rev 8343) @@ -702,7 +702,7 @@ case Token.function: if (!isCheckOnly) htFunctions.put(thisFunction.name, thisFunction); - flowContext.setFunction(script, ichCurrentCommand, iCommand, + flowContext.setFunction(script, ichCurrentCommand, iCommand + 1, lineNumbers, lineIndices, lltoken); thisFunction = null; tokenCommand.intValue = Integer.MAX_VALUE; // don't include this one Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-10-02 00:53:47 UTC (rev 8342) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-10-02 15:41:27 UTC (rev 8343) @@ -6497,6 +6497,11 @@ if (isSyntaxCheck) { v = name; } else { + if (tokAt(i + 1) == Token.leftsquare || tokAt(i + 1) == Token.dot) { + Object o = getParameter(name+"_set", true); + if (o instanceof String && ((String) o).indexOf("({") == 0) + name += "_set"; + } v = getParameter(name, true); if (v instanceof String) v = getStringObjectAsToken((String) v, name); @@ -6915,6 +6920,15 @@ case Token.fracZ: fv = atom.getFractionalCoord('Z'); break; + case Token.vibX: + fv = atom.getVibrationCoord('x'); + break; + case Token.vibY: + fv = atom.getVibrationCoord('y'); + break; + case Token.vibZ: + fv = atom.getVibrationCoord('z'); + break; case Token.distance: if (planeRef != null) fv = Graphics3D.distanceToPlane(planeRef, atom); @@ -7672,6 +7686,10 @@ type = "HIS"; pt++; break; + case Token.var: + pt += 2; + type = "VAR"; + break; case Token.identifier: type = parameterAsString(1).toLowerCase(); if (type.equals("image")) { @@ -7680,9 +7698,6 @@ width = intParameter(pt++); height = intParameter(pt++); } - } else if (type.equals("var")) { - pt += 2; - type = "VAR"; } else if (Parser.isOneOf(type, driverList.toLowerCase())) { pt++; type = type.substring(0, 1).toUpperCase() + type.substring(1); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2007-10-02 00:53:47 UTC (rev 8342) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2007-10-02 15:41:27 UTC (rev 8343) @@ -1,5 +1,8 @@ -version=11.3.27_dev +version=11.3.27 +# critical bug fix for functions not returning values +# bug fix for atomarray[i] not selecting properly +# bug fix for write not working with VAR # bug fix for application not accepting pastes into the # console consisting of multiple lines # bug fix for bondOrder command not properly treating 4.0 or 0.5 Modified: trunk/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Token.java 2007-10-02 00:53:47 UTC (rev 8342) +++ trunk/Jmol/src/org/jmol/viewer/Token.java 2007-10-02 15:41:27 UTC (rev 8343) @@ -403,6 +403,9 @@ final static int psi = atompropertyfloat | 8; final static int surfacedistance = atompropertyfloat | 9; final static int temperature = atompropertyfloat |10; + final static int vibX = atompropertyfloat |11; + final static int vibY = atompropertyfloat |12; + final static int vibZ = atompropertyfloat |13; // mathfunc means x = somefunc(a,b,c) @@ -568,7 +571,7 @@ case Token.point4f: return Escape.escape((Point4f) x.value); case Token.bitset: - return Escape.escape((BitSet) x.value, !(x.value instanceof BondSet)); + return Escape.escape(bsSelect(x), !(x.value instanceof BondSet)); case Token.list: String[] list = (String[]) x.value; i = x.intValue; @@ -636,22 +639,22 @@ } static BitSet bsSelect(Token token) { - selectItem(token, Integer.MIN_VALUE); + token = selectItem(token, Integer.MIN_VALUE); return (BitSet)token.value; } static BitSet bsSelect(Token token, int n) { - selectItem(token, Integer.MIN_VALUE); - selectItem(token, 1); - selectItem(token, n); + token = selectItem(token, Integer.MIN_VALUE); + token = selectItem(token, 1); + token = selectItem(token, n); return (BitSet)token.value; } - static Token selectItem(Token token, int i2) { - if (token.tok != Token.bitset - && token.tok != Token.list - && token.tok != Token.string) - return token; + static Token selectItem(Token tokenIn, int i2) { + if (tokenIn.tok != Token.bitset + && tokenIn.tok != Token.list + && tokenIn.tok != Token.string) + return tokenIn; // negative number is a count from the end @@ -659,29 +662,31 @@ String[] st = null; String s =null; - int i1 = token.intValue; + int i1 = tokenIn.intValue; if (i1 == Integer.MAX_VALUE) { if (i2 == Integer.MIN_VALUE) - i2 = token.intValue; - return new Token(token.tok, i2, token.value); + i2 = tokenIn.intValue; + return new Token(tokenIn.tok, i2, tokenIn.value); } int len = 0; int n = 0; - switch (token.tok) { + Token tokenOut = new Token(tokenIn.tok); + tokenOut.intValue = Integer.MAX_VALUE; + switch (tokenIn.tok) { case Token.bitset: - bs = (BitSet) token.value; + bs = BitSetUtil.copy((BitSet) tokenIn.value); len = BitSetUtil.length(bs); + tokenOut.value = bs; break; case Token.list: - st = (String[]) token.value; + st = (String[]) tokenIn.value; len = st.length; break; case Token.string: - s = (String) token.value; + s = (String) tokenIn.value; len = s.length(); } - token.intValue = Integer.MAX_VALUE; // "testing"[0] gives "g" // "testing"[-1] gives "n" // "testing"[3][0] gives "sting" @@ -701,18 +706,18 @@ else if (i2 < i1) i2 = i1; - switch (token.tok) { + switch (tokenIn.tok) { case Token.bitset: for (int j = 0; j < len; j++) if (bs.get(j) && (++n < i1 || n > i2)) bs.clear(j); - return token; + break; case Token.string: if (i1 < 1 || i1 > len) - token.value = ""; + tokenOut.value = ""; else - token.value = s.substring(i1 - 1, i2); - return token; + tokenOut.value = s.substring(i1 - 1, i2); + break; case Token.list: if (i1 < 1 || i1 > len || i2 > len) return new Token(Token.string, ""); @@ -721,10 +726,10 @@ String[]list = new String[i2 - i1 + 1]; for (int i = 0; i < list.length; i++) list[i] = st[i + i1 - 1]; - token.value = list; - return token; + tokenOut.value = list; + break; } - return token; + return tokenOut; } // parameters @@ -1140,6 +1145,9 @@ "fx", new Token(fracX), "fy", new Token(fracY), "fz", new Token(fracZ), + "vx", new Token(vibX), + "vy", new Token(vibY), + "vz", new Token(vibZ), "all", tokenAll, "none", new Token(none), "null", null, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |