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
86291a97
Commit
86291a97
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
optimized gaussian density cpu more
parent
8547f83f
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-math/geometry/gaussian-density/cpu.ts
+16
-15
16 additions, 15 deletions
src/mol-math/geometry/gaussian-density/cpu.ts
with
16 additions
and
15 deletions
src/mol-math/geometry/gaussian-density/cpu.ts
+
16
−
15
View file @
86291a97
...
...
@@ -46,6 +46,8 @@ export async function GaussianDensityCPU(ctx: RuntimeContext, position: Position
const
idData
=
space
.
create
()
const
idField
=
Tensor
.
create
(
space
,
idData
)
const
iu
=
dim
[
2
],
iv
=
dim
[
1
],
iuv
=
iu
*
iv
const
densData
=
space
.
create
()
const
v
=
Vec3
()
...
...
@@ -67,11 +69,7 @@ export async function GaussianDensityCPU(ctx: RuntimeContext, position: Position
const
invDelta
=
Vec3
.
inverse
(
Vec3
(),
delta
)
const
[
invDeltaX
,
invDeltaY
,
invDeltaZ
]
=
invDelta
let
dx
:
number
,
dy
:
number
,
dz
:
number
let
dxySq
:
number
let
dSq
:
number
// console.time('gaussian density cpu')
console
.
time
(
'
gaussian density cpu
'
)
for
(
let
i
=
0
;
i
<
n
;
++
i
)
{
const
j
=
OrderedSet
.
getAt
(
indices
,
i
)
...
...
@@ -94,19 +92,22 @@ export async function GaussianDensityCPU(ctx: RuntimeContext, position: Position
const
[
endX
,
endY
,
endZ
]
=
Vec3
.
ceil
(
end
,
Vec3
.
add
(
end
,
c
,
rad2
))
for
(
let
xi
=
begX
;
xi
<
endX
;
++
xi
)
{
dx
=
xi
*
invDeltaX
-
vx
const
dx
=
xi
*
invDeltaX
-
vx
const
xIdx
=
xi
*
iuv
for
(
let
yi
=
begY
;
yi
<
endY
;
++
yi
)
{
dy
=
yi
*
invDeltaY
-
vy
dxySq
=
dx
*
dx
+
dy
*
dy
const
dy
=
yi
*
invDeltaY
-
vy
const
dxySq
=
dx
*
dx
+
dy
*
dy
const
xyIdx
=
yi
*
iu
+
xIdx
for
(
let
zi
=
begZ
;
zi
<
endZ
;
++
zi
)
{
dz
=
zi
*
invDeltaZ
-
vz
dSq
=
dxySq
+
dz
*
dz
const
dz
=
zi
*
invDeltaZ
-
vz
const
dSq
=
dxySq
+
dz
*
dz
if
(
dSq
<=
r2sq
)
{
const
dens
=
Math
.
exp
(
-
alpha
*
(
dSq
*
rSqInv
))
space
.
add
(
data
,
xi
,
yi
,
zi
,
dens
)
if
(
dens
>
space
.
get
(
densData
,
xi
,
yi
,
zi
))
{
space
.
set
(
densData
,
xi
,
yi
,
zi
,
dens
)
space
.
set
(
idData
,
xi
,
yi
,
zi
,
i
)
const
idx
=
zi
+
xyIdx
data
[
idx
]
+=
dens
if
(
dens
>
densData
[
idx
])
{
densData
[
idx
]
=
dens
idData
[
idx
]
=
i
}
}
}
...
...
@@ -117,7 +118,7 @@ export async function GaussianDensityCPU(ctx: RuntimeContext, position: Position
await
ctx
.
update
({
message
:
'
filling density grid
'
,
current
:
i
,
max
:
n
})
}
}
//
console.timeEnd('gaussian density cpu')
console
.
timeEnd
(
'
gaussian density cpu
'
)
const
transform
=
Mat4
.
identity
()
Mat4
.
fromScaling
(
transform
,
Vec3
.
inverse
(
Vec3
.
zero
(),
delta
))
...
...
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