Particle

class halmd.mdsim.particle(args)

Construct particle instance.

Parameters:
  • args (table) – keyword arguments
  • args.dimension (number) – dimension of space
  • args.particles (number) – number of particles
  • args.species (number) – number of species (default: 1)
  • args.memory (string) – device where the particle information is stored (optional)
  • args.label (string) – instance label (default: all)

The supported values for memory are “host” and “gpu”. If memory is not specified, the memory location is selected according to the compute device.

nparticle

Number of particles.

nspecies

Number of particle species.

label

Instance label.

memory

Device where the particle memory resides.

Warning

During simulation, particle arrays are reordered in memory according to a space-filling curve. To access particles in initial order, use get_reverse_tag() to retrieve the current particle indices.

get_position()

Returns sequence with particle positions.

set_position(position)

Set particle positions to given sequence.

get_image()

Returns sequence with particle images.

set_image(image)

Set particle images to given sequence.

get_velocity()

Returns sequence with particle velocities.

set_velocity(velocity)

Set particle velocities to given sequence.

get_tag()

Returns sequence with particle tags.

set_tag(tag)

Set particle tags to given sequence.

get_reverse_tag()

Returns sequence with particle reverse tags.

set_reverse_tag(reverse_tag)

Set particle reverse tags to given sequence.

get_species()

Returns sequence with particle species.

set_species(species)

Set particle species to given sequence.

get_mass()

Returns sequence with particle masses.

set_mass(mass)

Set particle masses to given sequence.

get_force()

Returns unordered sequence with particle forces.

get_potential_energy()

Returns unordered sequence with potential energies.

get_stress_pot()

Returns unordered sequence with potential parts of stress tensors.

shift_velocity(vector)

Shift all velocities by vector.

shift_velocity_group(group, vector)

Shift velocities of group by vector.

rescale_velocity(scalar)

Rescale magnitude of all velocities by scalar.

rescale_velocity_group(group, scalar)

Rescale magnitude of velocities of group by scalar.

shift_rescale_velocity(vector, scalar)

First shift, then rescale all velocities.

shift_rescale_velocity_group(group, vector, scalar)

First shift, then rescale velocities of group.

aux_enable()

Enable the computation of auxliliary variables in the next on_force() step. These are: stress_pot and potential_energy and derived properties (such as the internal energy or the virial). The auxiliary variables should be activated like this:

sampler:on_prepare(function() particle:aux_enable() end, every, start)
on_prepend_force(slot)

Connect nullary slot to signal.

Returns:signal connection
on_force(slot)

Connect nullary slot to signal.

Returns:signal connection
on_append_force(slot)

Connect nullary slot to signal.

Returns:signal connection
__eq(other)
Parameters:other – instance of halmd.mdsim.particle

Implements the equality operator a = b and returns true if the other particle instance is the same as this one.