megnet.data.local_env module

Various NearNeighbors strategies to define local environments of sites in structure/molecule. Most of them are directly from pymatgen.analysis.local_env. The suitable NearNeighbors should have get_nn_info method implemented and this method needs to return a list of dict with each entry having following keys [‘site’, ‘image’, ‘weight’, ‘site_index’]

the weight will be used as the bond attributes in subsequent graph construction

class AllAtomPairs[source]

Bases: pymatgen.analysis.local_env.NearNeighbors

Get all combinations of atoms as bonds in a molecule

get_nn_info(molecule: pymatgen.core.structure.Molecule, n: int) List[Dict][source]

Get near neighbor information :param molecule: pymatgen Molecule :type molecule: Molecule :param n: number of molecule :type n: int

Returns: List of neighbor dictionary

class MinimumDistanceNNAll(cutoff: float = 4.0)[source]

Bases: pymatgen.analysis.local_env.NearNeighbors

Determine bonded sites by fixed cutoff

Args:.
cutoff (float): cutoff radius in Angstrom to look for trial

near-neighbor sites (default: 4.0).

get_nn_info(structure: pymatgen.core.structure.Structure, n: int) List[Dict][source]

Get all near-neighbor sites as well as the associated image locations and weights of the site with index n using the closest neighbor distance-based method.

Parameters
  • structure (Structure) – input structure.

  • n (integer) – index of site for which to determine near neighbors.

Returns

tuples, each one

of which represents a neighbor site, its image location, and its weight.

Return type

siw (list of tuples (Site, array, float))

deserialize(config: Dict)[source]

Deserialize the config dict to object :param config: (dict) nn_strategy config dict from seralize function

Returns: object

get(identifier: Union[str, Dict, pymatgen.analysis.local_env.NearNeighbors]) pymatgen.analysis.local_env.NearNeighbors[source]

Deserialize the NearNeighbors :param identifier: target for deserialize :type identifier: str, dict or NearNeighbors

Returns: NearNeighbors instance

serialize(identifier: Union[str, pymatgen.analysis.local_env.NearNeighbors])[source]

Serialize the local env objects to a dictionary :param identifier: (NearNeighbors object/str/None)

Returns: dictionary or None