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
661ac418
Commit
661ac418
authored
9 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Added logging to main module
parent
c02ddb7a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pycgtool.py
+20
-2
20 additions, 2 deletions
pycgtool.py
pycgtool/interface.py
+1
-0
1 addition, 0 deletions
pycgtool/interface.py
with
21 additions
and
2 deletions
pycgtool.py
+
20
−
2
View file @
661ac418
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
argparse
import
argparse
import
sys
import
sys
import
logging
from
pycgtool.frame
import
Frame
from
pycgtool.frame
import
Frame
from
pycgtool.mapping
import
Mapping
from
pycgtool.mapping
import
Mapping
...
@@ -9,6 +10,8 @@ from pycgtool.bondset import BondSet
...
@@ -9,6 +10,8 @@ from pycgtool.bondset import BondSet
from
pycgtool.forcefield
import
ForceField
from
pycgtool.forcefield
import
ForceField
from
pycgtool.interface
import
Progress
,
Options
from
pycgtool.interface
import
Progress
,
Options
logger
=
logging
.
getLogger
(
__name__
)
def
main
(
args
,
config
):
def
main
(
args
,
config
):
"""
"""
...
@@ -23,11 +26,17 @@ def main(args, config):
...
@@ -23,11 +26,17 @@ def main(args, config):
if
args
.
bnd
:
if
args
.
bnd
:
bonds
=
BondSet
(
args
.
bnd
,
config
)
bonds
=
BondSet
(
args
.
bnd
,
config
)
logger
.
info
(
"
Bond measurements will be made
"
)
else
:
logger
.
info
(
"
Bond measurements will not be made
"
)
if
args
.
map
:
if
args
.
map
:
mapping
=
Mapping
(
args
.
map
,
config
,
itp
=
args
.
itp
)
mapping
=
Mapping
(
args
.
map
,
config
,
itp
=
args
.
itp
)
cgframe
=
mapping
.
apply
(
frame
,
exclude
=
{
"
SOL
"
})
cgframe
=
mapping
.
apply
(
frame
,
exclude
=
{
"
SOL
"
})
cgframe
.
output
(
config
.
output_name
+
"
.gro
"
,
format
=
config
.
output
)
cgframe
.
output
(
config
.
output_name
+
"
.gro
"
,
format
=
config
.
output
)
logger
.
info
(
"
Mapping will be performed
"
)
else
:
logger
.
info
(
"
Mapping will not be performed
"
)
# 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
():
...
@@ -43,18 +52,23 @@ def main(args, config):
...
@@ -43,18 +52,23 @@ def main(args, config):
bonds
.
apply
(
cgframe
)
bonds
.
apply
(
cgframe
)
numframes
=
frame
.
numframes
-
args
.
begin
if
args
.
end
==
-
1
else
args
.
end
-
args
.
begin
numframes
=
frame
.
numframes
-
args
.
begin
if
args
.
end
==
-
1
else
args
.
end
-
args
.
begin
logger
.
info
(
"
Beginning analysis of {0} frames
"
.
format
(
numframes
))
Progress
(
numframes
,
postwhile
=
main_loop
).
run
()
Progress
(
numframes
,
postwhile
=
main_loop
).
run
()
if
args
.
bnd
:
if
args
.
bnd
:
if
args
.
map
:
if
args
.
map
:
logger
.
info
(
"
Beginning Boltzmann inversion
"
)
bonds
.
boltzmann_invert
()
bonds
.
boltzmann_invert
()
if
config
.
output_forcefield
:
if
config
.
output_forcefield
:
logger
.
info
(
"
Creating GROMACS forcefield directory
"
)
ff
=
ForceField
(
"
ff
"
+
config
.
output_name
+
"
.ff
"
)
ff
=
ForceField
(
"
ff
"
+
config
.
output_name
+
"
.ff
"
)
ff
.
write_rtp
(
config
.
output_name
+
"
.rtp
"
,
mapping
,
bonds
)
ff
.
write_rtp
(
config
.
output_name
+
"
.rtp
"
,
mapping
,
bonds
)
logger
.
info
(
"
GROMACS forcefield directory created
"
)
else
:
else
:
bonds
.
write_itp
(
config
.
output_name
+
"
.itp
"
,
mapping
=
mapping
)
bonds
.
write_itp
(
config
.
output_name
+
"
.itp
"
,
mapping
=
mapping
)
if
config
.
dump_measurements
:
if
config
.
dump_measurements
:
logger
.
info
(
"
Dumping bond measurements to file
"
)
bonds
.
dump_values
(
config
.
dump_n_values
)
bonds
.
dump_values
(
config
.
dump_n_values
)
...
@@ -71,8 +85,6 @@ def map_only(args, config):
...
@@ -71,8 +85,6 @@ def map_only(args, config):
cgframe
.
output
(
config
.
output_name
+
"
.gro
"
,
format
=
config
.
output
)
cgframe
.
output
(
config
.
output_name
+
"
.gro
"
,
format
=
config
.
output
)
if
args
.
xtc
and
(
config
.
output_xtc
or
args
.
outputxtc
):
if
args
.
xtc
and
(
config
.
output_xtc
or
args
.
outputxtc
):
numframes
=
frame
.
numframes
-
args
.
begin
if
args
.
end
==
-
1
else
args
.
end
-
args
.
begin
# 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
...
@@ -80,6 +92,8 @@ def map_only(args, config):
...
@@ -80,6 +92,8 @@ def map_only(args, config):
cgframe
=
mapping
.
apply
(
frame
,
cgframe
=
cgframe
,
exclude
=
{
"
SOL
"
})
cgframe
=
mapping
.
apply
(
frame
,
cgframe
=
cgframe
,
exclude
=
{
"
SOL
"
})
cgframe
.
write_xtc
(
config
.
output_name
+
"
.xtc
"
)
cgframe
.
write_xtc
(
config
.
output_name
+
"
.xtc
"
)
numframes
=
frame
.
numframes
-
args
.
begin
if
args
.
end
==
-
1
else
args
.
end
-
args
.
begin
logger
.
info
(
"
Beginning analysis of {0} frames
"
.
format
(
numframes
))
Progress
(
numframes
,
postwhile
=
main_loop
).
run
()
Progress
(
numframes
,
postwhile
=
main_loop
).
run
()
...
@@ -126,6 +140,10 @@ if __name__ == "__main__":
...
@@ -126,6 +140,10 @@ if __name__ == "__main__":
print
(
"
Using XTC: {0}
"
.
format
(
args
.
xtc
))
print
(
"
Using XTC: {0}
"
.
format
(
args
.
xtc
))
if
config
.
map_only
:
if
config
.
map_only
:
logger
.
info
(
"
Starting: mapping only
"
)
map_only
(
args
,
config
)
map_only
(
args
,
config
)
else
:
else
:
logger
.
info
(
"
Starting: parameter measurement
"
)
main
(
args
,
config
)
main
(
args
,
config
)
logger
.
info
(
"
Analysis complete
"
)
This diff is collapsed.
Click to expand it.
pycgtool/interface.py
+
1
−
0
View file @
661ac418
...
@@ -264,6 +264,7 @@ class Progress:
...
@@ -264,6 +264,7 @@ class Progress:
Iterate through self until stopped by maximum iterations or False condition.
Iterate through self until stopped by maximum iterations or False condition.
"""
"""
collections
.
deque
(
self
,
maxlen
=
0
)
collections
.
deque
(
self
,
maxlen
=
0
)
return
self
.
_its
@property
@property
def
_bar
(
self
):
def
_bar
(
self
):
...
...
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