def run_it(p): print('Running for parameters: {}'.format(p)) global last_s global last_ps if last_ps[:-1] == p.ps[:-1]: print('Changed T only') s = last_s s.T = p.T s.run(changedTonly=True) else: s = None if p.model == 'QcaBond': s = qca.QcaBond() elif p.model == 'QcaFixedCharge': s = qca.QcaFixedCharge() elif p.model == 'QcaGrandCanonical': s = qca.QcaGrandCanonical() s.V0 = p.V0 s.mu = 250 s.l = qca.Wire(p.N, p.V1, p.boa, 1) s.T = p.T s.init() s.run() last_s = s last_ps = p.ps return s
def run_it(p): print('Running for parameters: {}'.format(p)) s = None if p.model == 'QcaBond': s = qca.QcaBond() elif p.model == 'QcaFixedCharge': s = qca.QcaFixedCharge() elif p.model == 'QcaGrandCanonical': s = qca.QcaGrandCanonical() elif p.model == 'QcaIsing': s = qca.QcaIsing() s.V0 = p.V0 s.mu = p.mu s.q = p.q s.T = 1 s.l = qca.Wire(p.N, p.V1, p.boa, 1) s.init() s.run() Es = np.array(s.energies()) Es.sort() Es = Es[:10000] # throw away high energy states s.results['energies'] = Es return s
def run(self, V1s_start=None): if self.model_type == 'QcaIsing': self.s = qca.QcaIsing() elif self.model_type == 'QcaBond': self.s = qca.QcaBond() self.s.V0 = 1E6 self.s.T = self.T self.s.q = self.q self.y0s = [] self.e_y0s = [] self.ss = [] self.e_ss = [] if V1s_start is not None: self.V1s_start = V1s_start V11 = self.V1s_start[0] V12 = self.V1s_start[1] try: V1_crit = scipy.optimize.bisect(self.slope, V11, V12, xtol=self.epsilon) self.results['V1_crit'] = V1_crit self.results['N_iteration'] = len(self.y0s) self.results['y0'] = self.y0s self.results['error_y0'] = self.e_y0s self.results['slope'] = self.ss self.results['error_slope'] = self.e_ss except (ValueError): pass
def run_it(p): print('Running for parameters: {}'.format(p)) s = None if p.model == 'QcaIsing': s = qca.QcaIsing() elif p.model == 'QcaBond': s = qca.QcaBond() s.q = 0.5 s.t = 1 s.T = p.T s.l = qca.Wire(p.N, p.V1, p.boa, p.P) s.init() s.run() return s
def run(self): if self.type == 'QcaBond': self.s = qca.QcaBond() elif self.type == 'QcaIsing': self.s = qca.QcaIsing() self.s.V0 = 1E6 self.s.T = self.T self.s.q = self.q try: P_D = scipy.optimize.bisect(self.f, 1E-4, 1, xtol=self.epsilon) self.results['P_D'] = P_D except (ValueError): pass
def run_it(p): print('Running for parameters: {}'.format(p)) s = None if p.model == 'QcaBond': s = qca.QcaBond() elif p.model == 'QcaFixedCharge': s = qca.QcaFixedCharge() elif p.model == 'QcaGrandCanonical': s = qca.QcaGrandCanonical() s.q = p.q s.V0 = 1E6 s.mu = 0 s.t = 1 s.T = p.T N, V1 = 3, 40 s.l = qca.Wire(N, V1, p.boa, p.P) s.init() s.run() return s