Constrained relaxation, relax layers rigidly

Hi all,

I am trying to run some geometry relaxations in abinit including constraints, as described by the wtatcon flag. However, I’m a little bit confused on how to use the constraints and would appreciate some advice.

For context, I am looking at layered systems, e.g. MoS2, etc. I want to do a relaxation of a stack of layers, and have each layer move rigidly, optimizing only the distance between the layers. For example, for two layers of MoS2, I want to keep the bottom layer fixed (easily achieved with natfix), and then relax the top layer (z direction only), but preserving the relative positions of the atoms within the top layer.

Here is a simple input file showing how I think this could be done: (2.7 KB)

although it doesn’t seem to work for me. The example for wtatcon in the documentation is a little bit too simple, since it is just one constraint equation and it says “assuming the masses are equal” (do we really need to calculate the relative masses every time we want to do a constrained relaxation?..)

I would appreciate any advice if anyone has experience using these constraints


Daniel Bennett

Hi Danny,
I would use only the natfix flags in your case, not the nconeq and co (I also have to say that I never used the later and rarely the former…).
Isn’t atfix flags sufficient?
Be careful that with ionmov=2 it is constrained in reduced coordinate.
All the best,

Hi Eric,

I am in the same boat.

The natfix options work well, for fixing the atoms in the in-plane direction.

But I would like to relax the layers in the out-of-plane direction, while preserving the initial distances between the atoms within each layer. For example, in siesta, there is a geometry constraint option called rigid (see the manual, page 123). This calculates the average force on a group of atoms and moves them by the same amount each time. I am trying to achieve something similar using wtatcon but not sure if it is so straightforward