# make \`MPS\` and \`OpSum\` forward kwargs to \`state\` and \`op\`

**URL:** <https://itensor.discourse.group/t/make-mps-and-opsum-forward-kwargs-to-state-and-op/2285>\
**Category:** ITensor Development\
**Tags:** julia\
**Created:** [March 6, 2025, 12:22am UTC](https://itensor.discourse.group/t/make-mps-and-opsum-forward-kwargs-to-state-and-op/2285 "2025-03-06T00:22:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![VinceNeede](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/vinceneede/32/731_2.png) [@VinceNeede](https://itensor.discourse.group/u/VinceNeede)\
**Post date:** [March 6, 2025, 12:22am UTC](https://itensor.discourse.group/t/make-mps-and-opsum-forward-kwargs-to-state-and-op/2285/1 "2025-03-06T00:22:16Z")

</div>

It is not clear if something like that is possible or not.  
About `OpSum`, it seems that after this Issue [PastaQ.jl/Issue#247](https://github.com/GTorlai/PastaQ.jl/issues/247) it is possible to pass multi site operators and parameters, So I can write something like

```auto
sites = siteinds("Qubit",4)
os = OpSum() + ("Rn", 1, (θ = 0.5, ϕ = 0.2, λ = 1.2))
U = MPO(os, sites)

```

But I can’t find this in any documentation or example, if not from `PastaQ` ([OpSum · ITensors.jl](https://itensor.github.io/ITensors.jl/stable/OpSum.html#OpSum)), is the documentation outdated or is there a reason for not exposing this?

Meanwhile about `MPS` it doesn’t seem possible to pass parameters to the state. What I mean is that given this overload of `state`

```auto
function ITensors.state(::StateName"ψ_θ",::SiteType"Qubit"; θ) 
    @assert 0. <= θ <=1.
    return [sqrt(θ), sqrt(1-θ)]
end

```

It is not possible to do something like

```auto
psi = MPS(sites, i-> ("ψ_θ", (θ = isodd(i) ? 0.1 : 0.5,)))

```

Since it would be trivial to just construct the `Vector{ITensor}` and construct the MPS from it directly

```auto
states = [state(site,"ψ_θ"; θ = isodd(i) ? 0.1 : 0.5) for (i,site) in enumerate(sites)]
ψ = MPS(states)

```

I’m wondering if it is a choice of style or just it hasn’t been implemented yet. In either case I think it would be a good idea to put (if not the example I proposed, something similar) in the documentation or in the `Examples` section
