Revision: 20801
          http://sourceforge.net/p/jmol/code/20801
Author:   hansonr
Date:     2015-10-01 06:12:01 +0000 (Thu, 01 Oct 2015)
Log Message:
-----------
JmolVersion="14.3.16_2015.09.30"

new feature: calculate hydrogen TRUE
 -- calculates hydrogen and multiple bonding

bug fix: calculate aromatic should not touch atoms with 4 groups or H atoms
bug fix: calculate hydrogen should consider backbone N sp2.

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
    trunk/Jmol/src/org/jmol/modelset/BondCollection.java
    trunk/Jmol/src/org/jmol/modelset/ModelSet.java
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/viewer/JC.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2015-09-29 
21:53:26 UTC (rev 20800)
+++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2015-10-01 
06:12:01 UTC (rev 20801)
@@ -1301,7 +1301,8 @@
             // 2 bonds needed R2C or R-N or R2C=C or O
             //                    or RC=C or C=C
             boolean isEne = (hybridization == 2 || atomicNumber == 5 || nBonds 
== 1
-                && targetValence == 4 || atomicNumber == 7 && 
isAdjacentSp2(atom));
+                && targetValence == 4 
+                || atomicNumber == 7 && isAdjacentSp2(atom));
             getHybridizationAndAxes(i, atomicNumber, z, x, (isEne ? "sp2b"
                 : targetValence == 3 ? "sp3c" : "lpa"), false, true);
             pt = P3.newP(z);
@@ -1332,7 +1333,8 @@
                 continue;
               }
               if (getHybridizationAndAxes(i, atomicNumber, z, x, 
(hybridization == 2 || atomicNumber == 5 
-                  || atomicNumber == 7 && isAdjacentSp2(atom) 
+                  || atomicNumber == 7 
+                  && (atom.group.getNitrogenAtom() == atom || 
isAdjacentSp2(atom))
                   ? "sp2c"
                   : "sp3d"), true, false) != null) {
                 pt = P3.newP(z);

Modified: trunk/Jmol/src/org/jmol/modelset/BondCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/BondCollection.java        2015-09-29 
21:53:26 UTC (rev 20800)
+++ trunk/Jmol/src/org/jmol/modelset/BondCollection.java        2015-10-01 
06:12:01 UTC (rev 20801)
@@ -478,15 +478,26 @@
     Bond bond;
     isAll = (bsBonds == null);
     i0 = (isAll ? bondCount - 1 : bsBonds.nextSetBit(0));
+    BS bsTest = new BS();
     for (int i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit(i + 1))) {
         bond = bo[i];
         if (!bond.is(Edge.BOND_AROMATIC)
             || bsAromaticDouble.get(i) || bsAromaticSingle.get(i))
           continue;
-        if (!assignAromaticDouble(bond))
-          assignAromaticSingle(bond);
-        System.out.println(bond + " "+ bond.order);
+        bsTest.set(i);
+        if (bond.atom1.getElementNumber() == 8 || 
bond.atom2.getElementNumber() == 8) {
+          if (!assignAromaticDouble(bond))
+            assignAromaticSingle(bond);
+        } else {
+          bsTest.set(i);
+        }
       }
+    // now test non-O atoms
+    for (int i = bsTest.nextSetBit(0); i >= 0; i = bsTest.nextSetBit(i + 1)) {
+      bond = bo[i];
+      if (!assignAromaticDouble(bond))
+        assignAromaticSingle(bond);
+    }
     // all done: do the actual assignments and clear arrays.
     for (int i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit(i + 1))) {
         bond = bo[i];
@@ -642,10 +653,11 @@
     case 6: // C
       return (nAtoms == 4);
     case 7: // N
+      return (atom.group.getNitrogenAtom() == atom || nAtoms == 3 && 
atom.getFormalCharge() < 1);
     case 8: // O
-      return (nAtoms == 10 - n && atom.getFormalCharge() < 1);
+      return (atom.group.getCarbonylOxygenAtom() != atom && nAtoms == 2 && 
atom.getFormalCharge() < 1);
     case 16: // S
-      return (nAtoms == 18 - n && atom.getFormalCharge() < 1);
+      return (atom.group.groupID == JC.GROUPID_CYSTEINE || nAtoms == 2 && 
atom.getFormalCharge() < 1);
     }
     return false;
   }

Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-09-29 21:53:26 UTC 
(rev 20800)
+++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-10-01 06:12:01 UTC 
(rev 20801)
@@ -2404,6 +2404,7 @@
     Atom atomB = null;
     char altloc = '\0';
     short newOrder = (short) (order | Edge.BOND_NEW);
