kliff.transforms.configuration_transforms.graphs¶
- class kliff.transforms.configuration_transforms.graphs.RadialGraph(species, cutoff, n_layers=1, copy_to_config=False, mic=False)[source]¶
Generate a graph representation of a configuration. This generator will also save the required parameters for porting the model over to KIM-API using TorchMLModelDriver. The configuration file saved here will generate identical graphs at KIM-API runtime. For porting the graph representation you also need to provide the TorchScript model file name.
- Parameters:
species (list) – List of species.
cutoff (float) – Cutoff distance.
n_layers (int) – Number of convolution layers.
copy_to_config (bool) – If True, the graph will be copied to the Configuration object’s fingerprint attribute.
mic (bool) – If True, module will return conventional MIC graphs, as opposed to the parallel staged graphs.
- forward(configuration)[source]¶
Generate a graph representation of a configuration.
- Parameters:
configuration (
Configuration) – Instance of ~:class:kliff.dataset.Configuration. For which the graph representation is to be generated.- Return type:
- Returns:
C++ custom graph object or Pytorch Geometric Data object.
- static to_py_graph(graph)[source]¶
Convert a C++ graph object to a KLIFF Geometric Graph Data object,
GraphData.- Parameters:
graph (
GraphData) – C++ graph data object.- Return type:
- Returns:
PyGGraph object.
- export_kim_model(path, model)[source]¶
Save the transform toa text file for reuse. This is currently used to load the model into KIM-API for pre-processing. The model name is also required to correctly load the model into KIM-API.
- Parameters:
path (
Path) – Path to save the parameter file.model (
str) – name of model to save.
- class kliff.transforms.configuration_transforms.graphs.PyGGraph(*args: Any, **kwargs: Any)[source]¶
A Pytorch Geometric compatible graph representation of a configuration. When loaded into a class:torch_geometric.data.DataLoader the graphs of type PyGGraph will be automatically collated and batched.