Commit 21b1b195 authored by Christian Schneider's avatar Christian Schneider
Browse files

work on resonator class

parent b12d126f
......@@ -3,6 +3,9 @@
# theory.
#
# Useful references:
# Appendix of
# https://journals.aps.org/prapplied/abstract/10.1103/PhysRevApplied.16.034024
#
# CMF Schneider, PhD thesis, Chapter 2.1.1
# https://diglib.uibk.ac.at/ulbtirolhs/content/titleinfo/6067206
#
......@@ -39,7 +42,7 @@ def fit_frequency(temp_array, fr_array, delta0_guess=0.18e-3, alpha_guess=1e-3):
# Create Model
gmodel = lm.Model(get_delta_fr_over_f0)
# Guess values
sigma_n = 1e8 # Normal state conductance cancels out, only placeholder
sigma_n = 1 # Normal state conductance cancels out, only placeholder
f_max_idx = np.argmax(fr_array)
f_max = fr_array[f_max_idx]
T0 = temp_array[f_max_idx]
......@@ -56,6 +59,7 @@ def fit_frequency(temp_array, fr_array, delta0_guess=0.18e-3, alpha_guess=1e-3):
params['alpha'].min = 0
params['Delta0'].min = 0
params['Delta0'].max = 1
params['sigma_n'].vary = False
params['T0'].vary = False
params['f0'].vary = False
......@@ -67,6 +71,19 @@ def fit_frequency(temp_array, fr_array, delta0_guess=0.18e-3, alpha_guess=1e-3):
params=params,
T=temp_array)
# Print summary
print("Fit {}".format("successful." if res.success else "failed."))
if res.success:
print('Parameters')
print('----------')
print("alpha = {:.2e} +/- {:.1e}".format(res.params["alpha"].value,
res.params["alpha"].stderr))
print("Delta0 = {:.2e} +/- {:.1e} eV".format(res.params["Delta0"].value,
res.params["Delta0"].stderr))
print("Tc = {:.3f} +/- {:.3f} K"
.format(res.params["Delta0"].value*SC.eV/(SC.Boltzmann*1.76),
res.params["Delta0"].stderr*SC.eV/(SC.Boltzmann*1.76)))
return res
# Helper functions #############################################################
......
# Class to analyze squid resonators
#
# CMF Schneider, PhD thesis, Chapter 2
# https://diglib.uibk.ac.at/ulbtirolhs/content/titleinfo/6067206
#
# Libraries
import numpy as np
from scipy.special import kn
import scipy.constants as SC
import lmfit as lm
from scipy import optimize
# Numerical SQUID evaluation functions #########################################
def get_delta2(phi, beta, I, delta1, alpha=0, eta=0):
"""Calculate phase difference for second josephson junction.
Parameters
----------
phi : float
Applied magnetic flux in units of mag. flux qunata Phi0
beta : float
Screening parameter
I : float
Applied current
delta1 : float
Phase difference for first junction
alpha : float
Asymmetry in critical currents
eta : float
Asymmetry in linear SQUID inductance
Returns
-------
float
Phase difference for second josephson junction
"""
return delta1 + 2*np.pi*phi + np.pi*beta*I*(eta-1)/2 + np.pi*beta*\
(1-alpha)*np.sin(delta1)
def F(I, delta1, phi, beta, alpha=0, eta=0):
"""F function of Tesche and Clarke paper. The root of this function
sets the phase delta1 for a given current. Unfortunately it is an implicit
function, so we have to use numerics.
We can find the critical current by finding the maximum current at which
F still has a root.
Parameters
-----------
I : float
Applied current through SQUID
delta1 : float
Phase difference for junction1
phi : float
Applied magnetic flux in units of mag. flux quantum Phi0
beta : float
Screening parameter betaL = L_geo/(pi * L_J)
alpha : float
Critical current asymmetry
eta : float
Inductance asymmetry
"""
return I - (1 - alpha) * np.sin(delta1) - \
(1 + alpha) * np.sin(delta2(phi, beta, I, delta1, alpha, eta))
def find_roots(phi, beta, alpha=0, eta=0, n_deltas_min=1001):
"""Root finder for F. Returns the critical current for a given applied
flux.
In contrast to Tesche and Clarke we don't use
Newton Raphson but calculate all delta values by brute force and pick the
minimum. This makes the algortihm slower but much more robust since the
function is very nonlinear.
Parameters
-----------
Φa : applied magnetic flux. This function just supports float values,
no arrays.
β : screening parameter betaL = L_geo/(pi * L_J)
α : critical current asymmetry
η : inductance asymmetry
n_deltas_min : number of delta1 for which the function is evaluated.
delta1 runs between 0 and 2pi.
"""
# Calculate function for delta1 values betwen 0 and 2pi
# Requires refinment for high beta values due to numerical precission
# But use at least n_deltas_min points
deltas = np.linspace(0, 2 * np.pi,
int(np.max([n_deltas_min * β, n_deltas_min])))
# Function to minimize
def fun(x):
# Calculate F for all deltas for a given current x[0]
res = F(x[0], deltas, Φa, β, α, η)
# Pick minimum
min_idx = np.argmin(res)
# Return minimum value
return [res[min_idx]]
# Optimize: Find maximum critical current
sol = optimize.least_squares(fun, [2], bounds=(0, 2), method='trf')
return sol.x[0]
def find_ic(phi, beta, alpha=0, eta=0):
"""Find numerically the critical current of a SQUID loop.
Parameters
----------
phi : float
Applied flux in units of mag. flux quantum Phi0
beta
alpha
eta
Returns
-------
"""
def get_fr(phi, betaL, alpha, eta, L_r, C_r, I_JJ):
"""Calculate resonance frequency for a given flux and given resonator and
junction parameters.
Parameters
----------
phi : float
Applied flux in SQUID loop in units of mag. flux quantum Phi0
betaL : float
Screening parameter for SQUIDs 0<betaL
alpha : float
Asymmetry of josephson junctions
eta : float
Asymmetry of linear inductance of SQUID loop
L_r : float
Linear Inductance of resonator in Henry
C_r : float
Linear capacitance of resonator in Farad
I_JJ : float
Critical current of one (mean of the two if asymmetric) josephson
junction
Returns
-------
float
Resonance frequency of SQUID resonator for given flux
"""
L_squid = SC.hbar / (2 * SC.e * find_ic(phi, betaL, alpha, eta) * I_JJ)
return 1 / (2 * np.pi * np.sqrt(C_r * (L_r + L_squid)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment