Revision: 5254
Author: hansonr
Date: 2006-06-29 20:14:13 -0700 (Thu, 29 Jun 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5254&view=rev
Log Message:
-----------
bob200603 isosurface lcaoCartoon
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java
branches/bob200603/Jmol/src/org/jmol/viewer/Bond.java
branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java 2006-06-29
17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java 2006-06-30
03:14:13 UTC (rev 5254)
@@ -34,14 +34,14 @@
import javax.vecmath.Vector3f;
import javax.vecmath.Point3i;
-final class Atom implements Tuple {
+final public class Atom implements Tuple {
final static byte VIBRATION_VECTOR_FLAG = 0x02;
final static byte IS_HETERO_FLAG = 0x04;
Group group;
int atomIndex;
- Point3f point3f;
+ public Point3f point3f;
int screenX;
int screenY;
int screenZ;
@@ -169,24 +169,17 @@
boolean isBonded(Atom atomOther) {
if (bonds != null)
- for (int i = bonds.length; --i >= 0; ) {
- Bond bond = bonds[i];
- if ((bond.atom1 == atomOther) ||
- (bond.atom2 == atomOther))
+ for (int i = bonds.length; --i >= 0;)
+ if (bonds[i].getOtherAtom(this) == atomOther)
return true;
- }
return false;
}
Bond getBond(Atom atomOther) {
- if (bonds != null) {
- for (int i = bonds.length; --i >= 0; ) {
- Bond bond = bonds[i];
- if ((bond.atom1 == atomOther) ||
- (bond.atom2 == atomOther))
- return bond;
- }
- }
+ if (bonds != null)
+ for (int i = bonds.length; --i >= 0;)
+ if (bonds[i].getOtherAtom(atomOther) != null)
+ return bonds[i];
return null;
}
@@ -221,15 +214,11 @@
void deleteBondedAtom(Atom atomToDelete) {
if (bonds == null)
return;
- for (int i = bonds.length; --i >= 0; ) {
- Bond bond = bonds[i];
- Atom atomBonded =
- (bond.atom1 != this) ? bond.atom1 : bond.atom2;
- if (atomBonded == atomToDelete) {
+ for (int i = bonds.length; --i >= 0;)
+ if (bonds[i].getOtherAtom(this) == atomToDelete) {
deleteBond(i);
return;
}
- }
}
void deleteAllBonds() {
@@ -273,15 +262,13 @@
}
int getBondedAtomIndex(int bondIndex) {
- Bond bond = bonds[bondIndex];
- return (((bond.atom1 == this)
- ? bond.atom2
- : bond.atom1).atomIndex & 0xFFFF);
+ return bonds[bondIndex].getOtherAtom(this).atomIndex & 0xFFFF;
+ //BH: why & 0xFFFF ?
}
/*
* What is a MAR?
- * - just a term that I made up
+ * - just a term that Miguel made up
* - an abbreviation for Milli Angstrom Radius
* that is:
* - a *radius* of either a bond or an atom
@@ -595,8 +582,7 @@
Bond bondLongest = null;
for (int i = bonds.length; --i >= 0; ) {
Bond bond = bonds[i];
- Atom atomOther = bond.atom1 != this ? bond.atom1 : bond.atom2;
- float dist2 = point3f.distanceSquared(atomOther.point3f);
+ float dist2 = point3f.distanceSquared(bond.getOtherAtom(this).point3f);
if (dist2 > dist2Longest) {
bondLongest = bond;
dist2Longest = dist2;
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Bond.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Bond.java 2006-06-29
17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Bond.java 2006-06-30
03:14:13 UTC (rev 5254)
@@ -168,6 +168,10 @@
return atom1.group.chain.frame.viewer.getColixArgb(getColix2());
}
+ Atom getOtherAtom(Atom thisAtom) {
+ return (atom1 == thisAtom ? atom2 : atom2 == thisAtom ? atom1 : null);
+ }
+
////////////////////////////////////////////////////////////////
Hashtable getPublicProperties() {
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-06-29
17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-06-30
03:14:13 UTC (rev 5254)
@@ -726,7 +726,7 @@
}
void expressionExpected() throws ScriptException {
- evalError("(atom expression) expected");
+ evalError("valid (atom expression) expected");
}
void rotationPointsIdentical() throws ScriptException {
@@ -924,6 +924,15 @@
return floatValue;
}
+ String stringParameter(int index) throws ScriptException {
+ if (index >= statementLength)
+ badArgumentCount();
+ if (statement[index].tok == Token.string)
+ return (String) statement[index].value;
+ stringExpected();
+ return null; //impossible return
+ }
+
String objectNameParameter(int index) throws ScriptException {
if (index >= statementLength || statement[index].tok != Token.identifier)
objectNameExpected();
@@ -3109,9 +3118,7 @@
}
if (str.equalsIgnoreCase("defaultLoadScript")) {
checkLength3();
- if (statement[2].tok != Token.string)
- stringExpected();
- viewer.setDefaultLoadScript((String) statement[2].value);
+ viewer.setDefaultLoadScript(stringParameter(2));
break;
}
if (str.equalsIgnoreCase("dipoleScale")) {
@@ -4101,7 +4108,6 @@
int colorRangeStage = 0;
boolean colorByPhase = false;
String str;
-
for (int i = 1; i < statementLength; ++i) {
String propertyName = null;
Object propertyValue = null;
@@ -4117,7 +4123,7 @@
drawObjectNotDefined(id);
break;
case Token.expressionBegin:
- propertyValue = viewer.getAtomSetCenter(expression(statement, i +
1));
+ propertyValue = viewer.getAtomSetCenter(expression(statement, ++i));
i = pcLastExpressionInstruction;
break;
case Token.leftbrace:
@@ -4153,6 +4159,27 @@
break;
case Token.identifier:
str = (String) token.value;
+ if (str.equalsIgnoreCase("lcaoCartoon")) {
+ String lcaoType = stringParameter(++i);
+ viewer.setShapeProperty(JmolConstants.SHAPE_ISOSURFACE,
+ "lcaoCartoon", lcaoType);
+ switch (statement[++i].tok) {
+ case Token.expressionBegin:
+ propertyName = "lcaoAxes";
+ int atomIndex = viewer.firstAtomOf(expression(statement, ++i));
+ if (atomIndex < 0)
+ expressionExpected();
+ Vector3f[] axes = { new Vector3f(), new Vector3f(),
+ new Vector3f(viewer.getAtomPoint3f(atomIndex)) };
+ viewer.getPrincipalAxes(atomIndex, axes[0], axes[1], lcaoType);
+ i = pcLastExpressionInstruction;
+ propertyValue = axes;
+ break;
+ default:
+ expressionExpected();
+ }
+ break;
+ }
if (str.equalsIgnoreCase("sphere")) {
//sphere [radius]
propertyName = "sphere";
@@ -4177,7 +4204,7 @@
nlmZR[1] = intParameter(++i);
nlmZR[2] = intParameter(++i);
nlmZR[3] = (statement.length > i + 1
- && statement[i + 1].tok == Token.integer ? floatParameter(++i)
+ && statement[i + 1].tok == Token.integer || statement[i + 1].tok
== Token.decimal ? floatParameter(++i)
: 6f);
nlmZR[4] = (statement.length > i + 1
&& statement[i + 1].tok == Token.integer ? floatParameter(++i)
@@ -4357,6 +4384,7 @@
case Token.color:
colorSeen = true;
colorRangeStage = 1;
+ signPt = i + 1;
continue;
case Token.absolute:
colorRangeStage = 1;
@@ -4516,172 +4544,6 @@
"applyConnectParameters", null);
}
- void connect10_0_99() throws ScriptException {
- boolean haveType = false;
- int nAtomSets = 0;
- int nDistances = 0;
- /*
- * connect [<=2 distance parameters] [<=2 atom sets]
- * [<=1 bond type] [<=1 operation]
- *
- */
-
- viewer.setShapeProperty(JmolConstants.SHAPE_STICKS,
- "resetConnectParameters", null);
- if (statementLength == 1) {
- viewer.setShapeProperty(JmolConstants.SHAPE_STICKS,
- "rasmolCompatibleConnect", null);
- return;
- }
- for (int i = 1; i < statementLength; ++i) {
- String propertyName = null;
- Object propertyValue = null;
- switch_tag: switch (statement[i].tok) {
- case Token.on:
- case Token.off:
- if (statementLength != 2)
- badArgumentCount();
- viewer.setShapeProperty(JmolConstants.SHAPE_STICKS,
- "rasmolCompatibleConnect", null);
- return;
- case Token.integer:
- case Token.decimal:
- if (++nDistances > 2)
- badArgumentCount();
- if (nAtomSets > 0 || haveType)
- invalidParameterOrder();
- propertyName = "connectDistance";
- propertyValue = new Float(floatParameter(i));
- break;
- case Token.expressionBegin:
- if (++nAtomSets > 2)
- badArgumentCount();
- if (haveType)
- invalidParameterOrder();
- propertyName = "connectSet";
- propertyValue = expression(statement, i);
- // i = pcLastExpressionInstruction; // the for loop will
increment i
- i = pcLastExpressionInstruction;
-
- break;
- case Token.identifier:
- case Token.hbond:
- String cmd = (String) statement[i].value;
- for (int j = JmolConstants.bondOrderNames.length; --j >= 0;) {
- if (cmd.equalsIgnoreCase(JmolConstants.bondOrderNames[j])) {
- if (haveType)
- incompatibleArguments();
- cmd = JmolConstants.bondOrderNames[j];
- propertyName = "connectBondOrder";
- propertyValue = cmd;
- haveType = true;
- break switch_tag;
- }
- }
- if (++i != statementLength)
- invalidParameterOrder();
- if ("modify".equalsIgnoreCase(cmd))
- propertyValue = "modify";
- else if ("create".equalsIgnoreCase(cmd))
- propertyValue = "create";
- else if ("modifyOrCreate".equalsIgnoreCase(cmd))
- propertyValue = "modifyOrCreate";
- else if ("auto".equalsIgnoreCase(cmd))
- propertyValue = "auto";
- else
- unrecognizedSubcommand();
- propertyName = "connectOperation";
- break;
- case Token.none:
- case Token.delete:
- if (++i != statementLength)
- invalidParameterOrder();
- propertyName = "connectOperation";
- propertyValue = "delete";
- break;
- default:
- invalidArgument();
- }
- viewer.setShapeProperty(JmolConstants.SHAPE_STICKS, propertyName,
- propertyValue);
- }
- viewer.setShapeProperty(JmolConstants.SHAPE_STICKS,
- "applyConnectParameters", null);
- }
-
- void connectOLD() throws ScriptException {
- viewer.setShapeProperty(JmolConstants.SHAPE_STICKS, "initConnect", null);
- if (statementLength == 1) {
- viewer.rebond();
- return;
- }
- String propertyName = null;
- Object propertyValue = null;
- int nNumeric = 0;
- for (int i = 1; i < statementLength; ++i) {
- propertyName = null;
- propertyValue = null;
- Token token = statement[i];
- switch (token.tok) {
- case Token.on:
- case Token.off:
- viewer.rebond();
- return;
- case Token.integer:
- if (++nNumeric > 2) {
- propertyName = "connectMad";
- propertyValue = new Short(getMadInteger(token.intValue));
- } else {
- propertyName = "connectDistance";
- propertyValue = new Float(token.intValue);
- }
- break;
- case Token.decimal:
- if (++nNumeric > 2) {
- propertyName = "connectMad";
- propertyValue = new Short(getMadFloat(floatParameter(i)));
- } else {
- propertyName = "connectDistance";
- propertyValue = token.value;
- }
- break;
- case Token.expressionBegin:
- //System.out.println(i + " " + propertyName + " " + statementLength);
- propertyValue = expression(statement, i);
- i = pcLastExpressionInstruction;
- propertyName = (i == statementLength - 1 ? "targetSet" : "sourceSet");
- break;
- case Token.identifier:
- case Token.hbond:
- String cmd = ((String) token.value).toLowerCase();
- if (cmd.equals("single") || cmd.equals("double")
- || cmd.equals("triple") || cmd.equals("aromatic")
- || cmd.equals("hbond")) {
- propertyName = "connectBondOrder";
- propertyValue = cmd;
- nNumeric = 2;
- } else if (cmd.equals("exists")) {
- propertyName = "connectNew";
- propertyValue = Boolean.FALSE;
- } else if (cmd.equals("new")) {
- propertyName = "connectExistant";
- propertyValue = Boolean.FALSE;
- } else {
- unrecognizedSubcommand();
- }
- break;
- case Token.delete:
- propertyName = "connectBondOrder";
- propertyValue = new Short((short) 0);
- break;
- default:
- invalidArgument();
- }
- viewer.setShapeProperty(JmolConstants.SHAPE_STICKS, propertyName,
- propertyValue);
- }
- }
-
void getProperty() {
String retValue = "";
String property = (statementLength < 2 ? "" : (String) statement[1].value);
@@ -4689,4 +4551,5 @@
retValue = (String) viewer.getProperty("readable", property, param);
viewer.scriptEcho(retValue);
}
+
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java 2006-06-29
17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java 2006-06-30
03:14:13 UTC (rev 5254)
@@ -33,6 +33,7 @@
import javax.vecmath.Point3f;
import javax.vecmath.Matrix3f;
import javax.vecmath.Vector3f;
+import javax.vecmath.AxisAngle4f;
import java.util.BitSet;
import java.util.Hashtable;
import java.util.Properties;
@@ -2743,4 +2744,140 @@
atoms[atomIndex].point3f.y += y;
atoms[atomIndex].point3f.z += z;
}
+
+ void getPrincipalAxes(int atomIndex, Vector3f z, Vector3f x, String
lcaoType) {
+ Atom atom = atoms[atomIndex];
+ z.set(0, 0, 0);
+ x.set(0, 0, 0);
+ Atom atom1 = atom;
+ int nBonds = 0;
+ float cutoff = (float) Math.PI / 180f * 0.95f;
+ Vector3f n = new Vector3f();
+ Vector3f x2 = new Vector3f();
+ Vector3f x3 = new Vector3f(3.14159f, 2.71828f, 1.41421f);
+ Vector3f x4 = new Vector3f();
+ Vector3f y1 = new Vector3f();
+ Vector3f y2 = new Vector3f();
+ if (atom.bonds != null)
+ for (int i = atom.bonds.length; --i >= 0;)
+ if (atom.bonds[i].isCovalent()) {
+ ++nBonds;
+ atom1 = atom.bonds[i].getOtherAtom(atom);
+ n.sub(atom.point3f, atom1.point3f);
+ n.normalize();
+ z.add(n);
+ switch (nBonds) {
+ case 1:
+ x.set(n);
+ break;
+ case 2:
+ x2.set(n);
+ break;
+ case 3:
+ x3.set(n);
+ break;
+ case 4:
+ x4.set(n);
+ break;
+ default:
+ i = -1;
+ }
+ }
+ switch (nBonds) {
+ case 0:
+ z.set(0, 0, 1);
+ x.set(1, 0, 0);
+ break;
+ case 1:
+ if (lcaoType.indexOf("sp3") == 0) { // align z as sp3 orbital
+ x.cross(x3, z);
+ y1.cross(z, x);
+ x.normalize();
+ y1.normalize();
+ y2.set(x);
+ z.normalize();
+ x.scaleAdd(2.828f, x, z); // 2*sqrt(2)
+ if (!lcaoType.equals("sp3a") && !lcaoType.equals("sp3")) {
+ x.normalize();
+ AxisAngle4f a = new AxisAngle4f(z.x, z.y, z.z, (lcaoType
+ .equals("sp3b") ? 1 : -1) * 2.09439507f); // PI*2/3
+ Matrix3f m = new Matrix3f();
+ m.setIdentity();
+ m.set(a);
+ m.transform(x);
+ }
+ z.set(x);
+ x.cross(y1, z);
+ break;
+ }
+ if (atom1.getCovalentBondCount() == 3) {
+ //special case, for example R2C=O oxygen
+ getPrincipalAxes(atom1.atomIndex, z, x3, lcaoType);
+ x3.set(x);
+ if (lcaoType.indexOf("sp2") == 0) { // align z as sp2 orbital
+ z.scale(-1);
+ }
+ }
+ x.cross(x3, z);
+ break;
+ case 2:
+ if (z.length() < 0.1) { // linear A--X--B
+ z.set(x);
+ x.cross(x3, z);
+ break;
+ } // bent A--X--B
+ x3.cross(z, x);
+ if (lcaoType.indexOf("sp") == 0) { // align z as sp2 orbital
+ if (!lcaoType.equals("sp2")) {
+ z.set(lcaoType.indexOf("b") >= 0 ? x2 : x);
+ z.scale(-1);
+ }
+ x.cross(z, x3);
+ break;
+ }
+ if (lcaoType.indexOf("lp") == 0) { // align z as lone pair
+ x3.normalize();
+ z.normalize();
+ y1.scaleAdd(1.2f, x3, z);
+ y2.scaleAdd(-1.2f, x3, z);
+ z.set(lcaoType.indexOf("b") >= 0 ? y2 : y1);
+ x.cross(z, x3);
+ break;
+ }
+ // align z as p orbital
+ x.cross(z, x3);
+ z.set(x3);
+ break;
+ default:
+ System.out.println("getPrinc z x x2 x3 " + z + x + x2 + x3);
+ if (x.angle(x2) < cutoff)
+ y1.cross(x, x2);
+ else
+ y1.cross(x, x3);
+ y1.normalize();
+ if (x2.angle(x3) < cutoff)
+ y2.cross(x2, x3);
+ else
+ y2.cross(x, x3);
+ y2.normalize();
+ System.out.println("getPrinc y1 y2 " + x.dot(x2) + y1 + " " + x2.dot(x3)
+ + y2 + y2.dot(y1));
+ if (Math.abs(y2.dot(y1)) < 0.95f) {
+ x.cross(z, x);
+ break;
+ }
+ if (lcaoType.indexOf("sp") == 0) { // align z as sp2 orbital
+ z.set(lcaoType.indexOf("d") >= 0 ? x4 : lcaoType.indexOf("c") >= 0 ? x3
+ : lcaoType.indexOf("b") >= 0 ? x2 : x);
+ z.scale(-1);
+ x.set(y1);
+ break;
+ }
+ // align z as p orbital
+ z.set(y1);
+ }
+ x.normalize();
+ z.normalize();
+ System.out.println("principal axes: " + z + " " + x);
+ }
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-06-29
17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-06-30
03:14:13 UTC (rev 5254)
@@ -115,16 +115,24 @@
final static int nContourMax = 100;
final static int defaultColorNegative = Graphics3D.getArgbFromString("red");
final static int defaultColorPositive = Graphics3D.getArgbFromString("blue");
+ final static int defaultColorNegativeLCAO = Graphics3D
+ .getArgbFromString("purple");
+ final static int defaultColorPositiveLCAO = Graphics3D
+ .getArgbFromString("orange");
final static float defaultSolventRadius = 1.2f;
+ short defaultColix;
boolean colorBySign;
int colorNeg;
int colorPos;
+ int colorPosLCAO;
+ int colorNegLCAO;
int colorPtr;
boolean colorByPhase;
int colorPhase;
boolean insideOut;
boolean writePrecisionColor;
+ boolean dumpJVXL;
boolean isOrbital;
boolean isSphere;
@@ -133,6 +141,8 @@
boolean isFunctionXY;
Vector functionXYinfo;
+ String lcaoCartoon;
+
boolean isAnisotropic;
boolean isEccentric;
float eccentricityScale;
@@ -193,8 +203,8 @@
void setProperty(String propertyName, Object value, BitSet bs) {
- System.out.println("isosurface "+state+" setProperty: " + propertyName + "
= "
- + value);
+ System.out.println("isosurface " + state + " setProperty: " + propertyName
+ + " = " + value);
if ("init" == propertyName) {
fileIndex = 1;
nBytes = 0;
@@ -210,19 +220,22 @@
writePrecisionColor = false;
thisContour = -1;
iDoContourPlane = true;
+ dumpJVXL = true;
dataIsJvxl2dContour = false;
+ colorPtr = 0;
colorBySign = colorByPhase = false;
+ defaultColix = 0;
colorNeg = defaultColorNegative;
colorPos = defaultColorPositive;
+ colorNegLCAO = defaultColorNegativeLCAO;
+ colorPosLCAO = defaultColorPositiveLCAO;
isSphere = isOrbital = isLobe = isSolvent = isFunctionXY = false;
isEccentric = isAnisotropic = false;
scale = Float.NaN;
center = new Point3f(Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE);
//anisotropy[0] = anisotropy[1] = anisotropy[2] = 1f;
cutoff = Float.MAX_VALUE;
- state = STATE_INITIALIZED;
- assocGridPointMap = new Hashtable();
- assocGridPointNormals = new Hashtable();
+ initState();
super.setProperty("thisID", null, null);
return;
}
@@ -255,6 +268,7 @@
if ("eccentricity" == propertyName) {
setEccentricity((Point4f) value);
+ return;
}
/// special effects
@@ -305,10 +319,11 @@
if ("colorRGB" == propertyName) {
int rgb = ((Integer) value).intValue();
if (colorPtr++ > 0) {
- colorPos = rgb;
+ colorPos = colorPosLCAO = rgb;
} else {
- colorNeg = rgb;
+ colorNeg = colorNegLCAO = rgb;
}
+ defaultColix = Graphics3D.getColix(rgb);
return;
}
@@ -336,6 +351,24 @@
boolean isCalculation = false;
+ if ("lcaoCartoon" == propertyName) {
+ lcaoCartoon = (String) value;
+ dumpJVXL = false;
+ if (colorPtr == 1)
+ colorPosLCAO = colorNegLCAO;
+ return;
+ }
+
+ if ("lcaoAxes" == propertyName) {
+ if (++state != STATE_DATA_READ)
+ return;
+ Vector3f[] info = (Vector3f[]) value;
+ // z x center
+ if (center.x == Float.MAX_VALUE)
+ center.set(info[2]);
+ drawLcaoCartoon(lcaoCartoon, info[0], info[1]);
+ }
+
if ("plane" == propertyName) {
thePlane = (Point4f) value;
if (++state != STATE_DATA_READ)
@@ -423,7 +456,7 @@
colorIsosurface();
discardTempData(dataIsJvxl2dContour);
currentMesh.nBytes = nBytes;
- if (thePlane == null)
+ if (dumpJVXL && thePlane == null)
System.out.println("\n" + jvxlGetFile(currentMesh, jvxlFileMessage));
setModelIndex();
return;
@@ -477,6 +510,13 @@
return;
}
+ if ("delete" == propertyName) {
+ if (currentMesh == null)
+ nLCAO = 0;
+ // fall through to meshCollection
+ }
+
+ // processed by meshCollection
super.setProperty(propertyName, value, bs);
}
@@ -488,6 +528,12 @@
return super.getProperty(property, index);
}
+ void initState() {
+ state = STATE_INITIALIZED;
+ assocGridPointMap = new Hashtable();
+ assocGridPointNormals = new Hashtable();
+ }
+
void setEccentricity(Point4f info) {
Vector3f ecc = new Vector3f(info.x, info.y, info.z);
float c = (scale > 0 ? scale : info.w < 0 ? 1f : ecc.length());
@@ -660,6 +706,8 @@
int indexColorNegative;
short getDefaultColix() {
+ if (defaultColix != 0)
+ return defaultColix;
int argb;
if (cutoff >= 0) {
indexColorPositive = (indexColorPositive %
JmolConstants.argbsIsosurfacePositive.length);
@@ -3277,7 +3325,7 @@
float radius = lobe_sizeAngstroms / 2f * eccentricityScale;
setVoxelRange(0, -radius, radius, lobe_ptsPerAngstrom, lobe_gridMax);
setVoxelRange(1, -radius, radius, lobe_ptsPerAngstrom, lobe_gridMax);
- setVoxelRange(2, 0, radius * 4.4f, lobe_ptsPerAngstrom, lobe_gridMax);
+ setVoxelRange(2, 0, radius * 4.5f, lobe_ptsPerAngstrom, lobe_gridMax);
jvxlFileHeader = "lobe \nn="
+ psi_n
+ ", l="
@@ -3533,6 +3581,97 @@
return viewer.functionXY(functionName, x, y);
}
+ //// LCAO Cartoons ////
+
+ int nLCAO = 0;
+
+ void drawLcaoCartoon(String lcaoCartoon, Vector3f z, Vector3f x) {
+ Vector3f y = new Vector3f();
+ boolean isReverse = (lcaoCartoon.length() > 0 && lcaoCartoon.charAt(0) ==
'-');
+ if (isReverse) {
+ lcaoCartoon = lcaoCartoon.substring(1);
+ colorNeg = colorPosLCAO;
+ colorPos = colorNegLCAO;
+ } else {
+ colorPos = colorPosLCAO;
+ colorNeg = colorNegLCAO;
+ }
+ y.cross(z, x);
+ String id = (currentMesh == null ? "lcao" + (++nLCAO) + "_" + lcaoCartoon
+ : currentMesh.thisID);
+ if (currentMesh == null)
+ allocMesh(id);
+ defaultColix = Graphics3D.getColix(colorPos);
+
+ if (lcaoCartoon.equals("px")) {
+ currentMesh.thisID += "a";
+ createLcaoLobe(x, 1);
+ setProperty("thisID", id + "b", null);
+ createLcaoLobe(x, -1);
+ currentMesh.colix = Graphics3D.getColix(colorNeg);
+ return;
+ }
+ if (lcaoCartoon.equals("py")) {
+ currentMesh.thisID += "a";
+ createLcaoLobe(y, 1);
+ setProperty("thisID", id + "b", null);
+ createLcaoLobe(y, -1);
+ currentMesh.colix = Graphics3D.getColix(colorNeg);
+ return;
+ }
+ if (lcaoCartoon.equals("pz")) {
+ currentMesh.thisID += "a";
+ createLcaoLobe(z, 1);
+ setProperty("thisID", id + "b", null);
+ createLcaoLobe(z, -1);
+ currentMesh.colix = Graphics3D.getColix(colorNeg);
+ return;
+ }
+ if (lcaoCartoon.equals("pxa")) {
+ createLcaoLobe(x, 1);
+ return;
+ }
+ if (lcaoCartoon.equals("pxb")) {
+ createLcaoLobe(x, -1);
+ return;
+ }
+ if (lcaoCartoon.equals("pya")) {
+ createLcaoLobe(y, 1);
+ return;
+ }
+ if (lcaoCartoon.equals("pyb")) {
+ createLcaoLobe(y, -1);
+ return;
+ }
+ if (lcaoCartoon.equals("pza") || lcaoCartoon.indexOf("sp") == 0 ||
lcaoCartoon.indexOf("lp") == 0) {
+ createLcaoLobe(z, 1);
+ return;
+ }
+ if (lcaoCartoon.equals("pzb")) {
+ createLcaoLobe(z, -1);
+ return;
+ }
+ // assume s
+ createLcaoLobe(null, 1);
+ return;
+ }
+
+ Point4f lcaoDir = new Point4f();
+
+ void createLcaoLobe(Vector3f lobeAxis, float factor) {
+ initState();
+ System.out.println("creating isosurface " + currentMesh.thisID);
+ if (lobeAxis == null) {
+ setProperty("sphere", new Float(factor / 2f), null);
+ return;
+ }
+ lcaoDir.x = lobeAxis.x * factor;
+ lcaoDir.y = lobeAxis.y * factor;
+ lcaoDir.z = lobeAxis.z * factor;
+ lcaoDir.w = 0.5f;
+ setProperty("lobe", lcaoDir, null);
+ }
+
//// visibility methods
void setModelIndex() {
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
2006-06-29 17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
2006-06-30 03:14:13 UTC (rev 5254)
@@ -39,7 +39,7 @@
// for now, just update this by hand
// perhaps use ant filter later ... but mth doesn't like it :-(
public final static String copyright = "(C) 2006 Jmol Development";
- public final static String version = "10.x.15(branch bob200603)";
+ public final static String version = "10.x.17(branch bob200603)";
public final static String cvsDate = "$Date$";
public final static String date = cvsDate.substring(7, 23);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
2006-06-29 17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/MeshCollection.java
2006-06-30 03:14:13 UTC (rev 5254)
@@ -175,6 +175,7 @@
meshCount = 0;
}
}
+
int getIndexFromName(String thisID) {
for (int i = meshCount; --i >= 0; ) {
if (meshes[i] != null && thisID.equals(meshes[i].thisID))
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
2006-06-29 17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
2006-06-30 03:14:13 UTC (rev 5254)
@@ -1462,4 +1462,9 @@
frame.setAtomCoordRelative(atomIndex,x,y,z);
}
+ void getPrincipalAxes(int atomIndex, Vector3f z, Vector3f x, String
lcaoType) {
+ if (frame == null)
+ return;
+ frame.getPrincipalAxes(atomIndex, z, x, lcaoType);
+ }
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java 2006-06-29
17:21:25 UTC (rev 5253)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java 2006-06-30
03:14:13 UTC (rev 5254)
@@ -1147,6 +1147,10 @@
void clearBfactorRange(){
modelManager.clearBfactorRange();
}
+
+ void getPrincipalAxes(int atomIndex, Vector3f z, Vector3f x, String
lcaoType) {
+ modelManager.getPrincipalAxes(atomIndex, z, x, lcaoType);
+ }
BitSet getModelAtomBitSet(int modelIndex) {
return modelManager.getModelAtomBitSet(modelIndex);
@@ -1197,7 +1201,7 @@
return modelManager.getExportJmolAdapter();
}
- Frame getFrame() {
+ public Frame getFrame() {
return modelManager.getFrame();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits