Skip to content

num_expect=0 although evolution can run #332

@ferrispnugraha

Description

@ferrispnugraha

Bug Description

Run a simple evolution, not recording the expectation value

Code to Reproduce the Bug

using QuantumToolbox

H = 2 * π * 0.1 * sigmax()
ψ0 = basis(2, 0) # spin-up
tlist = LinRange(0.0, 10.0, 20)

prob = sesolveProblem(H, ψ0, tlist, e_ops = [sigmaz()])
sol = sesolve(prob)

Code Output

Progress: [==============================] 100.0% --- Elapsed Time: 0h 00m 02s (ETA: 0h 00m 00s)

Solution of time evolution
(return code: Success)
--------------------------
num_states = 1
num_expect = 0
ODE alg.: OrdinaryDiffEqTsit5.Tsit5{typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!), Static.False}(OrdinaryDiffEqCore.trivial_limiter!, OrdinaryDiffEqCore.trivial_limiter!, static(false))
abstol = 1.0e-8
reltol = 1.0e-6

Expected Behaviour

As in https://qutip.org/QuantumToolbox.jl/stable/users_guide/time_evolution/sesolve

Solution of time evolution
(return code: Success)

num_states = 1
num_expect = 1
ODE alg.: OrdinaryDiffEqTsit5.Tsit5{typeof(OrdinaryDiffEqCore.trivial_limiter!), typeof(OrdinaryDiffEqCore.trivial_limiter!), Static.False}(OrdinaryDiffEqCore.trivial_limiter!, OrdinaryDiffEqCore.trivial_limiter!, static(false))
abstol = 1.0e-8
reltol = 1.0e-6

Your Environment

QuantumToolbox.jl: Quantum Toolbox in Julia
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
Copyright © QuTiP team 2022 and later.
Current admin team:
    Alberto Mercurio and Yi-Te Huang

Package information:
====================================
Julia              Ver. 1.11.1
QuantumToolbox     Ver. 0.22.0
SciMLOperators     Ver. 0.3.12
LinearSolve        Ver. 2.38.0
OrdinaryDiffEqCore Ver. 1.13.0

System information:
====================================
OS       : Windows (x86_64-w64-mingw32)
CPU      : 20 × 12th Gen Intel(R) Core(TM) i7-12700H
Memory   : 31.679 GB
WORD_SIZE: 64
LIBM     : libopenlibm
LLVM     : libLLVM-16.0.6 (ORCJIT, alderlake)
BLAS     : libopenblas64_.dll (ilp64)
Threads  : 1 (on 20 virtual cores)

Additional Context

expt_z = real(sol.expect[1,:]) 
expt_y = real(sol.expect[2,:])

returns the following error (expect is empty):

MethodError: no method matching getindex(::Nothing, ::Int64, ::Colon)
The function `getindex` exists, but no method is defined for this combination of argument types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions