Page MenuHomec4science

three_cavities.py
No OneTemporary

File Metadata

Created
Tue, Jul 2, 06:52

three_cavities.py

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 27 09:05:05 2020
@author: ddavidsgl
"""
import numpy as np
import qutip
from scipy.optimize import minimize, shgo
import pickle
""""
Calculation for three cavities, where one is a storage cavity
"""
#import hamiltonian and construction of operators:
from hm import *
""""setting parameters"""
# The index 0 represents the storage cavity and index 1 the cooling cavity
# Delta_s = 0 # Detuning for the storage cavity
# The detuning for the cooling cavity was obtained by optimization
A_s1, A_s2, A_c = 30.77, 30.77, 2.31 # Anharmonicity of storage and cooling cavity
U = [-A_c, -A_s1, -A_s2] # Anharmonicity of storage and cooling cavity
#cross-Kerr: By the construction of the Hamiltonian, only the upper triangle
#of the interaction matrix is needed.
xK = 39.85
K = np.array([[0. , -xK, -xK],
[0. , 0., 0.],
[0. , 0., 0.]]) # cross-Kerr interaction matrix
#This matrix is trivial for 2 modes, but can be more complex for other topologies
J = 0 # hopping
Delta = [59.7750531, 0.000128719269, 0.000128719269]
F = [40.3499521, 20.4251174, 20.4251174]
kappa_c = 27.4250758 # Dissipation rate of the cooling cavity
# Omega_s = kappa_c # Drive amplitudes of storage and cooling cavity
Nmodes = 3 # number of modes
# The drive amplitude of the cooling cavity was obtained through optimization
Nmax = [19, 5, 5] #Max Fock-number for the storage and cooling cavity
"""getting list collapse operators for the dissipation process"""
# This only need to be computed once.
aa = a_tensor_list(Nmodes, Nmax) #contains a list of two qutip QObj
# the first is the annihilation op for the storage cavity the second for the
# cooling cavity
aa[0] *= np.sqrt(kappa_c)
# def fidelity(rho):
# """ calculate fidelity between single-photon Fock state and
# steady state of the storage cavity"""
# # rho_opt = qutip.tensor(qutip.basis(Nmax[1]+1, 1) + qutip.basis(Nmax[2]+1, 2))
# rho_opt = qutip.tensor([qutip.basis(Nmax[1]+1, 1)]*2)
# rho_opt = qutip.ket2dm(rho_opt)
# return qutip.fidelity(rho.ptrace([1,2]), rho_opt)
# def optimize_hamiltonian(paramlist):
# """"constructing hamiltonian"""
# paramlist
# Delta = paramlist[0:3]
# F = paramlist[3:6]
# h = hamiltonian(Delta, U, K, J, F, Nmodes, Nmax, verbose=False)
# """"solving for the steady-state"""
# rho_ss = qutip.steadystate(h, aa_scaled)
# # or use pol(rho_s) as a minimization function
# return 1 - fidelity(rho_ss)
# starting optimization procedure to find optimal cooling drive amplitude
# and detuning of the cooling cavity
# here x0 is the initial guess
# print("starting optimization routine...")
# optimizer_args = {'options':{'disp': True}}
# bounds = [(0,4*A_s1), (2*chi_c1, 8*chi_c1), (2*chi_c1, 8*chi_c1),
# (0, 4*kappa_c), (0, 4*kappa_c), (0, 4*kappa_c)]
# # opt = minimize(optimize_hamiltonian, x0 = [2*A_s, 2*xK, kappa_c, kappa_c],
# # callback=print, options = {'disp': True})
# opt = shgo(optimize_hamiltonian, bounds, iters = 3,
# minimizer_kwargs = optimizer_args,
# options = {'disp' : True})
# # get the optimal parameters from the minimization
# Delta = opt.x[0:2]
# F = opt.x[3:5]
h = hamiltonian(Delta, U, K, J, F, Nmodes, Nmax, verbose=False)
rho_ss = qutip.steadystate(h, aa, method='direct')
#plot results
# fig1, axs1 = qutip.plot_wigner_fock_distribution(rho_ss.ptrace(0), alpha_max=5,
# colorbar=True)
# fig2, axs2 = qutip.plot_wigner_fock_distribution(rho_ss.ptrace(1), alpha_max=5,
# colorbar=True)
# fig3, axs3 = qutip.plot_wigner_fock_distribution(rho_ss.ptrace(2), alpha_max=5,
# colorbar=True)
# fig1.suptitle('cooling cavity')
# fig2.suptitle('storage cavity 1')
# fig3.suptitle('storage cavity 2')
# fig1.tight_layout()
# fig2.tight_layout()
# fig3.tight_layout()
with open('fidisout.p', "wb") as f:
pickle.dump(rho_ss, f)

Event Timeline