Exemplo n.º 1
0
 def eval_bond_coul(self, occm_trial, nneocc_trial):
     logger.debug("charging effects are active")
     occm_ch, ntot_ch = SupportFunctions.identify(self.args.n, self.args.m, occm_trial, nneocc_trial, self.args.n_thresh_ch)
     nneocc_scr_trial = SupportFunctions.occneigh2(self.args.n, self.args.m, occm_ch, occm_trial, self.icind)
     ictot_scr_trial = SupportFunctions.totnoneigh2(self.args.n, self.args.m, nneocc_scr_trial, False)
     logger.debug('evaluating neights based off of coloumbic interaction')
     escreen = -self.args.beta_scr * (ictot_scr_trial - ntot_ch * self.args.n_thresh_ch)
     logger.debug("screnmol, energy: {0} {1} {2} ".format(ntot_ch, ictot_scr_trial, escreen))
     logger.debug("now determines charged 1st nn's")
     nneocc_ch_trial = SupportFunctions.occneigh2(self.args.n, self.args.m, occm_ch, occm_ch, self.icind)
     logger.debug('computing number of charge bonds and such coulombic energy')
     ictot_ch_trial = SupportFunctions.totnoneigh2(self.args.n, self.args.m, nneocc_ch_trial, True)
     ecoulrep = self.args.beta_coul * ictot_ch_trial
     return ecoulrep, escreen, occm_ch, nneocc_ch_trial, ntot_ch, ictot_ch_trial
Exemplo n.º 2
0
 def eval_bond_coul2nd(self, occm_ch, nneocc_ch_trial):
     logger.debug("now determining charged 2nd neighbour's")
     sec_nneocc_ch_trial = SupportFunctions.sec_neigh(self.args.n, self.args.m, occm_ch, nneocc_ch_trial, self.icind)
     icsec_ch_trial = SupportFunctions.totnoneigh2(self.args.n, self.args.m, sec_nneocc_ch_trial, True)
     ecoulrep_sec = self.args.beta_sec_coul * icsec_ch_trial
     logger.debug("2nd neighbour coloumbic energy: {0}".format(ecoulrep_sec))
     return ecoulrep_sec
Exemplo n.º 3
0
    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
Exemplo n.º 4
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