pele.mc.MonteCarlo

class pele.mc.MonteCarlo(coords, potential, takeStep, storage=None, event_after_step=None, acceptTest=None, temperature=1.0, confCheck=None, outstream=<open file '<stdout>', mode 'w' at 0x2b4a2cfa71e0>, store_initial=True, iprint=1)[source]

A class to run the Monte Carlo algorithm

Parameters :

coords : numpy array, one dimensional

The initial set of coordinates.

potential : potential object

A class implementing the potential. The class must have the following functions implemented:

potential.getEnergy(coords)
potential.getEnergyGradient(coords)

takeStep : object

The class which randomly perterbs the system, e.g. random displacement. It must have two functions implemented which are called like:

takeStep.takeStep(coords, driver=self)       #  takes the step
takeStep.updateStep(acceptstep, driver=self) #  for adaptive step size management

acceptTest : callable, optional

Acceptance criterion for monte carlo move. If None is given, metropolis is used. It must have the form:

bool = acceptTest(Eold, Enew, old_coords, new_coords)

confCheck : list of callables, optional

list of checks if current configuration is valid. This is executed before acceptTest and accepTest is only called if all checks return True. The checks are called like:

check(trial_energy, trial_coords, driver=self)

and must return a bool

temperature : float, optional

The temperature used in the metropolis criterion.

event_after_step : list of callables, optional

these are called just after each monte carlo round. Each event in the list takes the form::

event(energy, coords, acceptstep)

outstream : open file object, optional

The file stream to print quench information to. None for no printing. Default to standard out.

store_initial : bool, optional

if True store initial structure

Methods

addEventAfterStep(event) add an even to the list event_after_step
printStep()
run(nsteps) do multiple iterations
setPrinting([ostream, frq]) change how the printing is done
takeOneStep() one cycle of the routine