Purpose:
Read other log files (ChemCell, SPPARKS, SPARTA) and extract time-series data.
Description:
Read one or more log files from other programs (besides LAMMPS) and combine their species statistical data into long, named vectors (versus time). The vectors can be used in Python for further processing and plotting, or they can be output to a file.
This tool will work from log files from the Sandia ChemCell, SPPARKS, and SPARTA packages. For LAMMPS log files, see the log tool.
The only difference between the log files of those programs, so far as this tool is concerned is the line that delimits the start of the sections that contain time-series data. This can be set via the second argument in the constructor, as documented below. For ChemCell and SPARTA, the default string "Step" can be used. For SPPARKS, the string "Time" will work. Note that SPARTA can change the text in the line that starts a section of time-series data. In this case a start string specific to the log file must be used.
The log constructor reads one or more log files. The names of these one or more files are listed in the 1st argument. The 2nd argument is a string with text that begins the line that delimits the start of sections that contain time-series data, as explained above. If a 3rd argument is specified, then a single file should be specified as the 1st argument, and it is assumed to contain data for multiple runs, which are averaged.
The nvec, nlen, and names values give the # of vectors, their length, and names. The get() method returns one of more vectors as a Python list. The write() method outputs the numeric vectors to a file.
Usage:
o = olog("file1") read in one or more log files o = olog("log1 log2.gz") can be gzipped o = olog("file*") wildcard expands to multiple files o = olog("log.spparks","Time") 2nd arg = start string for time section o = olog("log.cell","",0) 3rd arg = average all runs
incomplete and duplicate thermo entries are deleted if specify 2nd arg, it delimits a time section no 2nd arg or empty string, use default = "Step" if specify any 3rd arg, average all runs, assume all start at time 0
nvec = o.nvec # of vectors of thermo info nlen = o.nlen length of each vectors names = o.names list of vector names a,b,... = o.get("A","B",...) return one or more vectors of values o.write("file.txt") write all vectors to a file o.write("file.txt","A","B",...) write listed vectors to a file
get and write allow abbreviated (uniquely) vector names
Related tools:
Prerequisites: none