{"id":17287616,"url":"https://github.com/dnlbauer/xdrfile","last_synced_at":"2025-04-14T11:07:28.582Z","repository":{"id":56234508,"uuid":"256216165","full_name":"dnlbauer/xdrfile","owner":"dnlbauer","description":"Rust Wrapper around the GROMACS libxdrfile library. A low level api to read and write molecular trajectories in .xtc and .trr format.","archived":false,"fork":false,"pushed_at":"2021-05-12T07:58:45.000Z","size":363,"stargazers_count":7,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T11:07:23.422Z","etag":null,"topics":["gromacs","molecular-dynamics","trajectories","trr","xdrfile","xtc"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnlbauer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-16T13:00:55.000Z","updated_at":"2025-01-14T01:59:08.000Z","dependencies_parsed_at":"2022-08-15T15:10:27.576Z","dependency_job_id":null,"html_url":"https://github.com/dnlbauer/xdrfile","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnlbauer%2Fxdrfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnlbauer%2Fxdrfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnlbauer%2Fxdrfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnlbauer%2Fxdrfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnlbauer","download_url":"https://codeload.github.com/dnlbauer/xdrfile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248868768,"owners_count":21174758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gromacs","molecular-dynamics","trajectories","trr","xdrfile","xtc"],"created_at":"2024-10-15T10:03:49.537Z","updated_at":"2025-04-14T11:07:28.561Z","avatar_url":"https://github.com/dnlbauer.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/danijoo/xdrfile.svg?branch=master)](https://travis-ci.org/danijoo/xdrfile) [![crates.io](https://img.shields.io/badge/crates.io-orange.svg?longCache=true)](https://www.crates.io/crates/xdrfile) [![Latest Documentation](https://docs.rs/xdrfile/badge.svg)](https://docs.rs/xdrfile)\n\n# xdrfile\nRead and write xdr trajectory files in .xtc and .trr file format\n\nThis crate is mainly intended to be a wrapper around the GROMACS libxdrfile\nXTC library and provides basic functionality to read and write xtc and trr\nfiles with a safe api.\n\n## Examples\n### Basic usage\n```rust\nuse xdrfile::*;\n\nfn main() -\u003e Result\u003c()\u003e {\n    // get a handle to the file\n    let mut trj = XTCTrajectory::open_read(\"tests/1l2y.xtc\")?;\n\n    // find number of atoms in the file\n    let num_atoms = trj.get_num_atoms()?;\n\n    // a frame object is used to get to read or write from a trajectory\n    // without instantiating data arrays for every step\n    let mut frame = Frame::with_len(num_atoms);\n\n    // read the first frame of the trajectory\n    trj.read(\u0026mut frame)?;\n\n    assert_eq!(frame.step, 1);\n    assert_eq!(frame.len(), num_atoms);\n\n    let first_atom_coords = frame[0];  // shorthand for frame.coords[0]\n    assert_eq!(first_atom_coords, [-0.8901, 0.4127, -0.055499997]);\n\n    Ok(())\n}\n```\n\n### Frame iteration\nFor convenience, the trajectory implementations provide \"into_iter\" to\nbe turned into an iterator that yields Rc\u003cFrame\u003e. If a frame is not kept\nduring iteration, the Iterator reuses it for better performance (and hence,\nRc is required)\n\n```rust\nuse xdrfile::*;\n\nfn main() -\u003e Result\u003c()\u003e {\n    // get a handle to the file\n    let trj = XTCTrajectory::open_read(\"tests/1l2y.xtc\")?;\n\n    // iterate over all frames\n    for (idx, result) in trj.into_iter().enumerate() {\n        let frame = result?;\n        println!(\"{}\", frame.time);\n        assert_eq!(idx+1, frame.step);\n    }\n    Ok(())\n}\n```\n\n## xdrfile\nUses the lowlevel xdrfile c library version 1.1.4 with some minor fixes and additions copied from [mdtraj](https://github.com/mdtraj/mdtraj).\n\n\n\n## License\nLicensed under LGPL because this is what the underlying c library (xdrfile) uses\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnlbauer%2Fxdrfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnlbauer%2Fxdrfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnlbauer%2Fxdrfile/lists"}