From: <ha...@us...> - 2008-05-21 12:37:38
|
Revision: 9399 http://jmol.svn.sourceforge.net/jmol/?rev=9399&view=rev Author: hansonr Date: 2008-05-21 05:37:33 -0700 (Wed, 21 May 2008) Log Message: ----------- version=11.5.38 adds RANDOM; upgrades quaternion # bug fix: select n-m:c chain selection inappropriately case sensitive # bug fix: draw ARROW {atom center} {xyz} draws arrow the wrong way # bug fix: draw CIRCLE for multiple models # bug fix: application -- "make crystal..." menu item does nothing -- removed # bug fix: zap of quaternion also zaps model inappropriately # bug fix: zap to one model assigns -1 to currentModelIndex instead of 0 # new feature: draw CIRCLE [FILL | MESH NOFILL] more intuitive open/filling syntax # new feature: draw VECTOR {atom center} {dx dy dz} # new feature: draw with mixed types processes them in order # (11.4 does {x,y,z}, then $xxx, then {atomExpression}, then @{{atoms}.split()}) # new feature: draw .... ">xxx" first character of title ">" forces title to # last point, not first # new feature: set quaternionFrame "c" "p" "q" # new feature: write QUATERNION S -- creates vector script # new feature: random(a), random(a,b) where a is lower bound and b is upper bound Modified Paths: -------------- trunk/Jmol/src/org/jmol/modelset/Chain.java trunk/Jmol/src/org/jmol/modelset/ModelCollection.java trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Token.java Modified: trunk/Jmol/src/org/jmol/modelset/Chain.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Chain.java 2008-05-20 22:55:41 UTC (rev 9398) +++ trunk/Jmol/src/org/jmol/modelset/Chain.java 2008-05-21 12:37:33 UTC (rev 9399) @@ -47,6 +47,10 @@ this.chainID = chainID; } + public void setModelSet(ModelSet modelSet) { + this.modelSet = modelSet; + } + public char getChainID() { return chainID; } Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2008-05-20 22:55:41 UTC (rev 9398) +++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2008-05-21 12:37:33 UTC (rev 9399) @@ -66,8 +66,11 @@ */ void merge(ModelSet modelSet) { for (int i = 0; i < modelSet.modelCount; i++) { - models[i] = modelSet.models[i]; - models[i].bsAtoms = null; + Model m = models[i] = modelSet.models[i]; + m.bsAtoms = null; + m.modelSet = (ModelSet) this; + for (int j = 0; j < m.chainCount; j++) + m.chains[j].setModelSet(m.modelSet); stateScripts = modelSet.stateScripts; thisStateModel = -1; } @@ -895,7 +898,8 @@ model.bioPolymers[p].getPdbData(ctype, isDerivative, bsAtoms, pdbATOM, pdbCONECT); pdbATOM.append(pdbCONECT); - return getProteinStructureState(bsAtoms, ctype == 'r') + pdbATOM.toString(); + return (ctype == 's' ? "" : getProteinStructureState(bsAtoms, ctype == 'r')) + + pdbATOM.toString(); } public String getPdbAtomData(BitSet bs) { @@ -955,6 +959,10 @@ break; case 'r': remark += "(phi,psi,omega,partialCharge)"; + break; + case 's': + remark = "# draw sequence for quaternions"; + break; } remark += "\n"; return remark + s; @@ -982,7 +990,7 @@ models[modelDataIndex].jmolFrameType = type; model.dataFrames.put(type, new Integer(modelDataIndex)); } - if (type.indexOf(" ") > 0) { //generic quaternion + if (type.indexOf(" ") > 0 && type.indexOf("deriv") < 0) { //generic quaternion type = type.substring(0, type.indexOf(" ")); model.dataFrames.put(type, new Integer(modelDataIndex)); } Modified: trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java 2008-05-20 22:55:41 UTC (rev 9398) +++ trunk/Jmol/src/org/jmol/modelsetbio/BioPolymer.java 2008-05-21 12:37:33 UTC (rev 9399) @@ -605,33 +605,43 @@ qprev = q; continue; } + //not sure of this if (q.dot(qprev) < 0) - q = q.mul(-1); + qprev = qprev.mul(-1); Quaternion qthis = q; q = qprev.inv().mul(q); //System.out.println("" + qprev+q+ qprev.mul(q) + qthis); qprev = qthis; + } else if (qlast == null && q.q0 < 0) { + //initialize with a positive q0 + q = q.mul(-1); } + if (qlast != null && q.dot(qlast) < 0) q = q.mul(-1); qlast = q; switch (ctype) { + case 's': case 'w': x = q.q1; y = q.q2; z = q.q3; w = q.q0; - if (Logger.debugging) { + if (Logger.debugging || ctype == 's') { String id = "draw q" + a.getAtomIndex(); String strV = " VECTOR " + Escape.escape((Point3f)a) + " "; int deg = (int) (Math.acos(w) * 360 / Math.PI); if (deg > 180) deg -= 360; - Logger.info(id + "x" + strV + Escape.escape(q.getVector(0)) + " color red" + Logger.info(strV = id + "x" + strV + Escape.escape(q.getVector(0)) + " color red" + "\n" + id + "y" + strV + Escape.escape(q.getVector(1)) + " color green" + "\n" + id + "z" + strV + Escape.escape(q.getVector(2)) + " color blue" - + "\n" + id + "q" + strV + " {" + (x*5) + "," + (y*5) + "," + (z*5) - + "} \">" + deg + "\" color yellow"); + + "\n" + id + "q1" + strV + " {" + (x*2) + "," + (y*2) + "," + (z*2) + "} \">" + deg + "\" color yellow" + + "\n" + id + "q2" + strV + " {" + (-x*2) + "," + (-y*2) + "," + (-z*2) + "} \">" + (-deg) + "\" color yellow"); + if (ctype == 's') { + pdbATOM.append(strV + "\n"); + continue; + } } break; case 'x': Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-05-20 22:55:41 UTC (rev 9398) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-05-21 12:37:33 UTC (rev 9399) @@ -4370,13 +4370,14 @@ private void dataFrame(int datatype) throws ScriptException { String type = ""; boolean isQuaternion = false; + boolean isDerivative = false; switch (datatype) { case JmolConstants.JMOL_DATA_RAMACHANDRAN: type = "ramachandran"; break; case JmolConstants.JMOL_DATA_QUATERNION: type = (statementLength == 1 ? "w" : optParameterAsString(1)); - boolean isDerivative = (optParameterAsString(statementLength - 1) + isDerivative = (optParameterAsString(statementLength - 1) .indexOf("deriv") == 0); if (isDerivative && statementLength == 2) type = "w"; @@ -4417,25 +4418,28 @@ return; int modelCount = viewer.getModelCount(); viewer.setJmolDataFrame(type, modelIndex, modelCount - 1); + String script; switch (datatype) { case JmolConstants.JMOL_DATA_RAMACHANDRAN: default: viewer.setFrameTitle(modelCount - 1, "ramachandran plot for model " + viewer.getModelNumberDotted(modelIndex)); - runScript("frame 0.0; frame last; reset;" + script = "frame 0.0; frame last; reset;" + "select visible; color structure; spacefill 3.0; wireframe 0; set rotationRadius 260;" + "draw ramaAxisX" + modelCount + " {200 0 0} {-200 0 0} \"phi\";" - + "draw ramaAxisY" + modelCount + " {0 200 0} {0 -200 0} \"psi\";"); + + "draw ramaAxisY" + modelCount + " {0 200 0} {0 -200 0} \"psi\";"; break; case JmolConstants.JMOL_DATA_QUATERNION: viewer.setFrameTitle(modelCount - 1, type + " for model " + viewer.getModelNumberDotted(modelIndex)); - runScript("frame 0.0; frame last; reset; set rotationRadius 12;" - + "select visible; trace 0.1; wireframe 0; color trace structure;" + script = "frame 0.0; frame last; reset; set rotationRadius 12;" + + "select visible; wireframe 0; " + "isosurface quatSphere" + modelCount - + " resolution 1.0 sphere 10.0 mesh nofill translucent 0.8;set rotationRadius 12"); + + " resolution 1.0 sphere 10.0 mesh nofill translucent 0.8;set rotationRadius 12;" + + (isDerivative ? "color structure" : "trace 0.1; color trace structure;"); break; } + runScript(script); viewer.loadShape(JmolConstants.SHAPE_ECHO); showString("frame " + viewer.getModelNumberDotted(modelCount - 1) + " created: " + type); @@ -8410,7 +8414,7 @@ case Token.quaternion: pt++; type2 = optParameterAsString(pt).toLowerCase(); - if (Parser.isOneOf(type2, "w;x;y;z")) + if (Parser.isOneOf(type2, "w;x;y;z;s")) // s is draw script pt++; else type2 = "w"; @@ -11516,6 +11520,8 @@ return evaluateReplace(args); case Token.array: return evaluateArray(args); + case Token.random: + return evaluateRandom(args); case Token.split: case Token.join: case Token.trim: @@ -11937,6 +11943,17 @@ return addX(array); } + private boolean evaluateRandom(Token[] args) throws ScriptException { + if (args.length > 2) + return false; + if (isSyntaxCheck) + return addX(1); + float lower = (args.length < 2 ? 0 : Token.fValue(args[0])); + float range = (args.length == 0 ? 1 : Token.fValue(args[args.length - 1])); + range -= lower; + return addX((float)(Math.random() * range) + lower); + } + private boolean evaluateLoad(Token[] args) throws ScriptException { if (args.length != 1) return false; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-05-20 22:55:41 UTC (rev 9398) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-05-21 12:37:33 UTC (rev 9399) @@ -16,7 +16,8 @@ # new feature: draw .... ">xxx" first character of title ">" forces title to # last point, not first # new feature: set quaternionFrame "c" "p" "q" - +# new feature: write QUATERNION S -- creates vector script +# new feature: random(a), random(a,b) where a is lower bound and b is upper bound # ----------------------------------------------------------------------------- #version=11.5.37 Modified: trunk/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Token.java 2008-05-20 22:55:41 UTC (rev 9398) +++ trunk/Jmol/src/org/jmol/viewer/Token.java 2008-05-21 12:37:33 UTC (rev 9399) @@ -456,8 +456,10 @@ // we really could put any of these in the 2 << 3 set, because this only specifies // a maximum number of parameters, and the actual number is check in the evaluateXXX call. + // xxx(a,b) + final static int random = 1 | 2 << 3 | mathfunc; final static int data = 2 | 2 << 3 | mathfunc | command; // ___.xxx(a,b) @@ -1049,7 +1051,7 @@ "quaternions", null, "quit", new Token(quit, 0), "ramachandran", new Token(ramachandran, 0), - "rama", null, + "rama", null, "refresh", new Token(refresh, 0), "reset", new Token(reset, maxArg1), "restore", new Token(restore, maxArg3), @@ -1304,6 +1306,7 @@ "psi", new Token(psi), "purine", new Token(purine), "pyrimidine", new Token(pyrimidine), + "random", new Token(random), "range", new Token(range), "rasmol", new Token(rasmol), "replace", new Token(replace), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |