Revision: 18608
          http://sourceforge.net/p/jmol/code/18608
Author:   hansonr
Date:     2013-08-20 22:43:55 +0000 (Tue, 20 Aug 2013)
Log Message:
-----------
___JmolVersion="13.3.4_dev_2013.08.20c"

bug fix: CIF reader not reading _CCDC_GEOM_BOND_TYPE record

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java
    trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java
    trunk/Jmol/src/org/jmol/adapter/readers/simple/FoldingXyzReader.java
    trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java
    trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java  2013-08-20 
18:23:45 UTC (rev 18607)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java  2013-08-20 
22:43:55 UTC (rev 18608)
@@ -79,6 +79,10 @@
   
   private CifDataReader tokenizer = new CifDataReader(this);
 
+  private boolean isMolecular;
+  private boolean filterAssembly;
+  private int configurationPtr = Integer.MIN_VALUE;
+
   private String thisDataSetName = "";
   private String chemicalName = "";
   private String thisStructuralFormula = "";
@@ -86,12 +90,10 @@
   private boolean iHaveDesiredModel;
   private boolean isPDB = false;
   private Map<String, String> htHetero;
-  private boolean isMolecular;
   private String molecularType = "GEOM_BOND default";
   private char lastAltLoc = '\0';
-  private int configurationPtr = Integer.MIN_VALUE;
+  private boolean haveAromatic;
   private int conformationIndex;
-  private boolean filterAssembly;
   private int nMolecular = 0;
   
 
@@ -122,6 +124,7 @@
       configurationPtr = parseIntStr(conf);
     isMolecular = checkFilterKey("MOLECUL");
     filterAssembly = checkFilterKey("$");
+
     if (isMolecular) {
       if (!doApplySymmetry) {
         doApplySymmetry = true;
@@ -131,7 +134,7 @@
       }
       molecularType = "filter \"MOLECULAR\"";
     }
-    initializeMod();
+    initializeModulation();
     readCifData();
     continuing = false;
   }
@@ -281,6 +284,7 @@
       atomSetCollection.removeCurrentAtomSet();
     else
       applySymmetryAndSetTrajectory();
+    finalizeModulation();
     if (htSites != null)
       addSites(htSites);
     int n = atomSetCollection.getAtomSetCount();
@@ -300,6 +304,8 @@
     if (header.length() > 0)
         atomSetCollection.setAtomSetCollectionAuxiliaryInfo("fileHeader",
           header);
+    if (haveAromatic)
+      addJmolScript("calculate aromatic");
   }
 
   private void setBiomolecules() {
@@ -560,9 +566,7 @@
       if (!doApplySymmetry) {
         isMolecular = true;
         doApplySymmetry = true;
-        latticeCells[0] = 1;
-        latticeCells[1] = 1;
-        latticeCells[2] = 1;
+        latticeCells[0] = latticeCells[1] = latticeCells[2] = 1;
       }
       if (isMolecular)
         processGeomBondLoopBlock();
@@ -612,6 +616,85 @@
     skipLoop();
   }
 
