InteractionConstraint¶
-
class
narupatools.ase.constraints.imd_constraint.InteractionConstraint(*, dynamics: Union[ase.atoms.Atoms, narupatools.ase.constraints.imd_constraint.ASEAtomsWrapper], key: str, interaction: narupa.imd.particle_interaction.ParticleInteraction, start_time: float)¶ An ASE constraint that applies an iMD force.
This conflates both an implementation of a narupatools interaction and an ASE constraint.
Inheritance

Methods
Create an ASE constraint that will apply an interactive force.
Adjust the forces in-place for an ASE Atoms object.
Adjust the momenta in-place for an ASE Atoms object.
Adjust the positions in-place for an ASE Atoms object.
Get the difference in potential energy due to this constraint.
Get the positions of the affected particles for this interaction, in nanometers.
Perform any tasks necessary after a dynamics step.
Perform any tasks necessary before a dynamics step.
Calculate the forces and energy of this interaction.
-
__init__(*, dynamics: Union[ase.atoms.Atoms, narupatools.ase.constraints.imd_constraint.ASEAtomsWrapper], key: str, interaction: narupa.imd.particle_interaction.ParticleInteraction, start_time: float)¶ Create an ASE constraint that will apply an interactive force.
- Parameters
dynamics – Dynamics this interaction is attached to.
key – Unique key to identify this interaction.
interaction – Initial parameters of the interaction.
start_time – Start time of interaction in simulation time in picoseconds
-
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.
-
adjust_potential_energy(atoms: ase.atoms.Atoms) → float¶ Get the difference in potential energy due to this constraint.
- Parameters
atoms – The ASE Atoms object this constraint applies to.
- Returns
The difference in potential energy, in eV.
-
get_positions() → numpy.ndarray[Any, numpy.dtype[numpy.float64]]¶ Get the positions of the affected particles for this interaction, in nanometers.
These are needed to calculate work.
- Returns
Array of positions for the particles affected by this interaction.
-
update_energy_and_forces(*, atoms: Optional[ase.atoms.Atoms] = None) → Tuple[numpy.ndarray[Any, numpy.dtype[numpy.float64]], float]¶ Calculate the forces and energy of this interaction.
Overriding this allows a subclass to implement features such as caching.
- Returns
Tuple of forces (in kilojoules per mole per nanometer) and energy (in kilojoules per mole).
Attributes
Forces that will be applied by the interaction.
Current parameters of the interaction.
List of indices affected by this interaction.
Potential energy of the interaction, in kilojoules per mole.
Start time of the interaction in picoseconds.
Total work performed by interaction in kilojoules per mole.
Work performed last step in kilojoules per mole.
-
forces¶ Forces that will be applied by the interaction.
The forces are in kilojoules per mole per nanometer.
This is a (N, 3) NumPy array, where N is the number of particles affected by this interaction.
-
interaction¶ Current parameters of the interaction.
-
particle_indices¶ List of indices affected by this interaction.
-
potential_energy¶ Potential energy of the interaction, in kilojoules per mole.
-
start_time¶ Start time of the interaction in picoseconds.
-
total_work¶ Total work performed by interaction in kilojoules per mole.
-
work_last_step¶ Work performed last step in kilojoules per mole.
-