CircuitSymMethods

class scqubits.core.circuit_sym_methods.CircuitSymMethods[source]

Methods

CircuitSymMethods.__init__()

CircuitSymMethods.hamiltonian_for_qutip_dynamics(...)

Returns the Hamiltonian in a format amenable to be forwarded to mesolve in Qutip. Also returns the symbolic expressions of time independent and time dependent terms of the Hamiltonian, which can be used for reference. free_var_func_dict is a dictionary with key-value pair {"var": f}, where f is a function returning the value of the variable var at time t. If one has extra terms to be added to the Hamiltonian (for instance, charge driving a fluxonium where there is no offset charge) they can be passed as a string in extra_terms. For example, to get the Hamiltonian for a circuit where Φ1 is the time varying parameter, this method can be called in the following way::.

CircuitSymMethods.offset_charge_transformation()

Prints the variable transformation between offset charges of transformed variables and the node charges.

CircuitSymMethods.operator_names_in_hamiltonian_symbolic()

Returns a list of the names (strings) of all operators occurring in the symbolic Hamiltonian.

CircuitSymMethods.print_expr_in_latex(expr)

Print a sympy expression or a list of equalities in LaTeX.

CircuitSymMethods.sym_hamiltonian([...])

Prints a user readable symbolic Hamiltonian for the current instance.

CircuitSymMethods.sym_interaction(...[, ...])

Print the interaction between any set of subsystems for the current instance.

CircuitSymMethods.sym_potential([...])

Method prints a user readable symbolic potential for the current instance.

hamiltonian_for_qutip_dynamics(free_var_func_dict, prefactor=1.0, extra_terms=None)[source]

Returns the Hamiltonian in a format amenable to be forwarded to mesolve in Qutip. Also returns the symbolic expressions of time independent and time dependent terms of the Hamiltonian, which can be used for reference. free_var_func_dict is a dictionary with key-value pair {“var”: f}, where f is a function returning the value of the variable var at time t. If one has extra terms to be added to the Hamiltonian (for instance, charge driving a fluxonium where there is no offset charge) they can be passed as a string in extra_terms. For example, to get the Hamiltonian for a circuit where Φ1 is the time varying parameter, this method can be called in the following way:

def flux_t(t, args):
    return 0.5 + 0.02*np.sin(t*2)
def ng_t(t, args):
    return 0.5 + 0.02*np.cos(t*2)
def EJ_t(t, args):
    return (1-np.exp(-t/1))*0.2
free_var_func_dict = {"Φ1": flux_t, "EJ": EJ_t, "ng": ng_t}

mesolve_input_H = self.hamiltonian_for_qutip_dynamics(free_var_func_dict, extra_terms="0.1*ng*Q1")
Parameters:
  • free_var_func_dict (Dict[str, Callable]) – Dict, as defined in the description above

  • prefactor (float) – prefactor with which the Hamiltonian and corresponding operators are multiplied, useful to set it to 2*np.pi for some qutip simulations

  • extra_terms (Optional[str]) – a string which will be converted into sympy expression, containing terms which are not present in the Circuit Hamiltonian. It is useful to define custom drive operators.

Return type:

Tuple[List[Union[Qobj, Tuple[Qobj, Callable]]], Expr, Dict[Qobj, Expr]]

offset_charge_transformation()[source]

Prints the variable transformation between offset charges of transformed variables and the node charges.

Return type:

None

operator_names_in_hamiltonian_symbolic()[source]

Returns a list of the names (strings) of all operators occurring in the symbolic Hamiltonian.

Return type:

List[str]

static print_expr_in_latex(expr)[source]

Print a sympy expression or a list of equalities in LaTeX.

Parameters:

expr (Union[Expr, List[Equality]]) – a sympy expressions or a list of equalities

Return type:

None

sym_hamiltonian(subsystem_index=None, float_round=6, print_latex=False, return_expr=False)[source]

Prints a user readable symbolic Hamiltonian for the current instance.

Parameters:
  • subsystem_index (Optional[int]) – when set to an index, the Hamiltonian for the corresponding subsystem is returned.

  • float_round (int) – Number of digits after the decimal to which floats are rounded

  • print_latex (bool) – if set to True, the expression is additionally printed as LaTeX code

  • return_expr (bool) – if set to True, all printing is suppressed and the function will silently return the sympy expression

Return type:

Optional[Expr]

sym_interaction(subsystem_indices, float_round=6, print_latex=False, return_expr=False)[source]

Print the interaction between any set of subsystems for the current instance. It would print the interaction terms having operators from all the subsystems mentioned in the tuple.

Parameters:
  • subsystem_indices (Tuple[int]) – Tuple of subsystem indices

  • float_round (int) – Number of digits after the decimal to which floats are rounded

  • print_latex (bool) – if set to True, the expression is additionally printed as LaTeX code

  • return_expr (bool) – if set to True, all printing is suppressed and the function will silently return the sympy expression

Return type:

Optional[Expr]

sym_potential(float_round=6, print_latex=False, return_expr=False)[source]

Method prints a user readable symbolic potential for the current instance.

Parameters:
  • float_round (int) – Number of digits after the decimal to which floats are rounded

  • print_latex (bool) – if set to True, the expression is additionally printed as LaTeX code

  • return_expr (bool) – if set to True, all printing is suppressed and the function will silently return the sympy expression

Return type:

Optional[Expr]