fn write(&self,
             atoms: &Atoms,
             data: Vec<Option<f64>>,
             filename: String,
             pbar: Bar)
             -> std::io::Result<()> {
        let filename = format!("{}.cube", filename);
        let mut buffer = BufWriter::new(File::create(filename)?);
        pbar.set_length(data.len() / 6 + (data.len() % 6 != 0) as usize);
        buffer.write_all(atoms.text.as_bytes())?;
        data.chunks(6).for_each(|line| {
                          if let Err(e) = line.iter().try_for_each(|f| {
                                                         write!(
                    buffer,
                    " {:.5}",
                    FortranFormat {
                        float: *f,
                        mult: VOLUME_UNITS
                    }
                )
                                                     })
                          {
                              panic!("Error occured during write: {}", e)
                          };
                          if let Err(e) = writeln!(buffer) {
                              panic!("Error occured during write: {}", e)
                          };
                          pbar.tick();
                      });
        Ok(())
    }
/// Write a cube file from a vector of options where None will be written as
/// zero.
Write a cube file from a vector of options where None will be written as
zero.
Write a cube file from a vector of options where None will be written as zero .
fn write(&self,
             atoms: &Atoms,
             data: Vec<Option<f64>>,
             filename: String,
             pbar: Bar)
             -> std::io::Result<()> {
        let filename = format!("{}.cube", filename);
        let mut buffer = BufWriter::new(File::create(filename)?);
        pbar.set_length(data.len() / 6 + (data.len() % 6 != 0) as usize);
        buffer.write_all(atoms.text.as_bytes())?;
        data.chunks(6).for_each(|line| {
                          if let Err(e) = line.iter().try_for_each(|f| {
                                                         write!(
                    buffer,
                    " {:.5}",
                    FortranFormat {
                        float: *f,
                        mult: VOLUME_UNITS
                    }
                )
                                                     })
                          {
                              panic!("Error occured during write: {}", e)
                          };
                          if let Err(e) = writeln!(buffer) {
                              panic!("Error occured during write: {}", e)
                          };
                          pbar.tick();
                      });
        Ok(())
    }
fn write ( & self , atoms : & Atoms , data : Vec < Option < f64 > > , filename : String , pbar : Bar ) -> std :: io :: Result < ( ) > { let filename = format ! ( " " filename ) ; let mut buffer = BufWriter :: new ( File :: create ( filename ) ? ) ; pbar . set_length ( data . len ( ) / 6 + ( data . len ( ) % 6 != 0 ) as usize ) ; buffer . write_all ( atoms . text . as_bytes ( ) ) ? ; data . chunks ( 6 ) . for_each ( | line | { if let Err ( e ) = line . iter ( ) . try_for_each ( | f | { write ! ( buffer " " FortranFormat { float f mult VOLUME_UNITS } ) } ) { panic ! ( " " e ) } ; if let Err ( e ) = writeln ! ( buffer ) { panic ! ( " " e ) } ; pbar . tick ( ) ; } ) ; Ok ( ( ) ) }
Write a cube file from a vector of options where None will be written as
zero.
Write a cube file from a vector of options where None will be written as zero .
&self
atoms
&Atoms
data
Vec<Option<f64>>
filename
String
pbar
Bar
&self
atoms
&Atoms
data
Vec<Option<f64>>
filename
String
pbar
Bar