PytLab / VASPy

Manipulating VASP files with Python.
https://pypi.python.org/pypi/vaspy/
MIT License
268 stars 97 forks source link

vaspy路径错误 #7

Closed YYangZiXin closed 6 years ago

YYangZiXin commented 6 years ago

在cannopy环境中,C:\Users\y7216\Downloads\VASPy-master\scripts\md_viz\map.py路径下运行vasp包中的map程序发生报错:

C:\Users\y7216\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\matplotlib\pyplot.py:524: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
  max_open_warning, RuntimeWarning)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
C:\Users\y7216\Downloads\VASPy-master\scripts\md_viz\map.py in <module>()
     29     # Merge all positions.
     30 
---> 31     trajs = get_trajectories()
     32     positions = np.concatenate(trajs)
     33 
C:\Users\y7216\Downloads\VASPy-master\scripts\md_viz\traj.py in get_trajectories()
     12 
     13 def get_trajectories():
---> 14     xdatcar = XdatCar()
     15     ani = AniFile()
     16 
C:\Users\y7216\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\vaspy\atomco.py in __init__(self, filename)
    488           ============  =======================================================
    489         """
--> 490         AtomCo.__init__(self, filename)
    491         self.info_nline = 7  # line numbers of lattice info
    492         self.load()
C:\Users\y7216\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\vaspy\atomco.py in __init__(self, filename)
     24     "Base class to be inherited by atomco classes."
     25     def __init__(self, filename):
---> 26         VasPy.__init__(self, filename)
     27 
     28     def verify(self):
C:\Users\y7216\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\vaspy\__init__.py in __init__(self, filename)
     30         # Check filename validity.
     31 
---> 32         if not os.path.exists(filename):
     33             raise ValueError("{} not exist!!!".format(filename')+'!)
     34 
ValueError: XDATCAR not exist. 

在map代码报错位置前一行添加: print(os.path)语句后,结果中增加了一行: %run "C:/Users/y7216/Downloads/VASPy-master/scripts/md_viz/map.py" C:\Users\y7216\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\matplotlib\pyplot.py:524: RuntimeWarning: More than 20 figures have been opened. 同样的问题也存在test系列程序中

Traceback (most recent call last):
  File "C:\Users\y7216\Downloads\VASPy-master\tests\incar_test.py", line 23, in test_rdata
    incar = InCar(filename)
  File "C:\Users\y7216\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\vaspy\incar.py", line 32, in __init__
    super(self.__class__, self).__init__(filename)
  File "C:\Users\y7216\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\vaspy\__init__.py", line 32, in __init__
    if not os.path.exists(filename):
ValueError: ./testdata/INCAR not exist.

----------------------------------------------------------------------
Ran 9 tests in 0.016s

FAILED (errors=8)
YYangZiXin commented 6 years ago

卸载cannopy用官方python运行成功

PytLab commented 6 years ago

上面的问题主要是没有数据文件造成的,需要有相应的XDATCAR和INCAR来实例化InCarXdatCar