# Finding all atomic lattices with Sage

Question: Is there a quick way to obtain all atomic lattices with $n$ elements and $k$ atoms for given $n,k$?

Here atomic means that every element is a join of atoms in the lattice, where atoms are the elements that cover the minimal element of the lattice.

I think such a lattice has at most $2^k$ elements and thus there shoud be a quick method.

I want to use a program for sage to obtain a large list of atomic lattices but the brute force way just works for $n \leq 12$.

Thanks for any help!

Here is the brute force method:

```
n=8
P=Posets(n-2)
P=[p.with_bounds() for p in P]
L=[p for p in P if p.is_lattice() and LatticePoset(p).is_atomic()]
display(len(L))
display(L[2])
```

There is certainly a way. I am not quite sure what is an atomic lattice $(L,<,0)$ right now, but i suppose we have some set $L$ with a partial order $<$ so that always $\min(a,b)$ and $\max(a,b)$ exist. And $0=\min L$. Now i would start to program the possible levels of the structure. They are maybe best defined by associating the oriented graph with vertices $L$ and edges $(x,y)$ if $x\overset !<y$...< p="">

(i do not understand that markup with p above, have to break the comment...)

i.e. $x$ is smaller than $y$ and there is no $z\ne x,y$ (in between). There is a distance in this graph, length of a shortest path, if any, else infinity. The levels are the possible distances from $0$. I am placing now $0$ in level $0$. Then all atoms get level one. To have the iterator for them (and further) take subsets. Then some elements are in level two, generate subsets for them.. And so on. The subsets are generated by taking partitions, then taking some order for them. Then start joining...

Thanks. I added some more explanation for what an atomic lattice is.