method Module

class method.DrawParticles(state=None)

Bases: object

Class to plot n particles with given positions.

Parameters:
  • n (int) – Number of particles.
  • pos (np.array(n,3)) – particle positions.
  • extent (np.array(3,1)) – domain extents.
cleanup()
draw()

Update current plot, use for real time plotting.

norm_vec(in_vec)
class method.EnergyStore(state=None)

Bases: object

Class to hold energy data more sensibly

Parameters:state (state) – Input state to track energy of.
plot(_plot=True)

Plot the stored energy data.

Returns:
update()

Update energy tracking of tracked state. :return:

class method.IntegratorRange(n, dt, velocities, list_reuse_count=1, list_reuse_distance=0.1, verbose=True, cprofile_dump=None)

Bases: object

next()
class method.IntegratorVelocityVerlet(positions, forces, velocities, masses, force_updater, interaction_cutoff, list_reuse_count, looping_method=None)

Bases: object

integrate(dt, t, schedule=None)
class method.KineticEnergyTracker(velocities=None, masses=None, kinetic_energy_dat=None, looping_method=None)

Bases: object

execute()
get_kinetic_energy_array()
class method.ListUpdateController(state_in=None, step_count=1, velocity_dat=None, timestep=None, shell_thickness=0.0, step_index_func=None)

Bases: object

The framework does not assume that it is employed in a MD simulation situation. This class implements cell list updating at a specific number of time steps or after a maximum velocity forces an update.

determine_update_status()

Return true if update of cell list is needed. :return:

execute_boundary_conditions()

Execute the boundary conditions for the simulation.

increment_step_count()
post_update()
pre_update()

called after it is determined that an update is happening :return:

set_timestep(val)
class method.ParticleTracker(dat=None, index=None, filename=None)

Bases: object

finalise()
write()

Call to write at a particular point in time.

class method.PercentagePrinter(dt, t, percent)

Bases: object

Class to print percentage completion to console.

Parameters:
  • dt (float) – Time step size.
  • t (float) – End time.
  • percent (int) – Percent to print on.
tick()

Method to call per iteration.

class method.PotentialEnergyTracker(potential_energy_dat)

Bases: object

execute()
get_potential_energy_array()
class method.RadialDistributionPeriodicNVE(state, rmax=None, rsteps=100)

Bases: object

Class to calculate radial distribution function.

Parameters:
  • state (state) – State containing particle positions.
  • rmax (double) – Maximum radial distance.
  • rsteps (int) – Resolution to record to, default 100.
  • DEBUG (bool) – Flag to enable debug flags.
evaluate()

Evaluate the radial distribution function.

plot()
raw_write(dir_name='./output', filename=None, rename_override=False)

Function to write Radial Distribution Evaluations to disk.

Parameters:
  • dir_name (str) – directory to write to, default ./output.
  • filename (str) – Filename to write to, default array name or data.rdf if name unset.
  • rename_override (bool) – Flagging as True will disable autorenaming of output file.
reset()
class method.Schedule(steps=None, items=None)

Bases: object

Class to schedule automated running of functions every set number of steps.

Parameters:
  • steps (list) – List of steps between each run.
  • items (list) – List of functions to run after set number of steps.
add_item(steps=None, items=None)

Add an item to the schedule.

Parameters:
  • item (function) – Function to run.
  • step (int) – Number of steps between running the function.
count

Return the currently held count

schedule

Returns the held schedule.

tick()

Method ran by integrator or other method per iteration. If the required number of ticks have passed the required functions will be ran.

class method.VelocityAutoCorrelation(state, size=0, v0=None)

Bases: object

Method to calculate Velocity Autocorrelation Function.

Parameters:
  • state (state) – Input state containing velocities.
  • size (int) – Initial length of VAF array (optional).
  • V0 (data.ParticleDat) – Initial velocity Dat (optional).
evaluate()

Evaluate VAF using the current velocities held in the state with the velocities in V0.

Parameters:t (double) – Time within block of integration.
plot()

Plot array of recorded VAF evaluations.

set_v0(v0=None, state=None)

Set an initial velocity Dat to use as V_0. Requires either a velocity Dat or a state as an argument. V_0 will be set to either the passed velocities or to the velocities in the passed state.

Parameters:
class method.VelocityVerlet(dt=0.0001, t=0.01, simulation=None, schedule=None, shell_thickness=0.0)

Bases: object

Class to apply Velocity-Verlet to a given state using a given looping method.

Parameters:
  • dt (double) – Time step size, can be specified at integrate call.
  • T (double) – End time, can be specified at integrate call.
  • USE_C (bool) – Flag to use C looping and kernel.
  • plot_handle (DrawParticles) – PLotting class to plot state at certain

progress points. :arg BasicEnergyStore energy_handle: Energy storage class to log energy at each iteration. :arg bool writexyz: Flag to indicate writing of xyz at each DT. :arg bool DEBUG: Flag to enable debug flags.

integrate(dt=None, t=None)

Integrate state forward in time.

Parameters:
  • dt (double) – Time step size.
  • t (double) – End time.
timer1
timer2
class method.VelocityVerletAnderson(dt=0.0001, t=0.01, simulation=None, schedule=None, shell_thickness=0.0)

Bases: method.VelocityVerlet

integrate_thermostat(dt=None, t=None, temp=273.15, nu=1.0)

Integrate state forward in time.

Parameters:
  • dt (double) – Time step size.
  • t (double) – End time.
  • temp (double) – Temperature of heat bath.
class method.WriteTrajectoryXYZ(state=None, dir_name='./output', file_name='out.xyz', title='A', symbol='A', overwrite=True, ordered=False)

Bases: object

Write Positions to file in XYZ format from given state to given filename.

write()

Append current positions to file. :return:

Previous topic

loop Module

Next topic

mpi Module

This Page