Trait bader::io::FileFormat
source · pub trait FileFormat {
// Required methods
fn read(&self, filename: String) -> ReadFunction;
fn to_atoms(&self, atom_text: String) -> Atoms;
fn write(
&self,
atoms: &Atoms,
data: Vec<Option<f64>>,
filename: String,
visible_pbar: bool
) -> Result<()>;
fn coordinate_format(&self, coords: [f64; 3]) -> (String, String, String);
// Provided method
fn init(
&self,
args: &Args
) -> (Vec<Vec<f64>>, Vec<f64>, Atoms, [usize; 3], [f64; 3]) { ... }
}
Expand description
FileFormat trait. Used for handling input from a file.
Required Methods§
sourcefn read(&self, filename: String) -> ReadFunction
fn read(&self, filename: String) -> ReadFunction
Reads the file into a ReadFunction
containing the information
needed from the file to build a Grid
.
filename
: The name of the file to read.
sourcefn to_atoms(&self, atom_text: String) -> Atoms
fn to_atoms(&self, atom_text: String) -> Atoms
Reads the non-density section of the file into an Atoms
object.
atom_text
: The full string of non-density information from the density file.
sourcefn write(
&self,
atoms: &Atoms,
data: Vec<Option<f64>>,
filename: String,
visible_pbar: bool
) -> Result<()>
fn write( &self, atoms: &Atoms, data: Vec<Option<f64>>, filename: String, visible_pbar: bool ) -> Result<()>
Writes a specific density, data, to tile in the correct format.
atoms
: The associated &Atoms
object for the density file.data
: The density to write to file wrapped in options with None representing 0.filename
: Where to save the file, minus any suffix as this should be applied in the function.pbar
: A progress bar for monitoring the write.