Exemplo n.º 1
0
import datainput as di
import solver as slv
import saveoutput as so
import numpy as np
import inputtests as it
DATALINES1 = it.reader('input_files/Schroedinger1.inp')
START1 = it.getxmin(DATALINES1)
STOP1 = it.getxmax(DATALINES1)
N1 = it.getnumofpoints(DATALINES1)-1
X1 = np.linspace(START1, STOP1, N1+1)
INTTYPE1 = it.interpolationtype(DATALINES1) #type of interpolation
A1 = it.getA(DATALINES1)
VX1 = np.asarray_chkfinite(it.getxvalues(DATALINES1), dtype=np.float64, order='C')
VY1 = np.asarray_chkfinite(it.getyvalues(DATALINES1), dtype=np.float64, order='C')
FVALUE1 = it.getfirsteigen(DATALINES1)-1
LVALUE1 = it.getlasteigen(DATALINES1)-1
NUMEV1 = LVALUE1-FVALUE1
AA1 = it.eigen(VX1, VY1, X1, INTTYPE1, FVALUE1, LVALUE1, A1, N1)
EIVAL1 = AA1[0]
so.saveeigenvaluestest(EIVAL1, FVALUE1, LVALUE1, 'testfiles/energietest1.dat')
so.savepotentialtest(slv.potential(VX1, VY1, X1, INTTYPE1), X1, 'testfiles/potentialtest1.dat')
def test_potential1():
    """The funtion tests the potential
    """
    refpot1 = di.readcalcpotential('reference_files/potential1.dat')
    pot1 = di.readcalcpotential('testfiles/potentialtest1.dat')
    assert np.all(pot1-refpot1 < 0.01)

def test_energies1():
    """The function tests the energies
    """
Exemplo n.º 2
0
import datainput as di
import solver as slv
import saveoutput as so
import numpy as np
import inputtests as it
DATALINES2 = it.reader('input_files/Schroedinger2.inp')
START2 = it.getxmin(DATALINES2)
STOP2 = it.getxmax(DATALINES2)
N2 = it.getnumofpoints(DATALINES2)-1
X2 = np.linspace(START2, STOP2, N2+1)
INTTYPE2 = it.interpolationtype(DATALINES2) #type of interpolation
A2 = it.getA(DATALINES2)
VX2 = np.asarray_chkfinite(it.getxvalues(DATALINES2), dtype=np.float64, order='C')
VY2 = np.asarray_chkfinite(it.getyvalues(DATALINES2), dtype=np.float64, order='C')
FVALUE2 = it.getfirsteigen(DATALINES2)-1
LVALUE2 = it.getlasteigen(DATALINES2)-1
NUMEV2 = LVALUE2-FVALUE2
AA2 = it.eigen(VX2, VY2, X2, INTTYPE2, FVALUE2, LVALUE2, A2, N2)
EIVAL2 = AA2[0]
so.saveeigenvaluestest(EIVAL2, FVALUE2, LVALUE2, 'testfiles/energietest2.dat')
so.savepotentialtest(slv.potential(VX2, VY2, X2, INTTYPE2), X2, 'testfiles/potentialtest2.dat')
def test_potential():
    """The function tests the potentials
    """
    refpot2 = di.readcalcpotential('reference_files/potential2.dat')
    pot2 = di.readcalcpotential('testfiles/potentialtest2.dat')
    assert np.all(pot2-refpot2 < 0.01)

def test_energies():
    """The function tests the energies
    """
Exemplo n.º 3
0
import inputtests as it
DATALINES4 = it.reader('input_files/Schroedinger4.inp')
START4 = it.getxmin(DATALINES4)
STOP4 = it.getxmax(DATALINES4)
N4 = it.getnumofpoints(DATALINES4) - 1
X4 = np.linspace(START4, STOP4, N4 + 1)
INTTYPE4 = it.interpolationtype(DATALINES4)  #type of interpolation
A4 = it.getA(DATALINES4)
VX4 = np.asarray_chkfinite(it.getxvalues(DATALINES4),
                           dtype=np.float64,
                           order='C')
VY4 = np.asarray_chkfinite(it.getyvalues(DATALINES4),
                           dtype=np.float64,
                           order='C')
FVALUE4 = it.getfirsteigen(DATALINES4) - 1
LVALUE4 = it.getlasteigen(DATALINES4) - 1
NUMEV4 = LVALUE4 - FVALUE4
AA4 = it.eigen(VX4, VY4, X4, INTTYPE4, FVALUE4, LVALUE4, A4, N4)
EIVAL4 = AA4[0]
so.saveeigenvaluestest(EIVAL4, FVALUE4, LVALUE4, 'testfiles/energietest4.dat')
so.savepotentialtest(slv.potential(VX4, VY4, X4, INTTYPE4), X4,
                     'testfiles/potentialtest4.dat')


def test_potential():
    """The funtion tests the potential
    """
    refpot4 = di.readcalcpotential('reference_files/potential4.dat')
    pot4 = di.readcalcpotential('testfiles/potentialtest4.dat')
    assert np.all(pot4 - refpot4 < 0.01)
