Browse Source

fix structure bond count calculation

Alexander Rose 4 years ago
parent
commit
b6514a4a50

+ 1 - 1
src/mol-model/structure/structure/structure.ts

@@ -97,7 +97,7 @@ class Structure {
 
     /** Count of all bonds (intra- and inter-unit) in the structure */
     get bondCount() {
-        if (!this._props.bondCount) {
+        if (this._props.bondCount === -1) {
             this._props.bondCount = this.interUnitBonds.edgeCount + Bond.getIntraUnitBondCount(this);
         }
         return this._props.bondCount;

+ 1 - 1
src/mol-model/structure/structure/unit/bonds.ts

@@ -162,7 +162,7 @@ namespace Bond {
         let count = 0;
         for (let i = 0, il = structure.units.length; i < il; ++i) {
             const u = structure.units[i];
-            if (Unit.isAtomic(u)) count += u.bonds.edgeCount / 2; // only count one direction
+            if (Unit.isAtomic(u)) count += u.bonds.edgeCount;
         }
         return count;
     }