示例#1
0
def FindEigenvalues(**args):
    """
	Finds the eigenvalues of the system specified by **args,
	by using pIRAM or ARPACK
	"""

    prop = SetupProblem(**args)
    tempPsi = prop.GetTempPsi()

    solver = pyprop.ArpackSolver(prop)
    solver.Solve()

    PrintOut(solver.Solver.GetEigenvalues().real)

    #test if the find eigenvectors are really eigenvectors
    for i in range(len(solver.Solver.GetEigenvalues())):
        solver.SetEigenvector(prop.psi, i)

        tempPsi.GetData()[:] = 0
        prop.MultiplyHamiltonian(tempPsi)
        n1 = tempPsi.GetNorm()
        n2 = prop.psi.GetNorm()
        lindep = prop.psi.InnerProduct(tempPsi) / (n1 * n2)

        E = prop.GetEnergyExpectationValue()

        PrintOut("E = %f, cos(theta) = %f" % (E, abs(lindep)))

        #Propagate the eigenstate to see if it remains in the same state
        #args['silent'] = True
        #args['initPsi'] = prop.psi
        #Propagate(**args)

    return solver
示例#2
0
def FindEigenvalues(useArpack=False, **args):
    prop = SetupProblem(**args)
    if useArpack:
        solver = pyprop.ArpackSolver(prop)
    else:
        solver = pyprop.PiramSolver(prop)
    solver.Solve()
    print solver.GetEigenvalues()
    return solver
示例#3
0
def GetH2Groundstate(**args):
	assert("configFile" not in args)
	args["configFile"] = "config.ini"
	args["eigenvalueCount"] = 1
	
	prop = SetupProblem(**args)
	solver = pyprop.ArpackSolver(prop)
	solver.Solve()

	E = solver.GetEigenvalues()[0]
	solver.SetEigenvector(prop.psi, 0)

	return E, prop.psi
示例#4
0
def FindEigenstates(useARPACK=False, **args):
    """
	Uses pIRAM to find the the lowest eigenvectors of the
	problem specified in **args
	"""
    prop = SetupProblem(**args)

    #use custom initial residual if provided
    initialResidual = args.get("initialResidual")
    if initialResidual != None:
        prop.psi.GetData()[:] = initialResidual.GetData()

    #find eigenstates
    solver = None
    if useARPACK:
        solver = pyprop.ArpackSolver(prop)
    else:
        solver = pyprop.PiramSolver(prop)
    solver.Solve()
    return solver
示例#5
0
def CreateArpackSolver(**args):
	prop = SetupProblem(**args)
	solver = pyprop.ArpackSolver(prop)
	solver.Solve()
	return prop, solver