6 releases
0.2.4 | Dec 3, 2023 |
---|---|
0.2.3 | Oct 13, 2023 |
0.1.0 | Oct 8, 2023 |
#219 in Science
69 downloads per month
1MB
420 lines
phrace
A terminal viewer for .xvg
files.
Gromacs tools can output xvg files to inspect a range of properties of molecular dynamics trajectories (e.g. gmx energy
).
These data files are commonly viewed with the Grace (xmgrace
) tool.[^grace]
[^grace]: By the way, insanely cool website. Check it out!
Installation
If you don't have Rust installed on your system, learn how to do it here. It is very easy.
To install the binary, run the following command.
cargo install phrace
Usage
Simply invoke with a path to an xvg file. The size of the plot will be inferred from the terminal size.
phrace example_data/potential_energy_em.xvg
GROMACS Energies
░
░
(
k ░
J ░
/ ░
m ░░
o ▒
l ▓░
) ▓▒
░█▓▒
▒▓██▒
░▓▓█▓▓██
▓██▓█▓▓█▓▓▓
░▓▓█▓█▓█▓▓█▓▓██▓█▓
░
Time (ps)
Summary: 393 items, mean ± σ -1512.5859 ± 54.731205, min … max -1565.1497 … -1111.5247
You can specify the width and/or height explicitly as well.
phrace -w 50 -h 25 example_data/ramachandran.xvg
Ramachandran Plot
░░░░░░░░░ ░░ ░░░░░ ░ ░
░░░░░░░░░░░░░░░░░░░░░ ░ ░ ░
░░░░░░░░░░░░░░░░░░░░░ ░ ░ ░ ░ ░
░░░ ░░░░░░░░░░░░░░░░ ░ ░
░░░░░░░ ░░░░░░░░░
░░░░░░░░░░░░░ ░░
░ ░ ░░░░░░░░ ░
░░░░░░░ ░░ ░
P ░ ░ ░░░░░░ ░ ░ ░ ░ ░
s ░░░ ░░░░░░░░░ ░░ ░ ░ ░ ░░░░░
i ░░░░ ░░░░░░░░░░░░ ░░░░░ ░ ░ ░░░░░░
░░░░ ░ ░░░░▒▓█▒░░░░ ░░░░░░░░ ░░ ░░░░
░░░░ ░ ░░░░▒░░░░░ ░░░ ░░░░░░░░ ░░
░░░░ ░ ░░░ ░░░░░░░ ░░ ░ ░░ ░░
░░ ░ ░ ░ ░ ░░░░░ ░ ░ ░
░░ ░ ░ ░░░░░░ ░░ ░ ░
░░ ░ ░ ░░░░░░░░░
░ ░ ░░░░ ░░ ░░░░░ ░ ░░░
░ ░░░░░░ ░░░░░░░░░ ░░░ ░
░
Phi
Summary: 3618 items, mean ± σ 8.999559 ± 90.19915, min … max -179.764 … 179.746
Rendering the plot with an ASCII style is also possible.
phrace --style ascii -w30 -h20 example_data/potential_energy_em.xvg
GROMACS Energies
.
( .
k
J .
/ :
m -=
o =#*
l :#%#%#@-
) +#%%#%#@#%#@#%#%#
.
Time (ps)
Summary: 393 items, mean ± σ -1512.5859 ± 54.731205, min … max -1565.1497 … -1111.5247
Future work
If I have some time, I want to add more options to change the viewport, add axis tick labels, ability to plot multiple columns at once. For now, it fits my needs, and I am putting it out there for others to use in case they find it useful in its current state.
I am interested in adding support for more data formats. Honestly, it would be pretty cool to add the ability to graph out some weird and esoteric formats, but maybe doing like... csv is cool too I guess. Get in touch if you have a particular need, and we can see whether we can pull some programming crimes together.
More plotting styles may also pop up if I feel inspired.
In other words: contributions and collaboration welcome.
Dependencies
Depends on the terminal_size
crate for getting the width and height of the terminal.
Depends on the lexopt
crate for parsing command line arguments.
No other dependencies.
By Ma3ke.
Dependencies
~2–13MB
~118K SLoC