qiskit_dynamics.backend.parse_backend_hamiltonian_dict#

parse_backend_hamiltonian_dict(hamiltonian_dict, subsystem_list=None)[source]#

Convert Pulse backend Hamiltonian dictionary into concrete array format with an ordered list of corresponding channels.

The Pulse backend Hamiltonian dictionary, hamiltonian_dict, must have the following keys:

  • 'h_str': List of Hamiltonian terms in string format (see below).

  • 'qub': Dictionary giving subsystem dimensions. Keys are subsystem labels, values are their dimensions.

  • 'vars': Dictionary whose keys are the variables appearing in the terms in the h_str list, and values being the numerical values of the variables.

The optional argument subsystem_list specifies a subset of subsystems to keep when parsing. If None, all subsystems are kept. If subsystem_list is specified, then terms including subsystems not in the list will be ignored.

Entries in the list hamiltonian_dict['h_str'] must be formatted as a product of constants (either numerical constants or variables in hamiltonian_dict['vars'].keys()) with operators. Operators are indicated with a capital letters followed by an integer indicating the subsystem the operator acts on. Accepted operator strings are:

  • 'X': If the target subsystem is two dimensional, the Pauli \(X\) operator, and if greater than two dimensional, returns \(a + a^\dagger\), where \(a\) and \(a^\dagger\) are the annihiliation and creation operators, respectively.

  • 'Y': If the target subsystem is two dimensional, the Pauli \(Y\) operator, and if greater than two dimensional, returns \(-i(a - a^\dagger)\), where \(a\) and \(a^\dagger\) are the annihiliation and creation operators, respectively.

  • 'Z': If the target subsystem is two dimensional, the Pauli \(Z\) operator, and if greater than two dimensional, returns \(I - 2 * N\), where \(N\) is the number operator.

  • 'a', 'A', or 'Sm': If two dimensional, the sigma minus operator, and if greater, generalizes to the annihilation operator.

  • 'C', or 'Sp': If two dimensional, sigma plus operator, and if greater, generalizes to the creation operator.

  • 'N', or 'O': The number operator.

  • 'I': The identity operator.

In addition to the above, a term in hamiltonian_dict['h_str'] can be associated with a channel by ending it with a string of the form '||Sxx', where S is a valid channel label, and 'xx' is an integer. Accepted channel labels are:

  • 'D' or 'd' for drive channels.

  • 'U' or 'u' for control channels.

  • 'M' or 'm' for measurement channels.

  • 'A' or 'a' for acquire channels.

Finally, summations of terms of the above form can be indicated in hamiltonian_dict['h_str'] via strings with syntax '_SUM[i, lb, ub, aa||S{i}]', where:

  • i is the summation variable.

  • lb and ub are the summation endpoints (inclusive).

  • aa is a valid operator string, possibly including the string {i} to indicate operators acting on subsystem i.

  • S{i} is the specification of a channel indexed by i.

For example, the following hamiltonian_dict specifies a single transmon with 4 levels:

hamiltonian_dict = {
    "h_str": ["v*np.pi*O0", "alpha*np.pi*O0*O0", "r*np.pi*X0||D0"],
    "qub": {"0": 4},
    "vars": {"v": 2.1, "alpha": -0.33, "r": 0.02},
}

The following example specifies a two transmon system, with single system terms specified using the summation format:

hamiltonian_dict = {
    "h_str": [
        "_SUM[i,0,1,wq{i}/2*(I{i}-Z{i})]",
        "_SUM[i,0,1,delta{i}/2*O{i}*O{i}]",
        "_SUM[i,0,1,-delta{i}/2*O{i}]",
        "_SUM[i,0,1,omegad{i}*X{i}||D{i}]",
        "jq0q1*Sp0*Sm1",
        "jq0q1*Sm0*Sp1",
        "omegad1*X0||U0",
        "omegad0*X1||U1"
    ],
    "qub": {"0": 4, "1": 4},
    "vars": {
        "delta0": -2.111793476400394,
        "delta1": -2.0894421352015744,
        "jq0q1": 0.010495754104003914,
        "omegad0": 0.9715458990879812,
        "omegad1": 0.9803812537440838,
        "wq0": 32.517894442809514,
        "wq1": 33.0948996120196,
    },
}
Parameters:
  • hamiltonian_dict (dict) – Pulse backend Hamiltonian dictionary.

  • subsystem_list (Optional[List[int]]) – List of subsystems to include in the model. If None all are kept.

Returns:

Model converted into concrete arrays - the static Hamiltonian, a list of Hamiltonians corresponding to different channels, a list of channel labels corresponding to the list of time-dependent Hamiltonians, and a dictionary with subsystem dimensions whose keys are the subsystem labels.

Return type:

Tuple