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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
de093b54
Commit
de093b54
authored
Sep 3, 2020
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
support origin and model as reference for model unitcell representation
parent
88cd9184
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-plugin-state/transforms/representation.ts
+2
-2
2 additions, 2 deletions
src/mol-plugin-state/transforms/representation.ts
src/mol-repr/shape/model/unitcell.ts
+13
-6
13 additions, 6 deletions
src/mol-repr/shape/model/unitcell.ts
with
15 additions
and
8 deletions
src/mol-plugin-state/transforms/representation.ts
+
2
−
2
View file @
de093b54
...
@@ -702,7 +702,7 @@ const ModelUnitcell3D = PluginStateTransform.BuiltIn({
...
@@ -702,7 +702,7 @@ const ModelUnitcell3D = PluginStateTransform.BuiltIn({
return
Task
.
create
(
'
Model Unit Cell
'
,
async
ctx
=>
{
return
Task
.
create
(
'
Model Unit Cell
'
,
async
ctx
=>
{
const
symmetry
=
ModelSymmetry
.
Provider
.
get
(
a
.
data
);
const
symmetry
=
ModelSymmetry
.
Provider
.
get
(
a
.
data
);
if
(
!
symmetry
)
return
StateObject
.
Null
;
if
(
!
symmetry
)
return
StateObject
.
Null
;
const
data
=
getUnitcellData
(
a
.
data
,
symmetry
);
const
data
=
getUnitcellData
(
a
.
data
,
symmetry
,
params
);
const
repr
=
UnitcellRepresentation
({
webgl
:
plugin
.
canvas3d
?.
webgl
,
...
plugin
.
representation
.
structure
.
themes
},
()
=>
UnitcellParams
);
const
repr
=
UnitcellRepresentation
({
webgl
:
plugin
.
canvas3d
?.
webgl
,
...
plugin
.
representation
.
structure
.
themes
},
()
=>
UnitcellParams
);
await
repr
.
createOrUpdate
(
params
,
data
).
runInContext
(
ctx
);
await
repr
.
createOrUpdate
(
params
,
data
).
runInContext
(
ctx
);
return
new
SO
.
Shape
.
Representation3D
({
repr
,
source
:
a
},
{
label
:
`Unit Cell`
,
description
:
symmetry
.
spacegroup
.
name
});
return
new
SO
.
Shape
.
Representation3D
({
repr
,
source
:
a
},
{
label
:
`Unit Cell`
,
description
:
symmetry
.
spacegroup
.
name
});
...
@@ -713,7 +713,7 @@ const ModelUnitcell3D = PluginStateTransform.BuiltIn({
...
@@ -713,7 +713,7 @@ const ModelUnitcell3D = PluginStateTransform.BuiltIn({
const
symmetry
=
ModelSymmetry
.
Provider
.
get
(
a
.
data
);
const
symmetry
=
ModelSymmetry
.
Provider
.
get
(
a
.
data
);
if
(
!
symmetry
)
return
StateTransformer
.
UpdateResult
.
Null
;
if
(
!
symmetry
)
return
StateTransformer
.
UpdateResult
.
Null
;
const
props
=
{
...
b
.
data
.
repr
.
props
,
...
newParams
};
const
props
=
{
...
b
.
data
.
repr
.
props
,
...
newParams
};
const
data
=
getUnitcellData
(
a
.
data
,
symmetry
);
const
data
=
getUnitcellData
(
a
.
data
,
symmetry
,
props
);
await
b
.
data
.
repr
.
createOrUpdate
(
props
,
data
).
runInContext
(
ctx
);
await
b
.
data
.
repr
.
createOrUpdate
(
props
,
data
).
runInContext
(
ctx
);
b
.
data
.
source
=
a
;
b
.
data
.
source
=
a
;
return
StateTransformer
.
UpdateResult
.
Updated
;
return
StateTransformer
.
UpdateResult
.
Updated
;
...
...
This diff is collapsed.
Click to expand it.
src/mol-repr/shape/model/unitcell.ts
+
13
−
6
View file @
de093b54
...
@@ -29,10 +29,16 @@ interface UnitcellData {
...
@@ -29,10 +29,16 @@ interface UnitcellData {
ref
:
Vec3
ref
:
Vec3
}
}
const
CellRef
=
{
origin
:
'
Origin
'
,
model
:
'
Model
'
};
const
CellParams
=
{
const
CellParams
=
{
...
Mesh
.
Params
,
...
Mesh
.
Params
,
cellColor
:
PD
.
Color
(
ColorNames
.
orange
),
cellColor
:
PD
.
Color
(
ColorNames
.
orange
),
cellScale
:
PD
.
Numeric
(
2
,
{
min
:
0.1
,
max
:
5
,
step
:
0.1
})
cellScale
:
PD
.
Numeric
(
2
,
{
min
:
0.1
,
max
:
5
,
step
:
0.1
}),
ref
:
PD
.
Select
(
'
model
'
,
PD
.
objectToOptions
(
CellRef
),
{
isEssential
:
true
})
};
};
type
MeshParams
=
typeof
CellParams
type
MeshParams
=
typeof
CellParams
...
@@ -98,11 +104,12 @@ function getUnitcellShape(ctx: RuntimeContext, data: UnitcellData, props: Unitce
...
@@ -98,11 +104,12 @@ function getUnitcellShape(ctx: RuntimeContext, data: UnitcellData, props: Unitce
//
//
export
function
getUnitcellData
(
model
:
Model
,
symmetry
:
Symmetry
)
{
export
function
getUnitcellData
(
model
:
Model
,
symmetry
:
Symmetry
,
props
:
UnitcellProps
)
{
return
{
const
ref
=
Vec3
();
symmetry
,
if
(
props
.
ref
===
'
model
'
)
{
ref
:
Vec3
.
transformMat4
(
Vec3
(),
Model
.
getCenter
(
model
),
symmetry
.
spacegroup
.
cell
.
toFractional
)
Vec3
.
transformMat4
(
ref
,
Model
.
getCenter
(
model
),
symmetry
.
spacegroup
.
cell
.
toFractional
);
};
}
return
{
symmetry
,
ref
};
}
}
export
type
UnitcellRepresentation
=
Representation
<
UnitcellData
,
UnitcellParams
>
export
type
UnitcellRepresentation
=
Representation
<
UnitcellData
,
UnitcellParams
>
...
...
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