Revision: 20850
          http://sourceforge.net/p/jmol/code/20850
Author:   hansonr
Date:     2015-10-30 11:52:33 +0000 (Fri, 30 Oct 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.5.0_2015.10.30"

FEATURE CHANGE: (Application only for now) PDB default for =xxxx 
  -- changed to 
    "pdb", 
"http://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/%c2%c3/pdb%file.ent.gz";
  -- will be complemented with file.ent for non-binary transfer, but that is 
not implemented yet at RCSB
  -- mmCIF counterpart not implemented yet.
  -- not HTML5 because for that we need the option to remove .gz

new feature: set testflag3 TRUE  gives random triangle effect to polyhedra

new feature: POLYHEDRON ID "xxx" OFFSET {3 3 3}
 -- allows cartesian offset of named polyhedra
 
bug fix: polyhedron volume will be incorrect if there is a 
         face triangle that has no edges visible (requires a six or more sided 
face)  

bug fix: nested if...{...if... } else {...} gives compiler syntax error:

  if (i=1) {
    print "i=1"
    if (j=1)
      print "j != 1" 
  } else {                // } closes if (j=1) instead of if (i=1) {
    print "i != 1"
  }

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/modelset/BondCollection.java
    trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java
    trunk/Jmol/src/org/jmol/renderspecial/PolyhedraRenderer.java
    trunk/Jmol/src/org/jmol/script/SV.java
    trunk/Jmol/src/org/jmol/script/ScriptCompiler.java
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/scriptext/MathExt.java
    trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java
    trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java
    trunk/Jmol/src/org/jmol/viewer/GlobalSettings.java
    trunk/Jmol/src/org/jmol/viewer/JC.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/Viewer.java

Modified: trunk/Jmol/src/org/jmol/modelset/BondCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/BondCollection.java        2015-10-28 
03:41:32 UTC (rev 20849)
+++ trunk/Jmol/src/org/jmol/modelset/BondCollection.java        2015-10-30 
11:52:33 UTC (rev 20850)
@@ -493,17 +493,17 @@
         }
       }
     // now test non-O atoms
-    for (int i = bsTest.nextSetBit(0); i >= 0; i = bsTest.nextSetBit(i + 1)) {
-      bond = bo[i];
-      if (!assignAromaticDouble(bond))
+    for (int i = bsTest.nextSetBit(0); i >= 0; i = bsTest.nextSetBit(i + 1))
+      if (!assignAromaticDouble(bond = bo[i]))
         assignAromaticSingle(bond);
-    }
     // all done: do the actual assignments and clear arrays.
+    BS bsModels = new BS();
     for (int i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit(i + 1))) {
         bond = bo[i];
         if (bsAromaticDouble.get(i)) {
           if (!bond.is(Edge.BOND_AROMATIC_DOUBLE)) {
             bsAromatic.set(i);
+            bsModels.set(bond.atom1.mi);
             bond.setOrder(Edge.BOND_AROMATIC_DOUBLE);
           }
         } else if (bsAromaticSingle.get(i) || bond.isAromatic()) {
@@ -513,7 +513,11 @@
           }
         }
       }
-
+    Model[] models = ((ModelSet) this).am;
+    for (int i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 
1))
+      if (models[i].isBioModel)
+        models[i].isPdbWithMultipleBonds = true;
+    
     assignAromaticNandO(bsBonds);
 
     bsAromaticSingle = null;

Modified: trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java   2015-10-28 03:41:32 UTC 
(rev 20849)
+++ trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java   2015-10-30 11:52:33 UTC 
(rev 20850)
@@ -121,10 +121,10 @@
     Atom[] at = ms.at;
     Model[] am = ms.am;
     for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
-      if (iLast != i - 1)
-        monomerIndexCurrent = -1;
+      if (at[i].group.isAdded(i))
+        continue;
       monomerIndexCurrent = at[i].group.setProteinStructureType(type,
-          monomerIndexCurrent);
+          iLast == i - 1 ? -1 : monomerIndexCurrent);
       int modelIndex = at[i].mi;
       ms.proteinStructureTainted = am[modelIndex].structureTainted = true;
       iLast = i = at[i].group.lastAtomIndex;
@@ -136,10 +136,14 @@
         i = am[modelIndex].firstAtomIndex + am[modelIndex].act;
         continue;
       }
