simulation Module

class simulation.BaseMDSimulation(domain_in, potential_in=None, particle_pos_init=None, particle_vel_init=None, particle_mass_init=None, n=0, cutoff=None, domain_boundary_condition=None, setup_only=False, pairloop_in=None)

Bases: object

Class to setup and contain simulation. Provdies methods to update the kinetic energy and forces of the simulation state.

Parameters:
  • domain_in – Instance of a domain class to use for the simulation.
  • potential_in – Short range potential between particles in simulation.
  • particle_pos_init – Method to initialise particle positions with, see PosInit* classes.
  • particle_vel_init – Method to initialise particle velocities with, see VelInit* classes.
  • particle_mass_init – Method to initialise particle masses with, see MassInit* classes.
  • n (int) – Total number of particles in simulation.
  • cutoff (float) – Cutoff to perform cell decomposition with if a potential is not passed.
forces_update()

Updates the forces in the simulation state using the short range potential.

kinetic_energy_update()

Update the kinetic energy of the simulation state. :return: Kinetic energy of the state.

potential = None

Short range potential between particles.

state = None

Simulation state, of type state.*

class simulation.MassInitIdentical(m=1.0)

Bases: object

Class to initialise all masses to one value.

Parameters:m (double) – Mass default 1.0
reset(state)

Apply to input mass dat class.

Parameters:mass_input (Dat) – Dat container with masses.
class simulation.MassInitTwoAlternating(m1=1.0, m2=1.0)

Bases: object

Class to initialise masses, alternates between two masses.

Parameters:
  • m1 (double) – First mass
  • m2 (double) – Second mass
reset(state)

Apply to input mass dat class.

Parameters:mass_input (Dat) – Dat container with masses.
class simulation.PosInitDLPOLYConfig(filename=None)

Bases: object

Read positions from DLPLOY config file.

Parameters:filename (str) – Config filename.
get_extent(state_input)

Initialise domain extents prior to setting particle positions.

reset(state_input)

Resets particle positions to those in file.

Parameters:state_input (state) – State object containing required number of particles.
class simulation.PosInitLatticeNRho(n, rho, lx=None)

Bases: object

Arrange n particles into a 3D lattice of density \(/rho\). Redfines container volume as a cube with deduced volume, assumes unit mass.

Parameters:
  • n (int) – n, number of particles.
  • rho (double) – \(rho\), required density.
  • lx (double) – domain side length, overrides density.
get_extent(state_input)

Initialise domain extents prior to setting particle positions.

reset(state_input)

Applies initial lattice to particle positions.

Parameters:state_input (state) – object of state class. Inheritered from BaseMDState.
class simulation.PosInitLatticeNRhoRand(n, rho, dev, lx=None)

Bases: object

Arrange n particles into a 3D lattice of density \(/rho\). Redfines container volume as a cube with deduced volume, assumes unit mass adds uniform deviantion based on given maximum.

Parameters:
  • n (int) – number of particles.
  • rho (double) – \(/rho\), required density.
  • dev (double) – maximum possible random deviation (uniform) from lattice.
  • lx (double) – domain side length, overrides density.
get_extent(state_input)

Initialise domain extents prior to setting particle positions.

reset(state_input)

Applies initial lattice to particle positions.

Parameters:state_input (state) – object of state class. Inheritered from BaseMDState.
class simulation.PosInitOneParticleInABox(r=array([ 0., 0., 0.]), extent=array([ 1., 1., 1.]))

Bases: object

Creates one particle in a domain of given extents.

Parameters:
  • r (double) – particle location.
  • extents (np.array(3,1)) – Extent for containing volume.
get_extent(state_input)

Initialise domain extents prior to setting particle positions.

reset(state_input)

Resets the first particle in the input state domain to sit on the input point.

Parameters:state_input (state) – State object containing at least one particle.
class simulation.PosInitTwoParticlesInABox(rx, extent=array([ 1., 1., 1.]), axis=array([ 1., 0., 0.]))

Bases: object

Creates two particles a set distance apart on the given axis, centred on the origin. Places these within a containing volume of given extents.

Parameters:
  • rx (double) – Distance between particles.
  • extents (np.array(3,1)) – Extent for containing volume.
  • axis (np.array(3,1)) – axis to centre on.
get_extent(state_input)

Initialise domain extents prior to setting particle positions.

reset(state_input)

Resets the first two particles in the input state domain to sit on the x-axis the set distance apart.

Parameters:state_input (state) – State object containing at least two particles.
class simulation.VelInitDLPOLYConfig(filename=None)

Bases: object

Read velocities from DLPLOY config file.

Parameters:filename (str) – Config filename.
reset(state_input)

Resets particle velocities to those in file.

Parameters:state_input (state) – State object containing required number of particles.
class simulation.VelInitMaxwellBoltzmannDist(temperature=293.15)

Bases: object

Initialise velocities by sampling from a gaussian distribution.

Parameters:
  • mu (double) – Mean for gaussian distribution.
  • sig (double) – Standard deviation for gaussian distribution.
reset(state_input)

Resets particle velocities to Maxwell-Boltzmann distribution.

Parameters:state_input (state) – Input state class oject containing velocities and masses.
class simulation.VelInitNormDist(mu=0.0, sig=1.0)

Bases: object

Initialise velocities by sampling from a gaussian distribution.

Parameters:
  • mu (double) – Mean for gaussian distribution.
  • sig (double) – Standard deviation for gaussian distribution.
reset(state_input)

Resets particle velocities to Gaussian distribution.

Parameters:state_input (state) – Input state class oject containing velocities.
class simulation.VelInitOneParticleInABox(vx=array([ 0., 0., 0.]))

Bases: object

Sets velocities for first particle.

Parameters:vx (np.array(3,1)) – Velocity vector for particle 1.
reset(state_input)

Resets the particles in the input state to the required velocities.

Parameters:state_input (state) – input state.
class simulation.VelInitPosBased

Bases: object

Sets velocities for two particles.

Parameters:
  • vx (np.array(3,1)) – Velocity vector for particle 1.
  • vy (np.array(3,1)) – Velocity vector for particle 2.
reset(state_input)

Resets the particles in the input state to the required velocities.

Parameters:state_input (state) – input state.
class simulation.VelInitTwoParticlesInABox(vx=array([ 0., 0., 0.]), vy=array([ 0., 0., 0.]))

Bases: object

Sets velocities for two particles.

Parameters:
  • vx (np.array(3,1)) – Velocity vector for particle 1.
  • vy (np.array(3,1)) – Velocity vector for particle 2.
reset(state_input)

Resets the particles in the input state to the required velocities.

Parameters:state_input (state) – input state.
simulation.periodic_mod(lower, val, upper)

Previous topic

runtime Module

Next topic

state Module

This Page