Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bayesianem
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
Container registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Riccardo PELLARIN
bayesianem
Commits
50454f43
Commit
50454f43
authored
7 years ago
by
samuel hanot
Browse files
Options
Downloads
Patches
Plain Diff
documentation
parent
4546b5d5
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
pyext/src/restraint.py
+20
-0
20 additions, 0 deletions
pyext/src/restraint.py
with
20 additions
and
0 deletions
pyext/src/restraint.py
+
20
−
0
View file @
50454f43
...
@@ -183,6 +183,9 @@ class GaussianEMRestraintWrapper(object):
...
@@ -183,6 +183,9 @@ class GaussianEMRestraintWrapper(object):
self
.
set_weight
(
weight
)
self
.
set_weight
(
weight
)
def
center_target_density_on_model
(
self
):
def
center_target_density_on_model
(
self
):
'''
aligns the center of mass of the target GMM on the center of mass of the model
'''
target_com
=
IMP
.
algebra
.
Vector3D
(
0
,
0
,
0
)
target_com
=
IMP
.
algebra
.
Vector3D
(
0
,
0
,
0
)
target_mass
=
0.0
target_mass
=
0.0
for
p
in
self
.
target_ps
:
for
p
in
self
.
target_ps
:
...
@@ -228,6 +231,9 @@ class GaussianEMRestraintWrapper(object):
...
@@ -228,6 +231,9 @@ class GaussianEMRestraintWrapper(object):
return
com
return
com
def
center_target_density_on_origin
(
self
):
def
center_target_density_on_origin
(
self
):
'''
aligns the center of mass of the target GMM on the origin
'''
target_com
=
self
.
get_center_of_mass
()
target_com
=
self
.
get_center_of_mass
()
print
(
'
target com
'
,
target_com
)
print
(
'
target com
'
,
target_com
)
model_com
=
IMP
.
algebra
.
Vector3D
(
0
,
0
,
0
)
model_com
=
IMP
.
algebra
.
Vector3D
(
0
,
0
,
0
)
...
@@ -240,6 +246,10 @@ class GaussianEMRestraintWrapper(object):
...
@@ -240,6 +246,10 @@ class GaussianEMRestraintWrapper(object):
# IMP.pmi.tools.translate_hierarchies(self.densities,v)
# IMP.pmi.tools.translate_hierarchies(self.densities,v)
def
center_model_on_target_density
(
self
,
input_object
):
def
center_model_on_target_density
(
self
,
input_object
):
'''
aligns the model on the target density
@param input_objects IMP.pmi.representation.Representation or IMP.pmi.topology.State
'''
if
type
(
input_object
)
is
IMP
.
pmi
.
representation
.
Representation
:
if
type
(
input_object
)
is
IMP
.
pmi
.
representation
.
Representation
:
hier
=
input_object
.
prot
hier
=
input_object
.
prot
elif
type
(
input_object
)
is
IMP
.
pmi
.
topology
.
State
:
elif
type
(
input_object
)
is
IMP
.
pmi
.
topology
.
State
:
...
@@ -271,6 +281,9 @@ class GaussianEMRestraintWrapper(object):
...
@@ -271,6 +281,9 @@ class GaussianEMRestraintWrapper(object):
IMP
.
core
.
transform
(
IMP
.
core
.
XYZ
(
p
),
transformation
)
IMP
.
core
.
transform
(
IMP
.
core
.
XYZ
(
p
),
transformation
)
def
center_on_target_density
(
self
):
def
center_on_target_density
(
self
):
'''
align the model on target GMM
'''
target_com
=
self
.
get_center_of_mass
()
target_com
=
self
.
get_center_of_mass
()
print
(
'
target com
'
,
target_com
)
print
(
'
target com
'
,
target_com
)
model_com
=
self
.
get_center_of_mass
(
target
=
False
)
model_com
=
self
.
get_center_of_mass
(
target
=
False
)
...
@@ -297,6 +310,10 @@ class GaussianEMRestraintWrapper(object):
...
@@ -297,6 +310,10 @@ class GaussianEMRestraintWrapper(object):
def
set_weight
(
self
,
weight
):
def
set_weight
(
self
,
weight
):
'''
set the weight of the restraint
@param weight
'''
self
.
weight
=
weight
self
.
weight
=
weight
self
.
rs
.
set_weight
(
weight
)
self
.
rs
.
set_weight
(
weight
)
...
@@ -324,6 +341,9 @@ class GaussianEMRestraintWrapper(object):
...
@@ -324,6 +341,9 @@ class GaussianEMRestraintWrapper(object):
return
self
.
rb
return
self
.
rb
def
get_density_as_hierarchy
(
self
):
def
get_density_as_hierarchy
(
self
):
'''
returns a hierarchy whose leaves are the gaussian particles of the target GMM
'''
if
self
.
em_root_hier
is
None
:
if
self
.
em_root_hier
is
None
:
self
.
em_root_hier
=
IMP
.
atom
.
Copy
.
setup_particle
(
IMP
.
Particle
(
self
.
m
),
0
)
self
.
em_root_hier
=
IMP
.
atom
.
Copy
.
setup_particle
(
IMP
.
Particle
(
self
.
m
),
0
)
self
.
em_root_hier
.
set_name
(
"
GaussianEMRestraint_density_
"
+
self
.
label
)
self
.
em_root_hier
.
set_name
(
"
GaussianEMRestraint_density_
"
+
self
.
label
)
...
...
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