-      iLast = at[i].group.getStrucNo();
-      if (iLast < 1000 && iLast > lastStrucNo[modelIndex])
-        lastStrucNo[modelIndex] = iLast;
-      i = at[i].group.lastAtomIndex + 1;
+      Group g = at[i].group;
+      if (!g.isAdded(i)) {
+        iLast = g.getStrucNo();
+        if (iLast < 1000 && iLast > lastStrucNo[modelIndex])
+          lastStrucNo[modelIndex] = iLast;
+        i = g.lastAtomIndex;
+      }
+      i++;
     }
     for (int i = 0; i < ms.ac;) {
       int modelIndex = at[i].mi;
@@ -147,9 +151,13 @@
         i = am[modelIndex].firstAtomIndex + am[modelIndex].act;
         continue;
       }
-      if (at[i].group.getStrucNo() > 1000)
-        at[i].group.setStrucNo(++lastStrucNo[modelIndex]);
-      i = at[i].group.lastAtomIndex + 1;
+      Group g = at[i].group;
+      if (!g.isAdded(i)) {
+        i = g.lastAtomIndex;
+        if (g.getStrucNo() > 1000)
+          g.setStrucNo(++lastStrucNo[modelIndex]);
+      }
+      i++;
     }
   }
 

Modified: trunk/Jmol/src/org/jmol/renderspecial/PolyhedraRenderer.java
===================================================================
--- trunk/Jmol/src/org/jmol/renderspecial/PolyhedraRenderer.java        
2015-10-28 03:41:32 UTC (rev 20849)
+++ trunk/Jmol/src/org/jmol/renderspecial/PolyhedraRenderer.java        
2015-10-30 11:52:33 UTC (rev 20850)
@@ -72,8 +72,8 @@
     if (p.id == null) {
       iAtom = p.centralAtom.i;
       colix = (colixes == null || iAtom >= colixes.length ? C.INHERIT_ALL
-        : colixes[iAtom]);
-      colix =  C.getColixInherited(colix, p.centralAtom.colixAtom);
+          : colixes[iAtom]);
+      colix = C.getColixInherited(colix, p.centralAtom.colixAtom);
     } else {
       colix = p.colix;
     }
@@ -121,12 +121,15 @@
       for (int i = planes.length; --i >= 0;) {
         int[] pl = planes[i];
         try {
-          g3d.fillTriangleTwoSided(normixes[i], sc[pl[0]], sc[pl[1]], 
sc[pl[2]]);
+          if (!showNumbers
+              || g3d.setC((short) (Math.round(Math.random() * 10) + 5)))
+            g3d.fillTriangleTwoSided(normixes[i], sc[pl[0]], sc[pl[1]],
+                sc[pl[2]]);
         } catch (Exception e) {
           System.out.println("PolyhedraRendererError");
         }
-//        if (pl[3] >= 0)
-  //        g3d.fillTriangleTwoSided(normixes[i], sc[pl[2]], sc[pl[3]], 
sc[pl[0]]);
+        //        if (pl[3] >= 0)
+        //        g3d.fillTriangleTwoSided(normixes[i], sc[pl[2]], sc[pl[3]], 
sc[pl[0]]);
       }
     // edges are not drawn translucently ever
     if (bsSelected != null && bsSelected.get(iAtom))
@@ -136,13 +139,13 @@
     if (g3d.setC(C.getColixTranslucent3(colix, false, 0)))
       for (int i = planes.length; --i >= 0;) {
         int[] pl = planes[i];
- //       if (pl[3] < 0) {
-         drawEdges(normixes[i], sc[pl[0]], sc[pl[1]], sc[pl[2]], -pl[3]);
-//          break;
-//        } else {
-//          drawFace(normixes[i], sc[pl[0]], sc[pl[1]], sc[pl[2]], 3);
-//          drawFace(normixes[i], sc[pl[0]], sc[pl[2]], sc[pl[3]], 6);
-//        }
+        //       if (pl[3] < 0) {
+        drawEdges(normixes[i], sc[pl[0]], sc[pl[1]], sc[pl[2]], -pl[3]);
+        //          break;
+        //        } else {
+        //          drawFace(normixes[i], sc[pl[0]], sc[pl[1]], sc[pl[2]], 3);
+        //          drawFace(normixes[i], sc[pl[0]], sc[pl[2]], sc[pl[3]], 6);
+        //        }
 
       }
     return needTranslucent;

