castep-model-core 0.2.9

The core module to parse, read, edit, and write 3D lattice models for castep and compatible with Materials Studio.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::{model_type::DefaultExport, CellModel, LatticeModel, MsiModel};
use std::{
    fs::{self, read_to_string},
    str::FromStr,
};
#[test]
fn test_cell_msi() {
    let msi_file = read_to_string("./SAC_GDY_V.msi").unwrap();
    let msi_model: LatticeModel<MsiModel> = LatticeModel::from_str(msi_file.as_str()).unwrap();
    fs::write("Test_msi.msi", msi_model.export()).unwrap();
    let cell_model: LatticeModel<CellModel> = msi_model.into();
    fs::write("Test_cell.cell", cell_model.export()).unwrap();
    let msi_back: LatticeModel<MsiModel> = cell_model.into();
    fs::write("Test_msi_back.msi", msi_back.export()).unwrap();
}