Systems and States
Systems
TensorMixedStates.System
— Typetype System
represent a quantum system
Fields
sites::Vector{<:AbstractSite}
: sites of the systempure_indices::Vector{Index}
: Indices for pure representationsmixed_indices::Vector{Index}
: Indices for mixed representations
Examples
System(10, Qubit())
System([Qubit(), SpinOne(), Qubit(), Boson(5)])
Indexation
system[i] gives site i
system[Pure(), i] gives pure index i
system[Mixed(), i] gives mixed index i
Base.length
— Methodlength(::System)
return the number of sites in the system
NDTensors.sim
— Methodsim(::System)
create a clone of the system: identical but with different indices
TensorMixedStates.:⊗
— Method::System ⊗ ::System
tensor(::System, ::System)
create the tensorial product of two systems
States
TensorMixedStates.Limits
— TypeA type to hold MPS limits
Fields
cutoff
: the cutoff under which singular values are neglectedmaxdim
: the maximum bond dimension
TensorMixedStates.State
— Typestruct State
State(Pure()|Mixed(), ::System, states)
State(Pure()|Mixed(), ::Int, ::AbstractSite, state)
State(Pure()|Mixed(), ::Vector{<:AbstractSite}, state)
State(::State, ::MPS)
represent the complete state of the simulated quantum system
Fields
type::Union{Pure, Mixed}
: pure or mixed representationsystem::System
: system descriptionstate::MPS
: system statepreobs::PreObs
: preprocessing data for computing observables
Examples
State(Pure(), system, "Up")
State(Mixed(), system, ["Up", "Dn", "Up"])
State(Mixed(), system, "FullyMixed")
State(Pure(), system, [1, 0])
State(Pure(), 10, Qubit(), "Up")
State(Mixed(), [Qubit(), Boson(4), Fermion()], ["Up", "2", "Occ"])
State(state, mps) returns a new state with the same system but a new mps
Operations
states can be added, substracted and multiplied by numbers
Base.length
— Methodlength(::State)
return the number of sites in the state
ITensorMPS.maxlinkdim
— Methodmaxlinkdim(::State)
return the maximum link dimension in the state
TensorMixedStates.mix
— Methodmix(::State)
transform a pure representation into a mixed representation
Base.truncate
— Methodtruncate(::State; limits::Limits)
apply the truncation to the given state
TensorMixedStates.trace
— Methodtrace(::State)
Return the trace of the system, mostly usefull for mixed representations. This should be one.
TensorMixedStates.trace2
— Methodtrace2(::State)
Return the trace of the square density matrix, mostly usefull for mixed representations. This is one for pure representations.
LinearAlgebra.norm
— Methodnorm(::State)
Return the norm of the state, mostly usefull for pure representations. This should be one for pure representation.
ITensors.dag
— Methoddag(::State)
adjoint of density matrix for mixed representation
TensorMixedStates.hermitianize
— Methodhermitianize(::State)
modify the state so that it is Hermitian (only useful for mixed state)
TensorMixedStates.hermitianity
— Methodhermitianity(::State)
hermitianity measure whether density matrix for mixed state is Hermitian as it should.
return a value from 0 (anti Hermitian) to 1 (Hermitian)
return 1 for pure state
TensorMixedStates.random_state
— Functionrandom_state(Pure()|Mixed(), ::System, linkdims::Int)
random_state(Pure()|Mixed(), ::Int, ::AbstractSite, linkdims::Int)
random_state(Pure()|Mixed(), ::Vector{<:AbstractSite}, linkdims::Int)
random_state(Pure()|Mixed(), ::State, linkdims::Int)
Return a random state, with the specified link dimension. If a State is given, randomize the given state.
TensorMixedStates.partial_trace
— Methodpartial_trace(::State, ::Vector{Int} [; keepers = true])
return the state partially traced at the given positions, alternatively one can give the positions to keep by setting keepers = true
Simulations
TensorMixedStates.Simulation
— TypeSimulation(state[, time = 0])
Simulation(sim, state[, time = sim.time])
A type to represent simulation data ans store time and file data. It is used and returned by runTMS. The first form creates a simulation object. The second updates the state in the simulation object. (see also get_sim_file
)
Most functions applicable to States can be applied to Simulations
Fields
state
: the state of the systemtime
: the simulation timeoutput
: if not nothing an io where to redirect outputfiles
: a dictionary holding io or dict where to write datadata
: a dictionary holding data collected for theData
objectsformats
: format info for the output
TensorMixedStates.get_sim_file
— Functionget_sim_file(::Simulation, filename)
return the corresponding file of the given simulation "stdout" (or "-"), "stderr" and "" respectively redirect to stdout, stderr and devnull, other names are interpreted as file names.
Filename finishing by ".json" will return a Dict where to store data and this data will be output in JSON format in the file by runTMS
at the end.
Special filenames of the form Data(name)
return a Dict where to store Data. Those Dict are gathered as a Dict in the data
field of the Simulation