ASE reading and writing POSCAR with selective dynamics

Hello,

I upgraded ASE from version 3.20.0b1 to 3.23.0b1
With 3.20.0b1, I was able to read and write POSCAR with selective dynamics but now I am able to add constraints to ASE atoms but writing to POSCAR gives out an error. Here is a simple reproducible example for reading a POSCAR.

For example:
from ase.io.vasp import read_vasp
atoms = read_vasp(‘POSCAR’)

The POSCAR file is as follows:

Ni6
1.0
4.309432 0.000000 0.000000
0.000000 2.488052 0.000000
0.000000 0.000000 6.094457
Ni
6
Selective dynamics
direct
0.000000 0.000000 0.000000 F F T Ni
0.333333 0.000000 0.333333 F F T Ni
0.666667 0.000000 0.666667 F F T Ni
0.500000 0.500000 -0.000000 F F T Ni
0.833333 0.500000 0.333333 F F T Ni
0.166667 0.500000 0.666667 F F T Ni

With 3.23.0b1 this gives:

Python 3.8.8 (default, Apr 13 2021, 19:58:26)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.

from ase.io.vasp import read_vasp
atoms = read_vasp(‘POSCAR’)
Traceback (most recent call last):
File “”, line 1, in
File “/home/subrahmanyam/a-appsoft/installs/anaconda3/lib/python3.8/site-packages/ase/utils/init.py”, line 486, in iofunc
obj = func(fd, *args, **kwargs)
File “/home/subrahmanyam/a-appsoft/installs/anaconda3/lib/python3.8/site-packages/ase/io/vasp.py”, line 242, in read_vasp
constraints.append(FixScaled(atoms.get_cell(), ind, sflags))
File “/home/subrahmanyam/a-appsoft/installs/anaconda3/lib/python3.8/site-packages/ase/constraints.py”, line 810, in init
super().init(a)
File “/home/subrahmanyam/a-appsoft/installs/anaconda3/lib/python3.8/site-packages/ase/constraints.py”, line 102, in init
raise ValueError('indices has wrong amount of dimensions. ’
ValueError: indices has wrong amount of dimensions. Got 2, expected ndim <= 1

Can someone please help.

Thank you