Closed ASEP

L=10;
n=4;
T=Select[Tuples[{0,1},L],Total[#]==n&]
Mclosed = ConstantArray[0,{Length[T],Length[T]}];
For[i=1,i≤Length[T],i++,
For[j=1,j≤Length[T],j++,
If[T[[i,1]]==0&&T[[i,L]]==1&&T[[j,1]]==1&&T[[j,L]]==0&&Table[T[[i,k]],{k,2,L-1}]==Table[T[[j,k]],{k,2,L-1}],
Mclosed[[i,j]]+=q;
];
If[T[[i,1]]==1&&T[[i,L]]==0&&T[[j,1]]==0&&T[[j,L]]==1&&Table[T[[i,k]],{k,2,L-1}]==Table[T[[j,k]],{k,2,L-1}],
Mclosed[[i,j]]+=p;
];
For[k=1,k<L,k++,
If[T[[i,k]]==0&&T[[i,k+1]]==1&&T[[j,k]]==1&&T[[j,k+1]]==0&&Table[T[[i,l2]],{l2,k-1}]==Table[T[[j,l2]],{l2,k-1}]&&Table[T[[i,l2]],{l2,k+2,L}]==Table[T[[j,l2]],{l2,k+2,L}],
Mclosed[[i,j]]+=p;
];
If[T[[i,k]]==1&&T[[i,k+1]]==0&&T[[j,k]]==0&&T[[j,k+1]]==1&&Table[T[[i,l2]],{l2,k-1}]==Table[T[[j,l2]],{l2,k-1}]&&Table[T[[i,l2]],{l2,k+2,L}]==Table[T[[j,l2]],{l2,k+2,L}],
Mclosed[[i,j]]+=q;
];
];
];
];
For[i=1,i≤Length[T],i++,
Mclosed[[i,i]]=-Sum[If[j==i,0,Mclosed[[j,i]]],{j,Length[T]}];
]
Mclosed//MatrixForm

ss=NullSpace[Mclosed/.{q->0}][[1]];
ss=Table[T[[i]]->Factor[((ss[[i]])/(Total[ss]))],{i,Length[ss]}]

ss=NullSpace[Mclosed][[1]];
ss=Table[T[[i]]->Factor[((ss[[i]])/(Total[ss]))],{i,Length[ss]}]

Density

Table[Sum[If[ss[[i,1,j]]==1,ss[[i,2]],0],{i,Length[ss]}],{j,L}]

Current

Table[Sum[
If[ss[[i,1,j]]==1&&ss[[i,1,j+1]]==0,p ss[[i,2]],
If[ss[[i,1,j]]==0&&ss[[i,1,j+1]]==1,-q ss[[i,2]],0]]
,{i,Length[ss]}],{j,L-1}]

Open ASEP

L=2;
T=Tuples[{0,1},L]
Mopen = ConstantArray[0,{Length[T],Length[T]}];
For[i=1,i≤Length[T],i++,
For[j=1,j≤Length[T],j++,
If[T[[i,1]]==1&&T[[j,1]]==0&&Table[T[[i,k]],{k,2,L}]==Table[T[[j,k]],{k,2,L}],
Mopen[[i,j]]+=α;
];
If[T[[i,1]]==0&&T[[j,1]]==1&&Table[T[[i,k]],{k,2,L}]==Table[T[[j,k]],{k,2,L}],
Mopen[[i,j]]+=γ;
];
If[T[[i,L]]==0&&T[[j,L]]==1&&Table[T[[i,k]],{k,1,L-1}]==Table[T[[j,k]],{k,1,L-1}],
Mopen[[i,j]]+=β;
];
If[T[[i,L]]==1&&T[[j,L]]==0&&Table[T[[i,k]],{k,1,L-1}]==Table[T[[j,k]],{k,1,L-1}],
Mopen[[i,j]]+=δ;
];
For[k=1,k<L,k++,
If[T[[i,k]]==0&&T[[i,k+1]]==1&&T[[j,k]]==1&&T[[j,k+1]]==0&&Table[T[[i,l2]],{l2,k-1}]==Table[T[[j,l2]],{l2,k-1}]&&Table[T[[i,l2]],{l2,k+2,L}]==Table[T[[j,l2]],{l2,k+2,L}],
Mopen[[i,j]]+=p;
];
If[T[[i,k]]==1&&T[[i,k+1]]==0&&T[[j,k]]==0&&T[[j,k+1]]==1&&Table[T[[i,l2]],{l2,k-1}]==Table[T[[j,l2]],{l2,k-1}]&&Table[T[[i,l2]],{l2,k+2,L}]==Table[T[[j,l2]],{l2,k+2,L}],
Mopen[[i,j]]+=q;
];
];
];
];
For[i=1,i≤Length[T],i++,
Mopen[[i,i]]=-Sum[If[j==i,0,Mopen[[j,i]]],{j,Length[T]}];
]
Mopen//MatrixForm

ss=NullSpace[Mopen/.{γ->0,δ->0,q->0,p->1}][[1]];
ss=Table[T[[i]]->Factor[((ss[[i]])/(Total[ss]))],{i,Length[ss]}]

Table[Simplify[Sum[If[ss[[i,1,j]]==1,ss[[i,2]],0],{i,Length[ss]}]],{j,L}]

Expand[α ((β^2)+(α^2) (1+β)+α β (1+β))]

ss=NullSpace[Mopen][[1]];
ss=Table[T[[i]]->Factor[((ss[[i]])/(Total[ss]))],{i,Length[ss]}]

Table[Simplify[Sum[If[ss[[i,1,j]]==1,ss[[i,2]],0],{i,Length[ss]}]],{j,L}]

Table[Factor[Sum[
If[ss[[i,1,j]]==1&&ss[[i,1,j+1]]==0,p ss[[i,2]],
If[ss[[i,1,j]]==0&&ss[[i,1,j+1]]==1,-q ss[[i,2]],0]]
,{i,Length[ss]}]],{j,L-1}]

%213[[1]]-%213[[2]]

n=3;
n0=1;
T=Tuples[{-1,0,1},n];
T = Select[Table[If[Count[T[[i]],0]==n0,T[[i]]],{i,Length[T]}],ListQ]

Closed 2-ASEP

n=3;
n0=1;
T=Tuples[{-1,0,1},n]
T = Select[Table[If[Count[T[[i]],0]==n0,T[[i]]],{i,Length[T]}],ListQ]
M = ConstantArray[0,{Length[T],Length[T]}];
For[i=1,i≤Length[T],i++,
For[j=1,j≤Length[T],j++,
If[T[[i,1]]==1&&T[[i,2]]==1&&T[[j,1]]==-1&&T[[j,2]]==-1&&Table[T[[i,k]],{k,3,n}]==Table[T[[j,k]],{k,3,n}],
M[[j,i]]+=a;
];
If[T[[i,1]]==-1&&T[[i,2]]==1&&T[[j,1]]==1&&T[[j,2]]==-1&&Table[T[[i,k]],{k,3,n}]==Table[T[[j,k]],{k,3,n}],
M[[j,i]]+=a;
];

If[T[[i,1]]==0&&T[[i,2]]==1&&T[[j,1]]==-1&&T[[j,2]]==0&&Table[T[[i,k]],{k,3,n}]==Table[T[[j,k]],{k,3,n}],
M[[j,i]]+=1/2;
];
If[T[[i,1]]==0&&T[[i,2]]==1&&T[[j,1]]==1&&T[[j,2]]==0&&Table[T[[i,k]],{k,3,n}]==Table[T[[j,k]],{k,3,n}],
M[[j,i]]+=1/2;
];

If[T[[i,1]]==1&&T[[i,2]]==0&&T[[j,1]]==0&&T[[j,2]]==-1&&Table[T[[i,k]],{k,3,n}]==Table[T[[j,k]],{k,3,n}],
M[[j,i]]+=a;
];
If[T[[i,1]]==-1&&T[[i,2]]==0&&T[[j,1]]==0&&T[[j,2]]==-1&&Table[T[[i,k]],{k,3,n}]==Table[T[[j,k]],{k,3,n}],
M[[j,i]]+=a;
];

If[T[[i,n]]==-1&&T[[j,n]]==1&&Table[T[[i,k]],{k,1,n-1}]==Table[T[[j,k]],{k,1,n-1}],
M[[j,i]]+=b;
];
For[k=2,k<n,k++,
If[T[[i,k]]==-1&&T[[i,k+1]]==1&&T[[j,k]]==1&&T[[j,k+1]]==-1&&Table[T[[i,l2]],{l2,k-1}]==Table[T[[j,l2]],{l2,k-1}]&&Table[T[[i,l2]],{l2,k+2,n}]==Table[T[[j,l2]],{l2,k+2,n}],
M[[j,i]]+=1;
];
If[T[[i,k]]==0&&T[[i,k+1]]==1&&T[[j,k]]==1&&T[[j,k+1]]==0&&Table[T[[i,l2]],{l2,k-1}]==Table[T[[j,l2]],{l2,k-1}]&&Table[T[[i,l2]],{l2,k+2,n}]==Table[T[[j,l2]],{l2,k+2,n}],
M[[j,i]]+=1;
];
If[T[[i,k]]==-1&&T[[i,k+1]]==0&&T[[j,k]]==0&&T[[j,k+1]]==-1&&Table[T[[i,l2]],{l2,k-1}]==Table[T[[j,l2]],{l2,k-1}]&&Table[T[[i,l2]],{l2,k+2,n}]==Table[T[[j,l2]],{l2,k+2,n}],
M[[j,i]]+=1;
];
];
];
];
For[i=1,i≤Length[T],i++,
M[[i,i]]=-Sum[If[j==i,0,M[[j,i]]],{j,Length[T]}];
]
M//MatrixForm

ss=NullSpace[M][[1]];
ss=Table[T[[i]]->Factor[((ss[[i]])/(Total[ss]))],{i,Length[ss]}]