currx = np.array([]) curry = np.array([]) act = np.array([]) actx = np.array([]) acty = np.array([]) print('s\tCurr\t\tCurrx\t\t\tCurry\t\tAct\t\tActx\t\tActy') for i in range(len(s)): fname = folder + 'MPS_s' + str(i) + '_mbd0' hamParams = np.array( [0.5, 0.5, p, 1. - p, 0., 0., 0.5, 0.5, 0., 0., 0.5, 0.5, 0., s[i]]) # Calculate Currents & Activities ======================= # xy current currMPO = curr_mpo((Nx, Ny), hamParams, periodicy=False, periodicx=False, includex=True, includey=True) opCurr = contract(mpo=currMPO, mps=fname, lmps=fname + '_left') opNorm = contract(mps=fname, lmps=fname + '_left') curr = np.append(curr, opCurr / opNorm) #print('Current = {}'.format(curr[-1])) # x current currMPO = curr_mpo((Nx, Ny), hamParams, periodicy=False, periodicx=False, includex=True, includey=False) opCurr = contract(mpo=currMPO, mps=fname, lmps=fname + '_left') opNorm = contract(mps=fname, lmps=fname + '_left')
s = npzfile['s'] Nx = int(npzfile['Nx']) Ny = int(npzfile['Ny']) nStates = 2 p = 0.1 E = np.zeros((len(s), nStates)) PT = np.zeros((len(s), nStates)) # Loop through all results in s vector for sInd in range(len(s)): hamParams = np.array( [0.5, 0.5, p, 1. - p, 0., 0., 0.5, 0.5, 0., 0., 0.5, 0.5, 0., s[sInd]]) mpo = return_mpo_asep2D((Nx, Ny), hamParams, periodicy=False, periodicx=False) cmpo = curr_mpo((Nx, Ny), hamParams, periodicy=False, periodicx=False) #mpo = return_mpo(N,(0.5,0.5,p,1.-p,0.5,0.5,s[sInd])) #cmpo= curr_mpo(N,(0.5,0.5,p,1.-p,0.5,0.5,s[sInd])) for state in range(nStates): fname_mps = path + 'MPS_s' + str(sInd) + '_mbd0' fname_lmps = path + 'MPS_s' + str(sInd) + '_mbd0_left' E[sInd, state] = contract(mps=fname_mps, mpo=mpo, state=state) / contract( mps=fname_mps, state=state) # Calculate PT Stuff #PT[sInd,state]= contract(mps=fname_mps,mpo=cmpo,state=0,lstate=state)*contract(mps=fname_mps,mpo=cmpo,state=state,lstate=0)/(E[sInd,0]-E[sInd,state]) PT[sInd, state] = contract( mps=fname_mps, lmps=fname_lmps, mpo=cmpo, state=0, lstate=state ) * contract( mps=fname_mps, lmps=fname_lmps, mpo=cmpo, state=state,
mpo = return_mpo_asep2D((Nx,Ny),hamParams,periodicy=periodicy,periodicx=periodicx) elif bcs == 'periodic': hamParams = np.array([p,1.-p,0.5,0.5,0.5,0.5,0.0,0.0,0.5,0.5,0.0,0.0,s0,0.]) mpo = return_mpo_asep2D((Nx,Ny),hamParams,periodicy=periodicy,periodicx=periodicx) Etmp,EEtmp,gaptmp,env = run_dmrg(mpo, mbd=mbd, fname=fname+'s0', nStates=2, alg=alg, returnEnv=True, calcLeftState=leftState) if leftState: EE = np.append(EE,EEtmp[0]) EEl= np.append(EEl,EEtmp[1]) # Calculate Current currMPO = curr_mpo((Nx,Ny),hamParams,periodicy=periodicy,periodicx=periodicx) opCurr = contract(mpo = currMPO, mps = fname+'s0'+'_mbd0', lmps= fname+'s0'+'_mbd0_left') opNorm = contract(mps = fname+'s0'+'_mbd0', lmps= fname+'s0'+'_mbd0_left') curr=np.append(curr,opCurr/opNorm) print('Current = {}'.format(curr[-1])) actMPO = act_mpo((Nx,Ny),hamParams,periodicy=periodicy,periodicx=periodicx,includex=True,includey=False) opAct = contract(mpo = actMPO, mps = fname+'s0'+'_mbd0', lmps= fname+'s0'+'_mbd0_left') act=np.append(act,opAct/opNorm) print('Activity = {}'.format(act[-1])) else: EE = np.append(EE,EEtmp)