Modified: trunk/Jmol/src/org/jmol/script/SV.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/SV.java      2015-10-28 03:41:32 UTC (rev 
20849)
+++ trunk/Jmol/src/org/jmol/script/SV.java      2015-10-30 11:52:33 UTC (rev 
20850)
@@ -1224,13 +1224,14 @@
         .indexOf(";" + format.toLowerCase() + ";"));
   }
 
- /**
-   * Accepts arguments from the format() function First argument is a
-   * format string.
+  /**
+   * Accepts arguments from the format() function First argument is a format
+   * string.
    * 
    * @param args
-   * @param pt 0: to JSON, 5: to base64, 12: to bytearray, 22: to array
- * @param array2D 
+   * @param pt
+   *        0: to JSON, 5: to base64, 12: to bytearray, 22: to array
+   * @param array2D
    * @return formatted string
    */
   public static Object format(SV[] args, int pt, boolean array2D) {
@@ -1271,7 +1272,7 @@
           break;
         default:
           String s = args[1].asString();
-          if (s.startsWith(";base64,")){
+          if (s.startsWith(";base64,")) {
             if (pt == 5)
               return s;
             bytes = Base64.decodeBase64(s);
@@ -1279,19 +1280,20 @@
             bytes = s.getBytes();
           }
         }
-        return (pt == 22 ? getVariable(bytes) : pt == 12 ? new BArray(bytes) : 
";base64,"
-            + javajs.util.Base64.getBase64(bytes).toString());
+        return (pt == 22 ? getVariable(bytes) : pt == 12 ? new BArray(bytes)
+            : ";base64," + javajs.util.Base64.getBase64(bytes).toString());
       }
     }
     // use values to replace codes in format string
+    String[] format = PT.split(PT.rep(sValue(args[0]), "%%", "\1"), "%");
+    if (format.length == 0)
+      return "";
     SB sb = new SB();
-    String[] format = PT.split(PT.rep(sValue(args[0]), "%%", "\1"), "%");
     sb.append(format[0]);
     for (int i = 1; i < format.length; i++) {
       Object ret = sprintf(PT.formatCheck("%" + format[i]),
-          (args[1].tok == hash ? args[1] 
-              : args[1].tok == varray ? args[1].getList().get(i - 1)
-                  : i < args.length ? args[i] :  null));
+          (args[1].tok == hash ? args[1] : args[1].tok == varray ? args[1]
+              .getList().get(i - 1) : i < args.length ? args[i] : null));
       if (AU.isAS(ret)) {
         String[] list = (String[]) ret;
         for (int j = 0; j < list.length; j++)

Modified: trunk/Jmol/src/org/jmol/script/ScriptCompiler.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java  2015-10-28 03:41:32 UTC 
(rev 20849)
+++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java  2015-10-30 11:52:33 UTC 
(rev 20850)
@@ -143,7 +143,7 @@
   private String ident, identLC;
   private Lst<T> vPush = new Lst<T>();
   private int pushCount;
-  private ScriptFlowContext lastFlowContext;
+  private ScriptFlowContext forceFlowContext;
 
   synchronized ScriptContext compile(String filename, String script,
                                      boolean isPredefining, boolean isSilent,
@@ -333,7 +333,7 @@
       isEndOfCommand = false;
       needRightParen = false;
       lastFlowCommand = null;
-      lastFlowContext = null;
+      forceFlowContext = null;
 
       theTok = T.nada;
       short iLine = 1;
@@ -731,7 +731,7 @@
           if (lastFlowCommand.tok != T.process && (tokAt(0) == T.leftbrace))
             ltoken.remove(0);
           lastFlowCommand = null;
-          lastFlowContext = flowContext;
+          forceFlowContext = flowContext;
 //          lastFlowImplicitEnd = flowContext.nextFlowImplicitEnd;
         }
       }
@@ -823,7 +823,7 @@
         } else if (n > 0 && !haveENDIF || isOneLine) {
           forceFlowEnd(flowContext.token);
           if (!isOneLine) {
-            lastFlowContext.forceEndIf = true;
+            forceFlowContext.forceEndIf = true;
           }
         }
         isEndOfCommand = true;
