Applying a shear force wave input on a box of granular particles during uniform compression

I’m currently working on a research project involving compression of granular material in a lab made python simulator and I am trying to prove the efficacy (for a research paper) of the lab’s simulator by recreating the simulation in LAMMPS. The simulation in python is split up into two parts; one being sample preparation and the other being the experiment.

The main problems I’m having at the moment are pretty far apart in terms of difficulty (at least from what I’m expecting).

The first problem I’ve run into is in the sample preparation. The sample starts off as a rectangular prism (there are some pictures below) with a lattice of grains filling the box to a point where the top boundary can “fall” and compress the grains to a cubic shape. The problem I’m having with this part is that I do not know how to move the top boundary as if gravity had acted on it. I thought maybe introducing a particle with gravity to the top boundary might settle it but there would be a host of problems with that (how would the particle be shaped, how would a boundary be fixed at the bottom of the particle, etc). I tried having a fixed rate compression of the boundary that would compress to a point where the cube would be made however I had trouble having forces between the moving wall and the grains in the simulation (most of the grains passed straight through the moving wall). Does anyone have any suggestions on how one could mimic this movement in LAMMPS? The first picture I’ve added shows a few grains chosen randomly and their z coordinates while being compressed by a top wall given gravity (hence the damped oscillations). The top wall is then fixed after some variable number of timesteps and the sample is prepared.

My second problem is a lot more convoluted. In the experiment part of the simulation the box undergoes a uniform compression and decompression from all sides and then undergoes a similar compression but this time with a “bump” added in the form of a shear strain. The bump is quite quick and involves two sides of the box to compress while the other two walls on perpendicular axis decompress. I’ll try to add as many pictures as possible but they might not pay justice to this part. I cannot even find a project that has this form of shear strain much less one that is based on a waveform so I do not know where to begin with this part of the replication of this research project. This is the part of the project I definitely need the most help with. The second photo I’ve included has the shear strain as the bottom picture and the uniform compression processes in the two graphs above.

If anyone resources that might help please let me know.

Also if the second part is a bit ambiguous I can try to make a short gif of the shear strain.

Options for (1) I can think of include:
a) Use fix controller to try to maintain a constant gravitational force on the wall. Note that the position of fix wall can be a variable.
b) Construct a rough wall using a bunch of overlapping particles and use something like fix aveforce.

For (2), if you had an analytic fit to your target pressure, you could probably use similar fixes but it might get tricky with multiple walls. Alternatively, you could use a periodic system and use either fix deform or fix deform/pressure. Won’t give you wall effects (could be good or bad), but should be much easier to apply a complex strain- or pressure-controlled deformation protocol. In particular, fix deform/pressure lets you separately define x,y,z target pressures which can be functions of time or other pressure components.