Got problems in generating vasp input files for structure with changed selective dynamics

Hi guys
I read a structure with previously customized selective dynamics. Then, I made all the atoms in the structure movable, and created a vasp inputset for the structure with new selective dynamics. However, the POSCAR file generated from the inputset showed that there were still some fixed atoms.

Here’s my test code:

from atomate.vasp.database import VaspCalcDb
from pymatgen.core import Structure
from pymatgen.io.vasp.sets import MPRelaxSet

#read the initial struture

mmdb=VaspCalcDb.from_db_file(‘db.json’,admin=True)
d=mmdb.collection.find_one({“task_label”:{"$regex":“initopt”}})
s=Structure.from_dict(d[“output”][“structure”])

#check the selective dynamics of the initial structure

[site.selective_dynamics for site in s]
[[True, True, True], [True, True, True], [False, False, False],…]

#make all the atoms movable and check the selective dynamics of the new structure

for i in range(s.num_sites):
… s[i].selective_dynamics=[True,True,True]

[site.selective_dynamics for site in s]
[[True, True, True], [True, True, True], [True, True, True],…]

#create vasp inputset and generate input files in the current directory

vasp_input_set = MPRelaxSet(s,force_gamma=True,user_incar_settings={‘LDAU’:False},user_kpoints_settings={‘reciprocal_density’:150})
vasp_input_set.write_input(".")

and one atom line in the generated POSCAR ends with “F F F”. By the way, I had added the selective dynamics to the initial structure like this:
structure.add_site_property(“selective_dynamics”,mobility_array)
and the POSCAR of the initial structure is right

I wonder what causes the problem and how to fix it. Many thanks for any help.

I’ve got the solution: the selective dynamics must be overriden by executing “add_site_property” again. but I still have no idea about the underlying mechanism.