+    boolean isAromatic = ((order & Edge.BOND_AROMATIC_MASK) != 0);
     try {
       for (int i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) {
         if (isBonds) {
@@ -2434,7 +2435,11 @@
           if ((bondAB == null ? idOrModifyOnly : createOnly)
               || checkDistance
               && !isInRange(atomA, atomB, minD, maxD, minDIsFrac, maxDIsFrac,
-                  isFractional))
+                  isFractional)
+              || isAromatic 
+              && (atomA.getElementNumber() == 1 || 
atomA.getCovalentBondCount() > 3
+                   || atomB.getElementNumber() == 1 || 
atomB.getCovalentBondCount() > 3)    
+              )
             continue;
           if (bondAB == null) {
             bsBonds.set(bondAtoms(atomA, atomB, order, mad, bsBonds, energy,

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-09-29 21:53:26 UTC 
(rev 20800)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-10-01 06:12:01 UTC 
(rev 20801)
@@ -643,10 +643,21 @@
           eval.report(GT.i(GT._("{0} hydrogen bonds"), Math.abs(n)));
         return;
       case T.hydrogen:
-        bs1 = (slen == 2 ? null : atomExpressionAt(2));
+        boolean andBond = (tokAt(2) == T.on);
+        if (andBond)
+          eval.iToken++;
+        bs1 = (slen == (andBond ? 3 : 2) ? null : atomExpressionAt(andBond ? 3 
 : 2));
         eval.checkLast(eval.iToken);
-        if (!chk)
+        if (!chk) {
           vwr.addHydrogens(bs1, false, false);
+          if (andBond) {
+            if (bs1 == null)
+              bs1 = vwr.bsA();
+            vwr.makeConnections(0.1f, 1e8f, Edge.BOND_AROMATIC,
+                T.modify, bs1, bs1, null, false, false, 0);
+            vwr.ms.assignAromaticBondsBs(true, null);            
+          }
+        }
         return;
       case T.partialcharge:
         eval.iToken = 1;

Modified: trunk/Jmol/src/org/jmol/viewer/JC.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/JC.java      2015-09-29 21:53:26 UTC (rev 
20800)
+++ trunk/Jmol/src/org/jmol/viewer/JC.java      2015-10-01 06:12:01 UTC (rev 
20801)
@@ -620,7 +620,8 @@
     // structure related
     //
     "@alpha _a=2", // rasmol doc says "approximately *.CA" - whatever?
-    "@backbone 
protein&(_a>=1&_a<6|_a>=64&_a<72)|nucleic&(_a>=6&_a<14|_a>=72)",    
+    "@bbone0 protein&(_a>=1&_a<6|_a>=64&_a<72)|nucleic&(_a>=6&_a<14|_a>=72)", 
// may or may not include H    
+    "@backbone back_bone | _H && connected(single, bbone0)",    
     "@spine protein&_a>=1&_a<4|nucleic&_a>=6&_a<14&_a!=12",
     "@sidechain (protein,nucleic) & !backbone",
     "@base nucleic & !backbone",

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-09-29 21:53:26 UTC 
(rev 20800)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-10-01 06:12:01 UTC 
(rev 20801)
@@ -65,18 +65,27 @@
 
 bug fix: draw ramachandran broken
 
+JmolVersion="14.3.16_2015.09.30"
 
+new feature: calculate hydrogen TRUE
+ -- calculates hydrogen and multiple bonding
+
+bug fix: calculate aromatic should not touch atoms with 4 groups or H atoms
+bug fix: calculate hydrogen should consider backbone N sp2.
+
 JmolVersion="14.3.16_2015.09.29"
 
 note: I am using "map" for "associative array" now
  
 new feature: mapOfMaps.array(k)
- -- generates an array of maps from a map of maps by storing all map keys 
under key k
+ -- generates an array of maps from a map of maps by 
+    storing all top-level map keys under key k in lower-level map
  -- reversed by another .array(k) 
  -- causes a script exception if mapOfMaps is not a map of maps
 
 new feature: arrayOfMaps.array(k)
- -- generates a map of maps from an array of maps by retrieving each map's key 
k as the key for that map
+ -- generates a map of maps from an array of maps by 
+    removing each map's key k and using that as the key for that map value 
  -- reversed by another .array(k) 
  -- causes a script exception if arrayOfMaps is not an array of maps or key k 
is not present in all maps
 

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