+  private int fieldProperty(int i) {
+    return ((field = tokenizer.loopData[i]).length() > 0 
+        && (firstChar = field.charAt(0)) != '\0' ? 
+            propertyOf[i] : NONE);
+  }
+
+  private String field;
+  private char firstChar = '\0';
+  private int[] propertyOf = new int[100]; // should be enough
+  private byte[] fieldOf = new byte[100];
+  private String[] fields;
+  private int propertyCount;
+  
+  
+  /**
+   * sets up arrays and variables for tokenizer.getData()
+   * 
+   * @param fields
+   * @throws Exception
+   */
+  private void parseLoopParameters(String[] fields) throws Exception {
+    if (fields == null)
+      fields = this.fields = new String[100];
+    tokenizer.fieldCount = 0;
+    for (int i = fields.length; --i >= 0; )
+      fieldOf[i] = NONE;
+
+    propertyCount = fields.length;
+    while (true) {
+      String str = tokenizer.peekToken();
+      if (str == null) {
+        tokenizer.fieldCount = 0;
+        break;
+      }
+      if (str.charAt(0) != '_')
+        break;
+      tokenizer.getTokenPeeked();
+      propertyOf[tokenizer.fieldCount] = NONE;
+      str = fixKey(str);
+      for (int i = fields.length; --i >= 0;)
+        if (fields[i] == null || str.equals(fields[i])) {
+          propertyOf[tokenizer.fieldCount] = i;
+          fieldOf[i] = (byte) tokenizer.fieldCount;
+          if (fields[i] == null)
+            fields[i] = str;
+          break;
+        }
+      tokenizer.fieldCount++;
+    }
+    if (tokenizer.fieldCount > 0)
+      tokenizer.loopData = new String[tokenizer.fieldCount];
+  }
+
+  /**
+   * 
+   * used for turning off fractional or nonfractional coord.
+   * 
+   * @param fieldIndex
+   */
+  private void disableField(int fieldIndex) {
+    int i = fieldOf[fieldIndex];
+    if (i != NONE)
+        propertyOf[i] = NONE;
+  }
+
+  /**
+   * 
+   * skips all associated loop data
+   * 
+   * @throws Exception
+   */
+  private void skipLoop() throws Exception {
+    String str;
+    while ((str = tokenizer.peekToken()) != null && str.charAt(0) == '_')
+      str  = tokenizer.getTokenPeeked();
+    while (tokenizer.getNextDataToken() != null) {
+    }
+  }  
+
   ////////////////////////////////////////////////////////////////
   // atom type data
   ////////////////////////////////////////////////////////////////
@@ -1294,160 +1377,7 @@
     }
   }
 
-
   ////////////////////////////////////////////////////////////////
