Project: s41467-024-51319-4 | Function: instant_simpShearXz (cpp)

system: You are an expert C++ programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow C++ best practices and maintain consistent code style.
Return **only** the complete C++ function code.

user: Complete this C++ function:

**DESCRIPTION:** Applies instantaneous simple shear deformation in xz-plane to simulate cyclic quasi-static shear

**KEY TERMS:** {
  "dstrain": "incremental shear strain",
  "box": "simulation box parameters",
  "pos": "particle positions",
  "boxH": "box transformation matrix",
  "unwarpPos": "unwrapped particle positions"
}

**CONTEXT CODE:**
    update->forceUnits = update->energyUnits / update->distanceUnits;
    update->velocityUnits = sqrt(update->energyUnits / update->massUnits);
    update->pressureUnits = update->energyUnits / pow(update->distanceUnits, DIM);
    update->volumeUnits = pow(update->distanceUnits, DIM);
}

void instant_inflate(Box *box, Particle *particle, Update *update, double deltaVF) {
    double volfrac_target = update->volFrac + deltaVF;
    double sfact = pow(volfrac_target / update->volFrac, 1.0 / DIM);
    particle->meanDiameter *= sfact;
    update->volFrac = pow(sfact, DIM) * update->volFrac;
    setUnits(update, particle->meanDiameter);
    
    update->Edone = update->Pdone = update->Tdone = false;
    particle->isForceValid = false;
    update->nebrList.isValid = false;
    update->nebrList.compelInit = true;
}

#if defined(__triBox__)
void instant_simpShearXz(Box *box, Particle *particle, Update *update, double deltaGamma) {
    adjustImg(box, particle);
    
    for (int iatom = 0; iatom < particle->nAtom; iatom++) {
        particle->pos[iatom][0] += particle->pos[iatom][DIM - 1] * deltaGamma;
    }
    
    box->boxH[spaceIdx2voigt(0, DIM - 1)] += deltaGamma * box->boxH[spaceIdx2voigt(DIM - 1, DIM - 1)];
    
    setBoxPara(box);
    
    update->Edone = update->Pdone = update->Tdone = false;
    particle->isForceValid = false;
    update->nebrList.isValid = false;
    update->nebrList.compelInit = true;
}
#if (DIM == 3)
void instant_simpShearXy(Box *box, Particle *particle, Update *update, double deltaGamma) {
    adjustImg(box, particle);
    
    for (int iatom = 0; iatom < particle->nAtom; iatom++) {
        particle->pos[iatom][0] += particle->pos[iatom][1] * deltaGamma;
    }
    box->boxH[spaceIdx2voigt(0, 2)] += box->boxH[spaceIdx2voigt(1, 2)] * deltaGamma;
    box->boxH[spaceIdx2voigt(0, 1)] += box->boxH[spaceIdx2voigt(1, 1)] * deltaGamma;
    
    setBoxPara(box);
    
    update->Edone = update->Pdone = update->Tdone = false;
    particle->isForceValid = false;
    update->nebrList.isValid = false;
    update->nebrList.compelInit = true;
}
void instant_simpShearYz(Box *box, Particle *particle, Update *update, double deltaGamma) {
    adjustImg(box, particle);
    
    for (int iatom = 0; iatom < particle->nAtom; iatom++) {
        particle->pos[iatom][1] += particle->pos[iatom][2] * deltaGamma;
    }
    
    box->boxH[spaceIdx2voigt(1, 2)] += box->boxH[spaceIdx2voigt(2, 2)] * deltaGamma;
    setBoxPara(box);
    
    update->Edone = update->Pdone = update->Tdone = false;
    particle->isForceValid = false;
    update->nebrList.isValid = false;
    update->nebrList.compelInit = true;
}
#endif
#endif

void instant_pureShearXz(Box *box, Particle *particle, Update *update, double deltaStrain) {
    adjustImg(box, particle);
    
    double scaleX = exp(0.5 * deltaStrain);
    
    for (int iatom = 0; iatom < particle->nAtom; iatom++) {
        particle->pos[iatom][DIM - 1] /= scaleX;
        particle->pos[iatom][0] *= scaleX;
    }
    
    for (int idim = 0; idim < DIM - 1; idim++) {
        box->boxH[spaceIdx2voigt(0, idim)] *= scaleX;
    }
    box->boxH[spaceIdx2voigt(DIM - 1, DIM - 1)] /= scaleX;
    
    setBoxPara(box);
    
    update->Edone = update->Pdone = update->Tdone = false;
    particle->isForceValid = false;
    update->nebrList.isValid = false;
    update->nebrList.compelInit = true;
}
void instant_deformation(Box *box, Particle *particle, Update *update, uptriMat transMat) {
    // Rt = R0 + transMat * R0;
    adjustImg(box, particle);
    
    uptriMat trans;
    uptriMatCpy(trans, transMat);