Exemplo n.º 4
0
import datainput as di
import solver as slv
import saveoutput as so
import numpy as np
import inputtests as it
DATALINES5 = it.reader('input_files/Schroedinger5.inp')
START5 = it.getxmin(DATALINES5)
STOP5 = it.getxmax(DATALINES5)
N5 = it.getnumofpoints(DATALINES5)-1
X5 = np.linspace(START5, STOP5, N5+1)
INTTYPE5 = it.interpolationtype(DATALINES5) #type of interpolation
A5 = it.getA(DATALINES5)
VX5 = np.asarray_chkfinite(it.getxvalues(DATALINES5), dtype=np.float64, order='C')
VY5 = np.asarray_chkfinite(it.getyvalues(DATALINES5), dtype=np.float64, order='C')
FVALUE5 = it.getfirsteigen(DATALINES5)-1
LVALUE5 = it.getlasteigen(DATALINES5)-1
NUMEV5 = LVALUE5-FVALUE5
AA5 = it.eigen(VX5, VY5, X5, INTTYPE5, FVALUE5, LVALUE5, A5, N5)
EIVAL5 = AA5[0]
so.saveeigenvaluestest(EIVAL5, FVALUE5, LVALUE5, 'testfiles/energietest5.dat')
so.savepotentialtest(slv.potential(VX5, VY5, X5, INTTYPE5), X5, 'testfiles/potentialtest5.dat')
def test_potential():
    """The funtion tests the potential
    """
    refpot5 = di.readcalcpotential('reference_files/potential5.dat')
    pot5 = di.readcalcpotential('testfiles/potentialtest5.dat')
    assert np.all(pot5-refpot5 < 0.01)

def test_energies():
    """The function tests the energies
    """
Exemplo n.º 5
0
import inputtests as it
DATALINES6 = it.reader('input_files/Schroedinger6.inp')
START6 = it.getxmin(DATALINES6)
STOP6 = it.getxmax(DATALINES6)
N6 = it.getnumofpoints(DATALINES6) - 1
X6 = np.linspace(START6, STOP6, N6 + 1)
INTTYPE6 = it.interpolationtype(DATALINES6)  #type of interpolation
A6 = it.getA(DATALINES6)
VX6 = np.asarray_chkfinite(it.getxvalues(DATALINES6),
                           dtype=np.float64,
                           order='C')
VY6 = np.asarray_chkfinite(it.getyvalues(DATALINES6),
                           dtype=np.float64,
                           order='C')
FVALUE6 = it.getfirsteigen(DATALINES6) - 1
LVALUE6 = it.getlasteigen(DATALINES6) - 1
NUMEV6 = LVALUE6 - FVALUE6
AA6 = it.eigen(VX6, VY6, X6, INTTYPE6, FVALUE6, LVALUE6, A6, N6)
EIVAL6 = AA6[0]
so.saveeigenvaluestest(EIVAL6, FVALUE6, LVALUE6, 'testfiles/energietest6.dat')
so.savepotentialtest(slv.potential(VX6, VY6, X6, INTTYPE6), X6,
                     'testfiles/potentialtest6.dat')


def test_potential():
    """The funtion tests the potential
    """
    refpot6 = di.readcalcpotential('reference_files/potential6.dat')
    pot6 = di.readcalcpotential('testfiles/potentialtest6.dat')
    assert np.all(pot6 - refpot6 < 0.01)
import inputtests as it
DATALINES3 = it.reader('input_files/Schroedinger3.inp')
START3 = it.getxmin(DATALINES3)
STOP3 = it.getxmax(DATALINES3)
N3 = it.getnumofpoints(DATALINES3) - 1
X3 = np.linspace(START3, STOP3, N3 + 1)
INTTYPE3 = it.interpolationtype(DATALINES3)  #type of interpolation
A3 = it.getA(DATALINES3)
VX3 = np.asarray_chkfinite(it.getxvalues(DATALINES3),
                           dtype=np.float64,
                           order='C')
VY3 = np.asarray_chkfinite(it.getyvalues(DATALINES3),
                           dtype=np.float64,
                           order='C')
FVALUE3 = it.getfirsteigen(DATALINES3) - 1
LVALUE3 = it.getlasteigen(DATALINES3) - 1
NUMEV3 = LVALUE3 - FVALUE3
AA3 = it.eigen(VX3, VY3, X3, INTTYPE3, FVALUE3, LVALUE3, A3, N3)
EIVAL3 = AA3[0]
so.saveeigenvaluestest(EIVAL3, FVALUE3, LVALUE3, 'testfiles/energietest3.dat')
so.savepotentialtest(slv.potential(VX3, VY3, X3, INTTYPE3), X3,
                     'testfiles/potentialtest3.dat')


def test_potential():
    """The funtion tests the potential
    """
    refpot3 = di.readcalcpotential('reference_files/potential3.dat')
    pot3 = di.readcalcpotential('testfiles/potentialtest3.dat')
    assert np.all(pot3 - refpot3 < 0.01)