|
@@ -16,6 +16,7 @@ import { Vec3, Mat4 } from '../../../../../mol-math/linear-algebra';
|
|
|
import StructureElement from '../../element';
|
|
|
import { StructConn } from '../../../../../mol-model-formats/structure/mmcif/bonds';
|
|
|
import { ElementIndex } from '../../../model/indexing';
|
|
|
+import { getInterBondOrderFromTable } from '../../../../../mol-model/structure/model/properties/atomic/bonds';
|
|
|
|
|
|
const MAX_RADIUS = 4;
|
|
|
|
|
@@ -52,13 +53,18 @@ function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComput
|
|
|
const state: PairState = { mapAB: new Map(), mapBA: new Map(), bondedA: UniqueArray.create(), bondedB: UniqueArray.create() };
|
|
|
let bondCount = 0;
|
|
|
|
|
|
- const { elements: atomsA } = unitA;
|
|
|
+ const { elements: atomsA, residueIndex: residueIndexA } = unitA;
|
|
|
const { x: xA, y: yA, z: zA } = unitA.model.atomicConformation;
|
|
|
- const { elements: atomsB } = unitB;
|
|
|
+ const { elements: atomsB, residueIndex: residueIndexB } = unitB;
|
|
|
const atomCount = unitA.elements.length;
|
|
|
|
|
|
- const { type_symbol: type_symbolA, label_alt_id: label_alt_idA } = unitA.model.atomicHierarchy.atoms;
|
|
|
- const { type_symbol: type_symbolB, label_alt_id: label_alt_idB } = unitB.model.atomicHierarchy.atoms;
|
|
|
+ // const { type_symbol: type_symbolA, label_alt_id: label_alt_idA } = unitA.model.atomicHierarchy.atoms;
|
|
|
+ // const { type_symbol: type_symbolB, label_alt_id: label_alt_idB } = unitB.model.atomicHierarchy.atoms;
|
|
|
+ const { type_symbol: type_symbolA, label_alt_id: label_alt_idA, label_atom_id: label_atom_idA } = unitA.model.atomicHierarchy.atoms;
|
|
|
+ const { type_symbol: type_symbolB, label_alt_id: label_alt_idB, label_atom_id: label_atom_idB } = unitB.model.atomicHierarchy.atoms;
|
|
|
+ const { label_comp_id: label_comp_idA } = unitA.model.atomicHierarchy.residues;
|
|
|
+ const { label_comp_id: label_comp_idB } = unitB.model.atomicHierarchy.residues;
|
|
|
+
|
|
|
const { lookup3d } = unitB;
|
|
|
const structConn = unitA.model === unitB.model && unitA.model.sourceData.kind === 'mmCIF' ? StructConn.get(unitA.model) : void 0;
|
|
|
|
|
@@ -104,6 +110,8 @@ function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComput
|
|
|
const thresholdA = getElementThreshold(aeI);
|
|
|
const altA = label_alt_idA.value(aI);
|
|
|
const metalA = MetalsSet.has(aeI);
|
|
|
+ const atomIdA = label_atom_idA.value(aI);
|
|
|
+ const compIdA = label_comp_idA.value(residueIndexA[aI]);
|
|
|
|
|
|
for (let ni = 0; ni < count; ni++) {
|
|
|
const _bI = indices[ni];
|
|
@@ -123,7 +131,12 @@ function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComput
|
|
|
|
|
|
if (isHa || isHb) {
|
|
|
if (dist < props.maxCovalentHydrogenBondingLength) {
|
|
|
- addLink(_aI, _bI, 1, LinkType.Flag.Covalent | LinkType.Flag.Computed, state);
|
|
|
+ addLink(
|
|
|
+ _aI, _bI,
|
|
|
+ 1, // covalent bonds involving a hydrogen are always of order 1
|
|
|
+ LinkType.Flag.Covalent | LinkType.Flag.Computed,
|
|
|
+ state
|
|
|
+ );
|
|
|
bondCount++;
|
|
|
}
|
|
|
continue;
|
|
@@ -135,7 +148,14 @@ function findPairLinks(unitA: Unit.Atomic, unitB: Unit.Atomic, props: LinkComput
|
|
|
: beI < 0 ? thresholdA : Math.max(thresholdA, getElementThreshold(beI));
|
|
|
|
|
|
if (dist <= pairingThreshold) {
|
|
|
- addLink(_aI, _bI, 1, (isMetal ? LinkType.Flag.MetallicCoordination : LinkType.Flag.Covalent) | LinkType.Flag.Computed, state);
|
|
|
+ const atomIdB = label_atom_idB.value(bI);
|
|
|
+ const compIdB = label_comp_idB.value(residueIndexB[bI]);
|
|
|
+ addLink(
|
|
|
+ _aI, _bI,
|
|
|
+ getInterBondOrderFromTable(compIdA, compIdB, atomIdA, atomIdB),
|
|
|
+ (isMetal ? LinkType.Flag.MetallicCoordination : LinkType.Flag.Covalent) | LinkType.Flag.Computed,
|
|
|
+ state
|
|
|
+ );
|
|
|
bondCount++;
|
|
|
}
|
|
|
}
|