SymmetryFunctionDataset¶
-
class
hdnnpy.dataset.descriptor.symmetry_function_dataset.
SymmetryFunctionDataset
(order, structures, **func_param_map)[source]¶ Bases:
hdnnpy.dataset.descriptor.descriptor_dataset_base.DescriptorDatasetBase
Symmetry function dataset for descriptor of HDNNP.
It accepts 0 or 2 for
order
.Each symmetry function requires following parameters.Pass parameters you want to use for the dataset as keyword argumentsfunc_param_map
.- type1: \(R_c\)
- type2: \(R_c, \eta, R_s\)
- type4: \(R_c, \eta, \lambda, \zeta\)
Parameters: - order (int) – passed to super class.
- structures (list [AtomicStructure]) – passed to super class.
- **func_param_map (list [tuple]) – parameter sets for each type of symmetry function.
References
Symmetry function was proposed by Behler et al. in this paper as a descriptor of HDNNP. Please see here for details of each symmetry function.
-
__getitem__
(item)¶ Return descriptor data this instance has.
If
item
is string, it returns corresponding descriptor. Available keys can be obtained bydescriptors
attribute. Otherwise, it returns a list of descriptor sliced byitem
.
-
__len__
()¶ Number of atomic structures given at initialization.
-
calculate_descriptors
(structure)[source]¶ Calculate required descriptors for a structure data.
Parameters: structure (AtomicStructure) – A structure data to calculate descriptors. Returns: Calculated descriptors. The length is the same as order
given at initialization.Return type: list [ndarray]
-
clear
()¶ Clear up instance variables to initial state.
-
generate_feature_keys
(elements)[source]¶ Generate feature keys from given elements and parameters.
parameters given at initialization are used.This method is used to initialize instance and expand feature dimension inHDNNPDataset
.Parameters: elements (list [str]) – Unique list of elements. It should be sorted alphabetically. Returns: Generated feature keys in a format like <func_name>:<parameters>:<elements>
.Return type: list [str]
-
load
(file_path, verbose=True, remake=False)¶ Load dataset from .npz format file.
Only root MPI process load dataset.
It validates following compatibility between loaded dataset and atomic structures given at initialization.
- length of data
- elemental composition
- elements
- tag
It also validates that loaded dataset satisfies requirements.
- feature keys
- order
Parameters: Raises: AssertionError
– If loaded dataset is incompatible with atomic structures given at initialization.ValueError
– If loaded dataset is lacking in any feature key or any descriptor andremake=False
.
-
make
(verbose=True)¶ Calculate & retain descriptor dataset
It calculates descriptor dataset by data-parallel using MPI communication.The calculated dataset is retained in only root MPI process.Parameters: verbose (bool, optional) – Print log to stdout.
-
save
(file_path, verbose=True)¶ Save dataset to .npz format file.
Only root MPI process save dataset.
Parameters: Raises: RuntimeError
– If this instance do not have any data.
-
DESCRIPTORS
= ['sym_func', 'derivative', 'second_derivative']¶ Names of descriptors for each derivative order.
Type: list [str]
-
elemental_composition
¶ Elemental composition of atomic structures given at initialization.
Type: list [str]