From 6b874786a850b4d9acc078c47b4118631cbfb3a8 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Thu, 15 Aug 2019 16:07:58 -0700 Subject: [PATCH] only extract CrossLinkRestraints when needed --- .../structure/unit/pair-restraints/extract-cross-links.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mol-model/structure/structure/unit/pair-restraints/extract-cross-links.ts b/src/mol-model/structure/structure/unit/pair-restraints/extract-cross-links.ts index 85ce85c8e..146528327 100644 --- a/src/mol-model/structure/structure/unit/pair-restraints/extract-cross-links.ts +++ b/src/mol-model/structure/structure/unit/pair-restraints/extract-cross-links.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ @@ -89,6 +89,7 @@ function createCrossLinkRestraint(unitA: Unit, indexA: StructureElement.UnitInde function extractCrossLinkRestraints(structure: Structure): PairRestraints<CrossLinkRestraint> { const pairs: CrossLinkRestraint[] = [] + if (!structure.models.some(m => IHMCrossLinkRestraint.fromModel(m))) return new PairRestraints(pairs) const n = structure.units.length for (let i = 0; i < n; ++i) { @@ -96,7 +97,9 @@ function extractCrossLinkRestraints(structure: Structure): PairRestraints<CrossL extractIntra(pairs, unitA) for (let j = i + 1; j < n; ++j) { const unitB = structure.units[j] - extractInter(pairs, unitA, unitB) + if (unitA.model === unitB.model) { + extractInter(pairs, unitA, unitB) + } } } -- GitLab