コード例 #1
0
def cnot1234():
    return sim.PulseSequence([ \
            sim.Rcar(params, 1.5*pi, 0*pi),
            sim.Rac(params, 1.5*pi, 0, 0),
            sim.RMS(params, 0.25*pi, 0.5*pi),
            sim.Rcar(params, 0.75*pi, 0*pi),
            sim.Rac(params, 1*pi, 0, 0),
            sim.RMS(params, 1.75*pi, 0.5*pi),
            sim.Rcar(params, 0.75*pi, 0*pi),
            sim.Rac(params, 1.5*pi, 0, 0),
            sim.Rcar(params, 0.5*pi, 0*pi) ])
コード例 #2
0
ファイル: expMS.py プロジェクト: knsmith/TIQC-SPICE
def data_optimize(inputparam, params, dec):
    ''' use this function to search for params.MScorr for every detuning. 
    How-to:
    - in the root-level code above, enter params.MSdelta and params.shortestMS
    - here put 'inputparam' in place of the number you want to optimize
    - run the file and enter the result in above
    - repeat for every number that appears in params.MScorr '''
    #params.MScorr = {
    #    'duration': 1.1642,
    #    'omrabi': 1.0268,
    #    'shortPulseFactorPos': {2: 1.000, 4: 1.0106, 8: inputparam, 16: 1.01835},
    #    'shortPulseFactorNeg': {2: 1.010, 4: 1.0214, 8: 1.0271, 16: 1.02986}
    #    }
    pulseseq = sim.PulseSequence([
        sim.Hide(params, 0, True),
        sim.Hide(params, 1, True),
        sim.RMS(params, pi / 2, 0),
        sim.Rcar(params, pi / 2, pi / 2)
    ])
    pulseseq[2].omrabi_r = params.omc_ms * inputparam
    pulseseq[2].omrabi_b = params.omc_ms * inputparam

    data = qc.simulateevolution(pulseseq, params, dec)
    data.displayPMTpopulations(0)

    inbalance = abs(data.P_PMT_end[2] - data.P_PMT_end[5])
    unwanted = abs(data.P_PMT_end[0] + data.P_PMT_end[1] + data.P_PMT_end[3] +
                   data.P_PMT_end[4])

    print inputparam, inbalance + unwanted

    return inbalance + unwanted
コード例 #3
0
ファイル: expMS.py プロジェクト: knsmith/TIQC-SPICE
def MSpulseshaped():
    ''' demonstration of pulse shaping removing fast oscillations '''
    tic = time.time()

    params.shape = 5
    pulselen = np.linspace(10. / 86 * pi / 2, 2 * pi, 4 * 160)
    realpulselen = np.zeros(len(pulselen))
    result = np.zeros([len(pulselen), 2])

    for i in range(len(pulselen)):
        print "pulse length ", pulselen[i]
        pulseseq = sim.PulseSequence([sim.RMS(params, pulselen[i], 0, -1)])
        realpulselen[i] = pulseseq[0].duration
        data = qc.simulateevolution(pulseseq, params, dec)
        data.tracedpopulation(0)
        result[i, :] = 1 - data.YtrI[-1]

    toc = time.time()

    pl.plot(realpulselen, result)
    pl.show()

    print "MSpulseshaped() runtime ", toc - tic, "sec"

    return realpulselen, result
コード例 #4
0
ファイル: expMS.py プロジェクト: knsmith/TIQC-SPICE
def timestepcheck(params, dec):
    ''' check that timestep chosen for ODE is converged '''
    timesteps = np.logspace(0, -3, 10)
    result = np.zeros([len(timesteps), 2])

    params.shape = 5
    params.printpulse = False
    pulseseq = sim.PulseSequence([sim.RMS(params, pi / 2, 0, -1)])

    for i in range(len(timesteps)):
        params.ODEtimestep = timesteps[i]
        print "timestep = ", params.ODEtimestep
        data = qc.simulateevolution(pulseseq, params, dec)
        result[i, 0] = abs(data.Yend[0])**2
        result[i, 1] = abs(data.Yend[int(3 * len(data.Yend) / 4)])**2

    pl.semilogx(timesteps, result[:, 0], '.:')
    pl.xlabel('ODE timestep, [us]')
    pl.ylabel('State population')
    pl.title('convergence of ODE solver vs timestep')
    #    pl.legend(['p(DD,0)', 'p(SS,0)'], loc=2)

    return timesteps, result
コード例 #5
0
''' pulse sequences for order-finding '''

import PyTIQC.core.simtools as sim

# order 1 - Toffoli(1,3,2) - from Volkmarizer
order1 = sim.PulseSequence( [ \
sim.Rcar(params, pi/2, pi/2),  #0
sim.Rac(params, pi/4, 0, 1),  #1
sim.RMS(params, pi/2, pi/2),   #2
sim.Rcar(params, pi/2,pi), #3
sim.Rac(params, 3*pi/2, 0, 1), #4
sim.Rcar(params, pi/4,1*pi), #5
sim.RMS(params, pi/4, pi/2), #6
sim.Rac(params, pi/2, 0, 1), #7
sim.RMS(params, pi/2, pi/2), #8
sim.Rcar(params, pi/2,0*pi), #9
sim.Rcar(params, pi/2,-pi/2) ])

# order 2 - CNOT(1,3) - from paper (IV.A first one)
order2 = sim.PulseSequence( [ \
sim.Rcar(params, pi/2, 0),
sim.Rac(params, 7*pi/2, 0, 2), # 3pi/2 in experiment
sim.RMS(params, pi/4, pi/2),
sim.Rcar(params, pi/4, 0),
sim.Rac(params, 3*pi, 0, 1),
sim.Rcar(params, pi/4, 0),
sim.RMS(params, pi/4, pi/2),
sim.Rac(params, 7*pi/2, 0, 2),
sim.Rcar(params, pi/2, 0),
sim.Rac(params, 3*pi, 0, 1) ])
コード例 #6
0
pi = np.pi

NumberOfIons = 3
NumberOfPhonons = 7
hspace = sim.hspace(NumberOfIons, 2, NumberOfPhonons, 0)
params = sim.parameters(hspace)

params.stepsize = 100
params.printpulse = True

dec = sim.decoherence(params)

pulseseq = sim.PulseSequence( [ \
    sim.Rcar(params, pi/2, 0),
    sim.Rac(params, pi/2, 0, 0),
    sim.RMS(params, pi/4, 0),
    sim.Rcar(params, pi/4, 0),
    sim.Rac(params, pi, 0, 2),
    sim.Rcar(params, pi/4, 0),
    sim.RMS(params, pi/4, 0),
    sim.Rac(params, pi/2, 0, 0),
    sim.Rcar(params, pi/2, 0),
    sim.Rac(params, pi, 0, 2)
    ] )

#params.y0[qc.stateToIndex('DDD' + ',0', hspace)] =  0.25-0.25j
#params.y0[qc.stateToIndex('DDS' + ',0', hspace)] = -0.25-0.25j
#params.y0[qc.stateToIndex('DSD' + ',0', hspace)] = -0.25-0.25j
#params.y0[qc.stateToIndex('DSS' + ',0', hspace)] = -0.25+0.25j
#params.y0[qc.stateToIndex('SDD' + ',0', hspace)] =  0.25-0.25j
#params.y0[qc.stateToIndex('SDS' + ',0', hspace)] = -0.25-0.25j
コード例 #7
0
ファイル: expMS.py プロジェクト: knsmith/TIQC-SPICE
#dec.doRandNtimes = 1
#dec.dict['all'] = True
#dec.doPP = False
#params.use_servers( ['local'])
params.progbar = True

#params.shortestMS = 4
params.calcPulseParams()

