Parse computational chemistry log files, but fast-ly.
Project description
FastLogfileParser
Parse logfiles from computational chemistry software, but fast-ly
Install with pip install fastlogfileparser
or conda
(forthcoming!).
- ~10x faster than
cclib
- zero dependencies, supports all modern Python version
- Supports linked jobs, returns a separate result dictionary for each job
- Retrieves values at every step, not just convergence
Usage
Gaussian
There is a single function fast_gaussian_logfile_parser
inside fastlogfileparser.gaussian
which reads logfiles and returns the result as a namedtuple (which prevents accidentally changing the values and allows using .
syntax to access them).
Usage Example
from fastlogfileparser.gaussian import fast_gaussian_logfile_parser as fglp
# read all jobs from the logfile
job_1, job_2, ..., job_n = fglp("data/result.log")
# access results
print(job_1.frequency_modes)
# show all available values retrieved from the file
print(job_1._fields)
# can also be accessed via
from fastlogfileparser.gaussian import FIELDS
Fast logfile parser is fastest when you ask it to retrieve only the fields you want, i.e.:
job_1, job_2, job_3 = fglp(FNAME, get=("gibbs", "scf"))
Retrieved Values
Quantity | Key | Type | Frequency |
---|---|---|---|
Gibbs free energy at 298K | gibbs |
float | 1/job |
Gibbs free energy at 0K | e0_zpe |
float | 1/job |
Enthalpy at 298K | e0_h |
float | 1/job |
E0 $^1$ | E0 |
float | 1/job |
Per-atom Zero Point Energy | zpe_per_atom |
float | 1/job |
Standardized xyz coords | std_xyz |
list[float] | 1/step/job |
... | ... | ... | ... |
Number of Atoms $^2$ | number_of_atoms |
int | 1/job |
Number of Optimization Steps $^2$ | number_of_optimization_steps |
int | 1/job |
$1$ equals E0 only for non-wavefunction methods
$2$ requires std_xyz
to be parsed to find these values
How much fast-ly-er?
FastLogfileParser
uses REGEX and only REGEX to retrieve data from logfiles, spending as much time in Python's excellent C-based REGEX library as possible.
See comparison.py
to run for yourself (install with pip install .[demos]
), but in short:
- compared to
cclib
,fastlogfileparser
is ~10x as fast and returns all values for intermediate steps in simulation (butcclib
supports retrieving a different set of values) - compared to
ase
,fastlogfileparser
is ~2x slower, but returns far more values and in a more readily accessible format
Development Notes
FastLogfileParser
is written in a purely functional style.
Running Tests
Install FastLogfileParser
with the optional [dev]
dependencies, i.e. from a local clone run `pip install -e ".[dev]"
Rather than keep the gigantic log files saved in the git repo directly, they are compressed to make cloning easier.
Before running tests, navigate to test
and run python data_loader.py decompress
to prepare the needed logfiles.
To add new data for the tests to the repo, perform the previous step and then run python data_loader.py compress
.
This may take some time to finish executing (a minute or so).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fastlogfileparser-1.0.0a5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc38bec73b5a4eb9164769b698e8fdb4cd77aeabca5bc441e6636a3158942050 |
|
MD5 | ac770a08c080e1512155e1ddbb601b21 |
|
BLAKE2b-256 | 9b8edb0564f3075067fefcf9e10396f73b70ea3d6975b04908f2f2d5da38fe24 |
Hashes for fastlogfileparser-1.0.0a5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d3219bd8f7b7929adcf3638a5b1a4f64275675524934d6c36cd7a6672b32ad0 |
|
MD5 | 5cf0073ea35d07921de30b15e315667b |
|
BLAKE2b-256 | 493121a9e1616e29d015a79d1e5d5f1abb6ccd75218fdfd02952169e815f70b9 |