shnitsel.io.ase.parse¶
Attributes¶
Functions¶
|
Function to assign shapes based on the chosen db_format and potential information in the metadata of a database. |
|
|
|
Apply attributes from db metadata and perform some validation checks on the result. |
|
Reads an ASE DB containing data in the SPaiNN or SchNet format |
Module Contents¶
- shapes_from_metadata(db_meta, db_format=None)¶
Function to assign shapes based on the chosen db_format and potential information in the metadata of a database.
If conflicting information on the db_format is provided and present in the database, en error will be raised.
- Parameters:
db_meta (dict) – The metadata dict of an ASE database.
db_format (Literal['spainn', 'schnet'] | None, optional) – The requested format of the database. Defaults to None.
- Returns:
Dict of data_var shapes dict[str, list[str]]: Dict of coordinate shapes str: The name of the leading dimension. Should be frame or time, but can be leading_dim_unknown if unknown
- Return type:
- Raises:
ValueError – If a db_format of database was requested that conflicts with the format of the database.
- apply_dataset_meta_from_db_metadata(dataset, db_meta, default_attrs)¶
Apply attributes from db metadata and perform some validation checks on the result.
Loads remaining missing coordinate variables from db metadata if available. Checks size of resulting dimensions if specified in db metadata. Further initializes the multi indices if specified in the metadata.
- Parameters:
- Returns:
Dataset with attributes set from from db metadata and dimension sizes asserted
- Return type:
Trajectory
- read_ase(db_path, db_format=None, loading_parameters=None)¶
Reads an ASE DB containing data in the SPaiNN or SchNet format
- Parameters:
db_path (pathlib.Path) – Path to the database
db_format (Literal['spainn', 'schnet'] | None, optional) – Must be one of ‘spainn’ or ‘schnet’ or None; determines interpretation of array shapes If None is provided, no shape will be assumed
loading_parameters (LoadingParameters) – Potentially configured parameters to overwrite loading behavior
- Return type:
An xr.Dataset of frames
- Raises:
ValueError – If db_format is not one of ‘spainn’ or ‘schnet’
FileNotFoundError – If db_path is not a file
ValueError – If db_path does not contain data corresponding to the format db_format