Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91589854
log2txt.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Nov 12, 12:31
Size
944 B
Mime Type
text/x-python
Expires
Thu, Nov 14, 12:31 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21254067
Attached To
rLAMMPS lammps
log2txt.py
View Options
#!/usr/bin/env python
# Script: log2txt.py
# Purpose: extract thermo info from LAMMPS log file
# create a text file of numbers in columns, suitable for plotting
# Syntax: log2txt.py log.lammps data.txt X Y ...
# log.lammps = LAMMPS log file
# data.txt = text file to create
# X Y ... = columns to include (optional), X,Y are thermo keywords
# if no columns listed, all columns are included
# Author: Steve Plimpton (Sandia), sjplimp at sandia.gov
import
sys
,
os
path
=
os
.
environ
[
"LAMMPS_PYTHON_TOOLS"
]
sys
.
path
.
append
(
path
)
from
log
import
log
if
len
(
sys
.
argv
)
<
3
:
raise
StandardError
,
"Syntax: log2txt.py log.lammps data.txt X Y ..."
logfile
=
sys
.
argv
[
1
]
datafile
=
sys
.
argv
[
2
]
columns
=
sys
.
argv
[
3
:]
lg
=
log
(
logfile
)
if
columns
==
[]:
lg
.
write
(
datafile
)
else
:
str
=
"lg.write(datafile,"
for
word
in
columns
:
str
+=
'"'
+
word
+
'",'
str
=
str
[:
-
1
]
+
')'
eval
(
str
)
Event Timeline
Log In to Comment