|
@@ -33,11 +33,11 @@ namespace Unit {
|
|
export function isSpheres(u: Unit): u is Spheres { return u.kind === Kind.Spheres; }
|
|
export function isSpheres(u: Unit): u is Spheres { return u.kind === Kind.Spheres; }
|
|
export function isGaussians(u: Unit): u is Gaussians { return u.kind === Kind.Gaussians; }
|
|
export function isGaussians(u: Unit): u is Gaussians { return u.kind === Kind.Gaussians; }
|
|
|
|
|
|
- export function create(id: number, invariantId: number, chainGroupId: number, kind: Kind, model: Model, operator: SymmetryOperator, elements: StructureElement.Set): Unit {
|
|
|
|
|
|
+ export function create(id: number, invariantId: number, chainGroupId: number, multiChain: boolean, kind: Kind, model: Model, operator: SymmetryOperator, elements: StructureElement.Set): Unit {
|
|
switch (kind) {
|
|
switch (kind) {
|
|
- case Kind.Atomic: return new Atomic(id, invariantId, chainGroupId, model, elements, SymmetryOperator.createMapping(operator, model.atomicConformation, void 0), AtomicProperties());
|
|
|
|
- case Kind.Spheres: return createCoarse(id, invariantId, chainGroupId, model, Kind.Spheres, elements, SymmetryOperator.createMapping(operator, model.coarseConformation.spheres, getSphereRadiusFunc(model)), CoarseProperties());
|
|
|
|
- case Kind.Gaussians: return createCoarse(id, invariantId, chainGroupId, model, Kind.Gaussians, elements, SymmetryOperator.createMapping(operator, model.coarseConformation.gaussians, getGaussianRadiusFunc(model)), CoarseProperties());
|
|
|
|
|
|
+ case Kind.Atomic: return new Atomic(id, invariantId, chainGroupId, multiChain, model, elements, SymmetryOperator.createMapping(operator, model.atomicConformation, void 0), AtomicProperties());
|
|
|
|
+ case Kind.Spheres: return createCoarse(id, invariantId, chainGroupId, multiChain, model, Kind.Spheres, elements, SymmetryOperator.createMapping(operator, model.coarseConformation.spheres, getSphereRadiusFunc(model)), CoarseProperties());
|
|
|
|
+ case Kind.Gaussians: return createCoarse(id, invariantId, chainGroupId, multiChain, model, Kind.Gaussians, elements, SymmetryOperator.createMapping(operator, model.coarseConformation.gaussians, getGaussianRadiusFunc(model)), CoarseProperties());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -99,6 +99,7 @@ namespace Unit {
|
|
/** invariant ID stays the same even if the Operator/conformation changes. */
|
|
/** invariant ID stays the same even if the Operator/conformation changes. */
|
|
readonly invariantId: number,
|
|
readonly invariantId: number,
|
|
readonly chainGroupId: number,
|
|
readonly chainGroupId: number,
|
|
|
|
+ readonly multiChain: boolean,
|
|
readonly elements: StructureElement.Set,
|
|
readonly elements: StructureElement.Set,
|
|
readonly model: Model,
|
|
readonly model: Model,
|
|
readonly conformation: SymmetryOperator.ArrayMapping<ElementIndex>,
|
|
readonly conformation: SymmetryOperator.ArrayMapping<ElementIndex>,
|
|
@@ -142,6 +143,7 @@ namespace Unit {
|
|
readonly invariantId: number;
|
|
readonly invariantId: number;
|
|
/** Used to identify a single chain split into multiple units. */
|
|
/** Used to identify a single chain split into multiple units. */
|
|
readonly chainGroupId: number;
|
|
readonly chainGroupId: number;
|
|
|
|
+ readonly multiChain: boolean;
|
|
readonly elements: StructureElement.Set;
|
|
readonly elements: StructureElement.Set;
|
|
readonly model: Model;
|
|
readonly model: Model;
|
|
readonly conformation: SymmetryOperator.ArrayMapping<ElementIndex>;
|
|
readonly conformation: SymmetryOperator.ArrayMapping<ElementIndex>;
|
|
@@ -155,12 +157,12 @@ namespace Unit {
|
|
|
|
|
|
getChild(elements: StructureElement.Set): Unit {
|
|
getChild(elements: StructureElement.Set): Unit {
|
|
if (elements.length === this.elements.length) return this;
|
|
if (elements.length === this.elements.length) return this;
|
|
- return new Atomic(this.id, this.invariantId, this.chainGroupId, this.model, elements, this.conformation, AtomicProperties());
|
|
|
|
|
|
+ return new Atomic(this.id, this.invariantId, this.chainGroupId, this.multiChain, this.model, elements, this.conformation, AtomicProperties());
|
|
}
|
|
}
|
|
|
|
|
|
applyOperator(id: number, operator: SymmetryOperator, dontCompose = false): Unit {
|
|
applyOperator(id: number, operator: SymmetryOperator, dontCompose = false): Unit {
|
|
const op = dontCompose ? operator : SymmetryOperator.compose(this.conformation.operator, operator);
|
|
const op = dontCompose ? operator : SymmetryOperator.compose(this.conformation.operator, operator);
|
|
- return new Atomic(id, this.invariantId, this.chainGroupId, this.model, this.elements, SymmetryOperator.createMapping(op, this.model.atomicConformation, this.conformation.r), this.props);
|
|
|
|
|
|
+ return new Atomic(id, this.invariantId, this.chainGroupId, this.multiChain, this.model, this.elements, SymmetryOperator.createMapping(op, this.model.atomicConformation, this.conformation.r), this.props);
|
|
}
|
|
}
|
|
|
|
|
|
get lookup3d() {
|
|
get lookup3d() {
|
|
@@ -224,10 +226,11 @@ namespace Unit {
|
|
return this.model.atomicHierarchy.residueAtomSegments.index[this.elements[elementIndex]];
|
|
return this.model.atomicHierarchy.residueAtomSegments.index[this.elements[elementIndex]];
|
|
}
|
|
}
|
|
|
|
|
|
- constructor(id: number, invariantId: number, chainGroupId: number, model: Model, elements: StructureElement.Set, conformation: SymmetryOperator.ArrayMapping<ElementIndex>, props: AtomicProperties) {
|
|
|
|
|
|
+ constructor(id: number, invariantId: number, chainGroupId: number, multiChain: boolean, model: Model, elements: StructureElement.Set, conformation: SymmetryOperator.ArrayMapping<ElementIndex>, props: AtomicProperties) {
|
|
this.id = id;
|
|
this.id = id;
|
|
this.invariantId = invariantId;
|
|
this.invariantId = invariantId;
|
|
this.chainGroupId = chainGroupId;
|
|
this.chainGroupId = chainGroupId;
|
|
|
|
+ this.multiChain = multiChain;
|
|
this.model = model;
|
|
this.model = model;
|
|
this.elements = elements;
|
|
this.elements = elements;
|
|
this.conformation = conformation;
|
|
this.conformation = conformation;
|
|
@@ -269,6 +272,7 @@ namespace Unit {
|
|
readonly id: number;
|
|
readonly id: number;
|
|
readonly invariantId: number;
|
|
readonly invariantId: number;
|
|
readonly chainGroupId: number;
|
|
readonly chainGroupId: number;
|
|
|
|
+ readonly multiChain: boolean;
|
|
readonly elements: StructureElement.Set;
|
|
readonly elements: StructureElement.Set;
|
|
readonly model: Model;
|
|
readonly model: Model;
|
|
readonly conformation: SymmetryOperator.ArrayMapping<ElementIndex>;
|
|
readonly conformation: SymmetryOperator.ArrayMapping<ElementIndex>;
|
|
@@ -280,12 +284,12 @@ namespace Unit {
|
|
|
|
|
|
getChild(elements: StructureElement.Set): Unit {
|
|
getChild(elements: StructureElement.Set): Unit {
|
|
if (elements.length === this.elements.length) return this as any as Unit /** lets call this an ugly temporary hack */;
|
|
if (elements.length === this.elements.length) return this as any as Unit /** lets call this an ugly temporary hack */;
|
|
- return createCoarse(this.id, this.invariantId, this.chainGroupId, this.model, this.kind, elements, this.conformation, CoarseProperties());
|
|
|
|
|
|
+ return createCoarse(this.id, this.invariantId, this.chainGroupId, this.multiChain, this.model, this.kind, elements, this.conformation, CoarseProperties());
|
|
}
|
|
}
|
|
|
|
|
|
applyOperator(id: number, operator: SymmetryOperator, dontCompose = false): Unit {
|
|
applyOperator(id: number, operator: SymmetryOperator, dontCompose = false): Unit {
|
|
const op = dontCompose ? operator : SymmetryOperator.compose(this.conformation.operator, operator);
|
|
const op = dontCompose ? operator : SymmetryOperator.compose(this.conformation.operator, operator);
|
|
- const ret = createCoarse(id, this.invariantId, this.chainGroupId, this.model, this.kind, this.elements, SymmetryOperator.createMapping(op, this.getCoarseConformation(), this.conformation.r), this.props);
|
|
|
|
|
|
+ const ret = createCoarse(id, this.invariantId, this.chainGroupId, this.multiChain, this.model, this.kind, this.elements, SymmetryOperator.createMapping(op, this.getCoarseConformation(), this.conformation.r), this.props);
|
|
// (ret as Coarse<K, C>)._lookup3d = this._lookup3d;
|
|
// (ret as Coarse<K, C>)._lookup3d = this._lookup3d;
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -314,12 +318,13 @@ namespace Unit {
|
|
return this.kind === Kind.Spheres ? this.model.coarseConformation.spheres : this.model.coarseConformation.gaussians;
|
|
return this.kind === Kind.Spheres ? this.model.coarseConformation.spheres : this.model.coarseConformation.gaussians;
|
|
}
|
|
}
|
|
|
|
|
|
- constructor(id: number, invariantId: number, chainGroupId: number, model: Model, kind: K, elements: StructureElement.Set, conformation: SymmetryOperator.ArrayMapping<ElementIndex>, props: CoarseProperties) {
|
|
|
|
|
|
+ constructor(id: number, invariantId: number, chainGroupId: number, multiChain: boolean, model: Model, kind: K, elements: StructureElement.Set, conformation: SymmetryOperator.ArrayMapping<ElementIndex>, props: CoarseProperties) {
|
|
this.kind = kind;
|
|
this.kind = kind;
|
|
this.objectPrimitive = kind === Kind.Spheres ? 'sphere' : 'gaussian'
|
|
this.objectPrimitive = kind === Kind.Spheres ? 'sphere' : 'gaussian'
|
|
this.id = id;
|
|
this.id = id;
|
|
this.invariantId = invariantId;
|
|
this.invariantId = invariantId;
|
|
this.chainGroupId = chainGroupId;
|
|
this.chainGroupId = chainGroupId;
|
|
|
|
+ this.multiChain = multiChain;
|
|
this.model = model;
|
|
this.model = model;
|
|
this.elements = elements;
|
|
this.elements = elements;
|
|
this.conformation = conformation;
|
|
this.conformation = conformation;
|
|
@@ -343,8 +348,8 @@ namespace Unit {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
- function createCoarse<K extends Kind.Gaussians | Kind.Spheres>(id: number, invariantId: number, chainGroupId: number, model: Model, kind: K, elements: StructureElement.Set, conformation: SymmetryOperator.ArrayMapping<ElementIndex>, props: CoarseProperties): Unit {
|
|
|
|
- return new Coarse(id, invariantId, chainGroupId, model, kind, elements, conformation, props) as any as Unit /** lets call this an ugly temporary hack */;
|
|
|
|
|
|
+ function createCoarse<K extends Kind.Gaussians | Kind.Spheres>(id: number, invariantId: number, chainGroupId: number, multiChain: boolean, model: Model, kind: K, elements: StructureElement.Set, conformation: SymmetryOperator.ArrayMapping<ElementIndex>, props: CoarseProperties): Unit {
|
|
|
|
+ return new Coarse(id, invariantId, chainGroupId, multiChain, model, kind, elements, conformation, props) as any as Unit /** lets call this an ugly temporary hack */;
|
|
}
|
|
}
|
|
|
|
|
|
export class Spheres extends Coarse<Kind.Spheres, CoarseSphereConformation> { }
|
|
export class Spheres extends Coarse<Kind.Spheres, CoarseSphereConformation> { }
|