custodian icon indicating copy to clipboard operation
custodian copied to clipboard

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

Open Andrew-S-Rosen opened this issue 2 years ago • 2 comments

Email (Optional)

No response

Version

2023.7.22

Which OS(es) are you using?

  • [ ] MacOS
  • [ ] Windows
  • [x] Linux

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

  • [X] I agree to follow this project's Code of Conduct

Andrew-S-Rosen avatar Sep 14 '23 01:09 Andrew-S-Rosen

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.

shyuep avatar Jun 25 '24 04:06 shyuep

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.

Andrew-S-Rosen avatar Jun 25 '24 09:06 Andrew-S-Rosen