simulate_dynamics
fireopal.simulate_dynamics(model, initial_state, simulation, observables, shot_count, backend_name, credentials)Simulate the dynamics of a many-body model and estimate observables.
Use this function to time-evolve a quantum many-body model from a given initial state and compute the expectation value of one or more observables of the evolved state. Unlike circuit-based functions, this function does not take any circuit input; the dynamics are specified entirely through the model and simulation definitions.
The user input has four components: the model definition, the simulation parameters, the initial state, and the observables of interest.
Parameters
- model (ModelType) – The model to simulate, created using
ModelType(). Describes the model name, lattice_type and the per-term parameters. SeeModelTypefor details. - initial_state (str) – The initial state from which to begin the time evolution.
- simulation (SimulationType) – The time-evolution method and its parameters, created using
SimulationType(). Describes the method, step_count, and time_step. - observables (SparseOccupationOperators | list [SparseOccupationOperators ]) – Observable(s) for which to compute expectation values of the evolved state. Accepts a single SparseOccupationOperators instance or a list of SparseOccupationOperators instances.
- shot_count (int) – Number of measurements (shots) to take per circuit.
- backend_name (str) – Name of the backend that will execute circuits.
- credentials (Credentials) – Credentials for the target hardware provider, created using the
appropriate helper from the
fireopal.credentialsmodule. For example, usemake_credentials_for_ibm_cloud()for IBM backends.
Returns
FireOpalJob – A job object whose result() method returns a dictionary
containing:
expectation_values (list[float]) : The estimated expectation values of the observables for the evolved state.
observables (list[PauliOperator]) : The observables the user submitted.
provider_job_ids ([str]) : List of provider job IDs for all quantum jobs run during the simulation.
warnings (list[str]) : The warnings produced while compiling or running the simulation.
Raises
QctrlArgumentsValueError – If the input parameter for model is not a ModelType instance.
If the input parameter for simulation is not a SimulationType instance.
If the input parameter for observables is not a SparseOccupationOperators
or a list of them.
If the input parameter for initial_state is longer than 64 characters.
If any observable references a site index greater than
len(initial_state) - 1.