ASEObserver

class narupatools.ase.constraints.observer.ASEObserver

ASE Constraint which listens for a change in its Atoms object.

It is not advisable to act immediately when one of the events are triggered, as there may be subsequent constraints that will modify the value.

Inheritance

Inheritance diagram of ASEObserver

Methods

__init__

Create a new ASEObserver.

adjust_cell

Adjust the unit cell in-place for an ASE Atoms object.

adjust_forces

Adjust the forces in-place for an ASE Atoms object.

adjust_momenta

Adjust the momenta in-place for an ASE Atoms object.

adjust_positions

Adjust the positions in-place for an ASE Atoms object.

get

Get the observer for the given Atoms, or None if one does not exist.

get_or_create

Get the observer for the given Atoms, or add a new one.

__init__()None

Create a new ASEObserver.

adjust_cell(atoms: ase.atoms.Atoms, cell: numpy.ndarray, /)None

Adjust the unit cell in-place for an ASE Atoms object.

Parameters
  • atoms – The ASE Atoms object this constraint applies to.

  • cell – 3x3 NumPy array of cell vectors, in angstrom.

adjust_forces(atoms: ase.atoms.Atoms, forces: numpy.ndarray, /)None

Adjust the forces in-place for an ASE Atoms object.

Parameters
  • atoms – The ASE Atoms object this constraint applies to.

  • forces – The forces to be modified by this constraint, in eV per nm.

adjust_momenta(atoms: ase.atoms.Atoms, momenta: numpy.ndarray, /)None

Adjust the momenta in-place for an ASE Atoms object.

Parameters
  • atoms – The ASE Atoms object this constraint applies to.

  • momenta – The momenta to be modified by this constraint, in a.m.u angstrom per ASE time unit.

adjust_positions(atoms: ase.atoms.Atoms, positions: numpy.ndarray, /)None

Adjust the positions in-place for an ASE Atoms object.

Parameters
  • atoms – The ASE Atoms object this constraint applies to.

  • positions – The positions to be modified by this constraint, in angstrom.

classmethod get(atoms: ase.atoms.Atoms)Optional[narupatools.ase.constraints.observer.ASEObserver]

Get the observer for the given Atoms, or None if one does not exist.

Parameters

atoms – Atoms object to look for an attached observer.

Returns

Found observer.

classmethod get_or_create(atoms: ase.atoms.Atoms)narupatools.ase.constraints.observer.ASEObserver

Get the observer for the given Atoms, or add a new one.

Parameters

atoms – Atoms object to look for an attached observer.

Returns

Found observer, or a newly created one which is added to the atoms object.

Attributes

on_set_cell

Event triggered when the system has its cell vectors modified.

on_set_momenta

Event triggered when the system has its momenta (and velocities) modified.

on_set_positions

Event triggered when the system has its positions modified.

on_set_cell

Event triggered when the system has its cell vectors modified.

on_set_momenta

Event triggered when the system has its momenta (and velocities) modified.

on_set_positions

Event triggered when the system has its positions modified.