| Crates.io | minitpr |
| lib.rs | minitpr |
| version | 0.2.3 |
| created_at | 2024-02-25 18:00:14.315478+00 |
| updated_at | 2025-05-16 12:51:03.750518+00 |
| description | Library for Reading Gromacs TPR Files |
| homepage | |
| repository | https://github.com/Ladme/minitpr |
| max_upload_size | |
| id | 1152672 |
| size | 83,086 |
minitpr is a pure Rust library designed for parsing Gromacs tpr files, focusing on extracting system topology and structure.
To include minitpr in your project, add it as a dependency using Cargo:
cargo add minitpr
Example usage to parse a tpr file and handle potential errors:
use minitpr::TprFile;
fn main() {
let tpr = match TprFile::parse("topol.tpr") {
Ok(file) => file,
Err(error) => {
eprintln!("{}", error);
return;
},
};
// now you can work with the `tpr` object, accessing its properties and data
// for instance, to iterate through the atoms of the molecular system, use:
for atom in tpr.topology.atoms.iter() {
// perform some operation with the atom
}
}
The TprFile structure encapsulates the following information:
TprHeader structure).SimBox structure if present.TprTopology structure).Each atom (see Atom) represented in the system topology includes:
None if unidentifiable).None if not present).None if not present).None if not present).Enable (de)serialization support for TprFile with serde by adding the feature flag during installation:
cargo add minitpr --features serde
minitpr is open-sourced under either the Apache License 2.0 or the MIT License at your option.
Due to the huge number of various force field and simulation parameters and Gromacs options, it is very difficult to comprehensively test the minitpr library.Your contributions in the form of tests, tpr files with unusual parameters, or new functionality are very welcome.
If the library is unable to parse your tpr file, but you believe it should be able to, please open a GitHub issue and upload your tpr file.