Browse Source

fix IndexPairBonds created with wrong count

- needs atom count (not bond count)
Alexander Rose 4 years ago
parent
commit
bb420d0806

+ 1 - 1
src/mol-model-formats/structure/cif-core.ts

@@ -220,7 +220,7 @@ async function getModels(db: CifCore_Database, format: CifCoreFormat, ctx: Runti
                 order: Column.ofIntArray(order),
                 distance: Column.ofFloatArray(dist),
                 flag: Column.ofIntArray(flag)
-            }, count: indexA.length }));
+            }, count: atomCount }));
         }
     }
 

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

@@ -67,7 +67,7 @@ async function getModels(mol: MolFile, ctx: RuntimeContext) {
         const indexA = Column.ofIntArray(Column.mapToArray(bonds.atomIdxA, x => x - 1, Int32Array));
         const indexB = Column.ofIntArray(Column.mapToArray(bonds.atomIdxB, x => x - 1, Int32Array));
         const order = Column.asArrayColumn(bonds.order, Int32Array);
-        const pairBonds = IndexPairBonds.fromData({ pairs: { indexA, indexB, order }, count: bonds.count });
+        const pairBonds = IndexPairBonds.fromData({ pairs: { indexA, indexB, order }, count: atoms.count });
         IndexPairBonds.Provider.set(models.representative, pairBonds);
     }
 

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

@@ -75,7 +75,7 @@ async function getModels(mol2: Mol2File, ctx: RuntimeContext) {
             const indexA = Column.ofIntArray(Column.mapToArray(bonds.origin_atom_id, x => x - 1, Int32Array));
             const indexB = Column.ofIntArray(Column.mapToArray(bonds.target_atom_id, x => x - 1, Int32Array));
             const order = Column.ofIntArray(Column.mapToArray(bonds.bond_type, x => x === 'ar' ? 1 : parseInt(x), Int8Array));
-            const pairBonds = IndexPairBonds.fromData({ pairs: { indexA, indexB, order }, count: bonds.count });
+            const pairBonds = IndexPairBonds.fromData({ pairs: { indexA, indexB, order }, count: atoms.count });
 
             const first = _models.representative;
             IndexPairBonds.Provider.set(first, pairBonds);