adslab_predictions#

class catlas.adslab_predictions.BatchOCPPredictor(checkpoint, number_steps, batch_size=8, cpu=False)#

Variable used to store the model used during predictions. Specifications are contained in the input config. This variable is globalized within a worker to avoid duplicate model loading.

direct_prediction(graphs_list)#

Run direct energy predictions on a list of graphs. Predict the relaxed energy without running ML relaxations.

Parameters

graphs_list (Iterable[torch_geometric.data.Data]) – structures to run inference on.

Returns

predicted energies of the input structures.

Return type

Iterable[float]

load_checkpoint(checkpoint_path)#

Load existing trained model

Parameters

checkpoint_path (str) – Path to trained model

make_dataloader(graphs_list)#

Make the dataloader used to feed graphs into the OCP model.

Parameters

graphs_list (Iterable[torch_geometric.data.Data]) – structures to run predictions on.

Returns

an object that feeds data into pytorch models.

Return type

torch.utils.data.DataLoader

relaxation_prediction(graphs_list)#

Relax structures, then predict their energies.

Parameters

graphs_list (Iterable[torch_geometric.data.Data]) – structures to run predictions on.

Returns

predicted energies Iterable[torch_geometric.data.Data): relaxed structures

Return type

Iterable[float]

class catlas.adslab_predictions.GraphsListDataset(graphs_list)#

Make a list of graphs to feed into ocp dataloader object

Extends:

torch.utils.data.Dataset: a torch Dataset

catlas.adslab_predictions.count_steps(config, df_results)#

Count the number of adslabs remaining at each filtering step.

Parameters
  • config (dict) – a catlas config

  • df_results (pd.core.frame.DataFrame) – the output of a catlas run

Returns

a list of steps and the number of adslabs remaining at that step int: the original number of adslabs before filtering

Return type

list[dict]

catlas.adslab_predictions.energy_prediction(adslab_dict, adslab_atoms, hash_adslab_atoms, hash_adslab_dict, graphs_dict, checkpoint_path, column_name, batch_size=8, gpu_mem_per_sample=None, number_steps=200)#

Predict the energies of adslabs.

Parameters
  • adslab_dict (dict) – A view of the adslabs to predict that will be used to store results. Should be ignored during cache comparisons.

  • adslab_atoms (Iterable[ase.atoms.Atoms]) – Adslabs containing the same adsorbate placed on different sites on the same surface. Should be ignored during cache comparisons.

  • hash_adslab_atoms (str) – A hash specific to adslab_atoms used for cache comparisons.

  • hash_adslab_dict (str) – A hash specific to adslab_dict used for cache comparisons

  • graphs_dict (dict) – A view of the adslabs to predict that will be used to predict energies. Should be ignored during cache comparisons.

  • checkpoint_path (str) – The path where the OCP model checkpoint can be found.

  • column_name (str) – An arbitrary name used to define the model output field names.

  • batch_size (int, optional) – The number of adslabs loaded onto a gpu at a single time during relaxations. Should be ignored during cache comparisons. Defaults to 8.

  • gpu_mem_per_sample (float, optional) – The approximate memory used by a single adslab during relaxations, used to determine batch size. Defaults to None.

  • number_steps (int, optional) – The number of steps used during relaxations. Should be determined using bin/optimize_frame.py. Defaults to 200.

Returns

Energy predictions and metadata including associated structures

and minimum predicted energy per surface.

Return type

dict

class catlas.adslab_predictions.GraphsListDataset(graphs_list)#

Make a list of graphs to feed into ocp dataloader object

Extends:

torch.utils.data.Dataset: a torch Dataset

class catlas.adslab_predictions.BatchOCPPredictor(checkpoint, number_steps, batch_size=8, cpu=False)#

Variable used to store the model used during predictions. Specifications are contained in the input config. This variable is globalized within a worker to avoid duplicate model loading.

direct_prediction(graphs_list)#

Run direct energy predictions on a list of graphs. Predict the relaxed energy without running ML relaxations.

Parameters

graphs_list (Iterable[torch_geometric.data.Data]) – structures to run inference on.

Returns

predicted energies of the input structures.

Return type

Iterable[float]

load_checkpoint(checkpoint_path)#

Load existing trained model

Parameters

checkpoint_path (str) – Path to trained model

make_dataloader(graphs_list)#

Make the dataloader used to feed graphs into the OCP model.

Parameters

graphs_list (Iterable[torch_geometric.data.Data]) – structures to run predictions on.

Returns

an object that feeds data into pytorch models.

Return type

torch.utils.data.DataLoader

relaxation_prediction(graphs_list)#

Relax structures, then predict their energies.

Parameters

graphs_list (Iterable[torch_geometric.data.Data]) – structures to run predictions on.

Returns

predicted energies Iterable[torch_geometric.data.Data): relaxed structures

Return type

Iterable[float]