# How do I relax only the in-plane component of the unit cell?

I know that &CONTROL='vc-relax' option calculation performs a unit cell relaxation, and that the ATOMIC_POSITIONS can be fixed as follows:

ATOMIC_POSITIONS crystal
Fe    0.000 0.000  0.00  0  0  0
Fe    0.500 0.500  0.00  0  0  0
Se    0.500 0.000  1.33  0  0  1
Se    0.000 0.500 -1.33  0  0  1


Which I believe tells me that only the z-component of the Se atoms within the unit cell are adjusted. (This I learned from a nice tutorial by RadeMaker [1]. The pw.x documentation itself is not clear about this.)

Can I do something similarly for the unit cell parameters themselves? For example...

CELL_PARAMETERS angstrom
3.77 0.00 0.00  1  0  0
0.00 3.77 0.00  0  1  0
0.00 0.00 5.52  0  0  1


I can't find documentation detailing this, or anything clarifying on StackExchange or ResearchGate. I would very much like to prevent the boundary conditions from tilting out of the plane of the Fe atoms. Thanks!

• +1 welcome to our new community and thank you so much for contributing your question here! We hope to see much more of you in the future !!! Commented Nov 11, 2021 at 19:58

## 1 Answer

To play with parameters or vectors of unit cell, you can use following tag inside &CELL

cell_dofree CHARACTER
Default:    'all'
Select which of the cell parameters should be moved:

'all' :
all axis and angles are moved

'ibrav' :
all axis and angles are moved, but the lattice remains consistent
with the initial ibrav choice. You can use this option in combination
with any other one by specifying "ibrav+option". Please note that some
combinations do not make sense for some crystals and will guarantee that
the relax will never converge. E.g. 'ibrav+2Dxy' is not a problem for
hexagonal cells, but will never converge for cubic ones.

'x' :
only the x component of axis 1 (v1_x) is moved

'y' :
only the y component of axis 2 (v2_y) is moved

'z' :
only the z component of axis 3 (v3_z) is moved

'xy' :
only v1_x and v2_y are moved

'xz' :
only v1_x and v3_z are moved

'yz' :
only v2_y and v3_z are moved

'xyz' :
only v1_x, v2_y, v3_z are moved

'shape' :
all axis and angles, keeping the volume fixed

'volume' :
the volume changes, keeping all angles fixed (i.e. only celldm(1) changes)

'2Dxy' :
only x and y components are allowed to change

'2Dshape' :
as above, keeping the area in xy plane fixed

'epitaxial_ab' :
fix axis 1 and 2 while allowing axis 3 to move

'epitaxial_ac' :
fix axis 1 and 3 while allowing axis 2 to move

'epitaxial_bc' :
fix axis 2 and 3 while allowing axis 1 to move
Above tag may not work perfectly if cell is not orthogonal



If you don't want forces and stress to relax along certain direction, you have to edit subroutine init_dofree in file Modules/cell_base.f90 and recompile your QE.

• Thank you for pointing this out! The pw.x documentation is thorough but can be quite confusing. This seems obvious now ^.^b Commented Nov 15, 2021 at 20:48