AtomicStructure

class hdnnpy.dataset.atomic_structure.AtomicStructure(atoms)[source]

Bases: object

Wrapper class of ase.Atoms.

It wraps ase.Atoms object to define additional methods and attributes.
Before wrapping, it sorts atoms by element alphabetically.
It stores calculated neighbor information such as distance, indices.
Parameters:atoms (Atoms) – an object to wrap.
clear_cache(cutoff_distance=None)[source]

Clear up cached neighbor information in this instance.

Parameters:cutoff_distance (float, optional) – It clears the corresponding cached data if specified, otherwise it clears all cached data.
get_neighbor_info(cutoff_distance, geometry_keys)[source]

Calculate or return cached data.

If there is no cached data, calculate it as necessary.
The calculated result is cached, and retained unless you use clear_cache() method.
Parameters:
  • cutoff_distance (float) – It calculates the geometry for the neighboring atoms within this value of each atom in a cell.
  • geometry_keys (list [str]) – A list of atomic geometries to calculate between an atom and its neighboring atoms.
Returns:

Neighbor information required by geometry_keys for each atom in a cell.

Return type:

Iterator [tuple]

classmethod read_xyz(file_path)[source]

Read .xyz format file and make a list of instances.

Parses .xyz format file using ase.io.iread() and wraps it by this class.

Parameters:file_path (Path) – File path to read atomic structures.
Returns:Initialized instances.
Return type:list [AtomicStructure]
elements

Elements included in a cell.

Type:list [str]