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
60b92471
Commit
60b92471
authored
4 years ago
by
JonStargaryen
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
79e283cf
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/extensions/anvil/algorithm.ts
+4
-18
4 additions, 18 deletions
src/extensions/anvil/algorithm.ts
with
4 additions
and
18 deletions
src/extensions/anvil/algorithm.ts
+
4
−
18
View file @
60b92471
...
...
@@ -73,7 +73,6 @@ function initialize(structure: Structure, props: ANVILProps): ANVILContext {
const
vec
=
Vec3
();
let
m
=
0
;
let
e
=
0
,
b
=
0
;
for
(
let
i
=
0
,
il
=
structure
.
units
.
length
;
i
<
il
;
++
i
)
{
const
unit
=
structure
.
units
[
i
];
const
{
elements
}
=
unit
;
...
...
@@ -105,16 +104,9 @@ function initialize(structure: Structure, props: ANVILProps): ANVILContext {
// keep track of offsets and exposed state to reuse
offsets
[
m
]
=
structure
.
serialMapping
.
getSerialIndex
(
l
.
unit
,
l
.
element
);
exposed
[
m
]
=
AccessibleSurfaceArea
.
getValue
(
l
,
asa
)
/
MaxAsa
[
label_comp_id
(
l
)]
>
asaCutoff
;
if
(
exposed
[
m
])
{
e
++
;
}
else
{
b
++
;
}
m
++
;
}
}
console
.
log
(
'
CAs =
'
+
m
);
console
.
log
(
'
exposed
'
+
e
+
'
- buried
'
+
b
);
// omit potentially empty tail
offsets
=
offsets
.
slice
(
0
,
m
);
...
...
@@ -145,20 +137,16 @@ function initialize(structure: Structure, props: ANVILProps): ANVILContext {
export
async
function
calculate
(
runtime
:
RuntimeContext
,
structure
:
Structure
,
params
:
ANVILProps
):
Promise
<
MembraneOrientation
>
{
const
ctx
=
initialize
(
structure
,
params
);
const
initialHphobHphil
=
HphobHphil
.
filtered
(
ctx
);
console
.
log
(
`init:
${
initialHphobHphil
.
hphob
}
-
${
initialHphobHphil
.
hphil
}
`
);
console
.
log
(
'
sync:
'
+
runtime
.
isSynchronous
);
if
(
runtime
.
shouldUpdate
)
{
await
runtime
.
update
({
message
:
'
Placing initial membrane...
'
});
}
const
initialMembrane
=
findMembrane
(
ctx
,
generateSpherePoints
(
ctx
,
ctx
.
numberOfSpherePoints
),
initialHphobHphil
)
!
;
console
.
log
(
`initial:
${
initialMembrane
.
qmax
}
`
);
if
(
runtime
.
shouldUpdate
)
{
await
runtime
.
update
({
message
:
'
Refining membrane placement...
'
});
}
const
refinedMembrane
=
findMembrane
(
ctx
,
findProximateAxes
(
ctx
,
initialMembrane
),
initialHphobHphil
)
!
;
console
.
log
(
`refined:
${
refinedMembrane
.
qmax
}
`
);
let
membrane
=
initialMembrane
.
qmax
!
>
refinedMembrane
.
qmax
!
?
initialMembrane
:
refinedMembrane
;
if
(
ctx
.
adjust
)
{
...
...
@@ -166,30 +154,29 @@ export async function calculate(runtime: RuntimeContext, structure: Structure, p
await
runtime
.
update
({
message
:
'
Adjusting membrane thickness...
'
});
}
membrane
=
adjustThickness
(
ctx
,
membrane
,
initialHphobHphil
);
console
.
log
(
'
Membrane width:
'
+
Vec3
.
distance
(
membrane
.
planePoint1
,
membrane
.
planePoint2
));
}
const
normalVector
=
Vec3
.
zero
();
const
center
=
Vec3
.
zero
();
const
jitter
=
[
0.001
,
0.001
,
0.001
]
as
Vec3
;
Vec3
.
sub
(
normalVector
,
membrane
.
planePoint1
,
membrane
.
planePoint2
);
Vec3
.
normalize
(
normalVector
,
normalVector
);
// prevent degenerate matrices (e.g., 5cbg - assembly 1 which is oriented along the y-axis)
if
(
Math
.
abs
(
normalVector
[
0
])
===
1
||
Math
.
abs
(
normalVector
[
1
])
===
1
||
Math
.
abs
(
normalVector
[
2
])
===
1
)
{
normalVector
[
0
]
+=
0.001
;
normalVector
[
1
]
+=
0.001
;
normalVector
[
2
]
+=
0.001
;
Vec3
.
add
(
normalVector
,
normalVector
,
jitter
);
}
Vec3
.
add
(
center
,
membrane
.
planePoint1
,
membrane
.
planePoint2
);
Vec3
.
scale
(
center
,
center
,
0.5
);
Vec3
.
add
(
center
,
center
,
jitter
);
const
extent
=
adjustExtent
(
ctx
,
membrane
,
center
);
return
{
planePoint1
:
membrane
.
planePoint1
,
planePoint2
:
membrane
.
planePoint2
,
normalVector
,
centroid
:
c
tx
.
centroid
,
centroid
:
c
enter
,
radius
:
extent
};
}
...
...
@@ -322,7 +309,6 @@ function adjustThickness(ctx: ANVILContext, membrane: MembraneCandidate, initial
maxThickness
-=
step
;
}
console
.
log
(
'
Number of TM segments:
'
+
maxNos
);
return
optimalThickness
;
}
...
...
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