Skip to content
Snippets Groups Projects
Commit cad44a07 authored by David Sehnal's avatar David Sehnal
Browse files

Fixed inter-unit bond computation for transformed units

parent 73c64407
Branches
Tags
No related merge requests found
...@@ -14,11 +14,11 @@ import { ModelPropertyDescriptor } from '../../../properties/custom'; ...@@ -14,11 +14,11 @@ import { ModelPropertyDescriptor } from '../../../properties/custom';
import { mmCIF_Database, mmCIF_Schema } from 'mol-io/reader/cif/schema/mmcif'; import { mmCIF_Database, mmCIF_Schema } from 'mol-io/reader/cif/schema/mmcif';
import { SortedArray } from 'mol-data/int'; import { SortedArray } from 'mol-data/int';
import { CifWriter } from 'mol-io/writer/cif' import { CifWriter } from 'mol-io/writer/cif'
import { ElementIndex } from '../../../indexing'; import { ElementIndex, ResidueIndex } from '../../../indexing';
export interface StructConn { export interface StructConn {
getResidueEntries(residueAIndex: number, residueBIndex: number): ReadonlyArray<StructConn.Entry>, getResidueEntries(residueAIndex: ResidueIndex, residueBIndex: ResidueIndex): ReadonlyArray<StructConn.Entry>,
getAtomEntries(atomIndex: number): ReadonlyArray<StructConn.Entry>, getAtomEntries(atomIndex: ElementIndex): ReadonlyArray<StructConn.Entry>,
readonly entries: ReadonlyArray<StructConn.Entry> readonly entries: ReadonlyArray<StructConn.Entry>
} }
...@@ -117,11 +117,11 @@ export namespace StructConn { ...@@ -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; 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; return this.getAtomIndex().get(atomIndex) || _emptyEntry;
} }
...@@ -134,7 +134,7 @@ export namespace StructConn { ...@@ -134,7 +134,7 @@ export namespace StructConn {
distance: number, distance: number,
order: number, order: number,
flags: 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 type StructConnType = typeof mmCIF_Schema.struct_conn.conn_type_id.T
......
...@@ -153,11 +153,13 @@ function findLinks(structure: Structure, params: LinkComputationParameters) { ...@@ -153,11 +153,13 @@ function findLinks(structure: Structure, params: LinkComputationParameters) {
if (!structure.units.some(u => Unit.isAtomic(u))) return new InterUnitBonds(map); if (!structure.units.some(u => Unit.isAtomic(u))) return new InterUnitBonds(map);
const lookup = structure.lookup3d; const lookup = structure.lookup3d;
const imageCenter = Vec3.zero();
for (const unit of structure.units) { for (const unit of structure.units) {
if (!Unit.isAtomic(unit)) continue; if (!Unit.isAtomic(unit)) continue;
const bs = unit.lookup3d.boundary.sphere; 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++) { for (let i = 0; i < closeUnits.count; i++) {
const other = structure.units[closeUnits.indices[i]]; const other = structure.units[closeUnits.indices[i]];
if (!Unit.isAtomic(other) || unit.id >= other.id) continue; if (!Unit.isAtomic(other) || unit.id >= other.id) continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment