Record
Overview
Complete storage of the computational history of:
- info: an object storing the basic information of the material
- history: an OrderedDict object that records the calculations ran and their outputs
- results: a results object storing the results for different physical properties
Note: a mat_info contains only the basic information of a material which is usually pulled directly from an existing database.
Attributes
Core Fields
| Field | Type | Description |
|---|---|---|
| id | str | Unique identifier,used primarily as the _id attribute when stored in mongodb |
| info | Info | Immutable metadata describing the material |
| history | dict[str, ProcessResolved] | All performed or in-progress calculations on this material |
| results | dict[str, PropertyResolved] | Output physical properties derived from calculations |
Save Setting
| Field | Type | Description |
|---|---|---|
| saving_mode | Literal[1, 2] | 1. Saves to JSON file 2. Save to cache memory |
| saving_dir | str | Target directory for saving JSON file Defaults to current working directory |
| saved_json | str | None | File path of save JSON, populated automatically |
model_config
Configuration to allow extra fields beyond the declared schema.
getattr(self, item:str)
If a requested attribute is not found on the model, this method checks the results dictionary to retrieve the value.
model_dump(self, args, *kwargs)
Serializes the model with alias preservation.
Computed fields
| Field | Type | Description |
|---|---|---|
| name | str | Returns the name of the material prefixed with Rc_, derived from info.name |
Validation and De-serialization
default_id(cls, values:dict)
Generates _id if not provided. This fixes legacy data that did not have _id.
default_properties(cls, value: dict)
Initializes core properties (ENCUT< KSPACING, SYMPREC) with default values if they are missing
load_history(self) -> Self
Sets host object on process in history and updates them accordingly.
load(cls, value: str | dict)
Loaded from file path or dictionary
Utilities
save(self, mode: Literal[1, 2] | None = None, dump = False)
Used to save any progress or modification to the calculations being run.
- mode = 1: Saves in the local work directory as a json file
- mode = 2: Saves to the history attribute of a mat_record object
confirm_overwrite(self, calculation, _confirmation: Literal["yes", "no"] | None = None)
for user to confirm whether to overwrite an existing calculations in the history.
recall(self, include, exclude)
Returns a filtered list of previous calculation from history.
progress(self, type, state, include, exclude, show) -> pd.DataFrame | JobInfo
Returns a summary of a job progress. - include: the calculations to include - exclude: the calculations to exclude
progress(type="simple") # percentage completed
progress(type="states") # full job states in a table
progress(type="full_info") # detailed job object info
status(self, include, exclude, show) -> pd.DataFrame
Returns job state (e.g., COMPLETED, FAILED) for each calculation.
list_calculations(self, show: bool = True) ->pd.DataFrame
Returns a DataFrame summarizing all stored calculations.
list_results(self, show: bool = True) -> pd.DataFrame
Restuls all the results in a pd.DataFrame
calculate(self, calculation, generat_func, overwrite, start, submit, cluster, force_confirmation, **kwargs) -> process
Initializes and optionally runs a new calculation
- calculation: a process subclass or the name of the subclass in str
- generator_func: A user created function that takes self. Addition process() specific arguements given as **kwargs will be ignored
- overwrite: option to overwrite any existing calculations of the same name in history.
- start: Whether to call the start() function of the calculation automatically or requires the user to call the function explicitly on the process obejct returned.
- start+kwargs: kwargs parsed to the start() function of the process
- force_confirmation: used by higher level objects to force a confirmation by using the confirmation it has received
output_collate(self, JS, JC, include, exclude)
Aggregates results for completed jobs using JS: JobStore and JC: JobController.
write_property(self, include, exclude, **kwargs) -> pd.DataFrame
Extracts a property from each relevant calculation and stores it in results.
result_collection(self, JS, JC, include, exclude, **kwargs) -> pd.DataFrame
Combines output_collate() and write_property() as a full post-processing pipeline.
fail_assess(self, show, include, exclude, **kwargs) -> pd.DataFrame
Analyzes and returns a table of failed jobs and their issues.
rerun(self, new_cluster, new_job, new_incr, include, exclude) -> dict
Resubmits failed or incomplete jobs with new settings. Returns a dict of changes.
Note
- This is material centric, as opposed to
Projectwhich is system-centric.