[−][src]Crate vasp_poscar
Library for reading and writing VASP POSCAR files.
See the Poscar
type for more details.
use vasp_poscar::{Poscar, ScaleLine}; const EXAMPLE: &'static str = "\ cubic diamond 3.7 0.5 0.5 0.0 0.0 0.5 0.5 0.5 0.0 0.5 C 2 Direct 0.0 0.0 0.0 0.25 0.25 0.25 "; // read from a BufRead instance, such as &[u8] or BufReader<File> let poscar = Poscar::from_reader(EXAMPLE.as_bytes())?; // get a RawPoscar object with public fields you can freely match on and manipulate let mut poscar = poscar.into_raw(); assert_eq!(poscar.scale, ScaleLine::Factor(3.7)); poscar.comment = "[Subject Name Here] was here".into(); poscar.scale = ScaleLine::Volume(10.0); // Turn the RawPoscar back into a Poscar let poscar = poscar.validate()?; // Poscar implements Display assert_eq!( format!("{}", poscar), "\ [Subject Name Here] was here -10.0 0.5 0.5 0.0 0.0 0.5 0.5 0.5 0.0 0.5 C 2 Direct 0.0 0.0 0.0 0.25 0.25 0.25 ");
Re-exports
pub extern crate failure; |
pub use crate::builder::Builder; |
pub use crate::builder::Zeroed; |
Modules
builder | Poscar construction through the builder pattern. |
Structs
Poscar | Represents a POSCAR file. |
RawPoscar | Unencumbered |
Enums
Coords | Represents data that can either be in direct units or cartesian. |
ScaleLine | Represents the second line in a POSCAR file. |
ValidationError | Covers all the reasons why |
Traits
To3 | Types convertible into |
ToN3 | Types convertable into |