How to construct a lattice#

Lattices are workflows comprised of a series of subtasks. These workflows are defined by functions with the lattice decorator. In the example below, we see how to create a very simple lattice that returns the square of a number.

[1]:
import covalent as ct
[2]:
@ct.lattice
def workflow(x):
    return x ** 2

Lattices can be comprised of several subtasks which are constructed via the electron decorator and added to the workflow as shown in How to add electrons to lattices.