def __init__(self, method, reduced_temp, max_displacement, cutoff, num_particles = None, file_name = None, tune_displacement = True, reduced_den = None): """ Initialize a MC simulation object Parameters ---------- method : string, either 'random' or 'file' Method to initialize system. random: Randomly create initial configuration. file: Initialize system by reading from a file. reduced_temp : float Reduced temperature at which the simulation will run. max_displacement : float Maximum trial move displacement in each dimension. cutoff : float Cutoff distance for energy calculation. tune_displacement : Boolean, default to True Whether to tune maximum displacement in trial move based on previous acceptance probability. num_particles : int, required if method is 'random' Number of particles in the system. reduced_den : float, required if method is 'random' Reduced density of the system. file_name : string, required if method is 'file' Name of file from which initial configuration will be read and generated. Returns ------- None """ self.beta = 1./float(reduced_temp) self._n_trials = 0 self._n_accept = 0 self.max_displacement = max_displacement self.tune_displacement = tune_displacement self._energy_array = np.array([]) self.current_step = 0 if method == 'random': self._Geom = Geom(method, num_particles = num_particles, reduced_den = reduced_den) elif method == 'file': self._Geom = Geom(method, file_name = file_name) else: raise ValueError("Method must be either 'file' or 'random'") if reduced_den < 0.0 or reduced_temp < 0.0: raise ValueError("reduced temperature and density must be greater than zero.") self._Energy = Energy(self._Geom, cutoff)
def getGeom(self, n): returnValue = libpanda._inPkJyoAgFb(self.this, n) import Geom returnObject = Geom.Geom(None) returnObject.this = returnValue if returnObject.this == 0: return None returnObject.userManagesMemory = 1 return returnObject.setPointer() return
def makeGeometry(self): returnValue = libpanda._inPMAKPIeEy(self.this) import Geom returnObject = Geom.Geom(None) returnObject.this = returnValue if returnObject.this == 0: return None returnObject.userManagesMemory = 1 return returnObject.setPointer() return