diff --git a/src/mol-model/structure/model/formats/mmcif/bonds/struct_conn.ts b/src/mol-model/structure/model/formats/mmcif/bonds/struct_conn.ts index 75a4afa8985b88de915f7256d017a38bf34c989e..3296debcaeed6abf6ab425927f59b78faf1f1e06 100644 --- a/src/mol-model/structure/model/formats/mmcif/bonds/struct_conn.ts +++ b/src/mol-model/structure/model/formats/mmcif/bonds/struct_conn.ts @@ -14,11 +14,11 @@ import { ModelPropertyDescriptor } from '../../../properties/custom'; import { mmCIF_Database, mmCIF_Schema } from 'mol-io/reader/cif/schema/mmcif'; import { SortedArray } from 'mol-data/int'; import { CifWriter } from 'mol-io/writer/cif' -import { ElementIndex } from '../../../indexing'; +import { ElementIndex, ResidueIndex } from '../../../indexing'; export interface StructConn { - getResidueEntries(residueAIndex: number, residueBIndex: number): ReadonlyArray<StructConn.Entry>, - getAtomEntries(atomIndex: number): ReadonlyArray<StructConn.Entry>, + getResidueEntries(residueAIndex: ResidueIndex, residueBIndex: ResidueIndex): ReadonlyArray<StructConn.Entry>, + getAtomEntries(atomIndex: ElementIndex): ReadonlyArray<StructConn.Entry>, readonly entries: ReadonlyArray<StructConn.Entry> } @@ -117,11 +117,11 @@ export namespace StructConn { } - getResidueEntries(residueAIndex: number, residueBIndex: number): ReadonlyArray<StructConn.Entry> { + getResidueEntries(residueAIndex: ResidueIndex, residueBIndex: ResidueIndex): ReadonlyArray<StructConn.Entry> { return this.getResiduePairIndex().get(_resKey(residueAIndex, residueBIndex)) || _emptyEntry; } - getAtomEntries(atomIndex: number): ReadonlyArray<StructConn.Entry> { + getAtomEntries(atomIndex: ElementIndex): ReadonlyArray<StructConn.Entry> { return this.getAtomIndex().get(atomIndex) || _emptyEntry; } @@ -134,7 +134,7 @@ export namespace StructConn { distance: number, order: number, flags: number, - partners: { residueIndex: number, atomIndex: ElementIndex, symmetry: string }[] + partners: { residueIndex: ResidueIndex, atomIndex: ElementIndex, symmetry: string }[] } type StructConnType = typeof mmCIF_Schema.struct_conn.conn_type_id.T diff --git a/src/mol-model/structure/structure/unit/links/inter-compute.ts b/src/mol-model/structure/structure/unit/links/inter-compute.ts index cd8e37397544128778502efe23fa2b664c1009a1..56c354a524ee07961d907815fc362db55b924a3d 100644 --- a/src/mol-model/structure/structure/unit/links/inter-compute.ts +++ b/src/mol-model/structure/structure/unit/links/inter-compute.ts @@ -153,11 +153,13 @@ function findLinks(structure: Structure, params: LinkComputationParameters) { if (!structure.units.some(u => Unit.isAtomic(u))) return new InterUnitBonds(map); const lookup = structure.lookup3d; + const imageCenter = Vec3.zero(); for (const unit of structure.units) { if (!Unit.isAtomic(unit)) continue; const bs = unit.lookup3d.boundary.sphere; - const closeUnits = lookup.findUnitIndices(bs.center[0], bs.center[1], bs.center[2], bs.radius + MAX_RADIUS); + Vec3.transformMat4(imageCenter, bs.center, unit.conformation.operator.matrix); + const closeUnits = lookup.findUnitIndices(imageCenter[0], imageCenter[1], imageCenter[2], bs.radius + MAX_RADIUS); for (let i = 0; i < closeUnits.count; i++) { const other = structure.units[closeUnits.indices[i]]; if (!Unit.isAtomic(other) || unit.id >= other.id) continue;