From: <ha...@us...> - 2007-12-31 14:04:47
|
Revision: 8881 http://jmol.svn.sourceforge.net/jmol/?rev=8881&view=rev Author: hansonr Date: 2007-12-31 06:04:42 -0800 (Mon, 31 Dec 2007) Log Message: ----------- version=11.3.67 # bug fix: wing vectors for biopolymers # not containing O improperly drawn for sheets # and, in the case of set traceAlpha TRUE (the default), helixes # bug fix: translateSelected/rotateSelected does not move cartoons Modified Paths: -------------- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java trunk/Jmol/src/org/jmol/modelset/ModelCollection.java trunk/Jmol/src/org/jmol/modelset/Polymer.java trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java trunk/Jmol/src/org/jmol/shapebio/BioShapeRenderer.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2007-12-31 05:04:32 UTC (rev 8880) +++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2007-12-31 14:04:42 UTC (rev 8881) @@ -81,7 +81,7 @@ specialAtomIDs = mergeModelSet.specialAtomIDs; } - Viewer viewer; + public Viewer viewer; //TESTING ONLY Graphics3D g3d; final protected static boolean showRebondTimes = true; @@ -490,10 +490,6 @@ taint(atomIndex, TAINT_COORD); } - public void setAtomCoordRelative(Point3f offset, BitSet bs) { - setAtomCoordRelative(bs, offset.x, offset.y, offset.z); - } - public void setAtomCoordRelative(int atomIndex, float x, float y, float z) { if (atomIndex < 0 || atomIndex >= atomCount) return; @@ -504,7 +500,7 @@ taint(atomIndex, TAINT_COORD); } - private void setAtomCoordRelative(BitSet atomSet, float x, float y, float z) { + protected void setAtomCoordRelative(BitSet atomSet, float x, float y, float z) { bspf = null; for (int i = atomCount; --i >= 0;) if (atomSet.get(i)) Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2007-12-31 05:04:32 UTC (rev 8880) +++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2007-12-31 14:04:42 UTC (rev 8881) @@ -422,7 +422,7 @@ for (int i = modelCount; --i >= 0;) if (models[i].isPDB && !alreadyDefined.get(i)) models[i].calculateStructures(); - if (addFileData) + if (addFileData) propagateSecondaryStructure(); } @@ -701,6 +701,11 @@ } public void recalculateLeadMidpointsAndWingVectors(int modelIndex) { + if (modelIndex < 0) { + for (int i = 0; i < modelCount; i++) + recalculateLeadMidpointsAndWingVectors(i); + return; + } int polymerCount = models[modelIndex].getBioPolymerCount(); for (int ip = 0; ip < polymerCount; ip++) models[modelIndex].getBioPolymer(ip) @@ -1170,12 +1175,13 @@ taint(i, TAINT_COORD); n++; } - if (isInternal) - return; - ptTemp.scale(1f / n); - for (int i = atomCount; --i >= 0;) - if (bs.get(i)) - atoms[i].add(ptTemp); + if (!isInternal) { + ptTemp.scale(1f / n); + for (int i = atomCount; --i >= 0;) + if (bs.get(i)) + atoms[i].add(ptTemp); + } + recalculateLeadMidpointsAndWingVectors(-1); } public BitSet getMoleculeBitSet(BitSet bs) { @@ -1508,6 +1514,16 @@ ////////// atoms ///////// + public void setAtomCoordRelative(Point3f offset, BitSet bs) { + setAtomCoordRelative(bs, offset.x, offset.y, offset.z); + recalculateLeadMidpointsAndWingVectors(-1); + } + + public void setAtomCoord(BitSet bs, int tokType, Object xyzValues) { + super.setAtomCoord(bs, tokType, xyzValues); + recalculateLeadMidpointsAndWingVectors(-1); + } + public int getAtomCountInModel(int modelIndex) { if (modelIndex < 0) return atomCount; Modified: trunk/Jmol/src/org/jmol/modelset/Polymer.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Polymer.java 2007-12-31 05:04:32 UTC (rev 8880) +++ trunk/Jmol/src/org/jmol/modelset/Polymer.java 2007-12-31 14:04:42 UTC (rev 8881) @@ -47,7 +47,7 @@ // holds center points between alpha carbons or sugar phosphoruses protected Point3f[] leadMidpoints; protected Point3f[] leadPoints; - protected Point3f[] tempPoints; + protected Point3f[] sheetPoints; // holds the vector that runs across the 'ribbon' protected Vector3f[] wingVectors; Modified: trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java 2007-12-31 05:04:32 UTC (rev 8880) +++ trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java 2007-12-31 14:04:42 UTC (rev 8881) @@ -28,6 +28,7 @@ import org.jmol.modelset.Model; import org.jmol.modelset.Polymer; import org.jmol.util.BitSetUtil; +//import org.jmol.util.Escape; import org.jmol.util.Logger; import org.jmol.util.TextFormat; @@ -203,7 +204,7 @@ public void clearStructures() { for (int i = 0; i < monomerCount; i++) - monomers[i].setStructure(null); + monomers[i].setStructure(null); } void removeProteinStructure(int monomerIndex, int count) { @@ -290,13 +291,13 @@ public void setConformation(BitSet bsSelected, int nAltLocsInModel) { for (int i = monomerCount; --i >= 0; ) monomers[i].updateOffsetsForAlternativeLocations(bsSelected, nAltLocsInModel); - recalculateLeadMidpointsAndWingVectors(); //calculateStructures(); } public void recalculateLeadMidpointsAndWingVectors() { leadAtomIndices = null; + sheetPoints = null; getLeadAtomIndices(); calcLeadMidpointsAndWingVectors(false); } @@ -318,30 +319,30 @@ return leadMidpoints; else if (sheetSmoothing == 0) return leadPoints; - return getTempPoints(sheetSmoothing); + return getSheetPoints(sheetSmoothing); } private float sheetSmoothing; - private Point3f[] getTempPoints(float sheetSmoothing) { - if (tempPoints != null && sheetSmoothing == this.sheetSmoothing) - return tempPoints; - tempPoints = new Point3f[monomerCount + 1]; + private Point3f[] getSheetPoints(float sheetSmoothing) { + if (sheetPoints != null && sheetSmoothing == this.sheetSmoothing) + return sheetPoints; + sheetPoints = new Point3f[monomerCount + 1]; getLeadPoints(); for (int i = 0; i < monomerCount; i++) - tempPoints[i] = new Point3f(); + sheetPoints[i] = new Point3f(); Vector3f v = new Vector3f(); for (int i = 0; i < monomerCount; i++) { if (monomers[i].isSheet()) { v.sub(leadMidpoints[i], leadPoints[i]); v.scale(sheetSmoothing); - tempPoints[i].add(leadPoints[i], v); + sheetPoints[i].add(leadPoints[i], v); } else { - tempPoints[i] = leadPoints[i]; + sheetPoints[i] = leadPoints[i]; } } - tempPoints[monomerCount] = tempPoints[monomerCount - 1]; + sheetPoints[monomerCount] = sheetPoints[monomerCount - 1]; this.sheetSmoothing = sheetSmoothing; - return tempPoints; + return sheetPoints; } public final Vector3f[] getWingVectors() { @@ -353,12 +354,13 @@ private final void calcLeadMidpointsAndWingVectors(boolean getNewPoints) { int count = monomerCount; if (leadMidpoints == null || getNewPoints) { - leadMidpoints = new Point3f[count + 1]; + leadMidpoints = new Point3f[count + 1]; leadPoints = new Point3f[count + 1]; wingVectors = new Vector3f[count + 1]; sheetSmoothing = Float.MIN_VALUE; } boolean hasWingPoints = hasWingPoints(); + //if (model.getModelSet().viewer.getTestFlag1()) hasWingPoints = false; Vector3f vectorA = new Vector3f(); Vector3f vectorB = new Vector3f(); @@ -404,43 +406,40 @@ wingVectors[1] = unitVectorX; } else { // auto-calculate wing vectors based upon lead atom positions only - // seems to work like a charm! :-) - Point3f next, current, prev; - prev = leadMidpoints[0]; - current = leadMidpoints[1]; Vector3f previousVectorC = null; for (int i = 1; i < count; ++i) { - next = leadMidpoints[i + 1]; - vectorA.sub(prev, current); - vectorB.sub(next, current); + // perfect for traceAlpha on; reasonably OK for traceAlpha OFF + vectorA.sub(leadMidpoints[i], leadPoints[i]); + vectorB.sub(leadPoints[i], leadMidpoints[i + 1]); vectorC.cross(vectorA, vectorB); vectorC.normalize(); if (previousVectorC != null && previousVectorC.angle(vectorC) > Math.PI/2) vectorC.scale(-1); previousVectorC = wingVectors[i] = new Vector3f(vectorC); - prev = current; - current = next; } } } wingVectors[0] = wingVectors[1]; wingVectors[count] = wingVectors[count - 1]; + Point3f pt = leadPoints[11]; + vectorC.set(wingVectors[11]); + vectorC.add(pt); + /* + //order of points is mid11 lead11 mid12 lead12 + System.out.println("draw pt" + 11 + "b " + Escape.escape(leadMidpoints[11]) + " color yellow"); + System.out.println("draw pt" + 11 + " " + Escape.escape(leadPoints[11]) + " color red"); + System.out.println("draw pt" + 12 + "b " + Escape.escape(leadMidpoints[12]) + " color blue"); + System.out.println("draw pt" + 12 + " " + Escape.escape(leadPoints[12]) + " color green"); + System.out.println("draw v" + 11 + " arrow " + Escape.escape(pt) + " " + Escape.escape(vectorC)); + System.out.println("draw plane" + 11 + " " + Escape.escape(leadPoints[11]) + " " + Escape.escape(leadMidpoints[11]) + " "+ Escape.escape(leadMidpoints[12])); - /* - for (int i = 0; i < wingVectors.length; ++i) { - if (wingVectors[i] == null) { - Logger.debug("que? wingVectors[" + i + "] == null?"); - Logger.debug("hasWingPoints=" + hasWingPoints + - " wingVectors.length=" + wingVectors.length + - " count=" + count); - - } - else if (Float.isNaN(wingVectors[i].x)) { - Logger.debug("wingVectors[" + i + "]=" + wingVectors[i]); - } - } - */ + pt = leadMidpoints[11]; + vectorC.set(wingVectors[11]); + vectorC.add(pt); + System.out.println("draw v" + 11 + "b arrow " + Escape.escape(pt) + " " + Escape.escape(vectorC)); +*/ + } private final Vector3f unitVectorX = new Vector3f(1, 0, 0); Modified: trunk/Jmol/src/org/jmol/shapebio/BioShapeRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/BioShapeRenderer.java 2007-12-31 05:04:32 UTC (rev 8880) +++ trunk/Jmol/src/org/jmol/shapebio/BioShapeRenderer.java 2007-12-31 14:04:42 UTC (rev 8881) @@ -111,8 +111,9 @@ isHighRes = TF; TF = (viewer.isJmolDataFrame(bioShape.modelIndex) || viewer.getTraceAlpha()); - if (TF != isTraceAlpha) + if (TF != isTraceAlpha) { invalidate = true; + } isTraceAlpha = TF; int val = viewer.getRibbonAspectRatio(); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2007-12-31 05:04:32 UTC (rev 8880) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2007-12-31 14:04:42 UTC (rev 8881) @@ -1,5 +1,9 @@ version=11.3.67 +# bug fix: wing vectors for biopolymers +# not containing O improperly drawn for sheets +# and, in the case of set traceAlpha TRUE (the default), helixes +# bug fix: translateSelected/rotateSelected does not move cartoons # 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |