megnet.utils.descriptor module¶
This module implements atom/bond/structure-wise descriptor calculated from pretrained megnet model
- class MEGNetDescriptor(model_name: Union[str, megnet.models.base.GraphModel, megnet.models.megnet.MEGNetModel] = '/Users/chichen/repos/megnet/docs_rst/../megnet/utils/../../mvl_models/mp-2019.4.1/formation_energy.hdf5', use_cache: bool = True)[source]¶
Bases:
object
MEGNet descriptors. This class takes a trained model and then compute the intermediate outputs as structure features
- Parameters
model_name (str or MEGNetModel) – trained model. If it is str, then only models in mvl_models are used.
use_cache (bool) – whether to use cache for structure graph calculations
- get_atom_features(structure: Union[pymatgen.core.structure.Structure, pymatgen.core.structure.Molecule], level: int = 3) numpy.ndarray [source]¶
Get megnet atom features from structure :param structure: pymatgen structure or molecule :param level: int, indicating the block number of megnet, starting
from 1
- Returns
nxm atomic feature matrix
- get_bond_features(structure: Union[pymatgen.core.structure.Structure, pymatgen.core.structure.Molecule], level: int = 3) numpy.ndarray [source]¶
Get bond features at megnet block level :param structure: pymatgen structure :param level: int
- Returns
n_bond x m bond feature matrix
- get_global_features(structure: Union[pymatgen.core.structure.Structure, pymatgen.core.structure.Molecule], level: int = 2) numpy.ndarray [source]¶
Get state features at megnet block level :param structure: pymatgen structure or molecule :param level: int
- Returns
1 x m_g global feature vector
- get_set2set(structure: Union[pymatgen.core.structure.Structure, pymatgen.core.structure.Molecule], ftype: str = 'atom') numpy.ndarray [source]¶
Get set2set output as features :param structure: pymatgen structure
or molecule
- Parameters
ftype (str) – atom or bond
- Returns
feature matrix, each row is a vector for an atom or bond