HookeanRepulsion#

class autoplex.data.rss.utils.HookeanRepulsion(a1, a2, k, rt=None)[source]#

Bases: FixConstraint

Constrain atoms softly to a minimum separation.

Intended to avoid early iterations of potentials causing crashes due to overlapping atoms.

It is recommended to calibrate the spring constant for your system dependent on the potential and the atomic species used. It is not guaranteed that the constraint will be either soft enough (e.g. non-exploding in MD) or strong enough (to avoid overlaps) for all spring constants and distances.

Adapted from: * Title: ASE constraints package at at ase/ase/constraints.py * Author: Ask Hjorth Larsen * Copyright 2024, ASE-developers. * Date 07/10/2024 * Code version: 3.23.0 * Availability: ase/ * License: LGPLv2.1+

Parameters:
  • a1 (int) –

  • a2 (int | tuple[float, float, float] | tuple[float, float, float, float] | Literal['cell']) –

  • k (float) –

  • rt (float | None) –

get_removed_dof(atoms)[source]#

Get number of removed degrees of freedom due to constraint.

property todict#

Convert constraint to dictionary.

adjust_positions(atoms, newpositions)[source]#

Adjust positions to match the constraints.

Do nothing for this constraint.

adjust_momenta(atoms, momenta)[source]#

Adjust momenta to match the constraints.

Do nothing for this constraint.

adjust_forces(atoms, forces)[source]#

Adjust forces on the atoms to match the constraints.

adjust_potential_energy(atoms)[source]#

Return the difference to the potential energy due to an active constraint.

(the quantity returned is to be added to the potential energy).

get_indices()[source]#

Get the indices.

index_shuffle(atoms, ind)[source]#

Change the indices.