Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working on tunable transmon discrepancies #3

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions qcsys/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .resonator import *
from .kno import *
from .transmon import *
from .tunable_transmon import *
from .transmon_single_charge_basis import *
from .squid_transmon import *
from .fluxonium import *
Expand Down
34 changes: 22 additions & 12 deletions qcsys/devices/transmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,26 @@ def common_ops(self):
ops["a_dag"] = jqt.create(N)
ops["phi"] = self.phi_zpf() * (ops["a"] + ops["a_dag"])
ops["n"] = 1j * self.n_zpf() * (ops["a_dag"] - ops["a"])

ops["cos(φ)"] = jqt.cosm(ops["phi"])

return ops

@property
def Ej(self):
return self.params["Ej"]

def phi_zpf(self):
"""Return Phase ZPF."""
return (2 * self.params["Ec"] / self.params["Ej"]) ** (0.25)
return (2 * self.params["Ec"] / self.Ej) ** (0.25)

def n_zpf(self):
"""Return Charge ZPF."""
return (self.params["Ej"] / (32 * self.params["Ec"])) ** (0.25)
return (self.Ej / (32 * self.params["Ec"])) ** (0.25)

def get_linear_ω(self):
"""Get frequency of linear terms."""
return jnp.sqrt(8 * self.params["Ec"] * self.params["Ej"])
return jnp.sqrt(8 * self.params["Ec"] * self.Ej)

def get_H_linear(self):
"""Return linear terms in H."""
Expand All @@ -50,17 +57,20 @@ def get_H_linear(self):

def get_H_full(self):
"""Return full H in linear basis."""
cos_phi_op = (
jsp.linalg.expm(1j * self.linear_ops["phi"])
+ jsp.linalg.expm(-1j * self.linear_ops["phi"])
) / 2

H_nl = -self.params["Ej"] * cos_phi_op - self.params[
"Ej"
] / 2 * jnp.linalg.matrix_power(self.linear_ops["phi"], 2)
# cos_phi_op = (
# jsp.linalg.expm(1j * self.linear_ops["phi"])
# + jsp.linalg.expm(-1j * self.linear_ops["phi"])
# ) / 2

cos_phi_op = self.linear_ops["cos(φ)"]

H_nl = -self.Ej * cos_phi_op - self.Ej / 2 * self.linear_ops["phi"] @ self.linear_ops["phi"]
return self.get_H_linear() + H_nl

# n_op = self.linear_ops["n"]
# return 4*self.params["Ec"]*n_op@n_op - self.Ej * cos_phi_op

def potential(self, phi):
"""Return potential energy for a given phi."""
return - self.params["Ej"] * jnp.cos(2 * jnp.pi * phi)
return - self.Ej * jnp.cos(2 * jnp.pi * phi)

24 changes: 24 additions & 0 deletions qcsys/devices/tunable_transmon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
""" Tunable Transmon."""

from flax import struct
from jax import config
import jax.numpy as jnp

from qcsys.devices.transmon import Transmon

config.update("jax_enable_x64", True)

@struct.dataclass
class TunableTransmon(Transmon):
"""
Tunable Transmon Device.
"""

@property
def Ej(self):
Ejsum = (self.params["Ej1"] + self.params["Ej2"])
phi_ext = 2 * jnp.pi * self.params["phi_ext"]
gamma = self.params["Ej2"]/self.params["Ej1"]
d = (gamma - 1)/(gamma + 1)
external_flux_factor = jnp.abs(jnp.sqrt(jnp.cos(phi_ext/2)**2 + d**2 * jnp.sin(phi_ext/2)**2))
return Ejsum * external_flux_factor
357 changes: 357 additions & 0 deletions tutorials/2-transmon.ipynb

Large diffs are not rendered by default.

File renamed without changes.