-  // bond data
-  ////////////////////////////////////////////////////////////////
-
-  final private static byte CHEM_COMP_BOND_ATOM_ID_1 = 0;
-  final private static byte CHEM_COMP_BOND_ATOM_ID_2 = 1;
-  final private static byte CHEM_COMP_BOND_VALUE_ORDER = 2;
-  final private static byte CHEM_COMP_BOND_AROMATIC_FLAG = 3;
-  final private static String[] chemCompBondFields = {
-    "_chem_comp_bond_atom_id_1",
-    "_chem_comp_bond_atom_id_2",
-    "_chem_comp_bond_value_order",
-    "_chem_comp_bond_pdbx_aromatic_flag", 
-  };
-  
-  private void processLigandBondLoopBlock() throws Exception {
-    parseLoopParameters(chemCompBondFields);
-    for (int i = propertyCount; --i >= 0;)
-      if (fieldOf[i] == NONE) {
-        Logger.warn("?que? missing _chem_comp_bond property:" + i);
-        skipLoop();
-        return;
-      }
-    int order = 0;
-    boolean isAromatic = false;
-    while (tokenizer.getData()) {
-      int atomIndex1 = -1;
-      int atomIndex2 = -1;
-      order = 0;
-      isAromatic = false;
-      for (int i = 0; i < tokenizer.fieldCount; ++i) {
-        switch (fieldProperty(i)) {
-        case CHEM_COMP_BOND_ATOM_ID_1:
-          atomIndex1 = atomSetCollection.getAtomIndexFromName(field);
-          break;
-        case CHEM_COMP_BOND_ATOM_ID_2:
-          atomIndex2 = atomSetCollection.getAtomIndexFromName(field);
-          break;
-        case CHEM_COMP_BOND_AROMATIC_FLAG:
-          isAromatic = (field.charAt(0) == 'Y');
-          break;
-        case CHEM_COMP_BOND_VALUE_ORDER:
-          order = JmolAdapter.ORDER_COVALENT_SINGLE;
-          if (field.equals("SING"))
-            order = JmolAdapter.ORDER_COVALENT_SINGLE;
-          else if (field.equals("DOUB"))
-            order = JmolAdapter.ORDER_COVALENT_DOUBLE;
-          else if (field.equals("TRIP"))
-            order = JmolAdapter.ORDER_COVALENT_TRIPLE;
-          else
-            Logger.warn("unknown CIF bond order: " + field);
-          break;
-        }
-      }
-      if (atomIndex1 < 0 || atomIndex2 < 0)
-        continue;
-      if (isAromatic)
-        switch (order) {
-        case JmolAdapter.ORDER_COVALENT_SINGLE:
-          order = JmolAdapter.ORDER_AROMATIC_SINGLE;
-          break;
-        case JmolAdapter.ORDER_COVALENT_DOUBLE:
-          order = JmolAdapter.ORDER_AROMATIC_DOUBLE;
-          break;
-        }
-      atomSetCollection.addNewBondWithOrder(atomIndex1, atomIndex2, order);
-    }
-  }
-
-  final private static byte GEOM_BOND_ATOM_SITE_LABEL_1 = 0;
-  final private static byte GEOM_BOND_ATOM_SITE_LABEL_2 = 1;
-  final private static byte GEOM_BOND_DISTANCE = 2;
-  //final private static byte GEOM_BOND_SITE_SYMMETRY_2 = 3;
-
-  final private static String[] geomBondFields = { 
-      "_geom_bond_atom_site_label_1",
-      "_geom_bond_atom_site_label_2",
-      "_geom_bond_distance",
-    //  "_geom_bond_site_symmetry_2",
-  };
-
-  /**
-   * 
-   * reads bond data -- N_ijk symmetry business is ignored,
-   * so we only indicate bonds within the unit cell to just the
-   * original set of atoms. "connect" script or "set forceAutoBond"
-   * will override these values.
-   * 
-   * @throws Exception
-   */
-  private void processGeomBondLoopBlock() throws Exception {
-    parseLoopParameters(geomBondFields);
-    for (int i = propertyCount; --i >= 0;)
-      if (fieldOf[i] == NONE) {
-        Logger.warn("?que? missing _geom_bond property:" + i);
-        skipLoop();
-        return;
-      }
-
-    String name1 = null;
-    String name2 = null;
-    while (tokenizer.getData()) {
-      int atomIndex1 = -1;
-      int atomIndex2 = -1;
-      float distance = 0;
-      float dx = 0;
-      //String siteSym2 = null;
-      for (int i = 0; i < tokenizer.fieldCount; ++i) {
-        switch (fieldProperty(i)) {
-        case NONE:
-          break;
-        case GEOM_BOND_ATOM_SITE_LABEL_1:
-          atomIndex1 = atomSetCollection.getAtomIndexFromName(name1 = field);
-          break;
-        case GEOM_BOND_ATOM_SITE_LABEL_2:
-          atomIndex2 = atomSetCollection.getAtomIndexFromName(name2 = field);
-          break;
-        case GEOM_BOND_DISTANCE:
-          distance = parseFloatStr(field);
-          int pt = field.indexOf('('); 
-          if (pt >= 0) {
-            char[] data = field.toCharArray();
-            // 3.567(12) --> 0.012
-            String sdx = field.substring(pt + 1, field.length() - 1);
-            int n = sdx.length();
-            for (int j = pt; --j >= 0;) {
-              if (data[j] == '.')
-                --j;
-               data[j] = (--n < 0 ? '0' : sdx.charAt(n));
-            }
-            dx = parseFloatStr(String.valueOf(data));
-            if (Float.isNaN(dx)) {
-              Logger.info("error reading uncertainty for " + line);
-              dx = 0.015f;
-            }
-            // TODO -- this is the full +/- (dx) in x.xxx(dx) -- is that too 
large?
-          } else {
-            dx = 0.015f;
-          }
-          break;
-        //case GEOM_BOND_SITE_SYMMETRY_2:
-          //siteSym2 = field;
-          //break;
-        }
-      }
-      if (atomIndex1 < 0 || atomIndex2 < 0)
-        continue;
-      if (distance > 0) 
-        bondTypes.addLast(new Object[] { name1, name2, 
Float.valueOf(distance), Float.valueOf(dx) });
-    }
-  }
-  
-  ////////////////////////////////////////////////////////////////
   // HETATM identity
   ////////////////////////////////////////////////////////////////
 
