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
e43a88a7
Commit
e43a88a7
authored
8 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Force constant infinity if variance zero
parent
874f8888
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
pycgtool/bondset.py
+3
-2
3 additions, 2 deletions
pycgtool/bondset.py
pycgtool/mapping.py
+2
-1
2 additions, 1 deletion
pycgtool/mapping.py
pycgtool/pycgtool.py
+6
-0
6 additions, 0 deletions
pycgtool/pycgtool.py
test/test_bondset.py
+1
-1
1 addition, 1 deletion
test/test_bondset.py
with
12 additions
and
4 deletions
pycgtool/bondset.py
+
3
−
2
View file @
e43a88a7
...
@@ -26,7 +26,7 @@ class Bond:
...
@@ -26,7 +26,7 @@ class Bond:
"""
"""
Class holding the properties of a single bonded term.
Class holding the properties of a single bonded term.
Bond lengths, angles and dihedrals are all equivalent, distinguised by the number of atoms present.
Bond lengths, angles and dihedrals are all equivalent, distinguis
h
ed by the number of atoms present.
"""
"""
__slots__
=
[
"
atoms
"
,
"
atom_numbers
"
,
"
values
"
,
"
eqm
"
,
"
fconst
"
]
__slots__
=
[
"
atoms
"
,
"
atom_numbers
"
,
"
values
"
,
"
eqm
"
,
"
fconst
"
]
...
@@ -69,7 +69,8 @@ class Bond:
...
@@ -69,7 +69,8 @@ class Bond:
try
:
try
:
self
.
fconst
=
conv
[
len
(
self
.
atoms
)]()
self
.
fconst
=
conv
[
len
(
self
.
atoms
)]()
except
FloatingPointError
:
except
FloatingPointError
:
self
.
fconst
=
0
# Happens when variance is 0, i.e. infinitely sharp peak
self
.
fconst
=
float
(
"
inf
"
)
def
r_squared
(
self
):
def
r_squared
(
self
):
raise
NotImplementedError
(
"
Bond r-squared is not yet implemented
"
)
raise
NotImplementedError
(
"
Bond r-squared is not yet implemented
"
)
...
...
This diff is collapsed.
Click to expand it.
pycgtool/mapping.py
+
2
−
1
View file @
e43a88a7
...
@@ -155,6 +155,7 @@ class Mapping:
...
@@ -155,6 +155,7 @@ class Mapping:
aa_residues
=
(
aares
for
aares
in
frame
if
select_predicate
(
aares
))
aa_residues
=
(
aares
for
aares
in
frame
if
select_predicate
(
aares
))
if
cgframe
is
None
:
if
cgframe
is
None
:
# Frame needs initialising
aa_residues
=
list
(
aa_residues
)
aa_residues
=
list
(
aa_residues
)
cgframe
=
self
.
_cg_frame_setup
(
aa_residues
,
frame
.
name
)
cgframe
=
self
.
_cg_frame_setup
(
aa_residues
,
frame
.
name
)
...
@@ -177,7 +178,7 @@ class Mapping:
...
@@ -177,7 +178,7 @@ class Mapping:
if
self
.
_map_center
==
"
mass
"
:
if
self
.
_map_center
==
"
mass
"
:
e
.
args
=
(
"
Error with mapping type
'
mass
'
, did you provide an itp file?
"
,)
e
.
args
=
(
"
Error with mapping type
'
mass
'
, did you provide an itp file?
"
,)
else
:
else
:
e
.
args
=
(
"
Error, unknown mapping type
'
{0}
'
"
.
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
,
cgframe
.
box
,
weights
)
...
...
This diff is collapsed.
Click to expand it.
pycgtool/pycgtool.py
+
6
−
0
View file @
e43a88a7
...
@@ -32,8 +32,14 @@ def main(args, config):
...
@@ -32,8 +32,14 @@ def main(args, config):
cgframe
.
output
(
config
.
output_name
+
"
.gro
"
,
format
=
config
.
output
)
cgframe
.
output
(
config
.
output_name
+
"
.gro
"
,
format
=
config
.
output
)
logger
.
info
(
"
Mapping will be performed
"
)
logger
.
info
(
"
Mapping will be performed
"
)
else
:
else
:
cgframe
=
frame
logger
.
info
(
"
Mapping will not be performed
"
)
logger
.
info
(
"
Mapping will not be performed
"
)
# Only measure bonds from GRO frame if no XTC is provided
# Allows the user to get a topology from a single snapshot
if
args
.
bnd
and
args
.
xtc
is
None
:
bonds
.
apply
(
cgframe
)
# Main loop - perform mapping and measurement on every frame in XTC
# Main loop - perform mapping and measurement on every frame in XTC
def
main_loop
():
def
main_loop
():
nonlocal
cgframe
nonlocal
cgframe
...
...
This diff is collapsed.
Click to expand it.
test/test_bondset.py
+
1
−
1
View file @
e43a88a7
...
@@ -102,4 +102,4 @@ class BondSetTest(unittest.TestCase):
...
@@ -102,4 +102,4 @@ class BondSetTest(unittest.TestCase):
bondset
.
boltzmann_invert
()
bondset
.
boltzmann_invert
()
for
bond
in
bondset
.
get_bond_lengths
(
"
ETH
"
,
True
):
for
bond
in
bondset
.
get_bond_lengths
(
"
ETH
"
,
True
):
self
.
assertAlmostEqual
(
1.
,
bond
.
eqm
)
self
.
assertAlmostEqual
(
1.
,
bond
.
eqm
)
self
.
assertEqual
(
0.
,
bond
.
fconst
)
self
.
assertEqual
(
float
(
"
inf
"
)
,
bond
.
fconst
)
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