PropertyDatasetBase¶
-
class
hdnnpy.dataset.property.property_dataset_base.
PropertyDatasetBase
(order, structures)[source]¶ Bases:
abc.ABC
Base class of atomic structure based property dataset.
Common instance variables for property datasets are initialized.
Parameters: - order (int) – Derivative order of property to calculate.
- structures (list [AtomicStructure]) – Properties are calculated for these atomic structures.
-
__getitem__
(item)[source]¶ Return property data this instance has.
If
item
is string, it returns corresponding property. Available keys can be obtained byproperties
attribute. Otherwise, it returns a list of property sliced byitem
.
-
calculate_properties
(structure)[source]¶ Calculate required properties for a structure data.
This is abstract method. Subclass of this base class have to override.
Parameters: structure (AtomicStructure) – A structure data to calculate properties. Returns: Calculated properties. The length is the same as order
given at initialization.Return type: list [ndarray]
-
load
(file_path, verbose=True, remake=False)[source]¶ 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.
- order
Parameters: Raises: AssertionError
– If loaded dataset is incompatible with atomic structures given at initialization.ValueError
– If loaded dataset is lacking in any property andremake=False
.
-
make
(verbose=True)[source]¶ Calculate & retain property dataset
It calculates property dataset by data-parallel using MPI communication.The calculated dataset is retained in only root MPI process.Each property values are divided by
COEFFICIENTS
which is unique to each property dataset class.Parameters: verbose (bool, optional) – Print log to stdout.
-
save
(file_path, verbose=True)[source]¶ Save dataset to .npz format file.
Only root MPI process save dataset.
Parameters: Raises: RuntimeError
– If this instance do not have any data.
-
elemental_composition
¶ Elemental composition of atomic structures given at initialization.
Type: list [str]