From: <ha...@us...> - 2013-06-13 22:54:06
|
Revision: 18327 http://sourceforge.net/p/jmol/code/18327 Author: hansonr Date: 2013-06-13 22:54:03 +0000 (Thu, 13 Jun 2013) Log Message: ----------- ___JmolVersion="13.1.17_dev_2013.06.13" bug fix: draw ARROW ATOM/BOND broken bug fix: draw ARROW with offset disallows set picking draw adjustments Modified Paths: -------------- trunk/Jmol/src/org/jmol/minimize/forcefield/Calculations.java trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsMMFF.java trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsUFF.java trunk/Jmol/src/org/jmol/minimize/forcefield/ForceField.java trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldMMFF.java trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldUFF.java trunk/Jmol/src/org/jmol/renderspecial/DrawRenderer.java trunk/Jmol/src/org/jmol/shapespecial/Draw.java trunk/Jmol/src/org/jmol/shapespecial/DrawMesh.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Viewer.java Added Paths: ----------- trunk/Jmol/src/org/jmol/minimize/MinPosition.java Added: trunk/Jmol/src/org/jmol/minimize/MinPosition.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/MinPosition.java (rev 0) +++ trunk/Jmol/src/org/jmol/minimize/MinPosition.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -0,0 +1,8 @@ +package org.jmol.minimize; + +public class MinPosition extends MinObject { + MinPosition(int[] data, double[] ddata) { + this.data = data; + this.ddata = ddata; + } +} Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/Calculations.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/Calculations.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/Calculations.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -30,6 +30,7 @@ import org.jmol.minimize.MinAngle; import org.jmol.minimize.MinAtom; import org.jmol.minimize.MinBond; +import org.jmol.minimize.MinPosition; import org.jmol.minimize.MinTorsion; import org.jmol.minimize.Util; import org.jmol.util.ArrayUtil; @@ -54,7 +55,8 @@ final static int CALC_OOP = 4; final static int CALC_VDW = 5; final static int CALC_ES = 6; - final static int CALC_MAX = 7; + final static int CALC_POSITION = 7; + final static int CALC_MAX = 8; ForceField ff; JmolList<Object[]>[] calculations = ArrayUtil.createArrayOfArrayList(CALC_MAX); @@ -67,6 +69,7 @@ MinBond[] minBonds; MinAngle[] minAngles; MinTorsion[] minTorsions; + MinPosition[] minPositions; JmolList<Object[]> constraints; boolean isPreliminary; @@ -76,13 +79,14 @@ Calculations(ForceField ff, MinAtom[] minAtoms, MinBond[] minBonds, - MinAngle[] minAngles, MinTorsion[] minTorsions, + MinAngle[] minAngles, MinTorsion[] minTorsions, MinPosition[] minPositions, JmolList<Object[]> constraints) { this.ff = ff; this.minAtoms = minAtoms; this.minBonds = minBonds; this.minAngles = minAngles; this.minTorsions = minTorsions; + this.minPositions = minPositions; atomCount = minAtoms.length; bondCount = minBonds.length; angleCount = minAngles.length; @@ -154,10 +158,10 @@ private double calc(int iType, boolean gradients) { logging = loggingEnabled && !silent; this.gradients = gradients; - JmolList<Object[]> calc = calculations[iType]; + JmolList<Object[]> calcs = calculations[iType]; int nCalc; double energy = 0; - if (calc == null || (nCalc = calc.size()) == 0) + if (calcs == null || (nCalc = calcs.size()) == 0) return 0; if (logging) appendLogData(getDebugHeader(iType)); @@ -194,6 +198,10 @@ return calc(CALC_OOP, gradients); } + double energyPos(boolean gradients) { + return calc(CALC_POSITION, gradients); + } + double energyVDW(boolean gradients) { return calc(CALC_VDW, gradients); } @@ -402,6 +410,12 @@ case -1: //Override to give reference break; + case CALC_POSITION: + return + "\nA T O M P O S I T I O N\n\n" + +" ATOM TYPE POSITION FORCE\n" + +" X Y Z CONSTANT DELTA ENERGY\n" + +"----------------------------------------------------------------"; case CALC_DISTANCE: return "\nB O N D S T R E T C H I N G (" + bondCount + " bonds)\n\n" @@ -455,6 +469,13 @@ protected String getDebugLineC(int iType, Calculation c) { float energy = ff.toUserUnits(c.energy); switch (iType) { + case CALC_POSITION: + return TextFormat.sprintf( + "%3d %-5s %8.3f %8.3f %8.3f %8.3f %8.3f", + "sFI", new Object[] { minAtoms[c.ia].sType, + new float[] { (float)c.dData[0], (float)c.dData[1], (float)c.dData[2], (float)c.dData[3], + (float)c.delta, energy }, + new int[] { minAtoms[c.ia].atom.getAtomNumber() }}); case CALC_DISTANCE: return TextFormat.sprintf( "%3d %3d %-5s %-5s %4.2f%8.3f %8.3f %8.3f %8.3f %8.3f", Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsMMFF.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsMMFF.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsMMFF.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -32,7 +32,9 @@ import org.jmol.minimize.MinAtom; import org.jmol.minimize.MinBond; import org.jmol.minimize.MinObject; +import org.jmol.minimize.MinPosition; import org.jmol.minimize.MinTorsion; +import org.jmol.minimize.forcefield.CalculationsUFF.PositionCalc; import org.jmol.util.TextFormat; /** @@ -56,14 +58,15 @@ VDWCalc vdwCalc; ESCalc esCalc; SBCalc sbCalc; + PositionCalc posCalc; ForceFieldMMFF mmff; CalculationsMMFF(ForceField ff, Map<Integer, Object> ffParams, MinAtom[] minAtoms, MinBond[] minBonds, - MinAngle[] minAngles, MinTorsion[] minTorsions, + MinAngle[] minAngles, MinTorsion[] minTorsions, MinPosition[] minPositions, JmolList<Object[]> constraints) { - super(ff, minAtoms, minBonds, minAngles, minTorsions, constraints); + super(ff, minAtoms, minBonds, minAngles, minTorsions, minPositions, constraints); mmff = (ForceFieldMMFF) ff; this.ffParams = ffParams; bondCalc = new DistanceCalc(); @@ -73,6 +76,7 @@ oopCalc = new OOPCalc(); vdwCalc = new VDWCalc(); esCalc = new ESCalc(); + posCalc = new PositionCalc(); } @Override @@ -112,6 +116,14 @@ if (isInvertible(minAtoms[i])) oopCalc.setData(calc, i); + if (minPositions != null) { + calc = calculations[CALC_POSITION] = new JmolList<Object[]>(); + // set up the special atom arrays + PositionCalc posCalc = new PositionCalc(); + for (int i = minPositions.length; --i >= 0;) + posCalc.setData(calc, minPositions[i].data, minPositions[i].ddata); + } + pairSearch(calculations[CALC_VDW] = new JmolList<Object[]>(), new VDWCalc(), calculations[CALC_ES] = new JmolList<Object[]>(), new ESCalc()); @@ -179,6 +191,8 @@ return vdwCalc.compute(dataIn); case CALC_ES: return esCalc.compute(dataIn); + case CALC_POSITION: + return posCalc.compute(dataIn); } return 0.0; } @@ -384,6 +398,21 @@ } } + class PositionCalc extends Calculation { + + @Override + double compute(Object[] dataIn) { + // TODO + return 0; + } + + public void setData(JmolList<Object[]> calc, int[] data, double[] ddata) { + // TODO + + } + + } + class OOPCalc extends Calculation { final static double FOOPD = 0.043844 * RAD_TO_DEG; Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsUFF.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsUFF.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsUFF.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -31,6 +31,7 @@ import org.jmol.minimize.MinAngle; import org.jmol.minimize.MinAtom; import org.jmol.minimize.MinBond; +import org.jmol.minimize.MinPosition; import org.jmol.minimize.MinTorsion; import org.jmol.minimize.Util; @@ -71,19 +72,21 @@ TorsionCalc torsionCalc; OOPCalc oopCalc; VDWCalc vdwCalc; + PositionCalc posCalc; //ESCalc esCalc; CalculationsUFF(ForceField ff, Map<Object, FFParam> ffParams, MinAtom[] minAtoms, MinBond[] minBonds, - MinAngle[] minAngles, MinTorsion[] minTorsions, + MinAngle[] minAngles, MinTorsion[] minTorsions, MinPosition[] minPositions, JmolList<Object[]> constraints) { - super(ff, minAtoms, minBonds, minAngles, minTorsions, constraints); + super(ff, minAtoms, minBonds, minAngles, minTorsions, minPositions, constraints); this.ffParams = ffParams; bondCalc = new DistanceCalc(); angleCalc = new AngleCalc(); torsionCalc = new TorsionCalc(); oopCalc = new OOPCalc(); vdwCalc = new VDWCalc(); + posCalc = new PositionCalc(); //esCalc = new ESCalc(); } @@ -98,28 +101,28 @@ JmolList<Object[]> calc; DistanceCalc distanceCalc = new DistanceCalc(); - calc = calculations[CALC_DISTANCE] = new JmolList<Object[]>(); + calc = calculations[CALC_DISTANCE] = new JmolList<Object[]>(); for (int i = 0; i < bondCount; i++) { MinBond bond = minBonds[i]; double bondOrder = bond.order; if (bond.isAromatic) bondOrder = 1.5; if (bond.isAmide) - bondOrder = 1.41; + bondOrder = 1.41; distanceCalc.setData(calc, bond.data[0], bond.data[1], bondOrder); } - calc = calculations[CALC_ANGLE] = new JmolList<Object[]>(); + calc = calculations[CALC_ANGLE] = new JmolList<Object[]>(); AngleCalc angleCalc = new AngleCalc(); for (int i = minAngles.length; --i >= 0;) angleCalc.setData(calc, minAngles[i].data); - calc = calculations[CALC_TORSION] = new JmolList<Object[]>(); + calc = calculations[CALC_TORSION] = new JmolList<Object[]>(); TorsionCalc torsionCalc = new TorsionCalc(); for (int i = minTorsions.length; --i >= 0;) torsionCalc.setData(calc, minTorsions[i].data); - calc = calculations[CALC_OOP] = new JmolList<Object[]>(); + calc = calculations[CALC_OOP] = new JmolList<Object[]>(); // set up the special atom arrays OOPCalc oopCalc = new OOPCalc(); int elemNo; @@ -129,11 +132,20 @@ oopCalc.setData(calc, i, elemNo); } + if (minPositions != null) { + calc = calculations[CALC_POSITION] = new JmolList<Object[]>(); + // set up the special atom arrays + PositionCalc posCalc = new PositionCalc(); + for (int i = minPositions.length; --i >= 0;) + posCalc.setData(calc, minPositions[i].data, minPositions[i].ddata); + } + // Note that while the UFF paper mentions an electrostatic term, // it does not actually use it. Both Towhee and the UFF FAQ // discourage the use of electrostatics with UFF. - pairSearch(calculations[CALC_VDW] = new JmolList<Object[]>(), new VDWCalc(), null, null); + pairSearch(calculations[CALC_VDW] = new JmolList<Object[]>(), + new VDWCalc(), null, null); return true; } @@ -181,6 +193,8 @@ return oopCalc.compute(dataIn); case CALC_VDW: return vdwCalc.compute(dataIn); + case CALC_POSITION: + return posCalc.compute(dataIn); //case CALC_ES: //return esCalc.compute(dataIn); } @@ -490,6 +504,21 @@ final static double KCAL22 = 22.0 * KCAL_TO_KJ; final static double KCAL44 = 44.0 * KCAL_TO_KJ; + class PositionCalc extends Calculation { + + @Override + double compute(Object[] dataIn) { + // TODO + return 0; + } + + public void setData(JmolList<Object[]> calc, int[] data, double[] ddata) { + // TODO + + } + + } + class OOPCalc extends Calculation { void setData(JmolList<Object[]> calc, int ib, int elemNo) { Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/ForceField.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/ForceField.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/ForceField.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -35,6 +35,7 @@ import org.jmol.minimize.MinAngle; import org.jmol.minimize.MinAtom; import org.jmol.minimize.MinBond; +import org.jmol.minimize.MinPosition; import org.jmol.minimize.MinTorsion; import org.jmol.minimize.Minimizer; import org.jmol.minimize.Util; @@ -89,6 +90,7 @@ MinBond[] minBonds; MinAngle[] minAngles; MinTorsion[] minTorsions; + MinPosition[] minPositions; BS bsFixed; Minimizer minimizer; @@ -324,6 +326,10 @@ return calc.energyOOP(gradients); } + double energyPosition(boolean gradients) { + return calc.energyPos(gradients); + } + double energyVDW(boolean gradients) { return calc.energyVDW(gradients); } Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldMMFF.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldMMFF.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldMMFF.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -249,7 +249,7 @@ setModelFields(); fixTypes(); calc = new CalculationsMMFF(this, ffParams, minAtoms, minBonds, - minAngles, minTorsions, minimizer.constraints); + minAngles, minTorsions, minPositions, minimizer.constraints); calc.setLoggingEnabled(true); return calc.setupCalculations(); } Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldUFF.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldUFF.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldUFF.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -64,7 +64,7 @@ return false; setAtomTypes(bsElements, elemnoMax); calc = new CalculationsUFF(this, ffParams, minAtoms, minBonds, - minAngles, minTorsions, minimizer.constraints); + minAngles, minTorsions, minPositions, minimizer.constraints); return calc.setupCalculations(); } Modified: trunk/Jmol/src/org/jmol/renderspecial/DrawRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/renderspecial/DrawRenderer.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/renderspecial/DrawRenderer.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -300,9 +300,9 @@ for (int i = 0; i < 4; i++) viewer.transformPtScr(vertices[i], screens[i]); - float f = 1; // bendiness + float f = 4 * getArrowScale(); // bendiness float endoffset = 0.2f; - float offsetside = 10 * width; + float offsetside = (width == 0 ? 0.1f : width); pt0.set(screens[0].x, screens[0].y, screens[0].z); pt1.set(screens[1].x, screens[1].y, screens[1].z); @@ -380,11 +380,7 @@ boolean isBarb) { if (dmesh.noHead) return; - float fScale = dmesh.drawArrowScale; - if (fScale == 0) - fScale = viewer.getFloat(T.defaultdrawarrowscale) * (dmesh.connections == null ? 1f : 0.5f); - if (fScale <= 0) - fScale = 0.5f; + float fScale = getArrowScale(); if (isTransformed) fScale *= 40; if (factor2 > 0) @@ -431,6 +427,15 @@ g3d.fillCylinderScreen3I(GData.ENDCAPS_OPENEND, diameter, pt0i, pt1i, null, null, mad / 2000f); } + private float getArrowScale() { + float fScale = dmesh.scale; + if (fScale == 0) + fScale = viewer.getFloat(T.defaultdrawarrowscale) * (dmesh.connections == null ? 1f : 0.5f); + if (fScale <= 0) + fScale = 0.5f; + return fScale; + } + private final BS bsHandles = new BS(); private void renderHandles() { Modified: trunk/Jmol/src/org/jmol/shapespecial/Draw.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Draw.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/shapespecial/Draw.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -1032,11 +1032,11 @@ * have to watch out for double-listed vertices * */ - if (newScale == 0 || dmesh.vertexCount == 0 || dmesh.scale == newScale) + if (newScale == 0 || dmesh.vertexCount == 0 && dmesh.connections == null || dmesh.scale == newScale) return; float f = newScale / dmesh.scale; dmesh.scale = newScale; - if (dmesh.haveXyPoints || dmesh.drawType == EnumDrawType.ARC || dmesh.drawType == EnumDrawType.CIRCLE || dmesh.drawType == EnumDrawType.CIRCULARPLANE) + if (dmesh.isRenderScalable()) return; // done in renderer V3 diff = new V3(); int iptlast = -1; @@ -1223,7 +1223,7 @@ } P3 pt = new P3(); int ptVertex = vertexes[iVertex]; - P3 coord = P3.newP(mesh.vertices[ptVertex]); + P3 coord = P3.newP(mesh.altVertices == null ? mesh.vertices[ptVertex] : (P3) mesh.altVertices[ptVertex]); P3 newcoord = new P3(); V3 move = new V3(); viewer.transformPt3f(coord, pt); @@ -1260,8 +1260,7 @@ * @param bsVisible * @return true if found */ - private boolean findPickedObject(int x, int y, boolean isPicking, - BS bsVisible) { + private boolean findPickedObject(int x, int y, boolean isPicking, BS bsVisible) { int dmin2 = MAX_OBJECT_CLICK_DISTANCE_SQUARED; if (gdata.isAntialiased()) { x <<= 1; @@ -1286,7 +1285,9 @@ for (int iVertex = (m.isTriangleSet ? 3 : m.polygonIndexes[iModel].length); --iVertex >= 0;) { try { - P3 pt = m.vertices[m.polygonIndexes[iModel][iVertex]]; + int iv = m.polygonIndexes[iModel][iVertex]; + P3 pt = (m.altVertices == null ? m.vertices[iv] + : (P3) m.altVertices[iv]); int d2 = coordinateInRange(x, y, pt, dmin2, ptXY); if (d2 >= 0) { pickedMesh = m; @@ -1344,7 +1345,7 @@ else if (dmesh.isBarb) str.append(" barb"); if (dmesh.scale != 1 - && (dmesh.haveXyPoints || dmesh.drawType == EnumDrawType.CIRCLE || dmesh.drawType == EnumDrawType.ARC)) + && (dmesh.haveXyPoints || dmesh.connections != null || dmesh.drawType == EnumDrawType.CIRCLE || dmesh.drawType == EnumDrawType.ARC)) str.append(" scale ").appendF(dmesh.scale); if (dmesh.width != 0) str.append(" diameter ").appendF( Modified: trunk/Jmol/src/org/jmol/shapespecial/DrawMesh.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/DrawMesh.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/shapespecial/DrawMesh.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -118,4 +118,17 @@ //no! title = (String[]) ArrayUtil.deleteElements(title, modelIndex, 1); } + public boolean isRenderScalable() { + switch (drawType) { + case ARROW: + return (connections != null); + case ARC: + case CIRCLE: + case CIRCULARPLANE: + return true; + default: + return haveXyPoints; + } + } + } Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-06-13 22:54:03 UTC (rev 18327) @@ -9,8 +9,10 @@ # The quotes above look odd for a parameter file, but they are # important for the JavaScript version of Jmol. -___JmolVersion="13.1.17_dev_2013.06.12" +___JmolVersion="13.1.17_dev_2013.06.13" +bug fix: draw ARROW ATOM/BOND broken +bug fix: draw ARROW with offset disallows set picking draw adjustments bug fix: concurrrent loading of two cif files by two different applets fails bug fix: draw LINEDATA not operative (undocumented, for state; from draw xxx INTERSECT yyy) -- needs revision to create DATA option; can be huge and very long to process state file Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-06-13 22:44:57 UTC (rev 18326) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-06-13 22:54:03 UTC (rev 18327) @@ -9732,6 +9732,7 @@ } public void cachePut(String key, Object data) { + // PyMOL reader and isosurface only fileManager.cachePut(key, data); } @@ -9766,10 +9767,12 @@ */ @Override public void cacheFile(String fileName, byte[] bytes) { + // PyMOL reader only fileManager.cachePut(fileName, bytes); } public int cacheFileByName(String fileName, boolean isAdd) { + // cache command in script return fileManager.cacheFileByNameAdd(fileName, isAdd); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |