| from pathlib import Path | |
| from boltzgen.data.data import Record, Structure | |
| def load_record(record_id: str, record_dir: Path) -> Record: | |
| """Load the given record. | |
| Parameters | |
| ---------- | |
| record_id : str | |
| The record id to load. | |
| record_dir : Path | |
| The path to the record directory. | |
| Returns | |
| ------- | |
| Record | |
| The loaded record. | |
| """ | |
| return Record.load(record_dir / f"{record_id}.json") | |
| def load_structure(record: Record, struct_dir: Path) -> Structure: | |
| """Load the given input data. | |
| Parameters | |
| ---------- | |
| record : str | |
| The record to load. | |
| target_dir : Path | |
| The path to the data directory. | |
| Returns | |
| ------- | |
| Input | |
| The loaded input. | |
| """ | |
| if (struct_dir / f"{record.id}.npz").exists(): | |
| structure_path = struct_dir / f"{record.id}.npz" | |
| else: | |
| structure_path = struct_dir / f"{record.id}" / f"{record.id}_model_0.npz" | |
| return Structure.load(structure_path) | |