I'm trying to adapt the code here ( http://itensor.org/docs.cgi?page=classes/autompo&vers=cppv3 )from C++ to Julia, specifically for the 1D Hubbard model. I'm a little confused on how I can enforce the number of electrons, number of sites, and number of spin-up and spin-down electrons.

Here is the code:

```
N = 2 # number of sites
t = 1.0 # hopping term
u = 0.0 # potential term (onsite)
sites = siteinds("Electron", N)
ampo = AutoMPO()
for i=1:N
ampo += u ,"Nupdn", i
end
for i=1:N-1
ampo += -t, "Cdagup", i, "Cup", i+1
ampo += -t, "Cdagup", i+1, "Cup", i
ampo += -t, "Cdagdn", i, "Cdn", i+1
ampo += -t, "Cdagdn", i+1, "Cdn", i
end
H = MPO(ampo, sites)
```

N = 2 above enforces that we have a two site Hubbard model. I'm assuming that I've also enforced two electrons here in the line:

```
sites = siteinds("Electron", N)
```

since I'm creating N=2 electrons (though I'm not sure if this is entirely true).

How might I enforce total S=0 (half of the electrons spin up, the other half spin down)? And how do I control how many electrons I have?

Apologies for the basic question!