#evolution equation SGPE
function phi_step_sgpe(phi, V, t, dt, lambda, m_b, mu, g, stencil_bc, xstep, T)
    noise = sqrt(T * dt) * sampler_complex(size(phi))
    d = length(size(phi))
    out = similar(phi)
    for x in stencil_bc
        out[x[1]] = (
            phi[x[1]] -
            1.0im *
            dt *
            (
                -1.0 / (2.0 * m_b * xstep^2) *
                (sum(phi[i] for i in x[2]) - 2 * d * phi[x[1]]) +
                g * conj(phi[x[1]]) * phi[x[1]] - mu + lambda * V[1][x[1]]
            ) *
            phi[x[1]] + noise[x[1]]
        )
    end
    @. phi = out
end


#if abspath(PROGRAM_FILE) == @__FILE__3
#    include("helper.jl")
#    using BenchmarkTools
#    phi = ones(100,100)+0im*ones(100,100)
#    V = [ones(100,100)+0im*ones(100,100),ones(100,100)+0im*ones(100,100),
#    ones(100,100)+0im*ones(100,100)]
#    xarray = [i for i in range(-5 / 2.0, 5 / 2.0, length = 100)]
#    V = V_fct(V, [0,0], 0, xarray, 1)
#    stencil_bc = tuple_stencil_bc(phi)
#    @btime phi_step_sgpe(phi,V, 0,0.1, 1, 1, 1, 1, stencil_bc, 0.1)
#end