@@ -1542,12 +1542,12 @@
         // specifically for else {  but not elseIf ( ) {
         isEndOfCommand = true;
         ScriptFlowContext f = (flowContext != null && flowContext.addLine == 0 
-            || lastFlowContext == null ? flowContext : lastFlowContext);
+            || forceFlowContext == null ? flowContext : forceFlowContext);
         if (f != null) {
           f.addLine = 0;
           f.forceEndIf = false;
           lastToken = T.tokenLeftBrace;
-          lastFlowContext = f;
+          forceFlowContext = f;
        }
         return CONTINUE;
       }
@@ -1684,10 +1684,10 @@
         // unexpectedly allows if (x) { print x else print y}
         fixFlowAddLine(flowContext);
         if (lltoken.get(iCommand - 1)[0].tok == T.end
-            && lastFlowContext != null && lastFlowContext.forceEndIf
-            && lastFlowContext.addLine > 0
-            && isFlowIfContextOK(lastFlowContext)) {
-          flowContext = lastFlowContext;
+            && forceFlowContext != null && forceFlowContext.forceEndIf
+            && forceFlowContext.addLine > 0
+            && isFlowIfContextOK(forceFlowContext)) {
+          flowContext = forceFlowContext;
           flowContext.forceEndIf = true;
           lltoken.remove(--iCommand);
         } else if (flowContext != null && flowContext.addLine > 0) {
@@ -1745,6 +1745,8 @@
         }
         if (theTok == T.rightbrace) {
           // if }, just push onto vBrace, but NOT onto ltoken
+          // no longer necessary to force end
+          forceFlowContext = null;
           addBrace(tokenCommand);
           tokCommand = T.nada;
           return CONTINUE;
@@ -2152,7 +2154,7 @@
   }
   private int forceFlowEnd(T token) {
     T t0 = tokenCommand;
-    lastFlowContext = flowContext;
+    forceFlowContext = flowContext;
     token = flowStart(token);
     if (!checkFlowEnd(token.tok, (String) token.value, ichBrace, false))
       return ERROR;

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-10-28 03:41:32 UTC 
(rev 20849)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-10-30 11:52:33 UTC 
(rev 20850)
@@ -3165,7 +3165,7 @@
     return "";
   }
 
-  private boolean polyhedra() throws ScriptException {
+  private void polyhedra() throws ScriptException {
     ScriptEval eval = e;
     // polyhedra
     // polyhedra on/off/delete
@@ -3198,6 +3198,7 @@
     setShapeProperty(JC.SHAPE_POLYHEDRA, "init", Boolean.TRUE);
     float translucentLevel = Float.MAX_VALUE;
     int[] colorArgb = new int[] { Integer.MIN_VALUE };
+    P3 offset = null;
     String id = null;
     for (int i = 1; i < slen; ++i) {
       String propertyName = null;
@@ -3259,7 +3260,11 @@
         needsGenerating = true;
         break;
       case T.offset:
-        eval.theTok = T.facecenteroffset;
+        if (!isFloatParameter(i + 1)) {
+          offset = getPoint3f(++i, true);
+          i = eval.iToken;
+          continue;
+        }
         //$FALL-THROUGH$
       case T.facecenteroffset:
         setShapeProperty(JC.SHAPE_POLYHEDRA, "collapsed", Boolean.TRUE);
@@ -3361,14 +3366,13 @@
       case T.id:
       case T.times:
       case T.identifier:
+      case T.string:
         if (!eval.isColorParam(i)) {
           if (i != 1)
             invPO();
-          setShapeProperty(
-              JC.SHAPE_POLYHEDRA,
-              "thisID",
-              id = (eval.theTok == T.id ? stringParameter(++i) : eval
-                  .optParameterAsString(i)));
+          id = (eval.theTok == T.id ? stringParameter(++i) : eval
+              .optParameterAsString(i));
+          setShapeProperty(JC.SHAPE_POLYHEDRA, "thisID", id);
           setShapeProperty(JC.SHAPE_POLYHEDRA, "model",
               Integer.valueOf(vwr.am.cmi));
           if (!eval.isCenterParameter(i + 1))
@@ -3391,15 +3395,17 @@
       if (propertyName != null)
         setShapeProperty(JC.SHAPE_POLYHEDRA, propertyName, propertyValue);
       if (onOffDelete)
-        return false;
+        return;
     }
     if (needsGenerating) {
       if (!typeSeen && haveBonds)
         setShapeProperty(JC.SHAPE_POLYHEDRA, "bonds", null);
       setShapeProperty(JC.SHAPE_POLYHEDRA, "generate", null);
-    } else if (!edgeParameterSeen) {// && lighting == T.nada)
+    } else if (!edgeParameterSeen && offset == null) {// && lighting == T.nada)
       error(ScriptError.ERROR_insufficientArguments);
     }
+    if (offset != null) 
+      setShapeProperty(JC.SHAPE_POLYHEDRA, "offset", offset);
     if (colorArgb[0] != Integer.MIN_VALUE)
       setShapeProperty(JC.SHAPE_POLYHEDRA, "colorThis",
           Integer.valueOf(colorArgb[0]));
@@ -3409,7 +3415,6 @@
     //    if (lighting != T.nada)
     //      setShapeProperty(JC.SHAPE_POLYHEDRA, "token", 
Integer.valueOf(lighting));
     setShapeProperty(JC.SHAPE_POLYHEDRA, "init", Boolean.FALSE);
-    return true;
   }
 
   /**

Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-10-28 03:41:32 UTC 
(rev 20849)
+++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-10-30 11:52:33 UTC 
(rev 20850)
@@ -3197,8 +3197,11 @@
           Point3fi  p;
           Point3fi[] pt3 = new Point3fi[sv.size()]; 
           for (int i = pt3.length; --i >= 0;) {
+            P3 p3 = SV.ptValue(sv.get(i));
+            if (p3 == null)
+              return false; 
             p = new Point3fi();
-            p.setT(SV.ptValue(sv.get(i)));
+            p.setT(p3);
             p.i = i;
             pt3[i] = p;
             bspt.addTuple(p);

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-10-28 03:41:32 UTC 
(rev 20849)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-10-30 11:52:33 UTC 
(rev 20850)
@@ -156,6 +156,12 @@
       return;
     }
 
+    if ("offset" == propertyName) {
+      if (thisID != null)
+        offsetPolyhedra((P3) value);
+      return;
+    }
+
     if ("model" == propertyName) {
       modelIndex = ((Integer) value).intValue();
       return;
@@ -285,7 +291,7 @@
       for (int i = bs1.nextSetBit(0); i >= 0; i = bs1.nextSetBit(i + 1)) {
         p = polyhedrons[i];
         if (p.id == null) {
-          p.colixEdge = colixEdge;          
+          p.colixEdge = colixEdge;
         } else {
           p.colixEdge = colixEdge;
           p.colix = colix;
@@ -354,6 +360,12 @@
     setPropAS(propertyName, value, bs);
   }
 
+  private void offsetPolyhedra(P3 value) {
+    BS bs = findPolyBS(null);
+    for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1))
+      polyhedrons[i].setOffset(P3.newP(value));
+  }
+
   @Override
   public Object getProperty(String propertyName, int index) {
     if (propertyName == "symmetry") {

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java        2015-10-28 
03:41:32 UTC (rev 20849)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java        2015-10-30 
11:52:33 UTC (rev 20850)
@@ -64,6 +64,8 @@
 
   public short colix = C.GOLD;
   public int modelIndex = Integer.MIN_VALUE;
+
+  private P3 offset;
   
 
   Polyhedron() {  
@@ -105,6 +107,8 @@
         modelIndex = info.get("modelIndex").intValue;
         colix = C.getColixS(info.get("color").asString());
         colixEdge = C.getColixS(info.get("colorEdge").asString());
+        if (info.containsKey("offset"))
+          offset = P3.newP(SV.ptValue(info.get("offset")));
       }
       Lst<SV> lst = info.get("vertices").getList();
       SV vc = info.get("vertexCount");
@@ -214,6 +218,8 @@
       info.put("modelIndex", Integer.valueOf(mi));
       info.put("color", C.getHexCode(colix));
       info.put("colorEdge", C.getHexCode(colixEdge == 0 ? colix : colixEdge));
+      if (offset != null)
+        info.put("offset", offset);
     }
     if (faces != null)
       info.put("faces", faces);
@@ -302,10 +308,7 @@
     if (bsFlat.cardinality() < triangles.length)
       for (int i = triangles.length; --i >= 0;) {
         int[] face = triangles[i];
-        for (int j = face.length - 2; --j >= 0;)
-          if (face[j + 2] >= 0)
-            v += triangleVolume(face[j], face[j + 1], face[j + 2], vAB, vAC,
-                vTemp);
+        v += triangleVolume(face[0], face[1], face[2], vAB, vAC, vTemp);
       }
     return Float.valueOf(v / 6);
   }
@@ -316,7 +319,7 @@
     vAC.setT(vertices[j]);
     vTemp.cross(vAB, vAC);
     vAC.setT(vertices[k]);
-    return vAC.dot(vTemp);
+    return  vAC.dot(vTemp);
   }
 
   String getState(Viewer vwr) {
@@ -350,4 +353,16 @@
     return normixes;
   }
 
+  void setOffset(P3 value) {
+    if (center == null)
+      return; // ID  polyhedra only
+    P3 v = P3.newP(value);
+    if (offset != null)
+      value.sub(offset);
+    offset = v;
+    center.add(value);
+    for (int i = vertices.length; --i >= 0;)
+      vertices[i].add(value);
+  }
+
 }

Modified: trunk/Jmol/src/org/jmol/viewer/GlobalSettings.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/GlobalSettings.java  2015-10-28 03:41:32 UTC 
(rev 20849)
+++ trunk/Jmol/src/org/jmol/viewer/GlobalSettings.java  2015-10-30 11:52:33 UTC 
(rev 20850)
@@ -75,8 +75,9 @@
         getDataBaseList(JC.databases);
         getDataBaseList(userDatabases);
       }
-      loadFormat = databases.get("pdb");
-      loadLigandFormat = databases.get("ligand");
+      loadFormat = pdbLoadFormat = databases.get("pdb");
+      pdbLoadFormat0 = databases.get("pdb0");
+      pdbLoadLigandFormat = databases.get("ligand");
       nmrUrlFormat = databases.get("nmr");
       nmrPredictFormat = databases.get("nmrdb");
       smilesUrlFormat = databases.get("nci") + "/file?format=sdf&get3d=True";
@@ -283,7 +284,7 @@
       setB("legacyJavaFloat", legacyJavaFloat);
       setF("loadAtomDataTolerance", loadAtomDataTolerance);
       setO("loadFormat", loadFormat);
-      setO("loadLigandFormat", loadLigandFormat);
+      setO("loadLigandFormat", pdbLoadLigandFormat);
       setB("logCommands", logCommands);
       setB("logGestures", logGestures);
       setB("measureAllModels", measureAllModels);
@@ -440,7 +441,7 @@
     boolean forceAutoBond = false;
     boolean fractionalRelative = true;// true: {1/2 1/2 1/2} relative to 
current (possibly offset) unit cell 
     char inlineNewlineChar = '|'; //pseudo static
-    String loadFormat, loadLigandFormat, nmrUrlFormat, nmrPredictFormat, 
smilesUrlFormat, nihResolverFormat, pubChemFormat;
+    String loadFormat, pdbLoadFormat, pdbLoadFormat0, pdbLoadLigandFormat, 
nmrUrlFormat, nmrPredictFormat, smilesUrlFormat, nihResolverFormat, 
pubChemFormat;
 
     String edsUrlFormat = 
"http://eds.bmc.uu.se/eds/dfs/%LC13/%LCFILE/%LCFILE.omap";;
     String edsUrlFormatDiff = 
"http://eds.bmc.uu.se/eds/dfs/%LC13/%LCFILE/%LCFILE_diff.omap";;
@@ -888,28 +889,33 @@
       return structureList;
     }
 
-  String resolveDataBase(String database, String id) {
-    String format = databases.get(database.toLowerCase());
-    if (format == null)
-      return null;
-    if (id.indexOf("/") < 0) {
-      if (database.equals("pubchem"))
-        id = "name/" + id;
-      else if (database.equals("nci"))
-        id += "/file?format=sdf&get3d=True";
-    }
-    try {
-      while (format.indexOf("%c") >= 0)
-        for (int i = 1; i < 10; i++) {
-          format = PT.rep(format, "%c" + i, id.substring(i - 1, i));
+    String resolveDataBase(String database, String id, String format) {
+      if (format == null) {
+        if ((format = databases.get(database.toLowerCase())) == null)
+          return null;
+        if (id.indexOf("/") < 0) {
+          if (database.equals("pubchem"))
+            id = "name/" + id;
+          else if (database.equals("nci"))
+            id += "/file?format=sdf&get3d=True";
         }
-    } catch (Exception e) {
-      // too bad.
+      } else if (id.indexOf(".") >= 0 && format.indexOf("%FILE.") >= 0) {
+        // replace RCSB format extension when a file extension is made 
explicit 
+        format = format.substring(0, format.indexOf("%FILE"));
+      }
+      try {
+        while (format.indexOf("%c") >= 0)
+          for (int i = 1; i < 10; i++) {
+            format = PT.rep(format, "%c" + i, id.substring(i - 1, i));
+          }
+      } catch (Exception e) {
+        // too bad.
+      }
+      return (format.indexOf("%FILE") >= 0 ? PT.formatStringS(format, "FILE", 
id)
+          : format.indexOf("%file") >= 0 ? PT.formatStringS(format, "file",
+              id.toLowerCase()) : format + id);
     }
-    return (format.indexOf("%FILE") < 0 ? format + id : PT.formatStringS(
-        format, "FILE", id));
-  }
-
+  
     static boolean doReportProperty(String name) {
       return (name.charAt(0) != '_' && unreportedProperties.indexOf(";" + name
           + ";") < 0);
@@ -1018,7 +1024,7 @@
       app(str, "set forceAutoBond " + forceAutoBond);
       app(str, "#set defaultDirectory " + PT.esc(defaultDirectory));
       app(str, "#set loadFormat " + PT.esc(loadFormat));
-      app(str, "#set loadLigandFormat " + PT.esc(loadLigandFormat));
+      app(str, "#set loadLigandFormat " + PT.esc(pdbLoadLigandFormat));
       app(str, "#set smilesUrlFormat " + PT.esc(smilesUrlFormat));
       app(str, "#set nihResolverFormat " + PT.esc(nihResolverFormat));
       app(str, "#set pubChemFormat " + PT.esc(pubChemFormat));

Modified: trunk/Jmol/src/org/jmol/viewer/JC.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/JC.java      2015-10-28 03:41:32 UTC (rev 
20849)
+++ trunk/Jmol/src/org/jmol/viewer/JC.java      2015-10-30 11:52:33 UTC (rev 
20850)
@@ -60,7 +60,8 @@
     "cod", 
"http://www.crystallography.net/cod/cif/%c1/%c2%c3/%c4%c5/%FILE.cif";,
     "nmr", "http://www.nmrdb.org/new_predictor?POST?molfile=";,
     "nmrdb", "http://www.nmrdb.org/service/predictor?POST?molfile=";,
-    "pdb", "http://www.rcsb.org/pdb/files/%FILE.pdb.gz";,
+    "pdb", 
"http://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/%c2%c3/pdb%file.ent.gz";,
 // new Jmol 14.5.0 10/28/2015
+    "pdb0", "http://www.rcsb.org/pdb/files/%FILE.pdb.gz";,
     "pdbe", "http://www.ebi.ac.uk/pdbe/entry-files/download/%FILE.cif";,
     "pdbe2", "http://www.ebi.ac.uk/pdbe/static/entry/%FILE_updated.cif";,
     "pubchem", 
"http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d";,

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-10-28 03:41:32 UTC 
(rev 20849)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-10-30 11:52:33 UTC 
(rev 20850)
@@ -62,10 +62,40 @@
 
 TODO: consider if models with no atoms will cause issues in relation to 
model.firstAtomIndex
 
-TODO: working on ID for polyhedra without atom refs
+Jmol.___JmolVersion="14.5.0_2015.10.30"
 
-Jmol.___JmolVersion="14.5.0_2015.10.28"
+FEATURE CHANGE: (Application only for now) PDB default for =xxxx 
+  -- changed to 
+    "pdb", 
"http://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/%c2%c3/pdb%file.ent.gz";
+  -- will be complemented with file.ent for non-binary transfer, but that is 
not implemented yet at RCSB
+  -- mmCIF counterpart not implemented yet.
+  -- not HTML5 because for that we need the option to remove .gz
 
+new feature: set testflag3 TRUE  gives random triangle effect to polyhedra
+
+new feature: POLYHEDRON ID "xxx" OFFSET {3 3 3}
+ -- allows cartesian offset of named polyhedra
+ 
+bug fix: polyhedron volume will be incorrect if there is a 
+         face triangle that has no edges visible (requires a six or more sided 
face)  
+
+bug fix: nested if...{...if... } else {...} gives compiler syntax error:
+
+  if (i=1) {
+    print "i=1"
+    if (j=1)
+      print "j != 1" 
+  } else {                // } closes if (j=1) instead of if (i=1) {
+    print "i != 1"
+  }
+
+JmolVersion="14.5.0_2015.10.29"
+
+bug fix: after CALCULATE HYDROGENS TRUE and then deleting hydrogens, hydrogens 
are not added to aromatic rings in PDB models
+bug fix: reading saved state after adding hydrogen atoms results in infinite 
loop
+
+JmolVersion="14.5.0_2015.10.28"
+
 bug fix: XODYDATA file reader does not read bond info or formal charge // 
changes in 14.4.0_2015.10.28
 
 FEATURE CHANGE: default RCSB/PDB load format (=xxxx) changed to 
http://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/%c2%c3/pdb%file.ent.gz

Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Viewer.java  2015-10-28 03:41:32 UTC (rev 
20849)
+++ trunk/Jmol/src/org/jmol/viewer/Viewer.java  2015-10-30 11:52:33 UTC (rev 
20850)
@@ -3905,7 +3905,7 @@
         try {
           int pt = f.indexOf("/");
           String database = f.substring(0, pt);
-          f = g.resolveDataBase(database, f.substring(pt + 1));
+          f = g.resolveDataBase(database, f.substring(pt + 1), null);
           return (f == null ? name : f);
         } catch (Exception e) {
           return name;
@@ -3913,10 +3913,13 @@
       }
       //$FALL-THROUGH$
     case '#': // ligand
-      String s = (type == '=' ? g.loadFormat : g.loadLigandFormat);
-      if (f.indexOf(".") > 0 && s.indexOf("%FILE.") >= 0)
-        s = s.substring(0, s.indexOf("%FILE") + 5);
-      return PT.formatStringS(s, "FILE", f);
+      String s = (type != '=' ? g.pdbLoadLigandFormat
+          // following is temporary, until issues are resolved for AJAX asych
+          : isJS && g.loadFormat.equals(g.pdbLoadFormat) ? g.pdbLoadFormat0 
+          : g.loadFormat);
+      if (f.indexOf(".") >= 0 && s.equals(g.pdbLoadFormat))
+          s = g.pdbLoadFormat0; // older version for =1crn.cif or  =1crn.pdb
+      return g.resolveDataBase(null, f, s);
     case '*':
       // European Bioinformatics Institute
       int pt = name.lastIndexOf("/");
@@ -3924,23 +3927,23 @@
         //  *dom/.../.../.../xxxx
         f = name.substring(pt + 1);
         format = (pt > 4 ? name.substring(5) : "mappings");
-        return PT.rep(g.resolveDataBase("map", f), "%TYPE", format);
+        return PT.rep(g.resolveDataBase("map", f, null), "%TYPE", format);
       } else if (name.startsWith("*val/")) {
         //  *val/.../.../.../xxxx
         f = name.substring(pt + 1);
         format = (pt > 4 ? name.substring(5) : "validation/outliers/all");
-        return PT.rep(g.resolveDataBase("map", f), "%TYPE", format);
+        return PT.rep(g.resolveDataBase("map", f, null), "%TYPE", format);
       } else if (name.startsWith("*rna3d/")) {
         //  *rna3d/.../.../.../xxxx
         f = name.substring(pt + 1);
         format = (pt > 6 ? name.substring(6) : "loops");
-        return PT.rep(g.resolveDataBase("rna3d", f), "%TYPE", format);
+        return PT.rep(g.resolveDataBase("rna3d", f, null), "%TYPE", format);
       } else if (name.startsWith("*dssr/")) {
         f = name.substring(pt + 1);
-        return g.resolveDataBase("dssr", f);
+        return g.resolveDataBase("dssr", f, null);
       } else if (name.startsWith("*dssr1/")) {
         f = name.substring(pt + 1);
-        return g.resolveDataBase("dssr1", f);
+        return g.resolveDataBase("dssr1", f, null);
       }
       // these are processed in SmarterJmolAdapter
       String pdbe = "pdbe";
@@ -3948,7 +3951,7 @@
         pdbe = "pdbe2";
         f = f.substring(0, 4);
       }
-      return g.resolveDataBase(pdbe, f);
+      return g.resolveDataBase(pdbe, f, null);
     case ':': // PubChem
       format = g.pubChemFormat;
       if (f.equals("")) {
@@ -5365,7 +5368,7 @@
       return;
     case T.loadligandformat:
       // /12.1.51//
-      g.loadLigandFormat = value;
+      g.pdbLoadLigandFormat = value;
       break;
     // 12.1.50
     case T.defaultlabelpdb:

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


------------------------------------------------------------------------------
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to