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

new feature: calculate hydrogens TRUE
 -- calculates hydrogens and multiple bonding
 -- same as 
 
    calculate hydrogens
    connect aromatic modify
    calculate aromatic
    
 -- similar to, but not identical to set pdbAddHydrogens
 -- allows reasonable addition of multiple bonds to proteins after loading

bug fix: connect aromatic should not touch H atoms or atoms with 4 or more 
covalent bonds
bug fix: calculate hydrogen should consider backbone N sp2
bug fix: {backbone} should include attached H atoms 
bug fix: calculate hydrogens should not place H atoms on water

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/modelset/Atom.java
    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/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/modelset/Atom.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/Atom.java  2015-10-01 06:15:23 UTC (rev 
20803)
+++ trunk/Jmol/src/org/jmol/modelset/Atom.java  2015-10-01 13:11:38 UTC (rev 
20804)
@@ -444,6 +444,9 @@
       valence = (byte) (nBonds < 0 ? 0 : nBonds < 0xEF ? nBonds : 0xEF);
   }
 
+  /**
+   * return the total bond order for this atom
+   */
   @Override
   public int getValence() {
     if (isDeleted())

Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2015-10-01 
06:15:23 UTC (rev 20803)
+++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2015-10-01 
13:11:38 UTC (rev 20804)
@@ -1236,12 +1236,14 @@
         int targetValence = aaRet[0];
         int hybridization = aaRet[2];
         int nBonds = aaRet[3];
-
+        if (nBonds == 0 && atom.isHetero())
+          continue; // no adding to water
         hAtoms[i] = new P3[n];
         int hPt = 0;
         if (nBonds == 0) {
           switch (n) {
           case 4:
+            // methane
             z.set(0.635f, 0.635f, 0.635f);
             pt = P3.newP(z);
             pt.add(atom);
@@ -1250,6 +1252,7 @@
               vConnect.addLast(atom);
             //$FALL-THROUGH$
           case 3:
+            // nitrogen
             z.set(-0.635f, -0.635f, 0.635f);
             pt = P3.newP(z);
             pt.add(atom);
@@ -1258,6 +1261,7 @@
               vConnect.addLast(atom);
             //$FALL-THROUGH$
           case 2:
+            // oxygen
             z.set(-0.635f, 0.635f, -0.635f);
             pt = P3.newP(z);
             pt.add(atom);

Modified: trunk/Jmol/src/org/jmol/modelset/BondCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/BondCollection.java        2015-10-01 
06:15:23 UTC (rev 20803)
+++ trunk/Jmol/src/org/jmol/modelset/BondCollection.java        2015-10-01 
13:11:38 UTC (rev 20804)
@@ -586,7 +586,7 @@
    */
   private boolean assignAromaticSingleForAtom(Atom atom, int notBondIndex) {
     Bond[] bonds = atom.bonds;
-    if (bonds == null || assignAromaticSingleHetero(atom))
+    if (bonds == null)// || assignAromaticMustBeSingle(atom))
       return false;
     for (int i = bonds.length; --i >= 0;) {
       Bond bond = bonds[i];
@@ -613,7 +613,7 @@
     Bond[] bonds = atom.bonds;
     if (bonds == null)
       return false;
-    boolean haveDouble = assignAromaticSingleHetero(atom);
+    boolean haveDouble = false;//assignAromaticMustBeSingle(atom);
     int lastBond = -1;
     for (int i = bonds.length; --i >= 0;) {
       if (bsAromaticDouble.get(bonds[i].index))
@@ -636,7 +636,20 @@
     return haveDouble;
   } 
   
-  private boolean assignAromaticSingleHetero(Atom atom) {
+  protected boolean allowAromaticBond(Bond b) {
+    if (assignAromaticMustBeSingle(b.atom1)
+        || assignAromaticMustBeSingle(b.atom2))
+      return false;
+    switch (b.getCovalentOrder()) {
+    case Edge.BOND_COVALENT_SINGLE:
+    case Edge.BOND_COVALENT_DOUBLE:
+      return b.atom1.getCovalentBondCount() <= 3 && 
b.atom2.getCovalentBondCount() <= 3;
+    default:
+      return false;
+    }
+  }
+  
+  private boolean assignAromaticMustBeSingle(Atom atom) {
     // only C N O S may be a problematic:
     int n = atom.getElementNumber();
     switch (n) {

Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-10-01 06:15:23 UTC 
(rev 20803)
+++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-10-01 13:11:38 UTC 
(rev 20804)
@@ -2436,9 +2436,7 @@
               || checkDistance
               && !isInRange(atomA, atomB, minD, maxD, minDIsFrac, maxDIsFrac,
                   isFractional)
-              || isAromatic 
-              && (atomA.getElementNumber() == 1 || 
atomA.getCovalentBondCount() > 3
-                   || atomB.getElementNumber() == 1 || 
atomB.getCovalentBondCount() > 3)    
+              || isAromatic && !allowAromaticBond(bondAB)
               )
             continue;
           if (bondAB == null) {

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-10-01 06:15:23 UTC 
(rev 20803)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-10-01 13:11:38 UTC 
(rev 20804)
@@ -75,10 +75,13 @@
     connect aromatic modify
     calculate aromatic
     
+ -- similar to, but not identical to set pdbAddHydrogens
+ -- allows reasonable addition of multiple bonds to proteins after loading
 
-bug fix: calculate aromatic should not touch atoms with 4 groups or H atoms
+bug fix: connect aromatic should not touch H atoms or atoms with 4 or more 
covalent bonds
 bug fix: calculate hydrogen should consider backbone N sp2
 bug fix: {backbone} should include attached H atoms 
+bug fix: calculate hydrogens should not place H atoms on water
 
 JmolVersion="14.3.16_2015.09.29"
 

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