def ensure_all_haldane_lattices(self): """Ensure that all haldane lattices called for by self.meshfns are loaded. """ # todo: add the ability to change glat.lp parameters (like Omk) at function call-- specify as list of lp's or as single lp print 'Ensuring all haldane lattices...' for ii in range(len(self.meshfns)): meshfn = self.meshfns[ii] if isinstance(meshfn, list): meshfn = meshfn[0] print 'Ensuring ', meshfn try: self.haldane_lattices[ii] append_glat = False except IndexError: append_glat = True try: # Check if lp['meshfn'] of haldane_lattice matches meshfn self.haldane_lattices[ii].lp['meshfn'] # print('Already have haldane_lattice defined for ii='+str(ii)+': ', test) except IndexError: lp = le.load_params(dio.prepdir(meshfn), 'lattice_params') lat = lattice_class.Lattice(lp=lp) lat.load(meshfn=meshfn) lp['Omk'] = -1.0 lp['Omg'] = -1.0 if append_glat: self.haldane_lattices.append( haldane_lattice_class.HaldaneLattice(lat, lp)) else: self.haldane_lattices[ ii] = haldane_lattice_class.HaldaneLattice(lat, lp) glat = haldane_lattice_class.HaldaneLattice( lat, self.haldane_lattices[ii].lp) self.haldane_lattices[ii] = glat
# try: meshfn = le.find_meshfn(lp) lp['meshfn'] = meshfn lat = lattice_class.Lattice(lp) lat.load() # print 'lat.lp[PV] = ', lat.lp['PV'] print 'lat.lp[periodicBC] = ', lat.lp['periodicBC'] print 'lat.PV = ', lat.PV # except RuntimeError: # print '\n\n Could not find lattice --> creating it!' # meshfn, trash = le.build_meshfn(lp) # lp['meshfn'] = meshfn # lat = lattice_class.Lattice(lp) # lat.build() # lat.save() hlat = haldane_lattice_class.HaldaneLattice(lat, lp) hlat.load() print '\n\n\n', hlat.lattice.lp, '\n' bott = BottIndex(hlat, cp=cp) bott.calc_bott(check=args.check, verbose=args.verbose) bott.save_bott_txt() if args.ensure_bott: # Calc bott index for specified network # try: meshfn = le.find_meshfn(lp) lp['meshfn'] = meshfn lat = lattice_class.Lattice(lp) lat.load() # except RuntimeError: