Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
fe3c314c
Commit
fe3c314c
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
use memoize1 for getOperatorsCached333
parent
94031fb6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-model/structure/structure/symmetry.ts
+15
-17
15 additions, 17 deletions
src/mol-model/structure/structure/symmetry.ts
with
15 additions
and
17 deletions
src/mol-model/structure/structure/symmetry.ts
+
15
−
17
View file @
fe3c314c
/**
/**
* Copyright (c) 2017-201
8
mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2017-201
9
mol* contributors, licensed under MIT, See LICENSE file for more info.
*
*
* @author David Sehnal <david.sehnal@gmail.com>
* @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
...
@@ -14,6 +14,7 @@ import Unit from './unit';
...
@@ -14,6 +14,7 @@ import Unit from './unit';
import
{
EquivalenceClasses
}
from
'
mol-data/util
'
;
import
{
EquivalenceClasses
}
from
'
mol-data/util
'
;
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
import
{
SymmetryOperator
,
Spacegroup
,
SpacegroupCell
}
from
'
mol-math/geometry
'
;
import
{
SymmetryOperator
,
Spacegroup
,
SpacegroupCell
}
from
'
mol-math/geometry
'
;
import
{
memoize1
}
from
'
mol-util/memoize
'
;
namespace
StructureSymmetry
{
namespace
StructureSymmetry
{
export
function
buildAssembly
(
structure
:
Structure
,
asmName
:
string
)
{
export
function
buildAssembly
(
structure
:
Structure
,
asmName
:
string
)
{
...
@@ -106,28 +107,25 @@ function getOperators(symmetry: ModelSymmetry, ijkMin: Vec3, ijkMax: Vec3) {
...
@@ -106,28 +107,25 @@ function getOperators(symmetry: ModelSymmetry, ijkMin: Vec3, ijkMax: Vec3) {
return
operators
;
return
operators
;
}
}
function
getOperatorsCached333
(
symmetry
:
ModelSymmetry
)
{
const
getOperatorsCached333
=
memoize1
((
symmetry
:
ModelSymmetry
)
=>
{
const
operators
:
SymmetryOperator
[]
=
symmetry
.
_operators_333
||
[];
const
ijkMin
=
Vec3
.
create
(
-
3
,
-
3
,
-
3
)
const
ijkMax
=
Vec3
.
create
(
3
,
3
,
3
)
const
operators
:
SymmetryOperator
[]
=
[];
const
{
spacegroup
}
=
symmetry
;
const
{
spacegroup
}
=
symmetry
;
if
(
operators
.
length
===
0
)
{
operators
[
0
]
=
Spacegroup
.
getSymmetryOperator
(
spacegroup
,
0
,
0
,
0
,
0
)
const
ijkMin
=
Vec3
.
create
(
-
3
,
-
3
,
-
3
)
for
(
let
op
=
0
;
op
<
spacegroup
.
operators
.
length
;
op
++
)
{
const
ijkMax
=
Vec3
.
create
(
3
,
3
,
3
)
for
(
let
i
=
ijkMin
[
0
];
i
<
ijkMax
[
0
];
i
++
)
{
operators
[
0
]
=
Spacegroup
.
getSymmetryOperator
(
spacegroup
,
0
,
0
,
0
,
0
)
for
(
let
j
=
ijkMin
[
1
];
j
<
ijkMax
[
1
];
j
++
)
{
for
(
let
op
=
0
;
op
<
spacegroup
.
operators
.
length
;
op
++
)
{
for
(
let
k
=
ijkMin
[
2
];
k
<
ijkMax
[
2
];
k
++
)
{
for
(
let
i
=
ijkMin
[
0
];
i
<
ijkMax
[
0
];
i
++
)
{
// we have added identity as the 1st operator.
for
(
let
j
=
ijkMin
[
1
];
j
<
ijkMax
[
1
];
j
++
)
{
if
(
op
===
0
&&
i
===
0
&&
j
===
0
&&
k
===
0
)
continue
;
for
(
let
k
=
ijkMin
[
2
];
k
<
ijkMax
[
2
];
k
++
)
{
operators
[
operators
.
length
]
=
Spacegroup
.
getSymmetryOperator
(
spacegroup
,
op
,
i
,
j
,
k
);
// we have added identity as the 1st operator.
if
(
op
===
0
&&
i
===
0
&&
j
===
0
&&
k
===
0
)
continue
;
operators
[
operators
.
length
]
=
Spacegroup
.
getSymmetryOperator
(
spacegroup
,
op
,
i
,
j
,
k
);
}
}
}
}
}
}
}
symmetry
.
_operators_333
=
operators
;
}
}
return
operators
;
return
operators
;
}
}
)
function
assembleOperators
(
structure
:
Structure
,
operators
:
ReadonlyArray
<
SymmetryOperator
>
)
{
function
assembleOperators
(
structure
:
Structure
,
operators
:
ReadonlyArray
<
SymmetryOperator
>
)
{
const
assembler
=
Structure
.
Builder
();
const
assembler
=
Structure
.
Builder
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment