pyiron_atomistics.atomistics.job.atomistic.Trajectory#

class pyiron_atomistics.atomistics.job.atomistic.Trajectory(positions, structure, center_of_mass=False, cells=None, indices=None)[source]#

Bases: HasStructure

A trajectory instance compatible with the ase.io class

__init__(positions, structure, center_of_mass=False, cells=None, indices=None)[source]#
Parameters:
  • positions (ndarray) – The array of the trajectory in cartesian coordinates

  • structure (pyiron.atomistics.structure.atoms.Atoms) – The initial structure instance from which the species info is derived

  • center_of_mass (bool) – False (default) if the specified positions are w.r.t. the origin

  • cells (None/ndarray) – Optional argument of the cell shape at every time step (Nx3x3 array) when the volume varies

  • indices (None/ndarray) – Indices for the species in the structure

Methods

__init__(positions, structure[, ...])

param positions:

The array of the trajectory in cartesian coordinates

animate_structures([spacefill, show_cell, ...])

Animate a series of atomic structures.

collect_structures([filter_function])

Collects a copy of all structures in a compact StructureStorage.

get_neighbors([start, stop, stride, ...])

Get the neighbors for a given section of the trajectory

get_neighbors_snapshots([snapshot_indices, ...])

Get the neighbors only for the required snapshots from the trajectory

get_structure([frame, wrap_atoms, ...])

Retrieve structure from object.

iter_structures([wrap_atoms])

Iterate over all structures in this object.

transform_structures(modify)

Return a modified object by applying a function to each object lazily.

Attributes

number_of_structures

maximum iteration_step + 1 that can be passed to get_structure().

animate_structures(spacefill: bool = True, show_cell: bool = True, center_of_mass: bool = False, particle_size: float = 0.5, camera: str = 'orthographic')#

Animate a series of atomic structures.

Parameters:
  • spacefill (bool) – If True, then atoms are visualized in spacefill stype

  • show_cell (bool) – True if the cell boundaries of the structure is to be shown

  • particle_size (float) – Scaling factor for the spheres representing the atoms. (The radius is determined by the atomic number)

  • center_of_mass (bool) – False (default) if the specified positions are w.r.t. the origin

  • camera (str) – camera perspective, choose from “orthographic” or “perspective”

Returns:

nglview IPython widget

Return type:

animation

collect_structures(filter_function=None) StructureStorage#

Collects a copy of all structures in a compact StructureStorage.

This can be used to force lazily applied modifications with transform_structures() or simply to obtain a known object type from a generic HasStructure object.

Parameters:

filter_function (function) – include structure only if this function returns True for it

Returns:

a copy of all (filtered) structures

Return type:

StructureStorage

get_neighbors(start=0, stop=-1, stride=1, num_neighbors=12, **kwargs)[source]#

Get the neighbors for a given section of the trajectory

Parameters:
  • start (int) – Start point of the slice of the trajectory to be sampled

  • stop (int) – End point of of the slice of the trajectory to be sampled

  • stride (int) – Samples the snapshots evert stride steps

  • num_neighbors (int) – The cutoff for the number of neighbors

  • **kwargs (dict) – Additional arguments to be passed to the get_neighbors() routine (eg. cutoff_radius, norm_order , etc.)

Returns:

NeighborsTraj instances

containing the neighbor information.

Return type:

pyiron_atomistics.atomistics.structure.neighbors.NeighborsTrajectory

get_neighbors_snapshots(snapshot_indices=None, num_neighbors=12, **kwargs)[source]#

Get the neighbors only for the required snapshots from the trajectory

Parameters:
  • snapshot_indices (list/numpy.ndarray) – Snapshots for which the the neighbors need to be computed (eg. [1, 5, 10,…, 100]

  • num_neighbors (int) – The cutoff for the number of neighbors

  • **kwargs (dict) – Additional arguments to be passed to the get_neighbors() routine (eg. cutoff_radius, norm_order , etc.)

Returns:

NeighborsTraj instances

containing the neighbor information.

Return type:

pyiron_atomistics.atomistics.structure.neighbors.NeighborsTrajectory

get_structure(frame=-1, wrap_atoms=True, iteration_step=None)#

Retrieve structure from object. The number of available structures depends on the job and what kind of calculation has been run on it, see number_of_structures.

Parameters:

frame (int, object) – index of the structure requested, if negative count from the back; if

:param _translate_frame() is overridden: :param frame will pass through it: :param iteration_step: deprecated alias for frame :type iteration_step: int :param wrap_atoms: True if the atoms are to be wrapped back into the unit cell :type wrap_atoms: bool

Returns:

the requested structure

Return type:

pyiron_atomistics.atomistics.structure.atoms.Atoms

Raises:

IndexError – if not -number_of_structures <= iteration_step < number_of_structures

iter_structures(wrap_atoms=True)#

Iterate over all structures in this object.

Parameters:

wrap_atoms (bool) – True if the atoms are to be wrapped back into the unit cell; passed to get_structure()

Yields:

pyiron_atomistics.atomistitcs.structure.atoms.Atoms – every structure attached to the object

property number_of_structures#

maximum iteration_step + 1 that can be passed to get_structure().

Type:

int

transform_structures(modify) TransformStructure#

Return a modified object by applying a function to each object lazily.

Parameters:

modify (function) – applied to each structure, has to return the modified structure

Returns:

a container with the modified structures

Return type:

TransformStructure