pulseseq = sim.PulseSequence( [ \
#    sim.Hide(params, 3, True),
#    sim.Hide(params, 4, True),


    sim.RMS(params, pi/2, 0),
    #sim.Rcar(params, pi/2, pi/2)
    ] )

data = qc.simulateevolution(pulseseq, params, dec)

data.displaypopulation(0)
data.displayPMTpopulations(1)
#data.displayPhaseSpace(0)

####################################################
# extra post-run diagnostic functions


def data_optimize(inputparam, params, dec):
    ''' use this function to search for params.MScorr for every detuning. 
コード例 #8
0
ファイル: QFTseq.py プロジェクト: rrines/tiqc-spice-python3
import PyTIQC.core.simtools as sim

QFTseqP1 = sim.PulseSequence([sim.Rcar(params, pi / 2, -pi / 2)])
QFTseqP2 = sim.PulseSequence([
    sim.Rcar(params, pi / 2, -pi / 2),
    sim.Rac(params, pi / 2, 0, 0),
    sim.Rcar(params, pi / 2, 0)
])
QFTseqP3 = sim.PulseSequence( [ \
    sim.Rcar(params, pi/4, pi/2),  #U.Uy(pi/4, N),
    sim.Rac(params, pi, 0, 1),    #U.Uz(pi, N, 1),
    sim.Rcar(params, pi/4, -pi/2), #  U.Uy(-pi/4,  N),
    sim.Rcar(params, pi/2, pi/2),   #U.Uy(pi/2,N),
    sim.Rac(params, pi, 0, 2),     #U.Uz(pi, N, 2),
    sim.Rcar(params, pi/2, -pi/2),    #U.Uy(-pi/2,N),
    sim.RMS(params, pi/4, 0),    #U.MS(pi/4,0,N),
    sim.Rac(params, pi, 0, 1),   #U.Uz(pi, N, 1),
    sim.RMS(params, pi/4, 0),    #U.MS(pi/4,0,N)
                               ]   )
QFTseqP4 = sim.PulseSequence([
    sim.Rcar(params, pi / 4, -pi / 2),
    sim.Rac(params, pi, 0, 2),
    sim.Rcar(params, pi / 4, pi / 2)
])


QFTseq = sim.PulseSequence( [ \
    sim.Rcar(params, pi/2, 0),       #1
    sim.Rac(params, pi, 0, 1),       #2
    sim.Rac(params, pi/2, 0, 2),     #3
    sim.RMS(params, pi/8, 0),        #4
コード例 #9
0
#    if doPPKitaev: params.ppcpus = 2

Kit = Kitaev.Kitaev()

##########################################
# load the pulse sequences
# change ion order and define permutations
##########################################
# execfile(pulseseqfileShor,locals(),globals())
# exec(open(pulseseqfileShor).read(),globals(),locals()) #,locals(),globals())

#Fredkin gate
Fredkin = sim.PulseSequence([ \
sim.Rcar(params, 0.5*pi, 0.5*pi),
sim.Rac(params, 0.5*pi, 0, 0),
sim.RMS(params, 0.5*pi, pi/2),
sim.Rac(params, 0.5*pi, 0, 1),
sim.Rac(params, -0.5*pi, 0, 0),
sim.Rcar(params, 0.75*pi, 1*pi),
sim.RMS(params, -0.25*pi, pi/2),
sim.Rac(params, 0.5*pi, 0, 1),
sim.RMS(params, 0.5*pi, pi/2),
sim.Rcar(params, 0.5*pi, 0*pi),
sim.Rac(params, -0.25*pi, 0, 1),
sim.Rac(params, 0.5*pi, 0, 0),
sim.RMS(params, 0.5*pi, pi/2),
sim.Rac(params, 0.5*pi, 0, 1),
sim.Rac(params, 0.5*pi, 0, 2),
sim.Rcar(params, 0.5*pi, 0*pi),
sim.Rac(params, -0.5*pi, 0, 2),
sim.Rac(params, -0.5*pi, 0, 1)  ])