Revision: 18384
          http://sourceforge.net/p/jmol/code/18384
Author:   hansonr
Date:     2013-07-01 08:40:38 +0000 (Mon, 01 Jul 2013)
Log Message:
-----------
{xx}.tensor()

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/modelset/ModelCollection.java
    trunk/Jmol/src/org/jmol/render/TextRenderer.java
    trunk/Jmol/src/org/jmol/util/Tensor.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java       2013-07-01 
08:08:21 UTC (rev 18383)
+++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java       2013-07-01 
08:40:38 UTC (rev 18384)
@@ -3419,6 +3419,14 @@
     return ilist;
   }
 
+  /**
+   * Returns a list of tensors that are of the specified type and 
+   * have both atomIndex1 and atomIndex2 in bs.
+   * 
+   * @param type
+   * @param bs
+   * @return list of Tensors
+   */
   @SuppressWarnings("unchecked")
   public JmolList<Tensor> getInteractionTensorList(String type, BS bs) {
     type = type.toLowerCase();
@@ -3431,7 +3439,7 @@
       int n = tensors.size();
       for (int j = 0; j < n; j++) {
         Tensor t = tensors.get(j);
-        if (t.type.equals(type))
+        if (t.type.equals(type) && bs.get(t.atomIndex1) && 
bs.get(t.atomIndex2))
           list.addLast(t);
       }      
     }

Modified: trunk/Jmol/src/org/jmol/render/TextRenderer.java
===================================================================
--- trunk/Jmol/src/org/jmol/render/TextRenderer.java    2013-07-01 08:08:21 UTC 
(rev 18383)
+++ trunk/Jmol/src/org/jmol/render/TextRenderer.java    2013-07-01 08:40:38 UTC 
(rev 18384)
@@ -76,19 +76,23 @@
   static void drawPointer(Text text, JmolRendererInterface g3d) {
     // now draw the pointer, if requested
 
-    if ((text.pointer & Object2d.POINTER_ON) != 0) {
-      if (!g3d.setColix((text.pointer & Object2d.POINTER_BACKGROUND) != 0 && 
text.bgcolix != 0 ? text.bgcolix
-              : text.colix))
-        return;
-      if (text.boxX > text.atomX)
-        g3d.drawLineXYZ(text.atomX, text.atomY, text.atomZ, 
-            (int) text.boxX, (int) (text.boxY + text.boxHeight / 2),
-            text.zSlab);
-      else if (text.boxX + text.boxWidth < text.atomX)
-        g3d.drawLineXYZ(text.atomX, text.atomY, text.atomZ, 
-            (int) (text.boxX + text.boxWidth), 
-            (int) (text.boxY + text.boxHeight / 2), text.zSlab);
-    }
+    if ((text.pointer & Object2d.POINTER_ON) == 0
+        || !g3d.setColix((text.pointer & Object2d.POINTER_BACKGROUND) != 0
+            && text.bgcolix != 0 ? text.bgcolix : text.colix))
+      return;
+    float w = text.boxWidth;
+    float h = text.boxHeight;
+    float pt = Float.NaN;
+    float x = text.boxX
+        + (text.boxX > text.atomX + w ? 0 : text.boxX + w < text.atomX -w ? w
+            : (pt = w / 2));
+    boolean setY = !Float.isNaN(pt);
+    float y = text.boxY
+        + (setY && text.boxY > text.atomY ? 0 : setY
+            && text.boxY + h < text.atomY ? h
+            : h / 2);
+    g3d.drawLineXYZ(text.atomX, text.atomY, text.atomZ, (int) x, (int) y,
+        text.zSlab);
   }
 
   static void renderSimpleLabel(JmolRendererInterface g3d, JmolFont font,

Modified: trunk/Jmol/src/org/jmol/util/Tensor.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/Tensor.java    2013-07-01 08:08:21 UTC (rev 
18383)
+++ trunk/Jmol/src/org/jmol/util/Tensor.java    2013-07-01 08:40:38 UTC (rev 
18384)
@@ -110,7 +110,8 @@
 
   /**
    * returns an object of the specified type, including 
-   * "eigenvalues", "eigenvectors", "asymmetric", "symmetric", "type", and 
"indices"
+   * "eigenvalues", "eigenvectors", "asymmetric", 
+   * "symmetric", "trace", "indices", and "type"
    * 
    * @param infoType
    * @return Object or null
@@ -123,8 +124,10 @@
            + ";eigenvectors."
            + ";asymmetric..."
            + ";symmetric...."
+           + ";trace........"
+           + ";indices......"
            + ";type........."
-           + ";indices......").indexOf(infoType)) {
+           ).indexOf(infoType)) {
     case 14:
       return eigenValues;
     case 28:
@@ -149,15 +152,16 @@
           b[i][j] = (float) symTensor[i][j];
       return b;
     case 70:
-      return type;
+      return Float.valueOf(eigenValues[0] + eigenValues[1] + eigenValues[2]);
     case 84:
       return new int[] {modelIndex, atomIndex1, atomIndex2};
+    case 98:
+      return type;
     default:
-      return null;
+      return null; 
     }
   }
 
-
   public static Tensor copyTensor(Tensor t0) {
     Tensor t = new Tensor();
     t.setType(t0.type);

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-07-01 08:08:21 UTC 
(rev 18383)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-07-01 08:40:38 UTC 
(rev 18384)
@@ -13,14 +13,12 @@
 
 new feature: {xxx}.tensor(type,what)
   -- type = "temp", "ms", "efg", etc.
-  -- what = "eigenvalues", "eigenvectors", "asymmetric", "symmetric", "type", 
and "indices"
-  -- returns a list of data
+  -- what = "eigenvalues", "eigenvectors", "asymmetric", "symmetric", "trace", 
"indices", and "type"
+  -- returns a list of data. 
   
 new feature: SET ECHO POINT {atom or point} 
-  -- allows 2D and 3D echos to have 
-  -- needs a bit of adjustment, as it only works when x is not within range of 
echo itself (same with labels)
+  -- allows 2D and 3D echos to have pointers to atoms or points 
   
-
 JmolVersion="13.1.18"
 JmolVersion="13.1.17_dev_2013.06.27"
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to