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
3404c828
Commit
3404c828
authored
5 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Accept log_file option for model.simulate() to redirect arbd stdout
parent
bd544678
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mrdna/model/arbdmodel.py
+11
-5
11 additions, 5 deletions
mrdna/model/arbdmodel.py
with
11 additions
and
5 deletions
mrdna/model/arbdmodel.py
+
11
−
5
View file @
3404c828
...
...
@@ -705,7 +705,7 @@ class ArbdModel(PdbModel):
if
typeA
!=
typeB
:
self
.
nbSchemes
.
append
(
(
nbScheme
,
typeB
,
typeA
)
)
def
simulate
(
self
,
output_name
,
output_directory
=
'
output
'
,
num_steps
=
100000000
,
timestep
=
None
,
gpu
=
0
,
output_period
=
1e4
,
arbd
=
None
,
directory
=
'
.
'
,
replicas
=
1
):
def
simulate
(
self
,
output_name
,
output_directory
=
'
output
'
,
num_steps
=
100000000
,
timestep
=
None
,
gpu
=
0
,
output_period
=
1e4
,
arbd
=
None
,
directory
=
'
.
'
,
replicas
=
1
,
log_file
=
None
):
assert
(
type
(
gpu
)
is
int
)
num_steps
=
int
(
num_steps
)
...
...
@@ -761,10 +761,16 @@ class ArbdModel(PdbModel):
cmd
=
tuple
(
str
(
x
)
for
x
in
cmd
)
print
(
"
Running ARBD with: %s
"
%
"
"
.
join
(
cmd
))
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
for
line
in
process
.
stdout
:
sys
.
stdout
.
write
(
line
)
sys
.
stdout
.
flush
()
if
log_file
is
None
or
(
hasattr
(
log_file
,
'
write
'
)
and
callable
(
log_file
.
write
)):
fd
=
sys
.
stdout
if
log_file
is
None
else
log_file
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
for
line
in
process
.
stdout
:
fd
.
write
(
line
)
fd
.
flush
()
else
:
with
open
(
log_file
,
'
w
'
)
as
fd
:
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
log_file
,
universal_newlines
=
True
)
process
.
communicate
()
except
:
raise
...
...
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