Interface

class Interaction : public mirheo::MirSimulationObject

Compute forces from particle interactions.

We distinguish two kinds of interactions (see Stage enum type):

  1. Intermediate ones, that do not compute any force, but compute intermediate quantities (e.g. densities in SDPD).
  2. Final ones, that compute forces (and possibly other quantities, e.g. stresses).

Subclassed by mirheo::BaseMembraneInteraction, mirheo::BasePairwiseInteraction, mirheo::BaseRodInteraction, mirheo::ChainInteraction, mirheo::ObjectBindingInteraction, mirheo::ObjectRodBindingInteraction

Public Types

enum Stage

Describes the stage of an interaction.

Values:

Intermediate
Final
using ActivePredicate = std::function<bool()>

Used to specify if a channel is active or not.

If a channel is inactive, the Interaction object can tell the simulation via this function object that the concerned channel does not need to be exchanged.

Typically, this can store the simulation state and be active only at given time intervals. The most common case is to be always active.

Public Functions

Interaction(const MirState *state, std::string name)

Constructs a Interaction object.

Parameters
  • state: The global state of the system
  • name: The name of the interaction

virtual void setPrerequisites(ParticleVector *pv1, ParticleVector *pv2, CellList *cl1, CellList *cl2)

Add needed properties to the given ParticleVectors for future interactions.

Must be called before any other method of this class.

Parameters

virtual void local(ParticleVector *pv1, ParticleVector *pv2, CellList *cl1, CellList *cl2, cudaStream_t stream) = 0

Compute interactions between bulk particles.

The result of the interaction is

added to the corresponding channel of the ParticleVector. The order of pv1 and pv2 may change the performance of the interactions.
Parameters
  • pv1: first interacting ParticleVector
  • pv2: second interacting ParticleVector. If it is the same as the pv1, self interactions will be computed.
  • cl1: cell-list built for the appropriate cut-off radius for pv1
  • cl2: cell-list built for the appropriate cut-off radius for pv2
  • stream: Execution stream

virtual void halo(ParticleVector *pv1, ParticleVector *pv2, CellList *cl1, CellList *cl2, cudaStream_t stream) = 0

Compute interactions between bulk particles and halo particles.

The result of the interaction is

added to the corresponding channel of the ParticleVector. In general, the following interactions will be computed: pv1->halo() <> pv2->local() and pv2->halo() <> pv1->local().
Parameters
  • pv1: first interacting ParticleVector
  • pv2: second interacting ParticleVector. If it is the same as the pv1, self interactions will be computed.
  • cl1: cell-list built for the appropriate cut-off radius for pv1
  • cl2: cell-list built for the appropriate cut-off radius for pv2
  • stream: Execution stream

virtual bool isSelfObjectInteraction() const

This is useful to know if we need exchange / cell-lists for that interaction. Example: membrane interactions are internal, all particles of a membrane are always on the same rank thus it does not need halo particles.

Return
boolean describing if the interaction is an internal interaction.

virtual Stage getStage() const

returns the Stage corresponding to this interaction.

virtual std::vector<InteractionChannel> getInputChannels() const

Returns which channels are required as input.

Positions and velocities are always required and are not listed here; Only other channels must be specified here.

virtual std::vector<InteractionChannel> getOutputChannels() const

Returns which channels are those output by the interactions.

virtual std::optional<real> getCutoffRadius() const

Return
the cut-off radius of the interaction; std::nullopt if there is no cutoff.

Public Static Attributes

const ActivePredicate alwaysActive

a predicate that always returns true.

struct InteractionChannel

A simple structure used to describe which channels are active.

Public Members

std::string name

the name of the channel

ActivePredicate active

the activity of the channel