def N_op(spin_names, orb_names, off_diag=None, map_operator_structure=None): r""" Create an operator of the total number of particles. .. math:: \hat N = \sum_{i\sigma} a_{i\sigma}^\dagger a_{i\sigma}. Parameters ---------- spin_names : list of strings Names of the spins, e.g. ['up','down']. orb_names : list of strings or int Names of the orbitals, e.g. [0,1,2] or ['t2g','eg']. off_diag : boolean Do we have (orbital) off-diagonal elements? If yes, the operators and blocks are denoted by ('spin', 'orbital'), otherwise by ('spin_orbital',0). map_operator_structure : dict Mapping of names of GF blocks names from one convention to another, e.g. {('up', 0): ('up_0', 0), ('down', 0): ('down_0',0)}. If provided, the operators and blocks are denoted by the mapping of ``('spin', 'orbital')``. Returns ------- N : Operator The total number of particles. """ mkind = get_mkind(off_diag, map_operator_structure) N = Operator() for sn, on in product(spin_names, orb_names): N += n(*mkind(sn, on)) return N
def N_op(spin_names, orb_names, off_diag = None, map_operator_structure = None): r""" Create an operator of the total number of particles. .. math:: \hat N = \sum_{i\sigma} a_{i\sigma}^\dagger a_{i\sigma}. Parameters ---------- spin_names : list of strings Names of the spins, e.g. ['up','down']. orb_names : list of strings or int Names of the orbitals, e.g. [0,1,2] or ['t2g','eg']. off_diag : boolean Do we have (orbital) off-diagonal elements? If yes, the operators and blocks are denoted by ('spin', 'orbital'), otherwise by ('spin_orbital',0). map_operator_structure : dict Mapping of names of GF blocks names from one convention to another, e.g. {('up', 0): ('up_0', 0), ('down', 0): ('down_0',0)}. If provided, the operators and blocks are denoted by the mapping of ``('spin', 'orbital')``. Returns ------- N : Operator The total number of particles. """ mkind = get_mkind(off_diag,map_operator_structure) N = Operator() for sn, on in product(spin_names,orb_names): N += n(*mkind(sn,on)) return N
print "n0up = ", A.average(n0up) print "n1up = ", A.average(n1up) print "n2up = ", A.average(n2up) print "n3up = ", A.average(n3up) n0down = c_dag_0_down * dagger(c_dag_0_down) n1down = c_dag_1_down * dagger(c_dag_1_down) n2down = c_dag_2_down * dagger(c_dag_2_down) n3down = c_dag_3_down * dagger(c_dag_3_down) print "n0down = ", A.average(n0down) print "n1down = ", A.average(n1down) print "n2down = ", A.average(n2down) print "n3down = ", A.average(n3down) # n in k space (to compare with gf) n_00 = n("00-up", 0) n_10 = n("10-up", 0) n_01 = n("01-up", 0) n_11 = n("11-up", 0) print "<n00> = ", A.average(n_00) print "<n10> = ", A.average(n_10) print "<n01> = ", A.average(n_01) print "<n11> = ", A.average(n_11) # dimer states are NOT orthogonals. print "dimer prod" , A.dot_product_from_creation_op(ops_0hole[0], ops_0hole[0]) print "dimer prod" , A.dot_product_from_creation_op(ops_0hole[0], ops_0hole[1]) print "dimer prod" , A.dot_product_from_creation_op(ops_0hole[1], ops_0hole[1]) print "dimer prod" , A.dot_product_from_creation_op(ops_1hole[1], ops_0hole[1]) for op in ops_1hole:
print "n0up = ", A.average(n0up) print "n1up = ", A.average(n1up) print "n2up = ", A.average(n2up) print "n3up = ", A.average(n3up) n0down = c_dag_0_down * dagger(c_dag_0_down) n1down = c_dag_1_down * dagger(c_dag_1_down) n2down = c_dag_2_down * dagger(c_dag_2_down) n3down = c_dag_3_down * dagger(c_dag_3_down) print "n0down = ", A.average(n0down) print "n1down = ", A.average(n1down) print "n2down = ", A.average(n2down) print "n3down = ", A.average(n3down) # n in k space (to compare with gf) n_00 = n("00-up", 0) n_10 = n("10-up", 0) n_01 = n("01-up", 0) n_11 = n("11-up", 0) print "<n00> = ", A.average(n_00) print "<n10> = ", A.average(n_10) print "<n01> = ", A.average(n_01) print "<n11> = ", A.average(n_11) # dimer states are NOT orthogonals. print "dimer prod", A.dot_product_from_creation_op(ops_0hole[0], ops_0hole[0]) print "dimer prod", A.dot_product_from_creation_op(ops_0hole[0], ops_0hole[1]) print "dimer prod", A.dot_product_from_creation_op(ops_0hole[1], ops_0hole[1]) print "dimer prod", A.dot_product_from_creation_op(ops_1hole[1], ops_0hole[1]) for op in ops_1hole: