Fixing some layers of atoms at both the ends of the simulation box during uniaxial tensile/compressive loading

I’m doing some dummy experiments on a routine work on tensile/compressive loading of nanopillars. I’ve found in some literatures that while doing such loading some atomic layers are fixed and undeformed while the rest of the nanopillar is deformed.
I’ve designed such an experiment (schematic attached in the link below? where I’ll need to deform the region a A along the Y axis while keeping the region B and B’ virtually undeformed to simulate the exact effect of the gripped region of a tensile test sample.
Will using “fix region” to define the region A and then doing a “fix group” to group the atoms of the group A and only deforming that group of atoms by a “fix deform” do the trick?
Thanks in advance.

trying to keep some atoms immobilized while others are moving when deforming a periodic box will always lead to some inconsistencies.

a) if you keep atoms immobile through not time integrating them or setting force and velocity to zero but include them into the fix group that deforms the system, the atoms are not truly immobile in real space, as they get moved through the box dilation. those atoms are only immobile in fractional coordinates.

b) immobilize atoms by not time integrating them or setting force and velocity to zero and you exclude atoms from the box dilation instead, they do not move in real space, but now the atoms that are dilated will be pushed toward those immobile atoms in an unphysical fashion and thus are creating undesired additional forces. this effect can be reduced by putting the immobile group into the center of the reference point for dilation of the box, but it cannot be avoided.

so whatever you do, there is a conceptual problem, and you have to choose which option is less problematic in your specific case.