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
87fee7a9
Commit
87fee7a9
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-model: symmetry generation fix
parent
79ba2fb2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+20
-29
20 additions, 29 deletions
src/mol-model/structure/structure/symmetry.ts
with
20 additions
and
29 deletions
src/mol-model/structure/structure/symmetry.ts
+
20
−
29
View file @
87fee7a9
...
...
@@ -5,16 +5,15 @@
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import
Structure
from
'
./structure
'
import
{
StructureSelection
,
QueryContext
}
from
'
../query
'
import
{
ModelSymmetry
}
from
'
../model
'
import
{
Task
,
RuntimeContext
}
from
'
mol-task
'
;
import
{
SortedArray
}
from
'
mol-data/int
'
;
import
Unit
from
'
./unit
'
;
import
{
EquivalenceClasses
}
from
'
mol-data/util
'
;
import
{
Spacegroup
,
SpacegroupCell
,
SymmetryOperator
}
from
'
mol-math/geometry
'
;
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
;
import
{
SymmetryOperator
,
Spacegroup
,
SpacegroupCell
}
from
'
mol-math/geometry
'
;
import
{
memoize1
}
from
'
mol-util/memoize
'
;
import
{
RuntimeContext
,
Task
}
from
'
mol-task
'
;
import
{
ModelSymmetry
}
from
'
../model
'
;
import
{
QueryContext
,
StructureSelection
}
from
'
../query
'
;
import
Structure
from
'
./structure
'
;
import
Unit
from
'
./unit
'
;
namespace
StructureSymmetry
{
export
function
buildAssembly
(
structure
:
Structure
,
asmName
:
string
)
{
...
...
@@ -93,30 +92,16 @@ namespace StructureSymmetry {
function
getOperators
(
symmetry
:
ModelSymmetry
,
ijkMin
:
Vec3
,
ijkMax
:
Vec3
)
{
const
operators
:
SymmetryOperator
[]
=
[];
const
{
spacegroup
}
=
symmetry
;
if
(
operators
.
length
===
0
)
{
for
(
let
op
=
0
;
op
<
spacegroup
.
operators
.
length
;
op
++
)
{
for
(
let
i
=
ijkMin
[
0
];
i
<
ijkMax
[
0
];
i
++
)
{
for
(
let
j
=
ijkMin
[
1
];
j
<
ijkMax
[
1
];
j
++
)
{
for
(
let
k
=
ijkMin
[
2
];
k
<
ijkMax
[
2
];
k
++
)
{
operators
[
operators
.
length
]
=
Spacegroup
.
getSymmetryOperator
(
spacegroup
,
op
,
i
,
j
,
k
);
}
}
}
}
if
(
ijkMin
[
0
]
<=
0
&&
ijkMax
[
0
]
>=
0
&&
ijkMin
[
1
]
<=
0
&&
ijkMax
[
1
]
>=
0
&&
ijkMin
[
2
]
<=
0
&&
ijkMax
[
2
]
>=
0
)
{
operators
[
0
]
=
Spacegroup
.
getSymmetryOperator
(
spacegroup
,
0
,
0
,
0
,
0
)
}
return
operators
;
}
const
getOperatorsCached333
=
memoize1
((
symmetry
:
ModelSymmetry
)
=>
{
const
ijkMin
=
Vec3
.
create
(
-
3
,
-
3
,
-
3
)
const
ijkMax
=
Vec3
.
create
(
3
,
3
,
3
)
const
operators
:
SymmetryOperator
[]
=
[];
const
{
spacegroup
}
=
symmetry
;
operators
[
0
]
=
Spacegroup
.
getSymmetryOperator
(
spacegroup
,
0
,
0
,
0
,
0
)
for
(
let
op
=
0
;
op
<
spacegroup
.
operators
.
length
;
op
++
)
{
for
(
let
i
=
ijkMin
[
0
];
i
<
ijkMax
[
0
];
i
++
)
{
for
(
let
j
=
ijkMin
[
1
];
j
<
ijkMax
[
1
];
j
++
)
{
for
(
let
k
=
ijkMin
[
2
];
k
<
ijkMax
[
2
];
k
++
)
{
for
(
let
i
=
ijkMin
[
0
];
i
<
=
ijkMax
[
0
];
i
++
)
{
for
(
let
j
=
ijkMin
[
1
];
j
<
=
ijkMax
[
1
];
j
++
)
{
for
(
let
k
=
ijkMin
[
2
];
k
<
=
ijkMax
[
2
];
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
);
...
...
@@ -125,7 +110,13 @@ const getOperatorsCached333 = memoize1((symmetry: ModelSymmetry) => {
}
}
return
operators
;
})
}
function
getOperatorsCached333
(
symmetry
:
ModelSymmetry
)
{
if
(
typeof
symmetry
.
_operators_333
!==
'
undefined
'
)
return
symmetry
.
_operators_333
;
symmetry
.
_operators_333
=
getOperators
(
symmetry
,
Vec3
.
create
(
-
3
,
-
3
,
-
3
),
Vec3
.
create
(
3
,
3
,
3
));
return
symmetry
.
_operators_333
;
}
function
assembleOperators
(
structure
:
Structure
,
operators
:
ReadonlyArray
<
SymmetryOperator
>
)
{
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