From: <ha...@us...> - 2009-11-10 12:11:06
|
Revision: 11704 http://jmol.svn.sourceforge.net/jmol/?rev=11704&view=rev Author: hansonr Date: 2009-11-10 12:10:59 +0000 (Tue, 10 Nov 2009) Log Message: ----------- 11.8.9 # bug fix: moveto QUATERNION not distinguishing between orientation quaternions # and molecular quaternions -- MOLECULAR keyword added Modified Paths: -------------- branches/v11_8/Jmol/src/org/jmol/viewer/Jmol.properties branches/v11_8/Jmol/src/org/jmol/viewer/ScriptEvaluator.java Modified: branches/v11_8/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v11_8/Jmol/src/org/jmol/viewer/Jmol.properties 2009-11-08 04:13:51 UTC (rev 11703) +++ branches/v11_8/Jmol/src/org/jmol/viewer/Jmol.properties 2009-11-10 12:10:59 UTC (rev 11704) @@ -4,6 +4,9 @@ version=11.8.9_dev +# bug fix: moveto QUATERNION (undocumented for 11.8) not distinguishing between +# orientation quaternions and molecular quaternions +# -- MOLECULAR keyword added # bug fix: setting perspective model stops animation in state script # bug fix: GAMESS reader not reading all vibrational frequencies Modified: branches/v11_8/Jmol/src/org/jmol/viewer/ScriptEvaluator.java =================================================================== --- branches/v11_8/Jmol/src/org/jmol/viewer/ScriptEvaluator.java 2009-11-08 04:13:51 UTC (rev 11703) +++ branches/v11_8/Jmol/src/org/jmol/viewer/ScriptEvaluator.java 2009-11-10 12:10:59 UTC (rev 11704) @@ -4850,14 +4850,20 @@ BitSet bsCenter = null; switch (getToken(i).tok) { case Token.quaternion: - i++; Quaternion q; - if(tokAt(i) == Token.bitset || tokAt(i) == Token.expressionBegin) { + boolean isMolecular = false; + if (optParameterAsString(++i).equalsIgnoreCase("molecular")) { + isMolecular = true; + i++; + } + if (tokAt(i) == Token.bitset || tokAt(i) == Token.expressionBegin) { + isMolecular = true; center = centerParameter(i); if (!(expressionResult instanceof BitSet)) error(ERROR_invalidArgument); bsCenter = (BitSet) expressionResult; - q = (isSyntaxCheck ? new Quaternion() : getAtomQuaternion(viewer, bsCenter)); + q = (isSyntaxCheck ? new Quaternion() + : getAtomQuaternion(viewer, bsCenter)); } else { q = new Quaternion(getPoint4f(i)); } @@ -4867,15 +4873,23 @@ AxisAngle4f aa = q.toAxisAngle4f(); axis.set(aa.x, aa.y, aa.z); /* - * The quaternion angle represents the angle by which the reference - * frame must be rotated to match the frame defined for the residue. + * The quaternion angle for an atom represents the angle by which + * the reference frame must be rotated to match the frame defined + * for the residue. + * * However, to "moveTo" this frame as the REFERENCE frame, what * we have to do is take that quaternion frame and rotate it * BACKWARD by that many degrees. Then it will match the reference * frame, which is ultimately our window frame. * + * fix -- MOLECULAR keyword added in Jmol 11.8.9 + * + * We only apply this for molecular-type quaternions, because + * in general the orientation quaternion refers to how the + * reference plane has been changed (the orientation matrix) + * */ - degrees = -(float)(aa.angle * 180 / Math.PI); + degrees = (isMolecular ? -1 : 1) * (float)(aa.angle * 180.0 / Math.PI); break; case Token.point3f: case Token.leftbrace: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |