Less stringent alternative to `fix 1 corner setforce 0.0 0.0 NULL`?

I’m trying to study a 3 layer graphene system where I need to control the relative stacking between the two outer layer atoms of my system. Specifically, the two outer layers have the same orientation (but can be slided with respect to each other) and the middle layer is rotated to form a moire system. To keep the relative orientation of the outer layers, I am fixing three corner atoms of each layer. However, for specific stacking cases, these 3 atoms are not on top of each other. It leads to some local distortions, as illustrated here using a map generated from the potential energy for each atom in one of the 3 layers. We observe the moire system where the purple losange indicates the simulation cell used in LAMMPS.

The circle indicates the location of the 3 atoms that are fixed. The arrow indicates which distortion I am talking about.

A hacky way would be for me to find some other atoms to fix so that this doesn’t happen. The problem is that in some sliding values, there might not be such 3 atoms on top of each other, and one would have to fix maybe 2 atoms on top of each other from 2 layers and the 6 atoms of a hexagon from the 3d layer.

Another I am thinking of, which would be more systematic and generic, but would require some suggestion from someone here: instead of fixing the atoms to be fixed completely, is there a way in LAMMPS to limit the total displacement any atom can make during the whole minimization process? If I don’t limit or fix this, the system will evolve into one of the more stable configurations… but if I limit it, I hope it will still go to the local high symmetry configuration.

You could try to “anchor” the individual carbon atoms: create a lattice of particles corresponding to your desired moire pattern, make those immobile, and then give each of your real carbon atoms a bond of zero equilibrium length to its corresponding lattice particle. By controlling the bond strength you effectively decide how much or little to constrain the carbon atoms’ dynamics.

Or just use fix spring/self.