|
@@ -14,6 +14,7 @@ import { SortedArray } from '../../../../../mol-data/int';
|
|
|
import { StructConn, ComponentBond } from '../../../../../mol-model-formats/structure/mmcif/bonds';
|
|
|
import { getIntraBondOrderFromTable } from '../../../model/properties/atomic/bonds';
|
|
|
import StructureElement from '../../element';
|
|
|
+import { IndexPairBonds } from '../../../../../mol-model-formats/structure/mmcif/bonds/index-pair';
|
|
|
|
|
|
function getGraph(atomA: StructureElement.UnitIndex[], atomB: StructureElement.UnitIndex[], _order: number[], _flags: number[], atomCount: number): IntraUnitBonds {
|
|
|
const builder = new IntAdjacencyGraph.EdgeBuilder(atomCount, atomA, atomB);
|
|
@@ -40,6 +41,7 @@ function _computeBonds(unit: Unit.Atomic, props: BondComputationProps): IntraUni
|
|
|
|
|
|
const structConn = unit.model.sourceData.kind === 'mmCIF' ? StructConn.get(unit.model) : void 0;
|
|
|
const component = unit.model.sourceData.kind === 'mmCIF' ? ComponentBond.get(unit.model) : void 0;
|
|
|
+ const indexPairs = IndexPairBonds.get(unit.model)
|
|
|
|
|
|
const atomA: StructureElement.UnitIndex[] = [];
|
|
|
const atomB: StructureElement.UnitIndex[] = [];
|
|
@@ -51,6 +53,33 @@ function _computeBonds(unit: Unit.Atomic, props: BondComputationProps): IntraUni
|
|
|
|
|
|
for (let _aI = 0 as StructureElement.UnitIndex; _aI < atomCount; _aI++) {
|
|
|
const aI = atoms[_aI];
|
|
|
+
|
|
|
+ if (!props.forceCompute && indexPairs) {
|
|
|
+ for (let i = indexPairs.offset[aI], il = indexPairs.offset[aI + 1]; i < il; ++i) {
|
|
|
+ const _bI = SortedArray.indexOf(unit.elements, indexPairs.b[i]) as StructureElement.UnitIndex;
|
|
|
+ if (_bI < 0) continue;
|
|
|
+ atomA[atomA.length] = _aI;
|
|
|
+ atomB[atomB.length] = _bI;
|
|
|
+ order[order.length] = indexPairs.edgeProps.order[i];
|
|
|
+ flags[flags.length] = BondType.Flag.Covalent;
|
|
|
+ }
|
|
|
+ continue // assume `indexPairs` supplies all bonds
|
|
|
+ }
|
|
|
+
|
|
|
+ const structConnEntries = props.forceCompute ? void 0 : structConn && structConn.getAtomEntries(aI);
|
|
|
+ if (structConnEntries) {
|
|
|
+ for (const se of structConnEntries) {
|
|
|
+ for (const p of se.partners) {
|
|
|
+ const _bI = SortedArray.indexOf(unit.elements, p.atomIndex) as StructureElement.UnitIndex;
|
|
|
+ if (_bI < 0) continue;
|
|
|
+ atomA[atomA.length] = _aI;
|
|
|
+ atomB[atomB.length] = _bI;
|
|
|
+ flags[flags.length] = se.flags;
|
|
|
+ order[order.length] = se.order;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const raI = residueIndex[aI];
|
|
|
const compId = label_comp_id.value(raI);
|
|
|
|
|
@@ -72,22 +101,6 @@ function _computeBonds(unit: Unit.Atomic, props: BondComputationProps): IntraUni
|
|
|
const thresholdA = getElementThreshold(aeI);
|
|
|
const altA = label_alt_id.value(aI);
|
|
|
const metalA = MetalsSet.has(aeI);
|
|
|
- const structConnEntries = props.forceCompute ? void 0 : structConn && structConn.getAtomEntries(aI);
|
|
|
-
|
|
|
- if (structConnEntries) {
|
|
|
- for (const se of structConnEntries) {
|
|
|
- if (se.distance > MAX_RADIUS) continue;
|
|
|
-
|
|
|
- for (const p of se.partners) {
|
|
|
- const _bI = SortedArray.indexOf(unit.elements, p.atomIndex) as StructureElement.UnitIndex;
|
|
|
- if (_bI < 0) continue;
|
|
|
- atomA[atomA.length] = _aI;
|
|
|
- atomB[atomB.length] = _bI;
|
|
|
- flags[flags.length] = se.flags;
|
|
|
- order[order.length] = se.order;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
for (let ni = 0; ni < count; ni++) {
|
|
|
const _bI = indices[ni];
|