@@ -1467,6 +1397,7 @@
    * 
    */
   private String[] hetatmData;
+
   private void processNonpolyData() {
     if (hetatmData == null)
       hetatmData = new String[3];
@@ -1884,86 +1815,175 @@
     }
   }
   
-  private int fieldProperty(int i) {
-    return ((field = tokenizer.loopData[i]).length() > 0 
-        && (firstChar = field.charAt(0)) != '\0' ? 
-            propertyOf[i] : NONE);
-  }
 
-  String field;
+  ////////////////////////////////////////////////////////////////
+  // bond data
+  ////////////////////////////////////////////////////////////////
+
+  final private static byte CHEM_COMP_BOND_ATOM_ID_1 = 0;
+  final private static byte CHEM_COMP_BOND_ATOM_ID_2 = 1;
+  final private static byte CHEM_COMP_BOND_VALUE_ORDER = 2;
+  final private static byte CHEM_COMP_BOND_AROMATIC_FLAG = 3;
+  final private static String[] chemCompBondFields = {
+    "_chem_comp_bond_atom_id_1",
+    "_chem_comp_bond_atom_id_2",
+    "_chem_comp_bond_value_order",
+    "_chem_comp_bond_pdbx_aromatic_flag", 
+  };
   
-  private char firstChar = '\0';
-  private int[] propertyOf = new int[100]; // should be enough
-  private byte[] fieldOf = new byte[100];
-  private String[] fields;
-  private int propertyCount;
-  
-  
-  /**
-   * sets up arrays and variables for tokenizer.getData()
-   * 
-   * @param fields
-   * @throws Exception
-   */
-  private void parseLoopParameters(String[] fields) throws Exception {
-    if (fields == null)
-      fields = this.fields = new String[100];
-    tokenizer.fieldCount = 0;
-    for (int i = fields.length; --i >= 0; )
-      fieldOf[i] = NONE;
-
-    propertyCount = fields.length;
-    while (true) {
-      String str = tokenizer.peekToken();
-      if (str == null) {
-        tokenizer.fieldCount = 0;
-        break;
+  private void processLigandBondLoopBlock() throws Exception {
+    parseLoopParameters(chemCompBondFields);
+    for (int i = propertyCount; --i >= 0;)
+      if (fieldOf[i] == NONE) {
+        Logger.warn("?que? missing _chem_comp_bond property:" + i);
+        skipLoop();
+        return;
       }
-      if (str.charAt(0) != '_')
-        break;
-      tokenizer.getTokenPeeked();
-      propertyOf[tokenizer.fieldCount] = NONE;
-      str = fixKey(str);
-      for (int i = fields.length; --i >= 0;)
-        if (fields[i] == null || str.equals(fields[i])) {
-          propertyOf[tokenizer.fieldCount] = i;
-          fieldOf[i] = (byte) tokenizer.fieldCount;
-          if (fields[i] == null)
-            fields[i] = str;
+    int order = 0;
+    boolean isAromatic = false;
+    while (tokenizer.getData()) {
+      int atomIndex1 = -1;
+      int atomIndex2 = -1;
+      order = 0;
+      isAromatic = false;
+      for (int i = 0; i < tokenizer.fieldCount; ++i) {
+        switch (fieldProperty(i)) {
+        case CHEM_COMP_BOND_ATOM_ID_1:
+          atomIndex1 = atomSetCollection.getAtomIndexFromName(field);
           break;
+        case CHEM_COMP_BOND_ATOM_ID_2:
+          atomIndex2 = atomSetCollection.getAtomIndexFromName(field);
+          break;
+        case CHEM_COMP_BOND_AROMATIC_FLAG:
+          isAromatic = (field.charAt(0) == 'Y');
+          break;
+        case CHEM_COMP_BOND_VALUE_ORDER:
+          order = getBondOrder(field);
+          break;
         }
-      tokenizer.fieldCount++;
+      }
+      if (atomIndex1 < 0 || atomIndex2 < 0)
+        continue;
+      if (isAromatic)
+        switch (order) {
+        case JmolAdapter.ORDER_COVALENT_SINGLE:
+          order = JmolAdapter.ORDER_AROMATIC_SINGLE;
+          break;
+        case JmolAdapter.ORDER_COVALENT_DOUBLE:
+          order = JmolAdapter.ORDER_AROMATIC_DOUBLE;
+          break;
+        }
+      atomSetCollection.addNewBondWithOrder(atomIndex1, atomIndex2, order);
     }
-    if (tokenizer.fieldCount > 0)
-      tokenizer.loopData = new String[tokenizer.fieldCount];
   }
 
-  /**
-   * 
-   * used for turning off fractional or nonfractional coord.
-   * 
-   * @param fieldIndex
-   */
-  private void disableField(int fieldIndex) {
-    int i = fieldOf[fieldIndex];
-    if (i != NONE)
-        propertyOf[i] = NONE;
+  private int getBondOrder(String field) {
+    switch (field.charAt(0)) {
+    default:
+      Logger.warn("unknown CIF bond order: " + field);
+      //$FALL-THROUGH$
+    case 'S':
+      return JmolAdapter.ORDER_COVALENT_SINGLE;
+    case 'D':
+      return JmolAdapter.ORDER_COVALENT_DOUBLE;
+    case 'T':
+      return JmolAdapter.ORDER_COVALENT_TRIPLE;
+    case 'A':
+      haveAromatic = true;
+      return JmolAdapter.ORDER_AROMATIC;
+    }
   }
 
+  final private static byte GEOM_BOND_ATOM_SITE_LABEL_1 = 0;
+  final private static byte GEOM_BOND_ATOM_SITE_LABEL_2 = 1;
+  final private static byte GEOM_BOND_DISTANCE = 2;
+  final private static byte CCDC_GEOM_BOND_TYPE = 3;
+  
+  //final private static byte GEOM_BOND_SITE_SYMMETRY_2 = 3;
+
+  final private static String[] geomBondFields = { 
+      "_geom_bond_atom_site_label_1",
+      "_geom_bond_atom_site_label_2",
+      "_geom_bond_distance",
+      "_ccdc_geom_bond_type"
+    //  "_geom_bond_site_symmetry_2",
+  };
+
   /**
    * 
-   * skips all associated loop data
+   * reads bond data -- N_ijk symmetry business is ignored,
+   * so we only indicate bonds within the unit cell to just the
+   * original set of atoms. "connect" script or "set forceAutoBond"
+   * will override these values, but see below.
    * 
    * @throws Exception
    */
-  private void skipLoop() throws Exception {
-    String str;
-    while ((str = tokenizer.peekToken()) != null && str.charAt(0) == '_')
-      str  = tokenizer.getTokenPeeked();
-    while (tokenizer.getNextDataToken() != null) {
+  private void processGeomBondLoopBlock() throws Exception {
+    parseLoopParameters(geomBondFields);
+    for (int i = propertyCount; --i >= 0;)
+      if (propertyOf[i] != CCDC_GEOM_BOND_TYPE && fieldOf[i] == NONE) {
+        Logger.warn("?que? missing _geom_bond property:" + i);
+        skipLoop();
+        return;
+      }
+
+    String name1 = null;
+    String name2 = null;
+    Integer order = Integer.valueOf(1);
+    while (tokenizer.getData()) {
+      int atomIndex1 = -1;
+      int atomIndex2 = -1;
+      float distance = 0;
+      float dx = 0;
+      //String siteSym2 = null;
+      for (int i = 0; i < tokenizer.fieldCount; ++i) {
+        switch (fieldProperty(i)) {
+        case NONE:
+          break;
+        case GEOM_BOND_ATOM_SITE_LABEL_1:
+          atomIndex1 = atomSetCollection.getAtomIndexFromName(name1 = field);
+          break;
+        case GEOM_BOND_ATOM_SITE_LABEL_2:
+          atomIndex2 = atomSetCollection.getAtomIndexFromName(name2 = field);
+          break;
+        case GEOM_BOND_DISTANCE:
+          distance = parseFloatStr(field);
+          int pt = field.indexOf('('); 
+          if (pt >= 0) {
+            char[] data = field.toCharArray();
+            // 3.567(12) --> 0.012
+            String sdx = field.substring(pt + 1, field.length() - 1);
+            int n = sdx.length();
+            for (int j = pt; --j >= 0;) {
+              if (data[j] == '.')
+                --j;
+               data[j] = (--n < 0 ? '0' : sdx.charAt(n));
+            }
+            dx = parseFloatStr(String.valueOf(data));
+            if (Float.isNaN(dx)) {
+              Logger.info("error reading uncertainty for " + line);
+              dx = 0.015f;
+            }
+            // TODO -- this is the full +/- (dx) in x.xxx(dx) -- is that too 
large?
+          } else {
+            dx = 0.015f;
+          }
+          break;
+        case CCDC_GEOM_BOND_TYPE:
+          order = Integer.valueOf(getBondOrder(field));
+          break;
+        //case GEOM_BOND_SITE_SYMMETRY_2:
+          //siteSym2 = field;
+          //break;
+        }
+      }
+      if (atomIndex1 < 0 || atomIndex2 < 0)
+        continue;
+      if (distance > 0) 
+        bondTypes.addLast(new Object[] { name1, name2, 
Float.valueOf(distance), Float.valueOf(dx), order });
     }
-  }  
-
+  }
+  
   /////////////////////////////////////
   //  bonding and molecular 
   /////////////////////////////////////
@@ -2111,6 +2131,7 @@
       Object[] o = bondTypes.get(i);
       float distance = ((Float) o[2]).floatValue();
       float dx = ((Float) o[3]).floatValue();
+      int order = ((Integer) o[4]).intValue();
       int iatom1 = atomSetCollection.getAtomIndexFromName((String) o[0]);
       int iatom2 = atomSetCollection.getAtomIndexFromName((String) o[1]);
       BS bs1 = bsSets[iatom1 - firstAtom];
@@ -2122,7 +2143,7 @@
           if ((!isMolecular || !bsConnected[j + firstAtom].get(k))
               && symmetry.checkDistance(atoms[j + firstAtom], atoms[k
                   + firstAtom], distance, dx, 0, 0, 0, ptOffset))
-            addNewBond(j + firstAtom, k + firstAtom);
+            addNewBond(j + firstAtom, k + firstAtom, order);
         }
     }
     
@@ -2140,7 +2161,7 @@
               if (!bsConnected[i].get(k)
                   && symmetry.checkDistance(atoms[i], atoms[k], 1.1f, 0, 0, 0,
                       0, ptOffset))
-                addNewBond(i, k);
+                addNewBond(i, k, 1);
             }
         }
     if (!isMolecular)
@@ -2204,9 +2225,10 @@
    * 
    * @param i
    * @param j
+   * @param order 
    */
-  private void addNewBond(int i, int j) {
-    atomSetCollection.addNewBond(i, j);
+  private void addNewBond(int i, int j, int order) {
+    atomSetCollection.addNewBondWithOrder(i, j, order);
     if (!isMolecular)
       return;
     bsConnected[i].set(j);

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java   
2013-08-20 18:23:45 UTC (rev 18607)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java   
2013-08-20 22:43:55 UTC (rev 18608)
@@ -84,15 +84,13 @@
   protected Map<String, Object> htSubsystems;
   
   
-  protected void initializeMod() throws Exception {
+  protected void initializeModulation() throws Exception {
     modDebug = checkFilterKey("MODDEBUG");
     modAxes = getFilter("MODAXES=");
     modType = getFilter("MODTYPE="); //ODU
     modSelected = parseIntStr("" + getFilter("MOD="));
     modVib = checkFilterKey("MODVIB"); // then use MODULATION ON  to see 
modulation
     modAverage = checkFilterKey("MODAVE");
-    if (!modVib && !modAverage)
-      addJmolScript("modulation on");
     checkSpecial = !checkFilterKey("NOSPECIAL");
     atomSetCollection.setCheckSpecial(checkSpecial);
     allowRotations = !checkFilterKey("NOSYM");
@@ -165,6 +163,11 @@
       Logger.debugging = Logger.debuggingHigh = false;
   }
   
+  protected void finalizeModulation() {
+    if (incommensurate && !modVib)
+      addJmolScript("modulation on");
+  }
+
   private String suffix;
   private P3 getMod(String key) {
     return htModulation.get(key + suffix);

Modified: trunk/Jmol/src/org/jmol/adapter/readers/simple/FoldingXyzReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/simple/FoldingXyzReader.java        
2013-08-20 18:23:45 UTC (rev 18607)
+++ trunk/Jmol/src/org/jmol/adapter/readers/simple/FoldingXyzReader.java        
2013-08-20 22:43:55 UTC (rev 18608)
@@ -150,7 +150,7 @@
               }
             }
             if (correct && (destination > origin)) {
-               atomSetCollection.addNewBond(origin, destination);
+               atomSetCollection.addNewBondWithOrder(origin, destination, 1);
             }
           }
         }

Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java        
2013-08-20 18:23:45 UTC (rev 18607)
+++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java        
2013-08-20 22:43:55 UTC (rev 18608)
@@ -46,7 +46,7 @@
   @Override
   public void initializeReader() throws Exception {
       setFractionalCoordinates(true);
-      initializeMod();
+      initializeModulation();
       atomSetCollection.newAtomSet();
   }
   
@@ -123,6 +123,7 @@
       atomSetCollection.getSymmetry().addLatticeVectors(lattvecs);
     applySymmetryAndSetTrajectory();
     setModulation();
+    finalizeModulation();
     finalizeReaderASCR();
   }
   
@@ -221,7 +222,8 @@
     String id = name.substring(0, ipt);
     ipt = id.lastIndexOf("/");
     id = id.substring(ipt + 1);
-    BufferedReader r = JmolBinary.getBufferedReaderForString((String) 
viewer.getLigandModel(id, name, "_file", "----"));
+    BufferedReader r = JmolBinary.getBufferedReaderForString((String) viewer
+        .getLigandModel(id, name, "_file", "----"));
     if (readM40Floats(r).startsWith("command"))
       readM40WaveVectors(r);
     int nAtoms = (int) floats[0];
@@ -229,8 +231,7 @@
       while (readM40Floats(r).length() == 0 || line.charAt(0) == ' '
           || line.charAt(0) == '-') {
       }
-      
-      
+
       Atom atom = new Atom();
       atom.atomName = line.substring(0, 9).trim();
       if (!filterAtom(atom, 0))
@@ -240,9 +241,9 @@
       if (!incommensurate)
         continue;
       String label = ";" + atom.atomName;
-      boolean haveCrenel = (getInt(60, 61) > 0);
-      boolean haveSawTooth = (getInt(61, 62) > 0);
-      boolean haveSomething = (getInt(62, 63) > 0);
+      boolean haveSpecialOcc = (getInt(60, 61) > 0);
+      boolean haveSpecialDisp = (getInt(61, 62) > 0);
+      boolean haveSpecialUij = (getInt(62, 63) > 0);
       int nOcc = getInt(65, 68);
       int nDisp = getInt(68, 71);
       int nUij = getInt(71, 74);
@@ -265,12 +266,12 @@
 
       // read occupancy parameters
       P3 pt;
-      if (nOcc > 0 && !haveCrenel)
+      if (nOcc > 0 && !haveSpecialOcc)
         r.readLine(); //"1.00000"
       int wv = 0;
       float a1, a2;
       for (int j = 0; j < nOcc; j++) {
-        if (haveCrenel) {
+        if (haveSpecialOcc) {
           float[][] data = readM40FloatLines(2, 1, r);
           a1 = data[1][0];
           a2 = data[0][0];
@@ -278,17 +279,17 @@
           wv = j + 1;
           readM40Floats(r);
           a1 = floats[1];
-          a2 = floats[0];          
+          a2 = floats[0];
         }
-        id = "O_" + wv + "#0" + label;        
+        id = "O_" + wv + "#0" + label;
         pt = P3.new3(a1, a2, 0);
         if (a1 != 0 || a2 != 0)
           addModulation(null, id, pt, -1);
       }
-      
+
       // read displacement data
       for (int j = 0; j < nDisp; j++) {
-        if (haveSawTooth) {
+        if (haveSpecialDisp) {
           readM40Floats(r);
           float c = floats[3];
           float w = floats[4];
@@ -308,11 +309,16 @@
           // fourier?
           addSinCos(j, "U_", label, r);
         } else {
-          float[][] data = readM40FloatLines(2, 6, r);
-          for (int k = 0, p = 0; k < 6; k++, p+=3)
-            addModulation(null, "U_" + (j + 1) + "#"
-                + U_LIST.substring(p, p + 3) + label, P3.new3(data[1][k],
-                data[0][k], 0), -1);
+          if (haveSpecialUij) {
+            //TODO
+            Logger.error("JanaReader -- not interpreting SpecialUij flag: " + 
line);
+          } else {
+            float[][] data = readM40FloatLines(2, 6, r);
+            for (int k = 0, p = 0; k < 6; k++, p += 3)
+              addModulation(null, "U_" + (j + 1) + "#"
+                  + U_LIST.substring(p, p + 3) + label, P3.new3(data[1][k],
+                  data[0][k], 0), -1);
+          }
         }
       }
     }

Modified: trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java      
2013-08-20 18:23:45 UTC (rev 18607)
+++ trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java      
2013-08-20 22:43:55 UTC (rev 18608)
@@ -644,14 +644,6 @@
     mapMostRecentAtomSerialNumber();
   }
 
-  public Bond addNewBond(int atomIndex1, int atomIndex2) {
-    return addNewBondWithOrder(atomIndex1, atomIndex2, 1);
-  }
-
-  Bond addNewSingleBondFromNames(String atomName1, String atomName2) {
-    return addNewBondFromNames(atomName1, atomName2, 1);
-  }
-
   public Bond addNewBondWithOrder(int atomIndex1, int atomIndex2, int order) {
     if (atomIndex1 < 0 || atomIndex1 >= atomCount ||
         atomIndex2 < 0 || atomIndex2 >= atomCount)

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-08-20 18:23:45 UTC 
(rev 18607)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-08-20 22:43:55 UTC 
(rev 18608)
@@ -11,8 +11,9 @@
 #  The quotes above look odd for a parameter file, but they are 
 #  important for the JavaScript version of Jmol.
 
-___JmolVersion="13.3.4_dev_2013.08.20"
+___JmolVersion="13.3.4_dev_2013.08.20c"
 
+bug fix: CIF reader not reading _CCDC_GEOM_BOND_TYPE record
 bug fix: File dialog problems with paths having space
 bug fix: GAMESS reader not reading energies
 bug fix: TRY failure in a load command followed by a successful load 

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


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to