def mat_fn_offdiag(self, d1, d2): '''Calculate an off-diagonal Hamiltonian matrix element. :type d1: iterable of :class:`BasisFn` objects :param d1: a Slater determinant basis function, `|d_1\\rangle` :type d2: iterable of :class:`BasisFn` objects :param d2: a Slater determinant basis function, `|d_2\\rangle` :rtype: float :returns: `\langle d_1|H|d_2 \\rangle`. ''' # <D|H|D'> = 1/2 <ij|ij> - <ij|ji> # if |D> and |D'> are related by a double excitation, assuming |D> and # |D'> are in maximum coincidence. (from_1, to_2, nperm) = hamil.determinant_excitation(d1, d2) hmatel = 0 if len(from_1) == 2: if all(total_momentum(from_1) == total_momentum(to_2)): if from_1[0].spin == to_2[0].spin and from_1[1].spin == to_2[1].spin: # Coulomb hmatel += self.sys.coulomb_int(from_1[0].kp - to_2[0].kp) if from_1[0].spin == to_2[1].spin and from_1[1].spin == to_2[0].spin: # Exchange hmatel -= self.sys.coulomb_int(from_1[0].kp - to_2[1].kp) if nperm % 2 == 1: hmatel = -hmatel return hmatel
def mat_fn_offdiag(self, bi, bj): '''Calculate an off-diagonal Hamiltonian matrix element. :type bi: iterable of :class:`LatticeSite` objects :param bi: a Slater determinant basis function, `|b_i\\rangle` :type bj: iterable of :class:`LatticeSite` objects :param bj: a Slater determinant basis function, `|b_j\\rangle` :rtype: float :returns: `\langle b_i|H|b_j \\rangle`. ''' # H = - \sum_{<ij>} (c_i^\dagger c_j + c_j^\dagger c_i - n_i n_j) # Coulomb operator is diagonal in this basis. # Kinetic term only if excitation involves moving a fermion from # a lattice site to a connected lattice site. (from_i, to_j, nperm) = hamil.determinant_excitation(bi, bj) if len(from_i) == 1: hmatel = self.sys.hopping_int(from_i[0], to_j[0]) else: hmatel = 0 if nperm % 2 == 1: hmatel = -hmatel return hmatel
def mat_fn_offdiag(self, d1, d2): '''Calculate an off-diagonal Hamiltonian matrix element. :type d1: iterable of :class:`BasisFn` objects :param d1: a Slater determinant basis function, `|d_1\\rangle` :type d2: iterable of :class:`BasisFn` objects :param d2: a Slater determinant basis function, `|d_2\\rangle` :rtype: float :returns: `\langle d_1|H|d_2 \\rangle`. ''' # <D|H|D'> = 1/2 <ij|ij> - <ij|ji> # if |D> and |D'> are related by a double excitation, assuming |D> and # |D'> are in maximum coincidence. (from_1, to_2, nperm) = hamil.determinant_excitation(d1, d2) hmatel = 0 if len(from_1) == 2: if all(total_momentum(from_1) == total_momentum(to_2)): if from_1[0].spin == to_2[0].spin and from_1[1].spin == to_2[ 1].spin: # Coulomb hmatel += self.sys.coulomb_int(from_1[0].kp - to_2[0].kp) if from_1[0].spin == to_2[1].spin and from_1[1].spin == to_2[ 0].spin: # Exchange hmatel -= self.sys.coulomb_int(from_1[0].kp - to_2[1].kp) if nperm % 2 == 1: hmatel = -hmatel return hmatel