Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mrdna
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tbgl
tools
mrdna
Commits
6dcc8f64
Commit
6dcc8f64
authored
7 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Made neighborhood for bead model backmapping dynamically increase if needed
parent
72bfa8fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beadModel.py
+14
-7
14 additions, 7 deletions
beadModel.py
beadModelTwist.py
+14
-7
14 additions, 7 deletions
beadModelTwist.py
with
28 additions
and
14 deletions
beadModel.py
+
14
−
7
View file @
6dcc8f64
...
...
@@ -690,20 +690,27 @@ class beadModel():
helixCutoff
=
dsDnaHelixNeighborDist
if
b
.
type
[
0
]
==
'
d
'
else
ssDnaHelixNeighborDist
allCutoff
=
dsDnaAllNeighborDist
if
b
.
type
[
0
]
==
'
d
'
else
ssDnaAllNeighborDist
def
positionsAreLinear
(
pos
):
if
len
(
pos
)
==
0
:
return
False
center
=
np
.
mean
(
pos
,
axis
=
0
)
cPos
=
pos
-
center
return
np
.
sum
(
np
.
abs
(
np
.
linalg
.
eig
(
cPos
.
T
.
dot
(
cPos
)
)[
0
]
)
>
1e-3
)
==
3
ids
=
[]
attempts
=
0
while
len
(
ids
)
<=
3
:
posOld
=
[]
while
len
(
ids
)
<=
3
or
not
positionsAreLinear
(
posOld
):
if
attempts
>
15
:
raise
Exception
(
"
Too many attempts to find a neighborhood for backmaping bead %d
"
%
b
.
idx
)
ids
=
simplerModel
.
_getNeighborhoodIds
(
b
,
simplerModelCoords
,
helixCutoff
,
allCutoff
)
posOld
=
np
.
array
(
[
simplerModel
.
particles
[
i
][
0
].
initialPosition
for
i
in
ids
]
)
allCutoff
*=
1.2
attempts
+=
1
posOld
=
np
.
array
(
[
simplerModel
.
particles
[
i
][
0
].
initialPosition
for
i
in
ids
]
)
if
attempts
>
1
:
print
(
"
Warning, increased allCutoff to
"
,
allCutoff
)
posNew
=
np
.
array
(
[
simplerModelCoords
[
i
]
for
i
in
ids
]
)
try
:
trans
[
b
.
idx
]
=
minimizeRmsd
(
posOld
,
posNew
)
except
:
raise
Error
(
"
Crapola
"
)
# print("ugly")
trans
[
b
.
idx
]
=
minimizeRmsd
(
posOld
,
posNew
)
## Optionally smooth orientations
...
...
This diff is collapsed.
Click to expand it.
beadModelTwist.py
+
14
−
7
View file @
6dcc8f64
...
...
@@ -762,20 +762,27 @@ class beadModelTwist():
helixCutoff
=
dsDnaHelixNeighborDist
if
b
.
type
[
0
]
in
(
'
d
'
,
'
O
'
)
else
ssDnaHelixNeighborDist
allCutoff
=
dsDnaAllNeighborDist
if
b
.
type
[
0
]
in
(
'
d
'
,
'
O
'
)
else
ssDnaAllNeighborDist
def
positionsAreLinear
(
pos
):
if
len
(
pos
)
==
0
:
return
False
center
=
np
.
mean
(
pos
,
axis
=
0
)
cPos
=
pos
-
center
return
np
.
sum
(
np
.
abs
(
np
.
linalg
.
eig
(
cPos
.
T
.
dot
(
cPos
)
)[
0
]
)
>
1e-3
)
==
3
ids
=
[]
attempts
=
0
while
len
(
ids
)
<=
3
:
posOld
=
[]
while
len
(
ids
)
<=
3
or
not
positionsAreLinear
(
posOld
):
if
attempts
>
15
:
raise
Exception
(
"
Too many attempts to find a neighborhood for backmaping bead %d
"
%
b
.
idx
)
ids
=
simplerModel
.
_getNeighborhoodIds
(
b
,
simplerModelCoords
,
helixCutoff
,
allCutoff
)
posOld
=
np
.
array
(
[
simplerModel
.
particles
[
i
][
0
].
initialPosition
for
i
in
ids
]
)
allCutoff
*=
1.2
attempts
+=
1
posOld
=
np
.
array
(
[
simplerModel
.
particles
[
i
][
0
].
initialPosition
for
i
in
ids
]
)
if
attempts
>
1
:
print
(
"
Warning, increased allCutoff to
"
,
allCutoff
)
posNew
=
np
.
array
(
[
simplerModelCoords
[
i
]
for
i
in
ids
]
)
try
:
trans
[
b
.
idx
]
=
minimizeRmsd
(
posOld
,
posNew
)
except
:
raise
Exception
(
"
Failed to find orientation of atom %d in the coarser model
"
%
b
.
idx
)
# print("ugly")
trans
[
b
.
idx
]
=
minimizeRmsd
(
posOld
,
posNew
)
## Optionally smooth orientations
...
...
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