From: <ha...@us...> - 2010-04-05 13:11:14
|
Revision: 12764 http://jmol.svn.sourceforge.net/jmol/?rev=12764&view=rev Author: hansonr Date: 2010-04-05 13:10:43 +0000 (Mon, 05 Apr 2010) Log Message: ----------- version=12.0.RC3 # bug fix: with unremediated PDB files, searching for *.C1' returns nothing # code: dispensing with specialAtomID array # bug fix: Jmol pseudo-hydrogen bonds were sometimes between two carbonyl groups # bug fix: structures with 400000+ atoms may be loaded # bug fix: calculated hbonds not retaining energy or type when saved to state # bug fix: color hbonds ENERGY causes NPE when non-calculated HBonds are created # code: smarter SmarterJmolAdapter deletes atoms as it goes to conserve resources # - allows loading of much larger models # code: ModelLoader distinguishes between small molecules and large molecules # bug fix: simple model appended to model having unit cell does not show axes # # new feature: set smallMoleculeMaxAtoms [default 40000] # This parameter sets the maximum number of atoms for default rendering of the model. # Models with this number or fewer atoms will be rendered with the default spacefill # rendering and the default bond diameter; models with more than this number of atoms # will be displayed by default with <b>spacefill 0; wireframe 1</b> for chains that # contain bonds and <b>backbone</b> for those that do not in order to conserve resources. # # new feature: calculate hbonds {....} {....} for models with H atoms # - H atoms must be in first set; atoms to consider must be in second set. # - no restriction in second set as to atom type other than that H atom in that set will be ignored. # # -------------------------------------------------------------- Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java trunk/Jmol/src/org/jmol/api/JmolAdapter.java trunk/Jmol/src/org/jmol/api/JmolBioResolver.java trunk/Jmol/src/org/jmol/modelset/Atom.java trunk/Jmol/src/org/jmol/modelset/AtomCollection.java trunk/Jmol/src/org/jmol/modelset/LabelToken.java trunk/Jmol/src/org/jmol/modelset/ModelCollection.java trunk/Jmol/src/org/jmol/modelset/ModelLoader.java trunk/Jmol/src/org/jmol/modelsetbio/Resolver.java trunk/Jmol/src/org/jmol/script/ScriptCompilationTokenParser.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/JmolConstants.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -453,10 +453,6 @@ return b; } - public String getClientAtomStringProperty(Object clientAtom, String propertyName) { - return null; - } - //////////////////////////////////////////////////////////////// public JmolAdapter.AtomIterator Modified: trunk/Jmol/src/org/jmol/api/JmolAdapter.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolAdapter.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/api/JmolAdapter.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -318,16 +318,6 @@ abstract public float[] getPdbScaleTranslate(Object atomSetCollection); /** - * Get a property from a clientAtom. - * - * @param clientAtom The clientAtom - * @param propertyName the key of the property - * @return The value of the property - */ - abstract public String getClientAtomStringProperty(Object clientAtom, - String propertyName); - - /** * Get an AtomIterator for retrieval of all atoms in the file. * * <p>This method may not return <code>null</code>. @@ -390,7 +380,6 @@ public String getGroup3() { return null; } public int getSequenceNumber() { return Integer.MIN_VALUE; } public char getInsertionCode() { return (char)0; } - public Object getClientAtomReference() { return null; } } /**************************************************************** Modified: trunk/Jmol/src/org/jmol/api/JmolBioResolver.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolBioResolver.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/api/JmolBioResolver.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -12,7 +12,7 @@ public Group distinguishAndPropagateGroup(Chain chain, String group3, int seqcode, int firstAtomIndex, int maxAtomIndex, int modelIndex, int[] specialAtomIndexes, - byte[] specialAtomIDs, Atom[] atoms); + Atom[] atoms); public Polymer buildBioPolymer(Group group, Group[] groups, int i, boolean checkPolymerConnections); Modified: trunk/Jmol/src/org/jmol/modelset/Atom.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Atom.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/modelset/Atom.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -62,6 +62,11 @@ private byte formalChargeAndFlags; private byte valence; char alternateLocationID; + byte atomID; + public byte getAtomID() { + return atomID; + } + short madAtom; public short getMadAtom() { return madAtom; @@ -540,17 +545,15 @@ screenDiameter = viewer.scaleToScreen(screenZ, Math.abs(madAtom)); } - // note: atomName cannot be null - // note: atomNames cannot be null - public String getAtomName() { - return group.chain.modelSet.atomNames[index]; + return (atomID > 0 ? JmolConstants.getSpecialAtomName(atomID) + : group.chain.modelSet.atomNames[index]); } public String getAtomType() { String[] atomTypes = group.chain.modelSet.atomTypes; String type = (atomTypes == null ? null : atomTypes[index]); - return (type == null ? group.chain.modelSet.atomNames[index] : type); + return (type == null ? getAtomName() : type); } public int getAtomNumber() { @@ -661,28 +664,14 @@ return str.substring(1); } - public int getModelIndex() { - return modelIndex; - } + public int getModelIndex() { + return modelIndex; + } - public int getMoleculeNumber() { - return (group.chain.modelSet.getMoleculeIndex(index) + 1); - } + public int getMoleculeNumber() { + return (group.chain.modelSet.getMoleculeIndex(index) + 1); + } - String getClientAtomStringProperty(String propertyName) { - Object[] clientAtomReferences = group.chain.modelSet.clientAtomReferences; - return - ((clientAtomReferences==null || clientAtomReferences.length<=index) - ? null : (group.chain.modelSet.viewer. - getClientAtomStringProperty(clientAtomReferences[index], - propertyName))); - } - - public byte getSpecialAtomID() { - byte[] specialAtomIDs = group.chain.modelSet.specialAtomIDs; - return specialAtomIDs == null ? 0 : specialAtomIDs[index]; - } - public float getFractionalCoord(char ch) { Point3f pt = getFractionalCoord(); return (ch == 'X' ? pt.x : ch == 'Y' ? pt.y : pt.z); @@ -945,7 +934,7 @@ // (this will be a difference in terms of *clickability*). // except BACKBONE flags |= group.shapeVisibilityFlags; - if (getSpecialAtomID() != JmolConstants.ATOMID_ALPHA_CARBON) + if (atomID != JmolConstants.ATOMID_ALPHA_CARBON) flags &= ~JmolConstants.BACKBONE_VISIBILITY_FLAG; // We know that (flags & AIM), so now we must remove that flag @@ -1103,7 +1092,7 @@ case Token.atomno: return atom.getAtomNumber(); case Token.atomid: - return atom.getSpecialAtomID(); + return atom.atomID; case Token.atomindex: return atom.getIndex(); case Token.bondcount: Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -67,13 +67,11 @@ atomNames = null; atomTypes = null; atomSerials = null; - clientAtomReferences = null; vibrationVectors = null; occupancies = null; bfactor100s = null; partialCharges = null; ionicRadii = null; - specialAtomIDs = null; ellipsoids = null; } @@ -83,14 +81,12 @@ atomNames = mergeModelSet.atomNames; atomTypes = mergeModelSet.atomTypes; atomSerials = mergeModelSet.atomSerials; - clientAtomReferences = mergeModelSet.clientAtomReferences; vibrationVectors = mergeModelSet.vibrationVectors; occupancies = mergeModelSet.occupancies; bfactor100s = mergeModelSet.bfactor100s; ionicRadii = mergeModelSet.ionicRadii; partialCharges = mergeModelSet.partialCharges; ellipsoids = mergeModelSet.ellipsoids; - specialAtomIDs = mergeModelSet.specialAtomIDs; setHaveStraightness(false); surfaceDistance100s = null; } @@ -140,8 +136,6 @@ String[] atomNames; String[] atomTypes; int[] atomSerials; - byte[] specialAtomIDs; - Object[] clientAtomReferences; Vector3f[] vibrationVectors; byte[] occupancies; short[] bfactor100s; @@ -700,6 +694,10 @@ } protected void setAtomName(int atomIndex, String name) { + byte id = JmolConstants.lookupSpecialAtomID(name); + atoms[atomIndex].atomID = id; + if (id > 0 && ((ModelCollection)this).models[atoms[atomIndex].modelIndex].isPDB) + return; if (atomNames == null) atomNames = new String[atoms.length]; atomNames[atomIndex] = name; @@ -2122,8 +2120,6 @@ atoms[j].index = j; atoms[j].modelIndex--; } - //System.out.println("atomcollection deleteAtoms atomslen=" + atoms.length); - atomNames = (String[]) ArrayUtil.deleteElements(atomNames, firstAtomIndex, nAtoms); atomTypes = (String[]) ArrayUtil.deleteElements(atomTypes, firstAtomIndex, @@ -2137,15 +2133,10 @@ firstAtomIndex, nAtoms); partialCharges = (float[]) ArrayUtil.deleteElements(partialCharges, firstAtomIndex, nAtoms); - //maybe will not work? ellipsoids = (Object[][]) ArrayUtil.deleteElements(ellipsoids, firstAtomIndex, nAtoms); - specialAtomIDs = (byte[]) ArrayUtil.deleteElements(specialAtomIDs, - firstAtomIndex, nAtoms); vibrationVectors = (Vector3f[]) ArrayUtil.deleteElements(vibrationVectors, firstAtomIndex, nAtoms); - clientAtomReferences = (Object[]) ArrayUtil.deleteElements((Object) clientAtomReferences, - firstAtomIndex, nAtoms); nSurfaceAtoms = 0; bsSurface = null; surfaceDistance100s = null; Modified: trunk/Jmol/src/org/jmol/modelset/LabelToken.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/LabelToken.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/modelset/LabelToken.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -285,7 +285,7 @@ if (propertyName.startsWith("property_")) { lt.text = propertyName; lt.tok = Token.data; - lt.data = viewer.getDataFloat(lt.text); + lt.data = viewer.getDataFloat(lt.text); } else { Token token = Token.getTokenFromName(propertyName); if (token != null && isLabelPropertyTok(token.tok)) @@ -375,8 +375,6 @@ break; case Token.data: floatT = (t.data != null ? t.data[atom.index] : Float.NaN); - if (Float.isNaN(floatT)) - strT = atom.getClientAtomStringProperty(t.text); break; case Token.formalcharge: int formalCharge = atom.getFormalCharge(); Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -1990,7 +1990,7 @@ bsCheck.and(getModelAtomBitSet(modelIndex, false)); for (int i = bsCheck.nextSetBit(0); i >= 0; i = bsCheck.nextSetBit(i + 1)) if (atoms[i].isVisible(0) - && atoms[i].getSpecialAtomID() == JmolConstants.ATOMID_ALPHA_CARBON + && atoms[i].atomID == JmolConstants.ATOMID_ALPHA_CARBON && atoms[i].getGroupID() != JmolConstants.GROUPID_CYSTINE) vCA.add((a1 = atoms[i])); if (vCA.size() == 0) @@ -2491,10 +2491,22 @@ } Logger.info(haveHAtoms ? "Standard Hbond calculation" : "Jmol pseudo-hbond calculation"); - BitSet bsCO = new BitSet(); - for (int i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) { - if (atoms[i].getSpecialAtomID() == JmolConstants.ATOMID_CARBONYL_OXYGEN) - bsCO.set(i); + BitSet bsCO = null; + if (!haveHAtoms) { + bsCO = new BitSet(); + for (int i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) { + int atomID = atoms[i].atomID; + switch (atomID) { + case JmolConstants.ATOMID_TERMINATING_OXT: + case JmolConstants.ATOMID_CARBONYL_OXYGEN: + case JmolConstants.ATOMID_CARBONYL_OD1: + case JmolConstants.ATOMID_CARBONYL_OD2: + case JmolConstants.ATOMID_CARBONYL_OE1: + case JmolConstants.ATOMID_CARBONYL_OE2: + bsCO.set(i); + break; + } + } } float maxXYDistance = viewer.getHbondsDistanceMax(); float minAttachedAngle = (float) (viewer.getHbondsAngleMin() * Math.PI / 180); @@ -3063,7 +3075,7 @@ char chainID = atom.getChainID(); info.put("name", getAtomName(i)); info.put("chain", (chainID == '\0' ? "" : "" + chainID)); - info.put("atomID", new Integer(atom.getSpecialAtomID())); + info.put("atomID", new Integer(atom.atomID)); info.put("groupID", new Integer(atom.getGroupID())); if (atom.alternateLocationID != '\0') info.put("altLocation", "" + atom.alternateLocationID); Modified: trunk/Jmol/src/org/jmol/modelset/ModelLoader.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -559,14 +559,16 @@ // atom is created, but not all methods are safe, because it // has no group -- this is only an issue for debugging int iLast = -1; + boolean isPDB = false; JmolAdapter.AtomIterator iterAtom = adapter.getAtomIterator(atomSetCollection); while (iterAtom.hasNext()) { int modelIndex = iterAtom.getAtomSetIndex() + baseModelIndex; if (modelIndex != iLast) { models[modelIndex].bsAtoms.clear(); + isPDB = models[modelIndex].isPDB; iLast = modelIndex; } - addAtom(modelIndex, + addAtom(isPDB, modelIndex, iterAtom.getAtomSymmetry(), iterAtom.getAtomSite(), iterAtom.getUniqueID(), @@ -590,7 +592,6 @@ iterAtom.getVectorY(), iterAtom.getVectorZ(), iterAtom.getAlternateLocationID(), - iterAtom.getClientAtomReference(), iterAtom.getRadius() ); } @@ -611,22 +612,21 @@ } - private void addAtom(int modelIndex, BitSet atomSymmetry, int atomSite, - Object atomUid, short atomicAndIsotopeNumber, - String atomName, int formalCharge, - float partialCharge, Object[] ellipsoid, - int occupancy, float bfactor, + private void addAtom(boolean isPDB, int modelIndex, BitSet atomSymmetry, + int atomSite, Object atomUid, + short atomicAndIsotopeNumber, String atomName, + int formalCharge, float partialCharge, + Object[] ellipsoid, int occupancy, float bfactor, float x, float y, float z, boolean isHetero, int atomSerial, char chainID, String group3, int groupSequenceNumber, char groupInsertionCode, float vectorX, float vectorY, float vectorZ, - char alternateLocationID, Object clientAtomReference, - float radius) { + char alternateLocationID, float radius) { checkNewGroup(atomCount, modelIndex, chainID, group3, groupSequenceNumber, groupInsertionCode); - Atom atom = new Atom(currentModelIndex, atomCount, x, y, z, radius, - atomSymmetry, atomSite, atomicAndIsotopeNumber, formalCharge, - isHetero, chainID, alternateLocationID); + Atom atom = new Atom(currentModelIndex, atomCount, x, y, z, radius, + atomSymmetry, atomSite, atomicAndIsotopeNumber, formalCharge, isHetero, + chainID, alternateLocationID); models[modelIndex].atomCount++; models[modelIndex].bsAtoms.set(atomCount); if (atomicAndIsotopeNumber % 128 == 1) @@ -638,10 +638,9 @@ if (ellipsoid != null) setEllipsoid(atomCount, ellipsoid); atom.group = nullGroup; - atom.colixAtom = viewer.getColixAtomPalette(atom, JmolConstants.PALETTE_CPK); + atom.colixAtom = viewer + .getColixAtomPalette(atom, JmolConstants.PALETTE_CPK); if (atomName != null) { - if (atomNames == null) - atomNames = new String[atoms.length]; int i; if ((i = atomName.indexOf('\0')) >= 0) { if (atomTypes == null) @@ -649,55 +648,31 @@ atomTypes[atomCount] = atomName.substring(i + 1); atomName = atomName.substring(0, i); } - atomNames[atomCount] = atomName.intern(); - byte specialAtomID = lookupSpecialAtomID(atomName); - if (specialAtomID == JmolConstants.ATOMID_ALPHA_CARBON && group3 != null - && group3.equalsIgnoreCase("CA")) + if (isPDB && atomName.indexOf('*') >= 0) + atomName = atomName.replace('*', '\''); + byte specialAtomID = (isPDB ? JmolConstants.lookupSpecialAtomID(atomName) + : 0); + if (specialAtomID == JmolConstants.ATOMID_ALPHA_CARBON + && "CA".equalsIgnoreCase(group3)) specialAtomID = 0; - if (specialAtomID != 0) { - if (specialAtomIDs == null) - specialAtomIDs = new byte[atoms.length]; - specialAtomIDs[atomCount] = specialAtomID; + atom.atomID = specialAtomID; + if (specialAtomID == 0) { + if (atomNames == null) + atomNames = new String[atoms.length]; + atomNames[atomCount] = atomName.intern(); } - } + } if (atomSerial != Integer.MIN_VALUE) { if (atomSerials == null) atomSerials = new int[atoms.length]; atomSerials[atomCount] = atomSerial; } - if (clientAtomReference != null) { - if (clientAtomReferences == null) - clientAtomReferences = new Object[atoms.length]; - clientAtomReferences[atomCount] = clientAtomReference; - } if (!Float.isNaN(vectorX)) setVibrationVector(atomCount, vectorX, vectorY, vectorZ); htAtomMap.put(atomUid, atom); atomCount++; } - private static Hashtable htAtom = new Hashtable(); - static { - for (int i = JmolConstants.specialAtomNames.length; --i >= 0; ) { - String specialAtomName = JmolConstants.specialAtomNames[i]; - if (specialAtomName != null) { - Integer boxedI = new Integer(i); - htAtom.put(specialAtomName, boxedI); - } - } - } - - private static byte lookupSpecialAtomID(String atomName) { - if (atomName != null) { - if (atomName.indexOf('*') >= 0) - atomName = atomName.replace('*', '\''); - Integer boxedAtomID = (Integer)htAtom.get(atomName); - if (boxedAtomID != null) - return (byte)(boxedAtomID.intValue()); - } - return 0; - } - private void checkNewGroup(int atomIndex, int modelIndex, char chainID, String group3, int groupSequenceNumber, char groupInsertionCode) { @@ -747,9 +722,6 @@ private void growAtomArrays(int newLength) { atoms = (Atom[]) ArrayUtil.setLength(atoms, newLength); - if (clientAtomReferences != null) - clientAtomReferences = (Object[]) ArrayUtil.setLength( - clientAtomReferences, newLength); if (vibrationVectors != null) vibrationVectors = (Vector3f[]) ArrayUtil.setLength(vibrationVectors, newLength); @@ -767,8 +739,6 @@ atomTypes = ArrayUtil.setLength(atomTypes, newLength); if (atomSerials != null) atomSerials = ArrayUtil.setLength(atomSerials, newLength); - if (specialAtomIDs != null) - specialAtomIDs = ArrayUtil.setLength(specialAtomIDs, newLength); } @@ -1059,8 +1029,8 @@ int modelIndex = atoms[firstAtomIndex].modelIndex; Group group = null; - if (group3 != null && specialAtomIDs != null && haveBioClasses) { - if (jbr == null && haveBioClasses) { + if (group3 != null && haveBioClasses) { + if (jbr == null) { try { Class shapeClass = Class.forName("org.jmol.modelsetbio.Resolver"); jbr = (JmolBioResolver) shapeClass.newInstance(); @@ -1073,7 +1043,7 @@ if (haveBioClasses) { group = jbr.distinguishAndPropagateGroup(chain, group3, seqcode, firstAtomIndex, maxAtomIndex, modelIndex, - specialAtomIndexes, specialAtomIDs, atoms); + specialAtomIndexes, atoms); } } String key; Modified: trunk/Jmol/src/org/jmol/modelsetbio/Resolver.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/Resolver.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/modelsetbio/Resolver.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -39,22 +39,20 @@ int seqcode, int firstAtomIndex, int maxAtomIndex, int modelIndex, int[] specialAtomIndexes, - byte[] specialAtomIDs, Atom[] atoms) { + Atom[] atoms) { /* * called by finalizeGroupBuild() * - * first: build array of special atom names, - * for example "CA" for the alpha carbon is assigned #2 - * see JmolConstants.specialAtomNames[] - * the special atoms all have IDs based on Atom.lookupSpecialAtomID(atomName) - * these will be the same for each conformation + * first: build array of special atom names, for example "CA" for the alpha + * carbon is assigned #2 see JmolConstants.specialAtomNames[] the special + * atoms all have IDs based on Atom.lookupSpecialAtomID(atomName) these will + * be the same for each conformation * - * second: creates the monomers themselves based on this information - * thus building the byte offsets[] array for each monomer, indicating which - * position relative to the first atom in the group is which atom. - * Each monomer.offsets[i] then points to the specific atom of that type - * these will NOT be the same for each conformation - * + * second: creates the monomers themselves based on this information thus + * building the byte offsets[] array for each monomer, indicating which + * position relative to the first atom in the group is which atom. Each + * monomer.offsets[i] then points to the specific atom of that type these + * will NOT be the same for each conformation */ int lastAtomIndex = maxAtomIndex - 1; @@ -65,31 +63,26 @@ for (int i = JmolConstants.ATOMID_MAX; --i >= 0;) specialAtomIndexes[i] = Integer.MIN_VALUE; - if (specialAtomIDs != null) { - // go last to first so that FIRST confirmation is default - for (int i = maxAtomIndex; --i >= firstAtomIndex;) { - int specialAtomID = specialAtomIDs[i]; - if (specialAtomID <= 0) - continue; - if (specialAtomID < JmolConstants.ATOMID_DISTINGUISHING_ATOM_MAX) { - /* - * save for future option -- turns out the 1jsa bug was in - * relation to an author using the same group number for two - * different groups - * - if ((distinguishingBits & (1 << specialAtomID) != 0) { - - //bh 9/21/2006: - // "if the group has two of the same, that cannot be right." - // Thus, for example, two C's doth not make a protein "carbonyl C" - distinguishingBits = 0; - break; - } - */ - distinguishingBits |= (1 << specialAtomID); - } - specialAtomIndexes[specialAtomID] = i; + // go last to first so that FIRST confirmation is default + for (int i = maxAtomIndex; --i >= firstAtomIndex;) { + int specialAtomID = atoms[i].getAtomID(); + if (specialAtomID <= 0) + continue; + if (specialAtomID < JmolConstants.ATOMID_DISTINGUISHING_ATOM_MAX) { + /* + * save for future option -- turns out the 1jsa bug was in relation to + * an author using the same group number for two different groups + * + * if ((distinguishingBits & (1 << specialAtomID) != 0) { + * + * //bh 9/21/2006: // + * "if the group has two of the same, that cannot be right." // Thus, + * for example, two C's doth not make a protein "carbonyl C" + * distinguishingBits = 0; break; } + */ + distinguishingBits |= (1 << specialAtomID); } + specialAtomIndexes[specialAtomID] = i; } if (lastAtomIndex < firstAtomIndex) Modified: trunk/Jmol/src/org/jmol/script/ScriptCompilationTokenParser.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptCompilationTokenParser.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/script/ScriptCompilationTokenParser.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -1059,9 +1059,10 @@ if (tokPeek(Token.times)) { tokenNext(); // this one is a '*' as a prime, not a wildcard - atomSpec += "*"; + atomSpec += "'"; } - return generateResidueSpecCode(new Token(Token.spec_atom, atomSpec)); + int atomID = JmolConstants.lookupSpecialAtomID(atomSpec.toUpperCase()); + return generateResidueSpecCode(new Token(Token.spec_atom, atomID, atomSpec)); } //---------------------------------------------------------------------------------------- Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -3012,6 +3012,13 @@ refresh(); rpn.addX(viewer.getClickableSet()); break; + case Token.spec_atom: + int atomID = instruction.intValue; + if (atomID > 0) + rpn.addX(compareInt(Token.atomid, null, Token.opEQ, atomID)); + else + rpn.addX(getAtomBits(instruction.tok, (String) value)); + break; case Token.carbohydrate: case Token.dna: case Token.hetero: @@ -3021,7 +3028,6 @@ case Token.purine: case Token.pyrimidine: case Token.rna: - case Token.spec_atom: case Token.spec_name_pattern: case Token.spec_alternate: case Token.specialposition: Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-04-05 13:10:43 UTC (rev 12764) @@ -3,6 +3,9 @@ version=12.0.RC3 +# bug fix: with unremediated PDB files, searching for *.C1' returns nothing +# code: dispensing with specialAtomID array +# bug fix: Jmol pseudo-hydrogen bonds were sometimes between two carbonyl groups # bug fix: structures with 400000+ atoms may be loaded # bug fix: calculated hbonds not retaining energy or type when saved to state # bug fix: color hbonds ENERGY causes NPE when non-calculated HBonds are created Modified: trunk/Jmol/src/org/jmol/viewer/JmolConstants.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -2241,7 +2241,7 @@ 0xFFFF80B0,*/ }; - public final static String[] specialAtomNames = { + private final static String[] specialAtomNames = { //////////////////////////////////////////////////////////////// // The ordering of these entries can be changed ... BUT ... @@ -2284,12 +2284,16 @@ // ... But we need to distinguish phosphorus separately because // it could be found in phosphorus-only nucleic polymers - + + "OD1", // 14 ASP/ASN carbonyl/carbonate + "OD2", // 15 ASP carbonyl/carbonate + "OE1", // 16 GLU/GLN carbonyl/carbonate + "OE2", // 17 GLU carbonyl/carbonate + // reserved for future expansion ... lipids & carbohydrates // 9/2006 -- carbohydrates are just handled as group3 codes // see below - null, null, // 14 - 15 - null, null, null, null, // 16 - 19 + null, null, // 18 - 19 null, null, null, null, // 20 - 23 null, null, null, null, // 24 - 27 null, null, null, null, // 28 - 31 @@ -2378,7 +2382,7 @@ "H1'", // 87 - H on sugar ring 1' carbon "H3T", // 88 - 3' terminus hydrogen - // add as many as necessary + // add as many as necessary -- backbone only "HO3'", // 89 - 3' terminus hydrogen (new) "HO5'", // 90 - 5' terminus hydrogen (new) @@ -2391,8 +2395,12 @@ "H2''", "HO2'", -}; + }; + public final static String getSpecialAtomName(int atomID) { + return specialAtomNames[atomID]; + } + public final static int ATOMID_MAX = specialAtomNames.length; //////////////////////////////////////////////////////////////// // currently, ATOMIDs must be >= 0 && <= 127 @@ -2435,6 +2443,11 @@ // this can be increased as far as 32, but not higher. public final static int ATOMID_DISTINGUISHING_ATOM_MAX = 14; + public final static byte ATOMID_CARBONYL_OD1 = 14; + public final static byte ATOMID_CARBONYL_OD2 = 15; + public final static byte ATOMID_CARBONYL_OE1 = 16; + public final static byte ATOMID_CARBONYL_OE2 = 17; + public final static byte ATOMID_N1 = 32; public final static byte ATOMID_C2 = 33; public final static byte ATOMID_N3 = 34; @@ -2468,7 +2481,22 @@ public final static byte ATOMID_HO3_PRIME = 89; public final static byte ATOMID_HO5_PRIME = 90; + private static Hashtable htSpecialAtoms = new Hashtable(); + static { + for (int i = specialAtomNames.length; --i >= 0; ) { + String specialAtomName = specialAtomNames[i]; + if (specialAtomName != null) + htSpecialAtoms.put(specialAtomName, new Integer(i)); + } + } + public static byte lookupSpecialAtomID(String atomName) { + Integer boxedAtomID = (Integer) htSpecialAtoms.get(atomName); + if (boxedAtomID != null) + return (byte) (boxedAtomID.intValue()); + return 0; + } + //////////////////////////////////////////////////////////////// // GROUP_ID related stuff for special groupIDs //////////////////////////////////////////////////////////////// Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-04-05 03:09:59 UTC (rev 12763) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-04-05 13:10:43 UTC (rev 12764) @@ -2420,16 +2420,6 @@ return modelSet.getModelBitSet(atomList, allTrajectories); } - // this is a problem. SmarterJmolAdapter doesn't implement this; - // it can only return null. - - public String getClientAtomStringProperty(Object clientAtom, - String propertyName) { - return (modelAdapter == null || propertyName == null - || propertyName.length() == 0 ? null : modelAdapter - .getClientAtomStringProperty(clientAtom, propertyName)); - } - public ModelSet getModelSet() { return modelSet; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |