diff --git a/src/extensions/membrane-orientation/representation.ts b/src/extensions/membrane-orientation/representation.ts index b5a571ba2c5a154815a93d4748ff52da6723150a..c4cba9058dbfe58cdcbc5e5f62de58cb863e0790 100644 --- a/src/extensions/membrane-orientation/representation.ts +++ b/src/extensions/membrane-orientation/representation.ts @@ -66,11 +66,12 @@ function getMembraneSpheres(ctx: RuntimeContext, data: Structure, props: Membran } function createMembraneLayer(spheresBuilder: SpheresBuilder, point: Vec3, normalVector: Vec3, density: number, radius: number) { + Vec3.normalize(normalVector, normalVector); const d = -Vec3.dot(normalVector, point); const rep = Vec3(); for (let i = -1000, il = 1000; i < il; i += density) { for (let j = -1000, jl = 1000; j < jl; j += density) { - Vec3.set(rep, i, j, -(d + i * normalVector[0] + j * normalVector[1]) / normalVector[2]); + Vec3.set(rep, i, j, normalVector[2] === 0 ? 0 : -(d + i * normalVector[0] + j * normalVector[1]) / normalVector[2]); if (Vec3.squaredDistance(rep, point) < radius) { spheresBuilder.add(rep[0], rep[1], rep[2], 0); } diff --git a/src/mol-model-props/computed/membrane-orientation/ANVIL.ts b/src/mol-model-props/computed/membrane-orientation/ANVIL.ts index 57159a4c62e62cb6205b4eac1597ff0a9e91454c..b40e5dccf239c448f0e0cf11c7c9070e5fd87f29 100644 --- a/src/mol-model-props/computed/membrane-orientation/ANVIL.ts +++ b/src/mol-model-props/computed/membrane-orientation/ANVIL.ts @@ -160,7 +160,7 @@ namespace MembraneCandidate { } function findMembrane(ctx: ANVILContext, spherePoints: Vec3[], initialStats: HphobHphil, label_comp_id: StructureElement.Property<string>): MembraneCandidate { - const { centroid, stepSize, maxThickness } = ctx; + const { centroid, stepSize, minThickness, maxThickness } = ctx; // best performing membrane let membrane: MembraneCandidate; // score of the best performing membrane @@ -186,7 +186,7 @@ function findMembrane(ctx: ANVILContext, spherePoints: Vec3[], initialStats: Hph qvartemp.push(MembraneCandidate.initial(c1, c2, stats)); } - let jmax = (maxThickness / stepSize) - 1; // TODO should be minThickness but causes weird results if actually in place + let jmax = (minThickness / stepSize) - 1; for (let width = 0, widthl = maxThickness; width < widthl;) { const imax = qvartemp.length - 1 - jmax;