mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 04:13:47 +01:00
Fixed 'vaspio' tests
Added 'rpath.py' module to determine the current directory. Also fixed the test example for EIGENVAL: VASP 5.4 uses a format with Fermi weights output (unlike previous versions).
This commit is contained in:
parent
3aba5f4135
commit
dda331b986
@ -3,48 +3,114 @@
|
|||||||
1.000000000000000E-004
|
1.000000000000000E-004
|
||||||
CAR
|
CAR
|
||||||
V
|
V
|
||||||
11 4 9
|
11 10 9
|
||||||
|
|
||||||
0.0000000E+00 0.0000000E+00 0.0000000E+00 0.3703704E-01
|
0.0000000E+00 0.0000000E+00 0.0000000E+00 0.8000000E-02
|
||||||
1 -31.099965
|
1 -30.901243 1.000000
|
||||||
2 -31.099965
|
2 -30.901242 1.000000
|
||||||
3 -31.099965
|
3 -30.901242 1.000000
|
||||||
4 -0.813470
|
4 -0.812822 1.000000
|
||||||
5 5.974027
|
5 6.116281 0.307472
|
||||||
6 5.974027
|
6 6.116282 0.000314
|
||||||
7 5.974027
|
7 6.116282 0.000000
|
||||||
8 7.986328
|
8 8.139559 0.000000
|
||||||
9 7.986328
|
9 8.139559 0.000000
|
||||||
|
|
||||||
0.3333333E+00 0.0000000E+00 0.0000000E+00 0.4444444E+00
|
0.2000000E+00 0.0000000E+00 0.0000000E+00 0.9600000E-01
|
||||||
1 -31.819277
|
1 -31.244548 1.000000
|
||||||
2 -31.322999
|
2 -31.006017 1.000000
|
||||||
3 -31.105684
|
3 -30.904003 1.000000
|
||||||
4 2.193081
|
4 0.680258 1.000000
|
||||||
5 4.784864
|
5 5.527848 0.997357
|
||||||
6 5.839340
|
6 5.837887 0.407717
|
||||||
7 7.833446
|
7 7.226963 0.000000
|
||||||
8 8.202781
|
8 7.781889 0.000000
|
||||||
9 8.589551
|
9 8.207361 0.000000
|
||||||
|
|
||||||
0.3333333E+00 0.3333333E+00 0.0000000E+00 0.2962963E+00
|
0.4000000E+00 0.0000000E+00 0.0000000E+00 0.9600000E-01
|
||||||
1 -31.750021
|
1 -31.771778 1.000000
|
||||||
2 -31.750021
|
2 -31.171899 1.000000
|
||||||
3 -31.217560
|
3 -30.908401 1.000000
|
||||||
4 3.978315
|
4 2.486834 1.000000
|
||||||
5 4.708263
|
5 4.687631 1.003771
|
||||||
6 4.708263
|
6 6.633241 -0.148217
|
||||||
7 8.262522
|
7 8.121131 0.000000
|
||||||
8 8.262522
|
8 8.444990 0.000000
|
||||||
9 14.771374
|
9 9.443636 0.000000
|
||||||
|
|
||||||
-0.3333333E+00 0.3333333E+00 0.3333333E+00 0.2222222E+00
|
0.2000000E+00 0.2000000E+00 0.0000000E+00 0.1920000E+00
|
||||||
1 -31.719893
|
1 -31.593915 1.000000
|
||||||
2 -31.577292
|
2 -31.156860 1.000000
|
||||||
3 -31.577292
|
3 -30.976267 1.000000
|
||||||
4 3.383714
|
4 2.768444 1.000000
|
||||||
5 3.756320
|
5 4.858815 1.008186
|
||||||
6 7.355029
|
6 5.229541 1.085485
|
||||||
7 7.355029
|
7 7.709737 0.000000
|
||||||
8 8.411511
|
8 8.541449 0.000000
|
||||||
9 11.054129
|
9 9.490980 0.000000
|
||||||
|
|
||||||
|
0.4000000E+00 0.2000000E+00 -0.5551115E-16 0.1920000E+00
|
||||||
|
1 -31.739891 1.000000
|
||||||
|
2 -31.337400 1.000000
|
||||||
|
3 -30.997116 1.000000
|
||||||
|
4 3.394894 1.000000
|
||||||
|
5 4.629829 1.000179
|
||||||
|
6 5.695587 0.810394
|
||||||
|
7 8.098534 0.000000
|
||||||
|
8 8.743598 0.000000
|
||||||
|
9 12.244586 0.000000
|
||||||
|
|
||||||
|
0.2000000E+00 0.2000000E+00 0.2000000E+00 0.6400000E-01
|
||||||
|
1 -31.617656 1.000000
|
||||||
|
2 -31.220150 1.000000
|
||||||
|
3 -31.220150 1.000000
|
||||||
|
4 4.450254 1.000000
|
||||||
|
5 4.450254 1.000000
|
||||||
|
6 4.634359 1.062133
|
||||||
|
7 8.491526 0.000000
|
||||||
|
8 8.491526 0.000000
|
||||||
|
9 12.973660 0.000000
|
||||||
|
|
||||||
|
-0.2000000E+00 0.2000000E+00 0.2000000E+00 0.4800000E-01
|
||||||
|
1 -31.296977 1.000000
|
||||||
|
2 -31.117861 1.000000
|
||||||
|
3 -31.117861 1.000000
|
||||||
|
4 1.927890 1.000000
|
||||||
|
5 5.995969 0.879283
|
||||||
|
6 6.272225 -0.010798
|
||||||
|
7 6.272226 0.000000
|
||||||
|
8 7.198547 0.000000
|
||||||
|
9 8.910235 0.000000
|
||||||
|
|
||||||
|
-0.4000000E+00 0.4000000E+00 0.2000000E+00 0.1920000E+00
|
||||||
|
1 -31.682485 1.000000
|
||||||
|
2 -31.294549 1.000000
|
||||||
|
3 -31.142973 1.000000
|
||||||
|
4 3.381464 1.000000
|
||||||
|
5 4.651227 1.002211
|
||||||
|
6 5.929509 0.183505
|
||||||
|
7 7.231965 0.000000
|
||||||
|
8 9.259558 0.000000
|
||||||
|
9 10.660847 0.000000
|
||||||
|
|
||||||
|
-0.4000000E+00 -0.4000000E+00 0.2000000E+00 0.6400000E-01
|
||||||
|
1 -31.585360 1.000000
|
||||||
|
2 -31.585359 1.000000
|
||||||
|
3 -31.188820 1.000000
|
||||||
|
4 3.846295 1.000000
|
||||||
|
5 3.846295 1.000298
|
||||||
|
6 5.810197 0.324984
|
||||||
|
7 8.723375 0.000000
|
||||||
|
8 8.723376 0.000000
|
||||||
|
9 15.381038 0.000000
|
||||||
|
|
||||||
|
-0.4000000E+00 0.4000000E+00 0.4000000E+00 0.4800000E-01
|
||||||
|
1 -31.554619 1.000000
|
||||||
|
2 -31.488158 1.000000
|
||||||
|
3 -31.488158 1.000000
|
||||||
|
4 3.090314 1.000000
|
||||||
|
5 3.105025 1.000861
|
||||||
|
6 8.500437 -0.068292
|
||||||
|
7 8.500437 0.000000
|
||||||
|
8 9.144518 0.000000
|
||||||
|
9 13.491662 0.000000
|
||||||
|
@ -1,52 +1,218 @@
|
|||||||
nq = 1
|
nq = 1
|
||||||
ispin = 1
|
ispin = 1
|
||||||
nelect = 11
|
nelect = 11
|
||||||
nktot = 4
|
nktot = 10
|
||||||
nband = 9
|
nband = 9
|
||||||
kpts:
|
kpts:
|
||||||
[[ 0. 0. 0. ]
|
[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00]
|
||||||
[ 0.3333333 0. 0. ]
|
[ 2.00000000e-01 0.00000000e+00 0.00000000e+00]
|
||||||
[ 0.3333333 0.3333333 0. ]
|
[ 4.00000000e-01 0.00000000e+00 0.00000000e+00]
|
||||||
[-0.3333333 0.3333333 0.3333333]]
|
[ 2.00000000e-01 2.00000000e-01 0.00000000e+00]
|
||||||
|
[ 4.00000000e-01 2.00000000e-01 -5.55111500e-17]
|
||||||
|
[ 2.00000000e-01 2.00000000e-01 2.00000000e-01]
|
||||||
|
[ -2.00000000e-01 2.00000000e-01 2.00000000e-01]
|
||||||
|
[ -4.00000000e-01 4.00000000e-01 2.00000000e-01]
|
||||||
|
[ -4.00000000e-01 -4.00000000e-01 2.00000000e-01]
|
||||||
|
[ -4.00000000e-01 4.00000000e-01 4.00000000e-01]]
|
||||||
kwghts:
|
kwghts:
|
||||||
[ 0.03703704 0.4444444 0.2962963 0.2222222 ]
|
[ 0.008 0.096 0.096 0.192 0.192 0.064 0.048 0.192 0.064 0.048]
|
||||||
eigs:
|
eigs:
|
||||||
[[[-31.099965]
|
[[[-30.901243]
|
||||||
[-31.099965]
|
[-30.901242]
|
||||||
[-31.099965]
|
[-30.901242]
|
||||||
[ -0.81347 ]
|
[ -0.812822]
|
||||||
[ 5.974027]
|
[ 6.116281]
|
||||||
[ 5.974027]
|
[ 6.116282]
|
||||||
[ 5.974027]
|
[ 6.116282]
|
||||||
[ 7.986328]
|
[ 8.139559]
|
||||||
[ 7.986328]]
|
[ 8.139559]]
|
||||||
|
|
||||||
[[-31.819277]
|
[[-31.244548]
|
||||||
[-31.322999]
|
[-31.006017]
|
||||||
[-31.105684]
|
[-30.904003]
|
||||||
[ 2.193081]
|
[ 0.680258]
|
||||||
[ 4.784864]
|
[ 5.527848]
|
||||||
[ 5.83934 ]
|
[ 5.837887]
|
||||||
[ 7.833446]
|
[ 7.226963]
|
||||||
[ 8.202781]
|
[ 7.781889]
|
||||||
[ 8.589551]]
|
[ 8.207361]]
|
||||||
|
|
||||||
[[-31.750021]
|
[[-31.771778]
|
||||||
[-31.750021]
|
[-31.171899]
|
||||||
[-31.21756 ]
|
[-30.908401]
|
||||||
[ 3.978315]
|
[ 2.486834]
|
||||||
[ 4.708263]
|
[ 4.687631]
|
||||||
[ 4.708263]
|
[ 6.633241]
|
||||||
[ 8.262522]
|
[ 8.121131]
|
||||||
[ 8.262522]
|
[ 8.44499 ]
|
||||||
[ 14.771374]]
|
[ 9.443636]]
|
||||||
|
|
||||||
[[-31.719893]
|
[[-31.593915]
|
||||||
[-31.577292]
|
[-31.15686 ]
|
||||||
[-31.577292]
|
[-30.976267]
|
||||||
[ 3.383714]
|
[ 2.768444]
|
||||||
[ 3.75632 ]
|
[ 4.858815]
|
||||||
[ 7.355029]
|
[ 5.229541]
|
||||||
[ 7.355029]
|
[ 7.709737]
|
||||||
[ 8.411511]
|
[ 8.541449]
|
||||||
[ 11.054129]]]
|
[ 9.49098 ]]
|
||||||
|
|
||||||
|
[[-31.739891]
|
||||||
|
[-31.3374 ]
|
||||||
|
[-30.997116]
|
||||||
|
[ 3.394894]
|
||||||
|
[ 4.629829]
|
||||||
|
[ 5.695587]
|
||||||
|
[ 8.098534]
|
||||||
|
[ 8.743598]
|
||||||
|
[ 12.244586]]
|
||||||
|
|
||||||
|
[[-31.617656]
|
||||||
|
[-31.22015 ]
|
||||||
|
[-31.22015 ]
|
||||||
|
[ 4.450254]
|
||||||
|
[ 4.450254]
|
||||||
|
[ 4.634359]
|
||||||
|
[ 8.491526]
|
||||||
|
[ 8.491526]
|
||||||
|
[ 12.97366 ]]
|
||||||
|
|
||||||
|
[[-31.296977]
|
||||||
|
[-31.117861]
|
||||||
|
[-31.117861]
|
||||||
|
[ 1.92789 ]
|
||||||
|
[ 5.995969]
|
||||||
|
[ 6.272225]
|
||||||
|
[ 6.272226]
|
||||||
|
[ 7.198547]
|
||||||
|
[ 8.910235]]
|
||||||
|
|
||||||
|
[[-31.682485]
|
||||||
|
[-31.294549]
|
||||||
|
[-31.142973]
|
||||||
|
[ 3.381464]
|
||||||
|
[ 4.651227]
|
||||||
|
[ 5.929509]
|
||||||
|
[ 7.231965]
|
||||||
|
[ 9.259558]
|
||||||
|
[ 10.660847]]
|
||||||
|
|
||||||
|
[[-31.58536 ]
|
||||||
|
[-31.585359]
|
||||||
|
[-31.18882 ]
|
||||||
|
[ 3.846295]
|
||||||
|
[ 3.846295]
|
||||||
|
[ 5.810197]
|
||||||
|
[ 8.723375]
|
||||||
|
[ 8.723376]
|
||||||
|
[ 15.381038]]
|
||||||
|
|
||||||
|
[[-31.554619]
|
||||||
|
[-31.488158]
|
||||||
|
[-31.488158]
|
||||||
|
[ 3.090314]
|
||||||
|
[ 3.105025]
|
||||||
|
[ 8.500437]
|
||||||
|
[ 8.500437]
|
||||||
|
[ 9.144518]
|
||||||
|
[ 13.491662]]]
|
||||||
|
ferw:
|
||||||
|
[[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 3.07472000e-01]
|
||||||
|
[ 3.14000000e-04]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 9.97357000e-01]
|
||||||
|
[ 4.07717000e-01]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00377100e+00]
|
||||||
|
[ -1.48217000e-01]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00818600e+00]
|
||||||
|
[ 1.08548500e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00017900e+00]
|
||||||
|
[ 8.10394000e-01]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.06213300e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 8.79283000e-01]
|
||||||
|
[ -1.07980000e-02]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00221100e+00]
|
||||||
|
[ 1.83505000e-01]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00029800e+00]
|
||||||
|
[ 3.24984000e-01]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]
|
||||||
|
|
||||||
|
[[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00000000e+00]
|
||||||
|
[ 1.00086100e+00]
|
||||||
|
[ -6.82920000e-02]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]
|
||||||
|
[ 0.00000000e+00]]]
|
||||||
|
5
python/vasp/test/_vaspio/rpath.py
Normal file
5
python/vasp/test/_vaspio/rpath.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
r"""
|
||||||
|
The sole role of this module is to determine the current path by
|
||||||
|
examining rpath.__file__.
|
||||||
|
"""
|
||||||
|
pass
|
@ -1 +1 @@
|
|||||||
PYTHONPATH=../../python:../../c:$PYTHONPATH python $1
|
PYTHONPATH=../..:../../../../c:$PYTHONPATH python $1
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
r"""
|
r"""
|
||||||
Tests for class 'Doscar' from module 'vaspio'
|
Tests for class 'Doscar' from module 'vaspio'
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
|
import rpath
|
||||||
|
_rpath = os.path.dirname(rpath.__file__) + '/'
|
||||||
|
|
||||||
import mytest
|
import mytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from vaspio import Doscar
|
from vaspio import Doscar
|
||||||
@ -24,7 +28,7 @@ class TestDoscar(mytest.MyTestCase):
|
|||||||
def test_example(self):
|
def test_example(self):
|
||||||
filename = 'DOSCAR.example'
|
filename = 'DOSCAR.example'
|
||||||
doscar = Doscar()
|
doscar = Doscar()
|
||||||
doscar.from_file(vasp_dir='./', dos_filename=filename)
|
doscar.from_file(vasp_dir=_rpath, dos_filename=filename)
|
||||||
|
|
||||||
test_efermi = doscar.efermi
|
test_efermi = doscar.efermi
|
||||||
expected = 5.84395237
|
expected = 5.84395237
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
r"""
|
r"""
|
||||||
Tests for class 'Eigneval' from module 'vaspio'
|
Tests for class 'Eigneval' from module 'vaspio'
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
|
import rpath
|
||||||
|
_rpath = os.path.dirname(rpath.__file__) + '/'
|
||||||
|
|
||||||
import mytest
|
import mytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from vaspio import Eigenval
|
from vaspio import Eigenval
|
||||||
@ -24,9 +28,9 @@ class TestEigenval(mytest.MyTestCase):
|
|||||||
def test_example(self):
|
def test_example(self):
|
||||||
filename = 'EIGENVAL.example'
|
filename = 'EIGENVAL.example'
|
||||||
eigenval = Eigenval()
|
eigenval = Eigenval()
|
||||||
eigenval.from_file(vasp_dir='./', eig_filename=filename)
|
eigenval.from_file(vasp_dir=_rpath, eig_filename=filename)
|
||||||
|
|
||||||
testout = 'EIGENVAL.example.out.test'
|
testout = _rpath + 'EIGENVAL.example.out.test'
|
||||||
with open(testout, 'w') as f:
|
with open(testout, 'w') as f:
|
||||||
writeline = lambda s: f.write(s + '\n')
|
writeline = lambda s: f.write(s + '\n')
|
||||||
writeprop = lambda pname: writeline("%s = %s"%(pname, eigenval.__dict__[pname]))
|
writeprop = lambda pname: writeline("%s = %s"%(pname, eigenval.__dict__[pname]))
|
||||||
@ -39,7 +43,8 @@ class TestEigenval(mytest.MyTestCase):
|
|||||||
writeline("kpts:\n%s"%(eigenval.kpts))
|
writeline("kpts:\n%s"%(eigenval.kpts))
|
||||||
writeline("kwghts:\n%s"%(eigenval.kwghts))
|
writeline("kwghts:\n%s"%(eigenval.kwghts))
|
||||||
writeline("eigs:\n%s"%(eigenval.eigs))
|
writeline("eigs:\n%s"%(eigenval.eigs))
|
||||||
|
writeline("ferw:\n%s"%(eigenval.ferw))
|
||||||
|
|
||||||
expected = 'EIGENVAL.example.out'
|
expected = _rpath + 'EIGENVAL.example.out'
|
||||||
self.assertFileEqual(testout, expected)
|
self.assertFileEqual(testout, expected)
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
r"""
|
r"""
|
||||||
Tests for class 'Ibzkpt' from module 'vaspio'
|
Tests for class 'Ibzkpt' from module 'vaspio'
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
|
import rpath
|
||||||
|
_rpath = os.path.dirname(rpath.__file__) + '/'
|
||||||
|
|
||||||
import mytest
|
import mytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from vaspio import Kpoints
|
from vaspio import Kpoints
|
||||||
@ -25,9 +29,9 @@ class TestIbzkpt(mytest.MyTestCase):
|
|||||||
def test_example(self):
|
def test_example(self):
|
||||||
ibz_file = 'IBZKPT.example'
|
ibz_file = 'IBZKPT.example'
|
||||||
kpoints = Kpoints()
|
kpoints = Kpoints()
|
||||||
kpoints.from_file(vasp_dir='./', ibz_filename=ibz_file)
|
kpoints.from_file(vasp_dir=_rpath, ibz_filename=ibz_file)
|
||||||
|
|
||||||
testout = 'IBZKPT.example.out.test'
|
testout = _rpath + 'IBZKPT.example.out.test'
|
||||||
with open(testout, 'w') as f:
|
with open(testout, 'w') as f:
|
||||||
writeline = lambda s: f.write(s + '\n')
|
writeline = lambda s: f.write(s + '\n')
|
||||||
writeline("nktot = %s"%(kpoints.nktot))
|
writeline("nktot = %s"%(kpoints.nktot))
|
||||||
@ -36,22 +40,22 @@ class TestIbzkpt(mytest.MyTestCase):
|
|||||||
writeline("kpts:\n%s"%(kpoints.kpts))
|
writeline("kpts:\n%s"%(kpoints.kpts))
|
||||||
writeline("tets:\n%s"%(kpoints.itet))
|
writeline("tets:\n%s"%(kpoints.itet))
|
||||||
|
|
||||||
expected = 'IBZKPT.example.out'
|
expected = _rpath + 'IBZKPT.example.out'
|
||||||
self.assertFileEqual(testout, expected)
|
self.assertFileEqual(testout, expected)
|
||||||
|
|
||||||
# Scenario 2
|
# Scenario 2
|
||||||
def test_notet(self):
|
def test_notet(self):
|
||||||
ibz_file = 'IBZKPT.notet'
|
ibz_file = 'IBZKPT.notet'
|
||||||
kpoints = Kpoints()
|
kpoints = Kpoints()
|
||||||
kpoints.from_file(vasp_dir='./', ibz_filename=ibz_file)
|
kpoints.from_file(vasp_dir=_rpath, ibz_filename=ibz_file)
|
||||||
|
|
||||||
testout = 'IBZKPT.notet.out.test'
|
testout = _rpath + 'IBZKPT.notet.out.test'
|
||||||
with open(testout, 'w') as f:
|
with open(testout, 'w') as f:
|
||||||
writeline = lambda s: f.write(s + '\n')
|
writeline = lambda s: f.write(s + '\n')
|
||||||
writeline("nktot = %s"%(kpoints.nktot))
|
writeline("nktot = %s"%(kpoints.nktot))
|
||||||
writeline("kpts:\n%s"%(kpoints.kpts))
|
writeline("kpts:\n%s"%(kpoints.kpts))
|
||||||
|
|
||||||
expected = 'IBZKPT.notet.out'
|
expected = _rpath + 'IBZKPT.notet.out'
|
||||||
self.assertFileEqual(testout, expected)
|
self.assertFileEqual(testout, expected)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
r"""
|
r"""
|
||||||
Tests for class 'Poscar' from module 'vaspio'
|
Tests for class 'Poscar' from module 'vaspio'
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
|
import rpath
|
||||||
|
_rpath = os.path.dirname(rpath.__file__) + '/'
|
||||||
|
|
||||||
import mytest
|
import mytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from vaspio import Poscar
|
from vaspio import Poscar
|
||||||
@ -25,9 +29,9 @@ class TestPoscar(mytest.MyTestCase):
|
|||||||
def test_example(self):
|
def test_example(self):
|
||||||
filename = 'POSCAR.example'
|
filename = 'POSCAR.example'
|
||||||
poscar = Poscar()
|
poscar = Poscar()
|
||||||
poscar.from_file(vasp_dir='./', poscar_filename=filename)
|
poscar.from_file(vasp_dir=_rpath, poscar_filename=filename)
|
||||||
|
|
||||||
testout = 'POSCAR.example.out.test'
|
testout = _rpath + 'POSCAR.example.out.test'
|
||||||
with open(testout, 'w') as f:
|
with open(testout, 'w') as f:
|
||||||
writeline = lambda s: f.write(s + '\n')
|
writeline = lambda s: f.write(s + '\n')
|
||||||
writeprop = lambda pname: writeline("%s = %s"%(pname, poscar.__dict__[pname]))
|
writeprop = lambda pname: writeline("%s = %s"%(pname, poscar.__dict__[pname]))
|
||||||
@ -39,14 +43,14 @@ class TestPoscar(mytest.MyTestCase):
|
|||||||
writeline("a_brav:\n%s"%(poscar.a_brav))
|
writeline("a_brav:\n%s"%(poscar.a_brav))
|
||||||
writeline("q_types:\n%s"%(poscar.q_types))
|
writeline("q_types:\n%s"%(poscar.q_types))
|
||||||
|
|
||||||
expected = 'POSCAR.example.out'
|
expected = _rpath + 'POSCAR.example.out'
|
||||||
self.assertFileEqual(testout, expected)
|
self.assertFileEqual(testout, expected)
|
||||||
|
|
||||||
# Scenario 2
|
# Scenario 2
|
||||||
def test_type_of_ion(self):
|
def test_type_of_ion(self):
|
||||||
filename = 'POSCAR.complex'
|
filename = 'POSCAR.complex'
|
||||||
poscar = Poscar()
|
poscar = Poscar()
|
||||||
poscar.from_file(vasp_dir='./', poscar_filename=filename)
|
poscar.from_file(vasp_dir=_rpath, poscar_filename=filename)
|
||||||
|
|
||||||
test_types = 4 * [0] + 4 * [1] + 12 * [2]
|
test_types = 4 * [0] + 4 * [1] + 12 * [2]
|
||||||
self.assertListEqual(test_types, poscar.type_of_ion)
|
self.assertListEqual(test_types, poscar.type_of_ion)
|
||||||
|
Loading…
Reference in New Issue
Block a user