1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-08-24 22:21:43 +02:00

Improved usize

This commit is contained in:
Anthony Scemama 2023-10-12 00:56:18 +02:00
parent b0dc33d97b
commit 7e9a3077d3
2 changed files with 9 additions and 3 deletions

View File

@ -129,8 +129,7 @@ pub fn read_{group_l}_{element_l}(trex_file: File) -> Result<{type_r}, ExitCode>
rc_return(rc, data)
}
pub fn write_{group_l}_{element_l}<T>(trex_file: File, data: T) -> Result<(), ExitCode>
where {type_c}: From<T> {
pub fn write_{group_l}_{element_l}(trex_file: File, data: {type_r}) -> Result<(), ExitCode> {
let data: {type_c} = data.try_into().unwrap();
let rc = unsafe { c::trexio_write_{group}_{element}_64(trex_file, data) };
rc_return(rc, ())

View File

@ -22,7 +22,7 @@ pub fn test_write(file_name: &str, back_end: BackEnd) {
let nucleus_num = 12;
let state_id = 2;
let charge = vec![6., 6., 6., 6., 6., 6., 1., 1., 1., 1., 1., 1.0f64];
let coord = vec![ 0.00000000, 1.39250319 , 0.00 ,
let coord = vec![ 0.00000000f64, 1.39250319 , 0.00 ,
-1.20594314, 0.69625160 , 0.00 ,
-1.20594314, -0.69625160 , 0.00 ,
0.00000000, -1.39250319 , 0.00 ,
@ -84,6 +84,13 @@ pub fn test_write(file_name: &str, back_end: BackEnd) {
trexio::write_mo_num(trex_file, mo_num).unwrap();
}
let mut energy = Vec::with_capacity(mo_num);
for i in 0..mo_num {
let e: f64 = i as f64 -100.0f64;
energy.push(e);
}
println!("{:#?}", energy);
trexio::close(trex_file).expect("Unable to close File");
}