pele.mc#

class pele.mc.MonteCarlo[source]

Source

class MonteCarlo:

A class to run the Monte Carlo algorithm

Parameters:
coordsnumpy array, one dimensional

The initial set of coordinates.

potentialpotential object

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

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

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
acceptTestcallable, 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)
confChecklist 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

temperaturefloat, optional

The temperature used in the metropolis criterion.

event_after_steplist of callables, optional

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

event(energy, coords, acceptstep)
outstreamopen file object, optional

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

store_initialbool, optional

if True store initial structure

MonteCarlo.setPrinting()[source]

Source

def setPrinting(self, ostream="default", frq=None):

change how the printing is done

Parameters:
ostreamopen file or None

where to print data

frqint or None

how often to print data. if None, don’t change current value

MonteCarlo.addEventAfterStep()[source]

Source

def addEventAfterStep(self, event):

add an even to the list event_after_step

MonteCarlo.run()[source]

Source

def run(self, nsteps):

do multiple iterations

MonteCarlo.takeOneStep()[source]

Source

def takeOneStep(self):

one cycle of the routine