From: <ha...@us...> - 2007-12-31 04:50:28
|
Revision: 8877 http://jmol.svn.sourceforge.net/jmol/?rev=8877&view=rev Author: hansonr Date: 2007-12-30 20:50:22 -0800 (Sun, 30 Dec 2007) Log Message: ----------- version=11.3.67_dev # bug fix: tainted occupancy not saved in state # bug fix: biopolymers have wrong wing vectors (from 11.3.62) # bug fix: restore of state does not reset user-defined atom properties # code: refactoring Atom and AtomCollection Modified Paths: -------------- trunk/Jmol/src/org/jmol/modelset/Atom.java trunk/Jmol/src/org/jmol/modelset/AtomCollection.java trunk/Jmol/src/org/jmol/modelset/ModelCollection.java trunk/Jmol/src/org/jmol/modelset/ModelLoader.java trunk/Jmol/src/org/jmol/modelset/ModelSet.java trunk/Jmol/src/org/jmol/modelset/Polymer.java trunk/Jmol/src/org/jmol/modelsetbio/AminoPolymer.java trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java trunk/Jmol/src/org/jmol/shapespecial/VectorsRenderer.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/modelset/Atom.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Atom.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/modelset/Atom.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -32,7 +32,6 @@ import org.jmol.g3d.Graphics3D; import org.jmol.util.TextFormat; -import java.util.Hashtable; import java.util.BitSet; import javax.vecmath.Point3f; @@ -93,115 +92,28 @@ madAtom = 0; } - Atom(ModelLoader modelSet, - int modelIndex, - int atomIndex, - BitSet atomSymmetry, - int atomSite, + Atom(int modelIndex, int atomIndex, + BitSet atomSymmetry, int atomSite, short atomicAndIsotopeNumber, - String atomName, short mad, - int formalCharge, float partialCharge, - int occupancy, - float bfactor, + short mad, int formalCharge, float x, float y, float z, - boolean isHetero, int atomSerial, char chainID, String group3, - float vibrationX, float vibrationY, float vibrationZ, + boolean isHetero, char chainID, char alternateLocationID, - Object clientAtomReference, float radius) { - this.group = modelSet.nullGroup; + float radius) { this.modelIndex = (short)modelIndex; this.atomSymmetry = atomSymmetry; this.atomSite = atomSite; this.atomIndex = atomIndex; this.atomicAndIsotopeNumber = atomicAndIsotopeNumber; - setBFactor(modelSet, bfactor); + if (isHetero) + formalChargeAndFlags = IS_HETERO_FLAG; setFormalCharge(formalCharge); - setOccupancy(modelSet, occupancy); - setPartialCharge(modelSet, partialCharge); - if (!Float.isNaN(vibrationX)) - setVibrationVector(modelSet, vibrationX, vibrationY, vibrationZ); - - colixAtom = modelSet.viewer.getColixAtomPalette(this, JmolConstants.PALETTE_CPK); this.alternateLocationID = (byte)alternateLocationID; this.radius = radius; setMadAtom(mad); set(x, y, z); - if (isHetero) - formalChargeAndFlags |= IS_HETERO_FLAG; - - if (atomName != null) { - if (modelSet.atomNames == null) - modelSet.atomNames = new String[modelSet.atoms.length]; - modelSet.atomNames[atomIndex] = atomName.intern(); - } - - byte specialAtomID = lookupSpecialAtomID(atomName); - if ((specialAtomID == JmolConstants.ATOMID_ALPHA_CARBON) && - (group3 != null) && - (group3.equalsIgnoreCase("CA"))) { - specialAtomID = 0; - } - //Logger.debug("atom - "+atomName+" specialAtomID=" + specialAtomID); - if (specialAtomID != 0) { - if (modelSet.specialAtomIDs == null) - modelSet.specialAtomIDs = new byte[modelSet.atoms.length]; - modelSet.specialAtomIDs[atomIndex] = specialAtomID; - } - - if (atomSerial != Integer.MIN_VALUE) { - if (modelSet.atomSerials == null) - modelSet.atomSerials = new int[modelSet.atoms.length]; - modelSet.atomSerials[atomIndex] = atomSerial; - } - - if (clientAtomReference != null) { - if (modelSet.clientAtomReferences == null) - modelSet.clientAtomReferences = new Object[modelSet.atoms.length]; - modelSet.clientAtomReferences[atomIndex] = clientAtomReference; - } - //System.out.println(this + " " + getIdentity()); } - 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); - //System.out.println("atom: "+specialAtomName+" "+i); - } - } - } - - /* - static String generateStarredAtomName(String primedAtomName) { - int primeIndex = primedAtomName.indexOf('\''); - if (primeIndex < 0) - return null; - return primedAtomName.replace('\'', '*'); - } - */ - - static String generatePrimeAtomName(String starredAtomName) { - int starIndex = starredAtomName.indexOf('*'); - if (starIndex < 0) - return starredAtomName; - return starredAtomName.replace('*', '\''); - } - - byte lookupSpecialAtomID(String atomName) { - if (atomName != null) { - atomName = generatePrimeAtomName(atomName); - Integer boxedAtomID = (Integer)htAtom.get(atomName); - //if (atomName.equals("O2P")) - //System.out.println("looking up "+atomName); - if (boxedAtomID != null) - return (byte)(boxedAtomID.intValue()); - } - return 0; - } - public final void setShapeVisibilityFlags(int flag) { shapeVisibilityFlags = flag; } @@ -410,44 +322,20 @@ formalChargeAndFlags = (byte)((formalChargeAndFlags & ~FORMAL_CHARGE_MASK) | (charge << 2)); } + void setVibrationVector() { + formalChargeAndFlags |= VIBRATION_VECTOR_FLAG; + } + public int getFormalCharge() { return formalChargeAndFlags >> 2; } - void setOccupancy(AtomCollection atomCollection, int occupancy) { - if (occupancy < 0) - occupancy = 0; - else if (occupancy > 100) - occupancy = 100; - if (occupancy != 100) { - if (atomCollection.occupancies == null) - atomCollection.occupancies = new byte[atomCollection.atoms.length]; - atomCollection.occupancies[atomIndex] = (byte)occupancy; - } - } - // a percentage value in the range 0-100 public int getOccupancy() { byte[] occupancies = group.chain.modelSet.occupancies; return occupancies == null ? 100 : occupancies[atomIndex]; } - void setPartialCharge(AtomCollection atomCollection, float partialCharge) { - if (Float.isNaN(partialCharge)) - return; - if (atomCollection.partialCharges == null) - atomCollection.partialCharges = new float[atomCollection.atoms.length]; - atomCollection.partialCharges[atomIndex] = partialCharge; - } - - void setBFactor(AtomCollection atomCollection, float bfactor) { - if (Float.isNaN(bfactor) || bfactor == 0) - return; - if (atomCollection.bfactor100s == null) - atomCollection.bfactor100s = new short[atomCollection.atoms.length]; - atomCollection.bfactor100s[atomIndex] = (short)(bfactor * 100); - } - // This is called bfactor100 because it is stored as an integer // 100 times the bfactor(temperature) value public int getBfactor100() { @@ -457,44 +345,6 @@ return bfactor100s[atomIndex]; } - void setVibrationVector(AtomCollection atomCollection, float x, float y, float z) { - if (Float.isNaN(x) || Float.isNaN(y) || Float.isNaN(z)) - return; - if (atomCollection.vibrationVectors == null) - atomCollection.vibrationVectors = new Vector3f[atomCollection.atoms.length]; - atomCollection.vibrationVectors[atomIndex] = new Vector3f(x, y, z); - formalChargeAndFlags |= VIBRATION_VECTOR_FLAG; - } - - void setVibrationVector(AtomCollection atomCollection, int tok, float fValue) { - Vector3f v = getVibrationVector(); - if (v == null) - v = new Vector3f(); - switch(tok) { - case Token.vibX: - v.x = fValue; - break; - case Token.vibY: - v.y = fValue; - break; - case Token.vibZ: - v.z = fValue; - break; - } - setVibrationVector(atomCollection, v.x, v.y, v.z); - } - - public Vector3f getVibrationVector() { - 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 setValency(int nBonds) { if (nBonds > 7) nBonds = 7; @@ -656,10 +506,6 @@ return partialCharges == null ? 0 : partialCharges[atomIndex]; } - int getArgb() { - return group.chain.modelSet.viewer.getColixArgb(colixAtom); - } - /** * Given a symmetry operation number, the set of cells in the model, and the * number of operations, this method returns either 0 or the cell number (555, 666) @@ -775,31 +621,28 @@ void setFractionalCoord(int tok, float fValue) { CellInfo[] c = group.chain.modelSet.cellInfos; - Point3f pt = new Point3f(this); if (c != null) - c[modelIndex].toFractional(pt); + c[modelIndex].toFractional(this); switch (tok) { case Token.fracX: - pt.x = fValue; + x = fValue; break; case Token.fracY: - pt.y = fValue; + y = fValue; break; case Token.fracZ: - pt.z = fValue; + z = fValue; break; } if (c != null) - c[modelIndex].toCartesian(pt); - set(pt); + c[modelIndex].toCartesian(this); } void setFractionalCoord(Point3f ptNew) { + set(ptNew); CellInfo[] c = group.chain.modelSet.cellInfos; - Point3f pt = new Point3f(ptNew); if (c != null) - c[modelIndex].toCartesian(pt); - set(pt); + c[modelIndex].toCartesian(this); } boolean isCursorOnTopOf(int xCursor, int yCursor, @@ -1250,12 +1093,12 @@ case 'x': case 'y': case 'z': - floatT = getVibrationCoord(ch); + floatT = group.chain.modelSet.getVibrationCoord(atomIndex, ch); break; default: if (ch != '\0') --ich; - Vector3f v = getVibrationVector(); + Vector3f v = group.chain.modelSet.getVibrationVector(atomIndex); if (v == null) { floatT = 0; break; Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -465,7 +465,8 @@ setAtomCoord(i, xyz.x, xyz.y, xyz.z); break; case Token.fracXyz: - setAtomCoordFractional(i, xyz); + atoms[i].setFractionalCoord(xyz); + taint(i, TAINT_COORD); break; case Token.vibXyz: setAtomVibrationVector(i, xyz.x, xyz.y, xyz.z); @@ -474,16 +475,11 @@ } } - public void setAtomVibrationVector(int atomIndex, float x, float y, float z) { - atoms[atomIndex].setVibrationVector(this, x, y, z); + private void setAtomVibrationVector(int atomIndex, float x, float y, float z) { + setVibrationVector(atomIndex, x, y, z); taint(atomIndex, TAINT_VIBRATION); } - public void setAtomCoordFractional(int atomIndex, Point3f pt) { - atoms[atomIndex].setFractionalCoord(pt); - taint(atomIndex, TAINT_COORD); - } - public void setAtomCoord(int atomIndex, float x, float y, float z) { if (atomIndex < 0 || atomIndex >= atomCount) return; @@ -539,6 +535,11 @@ case Token.atomZ: setAtomCoord(i, atom.x, atom.y, fValue); break; + case Token.vibX: + case Token.vibY: + case Token.vibZ: + setVibrationVector(i, tok, fValue); + break; case Token.fracX: case Token.fracY: case Token.fracZ: @@ -550,33 +551,99 @@ taint(i, TAINT_FORMALCHARGE); break; case Token.occupancy: - atom.setOccupancy(this, iValue); + setOccupancy(i, iValue); taint(i, TAINT_OCCUPANCY); break; case Token.partialCharge: - atom.setPartialCharge(this, fValue); + setPartialCharge(i, fValue); taint(i, TAINT_PARTIALCHARGE); break; case Token.temperature: - atom.setBFactor(this, fValue); + setBFactor(i, fValue); taint(i, TAINT_TEMPERATURE); break; case Token.valence: atom.setValency(iValue); taint(i, TAINT_VALENCE); break; - case Token.vibX: - case Token.vibY: - case Token.vibZ: - atom.setVibrationVector(this, tok, fValue); - taint(i, TAINT_VIBRATION); - break; } } } - // loading data + public float getVibrationCoord(int atomIndex, char c) { + if (vibrationVectors == null || vibrationVectors[atomIndex] == null) + return 0; + switch (c) { + case 'x': + return vibrationVectors[atomIndex].x; + case 'y': + return vibrationVectors[atomIndex].y; + default: + return vibrationVectors[atomIndex].z; + } + } + + public Vector3f getVibrationVector(int atomIndex) { + return vibrationVectors == null ? null : vibrationVectors[atomIndex]; + } + + protected void setVibrationVector(int atomIndex, float x, float y, float z) { + if (Float.isNaN(x) || Float.isNaN(y) || Float.isNaN(z)) + return; + if (vibrationVectors == null) + vibrationVectors = new Vector3f[atoms.length]; + vibrationVectors[atomIndex] = new Vector3f(x, y, z); + atoms[atomIndex].setVibrationVector(); + } + + private void setVibrationVector(int atomIndex, int tok, float fValue) { + Vector3f v = getVibrationVector(atomIndex); + if (v == null) + v = new Vector3f(); + switch(tok) { + case Token.vibX: + v.x = fValue; + break; + case Token.vibY: + v.y = fValue; + break; + case Token.vibZ: + v.z = fValue; + break; + } + setAtomVibrationVector(atomIndex, v.x, v.y, v.z); + } + + protected void setOccupancy(int atomIndex, int occupancy) { + if (occupancy < 0) + occupancy = 0; + else if (occupancy > 100) + occupancy = 100; + if (occupancy != 100) { + if (occupancies == null) + occupancies = new byte[atoms.length]; + occupancies[atomIndex] = (byte)occupancy; + } + } + protected void setPartialCharge(int atomIndex, float partialCharge) { + if (Float.isNaN(partialCharge)) + return; + if (partialCharges == null) + partialCharges = new float[atoms.length]; + partialCharges[atomIndex] = partialCharge; + } + + protected void setBFactor(int atomIndex, float bfactor) { + if (Float.isNaN(bfactor) || bfactor == 0) + return; + if (bfactor100s == null) + bfactor100s = new short[atoms.length]; + bfactor100s[atomIndex] = (short)(bfactor * 100); + } + + // loading data + public void loadData(String dataType, String dataString) { if (dataType.equalsIgnoreCase("coord")) { loadCoordinates(dataString, false); @@ -604,7 +671,7 @@ int nData = Parser.parseInt(dataString.substring(0, lines[0] - 1)); for (int i = 1; i <= nData; i++) { String[] tokens = Parser.getTokens(Parser.parseTrimmed(dataString.substring( - lines[i], lines[i + 1]))); + lines[i], lines[i + 1] - 1))); int atomIndex = Parser.parseInt(tokens[0]) - 1; float x = Parser.parseFloat(tokens[tokens.length - 1]); switch (type) { @@ -612,10 +679,10 @@ atoms[atomIndex].setFormalCharge((int)x); break; case TAINT_PARTIALCHARGE: - atoms[atomIndex].setPartialCharge(this, x); + setPartialCharge(atomIndex, x); break; case TAINT_TEMPERATURE: - atoms[atomIndex].setBFactor(this, x); + setBFactor(atomIndex, x); break; case TAINT_VALENCE: atoms[atomIndex].setValency((int)x); @@ -711,6 +778,9 @@ case TAINT_FORMALCHARGE: dataLabel = "formalcharge set"; break; + case TAINT_OCCUPANCY: + dataLabel = "occupancy set"; + break; case TAINT_PARTIALCHARGE: dataLabel = "partialcharge set"; break; @@ -735,6 +805,9 @@ case TAINT_FORMALCHARGE: s.append(atoms[i].getFormalCharge()); break; + case TAINT_OCCUPANCY: + s.append(atoms[i].getOccupancy()); + break; case TAINT_PARTIALCHARGE: s.append(atoms[i].getPartialCharge()); break; @@ -745,7 +818,7 @@ s.append(atoms[i].getValence()); break; case TAINT_VIBRATION: - Vector3f v = atoms[i].getVibrationVector(); + Vector3f v = getVibrationVector(i); if (v == null) v = new Vector3f(); s.append(" ").append(v.x).append(" ").append(v.y).append(" ").append(v.z); Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -418,10 +418,10 @@ * */ void calculateStructuresAllExcept(BitSet alreadyDefined, boolean addFileData) { + freezeModels(); for (int i = modelCount; --i >= 0;) if (models[i].isPDB && !alreadyDefined.get(i)) models[i].calculateStructures(); - freezeModels(); if (addFileData) propagateSecondaryStructure(); } @@ -435,6 +435,9 @@ for (int i = 0; i < m.chainCount; ++i) m.chains[i].groups = (Group[])ArrayUtil.setLength(m.chains[i].groups, groupCount); m.bioPolymers = (Polymer[])ArrayUtil.setLength(m.bioPolymers, m.bioPolymerCount); + for (int i = m.bioPolymerCount; --i >= 0; ) { + m.bioPolymers[i].freeze(); + } } } Modified: trunk/Jmol/src/org/jmol/modelset/ModelLoader.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -544,15 +544,68 @@ groupInsertionCode); if (atomCount == atoms.length) growAtomArrays(ATOM_GROWTH_INCREMENT); - Atom atom = new Atom(this, currentModelIndex, atomCount, atomSymmetry, - atomSite, atomicAndIsotopeNumber, atomName, mad, formalCharge, - partialCharge, occupancy, bfactor, x, y, z, isHetero, atomSerial, - chainID, group3, vectorX, vectorY, vectorZ, alternateLocationID, - clientAtomReference, radius); - atoms[atomCount++] = atom; + Atom atom = new Atom(currentModelIndex, atomCount, atomSymmetry, + atomSite, atomicAndIsotopeNumber, mad, formalCharge, x, y, z, isHetero, + chainID, alternateLocationID, radius); + atoms[atomCount] = atom; + setBFactor(atomCount, bfactor); + setOccupancy(atomCount, occupancy); + setPartialCharge(atomCount, partialCharge); + atom.group = nullGroup; + atom.colixAtom = viewer.getColixAtomPalette(atom, JmolConstants.PALETTE_CPK); + if (atomName != null) { + if (atomNames == null) + atomNames = new String[atoms.length]; + atomNames[atomCount] = atomName.intern(); + byte specialAtomID = lookupSpecialAtomID(atomName); + if (specialAtomID == JmolConstants.ATOMID_ALPHA_CARBON && group3 != null + && group3.equalsIgnoreCase("CA")) + specialAtomID = 0; + if (specialAtomID != 0) { + if (specialAtomIDs == null) + specialAtomIDs = new byte[atoms.length]; + specialAtomIDs[atomCount] = specialAtomID; + } + } + 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); + //System.out.println("atom: "+specialAtomName+" "+i); + } + } + } + + 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) { Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelSet.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -604,6 +604,5 @@ commands.append("\nend function;\n\n"); return commands.toString(); } - } Modified: trunk/Jmol/src/org/jmol/modelset/Polymer.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Polymer.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/modelset/Polymer.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -67,6 +67,9 @@ int endSeqcode) { } + public void freeze() { + } + public void calculateStructures() { } Modified: trunk/Jmol/src/org/jmol/modelsetbio/AminoPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/AminoPolymer.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/modelsetbio/AminoPolymer.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -277,8 +277,6 @@ //deprecated: calcHydrogenBonds(); //System.out.println("calculateStructures for model " + this.model.getModelIndex()); char[] structureTags = new char[monomerCount]; - calcPhiPsiAngles(); - hasOAtoms = checkWingAtoms(); for (int i = 0; i < monomerCount - 1; ++i) { AminoMonomer leadingResidue = (AminoMonomer) monomers[i]; AminoMonomer trailingResidue = (AminoMonomer) monomers[i + 1]; @@ -370,6 +368,11 @@ return true; } + public void freeze() { + hasOAtoms = checkWingAtoms(); + calcPhiPsiAngles(); + } + protected boolean calcPhiPsiAngles() { for (int i = 0; i < monomerCount - 1; ++i) calcPhiPsiAngles((AminoMonomer) monomers[i], (AminoMonomer) monomers[i + 1]); Modified: trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -303,13 +303,13 @@ public Point3f[] getLeadMidpoints() { if (leadMidpoints == null) - calcLeadMidpointsAndWingVectors(); + calcLeadMidpointsAndWingVectors(true); return leadMidpoints; } Point3f[] getLeadPoints() { if (leadPoints == null) - calcLeadMidpointsAndWingVectors(); + calcLeadMidpointsAndWingVectors(true); return leadPoints; } @@ -346,14 +346,10 @@ public final Vector3f[] getWingVectors() { if (leadMidpoints == null) // this is correct ... test on leadMidpoints - calcLeadMidpointsAndWingVectors(); + calcLeadMidpointsAndWingVectors(true); return wingVectors; // wingVectors might be null ... before autocalc } - private final void calcLeadMidpointsAndWingVectors() { - calcLeadMidpointsAndWingVectors(true); - } - private final void calcLeadMidpointsAndWingVectors(boolean getNewPoints) { int count = monomerCount; if (leadMidpoints == null || getNewPoints) { Modified: trunk/Jmol/src/org/jmol/shapespecial/VectorsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/VectorsRenderer.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/shapespecial/VectorsRenderer.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -47,7 +47,7 @@ Atom atom = atoms[i]; if (!atom.isShapeVisible(myVisibilityFlag) || modelSet.isAtomHidden(i)) continue; - Vector3f vibrationVector = atom.getVibrationVector(); + Vector3f vibrationVector = viewer.getVibrationVector(i); if (vibrationVector == null) continue; vectorScale = viewer.getVectorScale(); Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -7310,13 +7310,13 @@ fv = atom.getFractionalCoord('Z'); break; case Token.vibX: - fv = atom.getVibrationCoord('x'); + fv = viewer.getVibrationCoord(i, 'x'); break; case Token.vibY: - fv = atom.getVibrationCoord('y'); + fv = viewer.getVibrationCoord(i, 'y'); break; case Token.vibZ: - fv = atom.getVibrationCoord('z'); + fv = viewer.getVibrationCoord(i, 'z'); break; case Token.distance: if (planeRef != null) @@ -7353,7 +7353,7 @@ pt.add(atom.getFractionalCoord()); break; case Token.vibXyz: - pt.add(new Point3f(atom.getVibrationVector())); + pt.add(viewer.getVibrationVector(i)); break; case Token.color: pt.add(Graphics3D.colorPointFromInt(viewer.getColixArgb(atom Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2007-12-31 04:50:22 UTC (rev 8877) @@ -1,5 +1,9 @@ version=11.3.67_dev +# bug fix: tainted occupancy not saved in state +# bug fix: biopolymers have wrong wing vectors (from 11.3.62) +# bug fix: restore of state does not reset user-defined atom properties +# code: refactoring Atom and AtomCollection # ----------------------------------------------------------------------------- #version=11.3.66 Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-12-30 23:31:37 UTC (rev 8876) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-12-31 04:50:22 UTC (rev 8877) @@ -6293,4 +6293,12 @@ return modelSet.getBondAtom2(i); } + float getVibrationCoord(int atomIndex, char c) { + return modelSet.getVibrationCoord(atomIndex, c); + } + + public Vector3f getVibrationVector(int atomIndex) { + return modelSet.getVibrationVector(atomIndex); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |