Revision: 20248 http://sourceforge.net/p/jmol/code/20248 Author: hansonr Date: 2015-01-27 22:09:31 +0000 (Tue, 27 Jan 2015) Log Message: ----------- atom cleanup; singleton group fix
Modified Paths: -------------- trunk/Jmol/examples/basic/org/jmol/Export.java trunk/Jmol/src/org/jmol/api/JmolScriptEvaluator.java trunk/Jmol/src/org/jmol/modelset/Atom.java trunk/Jmol/src/org/jmol/modelset/AtomCollection.java trunk/Jmol/src/org/jmol/modelset/Chain.java trunk/Jmol/src/org/jmol/modelset/LabelToken.java trunk/Jmol/src/org/jmol/modelset/ModelLoader.java trunk/Jmol/src/org/jmol/modelset/ModelSet.java trunk/Jmol/src/org/jmol/modelsetbio/AlphaPolymer.java trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java trunk/Jmol/src/org/jmol/script/ScriptCompiler.java trunk/Jmol/src/org/jmol/script/ScriptEval.java trunk/Jmol/src/org/jmol/script/ScriptExpr.java trunk/Jmol/src/org/jmol/script/ScriptTokenParser.java trunk/Jmol/src/org/jmol/script/T.java trunk/Jmol/src/org/jmol/scriptext/CmdExt.java trunk/Jmol/src/org/jmol/viewer/ColorManager.java trunk/Jmol/src/org/jmol/viewer/JC.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/PropertyManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/examples/basic/org/jmol/Export.java =================================================================== --- trunk/Jmol/examples/basic/org/jmol/Export.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/examples/basic/org/jmol/Export.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -85,6 +85,7 @@ case HOVER: case MEASURE: case MINIMIZATION: + case SERVICE: case RESIZE: case SYNC: case STRUCTUREMODIFIED: Modified: trunk/Jmol/src/org/jmol/api/JmolScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolScriptEvaluator.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/api/JmolScriptEvaluator.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -89,8 +89,6 @@ boolean historyDisabled, boolean listCommands, SB outputBuffer, boolean allowThreads); - Map<String, Object> getDefinedAtomSets(); - String setObjectPropSafe(String id, int tokCommand); void stopScriptThreads(); Modified: trunk/Jmol/src/org/jmol/modelset/Atom.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Atom.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelset/Atom.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -38,7 +38,6 @@ import org.jmol.atomdata.RadiusData; import org.jmol.atomdata.RadiusData.EnumType; import org.jmol.c.PAL; -import org.jmol.c.STR; import org.jmol.c.VDW; import org.jmol.java.BS; import org.jmol.script.T; @@ -437,9 +436,8 @@ } public void setValence(int nBonds) { - if (isDeleted()) // no resurrection - return; - valence = (byte) (nBonds < 0 ? 0 : nBonds < 0xEF ? nBonds : 0xEF); + if (!isDeleted()) // no resurrection + valence = (byte) (nBonds < 0 ? 0 : nBonds < 0xEF ? nBonds : 0xEF); } @Override @@ -571,10 +569,6 @@ return atomSite; } - void setGroup(Group group) { - this.group = group; - } - @Override public void getGroupBits(BS bs) { group.selectAtoms(bs); @@ -886,7 +880,7 @@ info.append("["); info.append(group3); info.append("]"); - String seqcodeString = getSeqcodeString(); + String seqcodeString = group.getSeqcodeString(); if (seqcodeString != null) info.append(seqcodeString); int chainID = getChainID(); @@ -969,10 +963,6 @@ return group.isPyrimidine(); } - int getSeqcode() { - return group.seqcode; - } - @Override public int getResno() { return group.getResno(); @@ -1031,10 +1021,6 @@ return group.isLeadAtom(i); } - public float getGroupParameter(int tok) { - return group.getGroupParameter(tok); - } - @Override public int getChainID() { return group.chain.chainID; @@ -1065,38 +1051,10 @@ return group.chain.model.ms.getModulationCoord(i, ch); } - public int getPolymerLength() { - return group.getBioPolymerLength(); - } - - public int getPolymerIndexInModel() { - return group.getBioPolymerIndexInModel(); - } - - public int getMonomerIndex() { - return group.getMonomerIndex(); - } - - public int getSelectedGroupCountWithinChain() { - return group.chain.selectedGroupCount; - } - - public int getSelectedGroupIndexWithinChain() { + public int getSelectedGroupIndex() { return group.getSelectedGroupIndex(); } - public int getSelectedMonomerCountWithinPolymer() { - return group.getSelectedMonomerCount(); - } - - public int getSelectedMonomerIndexWithinPolymer() { - return group.getSelectedMonomerIndex(); - } - - public Chain getChain() { - return group.chain; - } - public String getModelNumberForLabel() { return group.chain.model.ms.getModelNumberForAtomLabel(mi); } @@ -1107,41 +1065,9 @@ @Override public String getBioStructureTypeName() { - return getProteinStructureType().getBioStructureTypeName(true); + return group.getProteinStructureType().getBioStructureTypeName(true); } - public STR getProteinStructureType() { - return group.getProteinStructureType(); - } - - public STR getProteinStructureSubType() { - return group.getProteinStructureSubType(); - } - - public int getStrucNo() { - return group.getStrucNo(); - } - - public String getStructureId() { - return group.getStructureId(); - } - - public String getProteinStructureTag() { - return group.getProteinStructureTag(); - } - - public short getGroupID() { - return group.groupID; - } - - public String getSeqcodeString() { - return group.getSeqcodeString(); - } - - public char getInsertionCode() { - return group.getInsertionCode(); - } - @Override public boolean equals(Object obj) { return (this == obj); @@ -1202,7 +1128,7 @@ case T.formalcharge: return getFormalCharge(); case T.groupid: - return getGroupID(); //-1 if no group + return group.groupID; //-1 if no group case T.groupindex: return group.groupIndex; case T.model: @@ -1221,7 +1147,7 @@ case T.polymer: return group.getBioPolymerIndexInModel() + 1; case T.polymerlength: - return getPolymerLength(); + return group.getBioPolymerLength(); case T.radius: // the comparator uses rasmol radius, unfortunately, for integers return getRasMolRadius(); @@ -1230,11 +1156,11 @@ case T.site: return getAtomSite(); case T.structure: - return getProteinStructureType().getId(); + return group.getProteinStructureType().getId(); case T.substructure: - return getProteinStructureSubType().getId(); + return group.getProteinStructureSubType().getId(); case T.strucno: - return getStrucNo(); + return group.getStrucNo(); case T.symop: return getSymOp(); case T.valence: @@ -1296,7 +1222,7 @@ case T.eta: case T.theta: case T.straightness: - return getGroupParameter(tokWhat); + return group.getGroupParameter(tokWhat); case T.fracx: return getFractionalCoord(!vwr.g.legacyJavaFloat, 'X', true, ptTemp); case T.fracy: @@ -1339,7 +1265,7 @@ } } } - return getGroupParameter(tokWhat); + return group.getGroupParameter(tokWhat); case T.radius: case T.spacefill: return getRadius(); @@ -1430,7 +1356,7 @@ case T.identify: return getIdentity(true); case T.insertion: - ch = getInsertionCode(); + ch = group.getInsertionCode(); return (ch == '\0' ? "" : "" + ch); case T.label: case T.format: @@ -1439,11 +1365,11 @@ s = ""; return s; case T.structure: - return getProteinStructureType().getBioStructureTypeName(false); + return group.getProteinStructureType().getBioStructureTypeName(false); case T.substructure: - return getProteinStructureSubType().getBioStructureTypeName(false); + return group.getProteinStructureSubType().getBioStructureTypeName(false); case T.strucid: - return getStructureId(); + return group.getStructureId(); case T.shape: return vwr.getHybridizationAndAxes(i, null, null, "d"); case T.symbol: @@ -1482,10 +1408,6 @@ return null; } - boolean isWithinStructure(STR type) { - return group.isWithinStructure(type); - } - @Override public int getOffsetResidueAtom(String name, int offset) { return group.getAtomIndex(name, offset); Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -857,7 +857,7 @@ if (hydrophobicities == null) { hydrophobicities = new float[at.length]; for (int i = 0; i < at.length; i++) - hydrophobicities[i] = Elements.getHydrophobicity(at[i].getGroupID()); + hydrophobicities[i] = Elements.getHydrophobicity(at[i].group.groupID); } hydrophobicities[atomIndex] = value; return true; @@ -2073,6 +2073,11 @@ if (at[i].getAtomNumber() == iSpec) bs.set(i); break; + case T.bonded: + for (i = ac; --i >= 0;) + if (at[i].getCovalentBondCount() > 0) + bs.set(i); + break; case T.atomname: String names = "," + specInfo + ","; for (i = ac; --i >= 0;) { @@ -2093,7 +2098,7 @@ break; case T.spec_resid: for (i = ac; --i >= 0;) - if (at[i].getGroupID() == iSpec) + if (at[i].group.groupID == iSpec) bs.set(i); break; case T.spec_chain: @@ -2130,7 +2135,7 @@ STR type = (tokType == T.helix ? STR.HELIX : STR.SHEET); for (i = ac; --i >= 0;) - if (at[i].isWithinStructure(type)) + if (at[i].group.isWithinStructure(type)) bs.set(i); break; case T.nucleic: @@ -2240,7 +2245,7 @@ case T.chain: bsInfo = BSUtil.copy((BS) specInfo); for (i = bsInfo.nextSetBit(0); i >= 0; i = bsInfo.nextSetBit(i + 1)) { - Chain chain = at[i].getChain(); + Chain chain = at[i].group.chain; chain.setAtomBitSet(bs); bsInfo.andNot(bs); } @@ -2249,15 +2254,15 @@ for (i = i0; i >= 0; i = bsInfo.nextSetBit(i+1)) { if (bs.get(i)) continue; - iPolymer = at[i].getPolymerIndexInModel(); + iPolymer = at[i].group.getBioPolymerIndexInModel(); bs.set(i); for (int j = i; --j >= 0;) - if (at[j].getPolymerIndexInModel() == iPolymer) + if (at[j].group.getBioPolymerIndexInModel() == iPolymer) bs.set(j); else break; for (; ++i < ac;) - if (at[i].getPolymerIndexInModel() == iPolymer) + if (at[i].group.getBioPolymerIndexInModel() == iPolymer) bs.set(i); else break; @@ -2298,7 +2303,7 @@ int[] hs = new int[2]; Atom a; for (int i = ac; --i >= 0;) { - int g = at[i].getGroupID(); + int g = at[i].group.groupID; if (g >= JC.GROUPID_WATER && g < JC.GROUPID_SOLVENT_MIN) { bs.set(i); } else if ((a = at[i]).getElementNumber() == 8 && a.getCovalentBondCount() == 2) { @@ -2463,7 +2468,7 @@ switch (insCode) { case '?': for (int i = ac; --i >= 0;) { - int atomSeqcode = at[i].getSeqcode(); + int atomSeqcode = at[i].group.seqcode; if (!haveSeqNumber || seqNum == Group.getSeqNumberFor(atomSeqcode) && Group.getInsertionCodeFor(atomSeqcode) != 0) { @@ -2474,7 +2479,7 @@ break; default: for (int i = ac; --i >= 0;) { - int atomSeqcode = at[i].getSeqcode(); + int atomSeqcode = at[i].group.seqcode; if (seqcode == atomSeqcode || !haveSeqNumber && seqcode == Group.getInsertionCodeFor(atomSeqcode) || insCode == '*' && seqNum == Group.getSeqNumberFor(atomSeqcode)) { @@ -2494,7 +2499,7 @@ BS bsDone = BS.newN(ac); int id; for (int i = bsDone.nextClearBit(0); i < ac; i = bsDone.nextClearBit(i + 1)) { - Chain chain = at[i].getChain(); + Chain chain = at[i].group.chain; if (chainID == (id = chain.chainID) || !caseSensitive && id >= 0 && id < 300 && chainID == chainToUpper(id)) { chain.setAtomBitSet(bs); @@ -2795,6 +2800,15 @@ //{*}.vxyz = {*}.vxyz.all.mul(3.0/{*}.vxyz.all.max) } + public BS getAtomsFromAtomNumberInFrame(int atomNumber) { + BS bs = vwr.getFrameAtoms(); + for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) + if (at[i].getAtomNumber() != atomNumber) + bs.clear(i); + return bs; + } + + } Modified: trunk/Jmol/src/org/jmol/modelset/Chain.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Chain.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelset/Chain.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -34,7 +34,7 @@ public int groupCount; public Group[] groups; - int selectedGroupCount; + public int selectedGroupCount; public Atom getAtom(int index) { return model.ms.at[index]; Modified: trunk/Jmol/src/org/jmol/modelset/LabelToken.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/LabelToken.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelset/LabelToken.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -549,7 +549,7 @@ : formalCharge < 0 ? "" + -formalCharge + "-" : ""); break; case 'g': - strT = "" + atom.getSelectedGroupIndexWithinChain(); + strT = "" + atom.getSelectedGroupIndex(); break; case T.model: strT = atom.getModelNumberForLabel(); @@ -567,17 +567,17 @@ floatT = atom.atomPropertyFloat(vwr, t.tok, ptTemp); break; case 'r': - strT = atom.getSeqcodeString(); + strT = atom.group.getSeqcodeString(); break; case T.strucid: - strT = atom.getStructureId(); + strT = atom.group.getStructureId(); break; case T.strucno: - int id = atom.getStrucNo(); + int id = atom.group.getStrucNo(); strT = (id <= 0 ? "" : "" + id); break; case T.straightness: - if (Float.isNaN(floatT = atom.getGroupParameter(T.straightness))) + if (Float.isNaN(floatT = atom.group.getGroupParameter(T.straightness))) strT = "null"; break; case T.vibx: Modified: trunk/Jmol/src/org/jmol/modelset/ModelLoader.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -1228,8 +1228,8 @@ groups[groupIndex] = group; group.groupIndex = groupIndex; - for (int i = lastAtomIndex; --i >= firstAtomIndex;) - ms.at[i].setGroup(group); + for (int i = lastAtomIndex + 1; --i >= firstAtomIndex;) + ms.at[i].group = group; } Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelSet.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -1342,7 +1342,7 @@ i = am[modelIndex].firstAtomIndex + am[modelIndex].ac; continue; } - iLast = at[i].getStrucNo(); + iLast = at[i].group.getStrucNo(); if (iLast < 1000 && iLast > lastStrucNo[modelIndex]) lastStrucNo[modelIndex] = iLast; i = at[i].group.lastAtomIndex + 1; @@ -1353,7 +1353,7 @@ i = am[modelIndex].firstAtomIndex + am[modelIndex].ac; continue; } - if (at[i].getStrucNo() > 1000) + if (at[i].group.getStrucNo() > 1000) at[i].group.setStrucNo(++lastStrucNo[modelIndex]); i = at[i].group.lastAtomIndex + 1; } @@ -2929,7 +2929,7 @@ lastmodel = imodel; lastid = -1; } - if ((id = at[i].getStrucNo()) != lastid && id != 0) { + if ((id = at[i].group.getStrucNo()) != lastid && id != 0) { at[i].group.setStrucNo(++idnew); lastid = idnew; } @@ -4079,21 +4079,5 @@ return ret; } - public BS getAtomsFromAtomNumberInFrame(int atomNumber) { - BS bs = new BS(); - BS bsModels = vwr.getVisibleFramesBitSet(); - for (int i = ac; --i >= 0;) { - Atom atom = at[i]; - if (!bsModels.get(atom.mi)) { - i = am[atom.mi].firstAtomIndex; - continue; - } - if (atom.getAtomNumber() == atomNumber) - bs.set(i); - } - return bs; - } - - } Modified: trunk/Jmol/src/org/jmol/modelsetbio/AlphaPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/AlphaPolymer.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelsetbio/AlphaPolymer.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -220,8 +220,8 @@ int[][] biopolymerStartsEnds = new int[nBiopolymers][nEndMin * 2]; for (int i = 0; i < n; i++) { a1 = vCA.get(i); - int polymerIndex = a1.getPolymerIndexInModel(); - int monomerIndex = a1.getMonomerIndex(); + int polymerIndex = a1.group.getBioPolymerIndexInModel(); + int monomerIndex = a1.group.getMonomerIndex(); int bpt = monomerIndex; if (bpt < nEndMin) biopolymerStartsEnds[polymerIndex][bpt] = i + 1; @@ -244,9 +244,9 @@ int ipt = strutPoint(i, j, n); a2 = vCA.get(j); int resno1 = a1.getResno(); - int polymerIndex1 = a1.getPolymerIndexInModel(); + int polymerIndex1 = a1.group.getBioPolymerIndexInModel(); int resno2 = a2.getResno(); - int polymerIndex2 = a2.getPolymerIndexInModel(); + int polymerIndex2 = a2.group.getBioPolymerIndexInModel(); if (polymerIndex1 == polymerIndex2 && Math.abs(resno2 - resno1) < delta) bsNearbyResidues.set(ipt); float d = d2[ipt] = a1.distanceSquared(a2); Modified: trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -317,9 +317,9 @@ for (int i = 0; i < ac; i++) { if (atoms[i].mi != 0) break; - if ((id = atoms[i].getStrucNo()) != lastid && id != 0) { + if ((id = atoms[i].group.getStrucNo()) != lastid && id != 0) { lastid = id; - switch (atoms[i].getProteinStructureType()) { + switch (atoms[i].group.getProteinStructureType()) { case HELIX: nH++; break; @@ -615,7 +615,7 @@ if (taintedOnly && !bsTainted.get(i)) continue; id = 0; - if (i == ac || (id = atoms[i].getStrucNo()) != lastId) { + if (i == ac || (id = atoms[i].group.getStrucNo()) != lastId) { if (bs != null) { switch (type) { case HELIX: @@ -711,8 +711,8 @@ if (id == 0 || bsAtoms != null && needPhiPsi - && (Float.isNaN(atoms[i].getGroupParameter(T.phi)) || Float - .isNaN(atoms[i].getGroupParameter(T.psi)))) + && (Float.isNaN(atoms[i].group.getGroupParameter(T.phi)) || Float + .isNaN(atoms[i].group.getGroupParameter(T.psi)))) continue; } String ch = atoms[i].getChainIDStr(); @@ -722,9 +722,9 @@ group1 = atoms[i].getGroup3(false); chain1 = ch; } - type = atoms[i].getProteinStructureType(); - subtype = atoms[i].getProteinStructureSubType(); - sid = atoms[i].getProteinStructureTag(); + type = atoms[i].group.getProteinStructureType(); + subtype = atoms[i].group.getProteinStructureSubType(); + sid = atoms[i].group.getProteinStructureTag(); bs.set(i); lastId = id; res2 = atoms[i].getResno(); @@ -850,7 +850,7 @@ for (int i = bsCheck.nextSetBit(0); i >= 0; i = bsCheck.nextSetBit(i + 1)) if (atoms[i].checkVisible() && atoms[i].atomID == JC.ATOMID_ALPHA_CARBON - && atoms[i].getGroupID() != JC.GROUPID_CYSTEINE) + && atoms[i].group.groupID != JC.GROUPID_CYSTEINE) vCA.addLast((a1 = atoms[i])); if (vCA.size() == 0) return 0; @@ -858,7 +858,7 @@ short mad = (short) (vwr.getFloat(T.strutdefaultradius) * 2000); int delta = vwr.getInt(T.strutspacing); boolean strutsMultiple = vwr.getBoolean(T.strutsmultiple); - Lst<Atom[]> struts = ((BioModel) m).getBioPolymer(a1.getPolymerIndexInModel()) + Lst<Atom[]> struts = ((BioModel) m).getBioPolymer(a1.group.getBioPolymerIndexInModel()) .calculateStruts(ms, bs1, bs2, vCA, thresh, delta, strutsMultiple); for (int i = 0; i < struts.size(); i++) { Atom[] o = struts.get(i); Modified: trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -901,7 +901,7 @@ new float[] { x * factor, y * factor, z * factor, w * factor } })); if (atomLast != null - && atomLast.getPolymerIndexInModel() == a.getPolymerIndexInModel()) { + && atomLast.group.getBioPolymerIndexInModel() == a.group.getBioPolymerIndexInModel()) { pdbCONECT.append("CONECT").append( PT.formatStringI("%5i", "i", atomLast.getAtomNumber())) .append(PT.formatStringI("%5i", "i", a.getAtomNumber())) Modified: trunk/Jmol/src/org/jmol/script/ScriptCompiler.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -1306,7 +1306,7 @@ && theTok != T.defaultcmd && lastToken.tok != T.switchcmd) return ERROR(ERROR_badContext, ident); if (lastToken.tok == T.define && theTok != T.leftbrace && nTokens != 1) { - addTokenToPrefix(T.o(T.string, ident)); + addTokenToPrefix(theTok == T.define ? lastToken : T.o(T.string, ident)); return CONTINUE; } switch (theTok) { Modified: trunk/Jmol/src/org/jmol/script/ScriptEval.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEval.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/script/ScriptEval.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -287,13 +287,7 @@ private Thread currentThread; public ScriptCompiler compiler; - public Map<String, Object> definedAtomSets; - @Override - public Map<String, Object> getDefinedAtomSets() { - return definedAtomSets; - } - public SB outputBuffer; private String contextPath = ""; @@ -355,7 +349,6 @@ this.compiler = (compiler == null ? (ScriptCompiler) vwr.compiler : compiler); isJS = vwr.isSingleThreaded; - definedAtomSets = vwr.definedAtomSets; return this; } @@ -1192,7 +1185,7 @@ @Override public void clearDefinedVariableAtomSets() { - definedAtomSets.remove("# variable"); + vwr.definedAtomSets.remove("# variable"); } /** @@ -1200,12 +1193,12 @@ * */ private void defineSets() { - if (!definedAtomSets.containsKey("# static")) { + if (!vwr.definedAtomSets.containsKey("# static")) { for (int i = 0; i < JC.predefinedStatic.length; i++) defineAtomSet(JC.predefinedStatic[i]); defineAtomSet("# static"); } - if (definedAtomSets.containsKey("# variable")) + if (vwr.definedAtomSets.containsKey("# variable")) return; for (int i = 0; i < JC.predefinedVariable.length; i++) defineAtomSet(JC.predefinedVariable[i]); @@ -1258,7 +1251,7 @@ private void defineAtomSet(String script) { if (script.indexOf("#") == 0) { - definedAtomSets.put(script, Boolean.TRUE); + vwr.definedAtomSets.put(script, Boolean.TRUE); return; } ScriptContext sc = compiler.compile("#predefine", script, true, false, @@ -1291,7 +1284,7 @@ String name = ((String) statement[1].value).toLowerCase(); if (name.startsWith("dynamic_")) name = "!" + name.substring(8); - definedAtomSets.put(name, statement); + vwr.definedAtomSets.put(name, statement); } @Override @@ -1320,10 +1313,10 @@ } defineSets(); setName = setName.toLowerCase(); - Object value = definedAtomSets.get(setName); + Object value = vwr.definedAtomSets.get(setName); boolean isDynamic = false; if (value == null) { - value = definedAtomSets.get("!" + setName); + value = vwr.definedAtomSets.get("!" + setName); isDynamic = (value != null); } if (value instanceof BS) @@ -1333,13 +1326,13 @@ BS bs = atomExpression((T[]) value, -2, 0, true, false, true, true); popContext(false, false); if (!isDynamic) - definedAtomSets.put(setName, bs); + vwr.definedAtomSets.put(setName, bs); return bs; } if (setName.equals("water")) { BS bs = vwr.ms.getAtoms(T.solvent, null); if (!isDynamic) - definedAtomSets.put(setName, bs); + vwr.definedAtomSets.put(setName, bs); return bs; } if (plurals) @@ -1358,7 +1351,7 @@ @Override public void deleteAtomsInVariables(BS bsDeleted) { - for (Map.Entry<String, Object> entry : definedAtomSets.entrySet()) { + for (Map.Entry<String, Object> entry : vwr.definedAtomSets.entrySet()) { Object value = entry.getValue(); if (value instanceof BS) { BSUtil.deleteBits((BS) value, bsDeleted); @@ -3225,13 +3218,13 @@ T[] code = new T[slen]; for (int i = slen; --i >= 0;) code[i] = st[i]; - definedAtomSets + vwr.definedAtomSets .put("!" + (isSite ? setName : setName.substring(8)), code); //if (!isSite) //vwr.addStateScript(thisCommand, false, true); removed for 12.1.16 } else { BS bs = atomExpressionAt(2); - definedAtomSets.put(setName, bs); + vwr.definedAtomSets.put(setName, bs); if (!chk) vwr.g.setUserVariable("@" + setName, SV.newV(T.bitset, bs)); } Modified: trunk/Jmol/src/org/jmol/script/ScriptExpr.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptExpr.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/script/ScriptExpr.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -195,14 +195,20 @@ switch (tok) { case T.define: - // @{@x} or @{@{x}} or @{@1} -- also userFunction(@1) - if (tokAt(++i) == T.expressionBegin) { + if ((tok = tokAt(++i)) == T.expressionBegin) { + // @{@x} or @{@{x}} or @{@1} -- also userFunction(@1) v = parameterExpressionToken(++i); i = iToken; - } else if (tokAt(i) == T.integer) { + } else if (tok == T.integer) { + // @3 v = vwr.ms.getAtoms(T.atomno, Integer.valueOf(st[i].intValue)); break; + } else if (tok == T.define && tokAt(i + 1) == T.integer) { + // @@3 + v = vwr.ms.getAtomsFromAtomNumberInFrame(st[++i].intValue); + break; } else { + // @@x v = getParameter(SV.sValue(st[i]), T.variable, true); } v = getParameter(((SV) v).asString(), T.variable, true); @@ -805,6 +811,7 @@ rpn.addXBs(lookupIdentifierValue("_" + value)); } break; + case T.bonded: case T.carbohydrate: case T.dna: case T.hetero: @@ -819,7 +826,6 @@ case T.spec_alternate: case T.specialposition: case T.symmetry: - case T.nonequivalent: case T.unitcell: rpn.addXBs(getAtomBits(instruction.tok, value)); break; @@ -876,7 +882,7 @@ (int) Math.floor(pt.y * 1000), (int) Math.floor(pt.z * 1000) })); break; case T.thismodel: - rpn.addXBs(vwr.getModelUndeletedAtomsBitSet(vwr.am.cmi)); + rpn.addXBs(vwr.am.cmi < 0 ? vwr.getFrameAtoms() : vwr.getModelUndeletedAtomsBitSet(vwr.am.cmi)); break; case T.hydrogen: case T.amino: @@ -2319,11 +2325,13 @@ boolean isSetAt = (j == 1 && st[0] == T.tokenSetCmd); if (isClauseDefine) { SV vt = parameterExpressionToken(++i); + v = (vt.tok == T.varray ? vt : SV.oValue(vt)); i = iToken; - v = (vt.tok == T.varray ? vt : SV.oValue(vt)); } else { if (tokAt(i) == T.integer) { - v = vwr.ms.getAtomsFromAtomNumberInFrame(st[i].intValue); + v = vwr.ms.getAtoms(T.atomno, Integer.valueOf(st[i].intValue)); + } else if (tokAt(i) == T.define && tokAt(i + 1) == T.integer) { + v = vwr.ms.getAtomsFromAtomNumberInFrame(st[++i].intValue); } else { v = getParameter(var, T.nada, true); } Modified: trunk/Jmol/src/org/jmol/script/ScriptTokenParser.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptTokenParser.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/script/ScriptTokenParser.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -162,17 +162,19 @@ int tok = tokAt(1); switch (tokCommand) { case T.define: - if (tokAt(1) == T.integer && tokAt(2) == T.per && tokAt(4) == T.opEQ) { + int i = (tokAt(1) == T.define ? 2 : 1); + if (tokAt(i) == T.integer && tokAt(i + 1) == T.per && tokAt(i + 3) == T.opEQ) { // @2.xxx = + // @@2.xxx = tokCommand = T.set; isSetBrace = true; - ptNewSetModifier = 4; + ptNewSetModifier = i + 3; isMathExpressionCommand = true; isEmbeddedExpression = true; addTokenToPostfixToken(T.tokenSetProperty); addTokenToPostfixToken(T.tokenExpressionBegin); - addNextToken(); - addNextToken(); + for (int j = 0; j++ <= i;) + addNextToken(); addTokenToPostfixToken(T.tokenExpressionEnd); firstToken = 0; } @@ -1011,12 +1013,15 @@ token = T.tokenDefineString; addTokenToPostfixToken(token); } - if (tokPeek() == T.nada) + if (tokPeekIs(T.nada)) return error(ERROR_endOfCommandUnexpected); // we allow @x[1], which compiles as {@x}[1], not @{x[1]} // otherwise [1] gets read as a general atom name selector - if (!addSubstituteTokenIf(T.leftbrace, T.tokenExpressionBegin)) + if (!addSubstituteTokenIf(T.leftbrace, T.tokenExpressionBegin)) { + if (tokPeek() == T.define) + addNextToken(); return addNextToken() && checkForItemSelector(true); + } while (moreTokens() && !tokPeekIs(T.rightbrace)) { if (tokPeekIs(T.leftbrace)) { if (!checkForCoordinate(true)) Modified: trunk/Jmol/src/org/jmol/script/T.java =================================================================== --- trunk/Jmol/src/org/jmol/script/T.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/script/T.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -431,6 +431,7 @@ public final static int spec_seqcode_range = expression | 39; public final static int amino = predefinedset | 2; + public final static int bonded = predefinedset | 3; public final static int dna = predefinedset | 4; public final static int hetero = predefinedset | 6 | deprecatedparam; public final static int helixalpha = predefinedset | 7; // Jmol 12.1.14 @@ -456,8 +457,7 @@ public final static int hidden = predefinedset | 42; public final static int specialposition = predefinedset | 44; public final static int visible = predefinedset | 46; - public final static int basemodel = predefinedset | 48; - public final static int nonequivalent = predefinedset | 50; + public final static int basemodel = predefinedset | 48; // specific to JCAMP-MOL files static int getPrecedence(int tokOperator) { @@ -1898,6 +1898,7 @@ "best", "bin", "bondCount", + "bonded", "bottom", "branch", "brillouin", @@ -2038,7 +2039,6 @@ "inherit", "normal", "noContourLines", - "nonequivalent", "notFrontOnly", "noTriangles", "now", @@ -2921,6 +2921,7 @@ best, // "best" bin, // "bin" bondcount, // "bondCount" + bonded, // "bonded" bottom, // "bottom" branch, // "branch" brillouin, // "brillouin" @@ -3061,7 +3062,6 @@ -1, // "inherit" normal, // "normal" nocontourlines, // "noContourLines" - nonequivalent, // "nonequivalent" notfrontonly, // "notFrontOnly" notriangles, // "noTriangles" now, // "now" Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -1507,7 +1507,7 @@ int[] result; if (expression2 > 0) { BS bs = new BS(); - eval.definedAtomSets.put("_1", bs); + vwr.definedAtomSets.put("_1", bs); BS bs0 = atomSets[0]; for (int atom1 = bs0.nextSetBit(0); atom1 >= 0; atom1 = bs0 .nextSetBit(atom1 + 1)) { @@ -3713,7 +3713,7 @@ break; case T.variables: if (!chk) - msg = vwr.getAtomDefs(eval.definedAtomSets) + vwr.g.getVariableList() + msg = vwr.getAtomDefs(vwr.definedAtomSets) + vwr.g.getVariableList() + getContext(true); break; case T.trajectory: Modified: trunk/Jmol/src/org/jmol/viewer/ColorManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/ColorManager.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/viewer/ColorManager.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -172,17 +172,17 @@ atom.getBfactor100(), lo, hi, ColorEncoder.BWR, false); case PAL.PALETTE_STRAIGHTNESS: return ce.getColorIndexFromPalette( - atom.getGroupParameter(T.straightness), -1, 1, ColorEncoder.BWR, + atom.group.getGroupParameter(T.straightness), -1, 1, ColorEncoder.BWR, false); case PAL.PALETTE_SURFACE: hi = vwr.ms.getSurfaceDistanceMax(); return ce.getColorIndexFromPalette( atom.getSurfaceDistance100(), 0, hi, ColorEncoder.BWR, false); case PAL.PALETTE_AMINO: - return ce.getColorIndexFromPalette(atom.getGroupID(), + return ce.getColorIndexFromPalette(atom.group.groupID, 0, 0, ColorEncoder.AMINO, false); case PAL.PALETTE_SHAPELY: - return ce.getColorIndexFromPalette(atom.getGroupID(), + return ce.getColorIndexFromPalette(atom.group.groupID, 0, 0, ColorEncoder.SHAPELY, false); case PAL.PALETTE_GROUP: // vwr.calcSelectedGroupsCount() must be called first ... @@ -192,19 +192,19 @@ // for each atom // therefore, we call it in Eval.colorObject(); return ce.getColorIndexFromPalette( - atom.getSelectedGroupIndexWithinChain(), 0, - atom.getSelectedGroupCountWithinChain() - 1, ColorEncoder.BGYOR, + atom.getSelectedGroupIndex(), 0, + atom.group.chain.selectedGroupCount - 1, ColorEncoder.BGYOR, false); case PAL.PALETTE_POLYMER: Model m = vwr.ms.am[atom.mi]; return ce.getColorIndexFromPalette( - atom.getPolymerIndexInModel(), 0, m.getBioPolymerCount() - 1, + atom.group.getBioPolymerIndexInModel(), 0, m.getBioPolymerCount() - 1, ColorEncoder.BGYOR, false); case PAL.PALETTE_MONOMER: // vwr.calcSelectedMonomersCount() must be called first ... return ce.getColorIndexFromPalette( - atom.getSelectedMonomerIndexWithinPolymer(), 0, - atom.getSelectedMonomerCountWithinPolymer() - 1, ColorEncoder.BGYOR, + atom.group.getSelectedMonomerIndex(), 0, + atom.group.getSelectedMonomerCount() - 1, ColorEncoder.BGYOR, false); case PAL.PALETTE_MOLECULE: return ce.getColorIndexFromPalette( @@ -225,7 +225,7 @@ modelIndex = atom.mi; return ce.getColorIndexFromPalette( modelSet.getInsertionCodeIndexInModel(modelIndex, - atom.getInsertionCode()), 0, + atom.group.getInsertionCode()), 0, modelSet.getInsertionCountInModel(modelIndex), ColorEncoder.ROYGB, false); case PAL.PALETTE_JMOL: @@ -237,7 +237,7 @@ argb = getJmolOrRasmolArgb(id, T.rasmol); break; case PAL.PALETTE_STRUCTURE: - argb = atom.getProteinStructureSubType().getColor(); + argb = atom.group.getProteinStructureSubType().getColor(); break; case PAL.PALETTE_CHAIN: int chain = atom.getChainID(); Modified: trunk/Jmol/src/org/jmol/viewer/JC.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JC.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/viewer/JC.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -519,7 +519,6 @@ "@helix310 substructure=7", "@helixalpha substructure=8", "@helixpi substructure=9", - "@bonded bondcount>0", }; // these are only updated once per file load or file append Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-01-27 22:09:31 UTC (rev 20248) @@ -19,14 +19,28 @@ Jmol.___JmolVersion="14.3.12_2015.01.26" +bug fix: select thisModel does not select all atoms in visible frame set + +new feature: @@3 for "atomno=3 and thisModel" + -- provides a function distinct from @3 when there are multiple models + -- includes all atoms in current frame set + -- example: + + load "cyclohexane_movie.xyz" + select @10 + 35 atoms selected + select @@10 + 1 atom selected + frame [1 2 4 6] + select @@10 + 4 atoms selected + @@10.label = "atom 10" + + new feature: frame [1 3 5 6] -- sets limited number of frames for animation and frame * -- same as animation frame [1 3 5 6]; frame * - -bug fix: @3 for "atomno=3" should not extend to models that are not part of the current model set - -- commonly used for shortcut at the console - -- provides a function distinct from "atomno=3" - + new feature: CGO SCREEN option -- CGO [SCREEN z ...] -- reads CGO 2D VERTEX records as screen coordinates, installing them at a depth of z Modified: trunk/Jmol/src/org/jmol/viewer/PropertyManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/PropertyManager.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/viewer/PropertyManager.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -1246,7 +1246,7 @@ s = PT.esc(s); switch (tok) { case T.residue: - s = "[" + a.getGroup3(false) + "]" + a.getSeqcodeString() + ":" + s; + s = "[" + a.getGroup3(false) + "]" + a.group.getSeqcodeString() + ":" + s; break; case T.sequence: case T.group1: @@ -1258,10 +1258,10 @@ glast = null; clast = null; } - if (a.getChain() != clast) { + if (a.group.chain != clast) { info.appendC('\n'); n = 0; - clast = a.getChain(); + clast = a.group.chain; info.append("Chain " + s + ":\n"); glast = null; } @@ -1355,7 +1355,7 @@ info.put("surfaceDistance", Float.valueOf(d)); if (ms.am[atom.mi].isBioModel) { info.put("resname", atom.getGroup3(false)); - char insCode = atom.getInsertionCode(); + char insCode = atom.group.getInsertionCode(); int seqNum = atom.getResno(); if (seqNum > 0) info.put("resno", Integer.valueOf(seqNum)); @@ -1364,12 +1364,12 @@ info.put("name", ms.at[i].getAtomName()); info.put("chain", atom.getChainIDStr()); info.put("atomID", Integer.valueOf(atom.atomID)); - info.put("groupID", Integer.valueOf(atom.getGroupID())); + info.put("groupID", Integer.valueOf(atom.group.groupID)); if (atom.altloc != '\0') info.put("altLocation", "" + atom.altloc); - info.put("structure", Integer.valueOf(atom.getProteinStructureType() + info.put("structure", Integer.valueOf(atom.group.getProteinStructureType() .getId())); - info.put("polymerLength", Integer.valueOf(atom.getPolymerLength())); + info.put("polymerLength", Integer.valueOf(atom.group.getBioPolymerLength())); info.put("occupancy", Integer.valueOf(atom.getOccupancy100())); int temp = atom.getBfactor100(); info.put("temp", Integer.valueOf(temp / 100)); @@ -1510,7 +1510,7 @@ private static void getAtomResidueInfo(SB info, Atom atom) { info.append("[").append(atom.getGroup3(false)).append("]").append( - atom.getSeqcodeString()).append(":"); + atom.group.getSeqcodeString()).append(":"); int id = atom.getChainID(); info.append(id == 0 ? " " : atom.getChainIDStr()); } @@ -1837,8 +1837,8 @@ new Object[] { a.getElementSymbolIso(false).toUpperCase(), strExtra, new float[] { x, y, z, 0f } })); if (atomLast != null - && atomLast.getPolymerIndexInModel() == a - .getPolymerIndexInModel()) + && atomLast.group.getBioPolymerIndexInModel() == a.group + .getBioPolymerIndexInModel()) pdbCONECT.append("CONECT") .append(PT.formatStringI("%5i", "i", atomLast.getAtomNumber())) .append(PT.formatStringI("%5i", "i", a.getAtomNumber())) Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2015-01-27 14:21:02 UTC (rev 20247) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2015-01-27 22:09:31 UTC (rev 20248) @@ -3039,6 +3039,10 @@ .copy(am.bsVisibleModels)); } + public BS getFrameAtoms() { + return getModelUndeletedAtomsBitSetBs(getVisibleFramesBitSet()); + } + public void defineAtomSets(Map<String, Object> info) { definedAtomSets.putAll(info); } @@ -8243,7 +8247,7 @@ // We only work on atoms that are in frame String ff = g.forceField; - BS bsInFrame = getModelUndeletedAtomsBitSetBs(getVisibleFramesBitSet()); + BS bsInFrame = getFrameAtoms(); if (bsSelected == null) bsSelected = getModelUndeletedAtomsBitSet(getVisibleFramesBitSet() @@ -8591,9 +8595,8 @@ case '{': if (getScriptManager() != null) { Map<String, Object> m = (Map<String, Object>) map; - Map<String, Object> sets = eval.getDefinedAtomSets(); - if (sets != null) - m.putAll(sets); + if (definedAtomSets != null) + m.putAll(definedAtomSets); T.getTokensType(m, T.predefinedset); } return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits