예제 #1
0
파일: chain.py 프로젝트: NNemec/NNlib
        else:
            S = None
        return chain(H,xyz,S=S)

def square_ladder(N,gamma,gamma_perp=None,do_cache=True):
    if gamma_perp == None:
        gamma_perp = gamma

    H = [ matrix(zeros((N,N))) for i in range(2) ]

    for n in range(1,N):
        H[0][n-1,n] = -gamma_perp
        H[0][n,n-1] = -gamma_perp

    for n in range(N):
        H[1][n,n] = -gamma

    return chain(H,do_cache=do_cache)

def linchain(gamma,do_cache=True):
    return square_ladder(N=1,gamma=gamma,do_cache=do_cache)

if __name__ == "__main__":
    import cnt
    import tightbinding
    x = cnt.armchair(20)
    ch = tightbinding.tight_binding_1stNN_graphene(x)

    a = ch.Gs_L(energy=0.5)
    b = ch.Gs_L(energy=1.0)
예제 #2
0
파일: scan.py 프로젝트: NNemec/NNlib
	if self.period is None:
	    return self.integrate() / (self.x[-1] - self.x[0])
	else:
	    return self.integrate() / (self.period)


if __name__ == '__main__':
    import cnt,chain
    import units

    set_printoptions(precision=2,linewidth=200)

    N = 50
    B = 200

    x = cnt.armchair(N)
    ch = chain.tight_binding_1stNN_graphene(x)
    ch.set_bfield([B * units.Tesla,0,0])

    def do_scan():
        scan = scan_adaptive(
            lambda E: ch.band_energies(E)[2*N-10:2*N+10],
            linspace(2*pi/3*0.9,2*pi/3*1.1,8),
            periodic = False,
#            periodic = True,
        )


        for i in range(10):
            scan.refine_bends(maxquot=2.0)
            print "Now at: %i points"%len(scan.x)