ppmd.utility.high_method module

class ppmd.utility.high_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 ppmd.utility.high_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 ppmd.utility.high_method.IntegratorVelocityVerlet(positions, forces, velocities, masses, force_updater, interaction_cutoff, list_reuse_count, looping_method=None)

Bases: object

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

Bases: object

execute()
get_kinetic_energy_array()
class ppmd.utility.high_method.ParticleTracker(dat=None, index=None, filename=None)

Bases: object

finalise()
write()

Call to write at a particular point in time.

class ppmd.utility.high_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 ppmd.utility.high_method.PotentialEnergyTracker(potential_energy_dat)

Bases: object

execute()
get_potential_energy_array()
class ppmd.utility.high_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 ppmd.utility.high_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.

property count

Return the currently held count

property 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 ppmd.utility.high_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
  • v0 (data.ParticleDat) – Velocity Dat.

  • state (state) – State class containing velocities.

class ppmd.utility.high_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.

property timer1
property timer2
class ppmd.utility.high_method.VelocityVerletAnderson(dt=0.0001, t=0.01, simulation=None, schedule=None, shell_thickness=0.0)

Bases: ppmd.utility.high_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 ppmd.utility.high_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: