Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pycgtool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
James Graham
pycgtool
Commits
1909c02c
Commit
1909c02c
authored
8 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Started parallel mapping issue
#10
parent
1621caa9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pycgtool/mapping.py
+28
-19
28 additions, 19 deletions
pycgtool/mapping.py
with
28 additions
and
19 deletions
pycgtool/mapping.py
+
28
−
19
View file @
1909c02c
...
@@ -7,6 +7,8 @@ Each list corresponds to a single molecule.
...
@@ -7,6 +7,8 @@ Each list corresponds to a single molecule.
import
numpy
as
np
import
numpy
as
np
import
warnings
import
warnings
import
itertools
import
multiprocessing
from
.frame
import
Atom
,
Residue
,
Frame
from
.frame
import
Atom
,
Residue
,
Frame
from
.parsers.cfg
import
CFG
from
.parsers.cfg
import
CFG
...
@@ -83,6 +85,8 @@ class Mapping:
...
@@ -83,6 +85,8 @@ class Mapping:
self
.
_map_center
=
options
.
map_center
self
.
_map_center
=
options
.
map_center
# self._pool = multiprocessing.Pool(processes=4)
with
CFG
(
filename
)
as
cfg
:
with
CFG
(
filename
)
as
cfg
:
self
.
_manual_charges
=
{}
self
.
_manual_charges
=
{}
for
mol
in
cfg
:
for
mol
in
cfg
:
...
@@ -179,7 +183,13 @@ class Mapping:
...
@@ -179,7 +183,13 @@ class Mapping:
cgframe
.
number
=
frame
.
number
cgframe
.
number
=
frame
.
number
cgframe
.
box
=
frame
.
box
cgframe
.
box
=
frame
.
box
for
aares
,
cgres
in
zip
(
aa_residues
,
cgframe
):
with
multiprocessing
.
Pool
(
processes
=
1
)
as
pool
:
cgframe
.
residues
=
list
(
pool
.
map
(
self
.
map_one
,
zip
(
aa_residues
,
cgframe
,
itertools
.
repeat
(
cgframe
.
box
))))
return
cgframe
def
map_one
(
self
,
tup
):
aares
,
cgres
,
box
=
tup
molmap
=
self
.
_mappings
[
aares
.
name
]
molmap
=
self
.
_mappings
[
aares
.
name
]
for
i
,
(
bead
,
bmap
)
in
enumerate
(
zip
(
cgres
,
molmap
)):
for
i
,
(
bead
,
bmap
)
in
enumerate
(
zip
(
cgres
,
molmap
)):
...
@@ -187,7 +197,7 @@ class Mapping:
...
@@ -187,7 +197,7 @@ class Mapping:
coords
=
np
.
array
([
aares
[
atom
].
coords
for
atom
in
bmap
],
dtype
=
np
.
float32
)
coords
=
np
.
array
([
aares
[
atom
].
coords
for
atom
in
bmap
],
dtype
=
np
.
float32
)
if
self
.
_map_center
==
"
geom
"
:
if
self
.
_map_center
==
"
geom
"
:
bead
.
coords
=
calc_coords
(
ref_coords
,
coords
,
cgframe
.
box
)
bead
.
coords
=
calc_coords
(
ref_coords
,
coords
,
box
)
else
:
else
:
try
:
try
:
weights
=
bmap
.
weights
[
self
.
_map_center
]
weights
=
bmap
.
weights
[
self
.
_map_center
]
...
@@ -197,10 +207,9 @@ class Mapping:
...
@@ -197,10 +207,9 @@ class Mapping:
else
:
else
:
e
.
args
=
(
"
Error with mapping type
'
{0}
'
, unknown mapping type.
"
.
format
(
e
.
args
[
0
]),)
e
.
args
=
(
"
Error with mapping type
'
{0}
'
, unknown mapping type.
"
.
format
(
e
.
args
[
0
]),)
raise
raise
bead
.
coords
=
calc_coords_weight
(
ref_coords
,
coords
,
cgframe
.
box
,
weights
)
bead
.
coords
=
calc_coords_weight
(
ref_coords
,
coords
,
box
,
weights
)
return
cgframe
return
cgres
@numba.jit
@numba.jit
def
calc_coords_weight
(
ref_coords
,
coords
,
box
,
weights
):
def
calc_coords_weight
(
ref_coords
,
coords
,
box
,
weights
):
...
...
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