def plot_model(model_params, phi_ext=0.1): model_params['phi_ext'] = phi_ext M = BosonicHaldaneModel(model_params) import matplotlib.pyplot as plt plt.figure() ax = plt.gca() M.lat.plot_sites(ax) M.coupling_terms['t1 Bd_i B_j'].plot_coupling_terms(ax, M.lat) M.coupling_terms['t2 Bd_i B_j'].plot_coupling_terms( ax, M.lat, text='{op_j!s} {strength_angle:.2f}', text_pos=0.9) print(M.coupling_terms['t1 Bd_i B_j'].to_TermList()) ax.set_aspect(1.) plt.show()
def run(model_params, phi_ext=np.linspace(0, 2.0, 7)): data = dict(phi_ext=phi_ext, QL=[], ent_spectrum=[]) dmrg_params = { 'mixer': True, # setting this to True helps to escape local minima 'mixer_params': { 'amplitude': 1.e-5, 'decay': 1.2, 'disable_after': 30 }, 'trunc_params': { 'svd_min': 1.e-10, }, 'lanczos_params': { 'N_min': 5, 'N_max': 20 }, 'chi_list': { 0: 9, 10: 49, 20: 100 }, 'max_E_err': 1.e-10, 'max_S_err': 1.e-6, 'max_sweeps': 150, 'verbose': 1., } prod_state = [1] if 2 * model_params['Lx'] * model_params['Ly'] % 4 != 0: warnings.warn( "Total filling factor = 1/4 cannot be achieved with this unit cell geometry." ) for i in range(1, 2 * model_params['Lx'] * model_params['Ly']): if i % 4 == 0: prod_state.append(1) else: prod_state.append(0) print(prod_state) eng = None for phi in phi_ext: print("=" * 100) print("phi_ext = ", phi) model_params['phi_ext'] = phi if eng is None: # first time in the loop M = BosonicHaldaneModel(model_params) psi = MPS.from_product_state(M.lat.mps_sites(), prod_state, bc=M.lat.bc_MPS) eng = dmrg.TwoSiteDMRGEngine(psi, M, dmrg_params) else: del eng.engine_params['chi_list'] M = BosonicHaldaneModel(model_params) eng.init_env(model=M) E, psi = eng.run() data['QL'].append(psi.average_charge(bond=0)[0]) data['ent_spectrum'].append( psi.entanglement_spectrum(by_charge=True)[0]) return data