Revision: 20808 http://sourceforge.net/p/jmol/code/20808 Author: hansonr Date: 2015-10-06 04:55:57 +0000 (Tue, 06 Oct 2015) Log Message: ----------- Jmol.___JmolVersion="14.3.16_2015.10.05"
new feature: load =aflow/AgAu -- easy access to binary metal alloy CIF files bug fix: braceless if/for fix from 10.04 Modified Paths: -------------- trunk/Jmol/src/org/jmol/modelset/BondCollection.java trunk/Jmol/src/org/jmol/script/ScriptCompiler.java trunk/Jmol/src/org/jmol/script/ScriptEval.java trunk/Jmol/src/org/jmol/scriptext/IsoExt.java trunk/Jmol/src/org/jmol/scriptext/MathExt.java trunk/Jmol/src/org/jmol/shape/MeshCollection.java trunk/Jmol/src/org/jmol/viewer/JC.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/modelset/BondCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/BondCollection.java 2015-10-04 04:28:59 UTC (rev 20807) +++ trunk/Jmol/src/org/jmol/modelset/BondCollection.java 2015-10-06 04:55:57 UTC (rev 20808) @@ -753,9 +753,8 @@ break; case 'p': case 'm': - bondOrder = Edge.getBondOrderNumberFromOrder( - bond.getCovalentOrder()).charAt(0) - - '0' + (type == 'p' ? 1 : -1); + bondOrder = Edge.getBondOrderNumberFromOrder(bond.getCovalentOrder()) + .charAt(0) - '0' + (type == 'p' ? 1 : -1); if (bondOrder > 3) bondOrder = 1; else if (bondOrder < 0) @@ -775,8 +774,11 @@ return bsAtoms; } bond.setOrder(bondOrder | Edge.BOND_NEW); - removeUnnecessaryBonds(bond.atom1, false); - removeUnnecessaryBonds(bond.atom2, false); + if (bond.atom1.getElementNumber() != 1 + && bond.atom2.getElementNumber() != 1) { + removeUnnecessaryBonds(bond.atom1, false); + removeUnnecessaryBonds(bond.atom2, false); + } bsAtoms.set(bond.atom1.i); bsAtoms.set(bond.atom2.i); } catch (Exception e) { Modified: trunk/Jmol/src/org/jmol/script/ScriptCompiler.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2015-10-04 04:28:59 UTC (rev 20807) +++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2015-10-06 04:55:57 UTC (rev 20808) @@ -783,21 +783,22 @@ } if (endOfLine) { if (flowContext != null && flowContext.checkForceEndIf(-1)) { + boolean isOneLine = (flowContext.addLine == 0); // if (....) xxxxx; if (isComment) { - if (flowContext.addLine > 0) { + if (!isOneLine) { flowContext.addLine++; flowContext.forceEndIf = true; } - } else if (n > 0) { + } else if (n > 0 || isOneLine) { forceFlowEnd(flowContext.token); - if (lastFlowContext.addLine > 0) { + if (!isOneLine) { lastFlowContext.forceEndIf = true; } } isEndOfCommand = true; cchToken = 0; ichCurrentCommand = ichToken; - if (n > 0) + if (n > 0 || isOneLine) lineCurrent--; return CONTINUE; } @@ -902,15 +903,15 @@ atokenInfix = ltoken.toArray(new T[size = ltoken.size()]); - if (logMessages) { - Logger.debug("token list:"); - for (int i = 0; i < atokenInfix.length; i++) - Logger.debug(i + ": " + atokenInfix[i]); - Logger.debug("vBraces list:"); - for (int i = 0; i < vBraces.size(); i++) - Logger.debug(i + ": " + vBraces.get(i)); - Logger.debug("-------------------------------------"); - } +// if (logMessages) { +// Logger.debug("token list:"); +// for (int i = 0; i < atokenInfix.length; i++) +// Logger.debug(i + ": " + atokenInfix[i]); +// Logger.debug("vBraces list:"); +// for (int i = 0; i < vBraces.size(); i++) +// Logger.debug(i + ": " + vBraces.get(i)); +// Logger.debug("-------------------------------------"); +// } // compile expressions (ScriptCompilerTokenParser.java) return compileExpressions(); @@ -1603,7 +1604,10 @@ lastToken = T.tokenOff; ichCurrentCommand = ichEnd = ichToken; setCommand(theToken); - if (T.tokAttr(tokCommand, T.flowCommand)) { + if (logMessages) + Logger.info("compiling " + theToken); + boolean isFlowCmd = T.tokAttr(tokCommand, T.flowCommand); + if (isFlowCmd) { lastFlowCommand = tokenCommand; } // before processing this command, check to see if we have completed @@ -1617,31 +1621,59 @@ cchToken = 0; return CONTINUE; } - if (T.tokAttr(tokCommand, T.flowCommand)) { - if (!checkFlowCommand((String) tokenCommand.value)) - return ERROR; - theToken = tokenCommand; - if (theTok == T.casecmd) { - addTokenToPrefix(tokenCommand); - theToken = T.tokenLeftParen; - } + switch (theTok) { + case T.leftbrace: break; - } - if (theTok == T.colon) { + case T.colon: braceCount++; isEndOfCommand = true; - break; - } - if (theTok == T.rightbrace) { - // if }, just push onto vBrace, but NOT onto ltoken - vBraces.addLast(tokenCommand); - iBrace++; - tokCommand = T.nada; - return CONTINUE; - } - - if (theTok != T.leftbrace) { - if (flowContext != null) { + return OK; + case T.elsecmd: + case T.elseif: + // unexpectedly allows if (x) { print x else print y} + fixFlowAddLine(flowContext); + if (lltoken.get(iCommand - 1)[0].tok == T.end + && lastFlowContext != null && lastFlowContext.forceEndIf + && lastFlowContext.addLine > 0 + && isFlowIfContextOK(lastFlowContext, tokCommand)) { + flowContext = lastFlowContext; + flowContext.forceEndIf = true; + lltoken.remove(--iCommand); + } else if (flowContext != null && flowContext.addLine > 0) { + while (flowContext != null + && !isFlowIfContextOK(flowContext, tokCommand)) { + if (flowContext.checkForceEndIf(0)) { + forceFlowEnd(flowContext.token); + processTokenList(iLine, isFull); + fixFlowAddLine(flowContext); + setCommand(theToken); + theTok = theToken.tok; + } else { + break; + } + } + } + // why is this? + // if (lastFlowContext != null && lastFlowContext.forceEndIf + // && lastFlowContext.addLine > 0) { + // flowContext = lastFlowContext; + // flowContext.forceEndIf = true; + // if (isFlowIfContextOK(flowContext, tokCommand) && lltoken.get(iCommand - 1)[0].tok == T.end) + // lltoken.remove(--iCommand); + // } + //$FALL-THROUGH$ + default: + if (isFlowCmd) { + if (!checkFlowCommand((String) tokenCommand.value)) + return ERROR; + theToken = tokenCommand; + if (theTok == T.casecmd) { + addTokenToPrefix(tokenCommand); + theToken = T.tokenLeftParen; + } + return OK; + } + if (flowContext != null && flowContext.addLine > 0) { fixFlowAddLine(flowContext); while (flowContext != null) { if (flowContext.checkForceEndIf(0)) { @@ -1654,6 +1686,13 @@ } } } + if (theTok == T.rightbrace) { + // if }, just push onto vBrace, but NOT onto ltoken + vBraces.addLast(tokenCommand); + iBrace++; + tokCommand = T.nada; + return CONTINUE; + } lastFlowCommand = null; } @@ -1803,11 +1842,11 @@ forPoint3 = nSemiSkip = 0; nSemiSkip += 2; break; - } + } if (nTokens == 3 && tokAt(2) == T.var) { newContextVariable(ident); break; - } + } if ((nTokens == 3 || nTokens == 4) && theTok == T.in) { // for ( var x IN // for ( x IN @@ -1816,13 +1855,13 @@ addTokenToPrefix(theToken); theToken = T.tokenLeftParen; break; - } + } //$FALL-THROUGH$ case T.switchcmd: case T.whilecmd: case T.elseif: case T.ifcmd: - if (nTokens <= 2 ||braceCount != 0 || parenCount != 0) + if (nTokens <= 2 || braceCount != 0 || parenCount != 0) break; //$FALL-THROUGH$ case T.process: @@ -1900,10 +1939,8 @@ return ERROR; } } else if (T.tokAttr(theTok, T.predefinedset)) { - Logger - .warn("WARNING: predefined term '" - + ident - + "' has been redefined by the user until the next file load."); + Logger.warn("WARNING: predefined term '" + ident + + "' has been redefined by the user until the next file load."); } else if (!isCheckOnly && ident.length() > 1) { Logger .warn("WARNING: redefining " @@ -1928,21 +1965,21 @@ } } //$FALL-THROUGH$ -// case T.display: -// case T.hide: -// case T.restrict: -// case T.select: -// case T.delete: -// if (bracketCount == 0 && theTok != T.identifier -// && !T.tokAttr(theTok, T.expression) && !T.tokAttr(theTok, T.misc) -// && (theTok & T.minmaxmask) != theTok) -// return ERROR(ERROR_invalidExpressionToken, ident); + // case T.display: + // case T.hide: + // case T.restrict: + // case T.select: + // case T.delete: + // if (bracketCount == 0 && theTok != T.identifier + // && !T.tokAttr(theTok, T.expression) && !T.tokAttr(theTok, T.misc) + // && (theTok & T.minmaxmask) != theTok) + // return ERROR(ERROR_invalidExpressionToken, ident); break; -// case T.center: -// if (theTok != T.identifier && theTok != T.dollarsign -// && !T.tokAttr(theTok, T.expression)) -// return ERROR(ERROR_invalidExpressionToken, ident); -// break; + // case T.center: + // if (theTok != T.identifier && theTok != T.dollarsign + // && !T.tokAttr(theTok, T.expression)) + // return ERROR(ERROR_invalidExpressionToken, ident); + // break; case T.plot3d: case T.pmesh: case T.isosurface: @@ -2108,14 +2145,6 @@ break; case T.elseif: case T.elsecmd: - if (lastFlowContext != null && lastFlowContext.forceEndIf - && lastFlowContext.addLine > 0) { - flowContext = lastFlowContext; - flowContext.forceEndIf = true; - if (isFlowIfContextOK(flowContext, tokCommand) - && lltoken.get(iCommand - 1)[0].tok == T.end) - lltoken.remove(pt = --iCommand); - } if (flowContext != null && !isFlowIfContextOK(flowContext, tokCommand)) flowContext = flowContext.parent; if (!isFlowIfContextOK(flowContext, tokCommand)) Modified: trunk/Jmol/src/org/jmol/script/ScriptEval.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEval.java 2015-10-04 04:28:59 UTC (rev 20807) +++ trunk/Jmol/src/org/jmol/script/ScriptEval.java 2015-10-06 04:55:57 UTC (rev 20808) @@ -3408,7 +3408,6 @@ ContextToken cmdToken = (ContextToken) theToken; int pt = st[0].intValue; SV[] forVars = cmdToken.forVars; - pt = st[0].intValue; int[] pts = new int[2]; Object bsOrList = null; SV forVal = null; Modified: trunk/Jmol/src/org/jmol/scriptext/IsoExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/IsoExt.java 2015-10-04 04:28:59 UTC (rev 20807) +++ trunk/Jmol/src/org/jmol/scriptext/IsoExt.java 2015-10-06 04:55:57 UTC (rev 20808) @@ -1120,6 +1120,7 @@ if (tokAt(1) == T.list && listIsosurface(iShape)) return; int iptDisplayProperty = 0; + boolean isDisplay = false; boolean isIsosurface = (iShape == JC.SHAPE_ISOSURFACE); boolean isPmesh = (iShape == JC.SHAPE_PMESH); boolean isPlot3d = (iShape == JC.SHAPE_PLOT3D); @@ -1319,7 +1320,7 @@ break; case T.display: case T.within: - boolean isDisplay = (eval.theTok == T.display); + isDisplay = (eval.theTok == T.display); if (isDisplay) { sbCommand.append(" display"); iptDisplayProperty = i; @@ -2766,7 +2767,7 @@ setShapeProperty(iShape, "clear", null); if (toCache) setShapeProperty(iShape, "cache", null); - if (iShape != JC.SHAPE_LCAOCARTOON) + if (iShape != JC.SHAPE_LCAOCARTOON && !isDisplay && !haveSlab) listIsosurface(iShape); } Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/MathExt.java 2015-10-04 04:28:59 UTC (rev 20807) +++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java 2015-10-06 04:55:57 UTC (rev 20808) @@ -2008,6 +2008,15 @@ (type + "D").toUpperCase().charAt(0), t456)); } + /** + * plane() or intersection() + * + * @param mp + * @param args + * @param tok + * @return + * @throws ScriptException + */ private boolean evaluatePlane(ScriptMathProcessor mp, SV[] args, int tok) throws ScriptException { if (tok == T.hkl && args.length != 3 || tok == T.intersection @@ -2127,7 +2136,7 @@ norm = V3.newV(pt2); if (pt3 == null) { plane = new P4(); - if (args.length == 2 || !args[2].asBoolean()) { + if (args.length == 2 || args[2].tok != T.integer && args[2].tok != T.decimal && !args[2].asBoolean()) { // plane(<point1>,<point2>) or // plane(<point1>,<point2>,false) pt3 = P3.newP(pt1); Modified: trunk/Jmol/src/org/jmol/shape/MeshCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/MeshCollection.java 2015-10-04 04:28:59 UTC (rev 20807) +++ trunk/Jmol/src/org/jmol/shape/MeshCollection.java 2015-10-06 04:55:57 UTC (rev 20808) @@ -457,10 +457,11 @@ if (property == "ID") return (currentMesh == null ? null : currentMesh.thisID); if (property.startsWith("list")) { - clean(); - SB sb = new SB(); + clean(); + SB sb = new SB(); int k = 0; - String id = (property.equals("list") ? null : property.substring(5)); + boolean isNamed = property.length() > 5; + String id = (property.equals("list") ? null : isNamed ? property.substring(5) : currentMesh == null ? null : currentMesh.thisID); for (int i = 0; i < meshCount; i++) { m = meshes[i]; if (id != null && !id.equalsIgnoreCase(m.thisID)) @@ -482,7 +483,7 @@ sb.append(s); } sb.appendC('\n'); - if (id != null) { + if (isNamed) { Object info = getProperty("jvxlFileInfo", 0); if (info != null) sb.append((String) info).appendC('\n'); Modified: trunk/Jmol/src/org/jmol/viewer/JC.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JC.java 2015-10-04 04:28:59 UTC (rev 20807) +++ trunk/Jmol/src/org/jmol/viewer/JC.java 2015-10-06 04:55:57 UTC (rev 20808) @@ -65,7 +65,8 @@ "pdbe2", "http://www.ebi.ac.uk/pdbe/static/entry/%FILE_updated.cif", "pubchem", "http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d", "map", "http://www.ebi.ac.uk/pdbe/api/%TYPE/%FILE?pretty=false&metadata=true", - "rna3d", "http://rna.bgsu.edu/rna3dhub/%TYPE/download/%FILE" + "rna3d", "http://rna.bgsu.edu/rna3dhub/%TYPE/download/%FILE", + "aflow", "http://aflowlib.mems.duke.edu/users/jmolers/binary_new/%FILE.aflow_binary" }; public static String[] macros = { Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-10-04 04:28:59 UTC (rev 20807) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-10-06 04:55:57 UTC (rev 20808) @@ -61,8 +61,19 @@ TODO: consider if models with no atoms will cause issues in relation to model.firstAtomIndex -Jmol.___JmolVersion="14.3.16_2015.10.03" +Jmol.___JmolVersion="14.3.16_2015.10.05" + +new feature: load =aflow/AgAu + -- easy access to binary metal alloy CIF files + +bug fix: braceless if/for fix from 10.04 + +JmolVersion="14.3.16_2015.10.04" + +bug fix: changing bond order of X-H using set picking assignBond_2 generates error messages and removes atoms + + new feature: if, for, and while can all operate using no braces for single-line bodies -- similar to JavaScript and Java -- examples: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits