mdsuite.file_io.tabular_text_files module¶
MDSuite Tabular Text file reader module.
- class mdsuite.file_io.tabular_text_files.TabularTextFileProcessor(file_path: Union[str, Path], file_format_column_names: Optional[Dict[PropertyInfo, list]] = None, custom_column_names: Optional[Dict[str, Any]] = None)[source]¶
Bases:
FileProcessor
Parent class for all file readers that are based on tabular text data (e.g. lammps, extxyz,…).
- get_configurations_generator() Iterator[TrajectoryChunkData] [source]¶
TabularTextFiles implements the parent virtual function, but requires its children to provide the necessary information about the table contents, see self._get_tabular_text_reader_data.
- property tabular_text_reader_data: TabularTextFileReaderMData¶
- class mdsuite.file_io.tabular_text_files.TabularTextFileReaderMData(n_configs: int, species_name_to_line_idx_dict: Dict[str, list], n_particles: int, property_to_column_idx_dict: Dict[str, list], n_header_lines: int, header_lines_for_each_config: bool = False, sort_by_column_idx: Optional[int] = None)[source]¶
Bases:
object
Class to hold the data that needs to be extracted from tabular text files before reading them.
- species_name_to_line_idx_dict¶
A dict that links the species name to the line idxs at which the particles can be found within a configuration. Example: {“Na”:[0,2,4], “Cl”:[1,3,5]} for a file in which Na and Cl are written alternatingly.
- property_to_column_idx_dict¶
A dict that links the property name to the column idxs at which the property is listed. Usually the output of mdsuite.file_io.tabular_text_files.extract_properties_from_header
- header_lines_for_each_config¶
Flag to indicate wether each config has its own header or if there is just one header at the top of the file.
- Type:
- sort_by_column_idx¶
if None (default): no sorting needed (the particles are always in the same order within a config if int: sort the lines in the config by the column with this index (e.g., use to sort by particle id in unsorted config output)
- Type:
- mdsuite.file_io.tabular_text_files.get_species_list_from_tabular_text_reader_data(tabular_text_reader_data: TabularTextFileReaderMData) List[SpeciesInfo] [source]¶
Use the data collected in TabularTextFileProcessor._get_tabular_text_reader_data() to get the values necessary for TabularTextFileProcessor.metadata.