def setup(self): if self.args.brestart: self.occm = numpy.zeros([self.args.n * self.args.m], dtype=numpy.bool) ifile = open(self.args.inp_filenm, 'r') self.etot = 0.0 self.args.n = numpy.load(ifile) self.args.m = numpy.load(ifile) self.ntotmol = numpy.load(ifile) self.occm = numpy.load(ifile) self.etot = numpy.load(ifile) ifile.close() # a dictionary to store energy values in # determines all positions and indices vectors self.allpos, self.allind, self.ic, self.pos = SupportFunctions.allpositions(self.args.n, self.args.m, self.args.b) #determines the index file of all neighbours self.allneigh = numpy.zeros([self.args.n*self.args.m, 6, 2], dtype=numpy.int) self.icind = numpy.zeros([self.args.n*self.args.m, 6], dtype=numpy.int) self.allneigh, self.icind = SupportFunctions.allneighbors(self.allind, self.ic, self.args.n, self.args.m) if not self.args.brestart: self.occm, self.ntotmol = SupportFunctions.randdistr(self.args.n, self.args.m, self.args.cov) #colours the molecules (occupied sites) #determines their neighbours self.nneocc = SupportFunctions.occneigh(self.args.n, self.args.m, self.occm, self.icind) # counts the bonds (shared edges) self.ictot = SupportFunctions.totnoneigh2(self.args.n, self.args.m, self.nneocc, True) # total energy self.evdW = -1.0*self.args.beta*self.ictot # total energy for the moment just vdW if not self.args.brestart: self.etot = self.evdW # logger.info('Temperature: {0}'.format(self.args.kt)) logger.info('INITIAL energy/mol: {0}'.format(self.etot/float(self.ntotmol))) # makes a little metropolis animation self.entropy = 0.0 self.escreen = 0.0 self.ecoulrep = 0.0 self.ecoulrep_sec = 0.0 self.jfrom = 0 self.jto = 0 self.icmov = 0 self.cluster_type = 0
def eval_bond_vdw(self, occm_trial): nneocc_trial = SupportFunctions.occneigh(self.args.n, self.args.m, occm_trial, self.icind) ictot_trial = SupportFunctions.totnoneigh2(self.args.n, self.args.m, nneocc_trial, True) evdW_trial = -self.args.beta * ictot_trial return evdW_trial, ictot_trial, nneocc_trial