materialsproject / custodian

A simple, robust and flexible just-in-time job management framework in Python.
MIT License
137 stars 108 forks source link

VASP handler needed for `ERROR: there must be 1 or 3 items on line 2 of POSCAR` #291

Open Andrew-S-Rosen opened 1 year ago

Andrew-S-Rosen commented 1 year ago

Email (Optional)

No response

Version

2023.7.22

Which OS(es) are you using?

What happened?

There is a (new?) VASP error shown below. It occurs when you make a POSCAR file with Windows line-endings. Changing the encoding fixes the POSCAR every time. This isn't really a high-priority thing since it will only ever happen if the user is making input files manually, in which case they probably aren't using Custodian.

 -----------------------------------------------------------------------------
|                                                                             |
|     EEEEEEE  RRRRRR   RRRRRR   OOOOOOO  RRRRRR      ###     ###     ###     |
|     E        R     R  R     R  O     O  R     R     ###     ###     ###     |
|     E        R     R  R     R  O     O  R     R     ###     ###     ###     |
|     EEEEE    RRRRRR   RRRRRR   O     O  RRRRRR       #       #       #      |
|     E        R   R    R   R    O     O  R   R                               |
|     E        R    R   R    R   O     O  R    R      ###     ###     ###     |
|     EEEEEEE  R     R  R     R  OOOOOOO  R     R     ###     ###     ###     |
|                                                                             |
|     ERROR: there must be 1 or 3 items on line 2 of POSCAR                   |
|                                                                             |
|       ---->  I REFUSE TO CONTINUE WITH THIS SICK JOB ... BYE!!! <----       |
|                                                                             |
 -----------------------------------------------------------------------------

Code snippet

No response

Log output

No response

Code of Conduct

shyuep commented 3 months ago

One way to sort this out easily is to convert all input files to Unix line endings before the start of a job. It is just a call to dos2unix * before the start of a run? E.g.,

if os.name == "posix":
    os.system("dos2unix *")

I would imagine this has negligible CPU cost.

Andrew-S-Rosen commented 3 months ago

Good suggestion. My only concern with this is that not all machines may have this utility (Wikipedia says it's not part of the Unix standard, although I imagine most machines do have it.

Of course, this is easy to get around: simply catch an exception and move on.

Edit: And it should not be * because Custodian can now be run on directories other than the pwd.