QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: sukhito teh on April 10, 2024, 10:43

Title: Constraints_data parameter in function "writePOSCAR"
Post by: sukhito teh on April 10, 2024, 10:43
Dear developers and users,
I am using QATK Version: T-2022.03 . May I know how can I pass information to parameter 'constrained_data' within the 'writePOSCAR' function? Thanks for your attention.

best regards
Sukhito Teh
Title: Re: Constraints_data parameter in function "writePOSCAR"
Post by: Anders Blom on April 12, 2024, 23:44
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

Code: python
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.
Title: Re: Constraints_data parameter in function "writePOSCAR"
Post by: sukhito teh on April 15, 2024, 11:48
Thanks for your reply.