From 08e92f12d3f9ebc9a3e78097b636589cf1cd22a3 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Fri, 19 Jul 2019 09:42:09 -0700 Subject: [PATCH] improved MolecularSurface calc: projectToriiRange --- src/mol-math/geometry/molecular-surface.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mol-math/geometry/molecular-surface.ts b/src/mol-math/geometry/molecular-surface.ts index 81305f41e..a133e6704 100644 --- a/src/mol-math/geometry/molecular-surface.ts +++ b/src/mol-math/geometry/molecular-surface.ts @@ -291,16 +291,22 @@ export async function calcMolecularSurface(ctx: RuntimeContext, position: Requir } } - async function projectTorii () { - for (let i = 0; i < n; ++i) { + function projectToriiRange (begI: number, endI: number) { + for (let i = begI; i < endI; ++i) { const k = OrderedSet.getAt(indices, i) lookup3d.find(px[k], py[k], pz[k], radius[k]) for (let j = 0, jl = neighbours.count; j < jl; ++j) { const l = OrderedSet.getAt(indices, neighbours.indices[j]) if (k < l) projectTorus(k, l) } + } + } - if (i % updateChunk === 0 && ctx.shouldUpdate) { + async function projectTorii() { + for (let i = 0; i < n; i += updateChunk) { + projectToriiRange(i, Math.min(i + updateChunk, n)) + + if (ctx.shouldUpdate) { await ctx.update({ message: 'projecting torii', current: i, max: n }) } } -- GitLab