From d597f1e88c0a0516ff0488c2a8c26560415b855b Mon Sep 17 00:00:00 2001 From: David Sehnal <david.sehnal@gmail.com> Date: Thu, 9 Nov 2017 21:34:46 +0100 Subject: [PATCH] Higher tolerance for "symmetry operators" --- src/mol-math/geometry/symmetry-operator.ts | 4 +++- src/perf-tests/structure.ts | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mol-math/geometry/symmetry-operator.ts b/src/mol-math/geometry/symmetry-operator.ts index 2e7bfabc8..053113865 100644 --- a/src/mol-math/geometry/symmetry-operator.ts +++ b/src/mol-math/geometry/symmetry-operator.ts @@ -21,10 +21,12 @@ namespace SymmetryOperator { export const DefaultName = '1_555' export const Default: SymmetryOperator = create(DefaultName, Mat4.identity()); + const RotationEpsilon = 0.0001; + export function create(name: string, matrix: Mat4, hkl?: number[]): SymmetryOperator { const _hkl = hkl ? Vec3.create(hkl[0], hkl[1], hkl[2]) : Vec3.zero(); if (Mat4.isIdentity(matrix)) return { name, matrix, inverse: Mat4.identity(), isIdentity: true, hkl: _hkl }; - if (!Mat4.isRotationAndTranslation(matrix)) throw new Error(`Symmetry operator (${name}) must be a composition of rotation and translation.`); + if (!Mat4.isRotationAndTranslation(matrix, RotationEpsilon)) throw new Error(`Symmetry operator (${name}) must be a composition of rotation and translation.`); return { name, matrix, inverse: Mat4.invert(Mat4.zero(), matrix), isIdentity: false, hkl: _hkl }; } diff --git a/src/perf-tests/structure.ts b/src/perf-tests/structure.ts index 5a7e48b41..9898edf50 100644 --- a/src/perf-tests/structure.ts +++ b/src/perf-tests/structure.ts @@ -241,9 +241,11 @@ export namespace PropertyAccess { console.log(to_mmCIF('test', s)); } - export function testAssembly(s: Structure) { + export function testAssembly(id: string, s: Structure) { + console.time('assembly') const a = Symmetry.buildAssembly(s, '1'); - fs.writeFileSync('e:/test/molstar/1hrv_assembly.cif', to_mmCIF('test', a, false)); + console.timeEnd('assembly') + fs.writeFileSync(`e:/test/molstar/${id}_assembly.bcif`, to_mmCIF(id, a, true)); console.log('exported'); //write(a); } @@ -252,12 +254,12 @@ export namespace PropertyAccess { //const { structures, models, mmcif } = await readCIF('./examples/1cbs_full.bcif'); //const { structures, models, mmcif } = await readCIF('e:/test/quick/3j3q_full.bcif'); //const { structures, models, mmcif } = await readCIF('e:/test/quick/1cbs_updated.cif'); - const { structures, models/*, mmcif*/ } = await readCIF('e:/test/quick/1hrv_updated.cif'); + const { structures, models/*, mmcif*/ } = await readCIF('e:/test/quick/5j7v_updated.cif'); //console.log(mmcif.pdbx_struct_oper_list.matrix.toArray()); // console.log(mmcif.pdbx_struct_oper_list.vector.toArray()); - testAssembly(structures[0]); + testAssembly('5j7v', structures[0]); throw ''; console.log(models[0].symmetry.assemblies); -- GitLab