megnet.data.crystal module¶
Crystal graph related
- class CrystalGraph(nn_strategy: Union[str, pymatgen.analysis.local_env.NearNeighbors] = 'MinimumDistanceNNAll', atom_converter: Optional[megnet.data.graph.Converter] = None, bond_converter: Optional[megnet.data.graph.Converter] = None, cutoff: float = 5.0)[source]¶
Bases:
megnet.data.graph.StructureGraphFixedRadius
Convert a crystal into a graph with z as atomic feature and distance as bond feature one can optionally include state features
Convert the structure into crystal graph :param nn_strategy: NearNeighbor strategy :type nn_strategy: str :param atom_converter: atom features converter :type atom_converter: Converter :param bond_converter: bond features converter :type bond_converter: Converter :param cutoff: cutoff radius :type cutoff: float
- class CrystalGraphDisordered(nn_strategy: Union[str, pymatgen.analysis.local_env.NearNeighbors] = 'MinimumDistanceNNAll', atom_converter: megnet.data.graph.Converter = <megnet.data.crystal._AtomEmbeddingMap object>, bond_converter: Optional[megnet.data.graph.Converter] = None, cutoff: float = 5.0)[source]¶
Bases:
megnet.data.graph.StructureGraphFixedRadius
Enable disordered site predictions
Convert the structure into crystal graph :param nn_strategy: NearNeighbor strategy :type nn_strategy: str :param atom_converter: atom features converter :type atom_converter: Converter :param bond_converter: bond features converter :type bond_converter: Converter :param cutoff: cutoff radius :type cutoff: float
- static get_atom_features(structure) List[dict] [source]¶
For a structure return the list of dictionary for the site occupancy for example, Fe0.5Ni0.5 site will be returned as {“Fe”: 0.5, “Ni”: 0.5}
- Parameters
structure (Structure) – pymatgen Structure with potential site disorder
- Returns
a list of site fraction description
- class CrystalGraphWithBondTypes(nn_strategy: Union[str, pymatgen.analysis.local_env.NearNeighbors] = 'VoronoiNN', atom_converter: Optional[megnet.data.graph.Converter] = None, bond_converter: Optional[megnet.data.graph.Converter] = None)[source]¶
Bases:
megnet.data.graph.StructureGraph
Overwrite the bond attributes with bond types, defined simply by the metallicity of the atoms forming the bond. Three types of scenario is considered, nonmetal-nonmetal (type 0), metal-nonmetal (type 1), and metal-metal (type 2)
- Parameters
- get_elemental_embeddings() Dict [source]¶
Provides the pre-trained elemental embeddings using formation energies, which can be used to speed up the training of other models. The embeddings are also extremely useful elemental descriptors that encode chemical similarity that may be used in other ways. See
“Graph Networks as a Universal Machine Learning Framework for Molecules and Crystals”, https://arxiv.org/abs/1812.05055
- Returns
Dict of elemental embeddings as {symbol: length 16 string}