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
8dd142fc
Commit
8dd142fc
authored
Sep 11, 2019
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
fixed ellipsoids with three identical eigenvalues (render sphere)
parent
97f24293
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-repr/structure/visual/ellipsoid-mesh.ts
+15
-9
15 additions, 9 deletions
src/mol-repr/structure/visual/ellipsoid-mesh.ts
with
15 additions
and
9 deletions
src/mol-repr/structure/visual/ellipsoid-mesh.ts
+
15
−
9
View file @
8dd142fc
...
@@ -14,10 +14,12 @@ import { Theme } from '../../../mol-theme/theme';
...
@@ -14,10 +14,12 @@ import { Theme } from '../../../mol-theme/theme';
import
{
Mesh
}
from
'
../../../mol-geo/geometry/mesh/mesh
'
;
import
{
Mesh
}
from
'
../../../mol-geo/geometry/mesh/mesh
'
;
import
{
sphereVertexCount
}
from
'
../../../mol-geo/primitive/sphere
'
;
import
{
sphereVertexCount
}
from
'
../../../mol-geo/primitive/sphere
'
;
import
{
MeshBuilder
}
from
'
../../../mol-geo/geometry/mesh/mesh-builder
'
;
import
{
MeshBuilder
}
from
'
../../../mol-geo/geometry/mesh/mesh-builder
'
;
import
{
Vec3
,
Mat3
,
Tensor
}
from
'
../../../mol-math/linear-algebra
'
;
import
{
Vec3
,
Mat3
,
Tensor
,
EPSILON
}
from
'
../../../mol-math/linear-algebra
'
;
import
{
isHydrogen
}
from
'
../../../mol-repr/structure/visual/util/common
'
;
import
{
isHydrogen
}
from
'
../../../mol-repr/structure/visual/util/common
'
;
import
{
addEllipsoid
}
from
'
../../../mol-geo/geometry/mesh/builder/ellipsoid
'
;
import
{
addEllipsoid
}
from
'
../../../mol-geo/geometry/mesh/builder/ellipsoid
'
;
import
{
AtomSiteAnisotrop
}
from
'
../../../mol-model-formats/structure/mmcif/anisotropic
'
import
{
AtomSiteAnisotrop
}
from
'
../../../mol-model-formats/structure/mmcif/anisotropic
'
import
{
equalEps
}
from
'
../../../mol-math/linear-algebra/3d/common
'
;
import
{
addSphere
}
from
'
../../../mol-geo/geometry/mesh/builder/sphere
'
;
export
const
EllipsoidMeshParams
=
{
export
const
EllipsoidMeshParams
=
{
...
UnitsMeshParams
,
...
UnitsMeshParams
,
...
@@ -65,9 +67,9 @@ export function createEllipsoidMesh(ctx: VisualContext, unit: Unit, structure: S
...
@@ -65,9 +67,9 @@ export function createEllipsoidMesh(ctx: VisualContext, unit: Unit, structure: S
const
v
=
Vec3
()
const
v
=
Vec3
()
const
m
=
Mat3
()
const
m
=
Mat3
()
const
eig
en
val
ue
s
=
Vec3
()
const
eigvals
=
Vec3
()
const
eig
en
vec
tor
1
=
Vec3
()
const
eigvec1
=
Vec3
()
const
eig
en
vec
tor
2
=
Vec3
()
const
eigvec2
=
Vec3
()
const
{
elementToAnsiotrop
,
data
}
=
atomSiteAnisotrop
const
{
elementToAnsiotrop
,
data
}
=
atomSiteAnisotrop
const
{
U
}
=
data
const
{
U
}
=
data
const
space
=
data
.
_schema
.
U
.
space
const
space
=
data
.
_schema
.
U
.
space
...
@@ -87,17 +89,21 @@ export function createEllipsoidMesh(ctx: VisualContext, unit: Unit, structure: S
...
@@ -87,17 +89,21 @@ export function createEllipsoidMesh(ctx: VisualContext, unit: Unit, structure: S
builderState
.
currentGroup
=
i
builderState
.
currentGroup
=
i
Tensor
.
toMat3
(
m
,
space
,
U
.
value
(
ai
))
Tensor
.
toMat3
(
m
,
space
,
U
.
value
(
ai
))
Mat3
.
symmtricFromLower
(
m
,
m
)
Mat3
.
symmtricFromLower
(
m
,
m
)
Mat3
.
symmetricEigenvalues
(
eig
en
val
ue
s
,
m
)
Mat3
.
symmetricEigenvalues
(
eigvals
,
m
)
Mat3
.
eigenvector
(
eig
en
vec
tor
1
,
m
,
eig
en
val
ue
s
[
1
])
Mat3
.
eigenvector
(
eigvec1
,
m
,
eigvals
[
1
])
Mat3
.
eigenvector
(
eig
en
vec
tor
2
,
m
,
eig
en
val
ue
s
[
2
])
Mat3
.
eigenvector
(
eigvec2
,
m
,
eigvals
[
2
])
for
(
let
j
=
0
;
j
<
3
;
++
j
)
{
for
(
let
j
=
0
;
j
<
3
;
++
j
)
{
// show 50% probability surface, needs sqrt as U matrix is in angstrom-squared
// show 50% probability surface, needs sqrt as U matrix is in angstrom-squared
// take abs of eigenvalue to avoid reflection
// take abs of eigenvalue to avoid reflection
// multiply by given size-factor
// multiply by given size-factor
eig
en
val
ue
s
[
j
]
=
sizeFactor
*
1.5958
*
Math
.
sqrt
(
Math
.
abs
(
eig
en
val
ue
s
[
j
]))
eigvals
[
j
]
=
sizeFactor
*
1.5958
*
Math
.
sqrt
(
Math
.
abs
(
eigvals
[
j
]))
}
}
addEllipsoid
(
builderState
,
v
,
eigenvector2
,
eigenvector1
,
eigenvalues
,
detail
)
if
(
equalEps
(
eigvals
[
0
],
eigvals
[
1
],
EPSILON
)
&&
equalEps
(
eigvals
[
1
],
eigvals
[
2
],
EPSILON
))
{
addSphere
(
builderState
,
v
,
eigvals
[
0
],
detail
)
}
else
{
addEllipsoid
(
builderState
,
v
,
eigvec2
,
eigvec1
,
eigvals
,
detail
)
}
}
}
return
MeshBuilder
.
getMesh
(
builderState
)
return
MeshBuilder
.
getMesh
(
builderState
)
...
...
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