jkitchin / vasp

New ASE compliant Python interface to VASP
122 stars 58 forks source link

TypeError When Using Vasp() #58

Closed WhoStoleMyPudding closed 3 years ago

WhoStoleMyPudding commented 3 years ago

Hi developers, I was just trying out the CO example. However, it produced the following erro. I am pretty new to this. Could you please help me and tell me what probably went wrong?

Traceback (most recent call last): File "CO_ex.py", line 16, in <module> atoms=co) File "/groups/caiw/DFT/vasp-python3/vasp/vasp.py", line 41, in inner return func(self, *args, **kwargs) File "/groups/caiw/DFT/vasp-python3/vasp/vasp_core.py", line 256, in __init__ str(label), atoms) File "/groups/caiw/DFT/vasp-python3/vasp/vasp.py", line 41, in inner return func(self, *args, **kwargs) File "/home/kaiwenwang/.local/lib/python3.7/site-packages/ase/calculators/calculator.py", line 901, in __init__ atoms, **kwargs) File "/groups/caiw/DFT/vasp-python3/vasp/vasp.py", line 41, in inner return func(self, *args, **kwargs) File "/home/kaiwenwang/.local/lib/python3.7/site-packages/ase/calculators/calculator.py", line 501, in __init__ self.read(restart) # read parameters, atoms and results File "/groups/caiw/DFT/vasp-python3/vasp/vasp.py", line 41, in inner return func(self, *args, **kwargs) File "/groups/caiw/DFT/vasp-python3/vasp/readers.py", line 269, in read if self.get_state() == Vasp.NEB: File "/groups/caiw/DFT/vasp-python3/vasp/vasp.py", line 41, in inner return func(self, *args, **kwargs) File "/groups/caiw/DFT/vasp-python3/vasp/vasp_core.py", line 793, in get_state for f in ['INCAR', 'POSCAR', 'POTCAR']] File "/groups/caiw/DFT/vasp-python3/vasp/vasp_core.py", line 793, in <listcomp> for f in ['INCAR', 'POSCAR', 'POTCAR']] File "/groups/caiw/Anaconda/lib/python3.7/posixpath.py", line 80, in join a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType

By the way, I tried using the ase.calculators.vasp and it worked, so I suppose it's not a problem of $VASP_PP_PATH setup?

Much appreciated.

MAHines commented 3 years ago

I have the same problem. I "solved" it by downgrading to ase version 3.18.0.

WhoStoleMyPudding commented 3 years ago

I have the same problem. I "solved" it by downgrading to ase version 3.18.0.

Thank you, MAHines. I tried it out and it does seem to make a difference since the code used to be stuck at the line

Calc=Vasp(blablabla),

and now it could run this line and I found the INCAR, KPOINTS, POSCAR, POTCAR file in the assigned folder. However, it's producing this new issue when I try to continue with get_forces(), get_potential_energy():

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/groups/caiw/Anaconda/lib/python3.7/site-packages/ase/atoms.py", line 728, in get_forces forces = self._calc.get_forces(self) File "/groups/caiw/DFT/vasp-python3/vasp/vasp.py", line 41, in inner return func(self, *args, **kwargs) File "/groups/caiw/Anaconda/lib/python3.7/site-packages/ase/calculators/calculator.py", line 632, in get_forces return self.get_property('forces', atoms) File "/groups/caiw/DFT/vasp-python3/vasp/vasp.py", line 41, in inner return func(self, *args, **kwargs) File "/groups/caiw/Anaconda/lib/python3.7/site-packages/ase/calculators/calculator.py", line 668, in get_property self.calculate(atoms, [name], system_changes) File "/groups/caiw/DFT/vasp-python3/vasp/vasp.py", line 41, in inner return func(self, *args, **kwargs) File "/groups/caiw/DFT/vasp-python3/vasp/runner.py", line 228, in calculate input=script, encoding='utf-8') File "/groups/caiw/Anaconda/lib/python3.7/subprocess.py", line 488, in run with Popen(*popenargs, **kwargs) as process: File "/groups/caiw/Anaconda/lib/python3.7/subprocess.py", line 800, in __init__ restore_signals, start_new_session) File "/groups/caiw/Anaconda/lib/python3.7/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'bsub': 'bsub' I supposed it's still a problem of the ASE?

WhoStoleMyPudding commented 3 years ago

Wait, I checked out the runner.py and found out that this is for LSF systems while my scheduler is PBS (I'm using the python3 branch). I suppose this is the problem? I tried to alter the runner.py file by myself but I'm an amateur in this and it is still not working. I'm wondering is there a branch or someone's fork that works for PBS scheduler (and also Python3 is even better)?

MAHines commented 3 years ago

Have you modified vasprc.py to know where your vasp is? From what you say, it sounds like your calculation is being setup OK, but VASP itself is not being started.

Since I use a different scheduler, I do something like the following when setting up the calculation:

runfile = write_VASP_runfile(runDict['cores'], runDict['local'], runDict['build'])
name = 'vasp.executable.serial'
calc = Vasp(calcName_prerelax,
                    atoms = slab,
                    blah, blah, blah)
calc.VASPRC[name] = runfile

where the function write_VASP_runfile returns the name of an executable file that starts up VASP. As an example, here is a typical runfile for running on a supercomputer:

#!/usr/bin/env python
import os

parcmd = 'srun -n 32 -c 16 --cpu_bind=cores vasp_std >> mahVASP.out'
exitcode = os.system(parcmd)

The advantage of this approach (for me) is that I can run on either my Mac or a supercomputer just by making the appropriate modifications to the runfile.

WhoStoleMyPudding commented 3 years ago

Thank you for your reply. I am beginning to understand these codes a bit and seems like there are a lot of things that I need to tweak.