vaspchg_rs

Crates.iovaspchg_rs
lib.rsvaspchg_rs
version0.1.1
sourcesrc
created_at2020-08-16 09:09:20.005192
updated_at2020-08-18 06:58:29.259111
descriptionA lib to parse VASP's charge density file.
homepagehttps://github.com/Ionizing/vaspchg_rs
repositoryhttps://github.com/Ionizing/vaspchg_rs
max_upload_size
id277174
size40,831
Ionizing (Ionizing)

documentation

README

vaspchg-rs

crates.io docs.rs

This is a crate aimed at reading/writing volumetric data file produced by VASP. Mostly the files should be CHGCAR, CHG and PARCHG

Example

use vaspchg_rs::{ChgBase, ChgType};

fn main() -> std::io::Result<()> {
    // Reading volumetric data
    let chgcar = ChgBase::from_file("CHGCAR")?;

    // Writing volumetric data to another file
    chgcar.write_file("another_CHGCAR", ChgType::Chgcar)?;

    // manipulating volumetric data
    let pos = chgcar.get_poscar().clone();
    let mut chg = chgcar.get_total_chg().clone();
    chg *= pos.scaled_volume();

    // construct another ChgBase object
    let new_chg = ChgBase::from_builder(chg, vec![], pos);
    new_chg.write_file("new_CHGCAR", ChgType::Parchg)?;
    Ok(())
}

Usage/Document

Clone this repository then run cargo doc to see the documents.

Detailed usage could be found in ChgBase and unit tests in tests/ folder.

Commit count: 33

cargo fmt