featurebox.featurizers.envir package¶
This part is for local environment features, mainly contains bond and state features.
Subpackages¶
Submodules¶
featurebox.featurizers.envir.desc_env module¶
Use descriptors form pyXtal_FF, in featurebox.test_featurizers.descriptors
all with calculate method.
- featurebox.featurizers.envir.desc_env.get_5_result(d: Dict, **kwargs) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray]¶
Change each center atoms has fill_size neighbors. More neighbors would be abandoned. Insufficient neighbors would be duplicated.
- 参数:
d – dict, dict of descriptor. at lest contain “x” and “dxdr”
fill_size – int, unstable.
- 返回:
(center_indices,center_prop, neighbor_indices, images, distances)
center_indices: np.ndarray 1d(N,).
neighbor_indices: np.ndarray 2d(N,fill_size).
images: np.ndarray 2d(N,fill_size,l).
distance: np.ndarray 2d(N,fill_size), None. center_prop: np.ndarray 1d(N,l_c).
- featurebox.featurizers.envir.desc_env.get_strategy2_in_spheres(structure, nn_strategy, cutoff, numerical_tol=None, cutoff_name='cutoff', pbc=True)¶
- featurebox.featurizers.envir.desc_env.mark_classes(classes: List)¶
featurebox.featurizers.envir.environment module¶
- class featurebox.featurizers.envir.environment.GEONNGet(nn_strategy: str = 'UserVoronoiNN', refine: str = 'geo_refine_nn', refined_strategy_param: Optional[Dict] = None, numerical_tol=1e-08, pbc: Union[List[int], bool] = False, cutoff=5.0, check_align=True, cutoff_name='cutoff', n_jobs=1, on_errors='raise', return_type='any')¶
基类:
_BaseEnvGetGet properties from Pymatgen.Structure. Where the nn_strategy is from
Pymatgen. And each structure is convert to data as following :center_indices:np.ndarray of shape(n,)center indexes.
neighbor_indices:np.ndarray of shape(n,fill_size)neighbor_indexes for each center_index. fill_size is the parameter of refine function.
images:np.ndarray of shape(n,lb>=3)offset vector in 3 orientations or more bond properties.
distances:np.ndarray of shape(n,fill_size)distance of neighbor_indexes for each center_index.
center_properties:np.ndarray of shape(n,l_c)center properties.
- 参数:
nn_strategy (str) – [“find_points_in_spheres”, “find_xyz_in_spheres”, “BrunnerNN_reciprocal”, “BrunnerNN_real”, “BrunnerNN_relative”, “EconNN”, “CrystalNN”, “MinimumDistanceNNAll”, “find_points_in_spheres”,”UserVoronoiNN”, “ACSF”,”BehlerParrinello”,”EAD”,”EAMD”,”SOAP”,”SO3”,”SO4_Bispectrum”,”wACSF”,]
refine (str) – sort method for neighbors of each atom. See Also:
universe_refine_nn()refined_strategy_param (dict) – parameters for refine
numerical_tol (float) – numerical_tol
pbc (list) – periodicity in 3 direction 3-length list,each one is 1 or 0. such as [0,0,0],The 1 mean in this direction is with periodicity.
cutoff – cutoff radius
- convert(structure: Union[Structure, Molecule]) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray]¶
- 参数:
structure – Structure,pymatgen Structure
- 返回:
center_indices,center_prop,neighbor_indices,images,distances
- get_radius(structure: Union[Structure, Molecule], cutoff) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray]¶
For quick get bond distance
- get_strategy1(structure: Union[Structure, Molecule], cutoff) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray]¶
For get bond distance with different strategy, for different nn_staagy could be rewrite.
- get_strategy2(structure: Union[Structure, Molecule, Atoms], cutoff) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray]¶
For get bond distance with different strategy, for different nn_staagy could be rewrite.
- get_xyz(structure: Union[Structure, Molecule], cutoff) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray]¶
For quick get bond distance
- featurebox.featurizers.envir.environment.geo_refine_nn(center_indices, neighbor_indices, vectors, distances, center_prop=None, ele_numbers=None, fill_size=10, dis_sort=True, **kwargs)¶
Change each center atoms has fill_size neighbors. More neighbors would be abandoned. Insufficient neighbors would be duplicated.
- 参数:
center_indices – np.ndarray 1d
neighbor_indices – np.ndarray 1d
distances – np.ndarray 1d or np.ndarray 2d
vectors – np.ndarray 2d
center_prop – np.ndarray 2d
ele_numbers – np.ndarray 1d
fill_size – float, not use,
cutoff –
dis_sort – bool sort neighbors with distance.
- 返回:
(center_indices,center_indices, neighbor_indices, images, distances)
center_indices: np.ndarray 1d(N,).
neighbor_indices: np.ndarray 2d(N,fill_size).
images: np.ndarray 2d(N,fill_size,l).
distance: np.ndarray 2d(N,fill_size,1). center_prop: np.ndarray 1d(N,l_c).
where l, and l_c >= 1
- featurebox.featurizers.envir.environment.get_marked_class(nn_strategy, env_dict: Optional[Dict] = None, instantiation: bool = True)¶
- 参数:
nn_strategy –
env_dict (dict) – dict of pre-definition, {“classname”: class}.
instantiation (bool) – return class of object.
- 返回:
object or class in NNDict.
- 返回类型:
obj
featurebox.featurizers.envir.local_env module¶
Use NearNeighbors from pymatgen.
all with get_all_nn_info method.
Most in pymatgen.analysis.local_env or
in pymatgen.optimization.neighbors.find_points_in_spheres()
The costumed as following:
- class featurebox.featurizers.envir.local_env.AllAtomPairs¶
基类:
NearNeighborsGet all combinations of atoms as bonds in a molecule
- get_nn_info(molecule: Molecule, n: int) List[Dict]¶
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 featurebox.featurizers.envir.local_env.MinimumDistanceNNAll(cutoff: float = 4.0)¶
基类:
NearNeighborsDetermine bonded sites by fixed cutoff.
- 参数:
cutoff (float) – cutoff radius in Angstrom to look for trial near-neighbor sites (default: 4.0).
- get_nn_info(structure: Structure, n: int) List[Dict]¶
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.
- 参数:
structure (Structure) – input structure.
n (int) – index of site for which to determine near neighbors.
- 返回:
- tuples, each one of which represents a neighbor site, its image location,
and its weight.
- 返回类型:
(list of tuples (Site, array, float))
- class featurebox.featurizers.envir.local_env.UserVoronoiNN(tol=0, targets=None, cutoff=13.0, allow_pathological=False, weight='solid_angle', extra_nn_info=True, compute_adj_neighbors=True)¶
基类:
VoronoiNNNot for all structure.
- 参数:
tol (float) – tolerance parameter for near-neighbor finding. Faces that are smaller than tol fraction of the largest face are not included in the tessellation. (default: 0).
targets (Element or list of Elements) – target element(s).
cutoff (float) – cutoff radius in Angstrom to look for near-neighbor atoms. Defaults to 13.0.
allow_pathological (bool) – whether to allow infinite vertices in determination of Voronoi coordination.
weight (string) – available in get_voronoi_polyhedra)
extra_nn_info (bool) –
compute_adj_neighbors (bool) – adjacent. Turn off for faster performance
- featurebox.featurizers.envir.local_env.get_strategy1_in_spheres(structure: Union[Structure, Molecule], nn_strategy: NearNeighbors, cutoff: float = 5.0, numerical_tol: float = 1e-08, pbc=True) Tuple[ndarray, ndarray, ndarray, ndarray, ndarray]¶
- featurebox.featurizers.envir.local_env.mark_classes(classes: List)¶