Project
Overview
A high-level organizational container for a set of material records and their associated calculations. It facilitates workflows that span multiple materials within a chemical system and provides coordination of bulk operations such as initiating materials, launching calculations, collectin results, and serializing project state.
Attributes
| Field | Type | Description |
|---|---|---|
| id | str | Unique identifier, used primarily as the _id attribute when stored in mongodb |
| name | str | Name of the project |
| host_dir | str | Base directory where all the materials and records for the project will be stored |
| mat_kwargs | dict | None | Optional query parameters used for pulling materials from a database |
| info_store | str | None | Path to an existing local directory containing material info in JSON format, if applicable |
| record_store | dict[str, Record] | A dictionary mapping material names to their Record objects or JSON paths to be deserialized |
| calculations: dict[str, process] | A runtime-only mapping of all active calculations, excluded from serialization | |
| record_path | str (computed) | File path for saving the record object at {host_dir}/Rc_{self.name}.json |
model_dump(self, args, *kwargs)
To manually implement serialize_by_alias by default
Initialisation
initiate(cls, chemsys, host_dir, info_store, restart, **kwargs)
Create and initialize a new Project for a given chemical system. This method sets up a dedicated directory, pulls material data (if not supplied), initializes material records, and saves the full record to disk. If the workspace already exists, restart=True must be specified to overwrite.
init_from_database(self, restart: bool = False)
Pulls data from existing database and initiate the info_store of the record.
Validation and De-serialization
default_id(cls, values:dict)
Fixes legacy data that did not have the _id field.
load_record(cls, value: dict) -> dict[str, Record]
Validator that loads Record instances from dict or JSON paths during deserialization. Uses parallel processing when records exceed a threshold.
load(cls, chemsys, host_dir)
The preferred method to load chemsys_record from the host_dir.
load_file(cls, path:str | None = None)
Loads a record from a specified file.
Serialization and Saving
dump_store(self, store: dict[str, Record], info: SerializationInfo) -> dict[str, str | dict]
Serializes the record_store. If context={'dump': True} is passed, each record is saved and replaced by its file path.
save(self, save_path: str | None = None, dump : bool = False):
Saves the current state to JSOn. If dump=True, performs deep serialization of the record_store.
calculate(self, calculation, generator_func, overwrite, start, sumit, cluster, include, exclude, **kwargs)
Initiates calculations across all materials using a generator fucntion or specified calculation.
displace(self, relax_name, include, exclude, **kwargs)
Performs structure displacement operations across all records.
make(self, include, exclude)
Triggers make() for all stored self.calculations. It generates input files or prepares the calculation setup for each process before it can be submitted or executed.
submit(self, include, exclude)
Submits all stored calculations.
output_collate(self, include_cal, exclude_cal, include, exclude)
Aggreates job results across all materials.
write_property(self, include_cal, exclude_cal, include, exclude)
Writes property objects from calculation results to the Record.
result_collection(self, include_cal, exclude_cal, include, exclude, **kwargs)
Full post-processing flow for gathering and writing results.
fail_assess(self, show, include_mat, exclude_mat, include_cal, exclude_cal, **kwargs)
Collects and displays information about failed jobs across all materials.
property compare(self, name, include, exclude, show) -> pd.DataFrame
Compares structural properties(e.g., relaxed structure) across materials.
show(self, include_cal, exclude_cal, include_mat, exclude_mat, detailed)
Shows job progress across all calulations and materials.
rerun(self, new_cluster, new_job, new_incar, include_mat, exclude_mat, include_cal, exclude_cal)
Triggers re-submission of failed or adjusted jobs across selected materials and calculations
Note
- It separates
info_storefromrecord_store - It supports parallel operations using
ProcessPoolExecutorto speed up serialization/deserialization