pylj.util

class pylj.util.System(number_of_particles, temperature, box_length, constants, forcefield, mass, init_conf='square', timestep_length=1e-14, cut_off=15)[source]

Bases: object

Simulation system. This class is designed to store all of the information about the job that is being run. This includes the particles object, as will as sampling objects such as the temperature, pressure, etc. arrays. :param number_of_particles: Number of particles to simulate. :type number_of_particles: int :param temperature: Initial temperature of the particles, in Kelvin. :type temperature: float :param box_length: Length of a single dimension of the simulation square, in Angstrom. :type box_length: float :param init_conf: The way that the particles are initially positioned. Should be one of:

  • ‘square’
  • ‘random’
Parameters:
  • timestep_length (float (optional)) – Length for each Velocity-Verlet integration step, in seconds.
  • cut_off (float (optional)) – The distance apart that the particles must be to consider there interaction to be negliable.
  • constants (float, array_like (optional)) – The values of the constants for the forcefield used.
  • mass (float (optional)) – The mass of the particles being simulated.
  • forcefield (function (optional)) – The particular forcefield to be used to find the energy and forces.
accept()[source]

Maps to the mc.accept function.

compute_energy()[source]

Maps to the compute_energy function in either the comp (if Cython is installed) or the pairwise module and allows for a cleaner interface.

compute_force()[source]

Maps to the compute_force function in either the comp (if Cython is installed) or the pairwise module and allows for a cleaner interface.

heat_bath(bath_temperature)[source]

Maps to the heat_bath function in either the comp (if Cython is installed) or the pairwise modules. :param target_temperature: The target temperature for the simulation. :type target_temperature: float

integrate[source]

Maps the chosen integration method. :param method: The integration method to be used, e.g. md.velocity_verlet. :type method: method

mc_sample()[source]

Maps to the mc.sample function. :param energy: Energy to add to the sample :type energy: float

md_sample()[source]

Maps to the md.sample function.

new_random_position()[source]

Maps to the mc.get_new_particle function.

number_of_pairs()[source]

Calculates the number of pairwise interactions in the simulation. :returns: Number of pairwise interactions in the system. :rtype: int

random()[source]

Sets the initial positions of the particles in a random arrangement.

reject()[source]

Maps to the mc.reject function.

select_random_particle()[source]

Maps to the mc.select_random_particle function.

square()[source]

Sets the initial positions of the particles on a square lattice.

pylj.util.particle_dt()[source]

Builds the data type for the particles, this consists of: - xposition and yposition - xvelocity and yvelocity - xacceleration and yacceleration - xprevious_position and yprevious_position - xforce and yforce - energy