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
4e20cd11
Commit
4e20cd11
authored
9 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Ignore missing beads - for DNA with issue
#2
parent
83346152
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.py
+1
-1
1 addition, 1 deletion
pycgtool.py
pycgtool/bondset.py
+2
-0
2 additions, 0 deletions
pycgtool/bondset.py
pycgtool/mapping.py
+6
-3
6 additions, 3 deletions
pycgtool/mapping.py
pycgtool/util.py
+12
-6
12 additions, 6 deletions
pycgtool/util.py
with
21 additions
and
10 deletions
pycgtool.py
+
1
−
1
View file @
4e20cd11
...
@@ -38,7 +38,7 @@ def main(args):
...
@@ -38,7 +38,7 @@ def main(args):
for
mol
in
bonds
:
for
mol
in
bonds
:
print
(
"
Bonds in {0}:
"
.
format
(
mol
))
print
(
"
Bonds in {0}:
"
.
format
(
mol
))
for
bond
in
bonds
[
mol
]:
for
bond
in
bonds
[
mol
]:
print
(
bond
.
eqm
,
bond
.
fconst
)
print
(
len
(
bond
.
values
),
bond
.
eqm
,
bond
.
fconst
)
bonds
.
write_itp
(
"
out.itp
"
,
mapping
=
mapping
)
bonds
.
write_itp
(
"
out.itp
"
,
mapping
=
mapping
)
ff
=
ForceField
(
"
fftest.ff
"
)
ff
=
ForceField
(
"
fftest.ff
"
)
...
...
This diff is collapsed.
Click to expand it.
pycgtool/bondset.py
+
2
−
0
View file @
4e20cd11
...
@@ -3,6 +3,8 @@ import numpy as np
...
@@ -3,6 +3,8 @@ import numpy as np
from
.util
import
stat_moments
,
sliding
from
.util
import
stat_moments
,
sliding
from
.parsers.cfg
import
CFG
from
.parsers.cfg
import
CFG
np
.
seterr
(
all
=
"
raise
"
)
class
Bond
:
class
Bond
:
__slots__
=
[
"
atoms
"
,
"
atom_numbers
"
,
"
values
"
,
"
eqm
"
,
"
fconst
"
]
__slots__
=
[
"
atoms
"
,
"
atom_numbers
"
,
"
values
"
,
"
eqm
"
,
"
fconst
"
]
...
...
This diff is collapsed.
Click to expand it.
pycgtool/mapping.py
+
6
−
3
View file @
4e20cd11
...
@@ -3,6 +3,8 @@ import numpy as np
...
@@ -3,6 +3,8 @@ import numpy as np
from
.frame
import
Atom
,
Residue
,
Frame
from
.frame
import
Atom
,
Residue
,
Frame
from
.parsers.cfg
import
CFG
from
.parsers.cfg
import
CFG
np
.
seterr
(
all
=
"
raise
"
)
class
BeadMap
:
class
BeadMap
:
__slots__
=
[
"
name
"
,
"
typ
"
,
"
type
"
,
"
atoms
"
,
"
charge
"
,
"
mass
"
]
__slots__
=
[
"
name
"
,
"
typ
"
,
"
type
"
,
"
atoms
"
,
"
charge
"
,
"
mass
"
]
...
@@ -84,9 +86,10 @@ class Mapping:
...
@@ -84,9 +86,10 @@ class Mapping:
try
:
try
:
bead
.
coords
/=
n
bead
.
coords
/=
n
except
FloatingPointError
:
except
FloatingPointError
:
raise
EmptyBeadError
(
"
Bead {0} in molecule {1} contains no atoms.
"
.
format
(
# raise EmptyBeadError("Bead {0} in molecule {1} contains no atoms.".format(
bead
.
name
,
aares
.
name
# bead.name, aares.name
))
# ))
pass
cgframe
.
natoms
+=
1
cgframe
.
natoms
+=
1
cgframe
.
residues
.
append
(
res
)
cgframe
.
residues
.
append
(
res
)
...
...
This diff is collapsed.
Click to expand it.
pycgtool/util.py
+
12
−
6
View file @
4e20cd11
...
@@ -2,23 +2,29 @@ import numpy as np
...
@@ -2,23 +2,29 @@ import numpy as np
np
.
seterr
(
all
=
"
raise
"
)
np
.
seterr
(
all
=
"
raise
"
)
def
stat_moments
(
vals
):
def
stat_moments
(
vals
,
ignore_nan
=
True
):
"""
"""
Return statistical (population) moments of data provided.
Return statistical (population) moments of data provided.
:param vals: The data for which to calculate moments
:param vals: The data for which to calculate moments
:param ignore_nan: Whether to exclude np.nan from calculation
:return: Numpy array of moments - population mean and variance
:return: Numpy array of moments - population mean and variance
"""
"""
if
ignore_nan
:
vals_tmp
=
[
val
for
val
in
vals
if
not
np
.
isnan
(
val
)]
else
:
vals_tmp
=
vals
res
=
np
.
zeros
(
2
)
res
=
np
.
zeros
(
2
)
try
:
try
:
for
val
in
vals
:
for
val
in
vals
_tmp
:
res
[
0
]
+=
val
res
[
0
]
+=
val
mean
=
res
[
0
]
/
len
(
vals
)
mean
=
res
[
0
]
/
len
(
vals
_tmp
)
for
val
in
vals
:
for
val
in
vals
_tmp
:
res
[
1
]
+=
pow
(
val
-
mean
,
2
)
res
[
1
]
+=
pow
(
val
-
mean
,
2
)
res
/=
len
(
vals
)
res
/=
len
(
vals
_tmp
)
return
res
return
res
except
FloatingPointError
:
except
FloatingPointError
:
return
np
.
zeros
(
2
)
return
np
.
zeros
(
2
)
...
@@ -29,7 +35,7 @@ def sliding(vals):
...
@@ -29,7 +35,7 @@ def sliding(vals):
Yield three values in a sliding window along an iterable.
Yield three values in a sliding window along an iterable.
:param vals: Iterable to iterate over
:param vals: Iterable to iterate over
:return:
Iterable
of tuples
:return:
Generator
of tuples
"""
"""
it
=
iter
(
vals
)
it
=
iter
(
vals
)
prev
=
None
prev
=
None
...
...
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