espressomd.plugins package

Submodules

espressomd.plugins.ase module

class espressomd.plugins.ase.ASEInterface(system: System, particle_slice: ParticleSlice, export_charges: bool = False, export_masses: bool = False, export_momenta: bool = False, export_forces: bool = False, assume_constant_charges: bool = False, assume_constant_masses: bool = False, assume_constant_types: bool = False, use_folded_positions: bool = True)[source]

Bases: object

Interface for ASE [Hjorth Larsen et al., 2017] with calculator support.

Parameters:
  • system (espressomd.system.System) – The ESPResSo system object.

  • particle_slice (espressomd.particle_data.ParticleSlice) – The particle slice to work on.

  • export_charges (bool, optional) – Whether to make particle charges available to ASE.

  • export_masses (bool, optional) – Whether to make particle masses available to ASE.

  • export_momenta (bool, optional) – Whether to make particle momenta available to ASE.

  • export_forces (bool, optional) – Whether to make particle forces available to ASE.

  • assume_constant_charges (bool, optional) – Assume that the particles’ charges won’t change while this instance is valid (faster update).

  • assume_constant_masses (bool, optional) – Assume that the particles’ masses won’t change while this instance is valid (faster update).

  • assume_constant_types (bool, optional) – Assume that the particles’ types won’t change while this instance is valid (faster update).

  • use_folded_positions (bool, optional) – If True, use folded positions (particles.pos_folded) which are always within the simulation box. If False, use unfolded positions (particles.pos).

integrate(steps: int, calculator) int[source]

Integrate the system for the specified number of steps.

For each step:

  1. Update ASE with current particle data

  2. Get forces from calculator

  3. Set external forces on particles

  4. Run one integration step

Since the particle property ext_force is updated at every time step, cache invalidation is inevitable, and the symplectic Euler method is needed to conserve momentum (espressomd.integrate.SymplecticEuler).

Parameters:
  • steps (int) – Number of integration steps to perform.

  • calculator (ase.calculators.calculator.Calculator) – ASE calculator to use for force calculations.

Returns:

Number of steps actually performed

Return type:

int

reset()[source]

Re-create the ASE atoms object using ESPResSo system properties.

New ASE atom objects are created from the current particle slice with positions, types, periodicity and box dimensions. If export flags are set, charges, masses, momenta and/or forces are also initialized.

set_slice(particles)[source]

Set the slice of particles to work on. This results in the re-creation of the ASE atom objects.

update_ase()[source]

Update the arrays in the atom objects based on the desired properties.

The assume_constant_* flags determine which properties to update.

Module contents