It requires 2 steps.
1) Define constraints via tags. Supported tags are "constrain" and "constrain_x" (y, z) in order to constrain each atom fully or only in x/y/z
2) Use a few lines of code
| from AddOns.VASPPlugins.Scripter.VASPConstraintsWidget import extractConstraintsFromTags |
| from AddOns.VASPPlugins.IO import writePOSCAR |
| vasp_constraints = extractConstraintsFromTags(configuration) |
| writePOSCAR(configuration, "POSCAR", vasp_constraints) |
Example config attached, with the resulting POSCAR.
Note that you can also do this directly from the Builder, using Export and choosing the VASP format.