In [26]:
using Lattices

In [ ]:
sq=MakeLattice("Square",5);

In [ ]:
PlotNeighbors(sq)

In [ ]:
ch=MakeLattice("Chain",3)

In [ ]:
hc=MakeLattice("Honeycomb",4);

In [ ]:
PlotNeighbors(hc)

In [ ]:
ck=MakeLattice("Checkerboard",4);

In [ ]:
PlotNeighbors(ck)

In [2]:
kg=MakeLattice("Kagome",5);

In [22]:
PlotNeighbors(kg)



In [23]:
function armod(x,y)
        return mod(x-1+y,y)+1
    end


Out[23]:
armod (generic function with 1 method)

In [59]:
l=3;
N=l^3;
d=convert(Int8,3);
nnei=6;
neigh=Array{Int16}(N,6);

a=[[1 0 0 ]
   [0 1 0]
   [0 0 1]];
unit=[0 0 0];
X=MakeX(a,unit,l,d);

neigh[:,1]=armod(X[:,1]+2,l)+l*X[:,2]+X[:,3]*l^2;
neigh[:,2]=armod(X[:,1],l)+l*X[:,2]+X[:,3]*l^2;
neigh[:,3]=X[:,1]+1+l*mod(X[:,2]+2,l)+X[:,3]*l^2;
neigh[:,4]=X[:,1]+1+l*mod(X[:,2],l)+X[:,3]*l^2
neigh[:,5]=X[:,1]+1+l*X[:,2]+mod(X[:,3]+2,l)*l^2;
neigh[:,6]=X[:,1]+1+l*X[:,2]+mod(X[:,3],l)*l^2;

In [ ]:


In [36]:
using PyPlot
scatter3D(X[:,1],X[:,2],X[:,3])


Out[36]:
PyObject <mpl_toolkits.mplot3d.art3d.Path3DCollection object at 0x31f754a90>

In [65]:
for i in 1:N
    for j in 1:nnei
        xx=[X[i,1], X[neigh[i,j],1] ]
        yx=[X[i,2], X[neigh[i,j],2] ]
        zx=[X[i,3], X[neigh[i,j],3] ]
        plot3D(xx,yx,zx)
    end
end



In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: