# Can I do a "constrained" geometry optimization in Quantum ESPRESSO, such that certain dopants appear in certain positions even after relaxation?

I am studying the magnetic properties of bulk ZnO, so I am doping it with transition metal elements in order to observe the magnetic spectrum. I replace a Zn atom with a transition metal element at different positions (first nearest neighbor, second nearest neighbor ...) at different concentrations. So the distance between atoms is very important in this study. The problem is I don't know how to relax my structure because after the vc-relax calculation all the atoms change the position and the transition element which I consider as the second-neighbor becomes the first-neighbor! I don't know exactly how can I optimize my structure?

In the attachment below, the Vanadium atom is chosen to be the second neighbor of the other vanadium atom (here I have dopped with two vanadium atoms) but after the vc-relax the position changes in a way that it becomes the first nearest neighbor! Does the optimization of cell parameters (i.e running test convergence on a and c parameters) is enough even if it is a supercell?

• Welcome to our site!
– Camps
Feb 17 '21 at 22:14
• A figure showing what your starting guess and final structure is would be helpful Feb 18 '21 at 6:35
• Is this also your account? I can merge these together for you, we generally prefer users to only have one account on a given site
– Tyberius
Feb 18 '21 at 16:28

Yes, you can! In the Quantum ESPRESSO input file, in the "ATOMIC_POSITIONS" card, you have to present the atom name and its coordinates, something like:

ATOMIC_POSITIONS {crystal}

    Atom_name  x_atom  y_atom  z_atom


There are three default variables: if_pos(1), if_pos(2), and if_pos(3) set to unity, acting as weights for the force. So to keep the atomic position unchanged during the relaxation process, change them to zero (for the atoms you want to keep still). Something like this:

ATOMIC_POSITIONS {crystal}

    Atom_name  x_atom  y_atom  z_atom 0 0 0

• I want to note that if you only fix a single atom, the structure will effectively be unconstrained. You need to fix at least a bond or two and this should work. Feb 23 '21 at 3:15
• thank you for your suggestion, I will try it Feb 24 '21 at 12:04