Quanlse/Simulator/__init__.py
def _generateCoupTerm(self, ham: QHamiltonian) -> None:
        r"""
        Return the time-dependent coupling terms of ith qubit and jth qubit.

        :math:`H_{coup} = (a_i^\dagger a_j + a_i a_j^\dagger) \cos(\omega_{qi} - \omega_{qj})t
            + (a_i^\dagger a_j - a_i a_j^\dagger) i \sin(\omega_{qi} - \omega_{qj})t`

        :param ham: a QHamiltonian object.
        :return: None
        """

        for index, value in self.couplingMap.items():

            # Calculate the detuning of qubit i and qubit j

            deltaOmega = self.qubitFreq[index[0]] - self.qubitFreq[index[1]]

            ai = QOperator('ai')
            aj = QOperator('aj')
            adagi = QOperator('adagi')
            adagj = QOperator('adagj')

            # Define the operators for qubit i and qubit j

            if isinstance(self.sysLevel, int):
                ai = destroy(self.sysLevel)
                adagi = create(self.sysLevel)
                aj = destroy(self.sysLevel)
                adagj = create(self.sysLevel)

            elif isinstance(self.sysLevel, list):
                ai = destroy(self.sysLevel[index[0]])
                adagi = create(self.sysLevel[index[0]])
                aj = destroy(self.sysLevel[index[1]])
                adagj = create(self.sysLevel[index[1]])

            # Add the time-dependent always-on interaction between qubit i and qubit j

            ham.addWave(operators=[adagi, aj], onSubSys=[index[0], index[1]],
                        waves=square(t=0, a=value), freq=deltaOmega, phase=0., tag='coupling', t0=0,
                        flag=QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT)

            ham.addWave(operators=[ai, adagj], onSubSys=[index[0], index[1]],
                        waves=square(t=0, a=value), freq=deltaOmega, phase=0., tag='coupling', t0=0,
                        flag=QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT)

            ham.addWave(operators=[QOperator(name='adagi', matrix=1j * adagi.matrix), aj],
                        onSubSys=[index[0], index[1]], waves=square(t=0, a=value),
                        freq=deltaOmega, phase=-pi / 2, tag='coupling', t0=0,
                        flag=QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT)

            ham.addWave(operators=[QOperator(name='ai', matrix=-1j * ai.matrix), adagj],
                        onSubSys=[index[0], index[1]], waves=square(t=0, a=value),
                        freq=deltaOmega, phase=-pi / 2, tag='coupling', t0=0,
                        flag=QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT)
r"""
        Return the time-dependent coupling terms of ith qubit and jth qubit.

        :math:`H_{coup} = (a_i^\dagger a_j + a_i a_j^\dagger) \cos(\omega_{qi} - \omega_{qj})t
            + (a_i^\dagger a_j - a_i a_j^\dagger) i \sin(\omega_{qi} - \omega_{qj})t`

        :param ham: a QHamiltonian object.
        :return: None
        
r"""
Return the time-dependent coupling terms of ith qubit and jth qubit.
r " " " Return the time - dependent coupling terms of ith qubit and jth qubit .
def _generateCoupTerm(self, ham: QHamiltonian) -> None:
        for index, value in self.couplingMap.items():
            deltaOmega = self.qubitFreq[index[0]] - self.qubitFreq[index[1]]
            ai = QOperator('ai')
            aj = QOperator('aj')
            adagi = QOperator('adagi')
            adagj = QOperator('adagj')
            if isinstance(self.sysLevel, int):
                ai = destroy(self.sysLevel)
                adagi = create(self.sysLevel)
                aj = destroy(self.sysLevel)
                adagj = create(self.sysLevel)
            elif isinstance(self.sysLevel, list):
                ai = destroy(self.sysLevel[index[0]])
                adagi = create(self.sysLevel[index[0]])
                aj = destroy(self.sysLevel[index[1]])
                adagj = create(self.sysLevel[index[1]])
            ham.addWave(operators=[adagi, aj], onSubSys=[index[0], index[1]],
                        waves=square(t=0, a=value), freq=deltaOmega, phase=0., tag='coupling', t0=0,
                        flag=QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT)
            ham.addWave(operators=[ai, adagj], onSubSys=[index[0], index[1]],
                        waves=square(t=0, a=value), freq=deltaOmega, phase=0., tag='coupling', t0=0,
                        flag=QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT)
            ham.addWave(operators=[QOperator(name='adagi', matrix=1j * adagi.matrix), aj],
                        onSubSys=[index[0], index[1]], waves=square(t=0, a=value),
                        freq=deltaOmega, phase=-pi / 2, tag='coupling', t0=0,
                        flag=QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT)
            ham.addWave(operators=[QOperator(name='ai', matrix=-1j * ai.matrix), adagj],
                        onSubSys=[index[0], index[1]], waves=square(t=0, a=value),
                        freq=deltaOmega, phase=-pi / 2, tag='coupling', t0=0,
                        flag=QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT)
def _generateCoupTerm ( self , ham : QHamiltonian ) -> None : for index , value in self . couplingMap . items ( ) : deltaOmega = self . qubitFreq [ index [ 0 ] ] - self . qubitFreq [ index [ 1 ] ] ai = QOperator ( 'ai' ) aj = QOperator ( 'aj' ) adagi = QOperator ( 'adagi' ) adagj = QOperator ( 'adagj' ) if isinstance ( self . sysLevel , int ) : ai = destroy ( self . sysLevel ) adagi = create ( self . sysLevel ) aj = destroy ( self . sysLevel ) adagj = create ( self . sysLevel ) elif isinstance ( self . sysLevel , list ) : ai = destroy ( self . sysLevel [ index [ 0 ] ] ) adagi = create ( self . sysLevel [ index [ 0 ] ] ) aj = destroy ( self . sysLevel [ index [ 1 ] ] ) adagj = create ( self . sysLevel [ index [ 1 ] ] ) ham . addWave ( operators = [ adagi , aj ] , onSubSys = [ index [ 0 ] , index [ 1 ] ] , waves = square ( t = 0 , a = value ) , freq = deltaOmega , phase = 0. , tag = 'coupling' , t0 = 0 , flag = QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT ) ham . addWave ( operators = [ ai , adagj ] , onSubSys = [ index [ 0 ] , index [ 1 ] ] , waves = square ( t = 0 , a = value ) , freq = deltaOmega , phase = 0. , tag = 'coupling' , t0 = 0 , flag = QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT ) ham . addWave ( operators = [ QOperator ( name = 'adagi' , matrix = 1j * adagi . matrix ) , aj ] , onSubSys = [ index [ 0 ] , index [ 1 ] ] , waves = square ( t = 0 , a = value ) , freq = deltaOmega , phase = - pi / 2 , tag = 'coupling' , t0 = 0 , flag = QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT ) ham . addWave ( operators = [ QOperator ( name = 'ai' , matrix = - 1j * ai . matrix ) , adagj ] , onSubSys = [ index [ 0 ] , index [ 1 ] ] , waves = square ( t = 0 , a = value ) , freq = deltaOmega , phase = - pi / 2 , tag = 'coupling' , t0 = 0 , flag = QWAVEFORM_FLAG_ALWAYS_ON | QWAVEFORM_FLAG_DO_NOT_CLEAR | QWAVEFORM_FLAG_DO_NOT_PLOT )
r"""
Return the time-dependent coupling terms of ith qubit and jth qubit.
r " " " Return the time - dependent coupling terms of ith qubit and jth qubit .
r"""
        Return the time-dependent coupling terms of ith qubit and jth qubit.

        :math:`H_{coup} = (a_i^\dagger a_j + a_i a_j^\dagger) \cos(\omega_{qi} - \omega_{qj})t
            + (a_i^\dagger a_j - a_i a_j^\dagger) i \sin(\omega_{qi} - \omega_{qj})t`

        :param ham: a QHamiltonian object.
        :return: None
        """ # Calculate the detuning of qubit i and qubit j # Define the operators for qubit i and qubit j # Add the time-dependent always-on interaction between qubit i and qubit j
None
self
ham
QHamiltonian
a QHamiltonian object.
a QHamiltonian object .
math
None