Revision: 20977
          http://sourceforge.net/p/jmol/code/20977
Author:   hansonr
Date:     2016-03-03 23:16:34 +0000 (Thu, 03 Mar 2016)
Log Message:
-----------
Jmol.___JmolVersion="14.4.3_2016.03.03b"

bug fix: CIF reader _atom_site_cartn_x incompatible with _geom_bond
 -- this fix now allows Jmol to read very simple CIF files that are equivalent 
to unlimited-atom MOL files
 -- _ccdc_geom_bond_type is not required, defaulting to S
 -- _ccdc_geom_bond_types include S, D, T, Q (quadruple), and A (aromatic) 
         
        data_icosahedron
        loop_
        _atom_site_label
        _atom_site_Cartn_x
        _atom_site_Cartn_y
        _atom_site_Cartn_z
        C01  0.0000000000  0.0000000000  9.5105651630
        C02  8.5065080835  0.0000000000  4.2532540418
        C03  2.6286555606  8.0901699437  4.2532540418
        C04 -6.8819096024  5.0000000000  4.2532540418
        C05 -6.8819096024 -5.0000000000  4.2532540418
        C06  2.6286555606 -8.0901699437  4.2532540418
        C07  6.8819096024  5.0000000000 -4.2532540418
        C08 -2.6286555606  8.0901699437 -4.2532540418
        C09 -8.5065080835  0.0000000000 -4.2532540418
        C10 -2.6286555606 -8.0901699437 -4.2532540418
        C11  6.8819096024 -5.0000000000 -4.2532540418
        C12  0.0000000000  0.0000000000 -9.5105651630
        loop_
        _geom_bond_atom_site_label_1
        _geom_bond_atom_site_label_2
        _ccdc_geom_bond_type
        C01 C02 S
        C01 C03 S
        C01 C04 S
        C01 C05 S
        C01 C06 S
        C02 C03 S
        C03 C04 S
        C04 C05 S
        C05 C06 S
        ...etc... 
         

Modified Paths:
--------------
    branches/v14_4/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java

Modified: branches/v14_4/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java
===================================================================
--- branches/v14_4/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java 
2016-03-03 22:55:43 UTC (rev 20976)
+++ branches/v14_4/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java 
2016-03-03 23:16:34 UTC (rev 20977)
@@ -1539,11 +1539,20 @@
       if (asc.getAtomIndex(name1 = getField(GEOM_BOND_ATOM_SITE_LABEL_1)) < 0
           || asc.getAtomIndex(name2 = getField(GEOM_BOND_ATOM_SITE_LABEL_2)) < 
0)
         continue;
+      int order = getBondOrder(getField(CCDC_GEOM_BOND_TYPE));
       float dx = 0;
       String sdist = getField(GEOM_BOND_DISTANCE);
       float distance = parseFloatStr(sdist);
-      if (distance == 0 || Float.isNaN(distance))
+      if (distance == 0 || Float.isNaN(distance)) {
+        if (!iHaveFractionalCoordinates) {
+          // maybe this is a simple Cartesian file with coordinates and bonds
+          Atom a = asc.getAtomFromName(name1);
+          Atom b = asc.getAtomFromName(name2);
+          if (a != null && b != null)
+            asc.addNewBondWithOrder(a.index, b.index, order);
+        }
         continue;
+      }
       int pt = sdist.indexOf('(');
       if (pt >= 0) {
         char[] data = sdist.toCharArray();
@@ -1564,7 +1573,6 @@
       } else {
         dx = 0.015f;
       }
-      int order = getBondOrder(getField(CCDC_GEOM_BOND_TYPE));
       // This field is from Materials Studio. See supplemental material for
       // http://pubs.rsc.org/en/Content/ArticleLanding/2012/CC/c2cc34714h
       // http://www.rsc.org/suppdata/cc/c2/c2cc34714h/c2cc34714h.txt
@@ -1572,7 +1580,7 @@
       // this 5-model file can be read using one model at a time: load 
"c2cc34714h.txt" 3
       // but it is far from perfect, and still the best way is load 
"c2cc34714h.txt" 3 packed
       bondCount++;
-     bondTypes.addLast(new Object[] { name1, name2, Float.valueOf(distance),
+      bondTypes.addLast(new Object[] { name1, name2, Float.valueOf(distance),
           Float.valueOf(dx), Integer.valueOf(order) });
     }
     if (bondCount > 0) {
@@ -1626,7 +1634,7 @@
         bsSets[ipt] = new BS();
       bsSets[ipt].set(i - firstAtom);
     }
-    
+
     // if molecular, we need atom connection lists and radii
 
     if (isMolecular) {
@@ -1747,7 +1755,7 @@
             addNewBond(j + firstAtom, k + firstAtom, order);
         }
     }
-    
+
     if (!iHaveFractionalCoordinates)
       return false;
 

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


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to